dm-vue3-ui
Version:
This Components Library will help get you started developing in Vue 3.
51,152 lines • 1.85 MB
JavaScript
import * as vue from "vue";
import { useSlots, reactive, computed, defineComponent, ref, openBlock, createBlock, resolveDynamicComponent, normalizeClass, withKeys, withModifiers, withCtx, createElementBlock, createElementVNode, createCommentVNode, renderSlot, unref, nextTick, Fragment, isVNode as isVNode$1, Comment, Text, getCurrentInstance, onMounted, onUpdated, onUnmounted, watch, inject, createVNode, provide, Transition, Teleport, TransitionGroup, render, h as h$1, watchEffect, withDirectives, resolveDirective, onBeforeUnmount, cloneVNode, toRef, vShow, onBeforeMount, createTextVNode, isRef, toRefs, shallowRef, toRaw, useAttrs, onBeforeUpdate, getCurrentScope, onScopeDispose, camelize as camelize$1, effectScope, renderList, toDisplayString as toDisplayString$1, useCssVars, normalizeStyle, mergeProps, createSlots } from "vue";
import dayjs from "dayjs";
import { DownOutlined as DownOutlined$3, ClockCircleOutlined as ClockCircleOutlined$3, CloseCircleOutlined as CloseCircleOutlined$3, SearchOutlined as SearchOutlined$3, DeleteOutlined, LeftOutlined, CloseCircleFilled as CloseCircleFilled$3 } from "@ant-design/icons-vue";
import { useVModel } from "@vueuse/core";
const SEARCH_TEMPLATE_KEY = "di-alert-search-template";
const addTemplate = (moduleKey, value2) => {
const templateInfo = store(SEARCH_TEMPLATE_KEY) && JSON.parse(store(SEARCH_TEMPLATE_KEY)) || {};
const currentModuleInfo = templateInfo[moduleKey] || [];
const index2 = currentModuleInfo.findIndex((v2) => v2.name === value2.name);
index2 === -1 || currentModuleInfo.splice(index2, 1);
currentModuleInfo.push(value2);
templateInfo[moduleKey] = currentModuleInfo;
store(SEARCH_TEMPLATE_KEY, JSON.stringify(templateInfo));
};
const getTemplatesByModuleKey = (moduleKey) => {
const templateInfo = store(SEARCH_TEMPLATE_KEY) && JSON.parse(store(SEARCH_TEMPLATE_KEY)) || {};
const currentModuleTemplates = templateInfo[moduleKey] || [];
return currentModuleTemplates;
};
const deleteTemplate1 = (moduleKey, templateName) => {
const templateInfo = store(SEARCH_TEMPLATE_KEY) && JSON.parse(store(SEARCH_TEMPLATE_KEY)) || {};
const currentModuleInfo = templateInfo[moduleKey] || [];
const index2 = currentModuleInfo.findIndex((v2) => v2.name === templateName);
index2 === -1 || currentModuleInfo.splice(index2, 1);
templateInfo[moduleKey] = currentModuleInfo;
store(SEARCH_TEMPLATE_KEY, JSON.stringify(templateInfo));
};
const validateRangeDateValue = (value2) => {
if (Array.isArray(value2) && value2.length === 2) {
return value2.every((v2) => v2 && dayjs(v2).isValid());
} else {
return false;
}
};
function store(key2, value2) {
function _parse(a2) {
try {
return JSON.parse(a2);
} catch (b2) {
return a2;
}
}
if (typeof window !== "undefined" && (window == null ? void 0 : window.localStorage)) {
try {
if (void 0 === value2) {
value2 = localStorage.getItem(key2);
return value2 && _parse(value2);
} else {
localStorage.setItem(key2, JSON.stringify(value2));
}
} catch (e2) {
console.log("not support localstorage");
}
}
}
function useSlotsExist(slotsName = "default") {
const slots = useSlots();
const checkSlotsExist = (slotsName2) => {
var _a;
const slotsContent = (_a = slots[slotsName2]) == null ? void 0 : _a.call(slots);
const checkExist = (slotContent) => {
if (typeof slotContent.children === "string") {
if (slotContent.children === "v-if") {
return false;
}
return slotContent.children.trim() !== "";
} else {
if (slotContent.children === null) {
if (slotContent.type === "img" || typeof slotContent.type !== "string") {
return true;
}
} else {
return Boolean(slotContent.children);
}
}
};
if (slotsContent && (slotsContent == null ? void 0 : slotsContent.length)) {
const result = slotsContent.some((slotContent) => {
return checkExist(slotContent);
});
return result;
}
return false;
};
if (Array.isArray(slotsName)) {
const slotsExist = reactive({});
slotsName.forEach((item) => {
const exist = computed(() => checkSlotsExist(item));
slotsExist[item] = exist;
});
return slotsExist;
} else {
return computed(() => checkSlotsExist(slotsName));
}
}
const _hoisted_1$j = {
key: 0,
class: "btn-loading"
};
const _hoisted_2$e = {
key: 0,
class: "m-static-circle"
};
const _hoisted_3$a = {
key: 1,
class: "m-dynamic-circle"
};
const _hoisted_4$9 = {
key: 1,
class: "btn-icon"
};
const _hoisted_5$6 = {
key: 2,
class: "btn-content"
};
const _sfc_main$n = /* @__PURE__ */ defineComponent({
...{
name: "dm-button"
},
__name: "index",
props: {
type: { default: "default" },
shape: { default: "default" },
icon: { default: void 0 },
size: { default: "middle" },
ghost: { type: Boolean, default: false },
customClass: { default: void 0 },
href: { default: void 0 },
target: { default: "_self" },
keyboard: { type: Boolean, default: true },
disabled: { type: Boolean, default: false },
loading: { type: Boolean, default: false },
loadingType: { default: "dynamic" },
block: { type: Boolean, default: false }
},
emits: ["click"],
setup(__props, { emit: __emit2 }) {
const props3 = __props;
const wave = ref(false);
const emit = __emit2;
const slotsExist = useSlotsExist(["icon", "default"]);
const showIcon = computed(() => {
return slotsExist.icon || props3.icon;
});
const showIconOnly = computed(() => {
return showIcon.value && !slotsExist.default;
});
function onClick2(e2) {
if (wave.value) {
wave.value = false;
nextTick(() => {
wave.value = true;
});
} else {
wave.value = true;
}
emit("click", e2);
}
function onKeyboard(e2) {
onClick2(e2);
}
function onWaveEnd() {
wave.value = false;
}
return (_ctx, _cache) => {
return openBlock(), createBlock(resolveDynamicComponent(_ctx.href ? "a" : "div"), {
tabindex: "0",
class: normalizeClass(["dm-button", [
`btn-${_ctx.type} btn-${_ctx.size}`,
{
[`loading-${_ctx.size}`]: !_ctx.href && _ctx.loading,
"btn-icon-only": showIconOnly.value,
"btn-circle": _ctx.shape === "circle",
"btn-round": _ctx.shape === "round",
"btn-loading-blur": !_ctx.href && _ctx.loading,
"btn-ghost": _ctx.ghost,
"btn-block": _ctx.block,
"btn-disabled": _ctx.disabled
},
_ctx.customClass
]]),
href: _ctx.href,
target: _ctx.target,
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.disabled || _ctx.loading ? () => false : onClick2($event)),
onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => _ctx.keyboard && !_ctx.disabled && !_ctx.loading ? onKeyboard($event) : () => false, ["prevent"]), ["enter"]))
}, {
default: withCtx(() => [
_ctx.loading || !showIcon.value ? (openBlock(), createElementBlock("div", _hoisted_1$j, [
!_ctx.href && _ctx.loadingType === "static" ? (openBlock(), createElementBlock("div", _hoisted_2$e, _cache[2] || (_cache[2] = [
createElementVNode("svg", {
class: "circle",
width: "1em",
height: "1em",
fill: "currentColor",
viewBox: "0 0 100 100"
}, [
createElementVNode("path", {
d: "M 50,50 m 0,-45 a 45,45 0 1 1 0,90 a 45,45 0 1 1 0,-90",
"stroke-linecap": "round",
class: "path",
"fill-opacity": "0"
})
], -1)
]))) : createCommentVNode("", true),
!_ctx.href && _ctx.loadingType === "dynamic" ? (openBlock(), createElementBlock("div", _hoisted_3$a, _cache[3] || (_cache[3] = [
createElementVNode("svg", {
class: "circle",
viewBox: "0 0 50 50",
width: "1em",
height: "1em",
fill: "currentColor"
}, [
createElementVNode("circle", {
class: "path",
cx: "25",
cy: "25",
r: "20",
fill: "none"
})
], -1)
]))) : createCommentVNode("", true)
])) : createCommentVNode("", true),
!_ctx.loading && showIcon.value ? (openBlock(), createElementBlock("span", _hoisted_4$9, [
renderSlot(_ctx.$slots, "icon", {}, () => [
_ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : createCommentVNode("", true)
], true)
])) : createCommentVNode("", true),
unref(slotsExist).default ? (openBlock(), createElementBlock("span", _hoisted_5$6, [
renderSlot(_ctx.$slots, "default", {}, void 0, true)
])) : createCommentVNode("", true),
!_ctx.disabled ? (openBlock(), createElementBlock("div", {
key: 3,
class: normalizeClass(["button-wave", { "wave-active": wave.value }]),
onAnimationend: onWaveEnd
}, null, 34)) : createCommentVNode("", true)
]),
_: 3
}, 40, ["class", "href", "target"]);
};
}
});
const index_vue_vue_type_style_index_0_scoped_bdc2e67b_lang = "";
const _export_sfc = (sfc, props3) => {
const target = sfc.__vccOpts || sfc;
for (const [key2, val] of props3) {
target[key2] = val;
}
return target;
};
const Button$1 = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-bdc2e67b"]]);
Button$1.install = (app) => {
app.component(Button$1.name, Button$1);
};
function _typeof$2(obj) {
"@babel/helpers - typeof";
return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
return typeof obj2;
} : function(obj2) {
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
}, _typeof$2(obj);
}
function _toPrimitive(input, hint) {
if (_typeof$2(input) !== "object" || input === null)
return input;
var prim = input[Symbol.toPrimitive];
if (prim !== void 0) {
var res = prim.call(input, hint || "default");
if (_typeof$2(res) !== "object")
return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key2 = _toPrimitive(arg, "string");
return _typeof$2(key2) === "symbol" ? key2 : String(key2);
}
function _defineProperty$q(obj, key2, value2) {
key2 = _toPropertyKey(key2);
if (key2 in obj) {
Object.defineProperty(obj, key2, {
value: value2,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key2] = value2;
}
return obj;
}
function ownKeys$1(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread2$1(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = null != arguments[i2] ? arguments[i2] : {};
i2 % 2 ? ownKeys$1(Object(source), true).forEach(function(key2) {
_defineProperty$q(target, key2, source[key2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function(key2) {
Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));
});
}
return target;
}
function _extends() {
_extends = Object.assign ? Object.assign.bind() : function(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2];
for (var key2 in source) {
if (Object.prototype.hasOwnProperty.call(source, key2)) {
target[key2] = source[key2];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
var isFunction$2 = function isFunction(val) {
return typeof val === "function";
};
var isArray$3 = Array.isArray;
var isString$3 = function isString(val) {
return typeof val === "string";
};
var isObject$3 = function isObject(val) {
return val !== null && _typeof$2(val) === "object";
};
var onRE = /^on[^a-z]/;
var isOn = function isOn2(key2) {
return onRE.test(key2);
};
var cacheStringFunction = function cacheStringFunction2(fn) {
var cache2 = /* @__PURE__ */ Object.create(null);
return function(str) {
var hit = cache2[str];
return hit || (cache2[str] = fn(str));
};
};
var camelizeRE = /-(\w)/g;
var camelize = cacheStringFunction(function(str) {
return str.replace(camelizeRE, function(_2, c2) {
return c2 ? c2.toUpperCase() : "";
});
});
var hyphenateRE = /\B([A-Z])/g;
var hyphenate = cacheStringFunction(function(str) {
return str.replace(hyphenateRE, "-$1").toLowerCase();
});
var hasOwnProperty$d = Object.prototype.hasOwnProperty;
var hasOwn$1 = function hasOwn(val, key2) {
return hasOwnProperty$d.call(val, key2);
};
function resolvePropValue(options, props3, key2, value2) {
var opt = options[key2];
if (opt != null) {
var hasDefault = hasOwn$1(opt, "default");
if (hasDefault && value2 === void 0) {
var defaultValue = opt.default;
value2 = opt.type !== Function && isFunction$2(defaultValue) ? defaultValue() : defaultValue;
}
if (opt.type === Boolean) {
if (!hasOwn$1(props3, key2) && !hasDefault) {
value2 = false;
} else if (value2 === "") {
value2 = true;
}
}
}
return value2;
}
function getDataAndAriaProps(props3) {
return Object.keys(props3).reduce(function(memo, key2) {
if (key2.substr(0, 5) === "data-" || key2.substr(0, 5) === "aria-") {
memo[key2] = props3[key2];
}
return memo;
}, {});
}
function toPx(val) {
if (typeof val === "number")
return "".concat(val, "px");
return val;
}
function renderHelper(v2) {
var props3 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var defaultV = arguments.length > 2 ? arguments[2] : void 0;
if (typeof v2 === "function") {
return v2(props3);
}
return v2 !== null && v2 !== void 0 ? v2 : defaultV;
}
function classNames() {
var classes = [];
for (var i2 = 0; i2 < arguments.length; i2++) {
var value2 = i2 < 0 || arguments.length <= i2 ? void 0 : arguments[i2];
if (!value2)
continue;
if (isString$3(value2)) {
classes.push(value2);
} else if (isArray$3(value2)) {
for (var _i = 0; _i < value2.length; _i++) {
var inner = classNames(value2[_i]);
if (inner) {
classes.push(inner);
}
}
} else if (isObject$3(value2)) {
for (var name in value2) {
if (value2[name]) {
classes.push(name);
}
}
}
}
return classes.join(" ");
}
var MapShim = function() {
if (typeof Map !== "undefined") {
return Map;
}
function getIndex(arr, key2) {
var result = -1;
arr.some(function(entry, index2) {
if (entry[0] === key2) {
result = index2;
return true;
}
return false;
});
return result;
}
return (
/** @class */
function() {
function class_1() {
this.__entries__ = [];
}
Object.defineProperty(class_1.prototype, "size", {
/**
* @returns {boolean}
*/
get: function() {
return this.__entries__.length;
},
enumerable: true,
configurable: true
});
class_1.prototype.get = function(key2) {
var index2 = getIndex(this.__entries__, key2);
var entry = this.__entries__[index2];
return entry && entry[1];
};
class_1.prototype.set = function(key2, value2) {
var index2 = getIndex(this.__entries__, key2);
if (~index2) {
this.__entries__[index2][1] = value2;
} else {
this.__entries__.push([key2, value2]);
}
};
class_1.prototype.delete = function(key2) {
var entries = this.__entries__;
var index2 = getIndex(entries, key2);
if (~index2) {
entries.splice(index2, 1);
}
};
class_1.prototype.has = function(key2) {
return !!~getIndex(this.__entries__, key2);
};
class_1.prototype.clear = function() {
this.__entries__.splice(0);
};
class_1.prototype.forEach = function(callback, ctx) {
if (ctx === void 0) {
ctx = null;
}
for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
var entry = _a[_i];
callback.call(ctx, entry[1], entry[0]);
}
};
return class_1;
}()
);
}();
var isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && window.document === document;
var global$1 = function() {
if (typeof global !== "undefined" && global.Math === Math) {
return global;
}
if (typeof self !== "undefined" && self.Math === Math) {
return self;
}
if (typeof window !== "undefined" && window.Math === Math) {
return window;
}
return Function("return this")();
}();
var requestAnimationFrame$1 = function() {
if (typeof requestAnimationFrame === "function") {
return requestAnimationFrame.bind(global$1);
}
return function(callback) {
return setTimeout(function() {
return callback(Date.now());
}, 1e3 / 60);
};
}();
var trailingTimeout = 2;
function throttle(callback, delay) {
var leadingCall = false, trailingCall = false, lastCallTime = 0;
function resolvePending() {
if (leadingCall) {
leadingCall = false;
callback();
}
if (trailingCall) {
proxy();
}
}
function timeoutCallback() {
requestAnimationFrame$1(resolvePending);
}
function proxy() {
var timeStamp = Date.now();
if (leadingCall) {
if (timeStamp - lastCallTime < trailingTimeout) {
return;
}
trailingCall = true;
} else {
leadingCall = true;
trailingCall = false;
setTimeout(timeoutCallback, delay);
}
lastCallTime = timeStamp;
}
return proxy;
}
var REFRESH_DELAY = 20;
var transitionKeys = ["top", "right", "bottom", "left", "width", "height", "size", "weight"];
var mutationObserverSupported = typeof MutationObserver !== "undefined";
var ResizeObserverController = (
/** @class */
function() {
function ResizeObserverController2() {
this.connected_ = false;
this.mutationEventsAdded_ = false;
this.mutationsObserver_ = null;
this.observers_ = [];
this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
}
ResizeObserverController2.prototype.addObserver = function(observer) {
if (!~this.observers_.indexOf(observer)) {
this.observers_.push(observer);
}
if (!this.connected_) {
this.connect_();
}
};
ResizeObserverController2.prototype.removeObserver = function(observer) {
var observers2 = this.observers_;
var index2 = observers2.indexOf(observer);
if (~index2) {
observers2.splice(index2, 1);
}
if (!observers2.length && this.connected_) {
this.disconnect_();
}
};
ResizeObserverController2.prototype.refresh = function() {
var changesDetected = this.updateObservers_();
if (changesDetected) {
this.refresh();
}
};
ResizeObserverController2.prototype.updateObservers_ = function() {
var activeObservers = this.observers_.filter(function(observer) {
return observer.gatherActive(), observer.hasActive();
});
activeObservers.forEach(function(observer) {
return observer.broadcastActive();
});
return activeObservers.length > 0;
};
ResizeObserverController2.prototype.connect_ = function() {
if (!isBrowser || this.connected_) {
return;
}
document.addEventListener("transitionend", this.onTransitionEnd_);
window.addEventListener("resize", this.refresh);
if (mutationObserverSupported) {
this.mutationsObserver_ = new MutationObserver(this.refresh);
this.mutationsObserver_.observe(document, {
attributes: true,
childList: true,
characterData: true,
subtree: true
});
} else {
document.addEventListener("DOMSubtreeModified", this.refresh);
this.mutationEventsAdded_ = true;
}
this.connected_ = true;
};
ResizeObserverController2.prototype.disconnect_ = function() {
if (!isBrowser || !this.connected_) {
return;
}
document.removeEventListener("transitionend", this.onTransitionEnd_);
window.removeEventListener("resize", this.refresh);
if (this.mutationsObserver_) {
this.mutationsObserver_.disconnect();
}
if (this.mutationEventsAdded_) {
document.removeEventListener("DOMSubtreeModified", this.refresh);
}
this.mutationsObserver_ = null;
this.mutationEventsAdded_ = false;
this.connected_ = false;
};
ResizeObserverController2.prototype.onTransitionEnd_ = function(_a) {
var _b = _a.propertyName, propertyName = _b === void 0 ? "" : _b;
var isReflowProperty = transitionKeys.some(function(key2) {
return !!~propertyName.indexOf(key2);
});
if (isReflowProperty) {
this.refresh();
}
};
ResizeObserverController2.getInstance = function() {
if (!this.instance_) {
this.instance_ = new ResizeObserverController2();
}
return this.instance_;
};
ResizeObserverController2.instance_ = null;
return ResizeObserverController2;
}()
);
var defineConfigurable = function(target, props3) {
for (var _i = 0, _a = Object.keys(props3); _i < _a.length; _i++) {
var key2 = _a[_i];
Object.defineProperty(target, key2, {
value: props3[key2],
enumerable: false,
writable: false,
configurable: true
});
}
return target;
};
var getWindowOf = function(target) {
var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
return ownerGlobal || global$1;
};
var emptyRect = createRectInit(0, 0, 0, 0);
function toFloat(value2) {
return parseFloat(value2) || 0;
}
function getBordersSize(styles2) {
var positions = [];
for (var _i = 1; _i < arguments.length; _i++) {
positions[_i - 1] = arguments[_i];
}
return positions.reduce(function(size, position) {
var value2 = styles2["border-" + position + "-width"];
return size + toFloat(value2);
}, 0);
}
function getPaddings(styles2) {
var positions = ["top", "right", "bottom", "left"];
var paddings = {};
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
var position = positions_1[_i];
var value2 = styles2["padding-" + position];
paddings[position] = toFloat(value2);
}
return paddings;
}
function getSVGContentRect(target) {
var bbox = target.getBBox();
return createRectInit(0, 0, bbox.width, bbox.height);
}
function getHTMLElementContentRect(target) {
var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
if (!clientWidth && !clientHeight) {
return emptyRect;
}
var styles2 = getWindowOf(target).getComputedStyle(target);
var paddings = getPaddings(styles2);
var horizPad = paddings.left + paddings.right;
var vertPad = paddings.top + paddings.bottom;
var width = toFloat(styles2.width), height = toFloat(styles2.height);
if (styles2.boxSizing === "border-box") {
if (Math.round(width + horizPad) !== clientWidth) {
width -= getBordersSize(styles2, "left", "right") + horizPad;
}
if (Math.round(height + vertPad) !== clientHeight) {
height -= getBordersSize(styles2, "top", "bottom") + vertPad;
}
}
if (!isDocumentElement(target)) {
var vertScrollbar = Math.round(width + horizPad) - clientWidth;
var horizScrollbar = Math.round(height + vertPad) - clientHeight;
if (Math.abs(vertScrollbar) !== 1) {
width -= vertScrollbar;
}
if (Math.abs(horizScrollbar) !== 1) {
height -= horizScrollbar;
}
}
return createRectInit(paddings.left, paddings.top, width, height);
}
var isSVGGraphicsElement = function() {
if (typeof SVGGraphicsElement !== "undefined") {
return function(target) {
return target instanceof getWindowOf(target).SVGGraphicsElement;
};
}
return function(target) {
return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === "function";
};
}();
function isDocumentElement(target) {
return target === getWindowOf(target).document.documentElement;
}
function getContentRect(target) {
if (!isBrowser) {
return emptyRect;
}
if (isSVGGraphicsElement(target)) {
return getSVGContentRect(target);
}
return getHTMLElementContentRect(target);
}
function createReadOnlyRect(_a) {
var x2 = _a.x, y2 = _a.y, width = _a.width, height = _a.height;
var Constr = typeof DOMRectReadOnly !== "undefined" ? DOMRectReadOnly : Object;
var rect = Object.create(Constr.prototype);
defineConfigurable(rect, {
x: x2,
y: y2,
width,
height,
top: y2,
right: x2 + width,
bottom: height + y2,
left: x2
});
return rect;
}
function createRectInit(x2, y2, width, height) {
return { x: x2, y: y2, width, height };
}
var ResizeObservation = (
/** @class */
function() {
function ResizeObservation2(target) {
this.broadcastWidth = 0;
this.broadcastHeight = 0;
this.contentRect_ = createRectInit(0, 0, 0, 0);
this.target = target;
}
ResizeObservation2.prototype.isActive = function() {
var rect = getContentRect(this.target);
this.contentRect_ = rect;
return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight;
};
ResizeObservation2.prototype.broadcastRect = function() {
var rect = this.contentRect_;
this.broadcastWidth = rect.width;
this.broadcastHeight = rect.height;
return rect;
};
return ResizeObservation2;
}()
);
var ResizeObserverEntry = (
/** @class */
function() {
function ResizeObserverEntry2(target, rectInit) {
var contentRect = createReadOnlyRect(rectInit);
defineConfigurable(this, { target, contentRect });
}
return ResizeObserverEntry2;
}()
);
var ResizeObserverSPI = (
/** @class */
function() {
function ResizeObserverSPI2(callback, controller, callbackCtx) {
this.activeObservations_ = [];
this.observations_ = new MapShim();
if (typeof callback !== "function") {
throw new TypeError("The callback provided as parameter 1 is not a function.");
}
this.callback_ = callback;
this.controller_ = controller;
this.callbackCtx_ = callbackCtx;
}
ResizeObserverSPI2.prototype.observe = function(target) {
if (!arguments.length) {
throw new TypeError("1 argument required, but only 0 present.");
}
if (typeof Element === "undefined" || !(Element instanceof Object)) {
return;
}
if (!(target instanceof getWindowOf(target).Element)) {
throw new TypeError('parameter 1 is not of type "Element".');
}
var observations = this.observations_;
if (observations.has(target)) {
return;
}
observations.set(target, new ResizeObservation(target));
this.controller_.addObserver(this);
this.controller_.refresh();
};
ResizeObserverSPI2.prototype.unobserve = function(target) {
if (!arguments.length) {
throw new TypeError("1 argument required, but only 0 present.");
}
if (typeof Element === "undefined" || !(Element instanceof Object)) {
return;
}
if (!(target instanceof getWindowOf(target).Element)) {
throw new TypeError('parameter 1 is not of type "Element".');
}
var observations = this.observations_;
if (!observations.has(target)) {
return;
}
observations.delete(target);
if (!observations.size) {
this.controller_.removeObserver(this);
}
};
ResizeObserverSPI2.prototype.disconnect = function() {
this.clearActive();
this.observations_.clear();
this.controller_.removeObserver(this);
};
ResizeObserverSPI2.prototype.gatherActive = function() {
var _this = this;
this.clearActive();
this.observations_.forEach(function(observation) {
if (observation.isActive()) {
_this.activeObservations_.push(observation);
}
});
};
ResizeObserverSPI2.prototype.broadcastActive = function() {
if (!this.hasActive()) {
return;
}
var ctx = this.callbackCtx_;
var entries = this.activeObservations_.map(function(observation) {
return new ResizeObserverEntry(observation.target, observation.broadcastRect());
});
this.callback_.call(ctx, entries, ctx);
this.clearActive();
};
ResizeObserverSPI2.prototype.clearActive = function() {
this.activeObservations_.splice(0);
};
ResizeObserverSPI2.prototype.hasActive = function() {
return this.activeObservations_.length > 0;
};
return ResizeObserverSPI2;
}()
);
var observers = typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : new MapShim();
var ResizeObserver$2 = (
/** @class */
function() {
function ResizeObserver2(callback) {
if (!(this instanceof ResizeObserver2)) {
throw new TypeError("Cannot call a class as a function.");
}
if (!arguments.length) {
throw new TypeError("1 argument required, but only 0 present.");
}
var controller = ResizeObserverController.getInstance();
var observer = new ResizeObserverSPI(callback, controller, this);
observers.set(this, observer);
}
return ResizeObserver2;
}()
);
[
"observe",
"unobserve",
"disconnect"
].forEach(function(method) {
ResizeObserver$2.prototype[method] = function() {
var _a;
return (_a = observers.get(this))[method].apply(_a, arguments);
};
});
var index$2 = function() {
if (typeof global$1.ResizeObserver !== "undefined") {
return global$1.ResizeObserver;
}
return ResizeObserver$2;
}();
function _arrayWithHoles$2(arr) {
if (Array.isArray(arr))
return arr;
}
function _iterableToArrayLimit$2(arr, i2) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s, _e, _x, _r, _arr = [], _n = true, _d = false;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i2) {
if (Object(_i) !== _i)
return;
_n = false;
} else
for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true)
;
} catch (err) {
_d = true, _e = err;
} finally {
try {
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r))
return;
} finally {
if (_d)
throw _e;
}
}
return _arr;
}
}
function _arrayLikeToArray$2(arr, len) {
if (len == null || len > arr.length)
len = arr.length;
for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++)
arr2[i2] = arr[i2];
return arr2;
}
function _unsupportedIterableToArray$2(o2, minLen) {
if (!o2)
return;
if (typeof o2 === "string")
return _arrayLikeToArray$2(o2, minLen);
var n2 = Object.prototype.toString.call(o2).slice(8, -1);
if (n2 === "Object" && o2.constructor)
n2 = o2.constructor.name;
if (n2 === "Map" || n2 === "Set")
return Array.from(o2);
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2))
return _arrayLikeToArray$2(o2, minLen);
}
function _nonIterableRest$2() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray$2(arr, i2) {
return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i2) || _unsupportedIterableToArray$2(arr, i2) || _nonIterableRest$2();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr))
return _arrayLikeToArray$2(arr);
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
return Array.from(iter);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread();
}
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
const freeGlobal$1 = freeGlobal;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal$1 || freeSelf || Function("return this")();
const root$1 = root;
var Symbol$1 = root$1.Symbol;
const Symbol$2 = Symbol$1;
var objectProto$d = Object.prototype;
var hasOwnProperty$c = objectProto$d.hasOwnProperty;
var nativeObjectToString$1 = objectProto$d.toString;
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
function getRawTag(value2) {
var isOwn = hasOwnProperty$c.call(value2, symToStringTag$1), tag = value2[symToStringTag$1];
try {
value2[symToStringTag$1] = void 0;
var unmasked = true;
} catch (e2) {
}
var result = nativeObjectToString$1.call(value2);
if (unmasked) {
if (isOwn) {
value2[symToStringTag$1] = tag;
} else {
delete value2[symToStringTag$1];
}
}
return result;
}
var objectProto$c = Object.prototype;
var nativeObjectToString = objectProto$c.toString;
function objectToString$1(value2) {
return nativeObjectToString.call(value2);
}
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
function baseGetTag(value2) {
if (value2 == null) {
return value2 === void 0 ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object(value2) ? getRawTag(value2) : objectToString$1(value2);
}
function overArg(func, transform2) {
return function(arg) {
return func(transform2(arg));
};
}
var getPrototype = overArg(Object.getPrototypeOf, Object);
const getPrototype$1 = getPrototype;
function isObjectLike(value2) {
return value2 != null && typeof value2 == "object";
}
var objectTag$3 = "[object Object]";
var funcProto$2 = Function.prototype, objectProto$b = Object.prototype;
var funcToString$2 = funcProto$2.toString;
var hasOwnProperty$b = objectProto$b.hasOwnProperty;
var objectCtorString = funcToString$2.call(Object);
function isPlainObject$1(value2) {
if (!isObjectLike(value2) || baseGetTag(value2) != objectTag$3) {
return false;
}
var proto = getPrototype$1(value2);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty$b.call(proto, "constructor") && proto.constructor;
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString$2.call(Ctor) == objectCtorString;
}
var isValid$1 = function isValid(value2) {
return value2 !== void 0 && value2 !== null && value2 !== "";
};
const isValid$2 = isValid$1;
var initDefaultProps = function initDefaultProps2(types, defaultProps) {
var propTypes = _objectSpread2$1({}, types);
Object.keys(defaultProps).forEach(function(k2) {
var 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 ".concat(k2, " prop"));
}
});
return propTypes;
};
const initDefaultProps$1 = initDefaultProps;
var splitAttrs = function splitAttrs2(attrs) {
var allAttrs = Object.keys(attrs);
var eventAttrs = {};
var onEvents = {};
var extraAttrs = {};
for (var i2 = 0, l2 = allAttrs.length; i2 < l2; i2++) {
var key2 = allAttrs[i2];
if (isOn(key2)) {
eventAttrs[key2[2].toLowerCase() + key2.slice(3)] = attrs[key2];
onEvents[key2] = attrs[key2];
} else {
extraAttrs[key2] = attrs[key2];
}
}
return {
onEvents,
events: eventAttrs,
extraAttrs
};
};
var parseStyleText = function parseStyleText2() {
var cssText = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
var camel = arguments.length > 1 ? arguments[1] : void 0;
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
var propertyDelimiter = /:(.+)/;
if (_typeof$2(cssText) === "object")
return cssText;
cssText.split(listDelimiter).forEach(function(item) {
if (item) {
var tmp = item.split(propertyDelimiter);
if (tmp.length > 1) {
var k2 = camel ? camelize(tmp[0].trim()) : tmp[0].trim();
res[k2] = tmp[1].trim();
}
}
});
return res;
};
var hasProp = function hasProp2(instance, prop) {
return instance[prop] !== void 0;
};
var flattenChildren = function flattenChildren2() {
var children = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
var filterEmpty2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
var temp = Array.isArray(children) ? children : [children];
var res = [];
temp.forEach(function(child) {
if (Array.isArray(child)) {
res.push.apply(res, _toConsumableArray(flattenChildren2(child, filterEmpty2)));
} else if (child && child.type === Fragment) {
res.push.apply(res, _toConsumableArray(flattenChildren2(child.children, filterEmpty2)));
} else if (child && isVNode$1(child)) {
if (filterEmpty2 && !isEmptyElement(child)) {
res.push(child);
} else if (!filterEmpty2) {
res.push(child);
}
} else if (isValid$2(child)) {
res.push(child);
}
});
return res;
};
var getSlot = function getSlot2(self2) {
var name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "default";
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
if (isVNode$1(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 {
var res = self2.$slots[name] && self2.$slots[name](options);
return flattenChildren(res);
}
};
var findDOMNode = function findDOMNode2(instance) {
var _instance$vnode;
var node = (instance === null || instance === void 0 ? void 0 : (_instance$vnode = instance.vnode) === null || _instance$vnode === void 0 ? void 0 : _instance$vnode.el) || instance && (instance.$el || instance);
while (node && !node.tagName) {
node = node.nextSibling;
}
return node;
};
var getOptionProps = function getOptionProps2(instance) {
var res = {};
if (instance.$ && instance.$.vnode) {
var props3 = instance.$.vnode.props || {};
Object.keys(instance.$props).forEach(function(k2) {
var v2 = instance.$props[k2];
var hyphenateKey = hyphenate(k2);
if (v2 !== void 0 || hyphenateKey in props3) {
res[k2] = v2;
}
});
} else if (isVNode$1(instance) && _typeof$2(instance.type) === "object") {
var originProps = instance.props || {};
var _props = {};
Object.keys(originProps).forEach(function(key2) {
_props[camelize(key2)] = originProps[key2];
});
var options = instance.type.props || {};
Object.keys(options).forEach(function(k2) {
var v2 = resolvePropValue(options, _props, k2, _props[k2]);
if (v2 !== void 0 || k2 in _props) {
res[k2] = v2;
}
});
}
return res;
};
var getComponent = function getComponent2(instance) {
var prop = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "default";
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : instance;
var execute = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
var com = void 0;
if (instance.$) {
var 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$1(instance)) {
var _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() {
var ele = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
var on = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
var props3 = {};
if (ele.$) {
props3 = _objectSpread2$1(_objectSpread2$1({}, props3), ele.$attrs);
} else {
props3 = _objectSpread2$1(_objectSpread2$1({}, props3), ele.props);
}
return splitAttrs(props3)[on ? "onEvents" : "events"];
}
function getStyle(ele, camel) {
var props3 = (isVNode$1(ele) ? ele.props : ele.$attrs) || {};
var style = props3.style || {};
if (typeof style === "string") {
style = parseStyleText(style, camel);
} else if (camel && style) {
var res = {};
Object.keys(style).forEach(function(k2) {
return res[camelize(k2)] = style[k2];
});
return res;
}
return style;
}
function isEmptyElement(c2) {
return c2 && (c2.type === Comment || c2.type === Fragment && c2.children.length === 0 || c2.type === Text && c2.children.trim() === "");
}
function filterEmpty() {
var children = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
var res = [];
children.forEach(function(child) {
if (Array.isArray(child)) {
res.push.apply(res, _toConsumableArray(child));
} else if ((child === null || child === void 0 ? void 0 : child.type) === Fragment) {
res.push.apply(res, _toConsumableArray(filterEmpty(child.children)));
} else {
res.push(child);
}
});
return res.filter(function(c2) {
return !isEmptyElement(c2);
});
}
function filterEmptyWithUndefined(children) {
if (children) {
var coms = filterEmpty(children);
return coms.length ? coms : void 0;
} else {
return children;
}
}
function isValidElement(element) {
if (Array.isArray(element) && element.length === 1) {
element = element[0];
}
return element && element.__v_isVNode && _typeof$2(element.type) !== "symbol";
}
function getPropsSlot(slots, props3) {
var _props$prop, _slots$prop;
var prop = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "default";
return (_props$prop = props3[prop]) !== null && _props$prop !== void 0 ? _props$prop : (_slots$prop = slots[prop]) === null || _slots$prop === void 0 ? void 0 : _slots$prop.call(slots);
}
const ResizeObserver$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ResizeObserver",
props: {
disabled: Boolean,
onResize: Function
},
emits: ["resize"],
setup: function setup(props3, _ref) {
var slots = _ref.slots;
var state = reactive({
width: 0,
height: 0,
offsetHeight: 0,
offsetWidth: 0
});
var currentElement = null;
var resizeObserver = null;
var destroyObserver = function destroyObserver2() {
if (resizeObserver) {
resizeObserver.disconnect();
resizeObserver = null;
}
};
var onResize = function onResize2(entries) {
var onResize3 = props3.onResize;
var target = entries[0].target;
var _target$getBoundingCl = target.getBoundingClientRect(), width = _target$getBoundingCl.width, height = _target$getBoundingCl.height;
var offsetWidth = target.offsetWidth, offsetHeight = target.offsetHeight;
var fixedWidth = Math.floor(width);
var fixedHeight = Math.floor(height);
if (state.width !== fixedWidth || state.height !== fixedHeight || state.offsetWidth !== offsetWidth || state.offsetHeight !== offsetHeight) {
var size = {
width: fixedWidth,
height: fixedHeight,
offsetWidth,
offsetHeight
};
_extends(state, size);
if (onResize3) {
Promise.resolve().then(function() {
onResize3(_objectSpread2$1(_objectSpread2$1({}, size), {}, {
offsetWidth,
offsetHeight
}), target);
});
}
}
};
var instance = getCurrentInstance();
var registerObserver = function registerObserver2() {
var disabled = props3.disabled;
if (disabled) {
destroyObserver();
return;
}
var element = findDOMNode(instance);
var elementChanged = element !== currentElement;
if (elementChanged) {
destroyObserver();
currentElement = element;
}
if (!resizeObserver && element) {
resizeObserver = new index$2(onResize);
resizeObserver.observe(element);
}
};
onMounted(function() {
registerObserver();
});
onUpdated(function() {
registerObserver();
});
onUnmounted(function() {
destroyObserver();
});
watch(function() {
return props3.disabled;
}, function() {
registerObserver();
}, {
flush: "post"
});
return function() {
var _slots$default;
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)[0];
};
}
});
var raf$1 = function raf(callback) {
return setTimeout(callback, 16);
};
var caf = function caf2(num) {
return clearTimeout(num);
};
if (typeof window !== "undefined" && "requestAnimationFrame" in window) {
raf$1 = function raf3(callback) {
return window.requestAnimationFrame(callback);
};
caf = function caf3(handle) {
return window.cancelAnimationFrame(handle);
};
}
var rafUUID = 0;
var rafIds = /* @__PURE__ */ new Map();
function cleanup(id) {
rafIds.delete(id);
}
function wrapperRaf(callback) {
var times = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
rafUUID += 1;
var id = rafUUID;
function callRef(leftTimes) {
if (leftTimes === 0) {
cleanup(id);
callback();
} else {
var realId = raf$1(function() {
callRef(leftTimes - 1);
});
rafIds.set(id, realId);
}
}
callRef(times);
return id;
}
wrapperRaf.cancel = function(id) {
var realId = rafIds.get(id);
cleanup(realId);
return caf(realId);
};
var tuple$1 = function tuple() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return args;
};
var withInstall = function withInstall2(comp) {
var c2 = comp;
c2.install = function(app) {
app.component(c2.displayName || c2.name, comp);
};
return comp;
};
var supportsPassive = false;
try {
var opts = Object.defineProperty({}, "passive", {
get: function get() {
supportsPassive = true;
}
});
window.addEventListener("testPassive", null, opts);
window.removeEventListener("testPassive", null, opts);
} catch (e2) {
}
const supportsPassive$1 = supportsPassive;
function addEventListenerWrap(target, eventType, cb, option) {
if (target && target.addEventListener) {
var opt = option;
if (opt === void 0 && supportsPassive$1 && (eventType === "touchstart" || eventType === "touchmove" || eventType === "wheel")) {
opt = {
passive: false
};
}
target.addEventListener(eventType, cb, opt);
}
return {
remove: function remove() {
if (target && target.removeEventListener) {
target.removeEventListener(eventType, cb);
}
}
};
}
function _objectWithoutPropertiesLoose$2(source, excluded) {
if (source == null)
return {};
var target = {};
var sourceKeys = Object.keys(source);
var key2, i2;
for (i2 = 0; i2 < sourceKeys.length; i2++) {
key2 = sourceKeys[i2];
if (excluded.indexOf(key2) >= 0)
continue;
target[key2] = source[key2];
}
return target;
}
function _objectWithoutProperties$2(source, excluded) {
if (source == null)
return {};
var target = _objectWithoutPropertiesLoose$2(source, excluded);
var key2, i2;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) {
key2 = sourceSymbolKeys[i2];
if (excluded.indexOf(key2) >= 0)
continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key2))
continue;
target[key2] = source[key2];
}
}
return target;
}
const enUS = {
// Options.jsx
items_per_page: "/ page",
jump_to: "Go to",
jump_to_confirm: "confirm",
page: "",
// Pagination.jsx
prev_page: "Previous Page",
next_page: "Next Page",
prev_5: "Previous 5 Pages",
next_5: "Next 5 Pages",
prev_3: "Previous 3 Pages",
next_3: "Next 3 Pages"
};
var locale$6 = {
locale: "en_US",
today: "Today",
now: "Now",
backToToday: "Back to today",
ok: "Ok",
clear: "Clear",
month: "Month",
year: "Year",
timeSelect: "select time",
dateSelect: "select date",
weekSelect: "Choose a week",
monthSelect: "Choose a month",
yearSelect: "Choose a year",
decadeSelect: "Choose a decade",
yearFormat: "YYYY",
dateFormat: "M/D/YYYY",
dayFormat: "D",
dateTimeFormat: "M/D/YYYY HH:mm:ss",
monthBeforeYear: true,
previousMonth: "Previous month (PageUp)",
nextMonth: "Next month (PageDown)",
previousYear: "Last year (Control + left)",
nextYear: "Next year (Control + right)",
previousDecade: "Last decade",
nextDecade: "Next decade",
previousCentury: "Last century",
nextCentury: "Next century"
};
const CalendarLocale$1 = locale$6;
var locale$5 = {
placeholder: "Select time",
rangePlaceholder: ["Start time", "End time"]
};
const TimePicker$1 = locale$5;
var locale$4 = {
lang: _objectSpread2$1({
placeholder: "Select date",
yearPlaceholder: "Select year",
quarterPlaceholder: "Select quarter",
monthPlaceholder: "Select month",
weekPlaceholder: "Select week",
rangePlaceholder: ["Start date", "End date"],
rangeYearPlaceholder: ["Start year", "End year"],
rangeQuarterPlaceholder: ["Start quarter", "End quarter"],
rangeMonthPlaceholder: ["Start month", "End month"],
rangeWeekPlaceholder: ["Start week", "End week"]
}, CalendarLocale$1),
timePickerLocale: _objectSpread2$1({}, TimePicker$1)
};
const locale2 = locale$4;
var typeTemplate = "${label} is not a valid ${type}";
var localeValues = {
locale: "en",
Pagination: enUS,
DatePicker: locale2,
TimePicker: TimePicker$1,
Calendar: locale2,
global: {
placeholder: "Please select"
},
Table: {
filterTitle: "Filter menu",
filterConfirm: "OK",
filterReset: "Reset",
filterEmptyText: "No filters",
filterCheckall: "Select all items",
filterSearchPlaceholder: "Search in filters",
emptyText: "No data",
selectAll: "Select current page",
selectInvert: "Invert current page",
selectNone: "Clear all data",
selectionAll: "Select all data",
sortTitle: "Sort",
expand: "Expand row",
collapse: "Collapse row",
triggerDesc: "Click to sort descending",
triggerAsc: "Click to sort ascending",
cancelSort: "Click to cancel sorting"
},
Modal: {
okText: "OK",
cancelText: "Cancel",
justOkText: "OK"
},
Popconfirm: {
okText: "OK",
cancelText: "Cancel"
},
Transfer: {
titles: ["", ""],
searchPlaceholder: "Search here",
itemUnit: "item",
itemsUnit: "items",
remove: "Remove",
selectCurrent: "Select current page",
removeCurrent: "Remove current page",
selectAll: "Select all data",
removeAll: "Remove all data",
selectInvert: "Invert current page"
},
Upload: {
uploading: "Uploading...",
removeFile: "Remove file",
uploadError: "Upload error",
previewFile: "Preview file",
downloadFile: "Download file"
},
Empty: {
description: "No Data"
},
Icon: {
icon: "icon"
},
Text: {
edit: "Edit",
copy: "Copy",
copied: "Copied",
expand: "Expand"
},
PageHeader: {
back: "Back"
},
Form: {
optional: "(optional)",
defaultValidateMessages: {
default: "Field validation error for ${label}",
required: "Please enter ${label}",
enum: "${label} must be one of [${enum}]",
whitespace: "${label} cannot be a blank character",
date: {
format: "${label} date format is invalid",
parse: "${label} cannot be converted to a date",
invalid: "${label} is an invalid date"
},
types: {
string: typeTemplate,
method: typeTemplate,
array: typeTemplate,
object: typeTemplate,
number: typeTemplate,
date: typeTemplate,
boolean: typeTemplate,
integer: typeTemplate,
float: typeTemplate,
regexp: typeTemplate,
email: typeTemplate,
url: typeTemplate,
hex: typeTemplate
},
string: {
len: "${label} must be ${len} characters",
min: "${label} must be at least ${min} characters",
max: "${label} must be up to ${max} characters",
range: "${label} must be between ${min}-${max} characters"
},
number: {
len: "${label} must be equal to ${len}",
min: "${label} must be minimum ${min}",
max: "${label} must be maximum ${max}",
range: "${label} must be between ${min}-${max}"
},
array: {
len: "Must be ${len} ${label}",
min: "At least ${min} ${label}",
max: "At most ${max} ${label}",
range: "The amount of ${label} must be between ${min}-${max}"
},
pattern: {
mismatch: "${label} does not match the pattern ${pattern}"
}
}
},
Image: {
preview: "Preview"
}
};
const defaultLocale$1 = localeValues;
const LocaleReceiver = defineComponent({
compatConfig: {
MODE: 3
},
name: "LocaleReceiver",
props: {
componentName: String,
defaultLocale: {
type: [Object, Function]
},
children: {
type: Function
}
},
setup: function setup2(props3, _ref) {
var slots = _ref.slots;
var localeData2 = inject("localeData", {});
var locale3 = computed(function() {
var _props$componentName = props3.componentName, componentName = _props$componentName === void 0 ? "global" : _props$componentName, defaultLocale2 = props3.defaultLocale;
var locale4 = defaultLocale2 || defaultLocale$1[componentName || "global"];
var antLocale = localeData2.antLocale;
var localeFromContext = componentName && antLocale ? antLocale[componentName] : {};
return _objectSpread2$1(_objectSpread2$1({}, typeof locale4 === "function" ? locale4() : locale4), localeFromContext || {});
});
var localeCode = computed(function() {
var antLocale = localeData2.antLocale;
var localeCode2 = antLocale && antLocale.locale;
if (antLocale && antLocale.exist && !localeCode2) {
return defaultLocale$1.locale;
}
return localeCode2;
});
return function() {
var children = props3.children || slots.default;
var antLocale = localeData2.antLocale;
return children === null || children === void 0 ? void 0 : children(locale3.value, localeCode.value, antLocale);
};
}
});
function useLocaleReceiver(componentName, defaultLocale2, propsLocale) {
var localeData2 = inject("localeData", {});
var componentLocale = computed(function() {
var antLocale = localeData2.antLocale;
var locale3 = unref(defaultLocale2) || defaultLocale$1[componentName || "global"];
var localeFromContext = componentName && antLocale ? antLocale[componentName] : {};
return _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, typeof locale3 === "function" ? locale3() : locale3), localeFromContext || {}), unref(propsLocale) || {});
});
return [componentLocale];
}
var Empty$2 = function Empty() {
var _useConfigInject = useConfigInject("empty", {}), getPrefixCls2 = _useConfigInject.getPrefixCls;
var prefixCls = getPrefixCls2("empty-img-default");
return createVNode("svg", {
"class": prefixCls,
"width": "184",
"height": "152",
"viewBox": "0 0 184 152"
}, [createVNode("g", {
"fill": "none",
"fill-rule": "evenodd"
}, [createVNode("g", {
"transform": "translate(24 31.67)"
}, [createVNode("ellipse", {
"class": "".concat(prefixCls, "-ellipse"),
"cx": "67.797",
"cy": "106.89",
"rx": "67.797",
"ry": "12.668"
}, null), createVNode("path", {
"class": "".concat(prefixCls, "-path-1"),
"d": "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"
}, null), createVNode("path", {
"class": "".concat(prefixCls, "-path-2"),
"d": "M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",
"transform": "translate(13.56)"
}, null), createVNode("path", {
"class": "".concat(prefixCls, "-path-3"),
"d": "M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z"
}, null), createVNode("path", {
"class": "".concat(prefixCls, "-path-4"),
"d": "M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z"
}, null)]), createVNode("path", {
"class": "".concat(prefixCls, "-path-5"),
"d": "M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z"
}, null), createVNode("g", {
"class": "".concat(prefixCls, "-g"),
"transform": "translate(149.65 15.383)"
}, [createVNode("ellipse", {
"cx": "20.654",
"cy": "3.167",
"rx": "2.849",
"ry": "2.815"
}, null), createVNode("path", {
"d": "M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"
}, null)])])]);
};
Empty$2.PRESENTED_IMAGE_DEFAULT = true;
const DefaultEmptyImg = Empty$2;
var Simple = function Simple2() {
var _useConfigInject = useConfigInject("empty", {}), getPrefixCls2 = _useConfigInject.getPrefixCls;
var prefixCls = getPrefixCls2("empty-img-simple");
return createVNode("svg", {
"class": prefixCls,
"width": "64",
"height": "41",
"viewBox": "0 0 64 41"
}, [createVNode("g", {
"transform": "translate(0 1)",
"fill": "none",
"fill-rule": "evenodd"
}, [createVNode("ellipse", {
"class": "".concat(prefixCls, "-ellipse"),
"fill": "#F5F5F5",
"cx": "32",
"cy": "33",
"rx": "32",
"ry": "7"
}, null), createVNode("g", {
"class": "".concat(prefixCls, "-g"),
"fill-rule": "nonzero",
"stroke": "#D9D9D9"
}, [createVNode("path", {
"d": "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"
}, null), createVNode("path", {
"d": "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",
"fill": "#FAFAFA",
"class": "".concat(prefixCls, "-path")
}, null)])])]);
};
Simple.PRESENTED_IMAGE_SIMPLE = true;
const SimpleEmptyImg = Simple;
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 n2 && e(t2.prototype, n2), r2 && e(t2, r2), t2;
}
function n$1() {
return (n$1 = 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$1(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$1 = 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$1(e2) && d(e2, "_vueTypes_name");
}, m = function(e2) {
return s$1(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;
void 0 === n2 && (n2 = false);
var i2 = true, o2 = "";
r2 = s$1(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, true);
}), o2 = r2.type.map(function(e3) {
return l$1(e3);
}).join(" or ")) : i2 = "Array" === (o2 = l$1(r2)) ? b(t2) : "Object" === o2 ? s$1(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 false === n2 ? (y(a2), false) : 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, false === n2 ? (y(p), i2) : 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, true) ? (this.default = b(e3) ? function() {
return [].concat(e3);
} : s$1(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$1(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, true);
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, true));
});
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], true));
});
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$1(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], true);
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$1({}, this.defaults);
}, set: function(t2) {
this.defaults = false !== t2 ? n$1({}, true !== t2 ? t2 : e2) : {};
} }]), o2;
}($)).defaults = n$1({}, 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, true);
}, 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());
var 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 PropTypes$1 = PropTypes;
var _excluded$s = ["image", "description", "imageStyle", "class"];
var defaultEmptyImg = createVNode(DefaultEmptyImg, null, null);
var simpleEmptyImg = createVNode(SimpleEmptyImg, null, null);
var Empty2 = function Empty3(props3, _ref) {
var _slots$description;
var _ref$slots = _ref.slots, slots = _ref$slots === void 0 ? {} : _ref$slots, attrs = _ref.attrs;
var _useConfigInject = useConfigInject("empty", props3), direction = _useConfigInject.direction, prefixClsRef = _useConfigInject.prefixCls;
var prefixCls = prefixClsRef.value;
var _props$attrs = _objectSpread2$1(_objectSpread2$1({}, props3), attrs), _props$attrs$image = _props$attrs.image, image = _props$attrs$image === void 0 ? defaultEmptyImg : _props$attrs$image, _props$attrs$descript = _props$attrs.description, description = _props$attrs$descript === void 0 ? ((_slots$description = slots.description) === null || _slots$description === void 0 ? void 0 : _slots$description.call(slots)) || void 0 : _props$attrs$descript, imageStyle = _props$attrs.imageStyle, _props$attrs$class = _props$attrs.class, className = _props$attrs$class === void 0 ? "" : _props$attrs$class, restProps = _objectWithoutProperties$2(_props$attrs, _excluded$s);
return createVNode(LocaleReceiver, {
"componentName": "Empty",
"children": function children(locale3) {
var _classNames;
var des = typeof description !== "undefined" ? description : locale3.description;
var alt = typeof des === "string" ? des : "empty";
var imageNode = null;
if (typeof image === "string") {
imageNode = createVNode("img", {
"alt": alt,
"src": image
}, null);
} else {
imageNode = image;
}
return createVNode("div", _objectSpread2$1({
"class": classNames(prefixCls, className, (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls, "-normal"), image === simpleEmptyImg), _defineProperty$q(_classNames, "".concat(prefixCls, "-rtl"), direction.value === "rtl"), _classNames))
}, restProps), [createVNode("div", {
"class": "".concat(prefixCls, "-image"),
"style": imageStyle
}, [imageNode]), des && createVNode("p", {
"class": "".concat(prefixCls, "-description")
}, [des]), slots.default && createVNode("div", {
"class": "".concat(prefixCls, "-footer")
}, [filterEmpty(slots.default())])]);
}
}, null);
};
Empty2.displayName = "AEmpty";
Empty2.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg;
Empty2.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg;
Empty2.inheritAttrs = false;
Empty2.props = {
prefixCls: String,
image: PropTypes$1.any,
description: PropTypes$1.any,
imageStyle: {
type: Object,
default: void 0
}
};
const Empty$1 = withInstall(Empty2);
var RenderEmpty = function RenderEmpty2(props3) {
var _useConfigInject = useConfigInject("empty", props3), prefixCls = _useConfigInject.prefixCls;
var renderHtml = function renderHtml2(componentName) {
switch (componentName) {
case "Table":
case "List":
return createVNode(Empty$1, {
"image": Empty$1.PRESENTED_IMAGE_SIMPLE
}, null);
case "Select":
case "TreeSelect":
case "Cascader":
case "Transfer":
case "Mentions":
return createVNode(Empty$1, {
"image": Empty$1.PRESENTED_IMAGE_SIMPLE,
"class": "".concat(prefixCls.value, "-small")
}, null);
default:
return createVNode(Empty$1, null, null);
}
};
return renderHtml(props3.componentName);
};
function renderEmpty(componentName) {
return createVNode(RenderEmpty, {
"componentName": componentName
}, null);
}
var warned = {};
function warning$2(valid, message2) {
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
console.error("Warning: ".concat(message2));
}
}
function note(valid, message2) {
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
console.warn("Note: ".concat(message2));
}
}
function call(method, valid, message2) {
if (!valid && !warned[message2]) {
method(false, message2);
warned[message2] = true;
}
}
function warningOnce(valid, message2) {
call(warning$2, valid, message2);
}
function noteOnce(valid, message2) {
call(note, valid, message2);
}
const warning$1 = function(valid, component) {
var message2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
warningOnce(valid, "[antdv: ".concat(component, "] ").concat(message2));
};
var ANT_MARK = "internalMark";
var LocaleProvider = defineComponent({
compatConfig: {
MODE: 3
},
name: "ALocaleProvider",
props: {
locale: {
type: Object
},
ANT_MARK__: String
},
setup: function setup3(props3, _ref) {
var slots = _ref.slots;
warning$1(props3.ANT_MARK__ === ANT_MARK, "LocaleProvider", "`LocaleProvider` is deprecated. Please use `locale` with `ConfigProvider` instead");
var state = reactive({
antLocale: _objectSpread2$1(_objectSpread2$1({}, props3.locale), {}, {
exist: true
}),
ANT_MARK__: ANT_MARK
});
provide("localeData", state);
watch(function() {
return props3.locale;
}, function() {
state.antLocale = _objectSpread2$1(_objectSpread2$1({}, props3.locale), {}, {
exist: true
});
}, {
immediate: true
});
return function() {
var _slots$default;
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
};
}
});
LocaleProvider.install = function(app) {
app.component(LocaleProvider.name, LocaleProvider);
return app;
};
const LocaleProvider$1 = withInstall(LocaleProvider);
tuple$1("bottomLeft", "bottomRight", "topLeft", "topRight");
var getTransitionProps = function getTransitionProps2(transitionName2) {
var opt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var transitionProps = transitionName2 ? _objectSpread2$1({
name: transitionName2,
appear: true,
// type: 'animation',
// appearFromClass: `${transitionName}-appear ${transitionName}-appear-prepare`,
// appearActiveClass: `antdv-base-transtion`,
// appearToClass: `${transitionName}-appear ${transitionName}-appear-active`,
enterFromClass: "".concat(transitionName2, "-enter ").concat(transitionName2, "-enter-prepare"),
enterActiveClass: "".concat(transitionName2, "-enter ").concat(transitionName2, "-enter-prepare"),
enterToClass: "".concat(transitionName2, "-enter ").concat(transitionName2, "-enter-active"),
leaveFromClass: " ".concat(transitionName2, "-leave"),
leaveActiveClass: "".concat(transitionName2, "-leave ").concat(transitionName2, "-leave-active"),
leaveToClass: "".concat(transitionName2, "-leave ").concat(transitionName2, "-leave-active")
}, opt) : _objectSpread2$1({
css: false
}, opt);
return transitionProps;
};
var getTransitionGroupProps = function getTransitionGroupProps2(transitionName2) {
var opt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var transitionProps = transitionName2 ? _objectSpread2$1({
name: transitionName2,
appear: true,
// appearFromClass: `${transitionName}-appear ${transitionName}-appear-prepare`,
appearActiveClass: "".concat(transitionName2),
appearToClass: "".concat(transitionName2, "-appear ").concat(transitionName2, "-appear-active"),
enterFromClass: "".concat(transitionName2, "-appear ").concat(transitionName2, "-enter ").concat(transitionName2, "-appear-prepare ").concat(transitionName2, "-enter-prepare"),
enterActiveClass: "".concat(transitionName2),
enterToClass: "".concat(transitionName2, "-enter ").concat(transitionName2, "-appear ").concat(transitionName2, "-appear-active ").concat(transitionName2, "-enter-active"),
leaveActiveClass: "".concat(transitionName2, " ").concat(transitionName2, "-leave"),
leaveToClass: "".concat(transitionName2, "-leave-active")
}, opt) : _objectSpread2$1({
css: false
}, opt);
return transitionProps;
};
var getTransitionName$1 = function getTransitionName(rootPrefixCls, motion, transitionName2) {
if (transitionName2 !== void 0) {
return transitionName2;
}
return "".concat(rootPrefixCls, "-").concat(motion);
};
const Notice = defineComponent({
name: "Notice",
inheritAttrs: false,
props: ["prefixCls", "duration", "updateMark", "noticeKey", "closeIcon", "closable", "props", "onClick", "onClose", "holder", "visible"],
setup: function setup4(props3, _ref) {
var attrs = _ref.attrs, slots = _ref.slots;
var closeTimer;
var isUnMounted = false;
var duration = computed(function() {
return props3.duration === void 0 ? 4.5 : props3.duration;
});
var startCloseTimer = function startCloseTimer2() {
if (duration.value && !isUnMounted) {
closeTimer = setTimeout(function() {
close3();
}, duration.value * 1e3);
}
};
var clearCloseTimer = function clearCloseTimer2() {
if (closeTimer) {
clearTimeout(closeTimer);
closeTimer = null;
}
};
var close3 = function close4(e2) {
if (e2) {
e2.stopPropagation();
}
clearCloseTimer();
var onClose = props3.onClose, noticeKey = props3.noticeKey;
if (onClose) {
onClose(noticeKey);
}
};
var restartCloseTimer = function restartCloseTimer2() {
clearCloseTimer();
startCloseTimer();
};
onMounted(function() {
startCloseTimer();
});
onUnmounted(function() {
isUnMounted = true;
clearCloseTimer();
});
watch([duration, function() {
return props3.updateMark;
}, function() {
return props3.visible;
}], function(_ref2, _ref3) {
var _ref4 = _slicedToArray$2(_ref2, 3), preDuration = _ref4[0], preUpdateMark = _ref4[1], preVisible = _ref4[2];
var _ref5 = _slicedToArray$2(_ref3, 3), newDuration = _ref5[0], newUpdateMark = _ref5[1], newVisible = _ref5[2];
if (preDuration !== newDuration || preUpdateMark !== newUpdateMark || preVisible !== newVisible && newVisible) {
restartCloseTimer();
}
}, {
flush: "post"
});
return function() {
var _slots$closeIcon, _slots$default;
var prefixCls = props3.prefixCls, closable = props3.closable, _props$closeIcon = props3.closeIcon, closeIcon = _props$closeIcon === void 0 ? (_slots$closeIcon = slots.closeIcon) === null || _slots$closeIcon === void 0 ? void 0 : _slots$closeIcon.call(slots) : _props$closeIcon, onClick2 = props3.onClick, holder = props3.holder;
var className = attrs.class, style = attrs.style;
var componentClass = "".concat(prefixCls, "-notice");
var dataOrAriaAttributeProps = Object.keys(attrs).reduce(function(acc, key2) {
if (key2.substr(0, 5) === "data-" || key2.substr(0, 5) === "aria-" || key2 === "role") {
acc[key2] = attrs[key2];
}
return acc;
}, {});
var node = createVNode("div", _objectSpread2$1({
"class": classNames(componentClass, className, _defineProperty$q({}, "".concat(componentClass, "-closable"), closable)),
"style": style,
"onMouseenter": clearCloseTimer,
"onMouseleave": startCloseTimer,
"onClick": onClick2
}, dataOrAriaAttributeProps), [createVNode("div", {
"class": "".concat(componentClass, "-content")
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]), closable ? createVNode("a", {
"tabindex": 0,
"onClick": close3,
"class": "".concat(componentClass, "-close")
}, [closeIcon || createVNode("span", {
"class": "".concat(componentClass, "-close-x")
}, null)]) : null]);
if (holder) {
return createVNode(Teleport, {
"to": holder
}, {
default: function _default3() {
return node;
}
});
}
return node;
};
}
});
var _excluded$r = ["name", "getContainer", "appContext", "prefixCls", "rootPrefixCls", "transitionName", "hasTransitionName"];
var seed = 0;
var now$2 = Date.now();
function getUuid() {
var id = seed;
seed += 1;
return "rcNotification_".concat(now$2, "_").concat(id);
}
var Notification = defineComponent({
name: "Notification",
inheritAttrs: false,
props: ["prefixCls", "transitionName", "animation", "maxCount", "closeIcon"],
setup: function setup5(props3, _ref) {
var attrs = _ref.attrs, expose = _ref.expose, slots = _ref.slots;
var hookRefs = /* @__PURE__ */ new Map();
var notices = ref([]);
var transitionProps = computed(function() {
var prefixCls = props3.prefixCls, _props$animation = props3.animation, animation = _props$animation === void 0 ? "fade" : _props$animation;
var name = props3.transitionName;
if (!name && animation) {
name = "".concat(prefixCls, "-").concat(animation);
}
return getTransitionGroupProps(name);
});
var add = function add2(originNotice, holderCallback) {
var key2 = originNotice.key || getUuid();
var notice2 = _objectSpread2$1(_objectSpread2$1({}, originNotice), {}, {
key: key2
});
var maxCount2 = props3.maxCount;
var noticeIndex = notices.value.map(function(v2) {
return v2.notice.key;
}).indexOf(key2);
var updatedNotices = notices.value.concat();
if (noticeIndex !== -1) {
updatedNotices.splice(noticeIndex, 1, {
notice: notice2,
holderCallback
});
} else {
if (maxCount2 && notices.value.length >= maxCount2) {
notice2.key = updatedNotices[0].notice.key;
notice2.updateMark = getUuid();
notice2.userPassKey = key2;
updatedNotices.shift();
}
updatedNotices.push({
notice: notice2,
holderCallback
});
}
notices.value = updatedNotices;
};
var remove = function remove2(removeKey) {
notices.value = notices.value.filter(function(_ref2) {
var _ref2$notice = _ref2.notice, key2 = _ref2$notice.key, userPassKey = _ref2$notice.userPassKey;
var mergedKey = userPassKey || key2;
return mergedKey !== removeKey;
});
};
expose({
add,
remove,
notices
});
return function() {
var _slots$closeIcon, _className;
var prefixCls = props3.prefixCls, _props$closeIcon = props3.closeIcon, closeIcon = _props$closeIcon === void 0 ? (_slots$closeIcon = slots.closeIcon) === null || _slots$closeIcon === void 0 ? void 0 : _slots$closeIcon.call(slots, {
prefixCls
}) : _props$closeIcon;
var noticeNodes = notices.value.map(function(_ref3, index2) {
var notice2 = _ref3.notice, holderCallback = _ref3.holderCallback;
var updateMark = index2 === notices.value.length - 1 ? notice2.updateMark : void 0;
var key2 = notice2.key, userPassKey = notice2.userPassKey;
var content = notice2.content;
var noticeProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
prefixCls,
closeIcon: typeof closeIcon === "function" ? closeIcon({
prefixCls
}) : closeIcon
}, notice2), notice2.props), {}, {
key: key2,
noticeKey: userPassKey || key2,
updateMark,
onClose: function onClose(noticeKey) {
var _notice$onClose;
remove(noticeKey);
(_notice$onClose = notice2.onClose) === null || _notice$onClose === void 0 ? void 0 : _notice$onClose.call(notice2);
},
onClick: notice2.onClick
});
if (holderCallback) {
return createVNode("div", {
"key": key2,
"class": "".concat(prefixCls, "-hook-holder"),
"ref": function ref2(div) {
if (typeof key2 === "undefined") {
return;
}
if (div) {
hookRefs.set(key2, div);
holderCallback(div, noticeProps);
} else {
hookRefs.delete(key2);
}
}
}, null);
}
return createVNode(Notice, noticeProps, {
default: function _default3() {
return [typeof content === "function" ? content({
prefixCls
}) : content];
}
});
});
var className = (_className = {}, _defineProperty$q(_className, prefixCls, 1), _defineProperty$q(_className, attrs.class, !!attrs.class), _className);
return createVNode("div", {
"class": className,
"style": attrs.style || {
top: "65px",
left: "50%"
}
}, [createVNode(TransitionGroup, _objectSpread2$1({
"tag": "div"
}, transitionProps.value), {
default: function _default3() {
return [noticeNodes];
}
})]);
};
}
});
Notification.newInstance = function newNotificationInstance(properties, callback) {
var _ref4 = properties || {}, _ref4$name = _ref4.name, name = _ref4$name === void 0 ? "notification" : _ref4$name, getContainer4 = _ref4.getContainer, appContext = _ref4.appContext, customizePrefixCls = _ref4.prefixCls, customRootPrefixCls = _ref4.rootPrefixCls, customTransitionName = _ref4.transitionName, hasTransitionName2 = _ref4.hasTransitionName, props3 = _objectWithoutProperties$2(_ref4, _excluded$r);
var div = document.createElement("div");
if (getContainer4) {
var root2 = getContainer4();
root2.appendChild(div);
} else {
document.body.appendChild(div);
}
var Wrapper = defineComponent({
compatConfig: {
MODE: 3
},
name: "NotificationWrapper",
setup: function setup99(_props, _ref5) {
var attrs = _ref5.attrs;
var notiRef = ref();
onMounted(function() {
callback({
notice: function notice2(noticeProps) {
var _notiRef$value;
(_notiRef$value = notiRef.value) === null || _notiRef$value === void 0 ? void 0 : _notiRef$value.add(noticeProps);
},
removeNotice: function removeNotice(key2) {
var _notiRef$value2;
(_notiRef$value2 = notiRef.value) === null || _notiRef$value2 === void 0 ? void 0 : _notiRef$value2.remove(key2);
},
destroy: function destroy3() {
render(null, div);
if (div.parentNode) {
div.parentNode.removeChild(div);
}
},
component: notiRef
});
});
return function() {
var global2 = globalConfigForApi;
var prefixCls = global2.getPrefixCls(name, customizePrefixCls);
var rootPrefixCls = global2.getRootPrefixCls(customRootPrefixCls, prefixCls);
var transitionName2 = hasTransitionName2 ? customTransitionName : "".concat(rootPrefixCls, "-").concat(customTransitionName);
return createVNode(ConfigProvider$1, _objectSpread2$1(_objectSpread2$1({}, global2), {}, {
"notUpdateGlobalConfig": true,
"prefixCls": rootPrefixCls
}), {
default: function _default3() {
return [createVNode(Notification, _objectSpread2$1(_objectSpread2$1({
"ref": notiRef
}, attrs), {}, {
"prefixCls": prefixCls,
"transitionName": transitionName2
}), null)];
}
});
};
}
});
var vm = createVNode(Wrapper, props3);
vm.appContext = appContext || vm.appContext;
render(vm, div);
};
const Notification$1 = Notification;
var LoadingOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } }] }, "name": "loading", "theme": "outlined" };
const LoadingOutlinedSvg = LoadingOutlined$2;
function bound01(n2, max) {
if (isOnePointZero(n2)) {
n2 = "100%";
}
var isPercent = isPercentage(n2);
n2 = max === 360 ? n2 : Math.min(max, Math.max(0, parseFloat(n2)));
if (isPercent) {
n2 = parseInt(String(n2 * max), 10) / 100;
}
if (Math.abs(n2 - max) < 1e-6) {
return 1;
}
if (max === 360) {
n2 = (n2 < 0 ? n2 % max + max : n2 % max) / parseFloat(String(max));
} else {
n2 = n2 % max / parseFloat(String(max));
}
return n2;
}
function clamp01(val) {
return Math.min(1, Math.max(0, val));
}
function isOnePointZero(n2) {
return typeof n2 === "string" && n2.indexOf(".") !== -1 && parseFloat(n2) === 1;
}
function isPercentage(n2) {
return typeof n2 === "string" && n2.indexOf("%") !== -1;
}
function boundAlpha(a2) {
a2 = parseFloat(a2);
if (isNaN(a2) || a2 < 0 || a2 > 1) {
a2 = 1;
}
return a2;
}
function convertToPercentage(n2) {
if (n2 <= 1) {
return "".concat(Number(n2) * 100, "%");
}
return n2;
}
function pad2(c2) {
return c2.length === 1 ? "0" + c2 : String(c2);
}
function rgbToRgb(r2, g2, b2) {
return {
r: bound01(r2, 255) * 255,
g: bound01(g2, 255) * 255,
b: bound01(b2, 255) * 255
};
}
function rgbToHsl(r2, g2, b2) {
r2 = bound01(r2, 255);
g2 = bound01(g2, 255);
b2 = bound01(b2, 255);
var max = Math.max(r2, g2, b2);
var min = Math.min(r2, g2, b2);
var h2 = 0;
var s2 = 0;
var l2 = (max + min) / 2;
if (max === min) {
s2 = 0;
h2 = 0;
} else {
var d2 = max - min;
s2 = l2 > 0.5 ? d2 / (2 - max - min) : d2 / (max + min);
switch (max) {
case r2:
h2 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
break;
case g2:
h2 = (b2 - r2) / d2 + 2;
break;
case b2:
h2 = (r2 - g2) / d2 + 4;
break;
}
h2 /= 6;
}
return { h: h2, s: s2, l: l2 };
}
function hue2rgb(p, q2, t2) {
if (t2 < 0) {
t2 += 1;
}
if (t2 > 1) {
t2 -= 1;
}
if (t2 < 1 / 6) {
return p + (q2 - p) * (6 * t2);
}
if (t2 < 1 / 2) {
return q2;
}
if (t2 < 2 / 3) {
return p + (q2 - p) * (2 / 3 - t2) * 6;
}
return p;
}
function hslToRgb(h2, s2, l2) {
var r2;
var g2;
var b2;
h2 = bound01(h2, 360);
s2 = bound01(s2, 100);
l2 = bound01(l2, 100);
if (s2 === 0) {
g2 = l2;
b2 = l2;
r2 = l2;
} else {
var q2 = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
var p = 2 * l2 - q2;
r2 = hue2rgb(p, q2, h2 + 1 / 3);
g2 = hue2rgb(p, q2, h2);
b2 = hue2rgb(p, q2, h2 - 1 / 3);
}
return { r: r2 * 255, g: g2 * 255, b: b2 * 255 };
}
function rgbToHsv(r2, g2, b2) {
r2 = bound01(r2, 255);
g2 = bound01(g2, 255);
b2 = bound01(b2, 255);
var max = Math.max(r2, g2, b2);
var min = Math.min(r2, g2, b2);
var h2 = 0;
var v2 = max;
var d2 = max - min;
var s2 = max === 0 ? 0 : d2 / max;
if (max === min) {
h2 = 0;
} else {
switch (max) {
case r2:
h2 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
break;
case g2:
h2 = (b2 - r2) / d2 + 2;
break;
case b2:
h2 = (r2 - g2) / d2 + 4;
break;
}
h2 /= 6;
}
return { h: h2, s: s2, v: v2 };
}
function hsvToRgb(h2, s2, v2) {
h2 = bound01(h2, 360) * 6;
s2 = bound01(s2, 100);
v2 = bound01(v2, 100);
var i2 = Math.floor(h2);
var f2 = h2 - i2;
var p = v2 * (1 - s2);
var q2 = v2 * (1 - f2 * s2);
var t2 = v2 * (1 - (1 - f2) * s2);
var mod = i2 % 6;
var r2 = [v2, q2, p, p, t2, v2][mod];
var g2 = [t2, v2, v2, q2, p, p][mod];
var b2 = [p, p, t2, v2, v2, q2][mod];
return { r: r2 * 255, g: g2 * 255, b: b2 * 255 };
}
function rgbToHex(r2, g2, b2, allow3Char) {
var hex = [
pad2(Math.round(r2).toString(16)),
pad2(Math.round(g2).toString(16)),
pad2(Math.round(b2).toString(16))
];
if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
}
return hex.join("");
}
function rgbaToHex(r2, g2, b2, a2, allow4Char) {
var hex = [
pad2(Math.round(r2).toString(16)),
pad2(Math.round(g2).toString(16)),
pad2(Math.round(b2).toString(16)),
pad2(convertDecimalToHex(a2))
];
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))) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
}
return hex.join("");
}
function convertDecimalToHex(d2) {
return Math.round(parseFloat(d2) * 255).toString(16);
}
function convertHexToDecimal(h2) {
return parseIntFromHex(h2) / 255;
}
function parseIntFromHex(val) {
return parseInt(val, 16);
}
function numberInputToObject(color) {
return {
r: color >> 16,
g: (color & 65280) >> 8,
b: color & 255
};
}
var names = {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkgrey: "#a9a9a9",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkslategrey: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
goldenrod: "#daa520",
gold: "#ffd700",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
grey: "#808080",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavenderblush: "#fff0f5",
lavender: "#e6e6fa",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgreen: "#90ee90",
lightgrey: "#d3d3d3",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370db",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#db7093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
rebeccapurple: "#663399",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
slategrey: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
};
function inputToRGB(color) {
var rgb = { r: 0, g: 0, b: 0 };
var a2 = 1;
var s2 = null;
var v2 = null;
var l2 = null;
var ok = false;
var format3 = false;
if (typeof color === "string") {
color = stringInputToObject(color);
}
if (typeof color === "object") {
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
rgb = rgbToRgb(color.r, color.g, color.b);
ok = true;
format3 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
s2 = convertToPercentage(color.s);
v2 = convertToPercentage(color.v);
rgb = hsvToRgb(color.h, s2, v2);
ok = true;
format3 = "hsv";
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
s2 = convertToPercentage(color.s);
l2 = convertToPercentage(color.l);
rgb = hslToRgb(color.h, s2, l2);
ok = true;
format3 = "hsl";
}
if (Object.prototype.hasOwnProperty.call(color, "a")) {
a2 = color.a;
}
}
a2 = boundAlpha(a2);
return {
ok,
format: color.format || format3,
r: Math.min(255, Math.max(rgb.r, 0)),
g: Math.min(255, Math.max(rgb.g, 0)),
b: Math.min(255, Math.max(rgb.b, 0)),
a: a2
};
}
var CSS_INTEGER = "[-\\+]?\\d+%?";
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
var matchers = {
CSS_UNIT: new RegExp(CSS_UNIT),
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
function stringInputToObject(color) {
color = color.trim().toLowerCase();
if (color.length === 0) {
return false;
}
var named = false;
if (names[color]) {
color = names[color];
named = true;
} else if (color === "transparent") {
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
}
var match2 = matchers.rgb.exec(color);
if (match2) {
return { r: match2[1], g: match2[2], b: match2[3] };
}
match2 = matchers.rgba.exec(color);
if (match2) {
return { r: match2[1], g: match2[2], b: match2[3], a: match2[4] };
}
match2 = matchers.hsl.exec(color);
if (match2) {
return { h: match2[1], s: match2[2], l: match2[3] };
}
match2 = matchers.hsla.exec(color);
if (match2) {
return { h: match2[1], s: match2[2], l: match2[3], a: match2[4] };
}
match2 = matchers.hsv.exec(color);
if (match2) {
return { h: match2[1], s: match2[2], v: match2[3] };
}
match2 = matchers.hsva.exec(color);
if (match2) {
return { h: match2[1], s: match2[2], v: match2[3], a: match2[4] };
}
match2 = matchers.hex8.exec(color);
if (match2) {
return {
r: parseIntFromHex(match2[1]),
g: parseIntFromHex(match2[2]),
b: parseIntFromHex(match2[3]),
a: convertHexToDecimal(match2[4]),
format: named ? "name" : "hex8"
};
}
match2 = matchers.hex6.exec(color);
if (match2) {
return {
r: parseIntFromHex(match2[1]),
g: parseIntFromHex(match2[2]),
b: parseIntFromHex(match2[3]),
format: named ? "name" : "hex"
};
}
match2 = matchers.hex4.exec(color);
if (match2) {
return {
r: parseIntFromHex(match2[1] + match2[1]),
g: parseIntFromHex(match2[2] + match2[2]),
b: parseIntFromHex(match2[3] + match2[3]),
a: convertHexToDecimal(match2[4] + match2[4]),
format: named ? "name" : "hex8"
};
}
match2 = matchers.hex3.exec(color);
if (match2) {
return {
r: parseIntFromHex(match2[1] + match2[1]),
g: parseIntFromHex(match2[2] + match2[2]),
b: parseIntFromHex(match2[3] + match2[3]),
format: named ? "name" : "hex"
};
}
return false;
}
function isValidCSSUnit(color) {
return Boolean(matchers.CSS_UNIT.exec(String(color)));
}
var TinyColor = (
/** @class */
function() {
function TinyColor2(color, opts) {
if (color === void 0) {
color = "";
}
if (opts === void 0) {
opts = {};
}
var _a;
if (color instanceof TinyColor2) {
return color;
}
if (typeof color === "number") {
color = numberInputToObject(color);
}
this.originalInput = color;
var rgb = inputToRGB(color);
this.originalInput = color;
this.r = rgb.r;
this.g = rgb.g;
this.b = rgb.b;
this.a = rgb.a;
this.roundA = Math.round(100 * this.a) / 100;
this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
this.gradientType = opts.gradientType;
if (this.r < 1) {
this.r = Math.round(this.r);
}
if (this.g < 1) {
this.g = Math.round(this.g);
}
if (this.b < 1) {
this.b = Math.round(this.b);
}
this.isValid = rgb.ok;
}
TinyColor2.prototype.isDark = function() {
return this.getBrightness() < 128;
};
TinyColor2.prototype.isLight = function() {
return !this.isDark();
};
TinyColor2.prototype.getBrightness = function() {
var rgb = this.toRgb();
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
};
TinyColor2.prototype.getLuminance = function() {
var rgb = this.toRgb();
var R2;
var G;
var B2;
var RsRGB = rgb.r / 255;
var GsRGB = rgb.g / 255;
var BsRGB = rgb.b / 255;
if (RsRGB <= 0.03928) {
R2 = RsRGB / 12.92;
} else {
R2 = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
}
if (GsRGB <= 0.03928) {
G = GsRGB / 12.92;
} else {
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
}
if (BsRGB <= 0.03928) {
B2 = BsRGB / 12.92;
} else {
B2 = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
}
return 0.2126 * R2 + 0.7152 * G + 0.0722 * B2;
};
TinyColor2.prototype.getAlpha = function() {
return this.a;
};
TinyColor2.prototype.setAlpha = function(alpha) {
this.a = boundAlpha(alpha);
this.roundA = Math.round(100 * this.a) / 100;
return this;
};
TinyColor2.prototype.isMonochrome = function() {
var s2 = this.toHsl().s;
return s2 === 0;
};
TinyColor2.prototype.toHsv = function() {
var hsv = rgbToHsv(this.r, this.g, this.b);
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
};
TinyColor2.prototype.toHsvString = function() {
var hsv = rgbToHsv(this.r, this.g, this.b);
var h2 = Math.round(hsv.h * 360);
var s2 = Math.round(hsv.s * 100);
var v2 = Math.round(hsv.v * 100);
return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%)") : "hsva(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%, ").concat(this.roundA, ")");
};
TinyColor2.prototype.toHsl = function() {
var hsl = rgbToHsl(this.r, this.g, this.b);
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
};
TinyColor2.prototype.toHslString = function() {
var hsl = rgbToHsl(this.r, this.g, this.b);
var h2 = Math.round(hsl.h * 360);
var s2 = Math.round(hsl.s * 100);
var l2 = Math.round(hsl.l * 100);
return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%)") : "hsla(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%, ").concat(this.roundA, ")");
};
TinyColor2.prototype.toHex = function(allow3Char) {
if (allow3Char === void 0) {
allow3Char = false;
}
return rgbToHex(this.r, this.g, this.b, allow3Char);
};
TinyColor2.prototype.toHexString = function(allow3Char) {
if (allow3Char === void 0) {
allow3Char = false;
}
return "#" + this.toHex(allow3Char);
};
TinyColor2.prototype.toHex8 = function(allow4Char) {
if (allow4Char === void 0) {
allow4Char = false;
}
return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
};
TinyColor2.prototype.toHex8String = function(allow4Char) {
if (allow4Char === void 0) {
allow4Char = false;
}
return "#" + this.toHex8(allow4Char);
};
TinyColor2.prototype.toHexShortString = function(allowShortChar) {
if (allowShortChar === void 0) {
allowShortChar = false;
}
return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
};
TinyColor2.prototype.toRgb = function() {
return {
r: Math.round(this.r),
g: Math.round(this.g),
b: Math.round(this.b),
a: this.a
};
};
TinyColor2.prototype.toRgbString = function() {
var r2 = Math.round(this.r);
var g2 = Math.round(this.g);
var b2 = Math.round(this.b);
return this.a === 1 ? "rgb(".concat(r2, ", ").concat(g2, ", ").concat(b2, ")") : "rgba(".concat(r2, ", ").concat(g2, ", ").concat(b2, ", ").concat(this.roundA, ")");
};
TinyColor2.prototype.toPercentageRgb = function() {
var fmt = function(x2) {
return "".concat(Math.round(bound01(x2, 255) * 100), "%");
};
return {
r: fmt(this.r),
g: fmt(this.g),
b: fmt(this.b),
a: this.a
};
};
TinyColor2.prototype.toPercentageRgbString = function() {
var rnd = function(x2) {
return Math.round(bound01(x2, 255) * 100);
};
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, ")");
};
TinyColor2.prototype.toName = function() {
if (this.a === 0) {
return "transparent";
}
if (this.a < 1) {
return false;
}
var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
var _b = _a[_i], key2 = _b[0], value2 = _b[1];
if (hex === value2) {
return key2;
}
}
return false;
};
TinyColor2.prototype.toString = function(format3) {
var formatSet = Boolean(format3);
format3 = format3 !== null && format3 !== void 0 ? format3 : this.format;
var formattedString = false;
var hasAlpha = this.a < 1 && this.a >= 0;
var needsAlphaFormat = !formatSet && hasAlpha && (format3.startsWith("hex") || format3 === "name");
if (needsAlphaFormat) {
if (format3 === "name" && this.a === 0) {
return this.toName();
}
return this.toRgbString();
}
if (format3 === "rgb") {
formattedString = this.toRgbString();
}
if (format3 === "prgb") {
formattedString = this.toPercentageRgbString();
}
if (format3 === "hex" || format3 === "hex6") {
formattedString = this.toHexString();
}
if (format3 === "hex3") {
formattedString = this.toHexString(true);
}
if (format3 === "hex4") {
formattedString = this.toHex8String(true);
}
if (format3 === "hex8") {
formattedString = this.toHex8String();
}
if (format3 === "name") {
formattedString = this.toName();
}
if (format3 === "hsl") {
formattedString = this.toHslString();
}
if (format3 === "hsv") {
formattedString = this.toHsvString();
}
return formattedString || this.toHexString();
};
TinyColor2.prototype.toNumber = function() {
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
};
TinyColor2.prototype.clone = function() {
return new TinyColor2(this.toString());
};
TinyColor2.prototype.lighten = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.l += amount / 100;
hsl.l = clamp01(hsl.l);
return new TinyColor2(hsl);
};
TinyColor2.prototype.brighten = function(amount) {
if (amount === void 0) {
amount = 10;
}
var rgb = this.toRgb();
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
return new TinyColor2(rgb);
};
TinyColor2.prototype.darken = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.l -= amount / 100;
hsl.l = clamp01(hsl.l);
return new TinyColor2(hsl);
};
TinyColor2.prototype.tint = function(amount) {
if (amount === void 0) {
amount = 10;
}
return this.mix("white", amount);
};
TinyColor2.prototype.shade = function(amount) {
if (amount === void 0) {
amount = 10;
}
return this.mix("black", amount);
};
TinyColor2.prototype.desaturate = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.s -= amount / 100;
hsl.s = clamp01(hsl.s);
return new TinyColor2(hsl);
};
TinyColor2.prototype.saturate = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.s += amount / 100;
hsl.s = clamp01(hsl.s);
return new TinyColor2(hsl);
};
TinyColor2.prototype.greyscale = function() {
return this.desaturate(100);
};
TinyColor2.prototype.spin = function(amount) {
var hsl = this.toHsl();
var hue = (hsl.h + amount) % 360;
hsl.h = hue < 0 ? 360 + hue : hue;
return new TinyColor2(hsl);
};
TinyColor2.prototype.mix = function(color, amount) {
if (amount === void 0) {
amount = 50;
}
var rgb1 = this.toRgb();
var rgb2 = new TinyColor2(color).toRgb();
var p = amount / 100;
var rgba = {
r: (rgb2.r - rgb1.r) * p + rgb1.r,
g: (rgb2.g - rgb1.g) * p + rgb1.g,
b: (rgb2.b - rgb1.b) * p + rgb1.b,
a: (rgb2.a - rgb1.a) * p + rgb1.a
};
return new TinyColor2(rgba);
};
TinyColor2.prototype.analogous = function(results, slices) {
if (results === void 0) {
results = 6;
}
if (slices === void 0) {
slices = 30;
}
var hsl = this.toHsl();
var part = 360 / slices;
var ret = [this];
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
hsl.h = (hsl.h + part) % 360;
ret.push(new TinyColor2(hsl));
}
return ret;
};
TinyColor2.prototype.complement = function() {
var hsl = this.toHsl();
hsl.h = (hsl.h + 180) % 360;
return new TinyColor2(hsl);
};
TinyColor2.prototype.monochromatic = function(results) {
if (results === void 0) {
results = 6;
}
var hsv = this.toHsv();
var h2 = hsv.h;
var s2 = hsv.s;
var v2 = hsv.v;
var res = [];
var modification = 1 / results;
while (results--) {
res.push(new TinyColor2({ h: h2, s: s2, v: v2 }));
v2 = (v2 + modification) % 1;
}
return res;
};
TinyColor2.prototype.splitcomplement = function() {
var hsl = this.toHsl();
var h2 = hsl.h;
return [
this,
new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
];
};
TinyColor2.prototype.onBackground = function(background) {
var fg = this.toRgb();
var bg = new TinyColor2(background).toRgb();
var alpha = fg.a + bg.a * (1 - fg.a);
return new TinyColor2({
r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
a: alpha
});
};
TinyColor2.prototype.triad = function() {
return this.polyad(3);
};
TinyColor2.prototype.tetrad = function() {
return this.polyad(4);
};
TinyColor2.prototype.polyad = function(n2) {
var hsl = this.toHsl();
var h2 = hsl.h;
var result = [this];
var increment = 360 / n2;
for (var i2 = 1; i2 < n2; i2++) {
result.push(new TinyColor2({ h: (h2 + i2 * increment) % 360, s: hsl.s, l: hsl.l }));
}
return result;
};
TinyColor2.prototype.equals = function(color) {
return this.toRgbString() === new TinyColor2(color).toRgbString();
};
return TinyColor2;
}()
);
var hueStep = 2;
var saturationStep = 0.16;
var saturationStep2 = 0.05;
var brightnessStep1 = 0.05;
var brightnessStep2 = 0.15;
var lightColorCount = 5;
var darkColorCount = 4;
var darkColorMap = [{
index: 7,
opacity: 0.15
}, {
index: 6,
opacity: 0.25
}, {
index: 5,
opacity: 0.3
}, {
index: 5,
opacity: 0.45
}, {
index: 5,
opacity: 0.65
}, {
index: 5,
opacity: 0.85
}, {
index: 4,
opacity: 0.9
}, {
index: 3,
opacity: 0.95
}, {
index: 2,
opacity: 0.97
}, {
index: 1,
opacity: 0.98
}];
function toHsv(_ref) {
var r2 = _ref.r, g2 = _ref.g, b2 = _ref.b;
var hsv = rgbToHsv(r2, g2, b2);
return {
h: hsv.h * 360,
s: hsv.s,
v: hsv.v
};
}
function toHex(_ref2) {
var r2 = _ref2.r, g2 = _ref2.g, b2 = _ref2.b;
return "#".concat(rgbToHex(r2, g2, b2, false));
}
function mix$1(rgb1, rgb2, amount) {
var p = amount / 100;
var rgb = {
r: (rgb2.r - rgb1.r) * p + rgb1.r,
g: (rgb2.g - rgb1.g) * p + rgb1.g,
b: (rgb2.b - rgb1.b) * p + rgb1.b
};
return rgb;
}
function getHue(hsv, i2, light) {
var hue;
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
hue = light ? Math.round(hsv.h) - hueStep * i2 : Math.round(hsv.h) + hueStep * i2;
} else {
hue = light ? Math.round(hsv.h) + hueStep * i2 : Math.round(hsv.h) - hueStep * i2;
}
if (hue < 0) {
hue += 360;
} else if (hue >= 360) {
hue -= 360;
}
return hue;
}
function getSaturation(hsv, i2, light) {
if (hsv.h === 0 && hsv.s === 0) {
return hsv.s;
}
var saturation;
if (light) {
saturation = hsv.s - saturationStep * i2;
} else if (i2 === darkColorCount) {
saturation = hsv.s + saturationStep;
} else {
saturation = hsv.s + saturationStep2 * i2;
}
if (saturation > 1) {
saturation = 1;
}
if (light && i2 === lightColorCount && saturation > 0.1) {
saturation = 0.1;
}
if (saturation < 0.06) {
saturation = 0.06;
}
return Number(saturation.toFixed(2));
}
function getValue$2(hsv, i2, light) {
var value2;
if (light) {
value2 = hsv.v + brightnessStep1 * i2;
} else {
value2 = hsv.v - brightnessStep2 * i2;
}
if (value2 > 1) {
value2 = 1;
}
return Number(value2.toFixed(2));
}
function generate$2(color) {
var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var patterns = [];
var pColor = inputToRGB(color);
for (var i2 = lightColorCount; i2 > 0; i2 -= 1) {
var hsv = toHsv(pColor);
var colorString = toHex(inputToRGB({
h: getHue(hsv, i2, true),
s: getSaturation(hsv, i2, true),
v: getValue$2(hsv, i2, true)
}));
patterns.push(colorString);
}
patterns.push(toHex(pColor));
for (var _i = 1; _i <= darkColorCount; _i += 1) {
var _hsv = toHsv(pColor);
var _colorString = toHex(inputToRGB({
h: getHue(_hsv, _i),
s: getSaturation(_hsv, _i),
v: getValue$2(_hsv, _i)
}));
patterns.push(_colorString);
}
if (opts.theme === "dark") {
return darkColorMap.map(function(_ref3) {
var index2 = _ref3.index, opacity = _ref3.opacity;
var darkColorString = toHex(mix$1(inputToRGB(opts.backgroundColor || "#141414"), inputToRGB(patterns[index2]), opacity * 100));
return darkColorString;
});
}
return patterns;
}
var presetPrimaryColors = {
red: "#F5222D",
volcano: "#FA541C",
orange: "#FA8C16",
gold: "#FAAD14",
yellow: "#FADB14",
lime: "#A0D911",
green: "#52C41A",
cyan: "#13C2C2",
blue: "#1890FF",
geekblue: "#2F54EB",
purple: "#722ED1",
magenta: "#EB2F96",
grey: "#666666"
};
var presetPalettes = {};
var presetDarkPalettes = {};
Object.keys(presetPrimaryColors).forEach(function(key2) {
presetPalettes[key2] = generate$2(presetPrimaryColors[key2]);
presetPalettes[key2].primary = presetPalettes[key2][5];
presetDarkPalettes[key2] = generate$2(presetPrimaryColors[key2], {
theme: "dark",
backgroundColor: "#141414"
});
presetDarkPalettes[key2].primary = presetDarkPalettes[key2][5];
});
var containers = [];
var styleElements = [];
var usage = "insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";
function createStyleElement() {
var styleElement = document.createElement("style");
styleElement.setAttribute("type", "text/css");
return styleElement;
}
function insertCss(css2, options) {
options = options || {};
if (css2 === void 0) {
throw new Error(usage);
}
var position = options.prepend === true ? "prepend" : "append";
var container = options.container !== void 0 ? options.container : document.querySelector("head");
var containerId = containers.indexOf(container);
if (containerId === -1) {
containerId = containers.push(container) - 1;
styleElements[containerId] = {};
}
var styleElement;
if (styleElements[containerId] !== void 0 && styleElements[containerId][position] !== void 0) {
styleElement = styleElements[containerId][position];
} else {
styleElement = styleElements[containerId][position] = createStyleElement();
if (position === "prepend") {
container.insertBefore(styleElement, container.childNodes[0]);
} else {
container.appendChild(styleElement);
}
}
if (css2.charCodeAt(0) === 65279) {
css2 = css2.substr(1, css2.length);
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText += css2;
} else {
styleElement.textContent += css2;
}
return styleElement;
}
function _objectSpread$o(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$p(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$p(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
function warn$1(valid, message2) {
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
console.error("Warning: ".concat(message2));
}
}
function warning(valid, message2) {
warn$1(valid, "[@ant-design/icons-vue] ".concat(message2));
}
function isIconDefinition(target) {
return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
}
function generate$1(node, key2, rootProps) {
if (!rootProps) {
return h$1(node.tag, _objectSpread$o({
key: key2
}, node.attrs), (node.children || []).map(function(child, index2) {
return generate$1(child, "".concat(key2, "-").concat(node.tag, "-").concat(index2));
}));
}
return h$1(node.tag, _objectSpread$o({
key: key2
}, rootProps, node.attrs), (node.children || []).map(function(child, index2) {
return generate$1(child, "".concat(key2, "-").concat(node.tag, "-").concat(index2));
}));
}
function getSecondaryColor(primaryColor) {
return generate$2(primaryColor)[0];
}
function normalizeTwoToneColors(twoToneColor) {
if (!twoToneColor) {
return [];
}
return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
}
var iconStyles = "\n.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";
var cssInjectedFlag = false;
var useInsertStyles = function useInsertStyles2() {
var styleStr = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : iconStyles;
nextTick(function() {
if (!cssInjectedFlag) {
if (typeof window !== "undefined" && window.document && window.document.documentElement) {
insertCss(styleStr, {
prepend: true
});
}
cssInjectedFlag = true;
}
});
};
var _excluded$q = ["icon", "primaryColor", "secondaryColor"];
function _objectWithoutProperties$1(source, excluded) {
if (source == null)
return {};
var target = _objectWithoutPropertiesLoose$1(source, excluded);
var key2, i2;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) {
key2 = sourceSymbolKeys[i2];
if (excluded.indexOf(key2) >= 0)
continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key2))
continue;
target[key2] = source[key2];
}
}
return target;
}
function _objectWithoutPropertiesLoose$1(source, excluded) {
if (source == null)
return {};
var target = {};
var sourceKeys = Object.keys(source);
var key2, i2;
for (i2 = 0; i2 < sourceKeys.length; i2++) {
key2 = sourceKeys[i2];
if (excluded.indexOf(key2) >= 0)
continue;
target[key2] = source[key2];
}
return target;
}
function _objectSpread$n(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$o(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$o(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var twoToneColorPalette = {
primaryColor: "#333",
secondaryColor: "#E6E6E6",
calculated: false
};
function setTwoToneColors(_ref) {
var primaryColor = _ref.primaryColor, secondaryColor = _ref.secondaryColor;
twoToneColorPalette.primaryColor = primaryColor;
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
twoToneColorPalette.calculated = !!secondaryColor;
}
function getTwoToneColors() {
return _objectSpread$n({}, twoToneColorPalette);
}
var IconBase = function IconBase2(props3, context) {
var _props$context$attrs = _objectSpread$n({}, props3, context.attrs), icon = _props$context$attrs.icon, primaryColor = _props$context$attrs.primaryColor, secondaryColor = _props$context$attrs.secondaryColor, restProps = _objectWithoutProperties$1(_props$context$attrs, _excluded$q);
var colors = twoToneColorPalette;
if (primaryColor) {
colors = {
primaryColor,
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
};
}
useInsertStyles();
warning(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
if (!isIconDefinition(icon)) {
return null;
}
var target = icon;
if (target && typeof target.icon === "function") {
target = _objectSpread$n({}, target, {
icon: target.icon(colors.primaryColor, colors.secondaryColor)
});
}
return generate$1(target.icon, "svg-".concat(target.name), _objectSpread$n({}, restProps, {
"data-icon": target.name,
width: "1em",
height: "1em",
fill: "currentColor",
"aria-hidden": "true"
}));
};
IconBase.props = {
icon: Object,
primaryColor: String,
secondaryColor: String,
focusable: String
};
IconBase.inheritAttrs = false;
IconBase.displayName = "IconBase";
IconBase.getTwoToneColors = getTwoToneColors;
IconBase.setTwoToneColors = setTwoToneColors;
const VueIcon = IconBase;
function _slicedToArray$1(arr, i2) {
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i2) || _unsupportedIterableToArray$1(arr, i2) || _nonIterableRest$1();
}
function _nonIterableRest$1() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray$1(o2, minLen) {
if (!o2)
return;
if (typeof o2 === "string")
return _arrayLikeToArray$1(o2, minLen);
var n2 = Object.prototype.toString.call(o2).slice(8, -1);
if (n2 === "Object" && o2.constructor)
n2 = o2.constructor.name;
if (n2 === "Map" || n2 === "Set")
return Array.from(o2);
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2))
return _arrayLikeToArray$1(o2, minLen);
}
function _arrayLikeToArray$1(arr, len) {
if (len == null || len > arr.length)
len = arr.length;
for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
arr2[i2] = arr[i2];
}
return arr2;
}
function _iterableToArrayLimit$1(arr, i2) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null)
return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i2 && _arr.length === i2)
break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null)
_i["return"]();
} finally {
if (_d)
throw _e;
}
}
return _arr;
}
function _arrayWithHoles$1(arr) {
if (Array.isArray(arr))
return arr;
}
function setTwoToneColor(twoToneColor) {
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor), _normalizeTwoToneColo2 = _slicedToArray$1(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1];
return VueIcon.setTwoToneColors({
primaryColor,
secondaryColor
});
}
function getTwoToneColor() {
var colors = VueIcon.getTwoToneColors();
if (!colors.calculated) {
return colors.primaryColor;
}
return [colors.primaryColor, colors.secondaryColor];
}
var _excluded$p = ["class", "icon", "spin", "rotate", "tabindex", "twoToneColor", "onClick"];
function _slicedToArray(arr, i2) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i2) || _unsupportedIterableToArray(arr, i2) || _nonIterableRest();
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(o2, minLen) {
if (!o2)
return;
if (typeof o2 === "string")
return _arrayLikeToArray(o2, minLen);
var n2 = Object.prototype.toString.call(o2).slice(8, -1);
if (n2 === "Object" && o2.constructor)
n2 = o2.constructor.name;
if (n2 === "Map" || n2 === "Set")
return Array.from(o2);
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2))
return _arrayLikeToArray(o2, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length)
len = arr.length;
for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
arr2[i2] = arr[i2];
}
return arr2;
}
function _iterableToArrayLimit(arr, i2) {
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
if (_i == null)
return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i2 && _arr.length === i2)
break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null)
_i["return"]();
} finally {
if (_d)
throw _e;
}
}
return _arr;
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr))
return arr;
}
function _objectSpread$m(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$n(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$n(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
function _objectWithoutProperties(source, excluded) {
if (source == null)
return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key2, i2;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) {
key2 = sourceSymbolKeys[i2];
if (excluded.indexOf(key2) >= 0)
continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key2))
continue;
target[key2] = source[key2];
}
}
return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null)
return {};
var target = {};
var sourceKeys = Object.keys(source);
var key2, i2;
for (i2 = 0; i2 < sourceKeys.length; i2++) {
key2 = sourceKeys[i2];
if (excluded.indexOf(key2) >= 0)
continue;
target[key2] = source[key2];
}
return target;
}
setTwoToneColor("#1890ff");
var Icon = function Icon2(props3, context) {
var _classObj;
var _props$context$attrs = _objectSpread$m({}, props3, context.attrs), cls = _props$context$attrs["class"], icon = _props$context$attrs.icon, spin = _props$context$attrs.spin, rotate = _props$context$attrs.rotate, tabindex = _props$context$attrs.tabindex, twoToneColor = _props$context$attrs.twoToneColor, onClick2 = _props$context$attrs.onClick, restProps = _objectWithoutProperties(_props$context$attrs, _excluded$p);
var classObj = (_classObj = {
anticon: true
}, _defineProperty$n(_classObj, "anticon-".concat(icon.name), Boolean(icon.name)), _defineProperty$n(_classObj, cls, cls), _classObj);
var svgClassString = spin === "" || !!spin || icon.name === "loading" ? "anticon-spin" : "";
var iconTabIndex = tabindex;
if (iconTabIndex === void 0 && onClick2) {
iconTabIndex = -1;
restProps.tabindex = iconTabIndex;
}
var svgStyle = rotate ? {
msTransform: "rotate(".concat(rotate, "deg)"),
transform: "rotate(".concat(rotate, "deg)")
} : void 0;
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor), _normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1];
return createVNode("span", _objectSpread$m({
"role": "img",
"aria-label": icon.name
}, restProps, {
"onClick": onClick2,
"class": classObj
}), [createVNode(VueIcon, {
"class": svgClassString,
"icon": icon,
"primaryColor": primaryColor,
"secondaryColor": secondaryColor,
"style": svgStyle
}, null)]);
};
Icon.props = {
spin: Boolean,
rotate: Number,
icon: Object,
twoToneColor: String
};
Icon.displayName = "AntdIcon";
Icon.inheritAttrs = false;
Icon.getTwoToneColor = getTwoToneColor;
Icon.setTwoToneColor = setTwoToneColor;
const AntdIcon = Icon;
function _objectSpread$l(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$m(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$m(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var LoadingOutlined = function LoadingOutlined2(props3, context) {
var p = _objectSpread$l({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$l({}, p, {
"icon": LoadingOutlinedSvg
}), null);
};
LoadingOutlined.displayName = "LoadingOutlined";
LoadingOutlined.inheritAttrs = false;
const LoadingOutlined$1 = LoadingOutlined;
var ExclamationCircleFilled$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "exclamation-circle", "theme": "filled" };
const ExclamationCircleFilledSvg = ExclamationCircleFilled$2;
function _objectSpread$k(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$l(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$l(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var ExclamationCircleFilled = function ExclamationCircleFilled2(props3, context) {
var p = _objectSpread$k({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$k({}, p, {
"icon": ExclamationCircleFilledSvg
}), null);
};
ExclamationCircleFilled.displayName = "ExclamationCircleFilled";
ExclamationCircleFilled.inheritAttrs = false;
const ExclamationCircleFilled$1 = ExclamationCircleFilled;
var CloseCircleFilled$2 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" } }] }, "name": "close-circle", "theme": "filled" };
const CloseCircleFilledSvg = CloseCircleFilled$2;
function _objectSpread$j(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$k(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$k(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var CloseCircleFilled = function CloseCircleFilled2(props3, context) {
var p = _objectSpread$j({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$j({}, p, {
"icon": CloseCircleFilledSvg
}), null);
};
CloseCircleFilled.displayName = "CloseCircleFilled";
CloseCircleFilled.inheritAttrs = false;
const CloseCircleFilled$1 = CloseCircleFilled;
var CheckCircleFilled$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" } }] }, "name": "check-circle", "theme": "filled" };
const CheckCircleFilledSvg = CheckCircleFilled$2;
function _objectSpread$i(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$j(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$j(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var CheckCircleFilled = function CheckCircleFilled2(props3, context) {
var p = _objectSpread$i({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$i({}, p, {
"icon": CheckCircleFilledSvg
}), null);
};
CheckCircleFilled.displayName = "CheckCircleFilled";
CheckCircleFilled.inheritAttrs = false;
const CheckCircleFilled$1 = CheckCircleFilled;
var InfoCircleFilled$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "info-circle", "theme": "filled" };
const InfoCircleFilledSvg = InfoCircleFilled$2;
function _objectSpread$h(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$i(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$i(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var InfoCircleFilled = function InfoCircleFilled2(props3, context) {
var p = _objectSpread$h({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$h({}, p, {
"icon": InfoCircleFilledSvg
}), null);
};
InfoCircleFilled.displayName = "InfoCircleFilled";
InfoCircleFilled.inheritAttrs = false;
const InfoCircleFilled$1 = InfoCircleFilled;
var defaultDuration$1 = 3;
var defaultTop$1;
var messageInstance;
var key = 1;
var localPrefixCls = "";
var transitionName = "move-up";
var hasTransitionName = false;
var getContainer$1 = function getContainer() {
return document.body;
};
var maxCount$1;
var rtl$1 = false;
function getKeyThenIncreaseKey() {
return key++;
}
function setMessageConfig(options) {
if (options.top !== void 0) {
defaultTop$1 = options.top;
messageInstance = null;
}
if (options.duration !== void 0) {
defaultDuration$1 = options.duration;
}
if (options.prefixCls !== void 0) {
localPrefixCls = options.prefixCls;
}
if (options.getContainer !== void 0) {
getContainer$1 = options.getContainer;
messageInstance = null;
}
if (options.transitionName !== void 0) {
transitionName = options.transitionName;
messageInstance = null;
hasTransitionName = true;
}
if (options.maxCount !== void 0) {
maxCount$1 = options.maxCount;
messageInstance = null;
}
if (options.rtl !== void 0) {
rtl$1 = options.rtl;
}
}
function getMessageInstance(args, callback) {
if (messageInstance) {
callback(messageInstance);
return;
}
Notification$1.newInstance({
appContext: args.appContext,
prefixCls: args.prefixCls || localPrefixCls,
rootPrefixCls: args.rootPrefixCls,
transitionName,
hasTransitionName,
style: {
top: defaultTop$1
},
getContainer: getContainer$1 || args.getPopupContainer,
maxCount: maxCount$1,
name: "message"
}, function(instance) {
if (messageInstance) {
callback(messageInstance);
return;
}
messageInstance = instance;
callback(instance);
});
}
var typeToIcon$1 = {
info: InfoCircleFilled$1,
success: CheckCircleFilled$1,
error: CloseCircleFilled$1,
warning: ExclamationCircleFilled$1,
loading: LoadingOutlined$1
};
function notice$1(args) {
var duration = args.duration !== void 0 ? args.duration : defaultDuration$1;
var target = args.key || getKeyThenIncreaseKey();
var closePromise = new Promise(function(resolve) {
var callback = function callback2() {
if (typeof args.onClose === "function") {
args.onClose();
}
return resolve(true);
};
getMessageInstance(args, function(instance) {
instance.notice({
key: target,
duration,
style: args.style || {},
class: args.class,
content: function content(_ref) {
var _classNames;
var prefixCls = _ref.prefixCls;
var Icon3 = typeToIcon$1[args.type];
var iconNode = Icon3 ? createVNode(Icon3, null, null) : "";
var messageClass = classNames("".concat(prefixCls, "-custom-content"), (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls, "-").concat(args.type), args.type), _defineProperty$q(_classNames, "".concat(prefixCls, "-rtl"), rtl$1 === true), _classNames));
return createVNode("div", {
"class": messageClass
}, [typeof args.icon === "function" ? args.icon() : args.icon || iconNode, createVNode("span", null, [typeof args.content === "function" ? args.content() : args.content])]);
},
onClose: callback,
onClick: args.onClick
});
});
});
var result = function result2() {
if (messageInstance) {
messageInstance.removeNotice(target);
}
};
result.then = function(filled, rejected) {
return closePromise.then(filled, rejected);
};
result.promise = closePromise;
return result;
}
function isArgsProps(content) {
return Object.prototype.toString.call(content) === "[object Object]" && !!content.content;
}
var api$1 = {
open: notice$1,
config: setMessageConfig,
destroy: function destroy(messageKey) {
if (messageInstance) {
if (messageKey) {
var _messageInstance = messageInstance, removeNotice = _messageInstance.removeNotice;
removeNotice(messageKey);
} else {
var _messageInstance2 = messageInstance, destroy3 = _messageInstance2.destroy;
destroy3();
messageInstance = null;
}
}
}
};
function attachTypeApi(originalApi, type) {
originalApi[type] = function(content, duration, onClose) {
if (isArgsProps(content)) {
return originalApi.open(_objectSpread2$1(_objectSpread2$1({}, content), {}, {
type
}));
}
if (typeof duration === "function") {
onClose = duration;
duration = void 0;
}
return originalApi.open({
content,
duration,
type,
onClose
});
};
}
["success", "info", "warning", "error", "loading"].forEach(function(type) {
return attachTypeApi(api$1, type);
});
api$1.warn = api$1.warning;
const message = api$1;
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key2, arg) {
try {
var info = gen[key2](arg);
var value2 = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value2);
} else {
Promise.resolve(value2).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self2 = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self2, args);
function _next(value2) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value2);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(void 0);
});
};
}
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
function getDefaultExportFromCjs(x2) {
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
}
function getAugmentedNamespace(n2) {
if (n2.__esModule)
return n2;
var f2 = n2.default;
if (typeof f2 == "function") {
var a2 = function a3() {
if (this instanceof a3) {
return Reflect.construct(f2, arguments, this.constructor);
}
return f2.apply(this, arguments);
};
a2.prototype = f2.prototype;
} else
a2 = {};
Object.defineProperty(a2, "__esModule", { value: true });
Object.keys(n2).forEach(function(k2) {
var d2 = Object.getOwnPropertyDescriptor(n2, k2);
Object.defineProperty(a2, k2, d2.get ? d2 : {
enumerable: true,
get: function() {
return n2[k2];
}
});
});
return a2;
}
var regeneratorRuntime$1 = { exports: {} };
var _typeof$1 = { exports: {} };
(function(module2) {
function _typeof2(obj) {
"@babel/helpers - typeof";
return module2.exports = _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
return typeof obj2;
} : function(obj2) {
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
}, module2.exports.__esModule = true, module2.exports["default"] = module2.exports, _typeof2(obj);
}
module2.exports = _typeof2, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
})(_typeof$1);
var _typeofExports = _typeof$1.exports;
(function(module2) {
var _typeof2 = _typeofExports["default"];
function _regeneratorRuntime2() {
module2.exports = _regeneratorRuntime2 = function _regeneratorRuntime3() {
return exports2;
}, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
var exports2 = {}, Op = Object.prototype, hasOwn3 = Op.hasOwnProperty, defineProperty2 = Object.defineProperty || function(obj, key2, desc) {
obj[key2] = desc.value;
}, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key2, value2) {
return Object.defineProperty(obj, key2, {
value: value2,
enumerable: true,
configurable: true,
writable: true
}), obj[key2];
}
try {
define({}, "");
} catch (err) {
define = function define2(obj, key2, value2) {
return obj[key2] = value2;
};
}
function wrap(innerFn, outerFn, self2, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []);
return defineProperty2(generator, "_invoke", {
value: makeInvokeMethod(innerFn, self2, context)
}), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports2.wrap = wrap;
var ContinueSentinel = {};
function Generator() {
}
function GeneratorFunction() {
}
function GeneratorFunctionPrototype() {
}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn3.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg, value2 = result.value;
return value2 && "object" == _typeof2(value2) && hasOwn3.call(value2, "__await") ? PromiseImpl.resolve(value2.__await).then(function(value3) {
invoke("next", value3, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value2).then(function(unwrapped) {
result.value = unwrapped, resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
defineProperty2(this, "_invoke", {
value: function value2(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}
});
}
function makeInvokeMethod(innerFn, self2, context) {
var state = "suspendedStart";
return function(method, arg) {
if ("executing" === state)
throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method)
throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg; ; ) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel)
continue;
return delegateResult;
}
}
if ("next" === context.method)
context.sent = context._sent = context.arg;
else if ("throw" === context.method) {
if ("suspendedStart" === state)
throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else
"return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self2, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel)
continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}
function maybeInvokeDelegate(delegate, context) {
var methodName = context.method, method = delegate.iterator[methodName];
if (void 0 === method)
return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = void 0, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type)
return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = void 0), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(true);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod)
return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next)
return iterable;
if (!isNaN(iterable.length)) {
var i2 = -1, next2 = function next3() {
for (; ++i2 < iterable.length; )
if (hasOwn3.call(iterable, i2))
return next3.value = iterable[i2], next3.done = false, next3;
return next3.value = void 0, next3.done = true, next3;
};
return next2.next = next2;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: void 0,
done: true
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty2(Gp, "constructor", {
value: GeneratorFunctionPrototype,
configurable: true
}), defineProperty2(GeneratorFunctionPrototype, "constructor", {
value: GeneratorFunction,
configurable: true
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports2.isGeneratorFunction = function(genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports2.mark = function(genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports2.awrap = function(arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
}), exports2.AsyncIterator = AsyncIterator, exports2.async = function(innerFn, outerFn, self2, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self2, tryLocsList), PromiseImpl);
return exports2.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
return this;
}), define(Gp, "toString", function() {
return "[object Generator]";
}), exports2.keys = function(val) {
var object = Object(val), keys2 = [];
for (var key2 in object)
keys2.push(key2);
return keys2.reverse(), function next2() {
for (; keys2.length; ) {
var key3 = keys2.pop();
if (key3 in object)
return next2.value = key3, next2.done = false, next2;
}
return next2.done = true, next2;
};
}, exports2.values = values, Context.prototype = {
constructor: Context,
reset: function reset2(skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = false, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
for (var name in this)
"t" === name.charAt(0) && hasOwn3.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = void 0);
},
stop: function stop() {
this.done = true;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type)
throw rootRecord.arg;
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done)
throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = void 0), !!caught;
}
for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) {
var entry = this.tryEntries[i2], record = entry.completion;
if ("root" === entry.tryLoc)
return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn3.call(entry, "catchLoc"), hasFinally = hasOwn3.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc)
return handle(entry.catchLoc, true);
if (this.prev < entry.finallyLoc)
return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc)
return handle(entry.catchLoc, true);
} else {
if (!hasFinally)
throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc)
return handle(entry.finallyLoc);
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) {
var entry = this.tryEntries[i2];
if (entry.tryLoc <= this.prev && hasOwn3.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function complete(record, afterLoc) {
if ("throw" === record.type)
throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) {
var entry = this.tryEntries[i2];
if (entry.finallyLoc === finallyLoc)
return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
"catch": function _catch(tryLoc) {
for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) {
var entry = this.tryEntries[i2];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName,
nextLoc
}, "next" === this.method && (this.arg = void 0), ContinueSentinel;
}
}, exports2;
}
module2.exports = _regeneratorRuntime2, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
})(regeneratorRuntime$1);
var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
var runtime = regeneratorRuntimeExports();
var regenerator = runtime;
try {
regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
if (typeof globalThis === "object") {
globalThis.regeneratorRuntime = runtime;
} else {
Function("r", "regeneratorRuntime = r")(runtime);
}
}
const _regeneratorRuntime = /* @__PURE__ */ getDefaultExportFromCjs(regenerator);
var CheckCircleOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z" } }, { "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "check-circle", "theme": "outlined" };
const CheckCircleOutlinedSvg = CheckCircleOutlined$2;
function _objectSpread$g(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$h(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$h(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var CheckCircleOutlined = function CheckCircleOutlined2(props3, context) {
var p = _objectSpread$g({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$g({}, p, {
"icon": CheckCircleOutlinedSvg
}), null);
};
CheckCircleOutlined.displayName = "CheckCircleOutlined";
CheckCircleOutlined.inheritAttrs = false;
const CheckCircleOutlined$1 = CheckCircleOutlined;
var InfoCircleOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" } }] }, "name": "info-circle", "theme": "outlined" };
const InfoCircleOutlinedSvg = InfoCircleOutlined$2;
function _objectSpread$f(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$g(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$g(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var InfoCircleOutlined = function InfoCircleOutlined2(props3, context) {
var p = _objectSpread$f({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$f({}, p, {
"icon": InfoCircleOutlinedSvg
}), null);
};
InfoCircleOutlined.displayName = "InfoCircleOutlined";
InfoCircleOutlined.inheritAttrs = false;
const InfoCircleOutlined$1 = InfoCircleOutlined;
var CloseCircleOutlined$2 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z" } }] }, "name": "close-circle", "theme": "outlined" };
const CloseCircleOutlinedSvg = CloseCircleOutlined$2;
function _objectSpread$e(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$f(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$f(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var CloseCircleOutlined = function CloseCircleOutlined2(props3, context) {
var p = _objectSpread$e({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$e({}, p, {
"icon": CloseCircleOutlinedSvg
}), null);
};
CloseCircleOutlined.displayName = "CloseCircleOutlined";
CloseCircleOutlined.inheritAttrs = false;
const CloseCircleOutlined$1 = CloseCircleOutlined;
var ExclamationCircleOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z" } }] }, "name": "exclamation-circle", "theme": "outlined" };
const ExclamationCircleOutlinedSvg = ExclamationCircleOutlined$2;
function _objectSpread$d(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$e(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$e(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var ExclamationCircleOutlined = function ExclamationCircleOutlined2(props3, context) {
var p = _objectSpread$d({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$d({}, p, {
"icon": ExclamationCircleOutlinedSvg
}), null);
};
ExclamationCircleOutlined.displayName = "ExclamationCircleOutlined";
ExclamationCircleOutlined.inheritAttrs = false;
const ExclamationCircleOutlined$1 = ExclamationCircleOutlined;
var CloseOutlined$2 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" } }] }, "name": "close", "theme": "outlined" };
const CloseOutlinedSvg = CloseOutlined$2;
function _objectSpread$c(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$d(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$d(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var CloseOutlined = function CloseOutlined2(props3, context) {
var p = _objectSpread$c({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$c({}, p, {
"icon": CloseOutlinedSvg
}), null);
};
CloseOutlined.displayName = "CloseOutlined";
CloseOutlined.inheritAttrs = false;
const CloseOutlined$1 = CloseOutlined;
var notificationInstance = {};
var defaultDuration = 4.5;
var defaultTop = "24px";
var defaultBottom = "24px";
var defaultPrefixCls$1 = "";
var defaultPlacement = "topRight";
var defaultGetContainer = function defaultGetContainer2() {
return document.body;
};
var defaultCloseIcon = null;
var rtl = false;
var maxCount;
function setNotificationConfig(options) {
var duration = options.duration, placement = options.placement, bottom = options.bottom, top = options.top, getContainer4 = options.getContainer, closeIcon = options.closeIcon, prefixCls = options.prefixCls;
if (prefixCls !== void 0) {
defaultPrefixCls$1 = prefixCls;
}
if (duration !== void 0) {
defaultDuration = duration;
}
if (placement !== void 0) {
defaultPlacement = placement;
}
if (bottom !== void 0) {
defaultBottom = typeof bottom === "number" ? "".concat(bottom, "px") : bottom;
}
if (top !== void 0) {
defaultTop = typeof top === "number" ? "".concat(top, "px") : top;
}
if (getContainer4 !== void 0) {
defaultGetContainer = getContainer4;
}
if (closeIcon !== void 0) {
defaultCloseIcon = closeIcon;
}
if (options.rtl !== void 0) {
rtl = options.rtl;
}
if (options.maxCount !== void 0) {
maxCount = options.maxCount;
}
}
function getPlacementStyle(placement) {
var top = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultTop;
var bottom = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : defaultBottom;
var style;
switch (placement) {
case "topLeft":
style = {
left: "0px",
top,
bottom: "auto"
};
break;
case "topRight":
style = {
right: "0px",
top,
bottom: "auto"
};
break;
case "bottomLeft":
style = {
left: "0px",
top: "auto",
bottom
};
break;
default:
style = {
right: "0px",
top: "auto",
bottom
};
break;
}
return style;
}
function getNotificationInstance(_ref, callback) {
var customizePrefixCls = _ref.prefixCls, _ref$placement = _ref.placement, placement = _ref$placement === void 0 ? defaultPlacement : _ref$placement, _ref$getContainer = _ref.getContainer, getContainer4 = _ref$getContainer === void 0 ? defaultGetContainer : _ref$getContainer, top = _ref.top, bottom = _ref.bottom, _ref$closeIcon = _ref.closeIcon, _closeIcon = _ref$closeIcon === void 0 ? defaultCloseIcon : _ref$closeIcon, appContext = _ref.appContext;
var _globalConfig = globalConfig(), getPrefixCls2 = _globalConfig.getPrefixCls;
var prefixCls = getPrefixCls2("notification", customizePrefixCls || defaultPrefixCls$1);
var cacheKey = "".concat(prefixCls, "-").concat(placement, "-").concat(rtl);
var cacheInstance = notificationInstance[cacheKey];
if (cacheInstance) {
Promise.resolve(cacheInstance).then(function(instance) {
callback(instance);
});
return;
}
var notificationClass = classNames("".concat(prefixCls, "-").concat(placement), _defineProperty$q({}, "".concat(prefixCls, "-rtl"), rtl === true));
Notification$1.newInstance({
name: "notification",
prefixCls: customizePrefixCls || defaultPrefixCls$1,
class: notificationClass,
style: getPlacementStyle(placement, top, bottom),
appContext,
getContainer: getContainer4,
closeIcon: function closeIcon(_ref2) {
var prefixCls2 = _ref2.prefixCls;
var closeIconToRender = createVNode("span", {
"class": "".concat(prefixCls2, "-close-x")
}, [renderHelper(_closeIcon, {}, createVNode(CloseOutlined$1, {
"class": "".concat(prefixCls2, "-close-icon")
}, null))]);
return closeIconToRender;
},
maxCount,
hasTransitionName: true
}, function(notification2) {
notificationInstance[cacheKey] = notification2;
callback(notification2);
});
}
var typeToIcon = {
success: CheckCircleOutlined$1,
info: InfoCircleOutlined$1,
error: CloseCircleOutlined$1,
warning: ExclamationCircleOutlined$1
};
function notice(args) {
var icon = args.icon, type = args.type, description = args.description, message2 = args.message, btn = args.btn;
var duration = args.duration === void 0 ? defaultDuration : args.duration;
getNotificationInstance(args, function(notification2) {
notification2.notice({
content: function content(_ref3) {
var outerPrefixCls = _ref3.prefixCls;
var prefixCls = "".concat(outerPrefixCls, "-notice");
var iconNode = null;
if (icon) {
iconNode = function iconNode2() {
return createVNode("span", {
"class": "".concat(prefixCls, "-icon")
}, [renderHelper(icon)]);
};
} else if (type) {
var Icon3 = typeToIcon[type];
iconNode = function iconNode2() {
return createVNode(Icon3, {
"class": "".concat(prefixCls, "-icon ").concat(prefixCls, "-icon-").concat(type)
}, null);
};
}
return createVNode("div", {
"class": iconNode ? "".concat(prefixCls, "-with-icon") : ""
}, [iconNode && iconNode(), createVNode("div", {
"class": "".concat(prefixCls, "-message")
}, [!description && iconNode ? createVNode("span", {
"class": "".concat(prefixCls, "-message-single-line-auto-margin")
}, null) : null, renderHelper(message2)]), createVNode("div", {
"class": "".concat(prefixCls, "-description")
}, [renderHelper(description)]), btn ? createVNode("span", {
"class": "".concat(prefixCls, "-btn")
}, [renderHelper(btn)]) : null]);
},
duration,
closable: true,
onClose: args.onClose,
onClick: args.onClick,
key: args.key,
style: args.style || {},
class: args.class
});
});
}
var api = {
open: notice,
close: function close(key2) {
Object.keys(notificationInstance).forEach(function(cacheKey) {
return Promise.resolve(notificationInstance[cacheKey]).then(function(instance) {
instance.removeNotice(key2);
});
});
},
config: setNotificationConfig,
destroy: function destroy2() {
Object.keys(notificationInstance).forEach(function(cacheKey) {
Promise.resolve(notificationInstance[cacheKey]).then(function(instance) {
instance.destroy();
});
delete notificationInstance[cacheKey];
});
}
};
var iconTypes = ["success", "info", "warning", "error"];
iconTypes.forEach(function(type) {
api[type] = function(args) {
return api.open(_objectSpread2$1(_objectSpread2$1({}, args), {}, {
type
}));
};
});
api.warn = api.warning;
const notification = api;
function canUseDom() {
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
}
var MARK_KEY = "vc-util-key";
function getMark() {
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, mark2 = _ref.mark;
if (mark2) {
return mark2.startsWith("data-") ? mark2 : "data-".concat(mark2);
}
return MARK_KEY;
}
function getContainer2(option) {
if (option.attachTo) {
return option.attachTo;
}
var head = document.querySelector("head");
return head || document.body;
}
function injectCSS(css2) {
var _option$csp;
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
if (!canUseDom()) {
return null;
}
var styleNode = document.createElement("style");
if ((_option$csp = option.csp) !== null && _option$csp !== void 0 && _option$csp.nonce) {
var _option$csp2;
styleNode.nonce = (_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce;
}
styleNode.innerHTML = css2;
var container = getContainer2(option);
var firstChild = container.firstChild;
if (option.prepend && container.prepend) {
container.prepend(styleNode);
} else if (option.prepend && firstChild) {
container.insertBefore(styleNode, firstChild);
} else {
container.appendChild(styleNode);
}
return styleNode;
}
var containerCache = /* @__PURE__ */ new Map();
function findExistNode(key2) {
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var container = getContainer2(option);
return Array.from(containerCache.get(container).children).find(function(node) {
return node.tagName === "STYLE" && node.getAttribute(getMark(option)) === key2;
});
}
function updateCSS(css2, key2) {
var option = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
var container = getContainer2(option);
if (!containerCache.has(container)) {
var placeholderStyle = injectCSS("", option);
var parentNode = placeholderStyle.parentNode;
containerCache.set(container, parentNode);
parentNode.removeChild(placeholderStyle);
}
var existNode = findExistNode(key2, option);
if (existNode) {
var _option$csp3, _option$csp4;
if ((_option$csp3 = option.csp) !== null && _option$csp3 !== void 0 && _option$csp3.nonce && existNode.nonce !== ((_option$csp4 = option.csp) === null || _option$csp4 === void 0 ? void 0 : _option$csp4.nonce)) {
var _option$csp5;
existNode.nonce = (_option$csp5 = option.csp) === null || _option$csp5 === void 0 ? void 0 : _option$csp5.nonce;
}
if (existNode.innerHTML !== css2) {
existNode.innerHTML = css2;
}
return existNode;
}
var newNode = injectCSS(css2, option);
newNode.setAttribute(getMark(option), key2);
return newNode;
}
const devWarning = function(valid, component, message2) {
warningOnce(valid, "[ant-design-vue: ".concat(component, "] ").concat(message2));
};
var dynamicStyleMark = "-ant-".concat(Date.now(), "-").concat(Math.random());
function registerTheme(globalPrefixCls, theme) {
var variables = {};
var formatColor = function formatColor2(color, updater) {
var clone3 = color.clone();
clone3 = (updater === null || updater === void 0 ? void 0 : updater(clone3)) || clone3;
return clone3.toRgbString();
};
var fillColor = function fillColor2(colorVal, type) {
var baseColor = new TinyColor(colorVal);
var colorPalettes = generate$2(baseColor.toRgbString());
variables["".concat(type, "-color")] = formatColor(baseColor);
variables["".concat(type, "-color-disabled")] = colorPalettes[1];
variables["".concat(type, "-color-hover")] = colorPalettes[4];
variables["".concat(type, "-color-active")] = colorPalettes[6];
variables["".concat(type, "-color-outline")] = baseColor.clone().setAlpha(0.2).toRgbString();
variables["".concat(type, "-color-deprecated-bg")] = colorPalettes[1];
variables["".concat(type, "-color-deprecated-border")] = colorPalettes[3];
};
if (theme.primaryColor) {
fillColor(theme.primaryColor, "primary");
var primaryColor = new TinyColor(theme.primaryColor);
var primaryColors = generate$2(primaryColor.toRgbString());
primaryColors.forEach(function(color, index2) {
variables["primary-".concat(index2 + 1)] = color;
});
variables["primary-color-deprecated-l-35"] = formatColor(primaryColor, function(c2) {
return c2.lighten(35);
});
variables["primary-color-deprecated-l-20"] = formatColor(primaryColor, function(c2) {
return c2.lighten(20);
});
variables["primary-color-deprecated-t-20"] = formatColor(primaryColor, function(c2) {
return c2.tint(20);
});
variables["primary-color-deprecated-t-50"] = formatColor(primaryColor, function(c2) {
return c2.tint(50);
});
variables["primary-color-deprecated-f-12"] = formatColor(primaryColor, function(c2) {
return c2.setAlpha(c2.getAlpha() * 0.12);
});
var primaryActiveColor = new TinyColor(primaryColors[0]);
variables["primary-color-active-deprecated-f-30"] = formatColor(primaryActiveColor, function(c2) {
return c2.setAlpha(c2.getAlpha() * 0.3);
});
variables["primary-color-active-deprecated-d-02"] = formatColor(primaryActiveColor, function(c2) {
return c2.darken(2);
});
}
if (theme.successColor) {
fillColor(theme.successColor, "success");
}
if (theme.warningColor) {
fillColor(theme.warningColor, "warning");
}
if (theme.errorColor) {
fillColor(theme.errorColor, "error");
}
if (theme.infoColor) {
fillColor(theme.infoColor, "info");
}
var cssList = Object.keys(variables).map(function(key2) {
return "--".concat(globalPrefixCls, "-").concat(key2, ": ").concat(variables[key2], ";");
});
if (canUseDom()) {
updateCSS("\n :root {\n ".concat(cssList.join("\n"), "\n }\n "), "".concat(dynamicStyleMark, "-dynamic-theme"));
} else {
devWarning(false, "ConfigProvider", "SSR do not support dynamic theme with css variables.");
}
}
var GlobalFormContextKey = Symbol("GlobalFormContextKey");
var useProvideGlobalForm = function useProvideGlobalForm2(state) {
provide(GlobalFormContextKey, state);
};
var configProviderProps = function configProviderProps2() {
return {
getTargetContainer: {
type: Function
},
getPopupContainer: {
type: Function
},
prefixCls: String,
getPrefixCls: {
type: Function
},
renderEmpty: {
type: Function
},
transformCellText: {
type: Function
},
csp: {
type: Object,
default: void 0
},
input: {
type: Object
},
autoInsertSpaceInButton: {
type: Boolean,
default: void 0
},
locale: {
type: Object,
default: void 0
},
pageHeader: {
type: Object
},
componentSize: {
type: String
},
direction: {
type: String
},
space: {
type: Object
},
virtual: {
type: Boolean,
default: void 0
},
dropdownMatchSelectWidth: {
type: [Number, Boolean],
default: true
},
form: {
type: Object,
default: void 0
},
// internal use
notUpdateGlobalConfig: Boolean
};
};
var defaultPrefixCls = "ant";
function getGlobalPrefixCls() {
return globalConfigForApi.prefixCls || defaultPrefixCls;
}
var globalConfigByCom = reactive({});
var globalConfigBySet = reactive({});
var globalConfigForApi = reactive({});
watchEffect(function() {
_extends(globalConfigForApi, globalConfigByCom, globalConfigBySet);
globalConfigForApi.prefixCls = getGlobalPrefixCls();
globalConfigForApi.getPrefixCls = function(suffixCls, customizePrefixCls) {
if (customizePrefixCls)
return customizePrefixCls;
return suffixCls ? "".concat(globalConfigForApi.prefixCls, "-").concat(suffixCls) : globalConfigForApi.prefixCls;
};
globalConfigForApi.getRootPrefixCls = function(rootPrefixCls, customizePrefixCls) {
if (rootPrefixCls) {
return rootPrefixCls;
}
if (globalConfigForApi.prefixCls) {
return globalConfigForApi.prefixCls;
}
if (customizePrefixCls && customizePrefixCls.includes("-")) {
return customizePrefixCls.replace(/^(.*)-[^-]*$/, "$1");
}
return getGlobalPrefixCls();
};
});
var stopWatchEffect;
var setGlobalConfig = function setGlobalConfig2(params) {
if (stopWatchEffect) {
stopWatchEffect();
}
stopWatchEffect = watchEffect(function() {
_extends(globalConfigBySet, reactive(params));
_extends(globalConfigForApi, reactive(params));
});
if (params.theme) {
registerTheme(getGlobalPrefixCls(), params.theme);
}
};
var globalConfig = function globalConfig2() {
return {
getPrefixCls: function getPrefixCls2(suffixCls, customizePrefixCls) {
if (customizePrefixCls)
return customizePrefixCls;
return suffixCls ? "".concat(getGlobalPrefixCls(), "-").concat(suffixCls) : getGlobalPrefixCls();
},
getRootPrefixCls: function getRootPrefixCls(rootPrefixCls, customizePrefixCls) {
if (rootPrefixCls) {
return rootPrefixCls;
}
if (globalConfigForApi.prefixCls) {
return globalConfigForApi.prefixCls;
}
if (customizePrefixCls && customizePrefixCls.includes("-")) {
return customizePrefixCls.replace(/^(.*)-[^-]*$/, "$1");
}
return getGlobalPrefixCls();
}
};
};
var ConfigProvider = defineComponent({
compatConfig: {
MODE: 3
},
name: "AConfigProvider",
inheritAttrs: false,
props: configProviderProps(),
setup: function setup6(props3, _ref) {
var slots = _ref.slots;
var getPrefixCls2 = function getPrefixCls3(suffixCls, customizePrefixCls) {
var _props$prefixCls = props3.prefixCls, prefixCls = _props$prefixCls === void 0 ? "ant" : _props$prefixCls;
if (customizePrefixCls)
return customizePrefixCls;
return suffixCls ? "".concat(prefixCls, "-").concat(suffixCls) : prefixCls;
};
var renderEmptyComponent = function renderEmptyComponent2(name) {
var renderEmpty$1 = props3.renderEmpty || slots.renderEmpty || renderEmpty;
return renderEmpty$1(name);
};
var getPrefixClsWrapper = function getPrefixClsWrapper2(suffixCls, customizePrefixCls) {
var prefixCls = props3.prefixCls;
if (customizePrefixCls)
return customizePrefixCls;
var mergedPrefixCls = prefixCls || getPrefixCls2("");
return suffixCls ? "".concat(mergedPrefixCls, "-").concat(suffixCls) : mergedPrefixCls;
};
var configProvider = reactive(_objectSpread2$1(_objectSpread2$1({}, props3), {}, {
getPrefixCls: getPrefixClsWrapper,
renderEmpty: renderEmptyComponent
}));
Object.keys(props3).forEach(function(key2) {
watch(function() {
return props3[key2];
}, function() {
configProvider[key2] = props3[key2];
});
});
if (!props3.notUpdateGlobalConfig) {
_extends(globalConfigByCom, configProvider);
watch(configProvider, function() {
_extends(globalConfigByCom, configProvider);
});
}
var validateMessagesRef = computed(function() {
var validateMessages = {};
if (props3.locale) {
var _props$locale$Form, _defaultLocale$Form;
validateMessages = ((_props$locale$Form = props3.locale.Form) === null || _props$locale$Form === void 0 ? void 0 : _props$locale$Form.defaultValidateMessages) || ((_defaultLocale$Form = defaultLocale$1.Form) === null || _defaultLocale$Form === void 0 ? void 0 : _defaultLocale$Form.defaultValidateMessages) || {};
}
if (props3.form && props3.form.validateMessages) {
validateMessages = _objectSpread2$1(_objectSpread2$1({}, validateMessages), props3.form.validateMessages);
}
return validateMessages;
});
useProvideGlobalForm({
validateMessages: validateMessagesRef
});
provide("configProvider", configProvider);
var renderProvider = function renderProvider2(legacyLocale) {
var _slots$default;
return createVNode(LocaleProvider$1, {
"locale": props3.locale || legacyLocale,
"ANT_MARK__": ANT_MARK
}, {
default: function _default3() {
return [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
}
});
};
watchEffect(function() {
if (props3.direction) {
message.config({
rtl: props3.direction === "rtl"
});
notification.config({
rtl: props3.direction === "rtl"
});
}
});
return function() {
return createVNode(LocaleReceiver, {
"children": function children(_2, __, legacyLocale) {
return renderProvider(legacyLocale);
}
}, null);
};
}
});
var defaultConfigProvider = reactive({
getPrefixCls: function getPrefixCls(suffixCls, customizePrefixCls) {
if (customizePrefixCls)
return customizePrefixCls;
return suffixCls ? "ant-".concat(suffixCls) : "ant";
},
renderEmpty,
direction: "ltr"
});
ConfigProvider.config = setGlobalConfig;
ConfigProvider.install = function(app) {
app.component(ConfigProvider.name, ConfigProvider);
};
const ConfigProvider$1 = ConfigProvider;
const useConfigInject = function(name, props3) {
var configProvider = inject("configProvider", defaultConfigProvider);
var prefixCls = computed(function() {
return configProvider.getPrefixCls(name, props3.prefixCls);
});
var direction = computed(function() {
var _props$direction;
return (_props$direction = props3.direction) !== null && _props$direction !== void 0 ? _props$direction : configProvider.direction;
});
var rootPrefixCls = computed(function() {
return configProvider.getPrefixCls();
});
var autoInsertSpaceInButton = computed(function() {
return configProvider.autoInsertSpaceInButton;
});
var renderEmpty2 = computed(function() {
return configProvider.renderEmpty;
});
var space = computed(function() {
return configProvider.space;
});
var pageHeader = computed(function() {
return configProvider.pageHeader;
});
var form = computed(function() {
return configProvider.form;
});
var getTargetContainer = computed(function() {
return props3.getTargetContainer || configProvider.getTargetContainer;
});
var getPopupContainer = computed(function() {
return props3.getPopupContainer || configProvider.getPopupContainer;
});
var dropdownMatchSelectWidth = computed(function() {
var _props$dropdownMatchS;
return (_props$dropdownMatchS = props3.dropdownMatchSelectWidth) !== null && _props$dropdownMatchS !== void 0 ? _props$dropdownMatchS : configProvider.dropdownMatchSelectWidth;
});
var virtual = computed(function() {
return (props3.virtual === void 0 ? configProvider.virtual !== false : props3.virtual !== false) && dropdownMatchSelectWidth.value !== false;
});
var size = computed(function() {
return props3.size || configProvider.componentSize;
});
var autocomplete = computed(function() {
var _configProvider$input;
return props3.autocomplete || ((_configProvider$input = configProvider.input) === null || _configProvider$input === void 0 ? void 0 : _configProvider$input.autocomplete);
});
var csp = computed(function() {
return configProvider.csp;
});
return {
configProvider,
prefixCls,
direction,
size,
getTargetContainer,
getPopupContainer,
space,
pageHeader,
form,
autoInsertSpaceInButton,
renderEmpty: renderEmpty2,
virtual,
dropdownMatchSelectWidth,
rootPrefixCls,
getPrefixCls: configProvider.getPrefixCls,
autocomplete,
csp
};
};
function omit(obj, fields) {
var shallowCopy = _extends({}, obj);
for (var i2 = 0; i2 < fields.length; i2 += 1) {
var key2 = fields[i2];
delete shallowCopy[key2];
}
return shallowCopy;
}
function _toArray(arr) {
return _arrayWithHoles$2(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableRest$2();
}
function getKey(data2, index2) {
var key2 = data2.key;
var value2;
if ("value" in data2) {
value2 = data2.value;
}
if (key2 !== null && key2 !== void 0) {
return key2;
}
if (value2 !== void 0) {
return value2;
}
return "rc-index-key-".concat(index2);
}
function fillFieldNames(fieldNames, childrenAsData) {
var _ref = fieldNames || {}, label = _ref.label, value2 = _ref.value, options = _ref.options;
return {
label: label || (childrenAsData ? "children" : "label"),
value: value2 || "value",
options: options || "options"
};
}
function flattenOptions(options) {
var _ref2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, fieldNames = _ref2.fieldNames, childrenAsData = _ref2.childrenAsData;
var flattenList = [];
var _fillFieldNames = fillFieldNames(fieldNames, false), fieldLabel = _fillFieldNames.label, fieldValue = _fillFieldNames.value, fieldOptions = _fillFieldNames.options;
function dig(list, isGroupOption) {
list.forEach(function(data2) {
var label = data2[fieldLabel];
if (isGroupOption || !(fieldOptions in data2)) {
var value2 = data2[fieldValue];
flattenList.push({
key: getKey(data2, flattenList.length),
groupOption: isGroupOption,
data: data2,
label,
value: value2
});
} else {
var grpLabel = label;
if (grpLabel === void 0 && childrenAsData) {
grpLabel = data2.label;
}
flattenList.push({
key: getKey(data2, flattenList.length),
group: true,
data: data2,
label: grpLabel
});
dig(data2[fieldOptions], true);
}
});
}
dig(options, false);
return flattenList;
}
function injectPropsWithOption(option) {
var newOption = _objectSpread2$1({}, option);
if (!("props" in newOption)) {
Object.defineProperty(newOption, "props", {
get: function get() {
warning$2(false, "Return type is option instead of Option instance. Please read value directly instead of reading from `props`.");
return newOption;
}
});
}
return newOption;
}
function getSeparatedContent(text, tokens) {
if (!tokens || !tokens.length) {
return null;
}
var match2 = false;
function separate(str, _ref3) {
var _ref4 = _toArray(_ref3), token2 = _ref4[0], restTokens = _ref4.slice(1);
if (!token2) {
return [str];
}
var list2 = str.split(token2);
match2 = match2 || list2.length > 1;
return list2.reduce(function(prevList, unitStr) {
return [].concat(_toConsumableArray(prevList), _toConsumableArray(separate(unitStr, restTokens)));
}, []).filter(function(unit) {
return unit;
});
}
var list = separate(text, tokens);
return match2 ? list : null;
}
function contains(root2, n2) {
if (!root2) {
return false;
}
return root2.contains(n2);
}
var availablePrefixs = ["moz", "ms", "webkit"];
function requestAnimationFramePolyfill() {
var lastTime = 0;
return function(callback) {
var currTime = (/* @__PURE__ */ new Date()).getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
}
function getRequestAnimationFrame() {
if (typeof window === "undefined") {
return function() {
};
}
if (window.requestAnimationFrame) {
return window.requestAnimationFrame.bind(window);
}
var prefix = availablePrefixs.filter(function(key2) {
return "".concat(key2, "RequestAnimationFrame") in window;
})[0];
return prefix ? window["".concat(prefix, "RequestAnimationFrame")] : requestAnimationFramePolyfill();
}
function cancelRequestAnimationFrame(id) {
if (typeof window === "undefined") {
return null;
}
if (window.cancelAnimationFrame) {
return window.cancelAnimationFrame(id);
}
var prefix = availablePrefixs.filter(function(key2) {
return "".concat(key2, "CancelAnimationFrame") in window || "".concat(key2, "CancelRequestAnimationFrame") in window;
})[0];
return prefix ? (window["".concat(prefix, "CancelAnimationFrame")] || window["".concat(prefix, "CancelRequestAnimationFrame")]).call(this, id) : clearTimeout(id);
}
var raf2 = getRequestAnimationFrame();
var cancelAnimationTimeout = function cancelAnimationTimeout2(frame) {
return cancelRequestAnimationFrame(frame.id);
};
var requestAnimationTimeout = function requestAnimationTimeout2(callback) {
var delay = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
var start = Date.now();
function timeout() {
if (Date.now() - start >= delay) {
callback.call();
} else {
frame.id = raf2(timeout);
}
}
var frame = {
id: raf2(timeout)
};
return frame;
};
var innerProps = {
visible: Boolean,
prefixCls: String,
zIndex: Number,
destroyPopupOnHide: Boolean,
forceRender: Boolean,
// Legacy Motion
animation: [String, Object],
transitionName: String,
// Measure
stretch: {
type: String
},
// Align
align: {
type: Object
},
point: {
type: Object
},
getRootDomNode: {
type: Function
},
getClassNameFromAlign: {
type: Function
},
onMouseenter: {
type: Function
},
onMouseleave: {
type: Function
},
onMousedown: {
type: Function
},
onTouchstart: {
type: Function
}
};
var mobileProps = _objectSpread2$1(_objectSpread2$1({}, innerProps), {}, {
mobile: {
type: Object
}
});
var popupProps = _objectSpread2$1(_objectSpread2$1({}, innerProps), {}, {
mask: Boolean,
mobile: {
type: Object
},
maskAnimation: String,
maskTransitionName: String
});
function getMotion(_ref) {
var prefixCls = _ref.prefixCls, animation = _ref.animation, transitionName2 = _ref.transitionName;
if (animation) {
return {
name: "".concat(prefixCls, "-").concat(animation)
};
}
if (transitionName2) {
return {
name: transitionName2
};
}
return {};
}
function Mask$1(props3) {
var prefixCls = props3.prefixCls, visible = props3.visible, zIndex = props3.zIndex, mask = props3.mask, maskAnimation = props3.maskAnimation, maskTransitionName = props3.maskTransitionName;
if (!mask) {
return null;
}
var motion = {};
if (maskTransitionName || maskAnimation) {
motion = getMotion({
prefixCls,
transitionName: maskTransitionName,
animation: maskAnimation
});
}
return createVNode(Transition, _objectSpread2$1({
"appear": true
}, motion), {
default: function _default3() {
return [withDirectives(createVNode("div", {
"style": {
zIndex
},
"class": "".concat(prefixCls, "-mask")
}, null), [[resolveDirective("if"), visible]])];
}
});
}
Mask$1.displayName = "Mask";
const MobilePopupInner = defineComponent({
compatConfig: {
MODE: 3
},
name: "MobilePopupInner",
inheritAttrs: false,
props: mobileProps,
emits: ["mouseenter", "mouseleave", "mousedown", "touchstart", "align"],
setup: function setup7(props3, _ref) {
var expose = _ref.expose, slots = _ref.slots;
var elementRef = ref();
expose({
forceAlign: function forceAlign() {
},
getElement: function getElement2() {
return elementRef.value;
}
});
return function() {
var _slots$default;
var zIndex = props3.zIndex, visible = props3.visible, prefixCls = props3.prefixCls, _props$mobile = props3.mobile, _props$mobile2 = _props$mobile === void 0 ? {} : _props$mobile, popupClassName = _props$mobile2.popupClassName, popupStyle = _props$mobile2.popupStyle, _props$mobile2$popupM = _props$mobile2.popupMotion, popupMotion = _props$mobile2$popupM === void 0 ? {} : _props$mobile2$popupM, popupRender = _props$mobile2.popupRender;
var mergedStyle = _objectSpread2$1({
zIndex
}, popupStyle);
var childNode = flattenChildren((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots));
if (childNode.length > 1) {
childNode = createVNode("div", {
"class": "".concat(prefixCls, "-content")
}, [childNode]);
}
if (popupRender) {
childNode = popupRender(childNode);
}
var mergedClassName = classNames(prefixCls, popupClassName);
return createVNode(Transition, _objectSpread2$1({
"ref": elementRef
}, popupMotion), {
default: function _default3() {
return [visible ? createVNode("div", {
"class": mergedClassName,
"style": mergedStyle
}, [childNode]) : null];
}
});
};
}
});
var StatusQueue = ["measure", "align", null, "motion"];
const useVisibleStatus = function(visible, doMeasure) {
var status = ref(null);
var rafRef = ref();
var destroyRef = ref(false);
function setStatus(nextStatus) {
if (!destroyRef.value) {
status.value = nextStatus;
}
}
function cancelRaf() {
wrapperRaf.cancel(rafRef.value);
}
function goNextStatus(callback) {
cancelRaf();
rafRef.value = wrapperRaf(function() {
var newStatus = status.value;
switch (status.value) {
case "align":
newStatus = "motion";
break;
case "motion":
newStatus = "stable";
break;
}
setStatus(newStatus);
callback === null || callback === void 0 ? void 0 : callback();
});
}
watch(visible, function() {
setStatus("measure");
}, {
immediate: true,
flush: "post"
});
onMounted(function() {
watch(status, function() {
switch (status.value) {
case "measure":
doMeasure();
break;
}
if (status.value) {
rafRef.value = wrapperRaf(/* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime.mark(function _callee() {
var index2, nextStatus;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1)
switch (_context.prev = _context.next) {
case 0:
index2 = StatusQueue.indexOf(status.value);
nextStatus = StatusQueue[index2 + 1];
if (nextStatus && index2 !== -1) {
setStatus(nextStatus);
}
case 3:
case "end":
return _context.stop();
}
}, _callee);
})));
}
}, {
immediate: true,
flush: "post"
});
});
onBeforeUnmount(function() {
destroyRef.value = true;
cancelRaf();
});
return [status, goNextStatus];
};
const useStretchStyle = function(stretch) {
var targetSize = ref({
width: 0,
height: 0
});
function measureStretch(element) {
targetSize.value = {
width: element.offsetWidth,
height: element.offsetHeight
};
}
var style = computed(function() {
var sizeStyle = {};
if (stretch.value) {
var _targetSize$value = targetSize.value, width = _targetSize$value.width, height = _targetSize$value.height;
if (stretch.value.indexOf("height") !== -1 && height) {
sizeStyle.height = "".concat(height, "px");
} else if (stretch.value.indexOf("minHeight") !== -1 && height) {
sizeStyle.minHeight = "".concat(height, "px");
}
if (stretch.value.indexOf("width") !== -1 && width) {
sizeStyle.width = "".concat(width, "px");
} else if (stretch.value.indexOf("minWidth") !== -1 && width) {
sizeStyle.minWidth = "".concat(width, "px");
}
}
return sizeStyle;
});
return [style, measureStretch];
};
function ownKeys(object, enumerableOnly) {
var keys2 = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys2.push.apply(keys2, symbols);
}
return keys2;
}
function _objectSpread2(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = null != arguments[i2] ? arguments[i2] : {};
i2 % 2 ? ownKeys(Object(source), true).forEach(function(key2) {
_defineProperty$c(target, key2, source[key2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key2) {
Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2));
});
}
return target;
}
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
return typeof obj2;
} : function(obj2) {
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
}, _typeof(obj);
}
function _defineProperty$c(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, {
value: value2,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key2] = value2;
}
return obj;
}
var vendorPrefix;
var jsCssMap = {
Webkit: "-webkit-",
Moz: "-moz-",
// IE did it wrong again ...
ms: "-ms-",
O: "-o-"
};
function getVendorPrefix() {
if (vendorPrefix !== void 0) {
return vendorPrefix;
}
vendorPrefix = "";
var style = document.createElement("p").style;
var testProp = "Transform";
for (var key2 in jsCssMap) {
if (key2 + testProp in style) {
vendorPrefix = key2;
}
}
return vendorPrefix;
}
function getTransitionName2() {
return getVendorPrefix() ? "".concat(getVendorPrefix(), "TransitionProperty") : "transitionProperty";
}
function getTransformName() {
return getVendorPrefix() ? "".concat(getVendorPrefix(), "Transform") : "transform";
}
function setTransitionProperty(node, value2) {
var name = getTransitionName2();
if (name) {
node.style[name] = value2;
if (name !== "transitionProperty") {
node.style.transitionProperty = value2;
}
}
}
function setTransform(node, value2) {
var name = getTransformName();
if (name) {
node.style[name] = value2;
if (name !== "transform") {
node.style.transform = value2;
}
}
}
function getTransitionProperty(node) {
return node.style.transitionProperty || node.style[getTransitionName2()];
}
function getTransformXY(node) {
var style = window.getComputedStyle(node, null);
var transform2 = style.getPropertyValue("transform") || style.getPropertyValue(getTransformName());
if (transform2 && transform2 !== "none") {
var matrix = transform2.replace(/[^0-9\-.,]/g, "").split(",");
return {
x: parseFloat(matrix[12] || matrix[4], 0),
y: parseFloat(matrix[13] || matrix[5], 0)
};
}
return {
x: 0,
y: 0
};
}
var matrix2d = /matrix\((.*)\)/;
var matrix3d = /matrix3d\((.*)\)/;
function setTransformXY(node, xy) {
var style = window.getComputedStyle(node, null);
var transform2 = style.getPropertyValue("transform") || style.getPropertyValue(getTransformName());
if (transform2 && transform2 !== "none") {
var arr;
var match2d = transform2.match(matrix2d);
if (match2d) {
match2d = match2d[1];
arr = match2d.split(",").map(function(item) {
return parseFloat(item, 10);
});
arr[4] = xy.x;
arr[5] = xy.y;
setTransform(node, "matrix(".concat(arr.join(","), ")"));
} else {
var match3d = transform2.match(matrix3d)[1];
arr = match3d.split(",").map(function(item) {
return parseFloat(item, 10);
});
arr[12] = xy.x;
arr[13] = xy.y;
setTransform(node, "matrix3d(".concat(arr.join(","), ")"));
}
} else {
setTransform(node, "translateX(".concat(xy.x, "px) translateY(").concat(xy.y, "px) translateZ(0)"));
}
}
var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
var getComputedStyleX;
function forceRelayout(elem) {
var originalStyle = elem.style.display;
elem.style.display = "none";
elem.offsetHeight;
elem.style.display = originalStyle;
}
function css(el, name, v2) {
var value2 = v2;
if (_typeof(name) === "object") {
for (var i2 in name) {
if (name.hasOwnProperty(i2)) {
css(el, i2, name[i2]);
}
}
return void 0;
}
if (typeof value2 !== "undefined") {
if (typeof value2 === "number") {
value2 = "".concat(value2, "px");
}
el.style[name] = value2;
return void 0;
}
return getComputedStyleX(el, name);
}
function getClientPosition(elem) {
var box;
var x2;
var y2;
var doc = elem.ownerDocument;
var body = doc.body;
var docElem = doc && doc.documentElement;
box = elem.getBoundingClientRect();
x2 = Math.floor(box.left);
y2 = Math.floor(box.top);
x2 -= docElem.clientLeft || body.clientLeft || 0;
y2 -= docElem.clientTop || body.clientTop || 0;
return {
left: x2,
top: y2
};
}
function getScroll$1(w2, top) {
var ret = w2["page".concat(top ? "Y" : "X", "Offset")];
var method = "scroll".concat(top ? "Top" : "Left");
if (typeof ret !== "number") {
var d2 = w2.document;
ret = d2.documentElement[method];
if (typeof ret !== "number") {
ret = d2.body[method];
}
}
return ret;
}
function getScrollLeft(w2) {
return getScroll$1(w2);
}
function getScrollTop(w2) {
return getScroll$1(w2, true);
}
function getOffset(el) {
var pos = getClientPosition(el);
var doc = el.ownerDocument;
var w2 = doc.defaultView || doc.parentWindow;
pos.left += getScrollLeft(w2);
pos.top += getScrollTop(w2);
return pos;
}
function isWindow(obj) {
return obj !== null && obj !== void 0 && obj == obj.window;
}
function getDocument(node) {
if (isWindow(node)) {
return node.document;
}
if (node.nodeType === 9) {
return node;
}
return node.ownerDocument;
}
function _getComputedStyle(elem, name, cs) {
var computedStyle = cs;
var val = "";
var d2 = getDocument(elem);
computedStyle = computedStyle || d2.defaultView.getComputedStyle(elem, null);
if (computedStyle) {
val = computedStyle.getPropertyValue(name) || computedStyle[name];
}
return val;
}
var _RE_NUM_NO_PX = new RegExp("^(".concat(RE_NUM, ")(?!px)[a-z%]+$"), "i");
var RE_POS = /^(top|right|bottom|left)$/;
var CURRENT_STYLE = "currentStyle";
var RUNTIME_STYLE = "runtimeStyle";
var LEFT = "left";
var PX = "px";
function _getComputedStyleIE(elem, name) {
var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
var style = elem.style;
var left = style[LEFT];
var rsLeft = elem[RUNTIME_STYLE][LEFT];
elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
style[LEFT] = name === "fontSize" ? "1em" : ret || 0;
ret = style.pixelLeft + PX;
style[LEFT] = left;
elem[RUNTIME_STYLE][LEFT] = rsLeft;
}
return ret === "" ? "auto" : ret;
}
if (typeof window !== "undefined") {
getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
}
function getOffsetDirection(dir, option) {
if (dir === "left") {
return option.useCssRight ? "right" : dir;
}
return option.useCssBottom ? "bottom" : dir;
}
function oppositeOffsetDirection(dir) {
if (dir === "left") {
return "right";
} else if (dir === "right") {
return "left";
} else if (dir === "top") {
return "bottom";
} else if (dir === "bottom") {
return "top";
}
}
function setLeftTop(elem, offset3, option) {
if (css(elem, "position") === "static") {
elem.style.position = "relative";
}
var presetH = -999;
var presetV = -999;
var horizontalProperty = getOffsetDirection("left", option);
var verticalProperty = getOffsetDirection("top", option);
var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);
if (horizontalProperty !== "left") {
presetH = 999;
}
if (verticalProperty !== "top") {
presetV = 999;
}
var originalTransition = "";
var originalOffset = getOffset(elem);
if ("left" in offset3 || "top" in offset3) {
originalTransition = getTransitionProperty(elem) || "";
setTransitionProperty(elem, "none");
}
if ("left" in offset3) {
elem.style[oppositeHorizontalProperty] = "";
elem.style[horizontalProperty] = "".concat(presetH, "px");
}
if ("top" in offset3) {
elem.style[oppositeVerticalProperty] = "";
elem.style[verticalProperty] = "".concat(presetV, "px");
}
forceRelayout(elem);
var old = getOffset(elem);
var originalStyle = {};
for (var key2 in offset3) {
if (offset3.hasOwnProperty(key2)) {
var dir = getOffsetDirection(key2, option);
var preset = key2 === "left" ? presetH : presetV;
var off = originalOffset[key2] - old[key2];
if (dir === key2) {
originalStyle[dir] = preset + off;
} else {
originalStyle[dir] = preset - off;
}
}
}
css(elem, originalStyle);
forceRelayout(elem);
if ("left" in offset3 || "top" in offset3) {
setTransitionProperty(elem, originalTransition);
}
var ret = {};
for (var _key in offset3) {
if (offset3.hasOwnProperty(_key)) {
var _dir = getOffsetDirection(_key, option);
var _off = offset3[_key] - originalOffset[_key];
if (_key === _dir) {
ret[_dir] = originalStyle[_dir] + _off;
} else {
ret[_dir] = originalStyle[_dir] - _off;
}
}
}
css(elem, ret);
}
function setTransform$1(elem, offset3) {
var originalOffset = getOffset(elem);
var originalXY = getTransformXY(elem);
var resultXY = {
x: originalXY.x,
y: originalXY.y
};
if ("left" in offset3) {
resultXY.x = originalXY.x + offset3.left - originalOffset.left;
}
if ("top" in offset3) {
resultXY.y = originalXY.y + offset3.top - originalOffset.top;
}
setTransformXY(elem, resultXY);
}
function setOffset(elem, offset3, option) {
if (option.ignoreShake) {
var oriOffset = getOffset(elem);
var oLeft = oriOffset.left.toFixed(0);
var oTop = oriOffset.top.toFixed(0);
var tLeft = offset3.left.toFixed(0);
var tTop = offset3.top.toFixed(0);
if (oLeft === tLeft && oTop === tTop) {
return;
}
}
if (option.useCssRight || option.useCssBottom) {
setLeftTop(elem, offset3, option);
} else if (option.useCssTransform && getTransformName() in document.body.style) {
setTransform$1(elem, offset3);
} else {
setLeftTop(elem, offset3, option);
}
}
function each(arr, fn) {
for (var i2 = 0; i2 < arr.length; i2++) {
fn(arr[i2]);
}
}
function isBorderBoxFn(elem) {
return getComputedStyleX(elem, "boxSizing") === "border-box";
}
var BOX_MODELS = ["margin", "border", "padding"];
var CONTENT_INDEX = -1;
var PADDING_INDEX = 2;
var BORDER_INDEX = 1;
var MARGIN_INDEX = 0;
function swap(elem, options, callback) {
var old = {};
var style = elem.style;
var name;
for (name in options) {
if (options.hasOwnProperty(name)) {
old[name] = style[name];
style[name] = options[name];
}
}
callback.call(elem);
for (name in options) {
if (options.hasOwnProperty(name)) {
style[name] = old[name];
}
}
}
function getPBMWidth(elem, props3, which) {
var value2 = 0;
var prop;
var j2;
var i2;
for (j2 = 0; j2 < props3.length; j2++) {
prop = props3[j2];
if (prop) {
for (i2 = 0; i2 < which.length; i2++) {
var cssProp = void 0;
if (prop === "border") {
cssProp = "".concat(prop).concat(which[i2], "Width");
} else {
cssProp = prop + which[i2];
}
value2 += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
}
}
}
return value2;
}
var domUtils = {
getParent: function getParent(element) {
var parent = element;
do {
if (parent.nodeType === 11 && parent.host) {
parent = parent.host;
} else {
parent = parent.parentNode;
}
} while (parent && parent.nodeType !== 1 && parent.nodeType !== 9);
return parent;
}
};
each(["Width", "Height"], function(name) {
domUtils["doc".concat(name)] = function(refWin) {
var d2 = refWin.document;
return Math.max(
// firefox chrome documentElement.scrollHeight< body.scrollHeight
// ie standard mode : documentElement.scrollHeight> body.scrollHeight
d2.documentElement["scroll".concat(name)],
// quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
d2.body["scroll".concat(name)],
domUtils["viewport".concat(name)](d2)
);
};
domUtils["viewport".concat(name)] = function(win) {
var prop = "client".concat(name);
var doc = win.document;
var body = doc.body;
var documentElement = doc.documentElement;
var documentElementProp = documentElement[prop];
return doc.compatMode === "CSS1Compat" && documentElementProp || body && body[prop] || documentElementProp;
};
});
function getWH(elem, name, ex) {
var extra = ex;
if (isWindow(elem)) {
return name === "width" ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
} else if (elem.nodeType === 9) {
return name === "width" ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
}
var which = name === "width" ? ["Left", "Right"] : ["Top", "Bottom"];
var borderBoxValue = name === "width" ? Math.floor(elem.getBoundingClientRect().width) : Math.floor(elem.getBoundingClientRect().height);
var isBorderBox = isBorderBoxFn(elem);
var cssBoxValue = 0;
if (borderBoxValue === null || borderBoxValue === void 0 || borderBoxValue <= 0) {
borderBoxValue = void 0;
cssBoxValue = getComputedStyleX(elem, name);
if (cssBoxValue === null || cssBoxValue === void 0 || Number(cssBoxValue) < 0) {
cssBoxValue = elem.style[name] || 0;
}
cssBoxValue = Math.floor(parseFloat(cssBoxValue)) || 0;
}
if (extra === void 0) {
extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
}
var borderBoxValueOrIsBorderBox = borderBoxValue !== void 0 || isBorderBox;
var val = borderBoxValue || cssBoxValue;
if (extra === CONTENT_INDEX) {
if (borderBoxValueOrIsBorderBox) {
return val - getPBMWidth(elem, ["border", "padding"], which);
}
return cssBoxValue;
} else if (borderBoxValueOrIsBorderBox) {
if (extra === BORDER_INDEX) {
return val;
}
return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ["border"], which) : getPBMWidth(elem, ["margin"], which));
}
return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which);
}
var cssShow = {
position: "absolute",
visibility: "hidden",
display: "block"
};
function getWHIgnoreDisplay() {
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
args[_key2] = arguments[_key2];
}
var val;
var elem = args[0];
if (elem.offsetWidth !== 0) {
val = getWH.apply(void 0, args);
} else {
swap(elem, cssShow, function() {
val = getWH.apply(void 0, args);
});
}
return val;
}
each(["width", "height"], function(name) {
var first = name.charAt(0).toUpperCase() + name.slice(1);
domUtils["outer".concat(first)] = function(el, includeMargin) {
return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
};
var which = name === "width" ? ["Left", "Right"] : ["Top", "Bottom"];
domUtils[name] = function(elem, v2) {
var val = v2;
if (val !== void 0) {
if (elem) {
var isBorderBox = isBorderBoxFn(elem);
if (isBorderBox) {
val += getPBMWidth(elem, ["padding", "border"], which);
}
return css(elem, name, val);
}
return void 0;
}
return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
};
});
function mix(to, from) {
for (var i2 in from) {
if (from.hasOwnProperty(i2)) {
to[i2] = from[i2];
}
}
return to;
}
var utils$1 = {
getWindow: function getWindow(node) {
if (node && node.document && node.setTimeout) {
return node;
}
var doc = node.ownerDocument || node;
return doc.defaultView || doc.parentWindow;
},
getDocument,
offset: function offset(el, value2, option) {
if (typeof value2 !== "undefined") {
setOffset(el, value2, option || {});
} else {
return getOffset(el);
}
},
isWindow,
each,
css,
clone: function clone(obj) {
var i2;
var ret = {};
for (i2 in obj) {
if (obj.hasOwnProperty(i2)) {
ret[i2] = obj[i2];
}
}
var overflow = obj.overflow;
if (overflow) {
for (i2 in obj) {
if (obj.hasOwnProperty(i2)) {
ret.overflow[i2] = obj.overflow[i2];
}
}
}
return ret;
},
mix,
getWindowScrollLeft: function getWindowScrollLeft(w2) {
return getScrollLeft(w2);
},
getWindowScrollTop: function getWindowScrollTop(w2) {
return getScrollTop(w2);
},
merge: function merge() {
var ret = {};
for (var i2 = 0; i2 < arguments.length; i2++) {
utils$1.mix(ret, i2 < 0 || arguments.length <= i2 ? void 0 : arguments[i2]);
}
return ret;
},
viewportWidth: 0,
viewportHeight: 0
};
mix(utils$1, domUtils);
var getParent$1 = utils$1.getParent;
function getOffsetParent(element) {
if (utils$1.isWindow(element) || element.nodeType === 9) {
return null;
}
var doc = utils$1.getDocument(element);
var body = doc.body;
var parent;
var positionStyle = utils$1.css(element, "position");
var skipStatic = positionStyle === "fixed" || positionStyle === "absolute";
if (!skipStatic) {
return element.nodeName.toLowerCase() === "html" ? null : getParent$1(element);
}
for (parent = getParent$1(element); parent && parent !== body && parent.nodeType !== 9; parent = getParent$1(parent)) {
positionStyle = utils$1.css(parent, "position");
if (positionStyle !== "static") {
return parent;
}
}
return null;
}
var getParent$1$1 = utils$1.getParent;
function isAncestorFixed(element) {
if (utils$1.isWindow(element) || element.nodeType === 9) {
return false;
}
var doc = utils$1.getDocument(element);
var body = doc.body;
var parent = null;
for (
parent = getParent$1$1(element);
// 修复元素位于 document.documentElement 下导致崩溃问题
parent && parent !== body && parent !== doc;
parent = getParent$1$1(parent)
) {
var positionStyle = utils$1.css(parent, "position");
if (positionStyle === "fixed") {
return true;
}
}
return false;
}
function getVisibleRectForElement(element, alwaysByViewport) {
var visibleRect = {
left: 0,
right: Infinity,
top: 0,
bottom: Infinity
};
var el = getOffsetParent(element);
var doc = utils$1.getDocument(element);
var win = doc.defaultView || doc.parentWindow;
var body = doc.body;
var documentElement = doc.documentElement;
while (el) {
if ((navigator.userAgent.indexOf("MSIE") === -1 || el.clientWidth !== 0) && // body may have overflow set on it, yet we still get the entire
// viewport. In some browsers, el.offsetParent may be
// document.documentElement, so check for that too.
el !== body && el !== documentElement && utils$1.css(el, "overflow") !== "visible") {
var pos = utils$1.offset(el);
pos.left += el.clientLeft;
pos.top += el.clientTop;
visibleRect.top = Math.max(visibleRect.top, pos.top);
visibleRect.right = Math.min(
visibleRect.right,
// consider area without scrollBar
pos.left + el.clientWidth
);
visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);
visibleRect.left = Math.max(visibleRect.left, pos.left);
} else if (el === body || el === documentElement) {
break;
}
el = getOffsetParent(el);
}
var originalPosition = null;
if (!utils$1.isWindow(element) && element.nodeType !== 9) {
originalPosition = element.style.position;
var position = utils$1.css(element, "position");
if (position === "absolute") {
element.style.position = "fixed";
}
}
var scrollX = utils$1.getWindowScrollLeft(win);
var scrollY = utils$1.getWindowScrollTop(win);
var viewportWidth = utils$1.viewportWidth(win);
var viewportHeight = utils$1.viewportHeight(win);
var documentWidth = documentElement.scrollWidth;
var documentHeight = documentElement.scrollHeight;
var bodyStyle = window.getComputedStyle(body);
if (bodyStyle.overflowX === "hidden") {
documentWidth = win.innerWidth;
}
if (bodyStyle.overflowY === "hidden") {
documentHeight = win.innerHeight;
}
if (element.style) {
element.style.position = originalPosition;
}
if (alwaysByViewport || isAncestorFixed(element)) {
visibleRect.left = Math.max(visibleRect.left, scrollX);
visibleRect.top = Math.max(visibleRect.top, scrollY);
visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth);
visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight);
} else {
var maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth);
visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth);
var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);
visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);
}
return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
}
function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {
var pos = utils$1.clone(elFuturePos);
var size = {
width: elRegion.width,
height: elRegion.height
};
if (overflow.adjustX && pos.left < visibleRect.left) {
pos.left = visibleRect.left;
}
if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {
size.width -= pos.left + size.width - visibleRect.right;
}
if (overflow.adjustX && pos.left + size.width > visibleRect.right) {
pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);
}
if (overflow.adjustY && pos.top < visibleRect.top) {
pos.top = visibleRect.top;
}
if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {
size.height -= pos.top + size.height - visibleRect.bottom;
}
if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {
pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);
}
return utils$1.mix(pos, size);
}
function getRegion(node) {
var offset3;
var w2;
var h2;
if (!utils$1.isWindow(node) && node.nodeType !== 9) {
offset3 = utils$1.offset(node);
w2 = utils$1.outerWidth(node);
h2 = utils$1.outerHeight(node);
} else {
var win = utils$1.getWindow(node);
offset3 = {
left: utils$1.getWindowScrollLeft(win),
top: utils$1.getWindowScrollTop(win)
};
w2 = utils$1.viewportWidth(win);
h2 = utils$1.viewportHeight(win);
}
offset3.width = w2;
offset3.height = h2;
return offset3;
}
function getAlignOffset(region, align) {
var V2 = align.charAt(0);
var H = align.charAt(1);
var w2 = region.width;
var h2 = region.height;
var x2 = region.left;
var y2 = region.top;
if (V2 === "c") {
y2 += h2 / 2;
} else if (V2 === "b") {
y2 += h2;
}
if (H === "c") {
x2 += w2 / 2;
} else if (H === "r") {
x2 += w2;
}
return {
left: x2,
top: y2
};
}
function getElFuturePos(elRegion, refNodeRegion, points, offset3, targetOffset2) {
var p1 = getAlignOffset(refNodeRegion, points[1]);
var p2 = getAlignOffset(elRegion, points[0]);
var diff2 = [p2.left - p1.left, p2.top - p1.top];
return {
left: Math.round(elRegion.left - diff2[0] + offset3[0] - targetOffset2[0]),
top: Math.round(elRegion.top - diff2[1] + offset3[1] - targetOffset2[1])
};
}
function isFailX(elFuturePos, elRegion, visibleRect) {
return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;
}
function isFailY(elFuturePos, elRegion, visibleRect) {
return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;
}
function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
}
function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
}
function flip(points, reg, map) {
var ret = [];
utils$1.each(points, function(p) {
ret.push(p.replace(reg, function(m2) {
return map[m2];
}));
});
return ret;
}
function flipOffset(offset3, index2) {
offset3[index2] = -offset3[index2];
return offset3;
}
function convertOffset(str, offsetLen) {
var n2;
if (/%$/.test(str)) {
n2 = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;
} else {
n2 = parseInt(str, 10);
}
return n2 || 0;
}
function normalizeOffset(offset3, el) {
offset3[0] = convertOffset(offset3[0], el.width);
offset3[1] = convertOffset(offset3[1], el.height);
}
function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
var points = align.points;
var offset3 = align.offset || [0, 0];
var targetOffset2 = align.targetOffset || [0, 0];
var overflow = align.overflow;
var source = align.source || el;
offset3 = [].concat(offset3);
targetOffset2 = [].concat(targetOffset2);
overflow = overflow || {};
var newOverflowCfg = {};
var fail = 0;
var alwaysByViewport = !!(overflow && overflow.alwaysByViewport);
var visibleRect = getVisibleRectForElement(source, alwaysByViewport);
var elRegion = getRegion(source);
normalizeOffset(offset3, elRegion);
normalizeOffset(targetOffset2, tgtRegion);
var elFuturePos = getElFuturePos(elRegion, tgtRegion, points, offset3, targetOffset2);
var newElRegion = utils$1.merge(elRegion, elFuturePos);
if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) {
if (overflow.adjustX) {
if (isFailX(elFuturePos, elRegion, visibleRect)) {
var newPoints = flip(points, /[lr]/gi, {
l: "r",
r: "l"
});
var newOffset = flipOffset(offset3, 0);
var newTargetOffset = flipOffset(targetOffset2, 0);
var newElFuturePos = getElFuturePos(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset);
if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
fail = 1;
points = newPoints;
offset3 = newOffset;
targetOffset2 = newTargetOffset;
}
}
}
if (overflow.adjustY) {
if (isFailY(elFuturePos, elRegion, visibleRect)) {
var _newPoints = flip(points, /[tb]/gi, {
t: "b",
b: "t"
});
var _newOffset = flipOffset(offset3, 1);
var _newTargetOffset = flipOffset(targetOffset2, 1);
var _newElFuturePos = getElFuturePos(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset);
if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {
fail = 1;
points = _newPoints;
offset3 = _newOffset;
targetOffset2 = _newTargetOffset;
}
}
}
if (fail) {
elFuturePos = getElFuturePos(elRegion, tgtRegion, points, offset3, targetOffset2);
utils$1.mix(newElRegion, elFuturePos);
}
var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);
var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);
if (isStillFailX || isStillFailY) {
var _newPoints2 = points;
if (isStillFailX) {
_newPoints2 = flip(points, /[lr]/gi, {
l: "r",
r: "l"
});
}
if (isStillFailY) {
_newPoints2 = flip(points, /[tb]/gi, {
t: "b",
b: "t"
});
}
points = _newPoints2;
offset3 = align.offset || [0, 0];
targetOffset2 = align.targetOffset || [0, 0];
}
newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;
newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;
if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {
newElRegion = adjustForViewport(elFuturePos, elRegion, visibleRect, newOverflowCfg);
}
}
if (newElRegion.width !== elRegion.width) {
utils$1.css(source, "width", utils$1.width(source) + newElRegion.width - elRegion.width);
}
if (newElRegion.height !== elRegion.height) {
utils$1.css(source, "height", utils$1.height(source) + newElRegion.height - elRegion.height);
}
utils$1.offset(source, {
left: newElRegion.left,
top: newElRegion.top
}, {
useCssRight: align.useCssRight,
useCssBottom: align.useCssBottom,
useCssTransform: align.useCssTransform,
ignoreShake: align.ignoreShake
});
return {
points,
offset: offset3,
targetOffset: targetOffset2,
overflow: newOverflowCfg
};
}
function isOutOfVisibleRect(target, alwaysByViewport) {
var visibleRect = getVisibleRectForElement(target, alwaysByViewport);
var targetRegion = getRegion(target);
return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom;
}
function alignElement(el, refNode, align) {
var target = align.target || refNode;
var refNodeRegion = getRegion(target);
var isTargetNotOutOfVisible = !isOutOfVisibleRect(target, align.overflow && align.overflow.alwaysByViewport);
return doAlign(el, refNodeRegion, align, isTargetNotOutOfVisible);
}
alignElement.__getOffsetParent = getOffsetParent;
alignElement.__getVisibleRectForElement = getVisibleRectForElement;
function alignPoint(el, tgtPoint, align) {
var pageX;
var pageY;
var doc = utils$1.getDocument(el);
var win = doc.defaultView || doc.parentWindow;
var scrollX = utils$1.getWindowScrollLeft(win);
var scrollY = utils$1.getWindowScrollTop(win);
var viewportWidth = utils$1.viewportWidth(win);
var viewportHeight = utils$1.viewportHeight(win);
if ("pageX" in tgtPoint) {
pageX = tgtPoint.pageX;
} else {
pageX = scrollX + tgtPoint.clientX;
}
if ("pageY" in tgtPoint) {
pageY = tgtPoint.pageY;
} else {
pageY = scrollY + tgtPoint.clientY;
}
var tgtRegion = {
left: pageX,
top: pageY,
width: 0,
height: 0
};
var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight;
var points = [align.points[0], "cc"];
return doAlign(el, tgtRegion, _objectSpread2(_objectSpread2({}, align), {}, {
points
}), pointInView);
}
function cloneElement(vnode) {
var nodeProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var override = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
var mergeRef = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
var ele = vnode;
if (Array.isArray(vnode)) {
ele = filterEmpty(vnode)[0];
}
if (!ele) {
return null;
}
var node = cloneVNode(ele, nodeProps, mergeRef);
node.props = override ? _objectSpread2$1(_objectSpread2$1({}, node.props), nodeProps) : node.props;
warning$1(_typeof$2(node.props.class) !== "object", "class must be string");
return node;
}
const isVisible = function(element) {
if (!element) {
return false;
}
if (element.offsetParent) {
return true;
}
if (element.getBBox) {
var box = element.getBBox();
if (box.width || box.height) {
return true;
}
}
if (element.getBoundingClientRect) {
var _box = element.getBoundingClientRect();
if (_box.width || _box.height) {
return true;
}
}
return false;
};
function isSamePoint(prev2, next2) {
if (prev2 === next2)
return true;
if (!prev2 || !next2)
return false;
if ("pageX" in next2 && "pageY" in next2) {
return prev2.pageX === next2.pageX && prev2.pageY === next2.pageY;
}
if ("clientX" in next2 && "clientY" in next2) {
return prev2.clientX === next2.clientX && prev2.clientY === next2.clientY;
}
return false;
}
function restoreFocus(activeElement, container) {
if (activeElement !== document.activeElement && contains(container, activeElement) && typeof activeElement.focus === "function") {
activeElement.focus();
}
}
function monitorResize(element, callback) {
var prevWidth = null;
var prevHeight = null;
function onResize(_ref) {
var _ref2 = _slicedToArray$2(_ref, 1), target = _ref2[0].target;
if (!document.documentElement.contains(target))
return;
var _target$getBoundingCl = target.getBoundingClientRect(), width = _target$getBoundingCl.width, height = _target$getBoundingCl.height;
var fixedWidth = Math.floor(width);
var fixedHeight = Math.floor(height);
if (prevWidth !== fixedWidth || prevHeight !== fixedHeight) {
Promise.resolve().then(function() {
callback({
width: fixedWidth,
height: fixedHeight
});
});
}
prevWidth = fixedWidth;
prevHeight = fixedHeight;
}
var resizeObserver = new index$2(onResize);
if (element) {
resizeObserver.observe(element);
}
return function() {
resizeObserver.disconnect();
};
}
const useBuffer = function(callback, buffer) {
var called = false;
var timeout = null;
function cancelTrigger() {
clearTimeout(timeout);
}
function trigger2(force) {
if (!called || force === true) {
if (callback() === false) {
return;
}
called = true;
cancelTrigger();
timeout = setTimeout(function() {
called = false;
}, buffer.value);
} else {
cancelTrigger();
timeout = setTimeout(function() {
called = false;
trigger2();
}, buffer.value);
}
}
return [trigger2, function() {
called = false;
cancelTrigger();
}];
};
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
function eq(value2, other) {
return value2 === other || value2 !== value2 && other !== other;
}
function assocIndexOf(array, key2) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key2)) {
return length;
}
}
return -1;
}
var arrayProto = Array.prototype;
var splice = arrayProto.splice;
function listCacheDelete(key2) {
var data2 = this.__data__, index2 = assocIndexOf(data2, key2);
if (index2 < 0) {
return false;
}
var lastIndex = data2.length - 1;
if (index2 == lastIndex) {
data2.pop();
} else {
splice.call(data2, index2, 1);
}
--this.size;
return true;
}
function listCacheGet(key2) {
var data2 = this.__data__, index2 = assocIndexOf(data2, key2);
return index2 < 0 ? void 0 : data2[index2][1];
}
function listCacheHas(key2) {
return assocIndexOf(this.__data__, key2) > -1;
}
function listCacheSet(key2, value2) {
var data2 = this.__data__, index2 = assocIndexOf(data2, key2);
if (index2 < 0) {
++this.size;
data2.push([key2, value2]);
} else {
data2[index2][1] = value2;
}
return this;
}
function ListCache(entries) {
var index2 = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype["delete"] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
function stackClear() {
this.__data__ = new ListCache();
this.size = 0;
}
function stackDelete(key2) {
var data2 = this.__data__, result = data2["delete"](key2);
this.size = data2.size;
return result;
}
function stackGet(key2) {
return this.__data__.get(key2);
}
function stackHas(key2) {
return this.__data__.has(key2);
}
function isObject$2(value2) {
var type = typeof value2;
return value2 != null && (type == "object" || type == "function");
}
var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
function isFunction$1(value2) {
if (!isObject$2(value2)) {
return false;
}
var tag = baseGetTag(value2);
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
}
var coreJsData = root$1["__core-js_shared__"];
const coreJsData$1 = coreJsData;
var maskSrcKey = function() {
var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
return uid ? "Symbol(src)_1." + uid : "";
}();
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
var funcProto$1 = Function.prototype;
var funcToString$1 = funcProto$1.toString;
function toSource(func) {
if (func != null) {
try {
return funcToString$1.call(func);
} catch (e2) {
}
try {
return func + "";
} catch (e2) {
}
}
return "";
}
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var funcProto = Function.prototype, objectProto$a = Object.prototype;
var funcToString = funcProto.toString;
var hasOwnProperty$a = objectProto$a.hasOwnProperty;
var reIsNative = RegExp(
"^" + funcToString.call(hasOwnProperty$a).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function baseIsNative(value2) {
if (!isObject$2(value2) || isMasked(value2)) {
return false;
}
var pattern = isFunction$1(value2) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value2));
}
function getValue$1(object, key2) {
return object == null ? void 0 : object[key2];
}
function getNative(object, key2) {
var value2 = getValue$1(object, key2);
return baseIsNative(value2) ? value2 : void 0;
}
var Map$1 = getNative(root$1, "Map");
const Map$2 = Map$1;
var nativeCreate = getNative(Object, "create");
const nativeCreate$1 = nativeCreate;
function hashClear() {
this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
this.size = 0;
}
function hashDelete(key2) {
var result = this.has(key2) && delete this.__data__[key2];
this.size -= result ? 1 : 0;
return result;
}
var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
var objectProto$9 = Object.prototype;
var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
function hashGet(key2) {
var data2 = this.__data__;
if (nativeCreate$1) {
var result = data2[key2];
return result === HASH_UNDEFINED$2 ? void 0 : result;
}
return hasOwnProperty$9.call(data2, key2) ? data2[key2] : void 0;
}
var objectProto$8 = Object.prototype;
var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
function hashHas(key2) {
var data2 = this.__data__;
return nativeCreate$1 ? data2[key2] !== void 0 : hasOwnProperty$8.call(data2, key2);
}
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
function hashSet(key2, value2) {
var data2 = this.__data__;
this.size += this.has(key2) ? 0 : 1;
data2[key2] = nativeCreate$1 && value2 === void 0 ? HASH_UNDEFINED$1 : value2;
return this;
}
function Hash(entries) {
var index2 = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
Hash.prototype.clear = hashClear;
Hash.prototype["delete"] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
function mapCacheClear() {
this.size = 0;
this.__data__ = {
"hash": new Hash(),
"map": new (Map$2 || ListCache)(),
"string": new Hash()
};
}
function isKeyable(value2) {
var type = typeof value2;
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value2 !== "__proto__" : value2 === null;
}
function getMapData(map, key2) {
var data2 = map.__data__;
return isKeyable(key2) ? data2[typeof key2 == "string" ? "string" : "hash"] : data2.map;
}
function mapCacheDelete(key2) {
var result = getMapData(this, key2)["delete"](key2);
this.size -= result ? 1 : 0;
return result;
}
function mapCacheGet(key2) {
return getMapData(this, key2).get(key2);
}
function mapCacheHas(key2) {
return getMapData(this, key2).has(key2);
}
function mapCacheSet(key2, value2) {
var data2 = getMapData(this, key2), size = data2.size;
data2.set(key2, value2);
this.size += data2.size == size ? 0 : 1;
return this;
}
function MapCache(entries) {
var index2 = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index2 < length) {
var entry = entries[index2];
this.set(entry[0], entry[1]);
}
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype["delete"] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
var LARGE_ARRAY_SIZE$1 = 200;
function stackSet(key2, value2) {
var data2 = this.__data__;
if (data2 instanceof ListCache) {
var pairs = data2.__data__;
if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
pairs.push([key2, value2]);
this.size = ++data2.size;
return this;
}
data2 = this.__data__ = new MapCache(pairs);
}
data2.set(key2, value2);
this.size = data2.size;
return this;
}
function Stack(entries) {
var data2 = this.__data__ = new ListCache(entries);
this.size = data2.size;
}
Stack.prototype.clear = stackClear;
Stack.prototype["delete"] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
var HASH_UNDEFINED = "__lodash_hash_undefined__";
function setCacheAdd(value2) {
this.__data__.set(value2, HASH_UNDEFINED);
return this;
}
function setCacheHas(value2) {
return this.__data__.has(value2);
}
function SetCache(values) {
var index2 = -1, length = values == null ? 0 : values.length;
this.__data__ = new MapCache();
while (++index2 < length) {
this.add(values[index2]);
}
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
function arraySome(array, predicate) {
var index2 = -1, length = array == null ? 0 : array.length;
while (++index2 < length) {
if (predicate(array[index2], index2, array)) {
return true;
}
}
return false;
}
function cacheHas(cache2, key2) {
return cache2.has(key2);
}
var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
var arrStacked = stack.get(array);
var othStacked = stack.get(other);
if (arrStacked && othStacked) {
return arrStacked == other && othStacked == array;
}
var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
stack.set(array, other);
stack.set(other, array);
while (++index2 < arrLength) {
var arrValue = array[index2], othValue = other[index2];
if (customizer) {
var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack);
}
if (compared !== void 0) {
if (compared) {
continue;
}
result = false;
break;
}
if (seen) {
if (!arraySome(other, function(othValue2, othIndex) {
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
result = false;
break;
}
}
stack["delete"](array);
stack["delete"](other);
return result;
}
var Uint8Array = root$1.Uint8Array;
const Uint8Array$1 = Uint8Array;
function mapToArray(map) {
var index2 = -1, result = Array(map.size);
map.forEach(function(value2, key2) {
result[++index2] = [key2, value2];
});
return result;
}
function setToArray(set) {
var index2 = -1, result = Array(set.size);
set.forEach(function(value2) {
result[++index2] = value2;
});
return result;
}
var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
var boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]";
var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]";
var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : void 0;
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag$2:
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag$1:
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
return false;
}
return true;
case boolTag$1:
case dateTag$1:
case numberTag$1:
return eq(+object, +other);
case errorTag$1:
return object.name == other.name && object.message == other.message;
case regexpTag$1:
case stringTag$1:
return object == other + "";
case mapTag$2:
var convert = mapToArray;
case setTag$2:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG;
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack["delete"](object);
return result;
case symbolTag$1:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
function arrayPush(array, values) {
var index2 = -1, length = values.length, offset3 = array.length;
while (++index2 < length) {
array[offset3 + index2] = values[index2];
}
return array;
}
var isArray$1 = Array.isArray;
const isArray$2 = isArray$1;
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray$2(object) ? result : arrayPush(result, symbolsFunc(object));
}
function arrayFilter(array, predicate) {
var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
while (++index2 < length) {
var value2 = array[index2];
if (predicate(value2, index2, array)) {
result[resIndex++] = value2;
}
}
return result;
}
function stubArray() {
return [];
}
var objectProto$7 = Object.prototype;
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
var nativeGetSymbols = Object.getOwnPropertySymbols;
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
if (object == null) {
return [];
}
object = Object(object);
return arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable$1.call(object, symbol);
});
};
const getSymbols$1 = getSymbols;
function baseTimes(n2, iteratee) {
var index2 = -1, result = Array(n2);
while (++index2 < n2) {
result[index2] = iteratee(index2);
}
return result;
}
var argsTag$2 = "[object Arguments]";
function baseIsArguments(value2) {
return isObjectLike(value2) && baseGetTag(value2) == argsTag$2;
}
var objectProto$6 = Object.prototype;
var hasOwnProperty$7 = objectProto$6.hasOwnProperty;
var propertyIsEnumerable = objectProto$6.propertyIsEnumerable;
var isArguments = baseIsArguments(function() {
return arguments;
}()) ? baseIsArguments : function(value2) {
return isObjectLike(value2) && hasOwnProperty$7.call(value2, "callee") && !propertyIsEnumerable.call(value2, "callee");
};
const isArguments$1 = isArguments;
function stubFalse() {
return false;
}
var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
var Buffer = moduleExports$1 ? root$1.Buffer : void 0;
var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
var isBuffer = nativeIsBuffer || stubFalse;
const isBuffer$1 = isBuffer;
var MAX_SAFE_INTEGER$1 = 9007199254740991;
var reIsUint = /^(?:0|[1-9]\d*)$/;
function isIndex(value2, length) {
var type = typeof value2;
length = length == null ? MAX_SAFE_INTEGER$1 : length;
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length);
}
var MAX_SAFE_INTEGER = 9007199254740991;
function isLength(value2) {
return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER;
}
var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", mapTag$1 = "[object Map]", numberTag = "[object Number]", objectTag$2 = "[object Object]", regexpTag = "[object RegExp]", setTag$1 = "[object Set]", stringTag = "[object String]", weakMapTag$1 = "[object WeakMap]";
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag$1 = "[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]";
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag$1] = typedArrayTags[numberTag] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] = typedArrayTags[setTag$1] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag$1] = false;
function baseIsTypedArray(value2) {
return isObjectLike(value2) && isLength(value2.length) && !!typedArrayTags[baseGetTag(value2)];
}
function baseUnary(func) {
return function(value2) {
return func(value2);
};
}
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
var moduleExports = freeModule && freeModule.exports === freeExports;
var freeProcess = moduleExports && freeGlobal$1.process;
var nodeUtil = function() {
try {
var types = freeModule && freeModule.require && freeModule.require("util").types;
if (types) {
return types;
}
return freeProcess && freeProcess.binding && freeProcess.binding("util");
} catch (e2) {
}
}();
const nodeUtil$1 = nodeUtil;
var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
const isTypedArray$1 = isTypedArray;
var objectProto$5 = Object.prototype;
var hasOwnProperty$6 = objectProto$5.hasOwnProperty;
function arrayLikeKeys(value2, inherited) {
var isArr = isArray$2(value2), isArg = !isArr && isArguments$1(value2), isBuff = !isArr && !isArg && isBuffer$1(value2), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value2), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value2.length, String) : [], length = result.length;
for (var key2 in value2) {
if ((inherited || hasOwnProperty$6.call(value2, key2)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
(key2 == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
isBuff && (key2 == "offset" || key2 == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
isType && (key2 == "buffer" || key2 == "byteLength" || key2 == "byteOffset") || // Skip index properties.
isIndex(key2, length)))) {
result.push(key2);
}
}
return result;
}
var objectProto$4 = Object.prototype;
function isPrototype(value2) {
var Ctor = value2 && value2.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$4;
return value2 === proto;
}
var nativeKeys = overArg(Object.keys, Object);
const nativeKeys$1 = nativeKeys;
var objectProto$3 = Object.prototype;
var hasOwnProperty$5 = objectProto$3.hasOwnProperty;
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys$1(object);
}
var result = [];
for (var key2 in Object(object)) {
if (hasOwnProperty$5.call(object, key2) && key2 != "constructor") {
result.push(key2);
}
}
return result;
}
function isArrayLike(value2) {
return value2 != null && isLength(value2.length) && !isFunction$1(value2);
}
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols$1);
}
var COMPARE_PARTIAL_FLAG$1 = 1;
var objectProto$2 = Object.prototype;
var hasOwnProperty$4 = objectProto$2.hasOwnProperty;
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index2 = objLength;
while (index2--) {
var key2 = objProps[index2];
if (!(isPartial ? key2 in other : hasOwnProperty$4.call(other, key2))) {
return false;
}
}
var objStacked = stack.get(object);
var othStacked = stack.get(other);
if (objStacked && othStacked) {
return objStacked == other && othStacked == object;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index2 < objLength) {
key2 = objProps[index2];
var objValue = object[key2], othValue = other[key2];
if (customizer) {
var compared = isPartial ? customizer(othValue, objValue, key2, other, object, stack) : customizer(objValue, othValue, key2, object, other, stack);
}
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
result = false;
break;
}
skipCtor || (skipCtor = key2 == "constructor");
}
if (result && !skipCtor) {
var objCtor = object.constructor, othCtor = other.constructor;
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
result = false;
}
}
stack["delete"](object);
stack["delete"](other);
return result;
}
var DataView = getNative(root$1, "DataView");
const DataView$1 = DataView;
var Promise$1 = getNative(root$1, "Promise");
const Promise$2 = Promise$1;
var Set$1 = getNative(root$1, "Set");
const Set$2 = Set$1;
var WeakMap$1 = getNative(root$1, "WeakMap");
const WeakMap$2 = WeakMap$1;
var mapTag = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag = "[object Set]", weakMapTag = "[object WeakMap]";
var dataViewTag = "[object DataView]";
var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$2);
var getTag = baseGetTag;
if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag || Map$2 && getTag(new Map$2()) != mapTag || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag || WeakMap$2 && getTag(new WeakMap$2()) != weakMapTag) {
getTag = function(value2) {
var result = baseGetTag(value2), Ctor = result == objectTag$1 ? value2.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
if (ctorString) {
switch (ctorString) {
case dataViewCtorString:
return dataViewTag;
case mapCtorString:
return mapTag;
case promiseCtorString:
return promiseTag;
case setCtorString:
return setTag;
case weakMapCtorString:
return weakMapTag;
}
}
return result;
};
}
const getTag$1 = getTag;
var COMPARE_PARTIAL_FLAG = 1;
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
var objectProto$1 = Object.prototype;
var hasOwnProperty$3 = objectProto$1.hasOwnProperty;
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray$2(object), othIsArr = isArray$2(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
if (isSameTag && isBuffer$1(object)) {
if (!isBuffer$1(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack());
return objIsArr || isTypedArray$1(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty$3.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$3.call(other, "__wrapped__");
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack());
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack());
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
function baseIsEqual(value2, other, bitmask, customizer, stack) {
if (value2 === other) {
return true;
}
if (value2 == null || other == null || !isObjectLike(value2) && !isObjectLike(other)) {
return value2 !== value2 && other !== other;
}
return baseIsEqualDeep(value2, other, bitmask, customizer, baseIsEqual, stack);
}
function isEqual$1(value2, other) {
return baseIsEqual(value2, other);
}
var alignProps = {
align: Object,
target: [Object, Function],
onAlign: Function,
monitorBufferTime: Number,
monitorWindowResize: Boolean,
disabled: Boolean
};
function getElement(func) {
if (typeof func !== "function")
return null;
return func();
}
function getPoint(point) {
if (_typeof$2(point) !== "object" || !point)
return null;
return point;
}
const Align = defineComponent({
compatConfig: {
MODE: 3
},
name: "Align",
props: alignProps,
emits: ["align"],
setup: function setup8(props3, _ref) {
var expose = _ref.expose, slots = _ref.slots;
var cacheRef = ref({});
var nodeRef = ref();
var _useBuffer = useBuffer(function() {
var latestDisabled = props3.disabled, latestTarget = props3.target, latestAlign = props3.align, latestOnAlign = props3.onAlign;
if (!latestDisabled && latestTarget && nodeRef.value) {
var source = nodeRef.value;
var result;
var element = getElement(latestTarget);
var point = getPoint(latestTarget);
cacheRef.value.element = element;
cacheRef.value.point = point;
cacheRef.value.align = latestAlign;
var _document = document, activeElement = _document.activeElement;
if (element && isVisible(element)) {
result = alignElement(source, element, latestAlign);
} else if (point) {
result = alignPoint(source, point, latestAlign);
}
restoreFocus(activeElement, source);
if (latestOnAlign && result) {
latestOnAlign(source, result);
}
return true;
}
return false;
}, computed(function() {
return props3.monitorBufferTime;
})), _useBuffer2 = _slicedToArray$2(_useBuffer, 2), _forceAlign = _useBuffer2[0], cancelForceAlign = _useBuffer2[1];
var resizeMonitor = ref({
cancel: function cancel() {
}
});
var sourceResizeMonitor = ref({
cancel: function cancel() {
}
});
var goAlign = function goAlign2() {
var target = props3.target;
var element = getElement(target);
var point = getPoint(target);
if (nodeRef.value !== sourceResizeMonitor.value.element) {
sourceResizeMonitor.value.cancel();
sourceResizeMonitor.value.element = nodeRef.value;
sourceResizeMonitor.value.cancel = monitorResize(nodeRef.value, _forceAlign);
}
if (cacheRef.value.element !== element || !isSamePoint(cacheRef.value.point, point) || !isEqual$1(cacheRef.value.align, props3.align)) {
_forceAlign();
if (resizeMonitor.value.element !== element) {
resizeMonitor.value.cancel();
resizeMonitor.value.element = element;
resizeMonitor.value.cancel = monitorResize(element, _forceAlign);
}
}
};
onMounted(function() {
nextTick(function() {
goAlign();
});
});
onUpdated(function() {
nextTick(function() {
goAlign();
});
});
watch(function() {
return props3.disabled;
}, function(disabled) {
if (!disabled) {
_forceAlign();
} else {
cancelForceAlign();
}
}, {
immediate: true,
flush: "post"
});
var winResizeRef = ref(null);
watch(function() {
return props3.monitorWindowResize;
}, function(monitorWindowResize) {
if (monitorWindowResize) {
if (!winResizeRef.value) {
winResizeRef.value = addEventListenerWrap(window, "resize", _forceAlign);
}
} else if (winResizeRef.value) {
winResizeRef.value.remove();
winResizeRef.value = null;
}
}, {
flush: "post"
});
onUnmounted(function() {
resizeMonitor.value.cancel();
sourceResizeMonitor.value.cancel();
if (winResizeRef.value)
winResizeRef.value.remove();
cancelForceAlign();
});
expose({
forceAlign: function forceAlign() {
return _forceAlign(true);
}
});
return function() {
var child = slots === null || slots === void 0 ? void 0 : slots.default();
if (child) {
return cloneElement(child[0], {
ref: nodeRef
}, true, true);
}
return null;
};
}
});
const PopupInner = defineComponent({
compatConfig: {
MODE: 3
},
name: "PopupInner",
inheritAttrs: false,
props: innerProps,
emits: ["mouseenter", "mouseleave", "mousedown", "touchstart", "align"],
setup: function setup9(props3, _ref) {
var expose = _ref.expose, attrs = _ref.attrs, slots = _ref.slots;
var alignRef = ref();
var elementRef = ref();
var alignedClassName = ref();
var _useStretchStyle = useStretchStyle(toRef(props3, "stretch")), _useStretchStyle2 = _slicedToArray$2(_useStretchStyle, 2), stretchStyle = _useStretchStyle2[0], measureStretchStyle = _useStretchStyle2[1];
var doMeasure = function doMeasure2() {
if (props3.stretch) {
measureStretchStyle(props3.getRootDomNode());
}
};
var visible = ref(false);
var timeoutId;
watch(function() {
return props3.visible;
}, function(val) {
clearTimeout(timeoutId);
if (val) {
timeoutId = setTimeout(function() {
visible.value = props3.visible;
});
} else {
visible.value = false;
}
}, {
immediate: true
});
var _useVisibleStatus = useVisibleStatus(visible, doMeasure), _useVisibleStatus2 = _slicedToArray$2(_useVisibleStatus, 2), status = _useVisibleStatus2[0], goNextStatus = _useVisibleStatus2[1];
var prepareResolveRef = ref();
var getAlignTarget = function getAlignTarget2() {
if (props3.point) {
return props3.point;
}
return props3.getRootDomNode;
};
var forceAlign = function forceAlign2() {
var _alignRef$value;
(_alignRef$value = alignRef.value) === null || _alignRef$value === void 0 ? void 0 : _alignRef$value.forceAlign();
};
var onInternalAlign = function onInternalAlign2(popupDomNode, matchAlign) {
var nextAlignedClassName = props3.getClassNameFromAlign(matchAlign);
var preAlignedClassName = alignedClassName.value;
if (alignedClassName.value !== nextAlignedClassName) {
alignedClassName.value = nextAlignedClassName;
}
if (status.value === "align") {
var _props$onAlign;
if (preAlignedClassName !== nextAlignedClassName) {
Promise.resolve().then(function() {
forceAlign();
});
} else {
goNextStatus(function() {
var _prepareResolveRef$va;
(_prepareResolveRef$va = prepareResolveRef.value) === null || _prepareResolveRef$va === void 0 ? void 0 : _prepareResolveRef$va.call(prepareResolveRef);
});
}
(_props$onAlign = props3.onAlign) === null || _props$onAlign === void 0 ? void 0 : _props$onAlign.call(props3, popupDomNode, matchAlign);
}
};
var motion = computed(function() {
var m2 = _typeof$2(props3.animation) === "object" ? props3.animation : getMotion(props3);
["onAfterEnter", "onAfterLeave"].forEach(function(eventName) {
var originFn = m2[eventName];
m2[eventName] = function(node) {
goNextStatus();
status.value = "stable";
originFn === null || originFn === void 0 ? void 0 : originFn(node);
};
});
return m2;
});
var onShowPrepare = function onShowPrepare2() {
return new Promise(function(resolve) {
prepareResolveRef.value = resolve;
});
};
watch([motion, status], function() {
if (!motion.value && status.value === "motion") {
goNextStatus();
}
}, {
immediate: true
});
expose({
forceAlign,
getElement: function getElement2() {
return elementRef.value.$el || elementRef.value;
}
});
var alignDisabled = computed(function() {
var _props$align;
if ((_props$align = props3.align) !== null && _props$align !== void 0 && _props$align.points && (status.value === "align" || status.value === "stable")) {
return false;
}
return true;
});
return function() {
var _slots$default;
var zIndex = props3.zIndex, align = props3.align, prefixCls = props3.prefixCls, destroyPopupOnHide = props3.destroyPopupOnHide, onMouseenter2 = props3.onMouseenter, onMouseleave2 = props3.onMouseleave, _props$onTouchstart = props3.onTouchstart, onTouchstart2 = _props$onTouchstart === void 0 ? function() {
} : _props$onTouchstart, onMousedown2 = props3.onMousedown;
var statusValue = status.value;
var mergedStyle = [_objectSpread2$1(_objectSpread2$1({}, stretchStyle.value), {}, {
zIndex,
opacity: statusValue === "motion" || statusValue === "stable" || !visible.value ? null : 0,
// pointerEvents: statusValue === 'stable' ? null : 'none',
pointerEvents: !visible.value && statusValue !== "stable" ? "none" : null
}), attrs.style];
var childNode = flattenChildren((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots, {
visible: props3.visible
}));
if (childNode.length > 1) {
childNode = createVNode("div", {
"class": "".concat(prefixCls, "-content")
}, [childNode]);
}
var mergedClassName = classNames(prefixCls, attrs.class, alignedClassName.value);
var hasAnimate = visible.value || !props3.visible;
var transitionProps = hasAnimate ? getTransitionProps(motion.value.name, motion.value) : {};
return createVNode(Transition, _objectSpread2$1(_objectSpread2$1({
"ref": elementRef
}, transitionProps), {}, {
"onBeforeEnter": onShowPrepare
}), {
default: function _default3() {
return !destroyPopupOnHide || props3.visible ? withDirectives(createVNode(Align, {
"target": getAlignTarget(),
"key": "popup",
"ref": alignRef,
"monitorWindowResize": true,
"disabled": alignDisabled.value,
"align": align,
"onAlign": onInternalAlign
}, {
default: function _default4() {
return createVNode("div", _objectSpread2$1(_objectSpread2$1({
"class": mergedClassName,
"onMouseenter": onMouseenter2,
"onMouseleave": onMouseleave2,
"onMousedown": withModifiers(onMousedown2, ["capture"])
}, _defineProperty$q({}, supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart", withModifiers(onTouchstart2, ["capture"]))), {}, {
"style": mergedStyle
}), [childNode]);
}
}), [[vShow, visible.value]]) : null;
}
});
};
}
});
const Popup = defineComponent({
compatConfig: {
MODE: 3
},
name: "Popup",
inheritAttrs: false,
props: popupProps,
setup: function setup10(props3, _ref) {
var attrs = _ref.attrs, slots = _ref.slots, expose = _ref.expose;
var innerVisible = ref(false);
var inMobile = ref(false);
var popupRef = ref();
watch([function() {
return props3.visible;
}, function() {
return props3.mobile;
}], function() {
innerVisible.value = props3.visible;
if (props3.visible && props3.mobile) {
inMobile.value = true;
}
}, {
immediate: true,
flush: "post"
});
expose({
forceAlign: function forceAlign() {
var _popupRef$value;
(_popupRef$value = popupRef.value) === null || _popupRef$value === void 0 ? void 0 : _popupRef$value.forceAlign();
},
getElement: function getElement2() {
var _popupRef$value2;
return (_popupRef$value2 = popupRef.value) === null || _popupRef$value2 === void 0 ? void 0 : _popupRef$value2.getElement();
}
});
return function() {
var cloneProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, props3), attrs), {}, {
visible: innerVisible.value
});
var popupNode = inMobile.value ? createVNode(MobilePopupInner, _objectSpread2$1(_objectSpread2$1({}, cloneProps), {}, {
"mobile": props3.mobile,
"ref": popupRef
}), {
default: slots.default
}) : createVNode(PopupInner, _objectSpread2$1(_objectSpread2$1({}, cloneProps), {}, {
"ref": popupRef
}), {
default: slots.default
});
return createVNode("div", null, [createVNode(Mask$1, cloneProps, null), popupNode]);
};
}
});
function isPointsEq(a1, a2, isAlignPoint) {
if (isAlignPoint) {
return a1[0] === a2[0];
}
return a1[0] === a2[0] && a1[1] === a2[1];
}
function getAlignFromPlacement(builtinPlacements, placementStr, align) {
var baseAlign = builtinPlacements[placementStr] || {};
return _objectSpread2$1(_objectSpread2$1({}, baseAlign), align);
}
function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
var points = align.points;
var placements2 = Object.keys(builtinPlacements);
for (var i2 = 0; i2 < placements2.length; i2 += 1) {
var placement = placements2[i2];
if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {
return "".concat(prefixCls, "-placement-").concat(placement);
}
}
return "";
}
const BaseMixin = {
methods: {
setState: function setState() {
var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
var callback = arguments.length > 1 ? arguments[1] : void 0;
var newState = typeof state === "function" ? state(this.$data, this.$props) : state;
if (this.getDerivedStateFromProps) {
var s2 = this.getDerivedStateFromProps(getOptionProps(this), _objectSpread2$1(_objectSpread2$1({}, this.$data), newState));
if (s2 === null) {
return;
} else {
newState = _objectSpread2$1(_objectSpread2$1({}, newState), s2 || {});
}
}
_extends(this.$data, newState);
if (this._.isMounted) {
this.$forceUpdate();
}
nextTick(function() {
callback && callback();
});
},
__emit: function __emit() {
var args = [].slice.call(arguments, 0);
var eventName = args[0];
eventName = "on".concat(eventName[0].toUpperCase()).concat(eventName.substring(1));
var event = this.$props[eventName] || this.$attrs[eventName];
if (args.length && event) {
if (Array.isArray(event)) {
for (var i2 = 0, l2 = event.length; i2 < l2; i2++) {
event[i2].apply(event, _toConsumableArray(args.slice(1)));
}
} else {
event.apply(void 0, _toConsumableArray(args.slice(1)));
}
}
}
}
};
var TriggerContextKey = Symbol("TriggerContextKey");
var useProviderTrigger = function useProviderTrigger2() {
var portal = null;
provide(TriggerContextKey, {
setPortal: function setPortal(val) {
portal = val;
},
popPortal: true
});
return function() {
return portal;
};
};
var useInjectTrigger = function useInjectTrigger2(tryPopPortal) {
return tryPopPortal ? inject(TriggerContextKey, {
setPortal: function setPortal() {
},
popPortal: false
}) : {
setPortal: function setPortal() {
},
popPortal: false
};
};
var PortalContextKey = Symbol("PortalContextKey");
var useProvidePortal = function useProvidePortal2(instance) {
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
inTriggerContext: true
};
provide(PortalContextKey, {
inTriggerContext: config.inTriggerContext,
shouldRender: computed(function() {
var _ref = instance || {}, sPopupVisible = _ref.sPopupVisible, popupRef = _ref.popupRef, forceRender = _ref.forceRender, autoDestroy = _ref.autoDestroy;
var shouldRender = false;
if (sPopupVisible || popupRef || forceRender) {
shouldRender = true;
}
if (!sPopupVisible && autoDestroy) {
shouldRender = false;
}
return shouldRender;
})
});
};
var useInjectPortal = function useInjectPortal2() {
useProvidePortal({}, {
inTriggerContext: false
});
var portalContext = inject(PortalContextKey, {
shouldRender: computed(function() {
return false;
}),
inTriggerContext: false
});
return {
shouldRender: computed(function() {
return portalContext.shouldRender.value || portalContext.inTriggerContext === false;
})
};
};
const Portal$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Portal",
inheritAttrs: false,
props: {
getContainer: PropTypes$1.func.isRequired,
didUpdate: Function
},
setup: function setup11(props3, _ref) {
var slots = _ref.slots;
var isSSR = true;
var container;
var _useInjectPortal = useInjectPortal(), shouldRender = _useInjectPortal.shouldRender;
onBeforeMount(function() {
isSSR = false;
if (shouldRender.value) {
container = props3.getContainer();
}
});
var stopWatch = watch(shouldRender, function() {
if (shouldRender.value && !container) {
container = props3.getContainer();
}
if (container) {
stopWatch();
}
});
onUpdated(function() {
nextTick(function() {
if (shouldRender.value) {
var _props$didUpdate;
(_props$didUpdate = props3.didUpdate) === null || _props$didUpdate === void 0 ? void 0 : _props$didUpdate.call(props3, props3);
}
});
});
onBeforeUnmount(function() {
if (container && container.parentNode) {
container.parentNode.removeChild(container);
}
});
return function() {
if (!shouldRender.value)
return null;
if (isSSR) {
var _slots$default;
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
}
return container ? createVNode(Teleport, {
"to": container
}, slots) : null;
};
}
});
function noop$2() {
}
function returnEmptyString() {
return "";
}
function returnDocument(element) {
if (element) {
return element.ownerDocument;
}
return window.document;
}
var ALL_HANDLERS = ["onClick", "onMousedown", "onTouchstart", "onMouseenter", "onMouseleave", "onFocus", "onBlur", "onContextmenu"];
const Trigger = defineComponent({
compatConfig: {
MODE: 3
},
name: "Trigger",
mixins: [BaseMixin],
inheritAttrs: false,
props: {
action: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.arrayOf(PropTypes$1.string)]).def([]),
showAction: PropTypes$1.any.def([]),
hideAction: PropTypes$1.any.def([]),
getPopupClassNameFromAlign: PropTypes$1.any.def(returnEmptyString),
onPopupVisibleChange: Function,
afterPopupVisibleChange: PropTypes$1.func.def(noop$2),
popup: PropTypes$1.any,
popupStyle: {
type: Object,
default: void 0
},
prefixCls: PropTypes$1.string.def("rc-trigger-popup"),
popupClassName: PropTypes$1.string.def(""),
popupPlacement: String,
builtinPlacements: PropTypes$1.object,
popupTransitionName: String,
popupAnimation: PropTypes$1.any,
mouseEnterDelay: PropTypes$1.number.def(0),
mouseLeaveDelay: PropTypes$1.number.def(0.1),
zIndex: Number,
focusDelay: PropTypes$1.number.def(0),
blurDelay: PropTypes$1.number.def(0.15),
getPopupContainer: Function,
getDocument: PropTypes$1.func.def(returnDocument),
forceRender: {
type: Boolean,
default: void 0
},
destroyPopupOnHide: {
type: Boolean,
default: false
},
mask: {
type: Boolean,
default: false
},
maskClosable: {
type: Boolean,
default: true
},
// onPopupAlign: PropTypes.func.def(noop),
popupAlign: PropTypes$1.object.def(function() {
return {};
}),
popupVisible: {
type: Boolean,
default: void 0
},
defaultPopupVisible: {
type: Boolean,
default: false
},
maskTransitionName: String,
maskAnimation: String,
stretch: String,
alignPoint: {
type: Boolean,
default: void 0
},
autoDestroy: {
type: Boolean,
default: false
},
mobile: Object,
getTriggerDOMNode: Function,
// portal context will change
tryPopPortal: Boolean
// no need reactive
},
setup: function setup12(props3) {
var align = computed(function() {
var popupPlacement = props3.popupPlacement, popupAlign = props3.popupAlign, builtinPlacements = props3.builtinPlacements;
if (popupPlacement && builtinPlacements) {
return getAlignFromPlacement(builtinPlacements, popupPlacement, popupAlign);
}
return popupAlign;
});
var _useInjectTrigger = useInjectTrigger(props3.tryPopPortal), setPortal = _useInjectTrigger.setPortal, popPortal = _useInjectTrigger.popPortal;
var popupRef = ref(null);
var setPopupRef = function setPopupRef2(val) {
popupRef.value = val;
};
return {
popPortal,
setPortal,
vcTriggerContext: inject("vcTriggerContext", {}),
popupRef,
setPopupRef,
triggerRef: ref(null),
align,
focusTime: null,
clickOutsideHandler: null,
contextmenuOutsideHandler1: null,
contextmenuOutsideHandler2: null,
touchOutsideHandler: null,
attachId: null,
delayTimer: null,
hasPopupMouseDown: false,
preClickTime: null,
preTouchTime: null,
mouseDownTimeout: null,
childOriginEvents: {}
};
},
data: function data() {
var _this = this, _this$setPortal;
var props3 = this.$props;
var popupVisible2;
if (this.popupVisible !== void 0) {
popupVisible2 = !!props3.popupVisible;
} else {
popupVisible2 = !!props3.defaultPopupVisible;
}
ALL_HANDLERS.forEach(function(h2) {
_this["fire".concat(h2)] = function(e2) {
_this.fireEvents(h2, e2);
};
});
(_this$setPortal = this.setPortal) === null || _this$setPortal === void 0 ? void 0 : _this$setPortal.call(this, createVNode(Portal$1, {
"key": "portal",
"getContainer": this.getContainer,
"didUpdate": this.handlePortalUpdate
}, {
default: this.getComponent
}));
return {
prevPopupVisible: popupVisible2,
sPopupVisible: popupVisible2,
point: null
};
},
watch: {
popupVisible: function popupVisible(val) {
if (val !== void 0) {
this.prevPopupVisible = this.sPopupVisible;
this.sPopupVisible = val;
}
}
},
created: function created() {
provide("vcTriggerContext", {
onPopupMouseDown: this.onPopupMouseDown
});
useProvidePortal(this);
},
deactivated: function deactivated() {
this.setPopupVisible(false);
},
mounted: function mounted() {
var _this2 = this;
this.$nextTick(function() {
_this2.updatedCal();
});
},
updated: function updated() {
var _this3 = this;
this.$nextTick(function() {
_this3.updatedCal();
});
},
beforeUnmount: function beforeUnmount() {
this.clearDelayTimer();
this.clearOutsideHandler();
clearTimeout(this.mouseDownTimeout);
wrapperRaf.cancel(this.attachId);
},
methods: {
updatedCal: function updatedCal() {
var props3 = this.$props;
var state = this.$data;
if (state.sPopupVisible) {
var currentDocument;
if (!this.clickOutsideHandler && (this.isClickToHide() || this.isContextmenuToShow())) {
currentDocument = props3.getDocument(this.getRootDomNode());
this.clickOutsideHandler = addEventListenerWrap(currentDocument, "mousedown", this.onDocumentClick);
}
if (!this.touchOutsideHandler) {
currentDocument = currentDocument || props3.getDocument(this.getRootDomNode());
this.touchOutsideHandler = addEventListenerWrap(currentDocument, "touchstart", this.onDocumentClick, supportsPassive$1 ? {
passive: false
} : false);
}
if (!this.contextmenuOutsideHandler1 && this.isContextmenuToShow()) {
currentDocument = currentDocument || props3.getDocument(this.getRootDomNode());
this.contextmenuOutsideHandler1 = addEventListenerWrap(currentDocument, "scroll", this.onContextmenuClose);
}
if (!this.contextmenuOutsideHandler2 && this.isContextmenuToShow()) {
this.contextmenuOutsideHandler2 = addEventListenerWrap(window, "blur", this.onContextmenuClose);
}
} else {
this.clearOutsideHandler();
}
},
onMouseenter: function onMouseenter(e2) {
var mouseEnterDelay = this.$props.mouseEnterDelay;
this.fireEvents("onMouseenter", e2);
this.delaySetPopupVisible(true, mouseEnterDelay, mouseEnterDelay ? null : e2);
},
onMouseMove: function onMouseMove(e2) {
this.fireEvents("onMousemove", e2);
this.setPoint(e2);
},
onMouseleave: function onMouseleave(e2) {
this.fireEvents("onMouseleave", e2);
this.delaySetPopupVisible(false, this.$props.mouseLeaveDelay);
},
onPopupMouseenter: function onPopupMouseenter() {
this.clearDelayTimer();
},
onPopupMouseleave: function onPopupMouseleave(e2) {
var _this$popupRef;
if (e2 && e2.relatedTarget && !e2.relatedTarget.setTimeout && contains((_this$popupRef = this.popupRef) === null || _this$popupRef === void 0 ? void 0 : _this$popupRef.getElement(), e2.relatedTarget)) {
return;
}
this.delaySetPopupVisible(false, this.$props.mouseLeaveDelay);
},
onFocus: function onFocus(e2) {
this.fireEvents("onFocus", e2);
this.clearDelayTimer();
if (this.isFocusToShow()) {
this.focusTime = Date.now();
this.delaySetPopupVisible(true, this.$props.focusDelay);
}
},
onMousedown: function onMousedown(e2) {
this.fireEvents("onMousedown", e2);
this.preClickTime = Date.now();
},
onTouchstart: function onTouchstart(e2) {
this.fireEvents("onTouchstart", e2);
this.preTouchTime = Date.now();
},
onBlur: function onBlur(e2) {
if (!contains(e2.target, e2.relatedTarget || document.activeElement)) {
this.fireEvents("onBlur", e2);
this.clearDelayTimer();
if (this.isBlurToHide()) {
this.delaySetPopupVisible(false, this.$props.blurDelay);
}
}
},
onContextmenu: function onContextmenu(e2) {
e2.preventDefault();
this.fireEvents("onContextmenu", e2);
this.setPopupVisible(true, e2);
},
onContextmenuClose: function onContextmenuClose() {
if (this.isContextmenuToShow()) {
this.close();
}
},
onClick: function onClick(event) {
this.fireEvents("onClick", event);
if (this.focusTime) {
var preTime;
if (this.preClickTime && this.preTouchTime) {
preTime = Math.min(this.preClickTime, this.preTouchTime);
} else if (this.preClickTime) {
preTime = this.preClickTime;
} else if (this.preTouchTime) {
preTime = this.preTouchTime;
}
if (Math.abs(preTime - this.focusTime) < 20) {
return;
}
this.focusTime = 0;
}
this.preClickTime = 0;
this.preTouchTime = 0;
if (this.isClickToShow() && (this.isClickToHide() || this.isBlurToHide()) && event && event.preventDefault) {
event.preventDefault();
}
if (event && event.domEvent) {
event.domEvent.preventDefault();
}
var nextVisible = !this.$data.sPopupVisible;
if (this.isClickToHide() && !nextVisible || nextVisible && this.isClickToShow()) {
this.setPopupVisible(!this.$data.sPopupVisible, event);
}
},
onPopupMouseDown: function onPopupMouseDown() {
var _this4 = this;
var _this$vcTriggerContex = this.vcTriggerContext, vcTriggerContext = _this$vcTriggerContex === void 0 ? {} : _this$vcTriggerContex;
this.hasPopupMouseDown = true;
clearTimeout(this.mouseDownTimeout);
this.mouseDownTimeout = setTimeout(function() {
_this4.hasPopupMouseDown = false;
}, 0);
if (vcTriggerContext.onPopupMouseDown) {
vcTriggerContext.onPopupMouseDown.apply(vcTriggerContext, arguments);
}
},
onDocumentClick: function onDocumentClick(event) {
if (this.$props.mask && !this.$props.maskClosable) {
return;
}
var target = event.target;
var root2 = this.getRootDomNode();
var popupNode = this.getPopupDomNode();
if (
// mousedown on the target should also close popup when action is contextMenu.
// https://github.com/ant-design/ant-design/issues/29853
(!contains(root2, target) || this.isContextMenuOnly()) && !contains(popupNode, target) && !this.hasPopupMouseDown
) {
this.delaySetPopupVisible(false, 0.1);
}
},
getPopupDomNode: function getPopupDomNode() {
var _this$popupRef2;
return ((_this$popupRef2 = this.popupRef) === null || _this$popupRef2 === void 0 ? void 0 : _this$popupRef2.getElement()) || null;
},
getRootDomNode: function getRootDomNode() {
var getTriggerDOMNode = this.$props.getTriggerDOMNode;
if (getTriggerDOMNode) {
var domNode = findDOMNode(this.triggerRef);
return findDOMNode(getTriggerDOMNode(domNode));
}
try {
var _domNode = findDOMNode(this.triggerRef);
if (_domNode) {
return _domNode;
}
} catch (err) {
}
return findDOMNode(this);
},
handleGetPopupClassFromAlign: function handleGetPopupClassFromAlign(align) {
var className = [];
var props3 = this.$props;
var popupPlacement = props3.popupPlacement, builtinPlacements = props3.builtinPlacements, prefixCls = props3.prefixCls, alignPoint2 = props3.alignPoint, getPopupClassNameFromAlign = props3.getPopupClassNameFromAlign;
if (popupPlacement && builtinPlacements) {
className.push(getAlignPopupClassName(builtinPlacements, prefixCls, align, alignPoint2));
}
if (getPopupClassNameFromAlign) {
className.push(getPopupClassNameFromAlign(align));
}
return className.join(" ");
},
getPopupAlign: function getPopupAlign() {
var props3 = this.$props;
var popupPlacement = props3.popupPlacement, popupAlign = props3.popupAlign, builtinPlacements = props3.builtinPlacements;
if (popupPlacement && builtinPlacements) {
return getAlignFromPlacement(builtinPlacements, popupPlacement, popupAlign);
}
return popupAlign;
},
getComponent: function getComponent$1() {
var _this5 = this;
var mouseProps = {};
if (this.isMouseEnterToShow()) {
mouseProps.onMouseenter = this.onPopupMouseenter;
}
if (this.isMouseLeaveToHide()) {
mouseProps.onMouseleave = this.onPopupMouseleave;
}
mouseProps.onMousedown = this.onPopupMouseDown;
mouseProps[supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart"] = this.onPopupMouseDown;
var handleGetPopupClassFromAlign2 = this.handleGetPopupClassFromAlign, getRootDomNode2 = this.getRootDomNode, getContainer4 = this.getContainer, $attrs = this.$attrs;
var _this$$props = this.$props, prefixCls = _this$$props.prefixCls, destroyPopupOnHide = _this$$props.destroyPopupOnHide, popupClassName = _this$$props.popupClassName, popupAnimation = _this$$props.popupAnimation, popupTransitionName = _this$$props.popupTransitionName, popupStyle = _this$$props.popupStyle, mask = _this$$props.mask, maskAnimation = _this$$props.maskAnimation, maskTransitionName = _this$$props.maskTransitionName, zIndex = _this$$props.zIndex, stretch = _this$$props.stretch, alignPoint2 = _this$$props.alignPoint, mobile = _this$$props.mobile, forceRender = _this$$props.forceRender;
var _this$$data = this.$data, sPopupVisible = _this$$data.sPopupVisible, point = _this$$data.point;
var popupProps2 = _objectSpread2$1(_objectSpread2$1({
prefixCls,
destroyPopupOnHide,
visible: sPopupVisible,
point: alignPoint2 ? point : null,
align: this.align,
animation: popupAnimation,
getClassNameFromAlign: handleGetPopupClassFromAlign2,
stretch,
getRootDomNode: getRootDomNode2,
mask,
zIndex,
transitionName: popupTransitionName,
maskAnimation,
maskTransitionName,
getContainer: getContainer4,
class: popupClassName,
style: popupStyle,
onAlign: $attrs.onPopupAlign || noop$2
}, mouseProps), {}, {
ref: this.setPopupRef,
mobile,
forceRender
});
return createVNode(Popup, popupProps2, {
default: this.$slots.popup || function() {
return getComponent(_this5, "popup");
}
});
},
attachParent: function attachParent(popupContainer) {
var _this6 = this;
wrapperRaf.cancel(this.attachId);
var _this$$props2 = this.$props, getPopupContainer = _this$$props2.getPopupContainer, getDocument2 = _this$$props2.getDocument;
var domNode = this.getRootDomNode();
var mountNode;
if (!getPopupContainer) {
mountNode = getDocument2(this.getRootDomNode()).body;
} else if (domNode || getPopupContainer.length === 0) {
mountNode = getPopupContainer(domNode);
}
if (mountNode) {
mountNode.appendChild(popupContainer);
} else {
this.attachId = wrapperRaf(function() {
_this6.attachParent(popupContainer);
});
}
},
getContainer: function getContainer3() {
var props3 = this.$props;
var getDocument2 = props3.getDocument;
var popupContainer = getDocument2(this.getRootDomNode()).createElement("div");
popupContainer.style.position = "absolute";
popupContainer.style.top = "0";
popupContainer.style.left = "0";
popupContainer.style.width = "100%";
this.attachParent(popupContainer);
return popupContainer;
},
setPopupVisible: function setPopupVisible(sPopupVisible, event) {
var alignPoint2 = this.alignPoint, prevPopupVisible = this.sPopupVisible, onPopupVisibleChange = this.onPopupVisibleChange;
this.clearDelayTimer();
if (prevPopupVisible !== sPopupVisible) {
if (!hasProp(this, "popupVisible")) {
this.setState({
sPopupVisible,
prevPopupVisible
});
}
onPopupVisibleChange && onPopupVisibleChange(sPopupVisible);
}
if (alignPoint2 && event && sPopupVisible) {
this.setPoint(event);
}
},
setPoint: function setPoint(point) {
var alignPoint2 = this.$props.alignPoint;
if (!alignPoint2 || !point)
return;
this.setState({
point: {
pageX: point.pageX,
pageY: point.pageY
}
});
},
handlePortalUpdate: function handlePortalUpdate() {
if (this.prevPopupVisible !== this.sPopupVisible) {
this.afterPopupVisibleChange(this.sPopupVisible);
}
},
delaySetPopupVisible: function delaySetPopupVisible(visible, delayS, event) {
var _this7 = this;
var delay = delayS * 1e3;
this.clearDelayTimer();
if (delay) {
var point = event ? {
pageX: event.pageX,
pageY: event.pageY
} : null;
this.delayTimer = requestAnimationTimeout(function() {
_this7.setPopupVisible(visible, point);
_this7.clearDelayTimer();
}, delay);
} else {
this.setPopupVisible(visible, event);
}
},
clearDelayTimer: function clearDelayTimer() {
if (this.delayTimer) {
cancelAnimationTimeout(this.delayTimer);
this.delayTimer = null;
}
},
clearOutsideHandler: function clearOutsideHandler() {
if (this.clickOutsideHandler) {
this.clickOutsideHandler.remove();
this.clickOutsideHandler = null;
}
if (this.contextmenuOutsideHandler1) {
this.contextmenuOutsideHandler1.remove();
this.contextmenuOutsideHandler1 = null;
}
if (this.contextmenuOutsideHandler2) {
this.contextmenuOutsideHandler2.remove();
this.contextmenuOutsideHandler2 = null;
}
if (this.touchOutsideHandler) {
this.touchOutsideHandler.remove();
this.touchOutsideHandler = null;
}
},
createTwoChains: function createTwoChains(event) {
var fn = function fn2() {
};
var events = getEvents(this);
if (this.childOriginEvents[event] && events[event]) {
return this["fire".concat(event)];
}
fn = this.childOriginEvents[event] || events[event] || fn;
return fn;
},
isClickToShow: function isClickToShow() {
var _this$$props3 = this.$props, action = _this$$props3.action, showAction = _this$$props3.showAction;
return action.indexOf("click") !== -1 || showAction.indexOf("click") !== -1;
},
isContextMenuOnly: function isContextMenuOnly() {
var action = this.$props.action;
return action === "contextmenu" || action.length === 1 && action[0] === "contextmenu";
},
isContextmenuToShow: function isContextmenuToShow() {
var _this$$props4 = this.$props, action = _this$$props4.action, showAction = _this$$props4.showAction;
return action.indexOf("contextmenu") !== -1 || showAction.indexOf("contextmenu") !== -1;
},
isClickToHide: function isClickToHide() {
var _this$$props5 = this.$props, action = _this$$props5.action, hideAction = _this$$props5.hideAction;
return action.indexOf("click") !== -1 || hideAction.indexOf("click") !== -1;
},
isMouseEnterToShow: function isMouseEnterToShow() {
var _this$$props6 = this.$props, action = _this$$props6.action, showAction = _this$$props6.showAction;
return action.indexOf("hover") !== -1 || showAction.indexOf("mouseenter") !== -1;
},
isMouseLeaveToHide: function isMouseLeaveToHide() {
var _this$$props7 = this.$props, action = _this$$props7.action, hideAction = _this$$props7.hideAction;
return action.indexOf("hover") !== -1 || hideAction.indexOf("mouseleave") !== -1;
},
isFocusToShow: function isFocusToShow() {
var _this$$props8 = this.$props, action = _this$$props8.action, showAction = _this$$props8.showAction;
return action.indexOf("focus") !== -1 || showAction.indexOf("focus") !== -1;
},
isBlurToHide: function isBlurToHide() {
var _this$$props9 = this.$props, action = _this$$props9.action, hideAction = _this$$props9.hideAction;
return action.indexOf("focus") !== -1 || hideAction.indexOf("blur") !== -1;
},
forcePopupAlign: function forcePopupAlign() {
if (this.$data.sPopupVisible) {
var _this$popupRef3;
(_this$popupRef3 = this.popupRef) === null || _this$popupRef3 === void 0 ? void 0 : _this$popupRef3.forceAlign();
}
},
fireEvents: function fireEvents(type, e2) {
if (this.childOriginEvents[type]) {
this.childOriginEvents[type](e2);
}
var event = this.$props[type] || this.$attrs[type];
if (event) {
event(e2);
}
},
close: function close2() {
this.setPopupVisible(false);
}
},
render: function render2() {
var _this8 = this;
var $attrs = this.$attrs;
var children = filterEmpty(getSlot(this));
var alignPoint2 = this.$props.alignPoint;
var child = children[0];
this.childOriginEvents = getEvents(child);
var newChildProps = {
key: "trigger"
};
if (this.isContextmenuToShow()) {
newChildProps.onContextmenu = this.onContextmenu;
} else {
newChildProps.onContextmenu = this.createTwoChains("onContextmenu");
}
if (this.isClickToHide() || this.isClickToShow()) {
newChildProps.onClick = this.onClick;
newChildProps.onMousedown = this.onMousedown;
newChildProps[supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart"] = this.onTouchstart;
} else {
newChildProps.onClick = this.createTwoChains("onClick");
newChildProps.onMousedown = this.createTwoChains("onMousedown");
newChildProps[supportsPassive$1 ? "onTouchstartPassive" : "onTouchstart"] = this.createTwoChains("onTouchstart");
}
if (this.isMouseEnterToShow()) {
newChildProps.onMouseenter = this.onMouseenter;
if (alignPoint2) {
newChildProps.onMousemove = this.onMouseMove;
}
} else {
newChildProps.onMouseenter = this.createTwoChains("onMouseenter");
}
if (this.isMouseLeaveToHide()) {
newChildProps.onMouseleave = this.onMouseleave;
} else {
newChildProps.onMouseleave = this.createTwoChains("onMouseleave");
}
if (this.isFocusToShow() || this.isBlurToHide()) {
newChildProps.onFocus = this.onFocus;
newChildProps.onBlur = this.onBlur;
} else {
newChildProps.onFocus = this.createTwoChains("onFocus");
newChildProps.onBlur = function(e2) {
if (e2 && (!e2.relatedTarget || !contains(e2.target, e2.relatedTarget))) {
_this8.createTwoChains("onBlur")(e2);
}
};
}
var childrenClassName = classNames(child && child.props && child.props.class, $attrs.class);
if (childrenClassName) {
newChildProps.class = childrenClassName;
}
var trigger2 = cloneElement(child, _objectSpread2$1(_objectSpread2$1({}, newChildProps), {}, {
ref: "triggerRef"
}), true, true);
if (this.popPortal) {
return trigger2;
} else {
var portal = createVNode(Portal$1, {
"key": "portal",
"getContainer": this.getContainer,
"didUpdate": this.handlePortalUpdate
}, {
default: this.getComponent
});
return createVNode(Fragment, null, [portal, trigger2]);
}
}
});
var _excluded$o = ["empty"];
var getBuiltInPlacements = function getBuiltInPlacements2(dropdownMatchSelectWidth) {
var adjustX = dropdownMatchSelectWidth === true ? 0 : 1;
return {
bottomLeft: {
points: ["tl", "bl"],
offset: [0, 4],
overflow: {
adjustX,
adjustY: 1
}
},
bottomRight: {
points: ["tr", "br"],
offset: [0, 4],
overflow: {
adjustX,
adjustY: 1
}
},
topLeft: {
points: ["bl", "tl"],
offset: [0, -4],
overflow: {
adjustX,
adjustY: 1
}
},
topRight: {
points: ["br", "tr"],
offset: [0, -4],
overflow: {
adjustX,
adjustY: 1
}
}
};
};
var SelectTrigger = defineComponent({
name: "SelectTrigger",
inheritAttrs: false,
props: {
dropdownAlign: Object,
visible: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
dropdownClassName: String,
dropdownStyle: PropTypes$1.object,
placement: String,
empty: {
type: Boolean,
default: void 0
},
prefixCls: String,
popupClassName: String,
animation: String,
transitionName: String,
getPopupContainer: Function,
dropdownRender: Function,
containerWidth: Number,
dropdownMatchSelectWidth: PropTypes$1.oneOfType([Number, Boolean]).def(true),
popupElement: PropTypes$1.any,
direction: String,
getTriggerDOMNode: Function,
onPopupVisibleChange: Function,
onPopupMouseEnter: Function
},
setup: function setup13(props3, _ref) {
var slots = _ref.slots, attrs = _ref.attrs, expose = _ref.expose;
var builtInPlacements = computed(function() {
var dropdownMatchSelectWidth = props3.dropdownMatchSelectWidth;
return getBuiltInPlacements(dropdownMatchSelectWidth);
});
var popupRef = ref();
expose({
getPopupElement: function getPopupElement() {
return popupRef.value;
}
});
return function() {
var _props$attrs = _objectSpread2$1(_objectSpread2$1({}, props3), attrs), _props$attrs$empty = _props$attrs.empty, empty = _props$attrs$empty === void 0 ? false : _props$attrs$empty, restProps = _objectWithoutProperties$2(_props$attrs, _excluded$o);
var visible = restProps.visible, dropdownAlign = restProps.dropdownAlign, prefixCls = restProps.prefixCls, popupElement = restProps.popupElement, dropdownClassName = restProps.dropdownClassName, dropdownStyle = restProps.dropdownStyle, _restProps$direction = restProps.direction, direction = _restProps$direction === void 0 ? "ltr" : _restProps$direction, placement = restProps.placement, dropdownMatchSelectWidth = restProps.dropdownMatchSelectWidth, containerWidth = restProps.containerWidth, dropdownRender = restProps.dropdownRender, animation = restProps.animation, transitionName2 = restProps.transitionName, getPopupContainer = restProps.getPopupContainer, getTriggerDOMNode = restProps.getTriggerDOMNode, onPopupVisibleChange = restProps.onPopupVisibleChange, onPopupMouseEnter = restProps.onPopupMouseEnter;
var dropdownPrefixCls = "".concat(prefixCls, "-dropdown");
var popupNode = popupElement;
if (dropdownRender) {
popupNode = dropdownRender({
menuNode: popupElement,
props: props3
});
}
var mergedTransitionName = animation ? "".concat(dropdownPrefixCls, "-").concat(animation) : transitionName2;
var popupStyle = _objectSpread2$1({
minWidth: "".concat(containerWidth, "px")
}, dropdownStyle);
if (typeof dropdownMatchSelectWidth === "number") {
popupStyle.width = "".concat(dropdownMatchSelectWidth, "px");
} else if (dropdownMatchSelectWidth) {
popupStyle.width = "".concat(containerWidth, "px");
}
return createVNode(Trigger, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"showAction": onPopupVisibleChange ? ["click"] : [],
"hideAction": onPopupVisibleChange ? ["click"] : [],
"popupPlacement": placement || (direction === "rtl" ? "bottomRight" : "bottomLeft"),
"builtinPlacements": builtInPlacements.value,
"prefixCls": dropdownPrefixCls,
"popupTransitionName": mergedTransitionName,
"popupAlign": dropdownAlign,
"popupVisible": visible,
"getPopupContainer": getPopupContainer,
"popupClassName": classNames(dropdownClassName, _defineProperty$q({}, "".concat(dropdownPrefixCls, "-empty"), empty)),
"popupStyle": popupStyle,
"getTriggerDOMNode": getTriggerDOMNode,
"onPopupVisibleChange": onPopupVisibleChange
}), {
default: slots.default,
popup: function popup() {
return createVNode("div", {
"ref": popupRef,
"onMouseenter": onPopupMouseEnter
}, [popupNode]);
}
});
};
}
});
const SelectTrigger$1 = SelectTrigger;
var KeyCode = {
/**
* MAC_ENTER
*/
MAC_ENTER: 3,
/**
* BACKSPACE
*/
BACKSPACE: 8,
/**
* TAB
*/
TAB: 9,
/**
* NUMLOCK on FF/Safari Mac
*/
NUM_CENTER: 12,
/**
* ENTER
*/
ENTER: 13,
/**
* SHIFT
*/
SHIFT: 16,
/**
* CTRL
*/
CTRL: 17,
/**
* ALT
*/
ALT: 18,
/**
* PAUSE
*/
PAUSE: 19,
/**
* CAPS_LOCK
*/
CAPS_LOCK: 20,
/**
* ESC
*/
ESC: 27,
/**
* SPACE
*/
SPACE: 32,
/**
* PAGE_UP
*/
PAGE_UP: 33,
/**
* PAGE_DOWN
*/
PAGE_DOWN: 34,
/**
* END
*/
END: 35,
/**
* HOME
*/
HOME: 36,
/**
* LEFT
*/
LEFT: 37,
/**
* UP
*/
UP: 38,
/**
* RIGHT
*/
RIGHT: 39,
/**
* DOWN
*/
DOWN: 40,
/**
* PRINT_SCREEN
*/
PRINT_SCREEN: 44,
/**
* INSERT
*/
INSERT: 45,
/**
* DELETE
*/
DELETE: 46,
/**
* ZERO
*/
ZERO: 48,
/**
* ONE
*/
ONE: 49,
/**
* TWO
*/
TWO: 50,
/**
* THREE
*/
THREE: 51,
/**
* FOUR
*/
FOUR: 52,
/**
* FIVE
*/
FIVE: 53,
/**
* SIX
*/
SIX: 54,
/**
* SEVEN
*/
SEVEN: 55,
/**
* EIGHT
*/
EIGHT: 56,
/**
* NINE
*/
NINE: 57,
/**
* QUESTION_MARK
*/
QUESTION_MARK: 63,
/**
* A
*/
A: 65,
/**
* B
*/
B: 66,
/**
* C
*/
C: 67,
/**
* D
*/
D: 68,
/**
* E
*/
E: 69,
/**
* F
*/
F: 70,
/**
* G
*/
G: 71,
/**
* H
*/
H: 72,
/**
* I
*/
I: 73,
/**
* J
*/
J: 74,
/**
* K
*/
K: 75,
/**
* L
*/
L: 76,
/**
* M
*/
M: 77,
/**
* N
*/
N: 78,
/**
* O
*/
O: 79,
/**
* P
*/
P: 80,
/**
* Q
*/
Q: 81,
/**
* R
*/
R: 82,
/**
* S
*/
S: 83,
/**
* T
*/
T: 84,
/**
* U
*/
U: 85,
/**
* V
*/
V: 86,
/**
* W
*/
W: 87,
/**
* X
*/
X: 88,
/**
* Y
*/
Y: 89,
/**
* Z
*/
Z: 90,
/**
* META
*/
META: 91,
/**
* WIN_KEY_RIGHT
*/
WIN_KEY_RIGHT: 92,
/**
* CONTEXT_MENU
*/
CONTEXT_MENU: 93,
/**
* NUM_ZERO
*/
NUM_ZERO: 96,
/**
* NUM_ONE
*/
NUM_ONE: 97,
/**
* NUM_TWO
*/
NUM_TWO: 98,
/**
* NUM_THREE
*/
NUM_THREE: 99,
/**
* NUM_FOUR
*/
NUM_FOUR: 100,
/**
* NUM_FIVE
*/
NUM_FIVE: 101,
/**
* NUM_SIX
*/
NUM_SIX: 102,
/**
* NUM_SEVEN
*/
NUM_SEVEN: 103,
/**
* NUM_EIGHT
*/
NUM_EIGHT: 104,
/**
* NUM_NINE
*/
NUM_NINE: 105,
/**
* NUM_MULTIPLY
*/
NUM_MULTIPLY: 106,
/**
* NUM_PLUS
*/
NUM_PLUS: 107,
/**
* NUM_MINUS
*/
NUM_MINUS: 109,
/**
* NUM_PERIOD
*/
NUM_PERIOD: 110,
/**
* NUM_DIVISION
*/
NUM_DIVISION: 111,
/**
* F1
*/
F1: 112,
/**
* F2
*/
F2: 113,
/**
* F3
*/
F3: 114,
/**
* F4
*/
F4: 115,
/**
* F5
*/
F5: 116,
/**
* F6
*/
F6: 117,
/**
* F7
*/
F7: 118,
/**
* F8
*/
F8: 119,
/**
* F9
*/
F9: 120,
/**
* F10
*/
F10: 121,
/**
* F11
*/
F11: 122,
/**
* F12
*/
F12: 123,
/**
* NUMLOCK
*/
NUMLOCK: 144,
/**
* SEMICOLON
*/
SEMICOLON: 186,
/**
* DASH
*/
DASH: 189,
/**
* EQUALS
*/
EQUALS: 187,
/**
* COMMA
*/
COMMA: 188,
/**
* PERIOD
*/
PERIOD: 190,
/**
* SLASH
*/
SLASH: 191,
/**
* APOSTROPHE
*/
APOSTROPHE: 192,
/**
* SINGLE_QUOTE
*/
SINGLE_QUOTE: 222,
/**
* OPEN_SQUARE_BRACKET
*/
OPEN_SQUARE_BRACKET: 219,
/**
* BACKSLASH
*/
BACKSLASH: 220,
/**
* CLOSE_SQUARE_BRACKET
*/
CLOSE_SQUARE_BRACKET: 221,
/**
* WIN_KEY
*/
WIN_KEY: 224,
/**
* MAC_FF_META
*/
MAC_FF_META: 224,
/**
* WIN_IME
*/
WIN_IME: 229,
// ======================== Function ========================
/**
* whether text and modified key is entered at the same time.
*/
isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e2) {
var keyCode = e2.keyCode;
if (e2.altKey && !e2.ctrlKey || e2.metaKey || // Function keys don't generate text
keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
return false;
}
switch (keyCode) {
case KeyCode.ALT:
case KeyCode.CAPS_LOCK:
case KeyCode.CONTEXT_MENU:
case KeyCode.CTRL:
case KeyCode.DOWN:
case KeyCode.END:
case KeyCode.ESC:
case KeyCode.HOME:
case KeyCode.INSERT:
case KeyCode.LEFT:
case KeyCode.MAC_FF_META:
case KeyCode.META:
case KeyCode.NUMLOCK:
case KeyCode.NUM_CENTER:
case KeyCode.PAGE_DOWN:
case KeyCode.PAGE_UP:
case KeyCode.PAUSE:
case KeyCode.PRINT_SCREEN:
case KeyCode.RIGHT:
case KeyCode.SHIFT:
case KeyCode.UP:
case KeyCode.WIN_KEY:
case KeyCode.WIN_KEY_RIGHT:
return false;
default:
return true;
}
},
/**
* whether character is entered.
*/
isCharacterKey: function isCharacterKey(keyCode) {
if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
return true;
}
if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
return true;
}
if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
return true;
}
if (window.navigator.userAgent.indexOf("WebKit") !== -1 && keyCode === 0) {
return true;
}
switch (keyCode) {
case KeyCode.SPACE:
case KeyCode.QUESTION_MARK:
case KeyCode.NUM_PLUS:
case KeyCode.NUM_MINUS:
case KeyCode.NUM_PERIOD:
case KeyCode.NUM_DIVISION:
case KeyCode.SEMICOLON:
case KeyCode.DASH:
case KeyCode.EQUALS:
case KeyCode.COMMA:
case KeyCode.PERIOD:
case KeyCode.SLASH:
case KeyCode.APOSTROPHE:
case KeyCode.SINGLE_QUOTE:
case KeyCode.OPEN_SQUARE_BRACKET:
case KeyCode.BACKSLASH:
case KeyCode.CLOSE_SQUARE_BRACKET:
return true;
default:
return false;
}
}
};
const KeyCode$1 = KeyCode;
var TransBtn = function TransBtn2(props3, _ref) {
var _slots$default;
var slots = _ref.slots;
var className = props3.class, customizeIcon = props3.customizeIcon, customizeIconProps = props3.customizeIconProps, _onMousedown = props3.onMousedown, onClick2 = props3.onClick;
var icon;
if (typeof customizeIcon === "function") {
icon = customizeIcon(customizeIconProps);
} else {
icon = customizeIcon;
}
return createVNode("span", {
"class": className,
"onMousedown": function onMousedown2(event) {
event.preventDefault();
if (_onMousedown) {
_onMousedown(event);
}
},
"style": {
userSelect: "none",
WebkitUserSelect: "none"
},
"unselectable": "on",
"onClick": onClick2,
"aria-hidden": true
}, [icon !== void 0 ? icon : createVNode("span", {
"class": className.split(/\s+/).map(function(cls) {
return "".concat(cls, "-icon");
})
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)])]);
};
TransBtn.inheritAttrs = false;
TransBtn.displayName = "TransBtn";
TransBtn.props = {
class: String,
customizeIcon: PropTypes$1.any,
customizeIconProps: PropTypes$1.any,
onMousedown: Function,
onClick: Function
};
const TransBtn$1 = TransBtn;
function onCompositionStart(e2) {
e2.target.composing = true;
}
function onCompositionEnd(e2) {
if (!e2.target.composing)
return;
e2.target.composing = false;
trigger(e2.target, "input");
}
function trigger(el, type) {
var e2 = document.createEvent("HTMLEvents");
e2.initEvent(type, true, true);
el.dispatchEvent(e2);
}
function addEventListener$2(el, event, handler2, options) {
el.addEventListener(event, handler2, options);
}
var antInput = {
created: function created2(el, binding) {
if (!binding.modifiers || !binding.modifiers.lazy) {
addEventListener$2(el, "compositionstart", onCompositionStart);
addEventListener$2(el, "compositionend", onCompositionEnd);
addEventListener$2(el, "change", onCompositionEnd);
}
}
};
const antInputDirective = antInput;
var inputProps$2 = {
inputRef: PropTypes$1.any,
prefixCls: String,
id: String,
inputElement: PropTypes$1.VueNode,
disabled: {
type: Boolean,
default: void 0
},
autofocus: {
type: Boolean,
default: void 0
},
autocomplete: String,
editable: {
type: Boolean,
default: void 0
},
activeDescendantId: String,
value: String,
open: {
type: Boolean,
default: void 0
},
tabindex: PropTypes$1.oneOfType([PropTypes$1.number, PropTypes$1.string]),
/** Pass accessibility props to input */
attrs: PropTypes$1.object,
onKeydown: {
type: Function
},
onMousedown: {
type: Function
},
onChange: {
type: Function
},
onPaste: {
type: Function
},
onCompositionstart: {
type: Function
},
onCompositionend: {
type: Function
},
onFocus: {
type: Function
},
onBlur: {
type: Function
}
};
var Input$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Input",
inheritAttrs: false,
props: inputProps$2,
setup: function setup14(props3) {
var blurTimeout = null;
var VCSelectContainerEvent = inject("VCSelectContainerEvent");
return function() {
var _inputNode, _inputNode$props;
var prefixCls = props3.prefixCls, id = props3.id, inputElement = props3.inputElement, disabled = props3.disabled, tabindex = props3.tabindex, autofocus = props3.autofocus, autocomplete = props3.autocomplete, editable = props3.editable, activeDescendantId = props3.activeDescendantId, value2 = props3.value, _onKeydown = props3.onKeydown, _onMousedown = props3.onMousedown, onChange = props3.onChange, onPaste = props3.onPaste, _onCompositionstart = props3.onCompositionstart, _onCompositionend = props3.onCompositionend, _onFocus = props3.onFocus, _onBlur = props3.onBlur, open2 = props3.open, inputRef = props3.inputRef, attrs = props3.attrs;
var inputNode = inputElement || withDirectives(createVNode("input", null, null), [[antInputDirective]]);
var inputProps3 = inputNode.props || {};
var onOriginKeyDown = inputProps3.onKeydown, onOriginInput = inputProps3.onInput, onOriginFocus = inputProps3.onFocus, onOriginBlur = inputProps3.onBlur, onOriginMouseDown = inputProps3.onMousedown, onOriginCompositionStart = inputProps3.onCompositionstart, onOriginCompositionEnd = inputProps3.onCompositionend, style = inputProps3.style;
inputNode = cloneElement(inputNode, _extends(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
type: "search"
}, inputProps3), {}, {
id,
ref: inputRef,
disabled,
tabindex,
autocomplete: autocomplete || "off",
autofocus,
class: classNames("".concat(prefixCls, "-selection-search-input"), (_inputNode = inputNode) === null || _inputNode === void 0 ? void 0 : (_inputNode$props = _inputNode.props) === null || _inputNode$props === void 0 ? void 0 : _inputNode$props.class),
role: "combobox",
"aria-expanded": open2,
"aria-haspopup": "listbox",
"aria-owns": "".concat(id, "_list"),
"aria-autocomplete": "list",
"aria-controls": "".concat(id, "_list"),
"aria-activedescendant": activeDescendantId
}, attrs), {}, {
value: editable ? value2 : "",
readonly: !editable,
unselectable: !editable ? "on" : null,
style: _objectSpread2$1(_objectSpread2$1({}, style), {}, {
opacity: editable ? null : 0
}),
onKeydown: function onKeydown(event) {
_onKeydown(event);
if (onOriginKeyDown) {
onOriginKeyDown(event);
}
},
onMousedown: function onMousedown2(event) {
_onMousedown(event);
if (onOriginMouseDown) {
onOriginMouseDown(event);
}
},
onInput: function onInput(event) {
onChange(event);
if (onOriginInput) {
onOriginInput(event);
}
},
onCompositionstart: function onCompositionstart(event) {
_onCompositionstart(event);
if (onOriginCompositionStart) {
onOriginCompositionStart(event);
}
},
onCompositionend: function onCompositionend(event) {
_onCompositionend(event);
if (onOriginCompositionEnd) {
onOriginCompositionEnd(event);
}
},
onPaste,
onFocus: function onFocus2() {
clearTimeout(blurTimeout);
onOriginFocus && onOriginFocus(arguments.length <= 0 ? void 0 : arguments[0]);
_onFocus && _onFocus(arguments.length <= 0 ? void 0 : arguments[0]);
VCSelectContainerEvent === null || VCSelectContainerEvent === void 0 ? void 0 : VCSelectContainerEvent.focus(arguments.length <= 0 ? void 0 : arguments[0]);
},
onBlur: function onBlur2() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
blurTimeout = setTimeout(function() {
onOriginBlur && onOriginBlur(args[0]);
_onBlur && _onBlur(args[0]);
VCSelectContainerEvent === null || VCSelectContainerEvent === void 0 ? void 0 : VCSelectContainerEvent.blur(args[0]);
}, 100);
}
}), inputNode.type === "textarea" ? {} : {
type: "search"
}), true, true);
return inputNode;
};
}
});
const Input$2 = Input$1;
var attributes = "accept acceptcharset accesskey action allowfullscreen allowtransparency\nalt async autocomplete autofocus autoplay capture cellpadding cellspacing challenge\ncharset checked classid classname colspan cols content contenteditable contextmenu\ncontrols coords crossorigin data datetime default defer dir disabled download draggable\nenctype form formaction formenctype formmethod formnovalidate formtarget frameborder\nheaders height hidden high href hreflang htmlfor for httpequiv icon id inputmode integrity\nis keyparams keytype kind label lang list loop low manifest marginheight marginwidth max maxlength media\nmediagroup method min minlength multiple muted name novalidate nonce open\noptimum pattern placeholder poster preload radiogroup readonly rel required\nreversed role rowspan rows sandbox scope scoped scrolling seamless selected\nshape size sizes span spellcheck src srcdoc srclang srcset start step style\nsummary tabindex target title type usemap value width wmode wrap";
var eventsName = "onCopy onCut onPaste onCompositionend onCompositionstart onCompositionupdate onKeydown\n onKeypress onKeyup onFocus onBlur onChange onInput onSubmit onClick onContextmenu onDoubleclick onDblclick\n onDrag onDragend onDragenter onDragexit onDragleave onDragover onDragstart onDrop onMousedown\n onMouseenter onMouseleave onMousemove onMouseout onMouseover onMouseup onSelect onTouchcancel\n onTouchend onTouchmove onTouchstart onTouchstartPassive onTouchmovePassive onScroll onWheel onAbort onCanplay onCanplaythrough\n onDurationchange onEmptied onEncrypted onEnded onError onLoadeddata onLoadedmetadata\n onLoadstart onPause onPlay onPlaying onProgress onRatechange onSeeked onSeeking onStalled onSuspend onTimeupdate onVolumechange onWaiting onLoad onError";
var propList = "".concat(attributes, " ").concat(eventsName).split(/[\s\n]+/);
var ariaPrefix = "aria-";
var dataPrefix = "data-";
function match$2(key2, prefix) {
return key2.indexOf(prefix) === 0;
}
function pickAttrs(props3) {
var ariaOnly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
var mergedConfig;
if (ariaOnly === false) {
mergedConfig = {
aria: true,
data: true,
attr: true
};
} else if (ariaOnly === true) {
mergedConfig = {
aria: true
};
} else {
mergedConfig = _objectSpread2$1({}, ariaOnly);
}
var attrs = {};
Object.keys(props3).forEach(function(key2) {
if (
// Aria
mergedConfig.aria && (key2 === "role" || match$2(key2, ariaPrefix)) || // Data
mergedConfig.data && match$2(key2, dataPrefix) || // Attr
mergedConfig.attr && (propList.includes(key2) || propList.includes(key2.toLowerCase()))
) {
attrs[key2] = props3[key2];
}
});
return attrs;
}
var OverflowContextProviderKey = Symbol("OverflowContextProviderKey");
var OverflowContextProvider = defineComponent({
compatConfig: {
MODE: 3
},
name: "OverflowContextProvider",
inheritAttrs: false,
props: {
value: {
type: Object
}
},
setup: function setup15(props3, _ref) {
var slots = _ref.slots;
provide(OverflowContextProviderKey, computed(function() {
return props3.value;
}));
return function() {
var _slots$default;
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
};
}
});
var useInjectOverflowContext = function useInjectOverflowContext2() {
return inject(OverflowContextProviderKey, computed(function() {
return null;
}));
};
var _excluded$n = ["prefixCls", "invalidate", "item", "renderItem", "responsive", "registerSize", "itemKey", "display", "order", "component"];
var UNDEFINED = void 0;
const Item$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Item",
props: {
prefixCls: String,
item: PropTypes$1.any,
renderItem: Function,
responsive: Boolean,
itemKey: {
type: [String, Number]
},
registerSize: Function,
display: Boolean,
order: Number,
component: PropTypes$1.any,
invalidate: Boolean
},
setup: function setup16(props3, _ref) {
var slots = _ref.slots, expose = _ref.expose;
var mergedHidden = computed(function() {
return props3.responsive && !props3.display;
});
var itemNodeRef = ref();
expose({
itemNodeRef
});
function internalRegisterSize(width) {
props3.registerSize(props3.itemKey, width);
}
onUnmounted(function() {
internalRegisterSize(null);
});
return function() {
var _slots$default;
var prefixCls = props3.prefixCls, invalidate = props3.invalidate, item = props3.item, renderItem = props3.renderItem, responsive = props3.responsive;
props3.registerSize;
props3.itemKey;
props3.display;
var order = props3.order, _props$component = props3.component, Component = _props$component === void 0 ? "div" : _props$component, restProps = _objectWithoutProperties$2(props3, _excluded$n);
var children = (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
var childNode = renderItem && item !== UNDEFINED ? renderItem(item) : children;
var overflowStyle;
if (!invalidate) {
overflowStyle = {
opacity: mergedHidden.value ? 0 : 1,
height: mergedHidden.value ? 0 : UNDEFINED,
overflowY: mergedHidden.value ? "hidden" : UNDEFINED,
order: responsive ? order : UNDEFINED,
pointerEvents: mergedHidden.value ? "none" : UNDEFINED,
position: mergedHidden.value ? "absolute" : UNDEFINED
};
}
var overflowProps3 = {};
if (mergedHidden.value) {
overflowProps3["aria-hidden"] = true;
}
return createVNode(ResizeObserver$1, {
"disabled": !responsive,
"onResize": function onResize(_ref2) {
var offsetWidth = _ref2.offsetWidth;
internalRegisterSize(offsetWidth);
}
}, {
default: function _default3() {
return createVNode(Component, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
"class": classNames(!invalidate && prefixCls),
"style": overflowStyle
}, overflowProps3), restProps), {}, {
"ref": itemNodeRef
}), {
default: function _default4() {
return [childNode];
}
});
}
});
};
}
});
var _excluded$m = ["component"], _excluded2$2 = ["className"], _excluded3 = ["class"];
const RawItem = defineComponent({
compatConfig: {
MODE: 3
},
name: "RawItem",
inheritAttrs: false,
props: {
component: PropTypes$1.any,
title: PropTypes$1.any,
id: String,
onMouseenter: {
type: Function
},
onMouseleave: {
type: Function
},
onClick: {
type: Function
},
onKeydown: {
type: Function
},
onFocus: {
type: Function
}
},
setup: function setup17(props3, _ref) {
var slots = _ref.slots, attrs = _ref.attrs;
var context = useInjectOverflowContext();
return function() {
if (!context.value) {
var _slots$default;
var _props$component = props3.component, Component = _props$component === void 0 ? "div" : _props$component, _restProps = _objectWithoutProperties$2(props3, _excluded$m);
return createVNode(Component, _objectSpread2$1(_objectSpread2$1({}, _restProps), attrs), {
default: function _default3() {
return [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
}
});
}
var _context$value = context.value, contextClassName = _context$value.className, restContext = _objectWithoutProperties$2(_context$value, _excluded2$2);
var className = attrs.class, restProps = _objectWithoutProperties$2(attrs, _excluded3);
return createVNode(OverflowContextProvider, {
"value": null
}, {
default: function _default3() {
return [createVNode(Item$2, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
"class": classNames(contextClassName, className)
}, restContext), restProps), props3), slots)];
}
});
};
}
});
var _excluded$l = ["class", "style"];
var RESPONSIVE = "responsive";
var INVALIDATE = "invalidate";
function defaultRenderRest(omittedItems) {
return "+ ".concat(omittedItems.length, " ...");
}
var overflowProps = function overflowProps2() {
return {
id: String,
prefixCls: String,
data: Array,
itemKey: [String, Number, Function],
/** Used for `responsive`. It will limit render node to avoid perf issue */
itemWidth: {
type: Number,
default: 10
},
renderItem: Function,
/** @private Do not use in your production. Render raw node that need wrap Item by developer self */
renderRawItem: Function,
maxCount: [Number, String],
renderRest: Function,
/** @private Do not use in your production. Render raw node that need wrap Item by developer self */
renderRawRest: Function,
suffix: PropTypes$1.any,
component: String,
itemComponent: PropTypes$1.any,
/** @private This API may be refactor since not well design */
onVisibleChange: Function,
/** When set to `full`, ssr will render full items by default and remove at client side */
ssr: String,
onMousedown: Function
};
};
var Overflow = defineComponent({
name: "Overflow",
inheritAttrs: false,
props: overflowProps(),
emits: ["visibleChange"],
setup: function setup18(props3, _ref) {
var attrs = _ref.attrs, emit = _ref.emit, slots = _ref.slots;
var fullySSR = computed(function() {
return props3.ssr === "full";
});
var containerWidth = ref(null);
var mergedContainerWidth = computed(function() {
return containerWidth.value || 0;
});
var itemWidths = ref(/* @__PURE__ */ new Map());
var prevRestWidth = ref(0);
var restWidth = ref(0);
var suffixWidth = ref(0);
var suffixFixedStart = ref(null);
var displayCount = ref(null);
var mergedDisplayCount = computed(function() {
if (displayCount.value === null && fullySSR.value) {
return Number.MAX_SAFE_INTEGER;
}
return displayCount.value || 0;
});
var restReady = ref(false);
var itemPrefixCls = computed(function() {
return "".concat(props3.prefixCls, "-item");
});
var mergedRestWidth = computed(function() {
return Math.max(prevRestWidth.value, restWidth.value);
});
var isResponsive = computed(function() {
return !!(props3.data.length && props3.maxCount === RESPONSIVE);
});
var invalidate = computed(function() {
return props3.maxCount === INVALIDATE;
});
var showRest = computed(function() {
return isResponsive.value || typeof props3.maxCount === "number" && props3.data.length > props3.maxCount;
});
var mergedData = computed(function() {
var items = props3.data;
if (isResponsive.value) {
if (containerWidth.value === null && fullySSR.value) {
items = props3.data;
} else {
items = props3.data.slice(0, Math.min(props3.data.length, mergedContainerWidth.value / props3.itemWidth));
}
} else if (typeof props3.maxCount === "number") {
items = props3.data.slice(0, props3.maxCount);
}
return items;
});
var omittedItems = computed(function() {
if (isResponsive.value) {
return props3.data.slice(mergedDisplayCount.value + 1);
}
return props3.data.slice(mergedData.value.length);
});
var getKey2 = function getKey3(item, index2) {
var _ref2;
if (typeof props3.itemKey === "function") {
return props3.itemKey(item);
}
return (_ref2 = props3.itemKey && (item === null || item === void 0 ? void 0 : item[props3.itemKey])) !== null && _ref2 !== void 0 ? _ref2 : index2;
};
var mergedRenderItem = computed(function() {
return props3.renderItem || function(item) {
return item;
};
});
var updateDisplayCount = function updateDisplayCount2(count, notReady) {
displayCount.value = count;
if (!notReady) {
restReady.value = count < props3.data.length - 1;
emit("visibleChange", count);
}
};
var onOverflowResize = function onOverflowResize2(_2, element) {
containerWidth.value = element.clientWidth;
};
var registerSize = function registerSize2(key2, width) {
var clone3 = new Map(itemWidths.value);
if (width === null) {
clone3.delete(key2);
} else {
clone3.set(key2, width);
}
itemWidths.value = clone3;
};
var registerOverflowSize = function registerOverflowSize2(_2, width) {
prevRestWidth.value = restWidth.value;
restWidth.value = width;
};
var registerSuffixSize = function registerSuffixSize2(_2, width) {
suffixWidth.value = width;
};
var getItemWidth = function getItemWidth2(index2) {
return itemWidths.value.get(getKey2(mergedData.value[index2], index2));
};
watch([mergedContainerWidth, itemWidths, restWidth, suffixWidth, function() {
return props3.itemKey;
}, mergedData], function() {
if (mergedContainerWidth.value && mergedRestWidth.value && mergedData.value) {
var totalWidth = suffixWidth.value;
var len = mergedData.value.length;
var lastIndex = len - 1;
if (!len) {
updateDisplayCount(0);
suffixFixedStart.value = null;
return;
}
for (var i2 = 0; i2 < len; i2 += 1) {
var currentItemWidth = getItemWidth(i2);
if (currentItemWidth === void 0) {
updateDisplayCount(i2 - 1, true);
break;
}
totalWidth += currentItemWidth;
if (
// Only one means `totalWidth` is the final width
lastIndex === 0 && totalWidth <= mergedContainerWidth.value || // Last two width will be the final width
i2 === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth.value
) {
updateDisplayCount(lastIndex);
suffixFixedStart.value = null;
break;
} else if (totalWidth + mergedRestWidth.value > mergedContainerWidth.value) {
updateDisplayCount(i2 - 1);
suffixFixedStart.value = totalWidth - currentItemWidth - suffixWidth.value + restWidth.value;
break;
}
}
if (props3.suffix && getItemWidth(0) + suffixWidth.value > mergedContainerWidth.value) {
suffixFixedStart.value = null;
}
}
});
return function() {
var displayRest = restReady.value && !!omittedItems.value.length;
var itemComponent = props3.itemComponent, renderRawItem = props3.renderRawItem, renderRawRest = props3.renderRawRest, renderRest = props3.renderRest, _props$prefixCls = props3.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-overflow" : _props$prefixCls, suffix = props3.suffix, _props$component = props3.component, Component = _props$component === void 0 ? "div" : _props$component, id = props3.id, onMousedown2 = props3.onMousedown;
var className = attrs.class, style = attrs.style, restAttrs = _objectWithoutProperties$2(attrs, _excluded$l);
var suffixStyle = {};
if (suffixFixedStart.value !== null && isResponsive.value) {
suffixStyle = {
position: "absolute",
left: "".concat(suffixFixedStart.value, "px"),
top: 0
};
}
var itemSharedProps = {
prefixCls: itemPrefixCls.value,
responsive: isResponsive.value,
component: itemComponent,
invalidate: invalidate.value
};
var internalRenderItemNode = renderRawItem ? function(item, index2) {
var key2 = getKey2(item, index2);
return createVNode(OverflowContextProvider, {
"key": key2,
"value": _objectSpread2$1(_objectSpread2$1({}, itemSharedProps), {}, {
order: index2,
item,
itemKey: key2,
registerSize,
display: index2 <= mergedDisplayCount.value
})
}, {
default: function _default3() {
return [renderRawItem(item, index2)];
}
});
} : function(item, index2) {
var key2 = getKey2(item, index2);
return createVNode(Item$2, _objectSpread2$1(_objectSpread2$1({}, itemSharedProps), {}, {
"order": index2,
"key": key2,
"item": item,
"renderItem": mergedRenderItem.value,
"itemKey": key2,
"registerSize": registerSize,
"display": index2 <= mergedDisplayCount.value
}), null);
};
var restNode = function restNode2() {
return null;
};
var restContextProps = {
order: displayRest ? mergedDisplayCount.value : Number.MAX_SAFE_INTEGER,
className: "".concat(itemPrefixCls.value, " ").concat(itemPrefixCls.value, "-rest"),
registerSize: registerOverflowSize,
display: displayRest
};
if (!renderRawRest) {
var mergedRenderRest = renderRest || defaultRenderRest;
restNode = function restNode2() {
return createVNode(Item$2, _objectSpread2$1(_objectSpread2$1({}, itemSharedProps), restContextProps), {
default: function _default3() {
return typeof mergedRenderRest === "function" ? mergedRenderRest(omittedItems.value) : mergedRenderRest;
}
});
};
} else if (renderRawRest) {
restNode = function restNode2() {
return createVNode(OverflowContextProvider, {
"value": _objectSpread2$1(_objectSpread2$1({}, itemSharedProps), restContextProps)
}, {
default: function _default3() {
return [renderRawRest(omittedItems.value)];
}
});
};
}
var overflowNode = function overflowNode2() {
var _slots$default;
return createVNode(Component, _objectSpread2$1({
"id": id,
"class": classNames(!invalidate.value && prefixCls, className),
"style": style,
"onMousedown": onMousedown2
}, restAttrs), {
default: function _default3() {
return [mergedData.value.map(internalRenderItemNode), showRest.value ? restNode() : null, suffix && createVNode(Item$2, _objectSpread2$1(_objectSpread2$1({}, itemSharedProps), {}, {
"order": mergedDisplayCount.value,
"class": "".concat(itemPrefixCls.value, "-suffix"),
"registerSize": registerSuffixSize,
"display": true,
"style": suffixStyle
}), {
default: function _default4() {
return suffix;
}
}), (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
}
});
};
return createVNode(ResizeObserver$1, {
"disabled": !isResponsive.value,
"onResize": onOverflowResize
}, {
default: overflowNode
});
};
}
});
Overflow.Item = RawItem;
Overflow.RESPONSIVE = RESPONSIVE;
Overflow.INVALIDATE = INVALIDATE;
const Overflow$1 = Overflow;
var TreeSelectLegacyContextPropsKey = Symbol("TreeSelectLegacyContextPropsKey");
function useInjectLegacySelectContext() {
return inject(TreeSelectLegacyContextPropsKey, {});
}
var props$2 = {
id: String,
prefixCls: String,
values: PropTypes$1.array,
open: {
type: Boolean,
default: void 0
},
searchValue: String,
inputRef: PropTypes$1.any,
placeholder: PropTypes$1.any,
disabled: {
type: Boolean,
default: void 0
},
mode: String,
showSearch: {
type: Boolean,
default: void 0
},
autofocus: {
type: Boolean,
default: void 0
},
autocomplete: String,
activeDescendantId: String,
tabindex: PropTypes$1.oneOfType([PropTypes$1.number, PropTypes$1.string]),
removeIcon: PropTypes$1.any,
choiceTransitionName: String,
maxTagCount: PropTypes$1.oneOfType([PropTypes$1.number, PropTypes$1.string]),
maxTagTextLength: Number,
maxTagPlaceholder: PropTypes$1.any.def(function() {
return function(omittedValues) {
return "+ ".concat(omittedValues.length, " ...");
};
}),
tagRender: Function,
onToggleOpen: {
type: Function
},
onRemove: Function,
onInputChange: Function,
onInputPaste: Function,
onInputKeyDown: Function,
onInputMouseDown: Function,
onInputCompositionStart: Function,
onInputCompositionEnd: Function
};
var onPreventMouseDown = function onPreventMouseDown2(event) {
event.preventDefault();
event.stopPropagation();
};
var SelectSelector = defineComponent({
name: "MultipleSelectSelector",
inheritAttrs: false,
props: props$2,
setup: function setup19(props3) {
var measureRef = ref();
var inputWidth = ref(0);
var focused = ref(false);
var legacyTreeSelectContext = useInjectLegacySelectContext();
var selectionPrefixCls = computed(function() {
return "".concat(props3.prefixCls, "-selection");
});
var inputValue = computed(function() {
return props3.open || props3.mode === "tags" ? props3.searchValue : "";
});
var inputEditable = computed(function() {
return props3.mode === "tags" || props3.showSearch && (props3.open || focused.value);
});
onMounted(function() {
watch(inputValue, function() {
inputWidth.value = measureRef.value.scrollWidth;
}, {
flush: "post",
immediate: true
});
});
function defaultRenderSelector(title, content, itemDisabled, closable, onClose) {
return createVNode("span", {
"class": classNames("".concat(selectionPrefixCls.value, "-item"), _defineProperty$q({}, "".concat(selectionPrefixCls.value, "-item-disabled"), itemDisabled)),
"title": typeof title === "string" || typeof title === "number" ? title.toString() : void 0
}, [createVNode("span", {
"class": "".concat(selectionPrefixCls.value, "-item-content")
}, [content]), closable && createVNode(TransBtn$1, {
"class": "".concat(selectionPrefixCls.value, "-item-remove"),
"onMousedown": onPreventMouseDown,
"onClick": onClose,
"customizeIcon": props3.removeIcon
}, {
default: function _default3() {
return [createTextVNode("×")];
}
})]);
}
function customizeRenderSelector(value2, content, itemDisabled, closable, onClose, option) {
var onMouseDown2 = function onMouseDown3(e2) {
onPreventMouseDown(e2);
props3.onToggleOpen(!open);
};
var originData = option;
if (legacyTreeSelectContext.keyEntities) {
var _legacyTreeSelectCont;
originData = ((_legacyTreeSelectCont = legacyTreeSelectContext.keyEntities[value2]) === null || _legacyTreeSelectCont === void 0 ? void 0 : _legacyTreeSelectCont.node) || {};
}
return createVNode("span", {
"key": value2,
"onMousedown": onMouseDown2
}, [props3.tagRender({
label: content,
value: value2,
disabled: itemDisabled,
closable,
onClose,
option: originData
})]);
}
function renderItem(valueItem) {
var itemDisabled = valueItem.disabled, label = valueItem.label, value2 = valueItem.value, option = valueItem.option;
var closable = !props3.disabled && !itemDisabled;
var displayLabel = label;
if (typeof props3.maxTagTextLength === "number") {
if (typeof label === "string" || typeof label === "number") {
var strLabel = String(displayLabel);
if (strLabel.length > props3.maxTagTextLength) {
displayLabel = "".concat(strLabel.slice(0, props3.maxTagTextLength), "...");
}
}
}
var onClose = function onClose2(event) {
var _props$onRemove;
if (event)
event.stopPropagation();
(_props$onRemove = props3.onRemove) === null || _props$onRemove === void 0 ? void 0 : _props$onRemove.call(props3, valueItem);
};
return typeof props3.tagRender === "function" ? customizeRenderSelector(value2, displayLabel, itemDisabled, closable, onClose, option) : defaultRenderSelector(label, displayLabel, itemDisabled, closable, onClose);
}
function renderRest(omittedValues) {
var _props$maxTagPlacehol = props3.maxTagPlaceholder, maxTagPlaceholder = _props$maxTagPlacehol === void 0 ? function(omittedValues2) {
return "+ ".concat(omittedValues2.length, " ...");
} : _props$maxTagPlacehol;
var content = typeof maxTagPlaceholder === "function" ? maxTagPlaceholder(omittedValues) : maxTagPlaceholder;
return defaultRenderSelector(content, content, false);
}
return function() {
var id = props3.id, prefixCls = props3.prefixCls, values = props3.values, open2 = props3.open, inputRef = props3.inputRef, placeholder = props3.placeholder, disabled = props3.disabled, autofocus = props3.autofocus, autocomplete = props3.autocomplete, activeDescendantId = props3.activeDescendantId, tabindex = props3.tabindex, onInputChange = props3.onInputChange, onInputPaste = props3.onInputPaste, onInputKeyDown = props3.onInputKeyDown, onInputMouseDown = props3.onInputMouseDown, onInputCompositionStart = props3.onInputCompositionStart, onInputCompositionEnd = props3.onInputCompositionEnd;
var inputNode = createVNode("div", {
"class": "".concat(selectionPrefixCls.value, "-search"),
"style": {
width: inputWidth.value + "px"
},
"key": "input"
}, [createVNode(Input$2, {
"inputRef": inputRef,
"open": open2,
"prefixCls": prefixCls,
"id": id,
"inputElement": null,
"disabled": disabled,
"autofocus": autofocus,
"autocomplete": autocomplete,
"editable": inputEditable.value,
"activeDescendantId": activeDescendantId,
"value": inputValue.value,
"onKeydown": onInputKeyDown,
"onMousedown": onInputMouseDown,
"onChange": onInputChange,
"onPaste": onInputPaste,
"onCompositionstart": onInputCompositionStart,
"onCompositionend": onInputCompositionEnd,
"tabindex": tabindex,
"attrs": pickAttrs(props3, true),
"onFocus": function onFocus2() {
return focused.value = true;
},
"onBlur": function onBlur2() {
return focused.value = false;
}
}, null), createVNode("span", {
"ref": measureRef,
"class": "".concat(selectionPrefixCls.value, "-search-mirror"),
"aria-hidden": true
}, [inputValue.value, createTextVNode(" ")])]);
var selectionNode = createVNode(Overflow$1, {
"prefixCls": "".concat(selectionPrefixCls.value, "-overflow"),
"data": values,
"renderItem": renderItem,
"renderRest": renderRest,
"suffix": inputNode,
"itemKey": "key",
"maxCount": props3.maxTagCount,
"key": "overflow"
}, null);
return createVNode(Fragment, null, [selectionNode, !values.length && !inputValue.value && createVNode("span", {
"class": "".concat(selectionPrefixCls.value, "-placeholder")
}, [placeholder])]);
};
}
});
const MultipleSelector = SelectSelector;
var props$1 = {
inputElement: PropTypes$1.any,
id: String,
prefixCls: String,
values: PropTypes$1.array,
open: {
type: Boolean,
default: void 0
},
searchValue: String,
inputRef: PropTypes$1.any,
placeholder: PropTypes$1.any,
disabled: {
type: Boolean,
default: void 0
},
mode: String,
showSearch: {
type: Boolean,
default: void 0
},
autofocus: {
type: Boolean,
default: void 0
},
autocomplete: String,
activeDescendantId: String,
tabindex: PropTypes$1.oneOfType([PropTypes$1.number, PropTypes$1.string]),
activeValue: String,
backfill: {
type: Boolean,
default: void 0
},
optionLabelRender: Function,
onInputChange: Function,
onInputPaste: Function,
onInputKeyDown: Function,
onInputMouseDown: Function,
onInputCompositionStart: Function,
onInputCompositionEnd: Function
};
var SingleSelector = defineComponent({
name: "SingleSelector",
setup: function setup20(props3) {
var inputChanged = ref(false);
var combobox = computed(function() {
return props3.mode === "combobox";
});
var inputEditable = computed(function() {
return combobox.value || props3.showSearch;
});
var inputValue = computed(function() {
var inputValue2 = props3.searchValue || "";
if (combobox.value && props3.activeValue && !inputChanged.value) {
inputValue2 = props3.activeValue;
}
return inputValue2;
});
var legacyTreeSelectContext = useInjectLegacySelectContext();
watch([combobox, function() {
return props3.activeValue;
}], function() {
if (combobox.value) {
inputChanged.value = false;
}
}, {
immediate: true
});
var hasTextInput = computed(function() {
return props3.mode !== "combobox" && !props3.open && !props3.showSearch ? false : !!inputValue.value;
});
var title = computed(function() {
var item = props3.values[0];
return item && (typeof item.label === "string" || typeof item.label === "number") ? item.label.toString() : void 0;
});
var renderPlaceholder = function renderPlaceholder2() {
if (props3.values[0]) {
return null;
}
var hiddenStyle = hasTextInput.value ? {
visibility: "hidden"
} : void 0;
return createVNode("span", {
"class": "".concat(props3.prefixCls, "-selection-placeholder"),
"style": hiddenStyle
}, [props3.placeholder]);
};
return function() {
var _item$key2;
var inputElement = props3.inputElement, prefixCls = props3.prefixCls, id = props3.id, values = props3.values, inputRef = props3.inputRef, disabled = props3.disabled, autofocus = props3.autofocus, autocomplete = props3.autocomplete, activeDescendantId = props3.activeDescendantId, open2 = props3.open, tabindex = props3.tabindex, optionLabelRender = props3.optionLabelRender, onInputKeyDown = props3.onInputKeyDown, onInputMouseDown = props3.onInputMouseDown, onInputChange = props3.onInputChange, onInputPaste = props3.onInputPaste, onInputCompositionStart = props3.onInputCompositionStart, onInputCompositionEnd = props3.onInputCompositionEnd;
var item = values[0];
var titleNode = null;
if (item && legacyTreeSelectContext.customSlots) {
var _item$key, _legacyTreeSelectCont, _originData$slots;
var key2 = (_item$key = item.key) !== null && _item$key !== void 0 ? _item$key : item.value;
var originData = ((_legacyTreeSelectCont = legacyTreeSelectContext.keyEntities[key2]) === null || _legacyTreeSelectCont === void 0 ? void 0 : _legacyTreeSelectCont.node) || {};
titleNode = legacyTreeSelectContext.customSlots[(_originData$slots = originData.slots) === null || _originData$slots === void 0 ? void 0 : _originData$slots.title] || legacyTreeSelectContext.customSlots.title || item.label;
if (typeof titleNode === "function") {
titleNode = titleNode(originData);
}
} else {
titleNode = optionLabelRender && item ? optionLabelRender(item.option) : item === null || item === void 0 ? void 0 : item.label;
}
return createVNode(Fragment, null, [createVNode("span", {
"class": "".concat(prefixCls, "-selection-search")
}, [createVNode(Input$2, {
"inputRef": inputRef,
"prefixCls": prefixCls,
"id": id,
"open": open2,
"inputElement": inputElement,
"disabled": disabled,
"autofocus": autofocus,
"autocomplete": autocomplete,
"editable": inputEditable.value,
"activeDescendantId": activeDescendantId,
"value": inputValue.value,
"onKeydown": onInputKeyDown,
"onMousedown": onInputMouseDown,
"onChange": function onChange(e2) {
inputChanged.value = true;
onInputChange(e2);
},
"onPaste": onInputPaste,
"onCompositionstart": onInputCompositionStart,
"onCompositionend": onInputCompositionEnd,
"tabindex": tabindex,
"attrs": pickAttrs(props3, true)
}, null)]), !combobox.value && item && !hasTextInput.value && createVNode("span", {
"class": "".concat(prefixCls, "-selection-item"),
"title": title.value
}, [createVNode(Fragment, {
"key": (_item$key2 = item.key) !== null && _item$key2 !== void 0 ? _item$key2 : item.value
}, [titleNode])]), renderPlaceholder()]);
};
}
});
SingleSelector.props = props$1;
SingleSelector.inheritAttrs = false;
const SingleSelector$1 = SingleSelector;
function isValidateOpenKey(currentKeyCode) {
return ![
// System function button
KeyCode$1.ESC,
KeyCode$1.SHIFT,
KeyCode$1.BACKSPACE,
KeyCode$1.TAB,
KeyCode$1.WIN_KEY,
KeyCode$1.ALT,
KeyCode$1.META,
KeyCode$1.WIN_KEY_RIGHT,
KeyCode$1.CTRL,
KeyCode$1.SEMICOLON,
KeyCode$1.EQUALS,
KeyCode$1.CAPS_LOCK,
KeyCode$1.CONTEXT_MENU,
// F1-F12
KeyCode$1.F1,
KeyCode$1.F2,
KeyCode$1.F3,
KeyCode$1.F4,
KeyCode$1.F5,
KeyCode$1.F6,
KeyCode$1.F7,
KeyCode$1.F8,
KeyCode$1.F9,
KeyCode$1.F10,
KeyCode$1.F11,
KeyCode$1.F12
].includes(currentKeyCode);
}
function useLock() {
var duration = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 250;
var lock = null;
var timeout;
onBeforeUnmount(function() {
clearTimeout(timeout);
});
function doLock(locked) {
if (locked || lock === null) {
lock = locked;
}
clearTimeout(timeout);
timeout = setTimeout(function() {
lock = null;
}, duration);
}
return [function() {
return lock;
}, doLock];
}
function createRef() {
var func = function func2(node) {
func2.current = node;
};
return func;
}
var Selector = defineComponent({
name: "Selector",
inheritAttrs: false,
props: {
id: String,
prefixCls: String,
showSearch: {
type: Boolean,
default: void 0
},
open: {
type: Boolean,
default: void 0
},
/** Display in the Selector value, it's not same as `value` prop */
values: PropTypes$1.array,
multiple: {
type: Boolean,
default: void 0
},
mode: String,
searchValue: String,
activeValue: String,
inputElement: PropTypes$1.any,
autofocus: {
type: Boolean,
default: void 0
},
activeDescendantId: String,
tabindex: PropTypes$1.oneOfType([PropTypes$1.number, PropTypes$1.string]),
disabled: {
type: Boolean,
default: void 0
},
placeholder: PropTypes$1.any,
removeIcon: PropTypes$1.any,
// Tags
maxTagCount: PropTypes$1.oneOfType([PropTypes$1.number, PropTypes$1.string]),
maxTagTextLength: Number,
maxTagPlaceholder: PropTypes$1.any,
tagRender: Function,
optionLabelRender: Function,
/** Check if `tokenSeparators` contains `\n` or `\r\n` */
tokenWithEnter: {
type: Boolean,
default: void 0
},
// Motion
choiceTransitionName: String,
onToggleOpen: {
type: Function
},
/** `onSearch` returns go next step boolean to check if need do toggle open */
onSearch: Function,
onSearchSubmit: Function,
onRemove: Function,
onInputKeyDown: {
type: Function
},
/**
* @private get real dom for trigger align.
* This may be removed after React provides replacement of `findDOMNode`
*/
domRef: Function
},
setup: function setup21(props3, _ref) {
var expose = _ref.expose;
var inputRef = createRef();
var compositionStatus = false;
var _useLock = useLock(0), _useLock2 = _slicedToArray$2(_useLock, 2), getInputMouseDown = _useLock2[0], setInputMouseDown = _useLock2[1];
var onInternalInputKeyDown = function onInternalInputKeyDown2(event) {
var which = event.which;
if (which === KeyCode$1.UP || which === KeyCode$1.DOWN) {
event.preventDefault();
}
if (props3.onInputKeyDown) {
props3.onInputKeyDown(event);
}
if (which === KeyCode$1.ENTER && props3.mode === "tags" && !compositionStatus && !props3.open) {
props3.onSearchSubmit(event.target.value);
}
if (isValidateOpenKey(which)) {
props3.onToggleOpen(true);
}
};
var onInternalInputMouseDown = function onInternalInputMouseDown2() {
setInputMouseDown(true);
};
var pastedText = null;
var triggerOnSearch = function triggerOnSearch2(value2) {
if (props3.onSearch(value2, true, compositionStatus) !== false) {
props3.onToggleOpen(true);
}
};
var onInputCompositionStart = function onInputCompositionStart2() {
compositionStatus = true;
};
var onInputCompositionEnd = function onInputCompositionEnd2(e2) {
compositionStatus = false;
if (props3.mode !== "combobox") {
triggerOnSearch(e2.target.value);
}
};
var onInputChange = function onInputChange2(event) {
var value2 = event.target.value;
if (props3.tokenWithEnter && pastedText && /[\r\n]/.test(pastedText)) {
var replacedText = pastedText.replace(/[\r\n]+$/, "").replace(/\r\n/g, " ").replace(/[\r\n]/g, " ");
value2 = value2.replace(replacedText, pastedText);
}
pastedText = null;
triggerOnSearch(value2);
};
var onInputPaste = function onInputPaste2(e2) {
var clipboardData = e2.clipboardData;
var value2 = clipboardData.getData("text");
pastedText = value2;
};
var onClick2 = function onClick3(_ref2) {
var target = _ref2.target;
if (target !== inputRef.current) {
var isIE = document.body.style.msTouchAction !== void 0;
if (isIE) {
setTimeout(function() {
inputRef.current.focus();
});
} else {
inputRef.current.focus();
}
}
};
var onMousedown2 = function onMousedown3(event) {
var inputMouseDown = getInputMouseDown();
if (event.target !== inputRef.current && !inputMouseDown) {
event.preventDefault();
}
if (props3.mode !== "combobox" && (!props3.showSearch || !inputMouseDown) || !props3.open) {
if (props3.open) {
props3.onSearch("", true, false);
}
props3.onToggleOpen();
}
};
expose({
focus: function focus() {
inputRef.current.focus();
},
blur: function blur() {
inputRef.current.blur();
}
});
return function() {
var prefixCls = props3.prefixCls, domRef = props3.domRef, mode = props3.mode;
var sharedProps = {
inputRef,
onInputKeyDown: onInternalInputKeyDown,
onInputMouseDown: onInternalInputMouseDown,
onInputChange,
onInputPaste,
onInputCompositionStart,
onInputCompositionEnd
};
var selectNode = mode === "multiple" || mode === "tags" ? createVNode(MultipleSelector, _objectSpread2$1(_objectSpread2$1({}, props3), sharedProps), null) : createVNode(SingleSelector$1, _objectSpread2$1(_objectSpread2$1({}, props3), sharedProps), null);
return createVNode("div", {
"ref": domRef,
"class": "".concat(prefixCls, "-selector"),
"onClick": onClick2,
"onMousedown": onMousedown2
}, [selectNode]);
};
}
});
const Selector$1 = Selector;
function useSelectTriggerControl(refs, open2, triggerOpen) {
function onGlobalMouseDown(event) {
var _refs$, _refs$2, _refs$2$value;
var target = event.target;
if (target.shadowRoot && event.composed) {
target = event.composedPath()[0] || target;
}
var elements = [(_refs$ = refs[0]) === null || _refs$ === void 0 ? void 0 : _refs$.value, (_refs$2 = refs[1]) === null || _refs$2 === void 0 ? void 0 : (_refs$2$value = _refs$2.value) === null || _refs$2$value === void 0 ? void 0 : _refs$2$value.getPopupElement()];
if (open2.value && elements.every(function(element) {
return element && !element.contains(target) && element !== target;
})) {
triggerOpen(false);
}
}
onMounted(function() {
window.addEventListener("mousedown", onGlobalMouseDown);
});
onBeforeUnmount(function() {
window.removeEventListener("mousedown", onGlobalMouseDown);
});
}
function useDelayReset() {
var timeout = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 10;
var bool = ref(false);
var delay;
var cancelLatest = function cancelLatest2() {
clearTimeout(delay);
};
onMounted(function() {
cancelLatest();
});
var delaySetBool = function delaySetBool2(value2, callback) {
cancelLatest();
delay = setTimeout(function() {
bool.value = value2;
if (callback) {
callback();
}
}, timeout);
};
return [bool, delaySetBool, cancelLatest];
}
var BaseSelectContextKey = Symbol("BaseSelectContextKey");
function useProvideBaseSelectProps(props3) {
return provide(BaseSelectContextKey, props3);
}
function useBaseProps() {
return inject(BaseSelectContextKey, {});
}
const isMobile$2 = function() {
if (typeof navigator === "undefined" || typeof window === "undefined") {
return false;
}
var agent = navigator.userAgent || navigator.vendor || window.opera;
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(agent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(agent === null || agent === void 0 ? void 0 : agent.substr(0, 4))) {
return true;
}
return false;
};
function toReactive(objectRef) {
if (!isRef(objectRef))
return reactive(objectRef);
var proxy = new Proxy({}, {
get: function get(_2, p, receiver) {
return Reflect.get(objectRef.value, p, receiver);
},
set: function set(_2, p, value2) {
objectRef.value[p] = value2;
return true;
},
deleteProperty: function deleteProperty(_2, p) {
return Reflect.deleteProperty(objectRef.value, p);
},
has: function has(_2, p) {
return Reflect.has(objectRef.value, p);
},
ownKeys: function ownKeys2() {
return Object.keys(objectRef.value);
},
getOwnPropertyDescriptor: function getOwnPropertyDescriptor() {
return {
enumerable: true,
configurable: true
};
}
});
return reactive(proxy);
}
var _excluded$k = ["prefixCls", "id", "open", "defaultOpen", "mode", "showSearch", "searchValue", "onSearch", "allowClear", "clearIcon", "showArrow", "inputIcon", "disabled", "loading", "getInputElement", "getPopupContainer", "placement", "animation", "transitionName", "dropdownStyle", "dropdownClassName", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "showAction", "direction", "tokenSeparators", "tagRender", "optionLabelRender", "onPopupScroll", "onDropdownVisibleChange", "onFocus", "onBlur", "onKeyup", "onKeydown", "onMousedown", "onClear", "omitDomProps", "getRawInputElement", "displayValues", "onDisplayValuesChange", "emptyOptions", "activeDescendantId", "activeValue", "OptionList"];
var DEFAULT_OMIT_PROPS = ["value", "onChange", "removeIcon", "placeholder", "autofocus", "maxTagCount", "maxTagTextLength", "maxTagPlaceholder", "choiceTransitionName", "onInputKeyDown", "onPopupScroll", "tabindex", "OptionList", "notFoundContent"];
var baseSelectPrivateProps = function baseSelectPrivateProps2() {
return {
prefixCls: String,
id: String,
omitDomProps: Array,
// >>> Value
displayValues: Array,
onDisplayValuesChange: Function,
// >>> Active
/** Current dropdown list active item string value */
activeValue: String,
/** Link search input with target element */
activeDescendantId: String,
onActiveValueChange: Function,
// >>> Search
searchValue: String,
/** Trigger onSearch, return false to prevent trigger open event */
onSearch: Function,
/** Trigger when search text match the `tokenSeparators`. Will provide split content */
onSearchSplit: Function,
maxLength: Number,
OptionList: PropTypes$1.any,
/** Tell if provided `options` is empty */
emptyOptions: Boolean
};
};
var baseSelectPropsWithoutPrivate = function baseSelectPropsWithoutPrivate2() {
return {
showSearch: {
type: Boolean,
default: void 0
},
tagRender: {
type: Function
},
optionLabelRender: {
type: Function
},
direction: {
type: String
},
// MISC
tabindex: Number,
autofocus: Boolean,
notFoundContent: PropTypes$1.any,
placeholder: PropTypes$1.any,
onClear: Function,
choiceTransitionName: String,
// >>> Mode
mode: String,
// >>> Status
disabled: {
type: Boolean,
default: void 0
},
loading: {
type: Boolean,
default: void 0
},
// >>> Open
open: {
type: Boolean,
default: void 0
},
defaultOpen: {
type: Boolean,
default: void 0
},
onDropdownVisibleChange: {
type: Function
},
// >>> Customize Input
/** @private Internal usage. Do not use in your production. */
getInputElement: {
type: Function
},
/** @private Internal usage. Do not use in your production. */
getRawInputElement: {
type: Function
},
// >>> Selector
maxTagTextLength: Number,
maxTagCount: {
type: [String, Number]
},
maxTagPlaceholder: PropTypes$1.any,
// >>> Search
tokenSeparators: {
type: Array
},
// >>> Icons
allowClear: {
type: Boolean,
default: void 0
},
showArrow: {
type: Boolean,
default: void 0
},
inputIcon: PropTypes$1.any,
/** Clear all icon */
clearIcon: PropTypes$1.any,
/** Selector remove icon */
removeIcon: PropTypes$1.any,
// >>> Dropdown
animation: String,
transitionName: String,
dropdownStyle: {
type: Object
},
dropdownClassName: String,
dropdownMatchSelectWidth: {
type: [Boolean, Number],
default: void 0
},
dropdownRender: {
type: Function
},
dropdownAlign: Object,
placement: {
type: String
},
getPopupContainer: {
type: Function
},
// >>> Focus
showAction: {
type: Array
},
onBlur: {
type: Function
},
onFocus: {
type: Function
},
// >>> Rest Events
onKeyup: Function,
onKeydown: Function,
onMousedown: Function,
onPopupScroll: Function,
onInputKeyDown: Function,
onMouseenter: Function,
onMouseleave: Function,
onClick: Function
};
};
var baseSelectProps = function baseSelectProps2() {
return _objectSpread2$1(_objectSpread2$1({}, baseSelectPrivateProps()), baseSelectPropsWithoutPrivate());
};
function isMultiple(mode) {
return mode === "tags" || mode === "multiple";
}
const BaseSelect = defineComponent({
compatConfig: {
MODE: 3
},
name: "BaseSelect",
inheritAttrs: false,
props: initDefaultProps$1(baseSelectProps(), {
showAction: [],
notFoundContent: "Not Found"
}),
setup: function setup22(props3, _ref) {
var attrs = _ref.attrs, expose = _ref.expose, slots = _ref.slots;
var multiple = computed(function() {
return isMultiple(props3.mode);
});
var mergedShowSearch = computed(function() {
return props3.showSearch !== void 0 ? props3.showSearch : multiple.value || props3.mode === "combobox";
});
var mobile = ref(false);
onMounted(function() {
mobile.value = isMobile$2();
});
var legacyTreeSelectContext = useInjectLegacySelectContext();
var containerRef = ref(null);
var selectorDomRef = createRef();
var triggerRef = ref(null);
var selectorRef = ref(null);
var listRef = ref(null);
var _useDelayReset = useDelayReset(), _useDelayReset2 = _slicedToArray$2(_useDelayReset, 3), mockFocused = _useDelayReset2[0], setMockFocused = _useDelayReset2[1], cancelSetMockFocused = _useDelayReset2[2];
var focus = function focus2() {
var _selectorRef$value;
(_selectorRef$value = selectorRef.value) === null || _selectorRef$value === void 0 ? void 0 : _selectorRef$value.focus();
};
var blur = function blur2() {
var _selectorRef$value2;
(_selectorRef$value2 = selectorRef.value) === null || _selectorRef$value2 === void 0 ? void 0 : _selectorRef$value2.blur();
};
expose({
focus,
blur,
scrollTo: function scrollTo2(arg) {
var _listRef$value;
return (_listRef$value = listRef.value) === null || _listRef$value === void 0 ? void 0 : _listRef$value.scrollTo(arg);
}
});
var mergedSearchValue = computed(function() {
var _props$displayValues$;
if (props3.mode !== "combobox") {
return props3.searchValue;
}
var val = (_props$displayValues$ = props3.displayValues[0]) === null || _props$displayValues$ === void 0 ? void 0 : _props$displayValues$.value;
return typeof val === "string" || typeof val === "number" ? String(val) : "";
});
var initOpen = props3.open !== void 0 ? props3.open : props3.defaultOpen;
var innerOpen = ref(initOpen);
var mergedOpen = ref(initOpen);
var setInnerOpen = function setInnerOpen2(val) {
innerOpen.value = props3.open !== void 0 ? props3.open : val;
mergedOpen.value = innerOpen.value;
};
watch(function() {
return props3.open;
}, function() {
setInnerOpen(props3.open);
});
var emptyListContent = computed(function() {
return !props3.notFoundContent && props3.emptyOptions;
});
watchEffect(function() {
mergedOpen.value = innerOpen.value;
if (props3.disabled || emptyListContent.value && mergedOpen.value && props3.mode === "combobox") {
mergedOpen.value = false;
}
});
var triggerOpen = computed(function() {
return emptyListContent.value ? false : mergedOpen.value;
});
var onToggleOpen = function onToggleOpen2(newOpen) {
var nextOpen = newOpen !== void 0 ? newOpen : !mergedOpen.value;
if (innerOpen.value !== nextOpen && !props3.disabled) {
setInnerOpen(nextOpen);
if (props3.onDropdownVisibleChange) {
props3.onDropdownVisibleChange(nextOpen);
}
}
};
var tokenWithEnter = computed(function() {
return (props3.tokenSeparators || []).some(function(tokenSeparator) {
return ["\n", "\r\n"].includes(tokenSeparator);
});
});
var onInternalSearch = function onInternalSearch2(searchText, fromTyping, isCompositing) {
var _props$onActiveValueC;
var ret = true;
var newSearchText = searchText;
(_props$onActiveValueC = props3.onActiveValueChange) === null || _props$onActiveValueC === void 0 ? void 0 : _props$onActiveValueC.call(props3, null);
var patchLabels = isCompositing ? null : getSeparatedContent(searchText, props3.tokenSeparators);
if (props3.mode !== "combobox" && patchLabels) {
var _props$onSearchSplit;
newSearchText = "";
(_props$onSearchSplit = props3.onSearchSplit) === null || _props$onSearchSplit === void 0 ? void 0 : _props$onSearchSplit.call(props3, patchLabels);
onToggleOpen(false);
ret = false;
}
if (props3.onSearch && mergedSearchValue.value !== newSearchText) {
props3.onSearch(newSearchText, {
source: fromTyping ? "typing" : "effect"
});
}
return ret;
};
var onInternalSearchSubmit = function onInternalSearchSubmit2(searchText) {
var _props$onSearch;
if (!searchText || !searchText.trim()) {
return;
}
(_props$onSearch = props3.onSearch) === null || _props$onSearch === void 0 ? void 0 : _props$onSearch.call(props3, searchText, {
source: "submit"
});
};
watch(mergedOpen, function() {
if (!mergedOpen.value && !multiple.value && props3.mode !== "combobox") {
onInternalSearch("", false, false);
}
}, {
immediate: true,
flush: "post"
});
watch(function() {
return props3.disabled;
}, function() {
if (innerOpen.value && !!props3.disabled) {
setInnerOpen(false);
}
}, {
immediate: true
});
var _useLock = useLock(), _useLock2 = _slicedToArray$2(_useLock, 2), getClearLock = _useLock2[0], setClearLock = _useLock2[1];
var onInternalKeyDown = function onInternalKeyDown2(event) {
var _props$onKeydown;
var clearLock = getClearLock();
var which = event.which;
if (which === KeyCode$1.ENTER) {
if (props3.mode !== "combobox") {
event.preventDefault();
}
if (!mergedOpen.value) {
onToggleOpen(true);
}
}
setClearLock(!!mergedSearchValue.value);
if (which === KeyCode$1.BACKSPACE && !clearLock && multiple.value && !mergedSearchValue.value && props3.displayValues.length) {
var cloneDisplayValues = _toConsumableArray(props3.displayValues);
var removedDisplayValue = null;
for (var i2 = cloneDisplayValues.length - 1; i2 >= 0; i2 -= 1) {
var current = cloneDisplayValues[i2];
if (!current.disabled) {
cloneDisplayValues.splice(i2, 1);
removedDisplayValue = current;
break;
}
}
if (removedDisplayValue) {
props3.onDisplayValuesChange(cloneDisplayValues, {
type: "remove",
values: [removedDisplayValue]
});
}
}
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
rest[_key - 1] = arguments[_key];
}
if (mergedOpen.value && listRef.value) {
var _listRef$value2;
(_listRef$value2 = listRef.value).onKeydown.apply(_listRef$value2, [event].concat(rest));
}
(_props$onKeydown = props3.onKeydown) === null || _props$onKeydown === void 0 ? void 0 : _props$onKeydown.call.apply(_props$onKeydown, [props3, event].concat(rest));
};
var onInternalKeyUp = function onInternalKeyUp2(event) {
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
rest[_key2 - 1] = arguments[_key2];
}
if (mergedOpen.value && listRef.value) {
var _listRef$value3;
(_listRef$value3 = listRef.value).onKeyup.apply(_listRef$value3, [event].concat(rest));
}
if (props3.onKeyup) {
props3.onKeyup.apply(props3, [event].concat(rest));
}
};
var onSelectorRemove = function onSelectorRemove2(val) {
var newValues = props3.displayValues.filter(function(i2) {
return i2 !== val;
});
props3.onDisplayValuesChange(newValues, {
type: "remove",
values: [val]
});
};
var focusRef = ref(false);
var onContainerFocus = function onContainerFocus2() {
setMockFocused(true);
if (!props3.disabled) {
if (props3.onFocus && !focusRef.value) {
props3.onFocus.apply(props3, arguments);
}
if (props3.showAction && props3.showAction.includes("focus")) {
onToggleOpen(true);
}
}
focusRef.value = true;
};
var onContainerBlur = function onContainerBlur2() {
setMockFocused(false, function() {
focusRef.value = false;
onToggleOpen(false);
});
if (props3.disabled) {
return;
}
var searchVal = mergedSearchValue.value;
if (searchVal) {
if (props3.mode === "tags") {
props3.onSearch(searchVal, {
source: "submit"
});
} else if (props3.mode === "multiple") {
props3.onSearch("", {
source: "blur"
});
}
}
if (props3.onBlur) {
props3.onBlur.apply(props3, arguments);
}
};
provide("VCSelectContainerEvent", {
focus: onContainerFocus,
blur: onContainerBlur
});
var activeTimeoutIds = [];
onMounted(function() {
activeTimeoutIds.forEach(function(timeoutId) {
return clearTimeout(timeoutId);
});
activeTimeoutIds.splice(0, activeTimeoutIds.length);
});
onBeforeUnmount(function() {
activeTimeoutIds.forEach(function(timeoutId) {
return clearTimeout(timeoutId);
});
activeTimeoutIds.splice(0, activeTimeoutIds.length);
});
var onInternalMouseDown = function onInternalMouseDown2(event) {
var _triggerRef$value, _props$onMousedown;
var target = event.target;
var popupElement = (_triggerRef$value = triggerRef.value) === null || _triggerRef$value === void 0 ? void 0 : _triggerRef$value.getPopupElement();
if (popupElement && popupElement.contains(target)) {
var timeoutId = setTimeout(function() {
var index2 = activeTimeoutIds.indexOf(timeoutId);
if (index2 !== -1) {
activeTimeoutIds.splice(index2, 1);
}
cancelSetMockFocused();
if (!mobile.value && !popupElement.contains(document.activeElement)) {
var _selectorRef$value3;
(_selectorRef$value3 = selectorRef.value) === null || _selectorRef$value3 === void 0 ? void 0 : _selectorRef$value3.focus();
}
});
activeTimeoutIds.push(timeoutId);
}
for (var _len3 = arguments.length, restArgs = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
restArgs[_key3 - 1] = arguments[_key3];
}
(_props$onMousedown = props3.onMousedown) === null || _props$onMousedown === void 0 ? void 0 : _props$onMousedown.call.apply(_props$onMousedown, [props3, event].concat(restArgs));
};
var containerWidth = ref(null);
var instance = getCurrentInstance();
var onPopupMouseEnter = function onPopupMouseEnter2() {
instance.update();
};
onMounted(function() {
watch(triggerOpen, function() {
if (triggerOpen.value) {
var _containerRef$value;
var newWidth = Math.ceil((_containerRef$value = containerRef.value) === null || _containerRef$value === void 0 ? void 0 : _containerRef$value.offsetWidth);
if (containerWidth.value !== newWidth && !Number.isNaN(newWidth)) {
containerWidth.value = newWidth;
}
}
}, {
immediate: true,
flush: "post"
});
});
useSelectTriggerControl([containerRef, triggerRef], triggerOpen, onToggleOpen);
useProvideBaseSelectProps(toReactive(_objectSpread2$1(_objectSpread2$1({}, toRefs(props3)), {}, {
open: mergedOpen,
triggerOpen,
showSearch: mergedShowSearch,
multiple,
toggleOpen: onToggleOpen
})));
return function() {
var _classNames2;
var _props$attrs = _objectSpread2$1(_objectSpread2$1({}, props3), attrs), prefixCls = _props$attrs.prefixCls, id = _props$attrs.id;
_props$attrs.open;
_props$attrs.defaultOpen;
var mode = _props$attrs.mode;
_props$attrs.showSearch;
_props$attrs.searchValue;
_props$attrs.onSearch;
var allowClear = _props$attrs.allowClear, clearIcon = _props$attrs.clearIcon, showArrow = _props$attrs.showArrow, inputIcon = _props$attrs.inputIcon, disabled = _props$attrs.disabled, loading = _props$attrs.loading, getInputElement = _props$attrs.getInputElement, getPopupContainer = _props$attrs.getPopupContainer, placement = _props$attrs.placement, animation = _props$attrs.animation, transitionName2 = _props$attrs.transitionName, dropdownStyle = _props$attrs.dropdownStyle, dropdownClassName = _props$attrs.dropdownClassName, dropdownMatchSelectWidth = _props$attrs.dropdownMatchSelectWidth, dropdownRender = _props$attrs.dropdownRender, dropdownAlign = _props$attrs.dropdownAlign;
_props$attrs.showAction;
var direction = _props$attrs.direction;
_props$attrs.tokenSeparators;
var tagRender = _props$attrs.tagRender, optionLabelRender = _props$attrs.optionLabelRender;
_props$attrs.onPopupScroll;
_props$attrs.onDropdownVisibleChange;
_props$attrs.onFocus;
_props$attrs.onBlur;
_props$attrs.onKeyup;
_props$attrs.onKeydown;
_props$attrs.onMousedown;
var onClear = _props$attrs.onClear, omitDomProps = _props$attrs.omitDomProps, getRawInputElement = _props$attrs.getRawInputElement, displayValues = _props$attrs.displayValues, onDisplayValuesChange = _props$attrs.onDisplayValuesChange, emptyOptions = _props$attrs.emptyOptions, activeDescendantId = _props$attrs.activeDescendantId, activeValue = _props$attrs.activeValue, OptionList2 = _props$attrs.OptionList, restProps = _objectWithoutProperties$2(_props$attrs, _excluded$k);
var customizeInputElement = mode === "combobox" && getInputElement && getInputElement() || null;
var customizeRawInputElement = typeof getRawInputElement === "function" && getRawInputElement();
var domProps = _objectSpread2$1({}, restProps);
var onTriggerVisibleChange;
if (customizeRawInputElement) {
onTriggerVisibleChange = function onTriggerVisibleChange2(newOpen) {
onToggleOpen(newOpen);
};
}
DEFAULT_OMIT_PROPS.forEach(function(propName) {
delete domProps[propName];
});
omitDomProps === null || omitDomProps === void 0 ? void 0 : omitDomProps.forEach(function(propName) {
delete domProps[propName];
});
var mergedShowArrow = showArrow !== void 0 ? showArrow : loading || !multiple.value && mode !== "combobox";
var arrowNode;
if (mergedShowArrow) {
arrowNode = createVNode(TransBtn$1, {
"class": classNames("".concat(prefixCls, "-arrow"), _defineProperty$q({}, "".concat(prefixCls, "-arrow-loading"), loading)),
"customizeIcon": inputIcon,
"customizeIconProps": {
loading,
searchValue: mergedSearchValue.value,
open: mergedOpen.value,
focused: mockFocused.value,
showSearch: mergedShowSearch.value
}
}, null);
}
var clearNode;
var onClearMouseDown = function onClearMouseDown2() {
onClear === null || onClear === void 0 ? void 0 : onClear();
onDisplayValuesChange([], {
type: "clear",
values: displayValues
});
onInternalSearch("", false, false);
};
if (!disabled && allowClear && (displayValues.length || mergedSearchValue.value)) {
clearNode = createVNode(TransBtn$1, {
"class": "".concat(prefixCls, "-clear"),
"onMousedown": onClearMouseDown,
"customizeIcon": clearIcon
}, {
default: function _default3() {
return [createTextVNode("×")];
}
});
}
var optionList = createVNode(OptionList2, {
"ref": listRef
}, _objectSpread2$1(_objectSpread2$1({}, legacyTreeSelectContext.customSlots), {}, {
option: slots.option
}));
var mergedClassName = classNames(prefixCls, attrs.class, (_classNames2 = {}, _defineProperty$q(_classNames2, "".concat(prefixCls, "-focused"), mockFocused.value), _defineProperty$q(_classNames2, "".concat(prefixCls, "-multiple"), multiple.value), _defineProperty$q(_classNames2, "".concat(prefixCls, "-single"), !multiple.value), _defineProperty$q(_classNames2, "".concat(prefixCls, "-allow-clear"), allowClear), _defineProperty$q(_classNames2, "".concat(prefixCls, "-show-arrow"), mergedShowArrow), _defineProperty$q(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _defineProperty$q(_classNames2, "".concat(prefixCls, "-loading"), loading), _defineProperty$q(_classNames2, "".concat(prefixCls, "-open"), mergedOpen.value), _defineProperty$q(_classNames2, "".concat(prefixCls, "-customize-input"), customizeInputElement), _defineProperty$q(_classNames2, "".concat(prefixCls, "-show-search"), mergedShowSearch.value), _classNames2));
var selectorNode = createVNode(SelectTrigger$1, {
"ref": triggerRef,
"disabled": disabled,
"prefixCls": prefixCls,
"visible": triggerOpen.value,
"popupElement": optionList,
"containerWidth": containerWidth.value,
"animation": animation,
"transitionName": transitionName2,
"dropdownStyle": dropdownStyle,
"dropdownClassName": dropdownClassName,
"direction": direction,
"dropdownMatchSelectWidth": dropdownMatchSelectWidth,
"dropdownRender": dropdownRender,
"dropdownAlign": dropdownAlign,
"placement": placement,
"getPopupContainer": getPopupContainer,
"empty": emptyOptions,
"getTriggerDOMNode": function getTriggerDOMNode() {
return selectorDomRef.current;
},
"onPopupVisibleChange": onTriggerVisibleChange,
"onPopupMouseEnter": onPopupMouseEnter
}, {
default: function _default3() {
return customizeRawInputElement ? isValidElement(customizeRawInputElement) && cloneElement(customizeRawInputElement, {
ref: selectorDomRef
}, false, true) : createVNode(Selector$1, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"domRef": selectorDomRef,
"prefixCls": prefixCls,
"inputElement": customizeInputElement,
"ref": selectorRef,
"id": id,
"showSearch": mergedShowSearch.value,
"mode": mode,
"activeDescendantId": activeDescendantId,
"tagRender": tagRender,
"optionLabelRender": optionLabelRender,
"values": displayValues,
"open": mergedOpen.value,
"onToggleOpen": onToggleOpen,
"activeValue": activeValue,
"searchValue": mergedSearchValue.value,
"onSearch": onInternalSearch,
"onSearchSubmit": onInternalSearchSubmit,
"onRemove": onSelectorRemove,
"tokenWithEnter": tokenWithEnter.value
}), null);
}
});
var renderNode;
if (customizeRawInputElement) {
renderNode = selectorNode;
} else {
renderNode = createVNode("div", _objectSpread2$1(_objectSpread2$1({}, domProps), {}, {
"class": mergedClassName,
"ref": containerRef,
"onMousedown": onInternalMouseDown,
"onKeydown": onInternalKeyDown,
"onKeyup": onInternalKeyUp
}), [mockFocused.value && !mergedOpen.value && createVNode("span", {
"style": {
width: 0,
height: 0,
position: "absolute",
overflow: "hidden",
opacity: 0
},
"aria-live": "polite"
}, ["".concat(displayValues.map(function(_ref2) {
var label = _ref2.label, value2 = _ref2.value;
return ["number", "string"].includes(_typeof$2(label)) ? label : value2;
}).join(", "))]), selectorNode, arrowNode, clearNode]);
}
return renderNode;
};
}
});
var Filter = function Filter2(_ref, _ref2) {
var _slots$default;
var height = _ref.height, offset3 = _ref.offset, prefixCls = _ref.prefixCls, onInnerResize = _ref.onInnerResize;
var slots = _ref2.slots;
var outerStyle = {};
var innerStyle = {
display: "flex",
flexDirection: "column"
};
if (offset3 !== void 0) {
outerStyle = {
height: "".concat(height, "px"),
position: "relative",
overflow: "hidden"
};
innerStyle = _objectSpread2$1(_objectSpread2$1({}, innerStyle), {}, {
transform: "translateY(".concat(offset3, "px)"),
position: "absolute",
left: 0,
right: 0,
top: 0
});
}
return createVNode("div", {
"style": outerStyle
}, [createVNode(ResizeObserver$1, {
"onResize": function onResize(_ref3) {
var offsetHeight = _ref3.offsetHeight;
if (offsetHeight && onInnerResize) {
onInnerResize();
}
}
}, {
default: function _default3() {
return [createVNode("div", {
"style": innerStyle,
"class": classNames(_defineProperty$q({}, "".concat(prefixCls, "-holder-inner"), prefixCls))
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)])];
}
})]);
};
Filter.displayName = "Filter";
Filter.inheritAttrs = false;
Filter.props = {
prefixCls: String,
/** Virtual filler height. Should be `count * itemMinHeight` */
height: Number,
/** Set offset of visible items. Should be the top of start item position */
offset: Number,
onInnerResize: Function
};
const Filler = Filter;
var Item = function Item2(_ref, _ref2) {
var _slots$default;
var setRef = _ref.setRef;
var slots = _ref2.slots;
var children = flattenChildren((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots));
return children && children.length ? cloneVNode(children[0], {
ref: setRef
}) : children;
};
Item.props = {
setRef: {
type: Function,
default: function _default() {
}
}
};
const Item$1 = Item;
var MIN_SIZE = 20;
function getPageY(e2) {
return "touches" in e2 ? e2.touches[0].pageY : e2.pageY;
}
const ScrollBar = defineComponent({
compatConfig: {
MODE: 3
},
name: "ScrollBar",
inheritAttrs: false,
props: {
prefixCls: String,
scrollTop: Number,
scrollHeight: Number,
height: Number,
count: Number,
onScroll: {
type: Function
},
onStartMove: {
type: Function
},
onStopMove: {
type: Function
}
},
setup: function setup23() {
return {
moveRaf: null,
scrollbarRef: createRef(),
thumbRef: createRef(),
visibleTimeout: null,
state: reactive({
dragging: false,
pageY: null,
startTop: null,
visible: false
})
};
},
watch: {
scrollTop: {
handler: function handler() {
this.delayHidden();
},
flush: "post"
}
},
mounted: function mounted2() {
var _this$scrollbarRef$cu, _this$thumbRef$curren;
(_this$scrollbarRef$cu = this.scrollbarRef.current) === null || _this$scrollbarRef$cu === void 0 ? void 0 : _this$scrollbarRef$cu.addEventListener("touchstart", this.onScrollbarTouchStart, supportsPassive$1 ? {
passive: false
} : false);
(_this$thumbRef$curren = this.thumbRef.current) === null || _this$thumbRef$curren === void 0 ? void 0 : _this$thumbRef$curren.addEventListener("touchstart", this.onMouseDown, supportsPassive$1 ? {
passive: false
} : false);
},
beforeUnmount: function beforeUnmount2() {
this.removeEvents();
clearTimeout(this.visibleTimeout);
},
methods: {
delayHidden: function delayHidden() {
var _this = this;
clearTimeout(this.visibleTimeout);
this.state.visible = true;
this.visibleTimeout = setTimeout(function() {
_this.state.visible = false;
}, 2e3);
},
onScrollbarTouchStart: function onScrollbarTouchStart(e2) {
e2.preventDefault();
},
onContainerMouseDown: function onContainerMouseDown(e2) {
e2.stopPropagation();
e2.preventDefault();
},
// ======================= Clean =======================
patchEvents: function patchEvents() {
window.addEventListener("mousemove", this.onMouseMove);
window.addEventListener("mouseup", this.onMouseUp);
this.thumbRef.current.addEventListener("touchmove", this.onMouseMove, supportsPassive$1 ? {
passive: false
} : false);
this.thumbRef.current.addEventListener("touchend", this.onMouseUp);
},
removeEvents: function removeEvents() {
window.removeEventListener("mousemove", this.onMouseMove);
window.removeEventListener("mouseup", this.onMouseUp);
this.scrollbarRef.current.removeEventListener("touchstart", this.onScrollbarTouchStart, supportsPassive$1 ? {
passive: false
} : false);
if (this.thumbRef.current) {
this.thumbRef.current.removeEventListener("touchstart", this.onMouseDown, supportsPassive$1 ? {
passive: false
} : false);
this.thumbRef.current.removeEventListener("touchmove", this.onMouseMove, supportsPassive$1 ? {
passive: false
} : false);
this.thumbRef.current.removeEventListener("touchend", this.onMouseUp);
}
wrapperRaf.cancel(this.moveRaf);
},
// ======================= Thumb =======================
onMouseDown: function onMouseDown(e2) {
var onStartMove = this.$props.onStartMove;
_extends(this.state, {
dragging: true,
pageY: getPageY(e2),
startTop: this.getTop()
});
onStartMove();
this.patchEvents();
e2.stopPropagation();
e2.preventDefault();
},
onMouseMove: function onMouseMove2(e2) {
var _this$state = this.state, dragging = _this$state.dragging, pageY = _this$state.pageY, startTop = _this$state.startTop;
var onScroll = this.$props.onScroll;
wrapperRaf.cancel(this.moveRaf);
if (dragging) {
var offsetY = getPageY(e2) - pageY;
var newTop = startTop + offsetY;
var enableScrollRange = this.getEnableScrollRange();
var enableHeightRange = this.getEnableHeightRange();
var ptg = enableHeightRange ? newTop / enableHeightRange : 0;
var newScrollTop = Math.ceil(ptg * enableScrollRange);
this.moveRaf = wrapperRaf(function() {
onScroll(newScrollTop);
});
}
},
onMouseUp: function onMouseUp() {
var onStopMove = this.$props.onStopMove;
this.state.dragging = false;
onStopMove();
this.removeEvents();
},
// ===================== Calculate =====================
getSpinHeight: function getSpinHeight() {
var _this$$props = this.$props, height = _this$$props.height, count = _this$$props.count;
var baseHeight = height / count * 10;
baseHeight = Math.max(baseHeight, MIN_SIZE);
baseHeight = Math.min(baseHeight, height / 2);
return Math.floor(baseHeight);
},
getEnableScrollRange: function getEnableScrollRange() {
var _this$$props2 = this.$props, scrollHeight = _this$$props2.scrollHeight, height = _this$$props2.height;
return scrollHeight - height || 0;
},
getEnableHeightRange: function getEnableHeightRange() {
var height = this.$props.height;
var spinHeight = this.getSpinHeight();
return height - spinHeight || 0;
},
getTop: function getTop() {
var scrollTop2 = this.$props.scrollTop;
var enableScrollRange = this.getEnableScrollRange();
var enableHeightRange = this.getEnableHeightRange();
if (scrollTop2 === 0 || enableScrollRange === 0) {
return 0;
}
var ptg = scrollTop2 / enableScrollRange;
return ptg * enableHeightRange;
},
// Not show scrollbar when height is large than scrollHeight
showScroll: function showScroll() {
var _this$$props3 = this.$props, height = _this$$props3.height, scrollHeight = _this$$props3.scrollHeight;
return scrollHeight > height;
}
},
render: function render3() {
var _this$state2 = this.state, dragging = _this$state2.dragging, visible = _this$state2.visible;
var prefixCls = this.$props.prefixCls;
var spinHeight = this.getSpinHeight() + "px";
var top = this.getTop() + "px";
var canScroll = this.showScroll();
var mergedVisible = canScroll && visible;
return createVNode("div", {
"ref": this.scrollbarRef,
"class": classNames("".concat(prefixCls, "-scrollbar"), _defineProperty$q({}, "".concat(prefixCls, "-scrollbar-show"), canScroll)),
"style": {
width: "8px",
top: 0,
bottom: 0,
right: 0,
position: "absolute",
display: mergedVisible ? void 0 : "none"
},
"onMousedown": this.onContainerMouseDown,
"onMousemove": this.delayHidden
}, [createVNode("div", {
"ref": this.thumbRef,
"class": classNames("".concat(prefixCls, "-scrollbar-thumb"), _defineProperty$q({}, "".concat(prefixCls, "-scrollbar-thumb-moving"), dragging)),
"style": {
width: "100%",
height: spinHeight,
top,
left: 0,
position: "absolute",
background: "rgba(0, 0, 0, 0.5)",
borderRadius: "99px",
cursor: "pointer",
userSelect: "none"
},
"onMousedown": this.onMouseDown
}, null)]);
}
});
function useHeights(mergedData, getKey2, onItemAdd, onItemRemove) {
var instance = /* @__PURE__ */ new Map();
var heights = /* @__PURE__ */ new Map();
var updatedMark = ref(Symbol("update"));
watch(mergedData, function() {
updatedMark.value = Symbol("update");
});
var collectRaf = void 0;
function cancelRaf() {
wrapperRaf.cancel(collectRaf);
}
function collectHeight() {
cancelRaf();
collectRaf = wrapperRaf(function() {
instance.forEach(function(element, key2) {
if (element && element.offsetParent) {
var offsetHeight = element.offsetHeight;
if (heights.get(key2) !== offsetHeight) {
updatedMark.value = Symbol("update");
heights.set(key2, element.offsetHeight);
}
}
});
});
}
function setInstance(item, ins) {
var key2 = getKey2(item);
var origin = instance.get(key2);
if (ins) {
instance.set(key2, ins.$el || ins);
collectHeight();
} else {
instance.delete(key2);
}
if (!origin !== !ins) {
if (ins) {
onItemAdd === null || onItemAdd === void 0 ? void 0 : onItemAdd(item);
} else {
onItemRemove === null || onItemRemove === void 0 ? void 0 : onItemRemove(item);
}
}
}
onUnmounted(function() {
cancelRaf();
});
return [setInstance, collectHeight, heights, updatedMark];
}
function useScrollTo(containerRef, mergedData, heights, props3, getKey2, collectHeight, syncScrollTop, triggerFlash) {
var scroll;
return function(arg) {
if (arg === null || arg === void 0) {
triggerFlash();
return;
}
wrapperRaf.cancel(scroll);
var data2 = mergedData.value;
var itemHeight = props3.itemHeight;
if (typeof arg === "number") {
syncScrollTop(arg);
} else if (arg && _typeof$2(arg) === "object") {
var index2;
var align = arg.align;
if ("index" in arg) {
index2 = arg.index;
} else {
index2 = data2.findIndex(function(item) {
return getKey2(item) === arg.key;
});
}
var _arg$offset = arg.offset, offset3 = _arg$offset === void 0 ? 0 : _arg$offset;
var syncScroll = function syncScroll2(times, targetAlign) {
if (times < 0 || !containerRef.value)
return;
var height = containerRef.value.clientHeight;
var needCollectHeight = false;
var newTargetAlign = targetAlign;
if (height) {
var mergedAlign = targetAlign || align;
var stackTop = 0;
var itemTop = 0;
var itemBottom = 0;
var maxLen = Math.min(data2.length, index2);
for (var i2 = 0; i2 <= maxLen; i2 += 1) {
var key2 = getKey2(data2[i2]);
itemTop = stackTop;
var cacheHeight = heights.get(key2);
itemBottom = itemTop + (cacheHeight === void 0 ? itemHeight : cacheHeight);
stackTop = itemBottom;
if (i2 === index2 && cacheHeight === void 0) {
needCollectHeight = true;
}
}
var scrollTop2 = containerRef.value.scrollTop;
var targetTop = null;
switch (mergedAlign) {
case "top":
targetTop = itemTop - offset3;
break;
case "bottom":
targetTop = itemBottom - height + offset3;
break;
default: {
var scrollBottom = scrollTop2 + height;
if (itemTop < scrollTop2) {
newTargetAlign = "top";
} else if (itemBottom > scrollBottom) {
newTargetAlign = "bottom";
}
}
}
if (targetTop !== null && targetTop !== scrollTop2) {
syncScrollTop(targetTop);
}
}
scroll = wrapperRaf(function() {
if (needCollectHeight) {
collectHeight();
}
syncScroll2(times - 1, newTargetAlign);
}, 2);
};
syncScroll(5);
}
};
}
var isFF = (typeof navigator === "undefined" ? "undefined" : _typeof$2(navigator)) === "object" && /Firefox/i.test(navigator.userAgent);
const isFF$1 = isFF;
const useOriginScroll = function(isScrollAtTop, isScrollAtBottom) {
var lock = false;
var lockTimeout = null;
function lockScroll() {
clearTimeout(lockTimeout);
lock = true;
lockTimeout = setTimeout(function() {
lock = false;
}, 50);
}
return function(deltaY) {
var smoothOffset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
var originScroll = (
// Pass origin wheel when on the top
deltaY < 0 && isScrollAtTop.value || // Pass origin wheel when on the bottom
deltaY > 0 && isScrollAtBottom.value
);
if (smoothOffset && originScroll) {
clearTimeout(lockTimeout);
lock = false;
} else if (!originScroll || lock) {
lockScroll();
}
return !lock && originScroll;
};
};
function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, onWheelDelta) {
var offsetRef = 0;
var nextFrame = null;
var wheelValue = null;
var isMouseScroll = false;
var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom);
function onWheel(event) {
if (!inVirtual.value)
return;
wrapperRaf.cancel(nextFrame);
var deltaY = event.deltaY;
offsetRef += deltaY;
wheelValue = deltaY;
if (originScroll(deltaY))
return;
if (!isFF$1) {
event.preventDefault();
}
nextFrame = wrapperRaf(function() {
var patchMultiple = isMouseScroll ? 10 : 1;
onWheelDelta(offsetRef * patchMultiple);
offsetRef = 0;
});
}
function onFireFoxScroll(event) {
if (!inVirtual.value)
return;
isMouseScroll = event.detail === wheelValue;
}
return [onWheel, onFireFoxScroll];
}
var SMOOTH_PTG = 14 / 15;
function useMobileTouchMove(inVirtual, listRef, callback) {
var touched = false;
var touchY = 0;
var element = null;
var interval = null;
var cleanUpEvents = function cleanUpEvents2() {
if (element) {
element.removeEventListener("touchmove", onTouchMove);
element.removeEventListener("touchend", onTouchEnd);
}
};
var onTouchMove = function onTouchMove2(e2) {
if (touched) {
var currentY = Math.ceil(e2.touches[0].pageY);
var offsetY = touchY - currentY;
touchY = currentY;
if (callback(offsetY)) {
e2.preventDefault();
}
clearInterval(interval);
interval = setInterval(function() {
offsetY *= SMOOTH_PTG;
if (!callback(offsetY, true) || Math.abs(offsetY) <= 0.1) {
clearInterval(interval);
}
}, 16);
}
};
var onTouchEnd = function onTouchEnd2() {
touched = false;
cleanUpEvents();
};
var onTouchStart = function onTouchStart2(e2) {
cleanUpEvents();
if (e2.touches.length === 1 && !touched) {
touched = true;
touchY = Math.ceil(e2.touches[0].pageY);
element = e2.target;
element.addEventListener("touchmove", onTouchMove, {
passive: false
});
element.addEventListener("touchend", onTouchEnd);
}
};
var noop2 = function noop3() {
};
onMounted(function() {
document.addEventListener("touchmove", noop2, {
passive: false
});
watch(inVirtual, function(val) {
listRef.value.removeEventListener("touchstart", onTouchStart);
cleanUpEvents();
clearInterval(interval);
if (val) {
listRef.value.addEventListener("touchstart", onTouchStart, {
passive: false
});
}
}, {
immediate: true
});
});
onBeforeUnmount(function() {
document.removeEventListener("touchmove", noop2);
});
}
var _excluded$j = ["prefixCls", "height", "itemHeight", "fullHeight", "data", "itemKey", "virtual", "component", "onScroll", "children", "style", "class"];
var EMPTY_DATA = [];
var ScrollStyle = {
overflowY: "auto",
overflowAnchor: "none"
};
function renderChildren(list, startIndex, endIndex, setNodeRef, renderFunc, _ref) {
var getKey2 = _ref.getKey;
return list.slice(startIndex, endIndex + 1).map(function(item, index2) {
var eleIndex = startIndex + index2;
var node = renderFunc(item, eleIndex, {
// style: status === 'MEASURE_START' ? { visibility: 'hidden' } : {},
});
var key2 = getKey2(item);
return createVNode(Item$1, {
"key": key2,
"setRef": function setRef(ele) {
return setNodeRef(item, ele);
}
}, {
default: function _default3() {
return [node];
}
});
});
}
var List = defineComponent({
compatConfig: {
MODE: 3
},
name: "List",
inheritAttrs: false,
props: {
prefixCls: String,
data: PropTypes$1.array,
height: Number,
itemHeight: Number,
/** If not match virtual scroll condition, Set List still use height of container. */
fullHeight: {
type: Boolean,
default: void 0
},
itemKey: {
type: [String, Number, Function],
required: true
},
component: {
type: [String, Object]
},
/** Set `false` will always use real scroll instead of virtual one */
virtual: {
type: Boolean,
default: void 0
},
children: Function,
onScroll: Function,
onMousedown: Function,
onMouseenter: Function,
onVisibleChange: Function
},
setup: function setup24(props3, _ref2) {
var expose = _ref2.expose;
var useVirtual = computed(function() {
var height = props3.height, itemHeight = props3.itemHeight, virtual = props3.virtual;
return !!(virtual !== false && height && itemHeight);
});
var inVirtual = computed(function() {
var height = props3.height, itemHeight = props3.itemHeight, data3 = props3.data;
return useVirtual.value && data3 && itemHeight * data3.length > height;
});
var state = reactive({
scrollTop: 0,
scrollMoving: false
});
var data2 = computed(function() {
return props3.data || EMPTY_DATA;
});
var mergedData = shallowRef([]);
watch(data2, function() {
mergedData.value = toRaw(data2.value).slice();
}, {
immediate: true
});
var itemKey = shallowRef(function(_item) {
return void 0;
});
watch(function() {
return props3.itemKey;
}, function(val) {
if (typeof val === "function") {
itemKey.value = val;
} else {
itemKey.value = function(item) {
return item === null || item === void 0 ? void 0 : item[val];
};
}
}, {
immediate: true
});
var componentRef = ref();
var fillerInnerRef = ref();
var scrollBarRef = ref();
var getKey2 = function getKey3(item) {
return itemKey.value(item);
};
var sharedConfig = {
getKey: getKey2
};
function syncScrollTop(newTop) {
var value2;
if (typeof newTop === "function") {
value2 = newTop(state.scrollTop);
} else {
value2 = newTop;
}
var alignedTop = keepInRange(value2);
if (componentRef.value) {
componentRef.value.scrollTop = alignedTop;
}
state.scrollTop = alignedTop;
}
var _useHeights = useHeights(mergedData, getKey2, null, null), _useHeights2 = _slicedToArray$2(_useHeights, 4), setInstance = _useHeights2[0], collectHeight = _useHeights2[1], heights = _useHeights2[2], updatedMark = _useHeights2[3];
var calRes = reactive({
scrollHeight: void 0,
start: 0,
end: 0,
offset: void 0
});
var offsetHeight = ref(0);
onMounted(function() {
nextTick(function() {
var _fillerInnerRef$value;
offsetHeight.value = ((_fillerInnerRef$value = fillerInnerRef.value) === null || _fillerInnerRef$value === void 0 ? void 0 : _fillerInnerRef$value.offsetHeight) || 0;
});
});
onUpdated(function() {
nextTick(function() {
var _fillerInnerRef$value2;
offsetHeight.value = ((_fillerInnerRef$value2 = fillerInnerRef.value) === null || _fillerInnerRef$value2 === void 0 ? void 0 : _fillerInnerRef$value2.offsetHeight) || 0;
});
});
watch([useVirtual, mergedData], function() {
if (!useVirtual.value) {
_extends(calRes, {
scrollHeight: void 0,
start: 0,
end: mergedData.value.length - 1,
offset: void 0
});
}
}, {
immediate: true
});
watch([useVirtual, mergedData, offsetHeight, inVirtual], function() {
if (useVirtual.value && !inVirtual.value) {
_extends(calRes, {
scrollHeight: offsetHeight.value,
start: 0,
end: mergedData.value.length - 1,
offset: void 0
});
}
if (componentRef.value) {
state.scrollTop = componentRef.value.scrollTop;
}
}, {
immediate: true
});
watch([inVirtual, useVirtual, function() {
return state.scrollTop;
}, mergedData, updatedMark, function() {
return props3.height;
}, offsetHeight], function() {
if (!useVirtual.value || !inVirtual.value) {
return;
}
var itemTop = 0;
var startIndex;
var startOffset;
var endIndex;
var dataLen = mergedData.value.length;
var data3 = mergedData.value;
var scrollTop2 = state.scrollTop;
var itemHeight = props3.itemHeight, height = props3.height;
var scrollTopHeight = scrollTop2 + height;
for (var i2 = 0; i2 < dataLen; i2 += 1) {
var item = data3[i2];
var key2 = getKey2(item);
var cacheHeight = heights.get(key2);
if (cacheHeight === void 0) {
cacheHeight = itemHeight;
}
var currentItemBottom = itemTop + cacheHeight;
if (startIndex === void 0 && currentItemBottom >= scrollTop2) {
startIndex = i2;
startOffset = itemTop;
}
if (endIndex === void 0 && currentItemBottom > scrollTopHeight) {
endIndex = i2;
}
itemTop = currentItemBottom;
}
if (startIndex === void 0) {
startIndex = 0;
startOffset = 0;
endIndex = Math.ceil(height / itemHeight);
}
if (endIndex === void 0) {
endIndex = dataLen - 1;
}
endIndex = Math.min(endIndex + 1, dataLen);
_extends(calRes, {
scrollHeight: itemTop,
start: startIndex,
end: endIndex,
offset: startOffset
});
}, {
immediate: true
});
var maxScrollHeight = computed(function() {
return calRes.scrollHeight - props3.height;
});
function keepInRange(newScrollTop) {
var newTop = newScrollTop;
if (!Number.isNaN(maxScrollHeight.value)) {
newTop = Math.min(newTop, maxScrollHeight.value);
}
newTop = Math.max(newTop, 0);
return newTop;
}
var isScrollAtTop = computed(function() {
return state.scrollTop <= 0;
});
var isScrollAtBottom = computed(function() {
return state.scrollTop >= maxScrollHeight.value;
});
var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom);
function onScrollBar(newScrollTop) {
var newTop = newScrollTop;
syncScrollTop(newTop);
}
function onFallbackScroll(e2) {
var _props$onScroll;
var newScrollTop = e2.currentTarget.scrollTop;
if (newScrollTop !== state.scrollTop) {
syncScrollTop(newScrollTop);
}
(_props$onScroll = props3.onScroll) === null || _props$onScroll === void 0 ? void 0 : _props$onScroll.call(props3, e2);
}
var _useFrameWheel = useFrameWheel(useVirtual, isScrollAtTop, isScrollAtBottom, function(offsetY) {
syncScrollTop(function(top) {
var newTop = top + offsetY;
return newTop;
});
}), _useFrameWheel2 = _slicedToArray$2(_useFrameWheel, 2), onRawWheel = _useFrameWheel2[0], onFireFoxScroll = _useFrameWheel2[1];
useMobileTouchMove(useVirtual, componentRef, function(deltaY, smoothOffset) {
if (originScroll(deltaY, smoothOffset)) {
return false;
}
onRawWheel({
preventDefault: function preventDefault() {
},
deltaY
});
return true;
});
function onMozMousePixelScroll(e2) {
if (useVirtual.value) {
e2.preventDefault();
}
}
var removeEventListener2 = function removeEventListener3() {
if (componentRef.value) {
componentRef.value.removeEventListener("wheel", onRawWheel, supportsPassive$1 ? {
passive: false
} : false);
componentRef.value.removeEventListener("DOMMouseScroll", onFireFoxScroll);
componentRef.value.removeEventListener("MozMousePixelScroll", onMozMousePixelScroll);
}
};
watchEffect(function() {
nextTick(function() {
if (componentRef.value) {
removeEventListener2();
componentRef.value.addEventListener("wheel", onRawWheel, supportsPassive$1 ? {
passive: false
} : false);
componentRef.value.addEventListener("DOMMouseScroll", onFireFoxScroll);
componentRef.value.addEventListener("MozMousePixelScroll", onMozMousePixelScroll);
}
});
});
onBeforeUnmount(function() {
removeEventListener2();
});
var scrollTo2 = useScrollTo(componentRef, mergedData, heights, props3, getKey2, collectHeight, syncScrollTop, function() {
var _scrollBarRef$value;
(_scrollBarRef$value = scrollBarRef.value) === null || _scrollBarRef$value === void 0 ? void 0 : _scrollBarRef$value.delayHidden();
});
expose({
scrollTo: scrollTo2
});
var componentStyle = computed(function() {
var cs = null;
if (props3.height) {
cs = _objectSpread2$1(_defineProperty$q({}, props3.fullHeight ? "height" : "maxHeight", props3.height + "px"), ScrollStyle);
if (useVirtual.value) {
cs.overflowY = "hidden";
if (state.scrollMoving) {
cs.pointerEvents = "none";
}
}
}
return cs;
});
watch([function() {
return calRes.start;
}, function() {
return calRes.end;
}, mergedData], function() {
if (props3.onVisibleChange) {
var renderList2 = mergedData.value.slice(calRes.start, calRes.end + 1);
props3.onVisibleChange(renderList2, mergedData.value);
}
}, {
flush: "post"
});
return {
state,
mergedData,
componentStyle,
onFallbackScroll,
onScrollBar,
componentRef,
useVirtual,
calRes,
collectHeight,
setInstance,
sharedConfig,
scrollBarRef,
fillerInnerRef
};
},
render: function render4() {
var _this = this;
var _this$$props$this$$at = _objectSpread2$1(_objectSpread2$1({}, this.$props), this.$attrs), _this$$props$this$$at2 = _this$$props$this$$at.prefixCls, prefixCls = _this$$props$this$$at2 === void 0 ? "rc-virtual-list" : _this$$props$this$$at2, height = _this$$props$this$$at.height;
_this$$props$this$$at.itemHeight;
_this$$props$this$$at.fullHeight;
_this$$props$this$$at.data;
_this$$props$this$$at.itemKey;
_this$$props$this$$at.virtual;
var _this$$props$this$$at3 = _this$$props$this$$at.component, Component = _this$$props$this$$at3 === void 0 ? "div" : _this$$props$this$$at3;
_this$$props$this$$at.onScroll;
var _this$$props$this$$at4 = _this$$props$this$$at.children, children = _this$$props$this$$at4 === void 0 ? this.$slots.default : _this$$props$this$$at4, style = _this$$props$this$$at.style, className = _this$$props$this$$at.class, restProps = _objectWithoutProperties$2(_this$$props$this$$at, _excluded$j);
var mergedClassName = classNames(prefixCls, className);
var scrollTop2 = this.state.scrollTop;
var _this$calRes = this.calRes, scrollHeight = _this$calRes.scrollHeight, offset3 = _this$calRes.offset, start = _this$calRes.start, end = _this$calRes.end;
var componentStyle = this.componentStyle, onFallbackScroll = this.onFallbackScroll, onScrollBar = this.onScrollBar, useVirtual = this.useVirtual, collectHeight = this.collectHeight, sharedConfig = this.sharedConfig, setInstance = this.setInstance, mergedData = this.mergedData;
return createVNode("div", _objectSpread2$1({
"style": _objectSpread2$1(_objectSpread2$1({}, style), {}, {
position: "relative"
}),
"class": mergedClassName
}, restProps), [createVNode(Component, {
"class": "".concat(prefixCls, "-holder"),
"style": componentStyle,
"ref": "componentRef",
"onScroll": onFallbackScroll
}, {
default: function _default3() {
return [createVNode(Filler, {
"prefixCls": prefixCls,
"height": scrollHeight,
"offset": offset3,
"onInnerResize": collectHeight,
"ref": "fillerInnerRef"
}, {
default: function _default4() {
return renderChildren(mergedData, start, end, setInstance, children, sharedConfig);
}
})];
}
}), useVirtual && createVNode(ScrollBar, {
"ref": "scrollBarRef",
"prefixCls": prefixCls,
"scrollTop": scrollTop2,
"height": height,
"scrollHeight": scrollHeight,
"count": mergedData.length,
"onScroll": onScrollBar,
"onStartMove": function onStartMove() {
_this.state.scrollMoving = true;
},
"onStopMove": function onStopMove() {
_this.state.scrollMoving = false;
}
}, null)]);
}
});
const List$1 = List;
function useMemo(getValue2, condition, shouldUpdate) {
var cacheRef = ref(getValue2());
watch(condition, function(next2, pre) {
if (shouldUpdate) {
if (shouldUpdate(next2, pre)) {
cacheRef.value = getValue2();
}
} else {
cacheRef.value = getValue2();
}
});
return cacheRef;
}
function isPlatformMac() {
return /(mac\sos|macintosh)/i.test(navigator.appVersion);
}
var SelectContextKey = Symbol("SelectContextKey");
function useProvideSelectProps(props3) {
return provide(SelectContextKey, props3);
}
function useSelectProps() {
return inject(SelectContextKey, {});
}
var _excluded$i = ["disabled", "title", "children", "style", "class", "className"];
function isTitleType(content) {
return typeof content === "string" || typeof content === "number";
}
var OptionList = defineComponent({
compatConfig: {
MODE: 3
},
name: "OptionList",
inheritAttrs: false,
slots: ["option"],
setup: function setup25(_2, _ref) {
var expose = _ref.expose, slots = _ref.slots;
var baseProps2 = useBaseProps();
var props3 = useSelectProps();
var itemPrefixCls = computed(function() {
return "".concat(baseProps2.prefixCls, "-item");
});
var memoFlattenOptions = useMemo(function() {
return props3.flattenOptions;
}, [function() {
return baseProps2.open;
}, function() {
return props3.flattenOptions;
}], function(next2) {
return next2[0];
});
var listRef = createRef();
var onListMouseDown = function onListMouseDown2(event) {
event.preventDefault();
};
var scrollIntoView = function scrollIntoView2(args) {
if (listRef.current) {
listRef.current.scrollTo(typeof args === "number" ? {
index: args
} : args);
}
};
var getEnabledActiveIndex = function getEnabledActiveIndex2(index2) {
var offset3 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
var len = memoFlattenOptions.value.length;
for (var i2 = 0; i2 < len; i2 += 1) {
var current = (index2 + i2 * offset3 + len) % len;
var _memoFlattenOptions$v = memoFlattenOptions.value[current], group = _memoFlattenOptions$v.group, data2 = _memoFlattenOptions$v.data;
if (!group && !data2.disabled) {
return current;
}
}
return -1;
};
var state = reactive({
activeIndex: getEnabledActiveIndex(0)
});
var setActive = function setActive2(index2) {
var fromKeyboard = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
state.activeIndex = index2;
var info = {
source: fromKeyboard ? "keyboard" : "mouse"
};
var flattenItem = memoFlattenOptions.value[index2];
if (!flattenItem) {
props3.onActiveValue(null, -1, info);
return;
}
props3.onActiveValue(flattenItem.value, index2, info);
};
watch([function() {
return memoFlattenOptions.value.length;
}, function() {
return baseProps2.searchValue;
}], function() {
setActive(props3.defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1);
}, {
immediate: true
});
var isSelected = function isSelected2(value2) {
return props3.rawValues.has(value2) && baseProps2.mode !== "combobox";
};
watch([function() {
return baseProps2.open;
}, function() {
return baseProps2.searchValue;
}], function() {
if (!baseProps2.multiple && baseProps2.open && props3.rawValues.size === 1) {
var value2 = Array.from(props3.rawValues)[0];
var index2 = toRaw(memoFlattenOptions.value).findIndex(function(_ref2) {
var data2 = _ref2.data;
return data2[props3.fieldNames.value] === value2;
});
if (index2 !== -1) {
setActive(index2);
nextTick(function() {
scrollIntoView(index2);
});
}
}
if (baseProps2.open) {
nextTick(function() {
var _listRef$current;
(_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.scrollTo(void 0);
});
}
}, {
immediate: true,
flush: "post"
});
var onSelectValue = function onSelectValue2(value2) {
if (value2 !== void 0) {
props3.onSelect(value2, {
selected: !props3.rawValues.has(value2)
});
}
if (!baseProps2.multiple) {
baseProps2.toggleOpen(false);
}
};
var getLabel = function getLabel2(item) {
return typeof item.label === "function" ? item.label() : item.label;
};
function renderItem(index2) {
var item = memoFlattenOptions.value[index2];
if (!item)
return null;
var itemData = item.data || {};
var value2 = itemData.value;
var group = item.group;
var attrs = pickAttrs(itemData, true);
var mergedLabel = getLabel(item);
return item ? createVNode("div", _objectSpread2$1(_objectSpread2$1({
"aria-label": typeof mergedLabel === "string" && !group ? mergedLabel : null
}, attrs), {}, {
"key": index2,
"role": group ? "presentation" : "option",
"id": "".concat(baseProps2.id, "_list_").concat(index2),
"aria-selected": isSelected(value2)
}), [value2]) : null;
}
var onKeydown = function onKeydown2(event) {
var which = event.which, ctrlKey = event.ctrlKey;
switch (which) {
case KeyCode$1.N:
case KeyCode$1.P:
case KeyCode$1.UP:
case KeyCode$1.DOWN: {
var offset3 = 0;
if (which === KeyCode$1.UP) {
offset3 = -1;
} else if (which === KeyCode$1.DOWN) {
offset3 = 1;
} else if (isPlatformMac() && ctrlKey) {
if (which === KeyCode$1.N) {
offset3 = 1;
} else if (which === KeyCode$1.P) {
offset3 = -1;
}
}
if (offset3 !== 0) {
var nextActiveIndex = getEnabledActiveIndex(state.activeIndex + offset3, offset3);
scrollIntoView(nextActiveIndex);
setActive(nextActiveIndex, true);
}
break;
}
case KeyCode$1.ENTER: {
var item = memoFlattenOptions.value[state.activeIndex];
if (item && !item.data.disabled) {
onSelectValue(item.value);
} else {
onSelectValue(void 0);
}
if (baseProps2.open) {
event.preventDefault();
}
break;
}
case KeyCode$1.ESC: {
baseProps2.toggleOpen(false);
if (baseProps2.open) {
event.stopPropagation();
}
}
}
};
var onKeyup = function onKeyup2() {
};
var scrollTo2 = function scrollTo3(index2) {
scrollIntoView(index2);
};
expose({
onKeydown,
onKeyup,
scrollTo: scrollTo2
});
return function() {
var id = baseProps2.id, notFoundContent = baseProps2.notFoundContent, onPopupScroll = baseProps2.onPopupScroll;
var menuItemSelectedIcon = props3.menuItemSelectedIcon, fieldNames = props3.fieldNames, virtual = props3.virtual, listHeight = props3.listHeight, listItemHeight = props3.listItemHeight;
var renderOption = slots.option;
var activeIndex = state.activeIndex;
var omitFieldNameList = Object.keys(fieldNames).map(function(key2) {
return fieldNames[key2];
});
if (memoFlattenOptions.value.length === 0) {
return createVNode("div", {
"role": "listbox",
"id": "".concat(id, "_list"),
"class": "".concat(itemPrefixCls.value, "-empty"),
"onMousedown": onListMouseDown
}, [notFoundContent]);
}
return createVNode(Fragment, null, [createVNode("div", {
"role": "listbox",
"id": "".concat(id, "_list"),
"style": {
height: 0,
width: 0,
overflow: "hidden"
}
}, [renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)]), createVNode(List$1, {
"itemKey": "key",
"ref": listRef,
"data": memoFlattenOptions.value,
"height": listHeight,
"itemHeight": listItemHeight,
"fullHeight": false,
"onMousedown": onListMouseDown,
"onScroll": onPopupScroll,
"virtual": virtual
}, {
default: function _default3(item, itemIndex) {
var _classNames;
var group = item.group, groupOption = item.groupOption, data2 = item.data, value2 = item.value;
var key2 = data2.key;
var label = typeof item.label === "function" ? item.label() : item.label;
if (group) {
var _data$title;
var groupTitle = (_data$title = data2.title) !== null && _data$title !== void 0 ? _data$title : isTitleType(label) && label;
return createVNode("div", {
"class": classNames(itemPrefixCls.value, "".concat(itemPrefixCls.value, "-group")),
"title": groupTitle
}, [renderOption ? renderOption(data2) : label !== void 0 ? label : key2]);
}
var disabled = data2.disabled, title = data2.title;
data2.children;
var style = data2.style, cls = data2.class, className = data2.className, otherProps = _objectWithoutProperties$2(data2, _excluded$i);
var passedProps = omit(otherProps, omitFieldNameList);
var selected = isSelected(value2);
var optionPrefixCls = "".concat(itemPrefixCls.value, "-option");
var optionClassName = classNames(itemPrefixCls.value, optionPrefixCls, cls, className, (_classNames = {}, _defineProperty$q(_classNames, "".concat(optionPrefixCls, "-grouped"), groupOption), _defineProperty$q(_classNames, "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !disabled), _defineProperty$q(_classNames, "".concat(optionPrefixCls, "-disabled"), disabled), _defineProperty$q(_classNames, "".concat(optionPrefixCls, "-selected"), selected), _classNames));
var mergedLabel = getLabel(item);
var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === "function" || selected;
var content = typeof mergedLabel === "number" ? mergedLabel : mergedLabel || value2;
var optionTitle = isTitleType(content) ? content.toString() : void 0;
if (title !== void 0) {
optionTitle = title;
}
return createVNode("div", _objectSpread2$1(_objectSpread2$1({}, passedProps), {}, {
"aria-selected": selected,
"class": optionClassName,
"title": optionTitle,
"onMousemove": function onMousemove(e2) {
if (otherProps.onMousemove) {
otherProps.onMousemove(e2);
}
if (activeIndex === itemIndex || disabled) {
return;
}
setActive(itemIndex);
},
"onClick": function onClick2(e2) {
if (!disabled) {
onSelectValue(value2);
}
if (otherProps.onClick) {
otherProps.onClick(e2);
}
},
"style": style
}), [createVNode("div", {
"class": "".concat(optionPrefixCls, "-content")
}, [renderOption ? renderOption(data2) : content]), isValidElement(menuItemSelectedIcon) || selected, iconVisible && createVNode(TransBtn$1, {
"class": "".concat(itemPrefixCls.value, "-option-state"),
"customizeIcon": menuItemSelectedIcon,
"customizeIconProps": {
isSelected: selected
}
}, {
default: function _default4() {
return [selected ? "✓" : null];
}
})]);
}
})]);
};
}
});
const OptionList$1 = OptionList;
var _excluded$h = ["value", "disabled"];
function convertNodeToOption(node) {
var key2 = node.key, children = node.children, _node$props = node.props, value2 = _node$props.value, disabled = _node$props.disabled, restProps = _objectWithoutProperties$2(_node$props, _excluded$h);
var child = children === null || children === void 0 ? void 0 : children.default;
return _objectSpread2$1({
key: key2,
value: value2 !== void 0 ? value2 : key2,
children: child,
disabled: disabled || disabled === ""
}, restProps);
}
function convertChildrenToData(nodes) {
var optionOnly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
var dd = flattenChildren(nodes).map(function(node, index2) {
var _children$label;
if (!isValidElement(node) || !node.type) {
return null;
}
var isSelectOptGroup = node.type.isSelectOptGroup, key2 = node.key, children = node.children, props3 = node.props;
if (optionOnly || !isSelectOptGroup) {
return convertNodeToOption(node);
}
var child = children && children.default ? children.default() : void 0;
var label = (props3 === null || props3 === void 0 ? void 0 : props3.label) || ((_children$label = children.label) === null || _children$label === void 0 ? void 0 : _children$label.call(children)) || key2;
return _objectSpread2$1(_objectSpread2$1({
key: "__RC_SELECT_GRP__".concat(key2 === null ? index2 : String(key2), "__")
}, props3), {}, {
label,
options: convertChildrenToData(child || [])
});
}).filter(function(data2) {
return data2;
});
return dd;
}
function useOptions(options, children, fieldNames) {
var mergedOptions = shallowRef();
var valueOptions = shallowRef();
var labelOptions = shallowRef();
var tempMergedOptions = shallowRef([]);
watch([options, children], function() {
if (options.value) {
tempMergedOptions.value = toRaw(options.value).slice();
} else {
tempMergedOptions.value = convertChildrenToData(children.value);
}
}, {
immediate: true,
deep: true
});
watchEffect(function() {
var newOptions = tempMergedOptions.value;
var newValueOptions = /* @__PURE__ */ new Map();
var newLabelOptions = /* @__PURE__ */ new Map();
var fieldNamesValue = fieldNames.value;
function dig(optionList) {
var isChildren = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
for (var i2 = 0; i2 < optionList.length; i2 += 1) {
var option = optionList[i2];
if (!option[fieldNamesValue.options] || isChildren) {
newValueOptions.set(option[fieldNamesValue.value], option);
newLabelOptions.set(option[fieldNamesValue.label], option);
} else {
dig(option[fieldNamesValue.options], true);
}
}
}
dig(newOptions);
mergedOptions.value = newOptions;
valueOptions.value = newValueOptions;
labelOptions.value = newLabelOptions;
});
return {
options: mergedOptions,
valueOptions,
labelOptions
};
}
var uuid$3 = 0;
var isBrowserClient = process.env.NODE_ENV !== "test" && canUseDom();
function getUUID$1() {
var retId;
if (isBrowserClient) {
retId = uuid$3;
uuid$3 += 1;
} else {
retId = "TEST_OR_SSR";
}
return retId;
}
function useId() {
var id = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ref("");
var innerId = "rc_select_".concat(getUUID$1());
return id.value || innerId;
}
function toArray$2(value2) {
if (Array.isArray(value2)) {
return value2;
}
return value2 !== void 0 ? [value2] : [];
}
var isClient$1 = typeof window !== "undefined" && window.document && window.document.documentElement;
process.env.NODE_ENV !== "test" && isClient$1;
function warningProps(props3) {
var mode = props3.mode, options = props3.options, children = props3.children, backfill = props3.backfill, allowClear = props3.allowClear, placeholder = props3.placeholder, getInputElement = props3.getInputElement, showSearch = props3.showSearch, onSearch = props3.onSearch, defaultOpen = props3.defaultOpen, autofocus = props3.autofocus, labelInValue = props3.labelInValue, value2 = props3.value, inputValue = props3.inputValue, optionLabelProp = props3.optionLabelProp;
var multiple = isMultiple(mode);
var mergedShowSearch = showSearch !== void 0 ? showSearch : multiple || mode === "combobox";
var mergedOptions = options || convertChildrenToData(children);
warningOnce(mode !== "tags" || mergedOptions.every(function(opt) {
return !opt.disabled;
}), "Please avoid setting option to disabled in tags mode since user can always type text as tag.");
warningOnce(mode !== "combobox" || !optionLabelProp, "`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly.");
warningOnce(mode === "combobox" || !backfill, "`backfill` only works with `combobox` mode.");
warningOnce(mode === "combobox" || !getInputElement, "`getInputElement` only work with `combobox` mode.");
noteOnce(mode !== "combobox" || !getInputElement || !allowClear || !placeholder, "Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`.");
if (onSearch && !mergedShowSearch && mode !== "combobox" && mode !== "tags") {
warningOnce(false, "`onSearch` should work with `showSearch` instead of use alone.");
}
noteOnce(!defaultOpen || autofocus, "`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autofocus` if needed.");
if (value2 !== void 0 && value2 !== null) {
var values = toArray$2(value2);
warningOnce(!labelInValue || values.every(function(val) {
return _typeof$2(val) === "object" && ("key" in val || "value" in val);
}), "`value` should in shape of `{ value: string | number, label?: any }` when you set `labelInValue` to `true`");
warningOnce(!multiple || Array.isArray(value2), "`value` should be array when `mode` is `multiple` or `tags`");
}
if (children) {
var invalidateChildType = null;
children.some(function(node) {
if (!isValidElement(node) || !node.type) {
return false;
}
var type = node.type;
if (type.isSelectOption) {
return false;
}
if (type.isSelectOptGroup) {
var _node$children;
var childs = ((_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.default()) || [];
var allChildrenValid = childs.every(function(subNode) {
if (!isValidElement(subNode) || !node.type || subNode.type.isSelectOption) {
return true;
}
invalidateChildType = subNode.type;
return false;
});
if (allChildrenValid) {
return false;
}
return true;
}
invalidateChildType = type;
return true;
});
if (invalidateChildType) {
warningOnce(false, "`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(invalidateChildType.displayName || invalidateChildType.name || invalidateChildType, "`."));
}
warningOnce(inputValue === void 0, "`inputValue` is deprecated, please use `searchValue` instead.");
}
}
function includes(test, search) {
return toArray$2(test).join("").toUpperCase().includes(search);
}
const useFilterOptions = function(options, fieldNames, searchValue, filterOption, optionFilterProp) {
return computed(function() {
var searchValueVal = searchValue.value;
var optionFilterPropValue = optionFilterProp === null || optionFilterProp === void 0 ? void 0 : optionFilterProp.value;
var filterOptionValue = filterOption === null || filterOption === void 0 ? void 0 : filterOption.value;
if (!searchValueVal || filterOptionValue === false) {
return options.value;
}
var _fieldNames$value = fieldNames.value, fieldOptions = _fieldNames$value.options, fieldLabel = _fieldNames$value.label, fieldValue = _fieldNames$value.value;
var filteredOptions = [];
var customizeFilter = typeof filterOptionValue === "function";
var upperSearch = searchValueVal.toUpperCase();
var filterFunc = customizeFilter ? filterOptionValue : function(_2, option) {
if (optionFilterPropValue) {
return includes(option[optionFilterPropValue], upperSearch);
}
if (option[fieldOptions]) {
return includes(option[fieldLabel !== "children" ? fieldLabel : "label"], upperSearch);
}
return includes(option[fieldValue], upperSearch);
};
var wrapOption = customizeFilter ? function(opt) {
return injectPropsWithOption(opt);
} : function(opt) {
return opt;
};
options.value.forEach(function(item) {
if (item[fieldOptions]) {
var matchGroup = filterFunc(searchValueVal, wrapOption(item));
if (matchGroup) {
filteredOptions.push(item);
} else {
var subOptions = item[fieldOptions].filter(function(subItem) {
return filterFunc(searchValueVal, wrapOption(subItem));
});
if (subOptions.length) {
filteredOptions.push(_objectSpread2$1(_objectSpread2$1({}, item), {}, _defineProperty$q({}, fieldOptions, subOptions)));
}
}
return;
}
if (filterFunc(searchValueVal, wrapOption(item))) {
filteredOptions.push(item);
}
});
return filteredOptions;
});
};
const useCache = function(labeledValues, valueOptions) {
var cacheRef = shallowRef({
values: /* @__PURE__ */ new Map(),
options: /* @__PURE__ */ new Map()
});
var filledLabeledValues = computed(function() {
var _cacheRef$value = cacheRef.value, prevValueCache = _cacheRef$value.values, prevOptionCache = _cacheRef$value.options;
var patchedValues = labeledValues.value.map(function(item) {
if (item.label === void 0) {
var _prevValueCache$get;
return _objectSpread2$1(_objectSpread2$1({}, item), {}, {
label: (_prevValueCache$get = prevValueCache.get(item.value)) === null || _prevValueCache$get === void 0 ? void 0 : _prevValueCache$get.label
});
}
return item;
});
var valueCache = /* @__PURE__ */ new Map();
var optionCache = /* @__PURE__ */ new Map();
patchedValues.forEach(function(item) {
valueCache.set(item.value, item);
optionCache.set(item.value, valueOptions.value.get(item.value) || prevOptionCache.get(item.value));
});
cacheRef.value.values = valueCache;
cacheRef.value.options = optionCache;
return patchedValues;
});
var getOption = function getOption2(val) {
return valueOptions.value.get(val) || cacheRef.value.options.get(val);
};
return [filledLabeledValues, getOption];
};
function useMergedState(defaultStateValue, option) {
var _ref = option || {}, defaultValue = _ref.defaultValue, _ref$value = _ref.value, value2 = _ref$value === void 0 ? ref() : _ref$value;
var initValue = typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
if (value2.value !== void 0) {
initValue = unref(value2);
}
if (defaultValue !== void 0) {
initValue = typeof defaultValue === "function" ? defaultValue() : defaultValue;
}
var innerValue = ref(initValue);
var mergedValue = ref(initValue);
watchEffect(function() {
var val = value2.value !== void 0 ? value2.value : innerValue.value;
if (option.postState) {
val = option.postState(val);
}
mergedValue.value = val;
});
function triggerChange(newValue) {
var preVal = mergedValue.value;
innerValue.value = newValue;
if (toRaw(mergedValue.value) !== newValue && option.onChange) {
option.onChange(newValue, preVal);
}
}
watch(value2, function() {
innerValue.value = value2.value;
});
return [mergedValue, triggerChange];
}
function useState(defaultStateValue) {
var initValue = typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
var innerValue = ref(initValue);
function triggerChange(newValue) {
innerValue.value = newValue;
}
return [innerValue, triggerChange];
}
var OMIT_DOM_PROPS = ["inputValue"];
function selectProps$1() {
return _objectSpread2$1(_objectSpread2$1({}, baseSelectPropsWithoutPrivate()), {}, {
prefixCls: String,
id: String,
backfill: {
type: Boolean,
default: void 0
},
// >>> Field Names
fieldNames: Object,
// >>> Search
/** @deprecated Use `searchValue` instead */
inputValue: String,
searchValue: String,
onSearch: Function,
autoClearSearchValue: {
type: Boolean,
default: void 0
},
// >>> Select
onSelect: Function,
onDeselect: Function,
// >>> Options
/**
* In Select, `false` means do nothing.
* In TreeSelect, `false` will highlight match item.
* It's by design.
*/
filterOption: {
type: [Boolean, Function],
default: void 0
},
filterSort: Function,
optionFilterProp: String,
optionLabelProp: String,
options: Array,
defaultActiveFirstOption: {
type: Boolean,
default: void 0
},
virtual: {
type: Boolean,
default: void 0
},
listHeight: Number,
listItemHeight: Number,
// >>> Icon
menuItemSelectedIcon: PropTypes$1.any,
mode: String,
labelInValue: {
type: Boolean,
default: void 0
},
value: PropTypes$1.any,
defaultValue: PropTypes$1.any,
onChange: Function,
children: Array
});
}
function isRawValue(value2) {
return !value2 || _typeof$2(value2) !== "object";
}
const Select$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Select",
inheritAttrs: false,
props: initDefaultProps$1(selectProps$1(), {
prefixCls: "vc-select",
autoClearSearchValue: true,
listHeight: 200,
listItemHeight: 20,
dropdownMatchSelectWidth: true
}),
setup: function setup26(props3, _ref) {
var expose = _ref.expose, attrs = _ref.attrs, slots = _ref.slots;
var mergedId = useId(toRef(props3, "id"));
var multiple = computed(function() {
return isMultiple(props3.mode);
});
var childrenAsData = computed(function() {
return !!(!props3.options && props3.children);
});
var mergedFilterOption = computed(function() {
if (props3.filterOption === void 0 && props3.mode === "combobox") {
return false;
}
return props3.filterOption;
});
var mergedFieldNames = computed(function() {
return fillFieldNames(props3.fieldNames, childrenAsData.value);
});
var _useMergedState = useMergedState("", {
value: computed(function() {
return props3.searchValue !== void 0 ? props3.searchValue : props3.inputValue;
}),
postState: function postState(search) {
return search || "";
}
}), _useMergedState2 = _slicedToArray$2(_useMergedState, 2), mergedSearchValue = _useMergedState2[0], setSearchValue = _useMergedState2[1];
var parsedOptions = useOptions(toRef(props3, "options"), toRef(props3, "children"), mergedFieldNames);
var valueOptions = parsedOptions.valueOptions, labelOptions = parsedOptions.labelOptions, mergedOptions = parsedOptions.options;
var convert2LabelValues = function convert2LabelValues2(draftValues) {
var valueList = toArray$2(draftValues);
return valueList.map(function(val) {
var rawValue;
var rawLabel;
var rawKey;
var rawDisabled;
if (isRawValue(val)) {
rawValue = val;
} else {
var _val$value;
rawKey = val.key;
rawLabel = val.label;
rawValue = (_val$value = val.value) !== null && _val$value !== void 0 ? _val$value : rawKey;
}
var option = valueOptions.value.get(rawValue);
if (option) {
var _option$key;
if (rawLabel === void 0)
rawLabel = option === null || option === void 0 ? void 0 : option[props3.optionLabelProp || mergedFieldNames.value.label];
if (rawKey === void 0)
rawKey = (_option$key = option === null || option === void 0 ? void 0 : option.key) !== null && _option$key !== void 0 ? _option$key : rawValue;
rawDisabled = option === null || option === void 0 ? void 0 : option.disabled;
}
return {
label: rawLabel,
value: rawValue,
key: rawKey,
disabled: rawDisabled,
option
};
});
};
var _useMergedState3 = useMergedState(props3.defaultValue, {
value: toRef(props3, "value")
}), _useMergedState4 = _slicedToArray$2(_useMergedState3, 2), internalValue = _useMergedState4[0], setInternalValue = _useMergedState4[1];
var rawLabeledValues = computed(function() {
var _values$;
var values = convert2LabelValues(internalValue.value);
if (props3.mode === "combobox" && !((_values$ = values[0]) !== null && _values$ !== void 0 && _values$.value)) {
return [];
}
return values;
});
var _useCache = useCache(rawLabeledValues, valueOptions), _useCache2 = _slicedToArray$2(_useCache, 2), mergedValues = _useCache2[0], getMixedOption = _useCache2[1];
var displayValues = computed(function() {
if (!props3.mode && mergedValues.value.length === 1) {
var firstValue = mergedValues.value[0];
if (firstValue.value === null && (firstValue.label === null || firstValue.label === void 0)) {
return [];
}
}
return mergedValues.value.map(function(item) {
var _ref2;
return _objectSpread2$1(_objectSpread2$1({}, item), {}, {
label: (_ref2 = typeof item.label === "function" ? item.label() : item.label) !== null && _ref2 !== void 0 ? _ref2 : item.value
});
});
});
var rawValues = computed(function() {
return new Set(mergedValues.value.map(function(val) {
return val.value;
}));
});
watchEffect(function() {
if (props3.mode === "combobox") {
var _mergedValues$value$;
var strValue = (_mergedValues$value$ = mergedValues.value[0]) === null || _mergedValues$value$ === void 0 ? void 0 : _mergedValues$value$.value;
if (strValue !== void 0 && strValue !== null) {
setSearchValue(String(strValue));
}
}
}, {
flush: "post"
});
var createTagOption = function createTagOption2(val, label) {
var _ref3;
var mergedLabel = label !== null && label !== void 0 ? label : val;
return _ref3 = {}, _defineProperty$q(_ref3, mergedFieldNames.value.value, val), _defineProperty$q(_ref3, mergedFieldNames.value.label, mergedLabel), _ref3;
};
var filledTagOptions = shallowRef();
watchEffect(function() {
if (props3.mode !== "tags") {
filledTagOptions.value = mergedOptions.value;
return;
}
var cloneOptions = mergedOptions.value.slice();
var existOptions = function existOptions2(val) {
return valueOptions.value.has(val);
};
_toConsumableArray(mergedValues.value).sort(function(a2, b2) {
return a2.value < b2.value ? -1 : 1;
}).forEach(function(item) {
var val = item.value;
if (!existOptions(val)) {
cloneOptions.push(createTagOption(val, item.label));
}
});
filledTagOptions.value = cloneOptions;
});
var filteredOptions = useFilterOptions(filledTagOptions, mergedFieldNames, mergedSearchValue, mergedFilterOption, toRef(props3, "optionFilterProp"));
var filledSearchOptions = computed(function() {
if (props3.mode !== "tags" || !mergedSearchValue.value || filteredOptions.value.some(function(item) {
return item[props3.optionFilterProp || "value"] === mergedSearchValue.value;
})) {
return filteredOptions.value;
}
return [createTagOption(mergedSearchValue.value)].concat(_toConsumableArray(filteredOptions.value));
});
var orderedFilteredOptions = computed(function() {
if (!props3.filterSort) {
return filledSearchOptions.value;
}
return _toConsumableArray(filledSearchOptions.value).sort(function(a2, b2) {
return props3.filterSort(a2, b2);
});
});
var displayOptions = computed(function() {
return flattenOptions(orderedFilteredOptions.value, {
fieldNames: mergedFieldNames.value,
childrenAsData: childrenAsData.value
});
});
var triggerChange = function triggerChange2(values) {
var labeledValues = convert2LabelValues(values);
setInternalValue(labeledValues);
if (props3.onChange && // Trigger event only when value changed
(labeledValues.length !== mergedValues.value.length || labeledValues.some(function(newVal, index2) {
var _mergedValues$value$i;
return ((_mergedValues$value$i = mergedValues.value[index2]) === null || _mergedValues$value$i === void 0 ? void 0 : _mergedValues$value$i.value) !== (newVal === null || newVal === void 0 ? void 0 : newVal.value);
}))) {
var returnValues = props3.labelInValue ? labeledValues.map(function(v2) {
return _objectSpread2$1(_objectSpread2$1({}, v2), {}, {
originLabel: v2.label,
label: typeof v2.label === "function" ? v2.label() : v2.label
});
}) : labeledValues.map(function(v2) {
return v2.value;
});
var returnOptions = labeledValues.map(function(v2) {
return injectPropsWithOption(getMixedOption(v2.value));
});
props3.onChange(
// Value
multiple.value ? returnValues : returnValues[0],
// Option
multiple.value ? returnOptions : returnOptions[0]
);
}
};
var _useState = useState(null), _useState2 = _slicedToArray$2(_useState, 2), activeValue = _useState2[0], setActiveValue = _useState2[1];
var _useState3 = useState(0), _useState4 = _slicedToArray$2(_useState3, 2), accessibilityIndex = _useState4[0], setAccessibilityIndex = _useState4[1];
var mergedDefaultActiveFirstOption = computed(function() {
return props3.defaultActiveFirstOption !== void 0 ? props3.defaultActiveFirstOption : props3.mode !== "combobox";
});
var onActiveValue = function onActiveValue2(active, index2) {
var _ref4 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, _ref4$source = _ref4.source, source = _ref4$source === void 0 ? "keyboard" : _ref4$source;
setAccessibilityIndex(index2);
if (props3.backfill && props3.mode === "combobox" && active !== null && source === "keyboard") {
setActiveValue(String(active));
}
};
var triggerSelect = function triggerSelect2(val, selected) {
var getSelectEnt = function getSelectEnt2() {
var _option$key2;
var option2 = getMixedOption(val);
var originLabel = option2 === null || option2 === void 0 ? void 0 : option2[mergedFieldNames.value.label];
return [props3.labelInValue ? {
label: typeof originLabel === "function" ? originLabel() : originLabel,
originLabel,
value: val,
key: (_option$key2 = option2 === null || option2 === void 0 ? void 0 : option2.key) !== null && _option$key2 !== void 0 ? _option$key2 : val
} : val, injectPropsWithOption(option2)];
};
if (selected && props3.onSelect) {
var _getSelectEnt = getSelectEnt(), _getSelectEnt2 = _slicedToArray$2(_getSelectEnt, 2), wrappedValue = _getSelectEnt2[0], option = _getSelectEnt2[1];
props3.onSelect(wrappedValue, option);
} else if (!selected && props3.onDeselect) {
var _getSelectEnt3 = getSelectEnt(), _getSelectEnt4 = _slicedToArray$2(_getSelectEnt3, 2), _wrappedValue = _getSelectEnt4[0], _option = _getSelectEnt4[1];
props3.onDeselect(_wrappedValue, _option);
}
};
var onInternalSelect = function onInternalSelect2(val, info) {
var cloneValues;
var mergedSelect = multiple.value ? info.selected : true;
if (mergedSelect) {
cloneValues = multiple.value ? [].concat(_toConsumableArray(mergedValues.value), [val]) : [val];
} else {
cloneValues = mergedValues.value.filter(function(v2) {
return v2.value !== val;
});
}
triggerChange(cloneValues);
triggerSelect(val, mergedSelect);
if (props3.mode === "combobox") {
setActiveValue("");
} else if (!multiple.value || props3.autoClearSearchValue) {
setSearchValue("");
setActiveValue("");
}
};
var onDisplayValuesChange = function onDisplayValuesChange2(nextValues, info) {
triggerChange(nextValues);
if (info.type === "remove" || info.type === "clear") {
info.values.forEach(function(item) {
triggerSelect(item.value, false);
});
}
};
var onInternalSearch = function onInternalSearch2(searchText, info) {
setSearchValue(searchText);
setActiveValue(null);
if (info.source === "submit") {
var formatted = (searchText || "").trim();
if (formatted) {
var newRawValues = Array.from(new Set([].concat(_toConsumableArray(rawValues.value), [formatted])));
triggerChange(newRawValues);
triggerSelect(formatted, true);
setSearchValue("");
}
return;
}
if (info.source !== "blur") {
var _props$onSearch;
if (props3.mode === "combobox") {
triggerChange(searchText);
}
(_props$onSearch = props3.onSearch) === null || _props$onSearch === void 0 ? void 0 : _props$onSearch.call(props3, searchText);
}
};
var onInternalSearchSplit = function onInternalSearchSplit2(words) {
var patchValues = words;
if (props3.mode !== "tags") {
patchValues = words.map(function(word) {
var opt = labelOptions.value.get(word);
return opt === null || opt === void 0 ? void 0 : opt.value;
}).filter(function(val) {
return val !== void 0;
});
}
var newRawValues = Array.from(new Set([].concat(_toConsumableArray(rawValues.value), _toConsumableArray(patchValues))));
triggerChange(newRawValues);
newRawValues.forEach(function(newRawValue) {
triggerSelect(newRawValue, true);
});
};
var realVirtual = computed(function() {
return props3.virtual !== false && props3.dropdownMatchSelectWidth !== false;
});
useProvideSelectProps(toReactive(_objectSpread2$1(_objectSpread2$1({}, parsedOptions), {}, {
flattenOptions: displayOptions,
onActiveValue,
defaultActiveFirstOption: mergedDefaultActiveFirstOption,
onSelect: onInternalSelect,
menuItemSelectedIcon: toRef(props3, "menuItemSelectedIcon"),
rawValues,
fieldNames: mergedFieldNames,
virtual: realVirtual,
listHeight: toRef(props3, "listHeight"),
listItemHeight: toRef(props3, "listItemHeight"),
childrenAsData
})));
if (process.env.NODE_ENV !== "production") {
watchEffect(function() {
warningProps(props3);
}, {
flush: "post"
});
}
var selectRef = ref();
expose({
focus: function focus() {
var _selectRef$value;
(_selectRef$value = selectRef.value) === null || _selectRef$value === void 0 ? void 0 : _selectRef$value.focus();
},
blur: function blur() {
var _selectRef$value2;
(_selectRef$value2 = selectRef.value) === null || _selectRef$value2 === void 0 ? void 0 : _selectRef$value2.blur();
},
scrollTo: function scrollTo2(arg) {
var _selectRef$value3;
(_selectRef$value3 = selectRef.value) === null || _selectRef$value3 === void 0 ? void 0 : _selectRef$value3.scrollTo(arg);
}
});
var pickProps = computed(function() {
return omit(props3, [
"id",
"mode",
"prefixCls",
"backfill",
"fieldNames",
// Search
"inputValue",
"searchValue",
"onSearch",
"autoClearSearchValue",
// Select
"onSelect",
"onDeselect",
"dropdownMatchSelectWidth",
// Options
"filterOption",
"filterSort",
"optionFilterProp",
"optionLabelProp",
"options",
"children",
"defaultActiveFirstOption",
"menuItemSelectedIcon",
"virtual",
"listHeight",
"listItemHeight",
// Value
"value",
"defaultValue",
"labelInValue",
"onChange"
]);
});
return function() {
return createVNode(BaseSelect, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, pickProps.value), attrs), {}, {
"id": mergedId,
"prefixCls": props3.prefixCls,
"ref": selectRef,
"omitDomProps": OMIT_DOM_PROPS,
"mode": props3.mode,
"displayValues": displayValues.value,
"onDisplayValuesChange": onDisplayValuesChange,
"searchValue": mergedSearchValue.value,
"onSearch": onInternalSearch,
"onSearchSplit": onInternalSearchSplit,
"dropdownMatchSelectWidth": props3.dropdownMatchSelectWidth,
"OptionList": OptionList$1,
"emptyOptions": !displayOptions.value.length,
"activeValue": activeValue.value,
"activeDescendantId": "".concat(mergedId, "_list_").concat(accessibilityIndex.value)
}), slots);
};
}
});
var Option = function Option2() {
return null;
};
Option.isSelectOption = true;
Option.displayName = "ASelectOption";
const Option$1 = Option;
var OptGroup = function OptGroup2() {
return null;
};
OptGroup.isSelectOptGroup = true;
OptGroup.displayName = "ASelectOptGroup";
const OptGroup$1 = OptGroup;
var DownOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" } }] }, "name": "down", "theme": "outlined" };
const DownOutlinedSvg = DownOutlined$2;
function _objectSpread$b(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$b(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$b(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var DownOutlined = function DownOutlined2(props3, context) {
var p = _objectSpread$b({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$b({}, p, {
"icon": DownOutlinedSvg
}), null);
};
DownOutlined.displayName = "DownOutlined";
DownOutlined.inheritAttrs = false;
const DownOutlined$1 = DownOutlined;
var CheckOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" } }] }, "name": "check", "theme": "outlined" };
const CheckOutlinedSvg = CheckOutlined$2;
function _objectSpread$a(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$a(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$a(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var CheckOutlined = function CheckOutlined2(props3, context) {
var p = _objectSpread$a({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$a({}, p, {
"icon": CheckOutlinedSvg
}), null);
};
CheckOutlined.displayName = "CheckOutlined";
CheckOutlined.inheritAttrs = false;
const CheckOutlined$1 = CheckOutlined;
var SearchOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" } }] }, "name": "search", "theme": "outlined" };
const SearchOutlinedSvg = SearchOutlined$2;
function _objectSpread$9(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$9(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$9(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var SearchOutlined = function SearchOutlined2(props3, context) {
var p = _objectSpread$9({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$9({}, p, {
"icon": SearchOutlinedSvg
}), null);
};
SearchOutlined.displayName = "SearchOutlined";
SearchOutlined.inheritAttrs = false;
const SearchOutlined$1 = SearchOutlined;
function getIcons(props3) {
var slots = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var loading = props3.loading, multiple = props3.multiple, prefixCls = props3.prefixCls;
var suffixIcon = props3.suffixIcon || slots.suffixIcon && slots.suffixIcon();
var clearIcon = props3.clearIcon || slots.clearIcon && slots.clearIcon();
var menuItemSelectedIcon = props3.menuItemSelectedIcon || slots.menuItemSelectedIcon && slots.menuItemSelectedIcon();
var removeIcon = props3.removeIcon || slots.removeIcon && slots.removeIcon();
var mergedClearIcon = clearIcon;
if (!clearIcon) {
mergedClearIcon = createVNode(CloseCircleFilled$1, null, null);
}
var mergedSuffixIcon = null;
if (suffixIcon !== void 0) {
mergedSuffixIcon = suffixIcon;
} else if (loading) {
mergedSuffixIcon = createVNode(LoadingOutlined$1, {
"spin": true
}, null);
} else {
var iconCls = "".concat(prefixCls, "-suffix");
mergedSuffixIcon = function mergedSuffixIcon2(_ref) {
var open2 = _ref.open, showSearch = _ref.showSearch;
if (open2 && showSearch) {
return createVNode(SearchOutlined$1, {
"class": iconCls
}, null);
}
return createVNode(DownOutlined$1, {
"class": iconCls
}, null);
};
}
var mergedItemIcon = null;
if (menuItemSelectedIcon !== void 0) {
mergedItemIcon = menuItemSelectedIcon;
} else if (multiple) {
mergedItemIcon = createVNode(CheckOutlined$1, null, null);
} else {
mergedItemIcon = null;
}
var mergedRemoveIcon = null;
if (removeIcon !== void 0) {
mergedRemoveIcon = removeIcon;
} else {
mergedRemoveIcon = createVNode(CloseOutlined$1, null, null);
}
return {
clearIcon: mergedClearIcon,
suffixIcon: mergedSuffixIcon,
itemIcon: mergedItemIcon,
removeIcon: mergedRemoveIcon
};
}
var ContextKey = Symbol("ContextProps");
var InternalContextKey = Symbol("InternalContextProps");
var defaultContext = {
id: computed(function() {
return void 0;
}),
onFieldBlur: function onFieldBlur() {
},
onFieldChange: function onFieldChange() {
},
clearValidate: function clearValidate() {
}
};
var defaultInternalContext = {
addFormItemField: function addFormItemField() {
},
removeFormItemField: function removeFormItemField() {
}
};
var useInjectFormItemContext = function useInjectFormItemContext2() {
var internalContext = inject(InternalContextKey, defaultInternalContext);
var formItemFieldKey = Symbol("FormItemFieldKey");
var instance = getCurrentInstance();
internalContext.addFormItemField(formItemFieldKey, instance.type);
onBeforeUnmount(function() {
internalContext.removeFormItemField(formItemFieldKey);
});
provide(InternalContextKey, defaultInternalContext);
provide(ContextKey, defaultContext);
return inject(ContextKey, defaultContext);
};
defineComponent({
compatConfig: {
MODE: 3
},
name: "AFormItemRest",
setup: function setup27(_2, _ref) {
var slots = _ref.slots;
provide(InternalContextKey, defaultInternalContext);
provide(ContextKey, defaultContext);
return function() {
var _slots$default;
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
};
}
});
var selectProps = function selectProps2() {
return _objectSpread2$1(_objectSpread2$1({}, omit(selectProps$1(), ["inputIcon", "mode", "getInputElement", "getRawInputElement", "backfill"])), {}, {
value: {
type: [Array, Object, String, Number]
},
defaultValue: {
type: [Array, Object, String, Number]
},
notFoundContent: PropTypes$1.any,
suffixIcon: PropTypes$1.any,
itemIcon: PropTypes$1.any,
size: String,
mode: String,
bordered: {
type: Boolean,
default: true
},
transitionName: String,
choiceTransitionName: {
type: String,
default: ""
},
"onUpdate:value": Function
});
};
var SECRET_COMBOBOX_MODE_DO_NOT_USE = "SECRET_COMBOBOX_MODE_DO_NOT_USE";
var Select = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASelect",
Option: Option$1,
OptGroup: OptGroup$1,
inheritAttrs: false,
props: initDefaultProps$1(selectProps(), {
listHeight: 256,
listItemHeight: 24
}),
SECRET_COMBOBOX_MODE_DO_NOT_USE,
// emits: ['change', 'update:value', 'blur'],
slots: [
"notFoundContent",
"suffixIcon",
"itemIcon",
"removeIcon",
"clearIcon",
"dropdownRender",
"option",
"placeholder",
"tagRender",
"maxTagPlaceholder",
"optionLabel"
// donot use, maybe remove it
],
setup: function setup28(props3, _ref) {
var attrs = _ref.attrs, emit = _ref.emit, slots = _ref.slots, expose = _ref.expose;
var selectRef = ref();
var formItemContext = useInjectFormItemContext();
var focus = function focus2() {
var _selectRef$value;
(_selectRef$value = selectRef.value) === null || _selectRef$value === void 0 ? void 0 : _selectRef$value.focus();
};
var blur = function blur2() {
var _selectRef$value2;
(_selectRef$value2 = selectRef.value) === null || _selectRef$value2 === void 0 ? void 0 : _selectRef$value2.blur();
};
var scrollTo2 = function scrollTo3(arg) {
var _selectRef$value3;
(_selectRef$value3 = selectRef.value) === null || _selectRef$value3 === void 0 ? void 0 : _selectRef$value3.scrollTo(arg);
};
var mode = computed(function() {
var mode2 = props3.mode;
if (mode2 === "combobox") {
return void 0;
}
if (mode2 === SECRET_COMBOBOX_MODE_DO_NOT_USE) {
return "combobox";
}
return mode2;
});
var _useConfigInject = useConfigInject("select", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction, configProvider = _useConfigInject.configProvider, size = _useConfigInject.size, getPrefixCls2 = _useConfigInject.getPrefixCls;
var rootPrefixCls = computed(function() {
return getPrefixCls2();
});
var transitionName2 = computed(function() {
return getTransitionName$1(rootPrefixCls.value, "slide-up", props3.transitionName);
});
var mergedClassName = computed(function() {
var _classNames;
return classNames((_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls.value, "-lg"), size.value === "large"), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-sm"), size.value === "small"), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-rtl"), direction.value === "rtl"), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-borderless"), !props3.bordered), _classNames));
});
var triggerChange = function triggerChange2() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
emit("update:value", args[0]);
emit.apply(void 0, ["change"].concat(args));
formItemContext.onFieldChange();
};
var handleBlur = function handleBlur2(e2) {
emit("blur", e2);
formItemContext.onFieldBlur();
};
expose({
blur,
focus,
scrollTo: scrollTo2
});
var isMultiple2 = computed(function() {
return mode.value === "multiple" || mode.value === "tags";
});
return function() {
var _slots$placeholder, _slots$default;
var notFoundContent = props3.notFoundContent, _props$listHeight = props3.listHeight, listHeight = _props$listHeight === void 0 ? 256 : _props$listHeight, _props$listItemHeight = props3.listItemHeight, listItemHeight = _props$listItemHeight === void 0 ? 24 : _props$listItemHeight, getPopupContainer = props3.getPopupContainer, dropdownClassName = props3.dropdownClassName, virtual = props3.virtual, dropdownMatchSelectWidth = props3.dropdownMatchSelectWidth, _props$id = props3.id, id = _props$id === void 0 ? formItemContext.id.value : _props$id, _props$placeholder = props3.placeholder, placeholder = _props$placeholder === void 0 ? (_slots$placeholder = slots.placeholder) === null || _slots$placeholder === void 0 ? void 0 : _slots$placeholder.call(slots) : _props$placeholder;
var renderEmpty2 = configProvider.renderEmpty, getContextPopupContainer = configProvider.getPopupContainer;
var mergedNotFound;
if (notFoundContent !== void 0) {
mergedNotFound = notFoundContent;
} else if (slots.notFoundContent) {
mergedNotFound = slots.notFoundContent();
} else if (mode.value === "combobox") {
mergedNotFound = null;
} else {
mergedNotFound = renderEmpty2("Select");
}
var _getIcons = getIcons(_objectSpread2$1(_objectSpread2$1({}, props3), {}, {
multiple: isMultiple2.value,
prefixCls: prefixCls.value
}), slots), suffixIcon = _getIcons.suffixIcon, itemIcon = _getIcons.itemIcon, removeIcon = _getIcons.removeIcon, clearIcon = _getIcons.clearIcon;
var selectProps3 = omit(props3, ["prefixCls", "suffixIcon", "itemIcon", "removeIcon", "clearIcon", "size", "bordered"]);
var rcSelectRtlDropDownClassName = classNames(dropdownClassName, _defineProperty$q({}, "".concat(prefixCls.value, "-dropdown-").concat(direction.value), direction.value === "rtl"));
return createVNode(Select$1, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
"ref": selectRef,
"virtual": virtual,
"dropdownMatchSelectWidth": dropdownMatchSelectWidth
}, selectProps3), attrs), {}, {
"placeholder": placeholder,
"listHeight": listHeight,
"listItemHeight": listItemHeight,
"mode": mode.value,
"prefixCls": prefixCls.value,
"direction": direction.value,
"inputIcon": suffixIcon,
"menuItemSelectedIcon": itemIcon,
"removeIcon": removeIcon,
"clearIcon": clearIcon,
"notFoundContent": mergedNotFound,
"class": [mergedClassName.value, attrs.class],
"getPopupContainer": getPopupContainer || getContextPopupContainer,
"dropdownClassName": rcSelectRtlDropDownClassName,
"onChange": triggerChange,
"onBlur": handleBlur,
"id": id,
"dropdownRender": selectProps3.dropdownRender || slots.dropdownRender,
"transitionName": transitionName2.value,
"children": (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots),
"tagRender": props3.tagRender || slots.tagRender,
"optionLabelRender": slots.optionLabel,
"maxTagPlaceholder": props3.maxTagPlaceholder || slots.maxTagPlaceholder
}), {
option: slots.option
});
};
}
});
Select.install = function(app) {
app.component(Select.name, Select);
app.component(Select.Option.displayName, Select.Option);
app.component(Select.OptGroup.displayName, Select.OptGroup);
return app;
};
var SelectOption = Select.Option;
Select.OptGroup;
const __unplugin_components_0$4 = Select;
var responsiveArray = ["xxxl", "xxl", "xl", "lg", "md", "sm", "xs"];
var responsiveMap = {
xs: "(max-width: 575px)",
sm: "(min-width: 576px)",
md: "(min-width: 768px)",
lg: "(min-width: 992px)",
xl: "(min-width: 1200px)",
xxl: "(min-width: 1600px)",
xxxl: "(min-width: 2000px)"
};
var subscribers = /* @__PURE__ */ new Map();
var subUid = -1;
var screens = {};
var responsiveObserve = {
matchHandlers: {},
dispatch: function dispatch(pointMap) {
screens = pointMap;
subscribers.forEach(function(func) {
return func(screens);
});
return subscribers.size >= 1;
},
subscribe: function subscribe(func) {
if (!subscribers.size)
this.register();
subUid += 1;
subscribers.set(subUid, func);
func(screens);
return subUid;
},
unsubscribe: function unsubscribe(token2) {
subscribers.delete(token2);
if (!subscribers.size)
this.unregister();
},
unregister: function unregister() {
var _this = this;
Object.keys(responsiveMap).forEach(function(screen) {
var matchMediaQuery = responsiveMap[screen];
var handler2 = _this.matchHandlers[matchMediaQuery];
handler2 === null || handler2 === void 0 ? void 0 : handler2.mql.removeListener(handler2 === null || handler2 === void 0 ? void 0 : handler2.listener);
});
subscribers.clear();
},
register: function register() {
var _this2 = this;
Object.keys(responsiveMap).forEach(function(screen) {
var matchMediaQuery = responsiveMap[screen];
var listener = function listener2(_ref) {
var matches = _ref.matches;
_this2.dispatch(_objectSpread2$1(_objectSpread2$1({}, screens), {}, _defineProperty$q({}, screen, matches)));
};
var mql = window.matchMedia(matchMediaQuery);
mql.addListener(listener);
_this2.matchHandlers[matchMediaQuery] = {
mql,
listener
};
listener(mql);
});
}
};
const ResponsiveObserve = responsiveObserve;
var autoAdjustOverflow$2 = {
adjustX: 1,
adjustY: 1
};
var targetOffset$2 = [0, 0];
var placements$3 = {
left: {
points: ["cr", "cl"],
overflow: autoAdjustOverflow$2,
offset: [-4, 0],
targetOffset: targetOffset$2
},
right: {
points: ["cl", "cr"],
overflow: autoAdjustOverflow$2,
offset: [4, 0],
targetOffset: targetOffset$2
},
top: {
points: ["bc", "tc"],
overflow: autoAdjustOverflow$2,
offset: [0, -4],
targetOffset: targetOffset$2
},
bottom: {
points: ["tc", "bc"],
overflow: autoAdjustOverflow$2,
offset: [0, 4],
targetOffset: targetOffset$2
},
topLeft: {
points: ["bl", "tl"],
overflow: autoAdjustOverflow$2,
offset: [0, -4],
targetOffset: targetOffset$2
},
leftTop: {
points: ["tr", "tl"],
overflow: autoAdjustOverflow$2,
offset: [-4, 0],
targetOffset: targetOffset$2
},
topRight: {
points: ["br", "tr"],
overflow: autoAdjustOverflow$2,
offset: [0, -4],
targetOffset: targetOffset$2
},
rightTop: {
points: ["tl", "tr"],
overflow: autoAdjustOverflow$2,
offset: [4, 0],
targetOffset: targetOffset$2
},
bottomRight: {
points: ["tr", "br"],
overflow: autoAdjustOverflow$2,
offset: [0, 4],
targetOffset: targetOffset$2
},
rightBottom: {
points: ["bl", "br"],
overflow: autoAdjustOverflow$2,
offset: [4, 0],
targetOffset: targetOffset$2
},
bottomLeft: {
points: ["tl", "bl"],
overflow: autoAdjustOverflow$2,
offset: [0, 4],
targetOffset: targetOffset$2
},
leftBottom: {
points: ["br", "bl"],
overflow: autoAdjustOverflow$2,
offset: [-4, 0],
targetOffset: targetOffset$2
}
};
var tooltipContentProps = {
prefixCls: String,
id: String,
overlayInnerStyle: PropTypes$1.any
};
const Content$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Content",
props: tooltipContentProps,
slots: ["overlay"],
setup: function setup29(props3, _ref) {
var slots = _ref.slots;
return function() {
var _slots$overlay;
return createVNode("div", {
"class": "".concat(props3.prefixCls, "-inner"),
"id": props3.id,
"role": "tooltip",
"style": props3.overlayInnerStyle
}, [(_slots$overlay = slots.overlay) === null || _slots$overlay === void 0 ? void 0 : _slots$overlay.call(slots)]);
};
}
});
var _excluded$g = ["overlayClassName", "trigger", "mouseEnterDelay", "mouseLeaveDelay", "overlayStyle", "prefixCls", "afterVisibleChange", "transitionName", "animation", "placement", "align", "destroyTooltipOnHide", "defaultVisible"];
function noop$1() {
}
const Tooltip = defineComponent({
compatConfig: {
MODE: 3
},
name: "Tooltip",
inheritAttrs: false,
props: {
trigger: PropTypes$1.any.def(["hover"]),
defaultVisible: {
type: Boolean,
default: void 0
},
visible: {
type: Boolean,
default: void 0
},
placement: PropTypes$1.string.def("right"),
transitionName: String,
animation: PropTypes$1.any,
afterVisibleChange: PropTypes$1.func.def(function() {
}),
overlayStyle: {
type: Object,
default: void 0
},
overlayClassName: String,
prefixCls: PropTypes$1.string.def("rc-tooltip"),
mouseEnterDelay: PropTypes$1.number.def(0.1),
mouseLeaveDelay: PropTypes$1.number.def(0.1),
getPopupContainer: Function,
destroyTooltipOnHide: {
type: Boolean,
default: false
},
align: PropTypes$1.object.def(function() {
return {};
}),
arrowContent: PropTypes$1.any.def(null),
tipId: String,
builtinPlacements: PropTypes$1.object,
overlayInnerStyle: {
type: Object,
default: void 0
},
popupVisible: {
type: Boolean,
default: void 0
},
onVisibleChange: Function,
onPopupAlign: Function
},
slots: ["arrowContent", "overlay"],
setup: function setup30(props3, _ref) {
var slots = _ref.slots, attrs = _ref.attrs, expose = _ref.expose;
var triggerDOM = ref();
var getPopupElement = function getPopupElement2() {
var prefixCls = props3.prefixCls, tipId = props3.tipId, overlayInnerStyle = props3.overlayInnerStyle;
return [createVNode("div", {
"class": "".concat(prefixCls, "-arrow"),
"key": "arrow"
}, [getPropsSlot(slots, props3, "arrowContent")]), createVNode(Content$1, {
"key": "content",
"prefixCls": prefixCls,
"id": tipId,
"overlayInnerStyle": overlayInnerStyle
}, {
overlay: slots.overlay
})];
};
var getPopupDomNode2 = function getPopupDomNode3() {
return triggerDOM.value.getPopupDomNode();
};
expose({
getPopupDomNode: getPopupDomNode2,
triggerDOM,
forcePopupAlign: function forcePopupAlign2() {
var _triggerDOM$value;
return (_triggerDOM$value = triggerDOM.value) === null || _triggerDOM$value === void 0 ? void 0 : _triggerDOM$value.forcePopupAlign();
}
});
var destroyTooltip = ref(false);
var autoDestroy = ref(false);
watchEffect(function() {
var destroyTooltipOnHide = props3.destroyTooltipOnHide;
if (typeof destroyTooltipOnHide === "boolean") {
destroyTooltip.value = destroyTooltipOnHide;
} else if (destroyTooltipOnHide && _typeof$2(destroyTooltipOnHide) === "object") {
var keepParent = destroyTooltipOnHide.keepParent;
destroyTooltip.value = keepParent === true;
autoDestroy.value = keepParent === false;
}
});
return function() {
var overlayClassName = props3.overlayClassName, trigger2 = props3.trigger, mouseEnterDelay = props3.mouseEnterDelay, mouseLeaveDelay = props3.mouseLeaveDelay, overlayStyle = props3.overlayStyle, prefixCls = props3.prefixCls, afterVisibleChange2 = props3.afterVisibleChange, transitionName2 = props3.transitionName, animation = props3.animation, placement = props3.placement, align = props3.align;
props3.destroyTooltipOnHide;
var defaultVisible = props3.defaultVisible, restProps = _objectWithoutProperties$2(props3, _excluded$g);
var extraProps = _objectSpread2$1({}, restProps);
if (props3.visible !== void 0) {
extraProps.popupVisible = props3.visible;
}
var triggerProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
popupClassName: overlayClassName,
prefixCls,
action: trigger2,
builtinPlacements: placements$3,
popupPlacement: placement,
popupAlign: align,
afterPopupVisibleChange: afterVisibleChange2,
popupTransitionName: transitionName2,
popupAnimation: animation,
defaultPopupVisible: defaultVisible,
destroyPopupOnHide: destroyTooltip.value,
autoDestroy: autoDestroy.value,
mouseLeaveDelay,
popupStyle: overlayStyle,
mouseEnterDelay
}, extraProps), attrs), {}, {
onPopupVisibleChange: props3.onVisibleChange || noop$1,
onPopupAlign: props3.onPopupAlign || noop$1,
ref: triggerDOM,
popup: getPopupElement()
});
return createVNode(Trigger, triggerProps, {
default: slots.default
});
};
}
});
var PresetStatusColorTypes = tuple$1("success", "processing", "error", "default", "warning");
var PresetColorTypes = tuple$1("pink", "red", "yellow", "orange", "cyan", "green", "blue", "purple", "geekblue", "magenta", "volcano", "gold", "lime");
const abstractTooltipProps = function() {
return {
trigger: [String, Array],
visible: {
type: Boolean,
default: void 0
},
defaultVisible: {
type: Boolean,
default: void 0
},
placement: String,
color: String,
transitionName: String,
overlayStyle: {
type: Object,
default: void 0
},
overlayClassName: String,
openClassName: String,
prefixCls: String,
mouseEnterDelay: Number,
mouseLeaveDelay: Number,
getPopupContainer: Function,
arrowPointAtCenter: {
type: Boolean,
default: void 0
},
autoAdjustOverflow: {
type: [Boolean, Object],
default: void 0
},
destroyTooltipOnHide: {
type: Boolean,
default: void 0
},
align: {
type: Object,
default: void 0
},
builtinPlacements: {
type: Object,
default: void 0
},
children: Array,
onVisibleChange: Function,
"onUpdate:visible": Function
};
};
var autoAdjustOverflowEnabled = {
adjustX: 1,
adjustY: 1
};
var autoAdjustOverflowDisabled = {
adjustX: 0,
adjustY: 0
};
var targetOffset$1 = [0, 0];
function getOverflowOptions(autoAdjustOverflow2) {
if (typeof autoAdjustOverflow2 === "boolean") {
return autoAdjustOverflow2 ? autoAdjustOverflowEnabled : autoAdjustOverflowDisabled;
}
return _objectSpread2$1(_objectSpread2$1({}, autoAdjustOverflowDisabled), autoAdjustOverflow2);
}
function getPlacements(config) {
var _config$arrowWidth = config.arrowWidth, arrowWidth = _config$arrowWidth === void 0 ? 4 : _config$arrowWidth, _config$horizontalArr = config.horizontalArrowShift, horizontalArrowShift = _config$horizontalArr === void 0 ? 16 : _config$horizontalArr, _config$verticalArrow = config.verticalArrowShift, verticalArrowShift = _config$verticalArrow === void 0 ? 8 : _config$verticalArrow, autoAdjustOverflow2 = config.autoAdjustOverflow, arrowPointAtCenter = config.arrowPointAtCenter;
var placementMap = {
left: {
points: ["cr", "cl"],
offset: [-4, 0]
},
right: {
points: ["cl", "cr"],
offset: [4, 0]
},
top: {
points: ["bc", "tc"],
offset: [0, -4]
},
bottom: {
points: ["tc", "bc"],
offset: [0, 4]
},
topLeft: {
points: ["bl", "tc"],
offset: [-(horizontalArrowShift + arrowWidth), -4]
},
leftTop: {
points: ["tr", "cl"],
offset: [-4, -(verticalArrowShift + arrowWidth)]
},
topRight: {
points: ["br", "tc"],
offset: [horizontalArrowShift + arrowWidth, -4]
},
rightTop: {
points: ["tl", "cr"],
offset: [4, -(verticalArrowShift + arrowWidth)]
},
bottomRight: {
points: ["tr", "bc"],
offset: [horizontalArrowShift + arrowWidth, 4]
},
rightBottom: {
points: ["bl", "cr"],
offset: [4, verticalArrowShift + arrowWidth]
},
bottomLeft: {
points: ["tl", "bc"],
offset: [-(horizontalArrowShift + arrowWidth), 4]
},
leftBottom: {
points: ["br", "cl"],
offset: [-4, verticalArrowShift + arrowWidth]
}
};
Object.keys(placementMap).forEach(function(key2) {
placementMap[key2] = arrowPointAtCenter ? _objectSpread2$1(_objectSpread2$1({}, placementMap[key2]), {}, {
overflow: getOverflowOptions(autoAdjustOverflow2),
targetOffset: targetOffset$1
}) : _objectSpread2$1(_objectSpread2$1({}, placements$3[key2]), {}, {
overflow: getOverflowOptions(autoAdjustOverflow2)
});
placementMap[key2].ignoreShake = true;
});
return placementMap;
}
function firstNotUndefined() {
var arr = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
for (var i2 = 0, len = arr.length; i2 < len; i2++) {
if (arr[i2] !== void 0) {
return arr[i2];
}
}
return void 0;
}
var splitObject = function splitObject2(obj, keys2) {
var picked = {};
var omitted = _objectSpread2$1({}, obj);
keys2.forEach(function(key2) {
if (obj && key2 in obj) {
picked[key2] = obj[key2];
delete omitted[key2];
}
});
return {
picked,
omitted
};
};
var PresetColorRegex$1 = new RegExp("^(".concat(PresetColorTypes.join("|"), ")(-inverse)?$"));
var tooltipProps = function tooltipProps2() {
return _objectSpread2$1(_objectSpread2$1({}, abstractTooltipProps()), {}, {
title: PropTypes$1.any
});
};
var tooltipDefaultProps = function tooltipDefaultProps2() {
return {
trigger: "hover",
transitionName: "zoom-big-fast",
align: {},
placement: "top",
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1,
arrowPointAtCenter: false,
autoAdjustOverflow: true
};
};
const ToolTip = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATooltip",
inheritAttrs: false,
props: initDefaultProps$1(tooltipProps(), {
trigger: "hover",
transitionName: "zoom-big-fast",
align: {},
placement: "top",
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1,
arrowPointAtCenter: false,
autoAdjustOverflow: true
}),
slots: ["title"],
// emits: ['update:visible', 'visibleChange'],
setup: function setup31(props3, _ref) {
var slots = _ref.slots, emit = _ref.emit, attrs = _ref.attrs, expose = _ref.expose;
var _useConfigInject = useConfigInject("tooltip", props3), prefixCls = _useConfigInject.prefixCls, getPopupContainer = _useConfigInject.getPopupContainer;
var visible = ref(firstNotUndefined([props3.visible, props3.defaultVisible]));
var tooltip = ref();
onMounted(function() {
warning$1(props3.defaultVisible === void 0, "Tooltip", "'defaultVisible' is deprecated, please use 'v-model:visible'");
});
var rafId;
watch(function() {
return props3.visible;
}, function(val) {
wrapperRaf.cancel(rafId);
rafId = wrapperRaf(function() {
visible.value = !!val;
});
});
var isNoTitle = function isNoTitle2() {
var _props$title;
var title = (_props$title = props3.title) !== null && _props$title !== void 0 ? _props$title : slots.title;
return !title && title !== 0;
};
var handleVisibleChange = function handleVisibleChange2(val) {
var noTitle = isNoTitle();
if (props3.visible === void 0) {
visible.value = noTitle ? false : val;
}
if (!noTitle) {
emit("update:visible", val);
emit("visibleChange", val);
}
};
var getPopupDomNode2 = function getPopupDomNode3() {
return tooltip.value.getPopupDomNode();
};
expose({
getPopupDomNode: getPopupDomNode2,
visible,
forcePopupAlign: function forcePopupAlign2() {
var _tooltip$value;
return (_tooltip$value = tooltip.value) === null || _tooltip$value === void 0 ? void 0 : _tooltip$value.forcePopupAlign();
}
});
var tooltipPlacements = computed(function() {
var builtinPlacements = props3.builtinPlacements, arrowPointAtCenter = props3.arrowPointAtCenter, autoAdjustOverflow2 = props3.autoAdjustOverflow;
return builtinPlacements || getPlacements({
arrowPointAtCenter,
autoAdjustOverflow: autoAdjustOverflow2
});
});
var isTrueProps = function isTrueProps2(val) {
return val || val === "";
};
var getDisabledCompatibleChildren = function getDisabledCompatibleChildren2(ele) {
var elementType = ele.type;
if (_typeof$2(elementType) === "object" && ele.props) {
if ((elementType.__ANT_BUTTON === true || elementType === "button") && isTrueProps(ele.props.disabled) || elementType.__ANT_SWITCH === true && (isTrueProps(ele.props.disabled) || isTrueProps(ele.props.loading))) {
var _splitObject = splitObject(getStyle(ele), ["position", "left", "right", "top", "bottom", "float", "display", "zIndex"]), picked = _splitObject.picked, omitted = _splitObject.omitted;
var spanStyle = _objectSpread2$1(_objectSpread2$1({
display: "inline-block"
}, picked), {}, {
cursor: "not-allowed",
lineHeight: 1,
width: ele.props && ele.props.block ? "100%" : null
});
var buttonStyle = _objectSpread2$1(_objectSpread2$1({}, omitted), {}, {
pointerEvents: "none"
});
var child = cloneElement(ele, {
style: buttonStyle
}, true);
return createVNode("span", {
"style": spanStyle,
"class": "".concat(prefixCls.value, "-disabled-compatible-wrapper")
}, [child]);
}
}
return ele;
};
var getOverlay = function getOverlay2() {
var _props$title2, _slots$title;
return (_props$title2 = props3.title) !== null && _props$title2 !== void 0 ? _props$title2 : (_slots$title = slots.title) === null || _slots$title === void 0 ? void 0 : _slots$title.call(slots);
};
var onPopupAlign = function onPopupAlign2(domNode, align) {
var placements2 = tooltipPlacements.value;
var placement = Object.keys(placements2).filter(function(key2) {
return placements2[key2].points[0] === align.points[0] && placements2[key2].points[1] === align.points[1];
})[0];
if (!placement) {
return;
}
var rect = domNode.getBoundingClientRect();
var transformOrigin = {
top: "50%",
left: "50%"
};
if (placement.indexOf("top") >= 0 || placement.indexOf("Bottom") >= 0) {
transformOrigin.top = "".concat(rect.height - align.offset[1], "px");
} else if (placement.indexOf("Top") >= 0 || placement.indexOf("bottom") >= 0) {
transformOrigin.top = "".concat(-align.offset[1], "px");
}
if (placement.indexOf("left") >= 0 || placement.indexOf("Right") >= 0) {
transformOrigin.left = "".concat(rect.width - align.offset[0], "px");
} else if (placement.indexOf("right") >= 0 || placement.indexOf("Left") >= 0) {
transformOrigin.left = "".concat(-align.offset[0], "px");
}
domNode.style.transformOrigin = "".concat(transformOrigin.left, " ").concat(transformOrigin.top);
};
return function() {
var _filterEmpty, _slots$default, _classNames;
var openClassName = props3.openClassName, color = props3.color, overlayClassName = props3.overlayClassName;
var children = (_filterEmpty = filterEmpty((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots))) !== null && _filterEmpty !== void 0 ? _filterEmpty : null;
children = children.length === 1 ? children[0] : children;
var tempVisible = visible.value;
if (props3.visible === void 0 && isNoTitle()) {
tempVisible = false;
}
if (!children) {
return null;
}
var child = getDisabledCompatibleChildren(isValidElement(children) ? children : createVNode("span", null, [children]));
var childCls = classNames((_classNames = {}, _defineProperty$q(_classNames, openClassName || "".concat(prefixCls.value, "-open"), true), _defineProperty$q(_classNames, child.props && child.props.class, child.props && child.props.class), _classNames));
var customOverlayClassName = classNames(overlayClassName, _defineProperty$q({}, "".concat(prefixCls.value, "-").concat(color), color && PresetColorRegex$1.test(color)));
var formattedOverlayInnerStyle;
var arrowContentStyle;
if (color && !PresetColorRegex$1.test(color)) {
formattedOverlayInnerStyle = {
backgroundColor: color
};
arrowContentStyle = {
backgroundColor: color
};
}
var vcTooltipProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, attrs), props3), {}, {
prefixCls: prefixCls.value,
getPopupContainer: getPopupContainer.value,
builtinPlacements: tooltipPlacements.value,
visible: tempVisible,
ref: tooltip,
overlayClassName: customOverlayClassName,
overlayInnerStyle: formattedOverlayInnerStyle,
onVisibleChange: handleVisibleChange,
onPopupAlign
});
return createVNode(Tooltip, vcTooltipProps, {
default: function _default3() {
return [visible.value ? cloneElement(child, {
class: childCls
}) : child];
},
arrowContent: function arrowContent() {
return createVNode("span", {
"class": "".concat(prefixCls.value, "-arrow-content"),
"style": arrowContentStyle
}, null);
},
overlay: getOverlay
});
};
}
});
const __unplugin_components_0$3 = withInstall(ToolTip);
var popoverProps = function popoverProps2() {
return _objectSpread2$1(_objectSpread2$1({}, abstractTooltipProps()), {}, {
content: PropTypes$1.any,
title: PropTypes$1.any
});
};
var Popover = defineComponent({
compatConfig: {
MODE: 3
},
name: "APopover",
props: initDefaultProps$1(popoverProps(), _objectSpread2$1(_objectSpread2$1({}, tooltipDefaultProps()), {}, {
trigger: "hover",
transitionName: "zoom-big",
placement: "top",
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1
})),
setup: function setup32(props3, _ref) {
var expose = _ref.expose, slots = _ref.slots;
var tooltipRef = ref();
expose({
getPopupDomNode: function getPopupDomNode2() {
var _tooltipRef$value, _tooltipRef$value$get;
return (_tooltipRef$value = tooltipRef.value) === null || _tooltipRef$value === void 0 ? void 0 : (_tooltipRef$value$get = _tooltipRef$value.getPopupDomNode) === null || _tooltipRef$value$get === void 0 ? void 0 : _tooltipRef$value$get.call(_tooltipRef$value);
}
});
var _useConfigInject = useConfigInject("popover", props3), prefixCls = _useConfigInject.prefixCls, configProvider = _useConfigInject.configProvider;
var rootPrefixCls = computed(function() {
return configProvider.getPrefixCls();
});
var getOverlay = function getOverlay2() {
var _slots$title, _slots$content;
var _props$title = props3.title, title = _props$title === void 0 ? filterEmpty((_slots$title = slots.title) === null || _slots$title === void 0 ? void 0 : _slots$title.call(slots)) : _props$title, _props$content = props3.content, content = _props$content === void 0 ? filterEmpty((_slots$content = slots.content) === null || _slots$content === void 0 ? void 0 : _slots$content.call(slots)) : _props$content;
var hasTitle = !!(Array.isArray(title) ? title.length : title);
var hasContent = !!(Array.isArray(content) ? content.length : title);
if (!hasTitle && !hasContent)
return void 0;
return createVNode(Fragment, null, [hasTitle && createVNode("div", {
"class": "".concat(prefixCls.value, "-title")
}, [title]), createVNode("div", {
"class": "".concat(prefixCls.value, "-inner-content")
}, [content])]);
};
return function() {
return createVNode(__unplugin_components_0$3, _objectSpread2$1(_objectSpread2$1({}, omit(props3, ["title", "content"])), {}, {
"prefixCls": prefixCls.value,
"ref": tooltipRef,
"transitionName": getTransitionName$1(rootPrefixCls.value, "zoom-big", props3.transitionName)
}), {
title: getOverlay,
default: slots.default
});
};
}
});
const __unplugin_components_6 = withInstall(Popover);
var autoAdjustOverflow$1 = {
adjustX: 1,
adjustY: 1
};
var targetOffset = [0, 0];
var placements$1 = {
topLeft: {
points: ["bl", "tl"],
overflow: autoAdjustOverflow$1,
offset: [0, -4],
targetOffset
},
topCenter: {
points: ["bc", "tc"],
overflow: autoAdjustOverflow$1,
offset: [0, -4],
targetOffset
},
topRight: {
points: ["br", "tr"],
overflow: autoAdjustOverflow$1,
offset: [0, -4],
targetOffset
},
bottomLeft: {
points: ["tl", "bl"],
overflow: autoAdjustOverflow$1,
offset: [0, 4],
targetOffset
},
bottomCenter: {
points: ["tc", "bc"],
overflow: autoAdjustOverflow$1,
offset: [0, 4],
targetOffset
},
bottomRight: {
points: ["tr", "br"],
overflow: autoAdjustOverflow$1,
offset: [0, 4],
targetOffset
}
};
const placements$2 = placements$1;
var _excluded$f = ["prefixCls", "arrow", "showAction", "overlayStyle", "trigger", "placement", "align", "getPopupContainer", "transitionName", "animation", "overlayClassName"];
const Dropdown$2 = defineComponent({
compatConfig: {
MODE: 3
},
props: {
minOverlayWidthMatchTrigger: {
type: Boolean,
default: void 0
},
arrow: {
type: Boolean,
default: false
},
prefixCls: PropTypes$1.string.def("rc-dropdown"),
transitionName: String,
overlayClassName: PropTypes$1.string.def(""),
openClassName: String,
animation: PropTypes$1.any,
align: PropTypes$1.object,
overlayStyle: {
type: Object,
default: void 0
},
placement: PropTypes$1.string.def("bottomLeft"),
overlay: PropTypes$1.any,
trigger: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.arrayOf(PropTypes$1.string)]).def("hover"),
alignPoint: {
type: Boolean,
default: void 0
},
showAction: PropTypes$1.array,
hideAction: PropTypes$1.array,
getPopupContainer: Function,
visible: {
type: Boolean,
default: void 0
},
defaultVisible: {
type: Boolean,
default: false
},
mouseEnterDelay: PropTypes$1.number.def(0.15),
mouseLeaveDelay: PropTypes$1.number.def(0.1)
},
emits: ["visibleChange", "overlayClick"],
slots: ["overlay"],
setup: function setup33(props3, _ref) {
var slots = _ref.slots, emit = _ref.emit, expose = _ref.expose;
var triggerVisible = ref(!!props3.visible);
watch(function() {
return props3.visible;
}, function(val) {
if (val !== void 0) {
triggerVisible.value = val;
}
});
var triggerRef = ref();
expose({
triggerRef
});
var onClick2 = function onClick3(e2) {
if (props3.visible === void 0) {
triggerVisible.value = false;
}
emit("overlayClick", e2);
};
var onVisibleChange = function onVisibleChange2(visible) {
if (props3.visible === void 0) {
triggerVisible.value = visible;
}
emit("visibleChange", visible);
};
var getMenuElement = function getMenuElement2() {
var _slots$overlay;
var overlayElement = (_slots$overlay = slots.overlay) === null || _slots$overlay === void 0 ? void 0 : _slots$overlay.call(slots);
var extraOverlayProps = {
prefixCls: "".concat(props3.prefixCls, "-menu"),
onClick: onClick2,
getPopupContainer: function getPopupContainer() {
return triggerRef.value.getPopupDomNode();
}
};
return createVNode(Fragment, null, [props3.arrow && createVNode("div", {
"class": "".concat(props3.prefixCls, "-arrow")
}, null), cloneElement(overlayElement, extraOverlayProps, false)]);
};
var minOverlayWidthMatchTrigger = computed(function() {
var _props$minOverlayWidt = props3.minOverlayWidthMatchTrigger, matchTrigger = _props$minOverlayWidt === void 0 ? !props3.alignPoint : _props$minOverlayWidt;
return matchTrigger;
});
var renderChildren2 = function renderChildren3() {
var _slots$default;
var children = (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
return triggerVisible.value && children ? cloneElement(children[0], {
class: props3.openClassName || "".concat(props3.prefixCls, "-open")
}, false) : children;
};
var triggerHideAction = computed(function() {
if (!props3.hideAction && props3.trigger.indexOf("contextmenu") !== -1) {
return ["click"];
}
return props3.hideAction;
});
return function() {
var prefixCls = props3.prefixCls, arrow = props3.arrow, showAction = props3.showAction, overlayStyle = props3.overlayStyle, trigger2 = props3.trigger, placement = props3.placement, align = props3.align, getPopupContainer = props3.getPopupContainer, transitionName2 = props3.transitionName, animation = props3.animation, overlayClassName = props3.overlayClassName, otherProps = _objectWithoutProperties$2(props3, _excluded$f);
return createVNode(Trigger, _objectSpread2$1(_objectSpread2$1({}, otherProps), {}, {
"prefixCls": prefixCls,
"ref": triggerRef,
"popupClassName": classNames(overlayClassName, _defineProperty$q({}, "".concat(prefixCls, "-show-arrow"), arrow)),
"popupStyle": overlayStyle,
"builtinPlacements": placements$2,
"action": trigger2,
"showAction": showAction,
"hideAction": triggerHideAction.value || [],
"popupPlacement": placement,
"popupAlign": align,
"popupTransitionName": transitionName2,
"popupAnimation": animation,
"popupVisible": triggerVisible.value,
"stretch": minOverlayWidthMatchTrigger.value ? "minWidth" : "",
"onPopupVisibleChange": onVisibleChange,
"getPopupContainer": getPopupContainer
}), {
popup: getMenuElement,
default: renderChildren2
});
};
}
});
var START_EVENT_NAME_MAP = {
transitionstart: {
transition: "transitionstart",
WebkitTransition: "webkitTransitionStart",
MozTransition: "mozTransitionStart",
OTransition: "oTransitionStart",
msTransition: "MSTransitionStart"
},
animationstart: {
animation: "animationstart",
WebkitAnimation: "webkitAnimationStart",
MozAnimation: "mozAnimationStart",
OAnimation: "oAnimationStart",
msAnimation: "MSAnimationStart"
}
};
var END_EVENT_NAME_MAP = {
transitionend: {
transition: "transitionend",
WebkitTransition: "webkitTransitionEnd",
MozTransition: "mozTransitionEnd",
OTransition: "oTransitionEnd",
msTransition: "MSTransitionEnd"
},
animationend: {
animation: "animationend",
WebkitAnimation: "webkitAnimationEnd",
MozAnimation: "mozAnimationEnd",
OAnimation: "oAnimationEnd",
msAnimation: "MSAnimationEnd"
}
};
var startEvents = [];
var endEvents = [];
function detectEvents() {
var testEl = document.createElement("div");
var style = testEl.style;
if (!("AnimationEvent" in window)) {
delete START_EVENT_NAME_MAP.animationstart.animation;
delete END_EVENT_NAME_MAP.animationend.animation;
}
if (!("TransitionEvent" in window)) {
delete START_EVENT_NAME_MAP.transitionstart.transition;
delete END_EVENT_NAME_MAP.transitionend.transition;
}
function process2(EVENT_NAME_MAP, events) {
for (var baseEventName in EVENT_NAME_MAP) {
if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) {
var baseEvents = EVENT_NAME_MAP[baseEventName];
for (var styleName in baseEvents) {
if (styleName in style) {
events.push(baseEvents[styleName]);
break;
}
}
}
}
}
process2(START_EVENT_NAME_MAP, startEvents);
process2(END_EVENT_NAME_MAP, endEvents);
}
if (typeof window !== "undefined" && typeof document !== "undefined") {
detectEvents();
}
function addEventListener$1(node, eventName, eventListener) {
node.addEventListener(eventName, eventListener, false);
}
function removeEventListener$1(node, eventName, eventListener) {
node.removeEventListener(eventName, eventListener, false);
}
var TransitionEvents = {
// Start events
startEvents,
addStartEventListener: function addStartEventListener(node, eventListener) {
if (startEvents.length === 0) {
setTimeout(eventListener, 0);
return;
}
startEvents.forEach(function(startEvent) {
addEventListener$1(node, startEvent, eventListener);
});
},
removeStartEventListener: function removeStartEventListener(node, eventListener) {
if (startEvents.length === 0) {
return;
}
startEvents.forEach(function(startEvent) {
removeEventListener$1(node, startEvent, eventListener);
});
},
// End events
endEvents,
addEndEventListener: function addEndEventListener(node, eventListener) {
if (endEvents.length === 0) {
setTimeout(eventListener, 0);
return;
}
endEvents.forEach(function(endEvent) {
addEventListener$1(node, endEvent, eventListener);
});
},
removeEndEventListener: function removeEndEventListener(node, eventListener) {
if (endEvents.length === 0) {
return;
}
endEvents.forEach(function(endEvent) {
removeEventListener$1(node, endEvent, eventListener);
});
}
};
const TransitionEvents$1 = TransitionEvents;
var styleForPesudo;
function isHidden(element) {
if (process.env.NODE_ENV === "test") {
return false;
}
return !element || element.offsetParent === null;
}
function isNotGrey(color) {
var match2 = (color || "").match(/rgba?\((\d*), (\d*), (\d*)(, [\.\d]*)?\)/);
if (match2 && match2[1] && match2[2] && match2[3]) {
return !(match2[1] === match2[2] && match2[2] === match2[3]);
}
return true;
}
const Wave = defineComponent({
compatConfig: {
MODE: 3
},
name: "Wave",
props: {
insertExtraNode: Boolean,
disabled: Boolean
},
setup: function setup34(props3, _ref) {
var slots = _ref.slots, expose = _ref.expose;
var instance = getCurrentInstance();
var _useConfigInject = useConfigInject("", props3), csp = _useConfigInject.csp, prefixCls = _useConfigInject.prefixCls;
expose({
csp
});
var eventIns = null;
var clickWaveTimeoutId = null;
var animationStartId = null;
var animationStart = false;
var extraNode = null;
var isUnmounted = false;
var onTransitionStart = function onTransitionStart2(e2) {
if (isUnmounted)
return;
var node = findDOMNode(instance);
if (!e2 || e2.target !== node) {
return;
}
if (!animationStart) {
resetEffect(node);
}
};
var onTransitionEnd = function onTransitionEnd2(e2) {
if (!e2 || e2.animationName !== "fadeEffect") {
return;
}
resetEffect(e2.target);
};
var getAttributeName = function getAttributeName2() {
var insertExtraNode = props3.insertExtraNode;
return insertExtraNode ? "".concat(prefixCls.value, "-click-animating") : "".concat(prefixCls.value, "-click-animating-without-extra-node");
};
var onClick2 = function onClick3(node, waveColor) {
var insertExtraNode = props3.insertExtraNode, disabled = props3.disabled;
if (disabled || !node || isHidden(node) || node.className.indexOf("-leave") >= 0) {
return;
}
extraNode = document.createElement("div");
extraNode.className = "".concat(prefixCls.value, "-click-animating-node");
var attributeName = getAttributeName();
node.removeAttribute(attributeName);
node.setAttribute(attributeName, "true");
styleForPesudo = styleForPesudo || document.createElement("style");
if (waveColor && waveColor !== "#ffffff" && waveColor !== "rgb(255, 255, 255)" && isNotGrey(waveColor) && !/rgba\(\d*, \d*, \d*, 0\)/.test(waveColor) && // any transparent rgba color
waveColor !== "transparent") {
var _csp$value;
if ((_csp$value = csp.value) !== null && _csp$value !== void 0 && _csp$value.nonce) {
styleForPesudo.nonce = csp.value.nonce;
}
extraNode.style.borderColor = waveColor;
styleForPesudo.innerHTML = "\n [".concat(prefixCls.value, "-click-animating-without-extra-node='true']::after, .").concat(prefixCls.value, "-click-animating-node {\n --antd-wave-shadow-color: ").concat(waveColor, ";\n }");
if (!document.body.contains(styleForPesudo)) {
document.body.appendChild(styleForPesudo);
}
}
if (insertExtraNode) {
node.appendChild(extraNode);
}
TransitionEvents$1.addStartEventListener(node, onTransitionStart);
TransitionEvents$1.addEndEventListener(node, onTransitionEnd);
};
var resetEffect = function resetEffect2(node) {
if (!node || node === extraNode || !(node instanceof Element)) {
return;
}
var insertExtraNode = props3.insertExtraNode;
var attributeName = getAttributeName();
node.setAttribute(attributeName, "false");
if (styleForPesudo) {
styleForPesudo.innerHTML = "";
}
if (insertExtraNode && extraNode && node.contains(extraNode)) {
node.removeChild(extraNode);
}
TransitionEvents$1.removeStartEventListener(node, onTransitionStart);
TransitionEvents$1.removeEndEventListener(node, onTransitionEnd);
};
var bindAnimationEvent = function bindAnimationEvent2(node) {
if (!node || !node.getAttribute || node.getAttribute("disabled") || node.className.indexOf("disabled") >= 0) {
return;
}
var newClick = function newClick2(e2) {
if (e2.target.tagName === "INPUT" || isHidden(e2.target)) {
return;
}
resetEffect(node);
var waveColor = getComputedStyle(node).getPropertyValue("border-top-color") || // Firefox Compatible
getComputedStyle(node).getPropertyValue("border-color") || getComputedStyle(node).getPropertyValue("background-color");
clickWaveTimeoutId = setTimeout(function() {
return onClick2(node, waveColor);
}, 0);
wrapperRaf.cancel(animationStartId);
animationStart = true;
animationStartId = wrapperRaf(function() {
animationStart = false;
}, 10);
};
node.addEventListener("click", newClick, true);
return {
cancel: function cancel() {
node.removeEventListener("click", newClick, true);
}
};
};
onMounted(function() {
nextTick(function() {
var node = findDOMNode(instance);
if (node.nodeType !== 1) {
return;
}
eventIns = bindAnimationEvent(node);
});
});
onBeforeUnmount(function() {
if (eventIns) {
eventIns.cancel();
}
clearTimeout(clickWaveTimeoutId);
isUnmounted = true;
});
return function() {
var _slots$default;
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)[0];
};
}
});
function convertLegacyProps(type) {
if (type === "danger") {
return {
danger: true
};
}
return {
type
};
}
var buttonProps = function buttonProps2() {
return {
prefixCls: String,
type: String,
htmlType: {
type: String,
default: "button"
},
shape: {
type: String
},
size: {
type: String
},
loading: {
type: [Boolean, Object],
default: function _default3() {
return false;
}
},
disabled: {
type: Boolean,
default: void 0
},
ghost: {
type: Boolean,
default: void 0
},
block: {
type: Boolean,
default: void 0
},
danger: {
type: Boolean,
default: void 0
},
icon: PropTypes$1.any,
href: String,
target: String,
title: String,
onClick: {
type: Function
},
onMousedown: {
type: Function
}
};
};
const buttonTypes = buttonProps;
var getCollapsedWidth = function getCollapsedWidth2(node) {
if (node) {
node.style.width = "0px";
node.style.opacity = "0";
node.style.transform = "scale(0)";
}
};
var getRealWidth = function getRealWidth2(node) {
nextTick(function() {
if (node) {
node.style.width = "".concat(node.scrollWidth, "px");
node.style.opacity = "1";
node.style.transform = "scale(1)";
}
});
};
var resetStyle = function resetStyle2(node) {
if (node && node.style) {
node.style.width = null;
node.style.opacity = null;
node.style.transform = null;
}
};
const LoadingIcon = defineComponent({
compatConfig: {
MODE: 3
},
name: "LoadingIcon",
props: {
prefixCls: String,
loading: [Boolean, Object],
existIcon: Boolean
},
setup: function setup35(props3) {
return function() {
var existIcon = props3.existIcon, prefixCls = props3.prefixCls, loading = props3.loading;
if (existIcon) {
return createVNode("span", {
"class": "".concat(prefixCls, "-loading-icon")
}, [createVNode(LoadingOutlined$1, null, null)]);
}
var visible = !!loading;
return createVNode(Transition, {
"name": "".concat(prefixCls, "-loading-icon-motion"),
"onBeforeEnter": getCollapsedWidth,
"onEnter": getRealWidth,
"onAfterEnter": resetStyle,
"onBeforeLeave": getRealWidth,
"onLeave": function onLeave(node) {
setTimeout(function() {
getCollapsedWidth(node);
});
},
"onAfterLeave": resetStyle
}, {
default: function _default3() {
return [visible ? createVNode("span", {
"class": "".concat(prefixCls, "-loading-icon")
}, [createVNode(LoadingOutlined$1, null, null)]) : null];
}
});
};
}
});
var rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/;
var isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);
function isUnborderedButtonType(type) {
return type === "text" || type === "link";
}
const Button = defineComponent({
compatConfig: {
MODE: 3
},
name: "AButton",
inheritAttrs: false,
__ANT_BUTTON: true,
props: initDefaultProps$1(buttonTypes(), {
type: "default"
}),
slots: ["icon"],
// emits: ['click', 'mousedown'],
setup: function setup36(props3, _ref) {
var slots = _ref.slots, attrs = _ref.attrs, emit = _ref.emit, expose = _ref.expose;
var _useConfigInject = useConfigInject("btn", props3), prefixCls = _useConfigInject.prefixCls, autoInsertSpaceInButton = _useConfigInject.autoInsertSpaceInButton, direction = _useConfigInject.direction, size = _useConfigInject.size;
var buttonNodeRef = ref(null);
var delayTimeoutRef = ref(void 0);
var isNeedInserted = false;
var innerLoading = ref(false);
var hasTwoCNChar = ref(false);
var autoInsertSpace = computed(function() {
return autoInsertSpaceInButton.value !== false;
});
var loadingOrDelay = computed(function() {
return _typeof$2(props3.loading) === "object" && props3.loading.delay ? props3.loading.delay || true : !!props3.loading;
});
watch(loadingOrDelay, function(val) {
clearTimeout(delayTimeoutRef.value);
if (typeof loadingOrDelay.value === "number") {
delayTimeoutRef.value = setTimeout(function() {
innerLoading.value = val;
}, loadingOrDelay.value);
} else {
innerLoading.value = val;
}
}, {
immediate: true
});
var classes = computed(function() {
var _ref2;
var type = props3.type, _props$shape = props3.shape, shape = _props$shape === void 0 ? "default" : _props$shape, ghost = props3.ghost, block = props3.block, danger = props3.danger;
var pre = prefixCls.value;
var sizeClassNameMap = {
large: "lg",
small: "sm",
middle: void 0
};
var sizeFullname = size.value;
var sizeCls = sizeFullname ? sizeClassNameMap[sizeFullname] || "" : "";
return _ref2 = {}, _defineProperty$q(_ref2, "".concat(pre), true), _defineProperty$q(_ref2, "".concat(pre, "-").concat(type), type), _defineProperty$q(_ref2, "".concat(pre, "-").concat(shape), shape !== "default" && shape), _defineProperty$q(_ref2, "".concat(pre, "-").concat(sizeCls), sizeCls), _defineProperty$q(_ref2, "".concat(pre, "-loading"), innerLoading.value), _defineProperty$q(_ref2, "".concat(pre, "-background-ghost"), ghost && !isUnborderedButtonType(type)), _defineProperty$q(_ref2, "".concat(pre, "-two-chinese-chars"), hasTwoCNChar.value && autoInsertSpace.value), _defineProperty$q(_ref2, "".concat(pre, "-block"), block), _defineProperty$q(_ref2, "".concat(pre, "-dangerous"), !!danger), _defineProperty$q(_ref2, "".concat(pre, "-rtl"), direction.value === "rtl"), _ref2;
});
var fixTwoCNChar = function fixTwoCNChar2() {
var node = buttonNodeRef.value;
if (!node || autoInsertSpaceInButton.value === false) {
return;
}
var buttonText = node.textContent;
if (isNeedInserted && isTwoCNChar(buttonText)) {
if (!hasTwoCNChar.value) {
hasTwoCNChar.value = true;
}
} else if (hasTwoCNChar.value) {
hasTwoCNChar.value = false;
}
};
var handleClick = function handleClick2(event) {
if (innerLoading.value || props3.disabled) {
event.preventDefault();
return;
}
emit("click", event);
};
var insertSpace = function insertSpace2(child, needInserted) {
var SPACE = needInserted ? " " : "";
if (child.type === Text) {
var text = child.children.trim();
if (isTwoCNChar(text)) {
text = text.split("").join(SPACE);
}
return createVNode("span", null, [text]);
}
return child;
};
watchEffect(function() {
devWarning(!(props3.ghost && isUnborderedButtonType(props3.type)), "Button", "`link` or `text` button can't be a `ghost` button.");
});
onMounted(fixTwoCNChar);
onUpdated(fixTwoCNChar);
onBeforeUnmount(function() {
delayTimeoutRef.value && clearTimeout(delayTimeoutRef.value);
});
var focus = function focus2() {
var _buttonNodeRef$value;
(_buttonNodeRef$value = buttonNodeRef.value) === null || _buttonNodeRef$value === void 0 ? void 0 : _buttonNodeRef$value.focus();
};
var blur = function blur2() {
var _buttonNodeRef$value2;
(_buttonNodeRef$value2 = buttonNodeRef.value) === null || _buttonNodeRef$value2 === void 0 ? void 0 : _buttonNodeRef$value2.blur();
};
expose({
focus,
blur
});
return function() {
var _slots$icon, _slots$default;
var _props$icon = props3.icon, icon = _props$icon === void 0 ? (_slots$icon = slots.icon) === null || _slots$icon === void 0 ? void 0 : _slots$icon.call(slots) : _props$icon;
var children = flattenChildren((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots));
isNeedInserted = children.length === 1 && !icon && !isUnborderedButtonType(props3.type);
var type = props3.type, htmlType = props3.htmlType, disabled = props3.disabled, href = props3.href, title = props3.title, target = props3.target, onMousedown2 = props3.onMousedown;
var iconType = innerLoading.value ? "loading" : icon;
var buttonProps3 = _objectSpread2$1(_objectSpread2$1({}, attrs), {}, {
title,
disabled,
class: [classes.value, attrs.class, _defineProperty$q({}, "".concat(prefixCls.value, "-icon-only"), children.length === 0 && !!iconType)],
onClick: handleClick,
onMousedown: onMousedown2
});
if (!disabled) {
delete buttonProps3.disabled;
}
var iconNode = icon && !innerLoading.value ? icon : createVNode(LoadingIcon, {
"existIcon": !!icon,
"prefixCls": prefixCls.value,
"loading": !!innerLoading.value
}, null);
var kids = children.map(function(child) {
return insertSpace(child, isNeedInserted && autoInsertSpace.value);
});
if (href !== void 0) {
return createVNode("a", _objectSpread2$1(_objectSpread2$1({}, buttonProps3), {}, {
"href": href,
"target": target,
"ref": buttonNodeRef
}), [iconNode, kids]);
}
var buttonNode = createVNode("button", _objectSpread2$1(_objectSpread2$1({}, buttonProps3), {}, {
"ref": buttonNodeRef,
"type": htmlType
}), [iconNode, kids]);
if (isUnborderedButtonType(type)) {
return buttonNode;
}
return createVNode(Wave, {
"ref": "wave",
"disabled": !!innerLoading.value
}, {
default: function _default3() {
return [buttonNode];
}
});
};
}
});
function _defineProperties(target, props3) {
for (var i2 = 0; i2 < props3.length; i2++) {
var descriptor = props3[i2];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor)
descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var UnreachableException = /* @__PURE__ */ _createClass(function UnreachableException2(value2) {
_classCallCheck(this, UnreachableException2);
this.error = new Error("unreachable case: ".concat(JSON.stringify(value2)));
});
var buttonGroupProps = function buttonGroupProps2() {
return {
prefixCls: String,
size: {
type: String
}
};
};
const ButtonGroup$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AButtonGroup",
props: buttonGroupProps(),
setup: function setup37(props3, _ref) {
var slots = _ref.slots;
var _useConfigInject = useConfigInject("btn-group", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction;
var classes = computed(function() {
var _ref2;
var size = props3.size;
var sizeCls = "";
switch (size) {
case "large":
sizeCls = "lg";
break;
case "small":
sizeCls = "sm";
break;
case "middle":
case void 0:
break;
default:
console.warn(new UnreachableException(size).error);
}
return _ref2 = {}, _defineProperty$q(_ref2, "".concat(prefixCls.value), true), _defineProperty$q(_ref2, "".concat(prefixCls.value, "-").concat(sizeCls), sizeCls), _defineProperty$q(_ref2, "".concat(prefixCls.value, "-rtl"), direction.value === "rtl"), _ref2;
});
return function() {
var _slots$default;
return createVNode("div", {
"class": classes.value
}, [flattenChildren((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots))]);
};
}
});
Button.Group = ButtonGroup$1;
Button.install = function(app) {
app.component(Button.name, Button);
app.component(ButtonGroup$1.name, ButtonGroup$1);
return app;
};
var dropdownProps = function dropdownProps2() {
return {
arrow: {
type: [Boolean, Object],
default: void 0
},
trigger: {
type: [Array, String]
},
overlay: PropTypes$1.any,
visible: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
align: {
type: Object
},
getPopupContainer: Function,
prefixCls: String,
transitionName: String,
placement: String,
overlayClassName: String,
overlayStyle: {
type: Object,
default: void 0
},
forceRender: {
type: Boolean,
default: void 0
},
mouseEnterDelay: Number,
mouseLeaveDelay: Number,
openClassName: String,
minOverlayWidthMatchTrigger: {
type: Boolean,
default: void 0
},
destroyPopupOnHide: {
type: Boolean,
default: void 0
},
onVisibleChange: {
type: Function
},
"onUpdate:visible": {
type: Function
}
};
};
var buttonTypesProps = buttonTypes();
var dropdownButtonProps = function dropdownButtonProps2() {
return _objectSpread2$1(_objectSpread2$1({}, dropdownProps()), {}, {
type: buttonTypesProps.type,
size: String,
htmlType: buttonTypesProps.htmlType,
href: String,
disabled: {
type: Boolean,
default: void 0
},
prefixCls: String,
icon: PropTypes$1.any,
title: String,
loading: buttonTypesProps.loading,
onClick: {
type: Function
}
});
};
var EllipsisOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "ellipsis", "theme": "outlined" };
const EllipsisOutlinedSvg = EllipsisOutlined$2;
function _objectSpread$8(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$8(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$8(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var EllipsisOutlined = function EllipsisOutlined2(props3, context) {
var p = _objectSpread$8({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$8({}, p, {
"icon": EllipsisOutlinedSvg
}), null);
};
EllipsisOutlined.displayName = "EllipsisOutlined";
EllipsisOutlined.inheritAttrs = false;
const EllipsisOutlined$1 = EllipsisOutlined;
var _excluded$e = ["type", "disabled", "loading", "htmlType", "class", "overlay", "trigger", "align", "visible", "onVisibleChange", "placement", "href", "title", "icon", "mouseEnterDelay", "mouseLeaveDelay", "overlayClassName", "overlayStyle", "destroyPopupOnHide", "onClick", "onUpdate:visible"];
var ButtonGroup = Button.Group;
const DropdownButton = defineComponent({
compatConfig: {
MODE: 3
},
name: "ADropdownButton",
inheritAttrs: false,
__ANT_BUTTON: true,
props: initDefaultProps$1(dropdownButtonProps(), {
trigger: "hover",
placement: "bottomRight",
type: "default"
}),
// emits: ['click', 'visibleChange', 'update:visible'],
slots: ["icon", "leftButton", "rightButton", "overlay"],
setup: function setup38(props3, _ref) {
var slots = _ref.slots, attrs = _ref.attrs, emit = _ref.emit;
var handleVisibleChange = function handleVisibleChange2(val) {
emit("update:visible", val);
emit("visibleChange", val);
};
var _useConfigInject = useConfigInject("dropdown-button", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction, getPopupContainer = _useConfigInject.getPopupContainer;
return function() {
var _slots$overlay, _slots$icon;
var _props$attrs = _objectSpread2$1(_objectSpread2$1({}, props3), attrs), _props$attrs$type = _props$attrs.type, type = _props$attrs$type === void 0 ? "default" : _props$attrs$type, disabled = _props$attrs.disabled, loading = _props$attrs.loading, htmlType = _props$attrs.htmlType, _props$attrs$class = _props$attrs.class, className = _props$attrs$class === void 0 ? "" : _props$attrs$class, _props$attrs$overlay = _props$attrs.overlay, _overlay = _props$attrs$overlay === void 0 ? (_slots$overlay = slots.overlay) === null || _slots$overlay === void 0 ? void 0 : _slots$overlay.call(slots) : _props$attrs$overlay, trigger2 = _props$attrs.trigger, align = _props$attrs.align, visible = _props$attrs.visible;
_props$attrs.onVisibleChange;
var _props$attrs$placemen = _props$attrs.placement, placement = _props$attrs$placemen === void 0 ? direction.value === "rtl" ? "bottomLeft" : "bottomRight" : _props$attrs$placemen, href = _props$attrs.href, title = _props$attrs.title, _props$attrs$icon = _props$attrs.icon, icon = _props$attrs$icon === void 0 ? ((_slots$icon = slots.icon) === null || _slots$icon === void 0 ? void 0 : _slots$icon.call(slots)) || createVNode(EllipsisOutlined$1, null, null) : _props$attrs$icon, mouseEnterDelay = _props$attrs.mouseEnterDelay, mouseLeaveDelay = _props$attrs.mouseLeaveDelay, overlayClassName = _props$attrs.overlayClassName, overlayStyle = _props$attrs.overlayStyle, destroyPopupOnHide = _props$attrs.destroyPopupOnHide, onClick2 = _props$attrs.onClick;
_props$attrs["onUpdate:visible"];
var restProps = _objectWithoutProperties$2(_props$attrs, _excluded$e);
var dropdownProps3 = {
align,
disabled,
trigger: disabled ? [] : trigger2,
placement,
getPopupContainer: getPopupContainer.value,
onVisibleChange: handleVisibleChange,
mouseEnterDelay,
mouseLeaveDelay,
visible,
overlayClassName,
overlayStyle,
destroyPopupOnHide
};
var leftButton = createVNode(Button, {
"type": type,
"disabled": disabled,
"loading": loading,
"onClick": onClick2,
"htmlType": htmlType,
"href": href,
"title": title
}, {
default: slots.default
});
var rightButton = createVNode(Button, {
"type": type,
"icon": icon
}, null);
return createVNode(ButtonGroup, _objectSpread2$1(_objectSpread2$1({}, restProps), {}, {
"class": classNames(prefixCls.value, className)
}), {
default: function _default3() {
return [slots.leftButton ? slots.leftButton({
button: leftButton
}) : leftButton, createVNode(Dropdown$1, dropdownProps3, {
default: function _default4() {
return [slots.rightButton ? slots.rightButton({
button: rightButton
}) : rightButton];
},
overlay: function overlay() {
return _overlay;
}
})];
}
});
};
}
});
var RightOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, "name": "right", "theme": "outlined" };
const RightOutlinedSvg = RightOutlined$2;
function _objectSpread$7(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$7(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$7(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var RightOutlined = function RightOutlined2(props3, context) {
var p = _objectSpread$7({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$7({}, p, {
"icon": RightOutlinedSvg
}), null);
};
RightOutlined.displayName = "RightOutlined";
RightOutlined.inheritAttrs = false;
const RightOutlined$1 = RightOutlined;
var Dropdown = defineComponent({
compatConfig: {
MODE: 3
},
name: "ADropdown",
inheritAttrs: false,
props: initDefaultProps$1(dropdownProps(), {
mouseEnterDelay: 0.15,
mouseLeaveDelay: 0.1,
placement: "bottomLeft",
trigger: "hover"
}),
// emits: ['visibleChange', 'update:visible'],
slots: ["overlay"],
setup: function setup39(props3, _ref) {
var slots = _ref.slots, attrs = _ref.attrs, emit = _ref.emit;
var _useConfigInject = useConfigInject("dropdown", props3), prefixCls = _useConfigInject.prefixCls, rootPrefixCls = _useConfigInject.rootPrefixCls, direction = _useConfigInject.direction, getPopupContainer = _useConfigInject.getPopupContainer;
var transitionName2 = computed(function() {
var _props$placement = props3.placement, placement2 = _props$placement === void 0 ? "" : _props$placement, transitionName3 = props3.transitionName;
if (transitionName3 !== void 0) {
return transitionName3;
}
if (placement2.indexOf("top") >= 0) {
return "".concat(rootPrefixCls.value, "-slide-down");
}
return "".concat(rootPrefixCls.value, "-slide-up");
});
var renderOverlay = function renderOverlay2() {
var _slots$overlay, _overlayNode$children, _overlayNode$children2;
var overlay = props3.overlay || ((_slots$overlay = slots.overlay) === null || _slots$overlay === void 0 ? void 0 : _slots$overlay.call(slots));
var overlayNode = Array.isArray(overlay) ? overlay[0] : overlay;
if (!overlayNode)
return null;
var overlayProps = overlayNode.props || {};
devWarning(!overlayProps.mode || overlayProps.mode === "vertical", "Dropdown", 'mode="'.concat(overlayProps.mode, `" is not supported for Dropdown's Menu.`));
var _overlayProps$selecta = overlayProps.selectable, selectable = _overlayProps$selecta === void 0 ? false : _overlayProps$selecta, _overlayProps$expandI = overlayProps.expandIcon, expandIcon = _overlayProps$expandI === void 0 ? (_overlayNode$children = overlayNode.children) === null || _overlayNode$children === void 0 ? void 0 : (_overlayNode$children2 = _overlayNode$children.expandIcon) === null || _overlayNode$children2 === void 0 ? void 0 : _overlayNode$children2.call(_overlayNode$children) : _overlayProps$expandI;
var overlayNodeExpandIcon = typeof expandIcon !== "undefined" && isValidElement(expandIcon) ? expandIcon : createVNode("span", {
"class": "".concat(prefixCls.value, "-menu-submenu-arrow")
}, [createVNode(RightOutlined$1, {
"class": "".concat(prefixCls.value, "-menu-submenu-arrow-icon")
}, null)]);
var fixedModeOverlay = isValidElement(overlayNode) ? cloneElement(overlayNode, {
mode: "vertical",
selectable,
expandIcon: function expandIcon2() {
return overlayNodeExpandIcon;
}
}) : overlayNode;
return fixedModeOverlay;
};
var placement = computed(function() {
var placement2 = props3.placement;
if (!placement2) {
return direction.value === "rtl" ? "bottomRight" : "bottomLeft";
}
if (placement2.includes("Center")) {
var newPlacement = placement2.slice(0, placement2.indexOf("Center"));
devWarning(!placement2.includes("Center"), "Dropdown", "You are using '".concat(placement2, "' placement in Dropdown, which is deprecated. Try to use '").concat(newPlacement, "' instead."));
return newPlacement;
}
return placement2;
});
var handleVisibleChange = function handleVisibleChange2(val) {
emit("update:visible", val);
emit("visibleChange", val);
};
return function() {
var _slots$default, _child$props;
var arrow = props3.arrow, trigger2 = props3.trigger, disabled = props3.disabled, overlayClassName = props3.overlayClassName;
var child = (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)[0];
var dropdownTrigger = cloneElement(child, _extends({
class: classNames(child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.class, _defineProperty$q({}, "".concat(prefixCls.value, "-rtl"), direction.value === "rtl"), "".concat(prefixCls.value, "-trigger"))
}, disabled ? {
disabled
} : {}));
var overlayClassNameCustomized = classNames(overlayClassName, _defineProperty$q({}, "".concat(prefixCls.value, "-rtl"), direction.value === "rtl"));
var triggerActions = disabled ? [] : trigger2;
var alignPoint2;
if (triggerActions && triggerActions.indexOf("contextmenu") !== -1) {
alignPoint2 = true;
}
var builtinPlacements = getPlacements({
arrowPointAtCenter: _typeof$2(arrow) === "object" && arrow.pointAtCenter,
autoAdjustOverflow: true
});
var dropdownProps3 = omit(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, props3), attrs), {}, {
builtinPlacements,
overlayClassName: overlayClassNameCustomized,
arrow,
alignPoint: alignPoint2,
prefixCls: prefixCls.value,
getPopupContainer: getPopupContainer.value,
transitionName: transitionName2.value,
trigger: triggerActions,
onVisibleChange: handleVisibleChange,
placement: placement.value
}), ["overlay", "onUpdate:visible"]);
return createVNode(Dropdown$2, dropdownProps3, {
default: function _default3() {
return [dropdownTrigger];
},
overlay: renderOverlay
});
};
}
});
Dropdown.Button = DropdownButton;
const Dropdown$1 = Dropdown;
function shallowEqual(objA, objB, compare, compareContext) {
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
if (ret !== void 0) {
return !!ret;
}
if (objA === objB) {
return true;
}
if (_typeof$2(objA) !== "object" || !objA || _typeof$2(objB) !== "object" || !objB) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
for (var idx = 0; idx < keysA.length; idx++) {
var key2 = keysA[idx];
if (!bHasOwnProperty(key2)) {
return false;
}
var valueA = objA[key2];
var valueB = objB[key2];
ret = compare ? compare.call(compareContext, valueA, valueB, key2) : void 0;
if (ret === false || ret === void 0 && valueA !== valueB) {
return false;
}
}
return true;
}
function shallowequal(value2, other, customizer, thisArg) {
return shallowEqual(toRaw(value2), toRaw(other), customizer, thisArg);
}
var MenuContextKey = Symbol("menuContextKey");
var useProvideMenu = function useProvideMenu2(props3) {
provide(MenuContextKey, props3);
};
var useInjectMenu = function useInjectMenu2() {
return inject(MenuContextKey);
};
var ForceRenderKey = Symbol("ForceRenderKey");
var useProvideForceRender = function useProvideForceRender2(forceRender) {
provide(ForceRenderKey, forceRender);
};
var useInjectForceRender = function useInjectForceRender2() {
return inject(ForceRenderKey, false);
};
var MenuFirstLevelContextKey = Symbol("menuFirstLevelContextKey");
var useProvideFirstLevel = function useProvideFirstLevel2(firstLevel) {
provide(MenuFirstLevelContextKey, firstLevel);
};
var useInjectFirstLevel = function useInjectFirstLevel2() {
return inject(MenuFirstLevelContextKey, true);
};
var MenuContextProvider = defineComponent({
compatConfig: {
MODE: 3
},
name: "MenuContextProvider",
inheritAttrs: false,
props: {
mode: {
type: String,
default: void 0
},
overflowDisabled: {
type: Boolean,
default: void 0
},
isRootMenu: {
type: Boolean,
default: void 0
}
},
setup: function setup40(props3, _ref) {
var slots = _ref.slots;
var menuContext = useInjectMenu();
var newContext = _objectSpread2$1({}, menuContext);
if (props3.mode !== void 0) {
newContext.mode = toRef(props3, "mode");
}
if (props3.isRootMenu !== void 0) {
newContext.isRootMenu = toRef(props3, "isRootMenu");
}
if (props3.overflowDisabled !== void 0) {
newContext.overflowDisabled = toRef(props3, "overflowDisabled");
}
useProvideMenu(newContext);
return function() {
var _slots$default;
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
};
}
});
const useProvideMenu$1 = useProvideMenu;
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length, index2 = fromIndex + (fromRight ? 1 : -1);
while (fromRight ? index2-- : ++index2 < length) {
if (predicate(array[index2], index2, array)) {
return index2;
}
}
return -1;
}
function baseIsNaN(value2) {
return value2 !== value2;
}
function strictIndexOf(array, value2, fromIndex) {
var index2 = fromIndex - 1, length = array.length;
while (++index2 < length) {
if (array[index2] === value2) {
return index2;
}
}
return -1;
}
function baseIndexOf(array, value2, fromIndex) {
return value2 === value2 ? strictIndexOf(array, value2, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
}
function arrayIncludes(array, value2) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value2, 0) > -1;
}
function arrayIncludesWith(array, value2, comparator) {
var index2 = -1, length = array == null ? 0 : array.length;
while (++index2 < length) {
if (comparator(value2, array[index2])) {
return true;
}
}
return false;
}
function noop() {
}
var INFINITY$2 = 1 / 0;
var createSet = !(Set$2 && 1 / setToArray(new Set$2([, -0]))[1] == INFINITY$2) ? noop : function(values) {
return new Set$2(values);
};
const createSet$1 = createSet;
var LARGE_ARRAY_SIZE = 200;
function baseUniq(array, iteratee, comparator) {
var index2 = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
if (comparator) {
isCommon = false;
includes2 = arrayIncludesWith;
} else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : createSet$1(array);
if (set) {
return setToArray(set);
}
isCommon = false;
includes2 = cacheHas;
seen = new SetCache();
} else {
seen = iteratee ? [] : result;
}
outer:
while (++index2 < length) {
var value2 = array[index2], computed2 = iteratee ? iteratee(value2) : value2;
value2 = comparator || value2 !== 0 ? value2 : 0;
if (isCommon && computed2 === computed2) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed2) {
continue outer;
}
}
if (iteratee) {
seen.push(computed2);
}
result.push(value2);
} else if (!includes2(seen, computed2, comparator)) {
if (seen !== result) {
seen.push(computed2);
}
result.push(value2);
}
}
return result;
}
function uniq(array) {
return array && array.length ? baseUniq(array) : [];
}
var SiderCollapsedKey = Symbol("siderCollapsed");
var OVERFLOW_KEY = "$$__vc-menu-more__key";
var KeyPathContext = Symbol("KeyPathContext");
var useInjectKeyPath = function useInjectKeyPath2() {
return inject(KeyPathContext, {
parentEventKeys: computed(function() {
return [];
}),
parentKeys: computed(function() {
return [];
}),
parentInfo: {}
});
};
var useProvideKeyPath = function useProvideKeyPath2(eventKey, key2, menuInfo) {
var _useInjectKeyPath = useInjectKeyPath(), parentEventKeys = _useInjectKeyPath.parentEventKeys, parentKeys = _useInjectKeyPath.parentKeys;
var eventKeys = computed(function() {
return [].concat(_toConsumableArray(parentEventKeys.value), [eventKey]);
});
var keys2 = computed(function() {
return [].concat(_toConsumableArray(parentKeys.value), [key2]);
});
provide(KeyPathContext, {
parentEventKeys: eventKeys,
parentKeys: keys2,
parentInfo: menuInfo
});
return keys2;
};
var measure$1 = Symbol("measure");
var PathContext = defineComponent({
compatConfig: {
MODE: 3
},
setup: function setup41(_props, _ref) {
var slots = _ref.slots;
provide(measure$1, true);
return function() {
var _slots$default;
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
};
}
});
var useMeasure = function useMeasure2() {
return inject(measure$1, false);
};
const useProvideKeyPath$1 = useProvideKeyPath;
function useDirectionStyle(level) {
var _useInjectMenu = useInjectMenu(), mode = _useInjectMenu.mode, rtl2 = _useInjectMenu.rtl, inlineIndent = _useInjectMenu.inlineIndent;
return computed(function() {
return mode.value !== "inline" ? null : rtl2.value ? {
paddingRight: "".concat(level.value * inlineIndent.value, "px")
} : {
paddingLeft: "".concat(level.value * inlineIndent.value, "px")
};
});
}
var indexGuid$1 = 0;
var menuItemProps = function menuItemProps2() {
return {
id: String,
role: String,
disabled: Boolean,
danger: Boolean,
title: {
type: [String, Boolean],
default: void 0
},
icon: PropTypes$1.any,
onMouseenter: Function,
onMouseleave: Function,
onClick: Function,
onKeydown: Function,
onFocus: Function
};
};
const __unplugin_components_2$3 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AMenuItem",
inheritAttrs: false,
props: menuItemProps(),
// emits: ['mouseenter', 'mouseleave', 'click', 'keydown', 'focus'],
slots: ["icon", "title"],
setup: function setup42(props3, _ref) {
var slots = _ref.slots, emit = _ref.emit, attrs = _ref.attrs;
var instance = getCurrentInstance();
var isMeasure = useMeasure();
var key2 = _typeof$2(instance.vnode.key) === "symbol" ? String(instance.vnode.key) : instance.vnode.key;
devWarning(_typeof$2(instance.vnode.key) !== "symbol", "MenuItem", 'MenuItem `:key="'.concat(String(key2), '"` not support Symbol type'));
var eventKey = "menu_item_".concat(++indexGuid$1, "_$$_").concat(key2);
var _useInjectKeyPath = useInjectKeyPath(), parentEventKeys = _useInjectKeyPath.parentEventKeys, parentKeys = _useInjectKeyPath.parentKeys;
var _useInjectMenu = useInjectMenu(), prefixCls = _useInjectMenu.prefixCls, activeKeys = _useInjectMenu.activeKeys, disabled = _useInjectMenu.disabled, changeActiveKeys = _useInjectMenu.changeActiveKeys, rtl2 = _useInjectMenu.rtl, inlineCollapsed = _useInjectMenu.inlineCollapsed, siderCollapsed = _useInjectMenu.siderCollapsed, onItemClick2 = _useInjectMenu.onItemClick, selectedKeys = _useInjectMenu.selectedKeys, registerMenuInfo = _useInjectMenu.registerMenuInfo, unRegisterMenuInfo = _useInjectMenu.unRegisterMenuInfo;
var firstLevel = useInjectFirstLevel();
var isActive = ref(false);
var keysPath = computed(function() {
return [].concat(_toConsumableArray(parentKeys.value), [key2]);
});
var menuInfo = {
eventKey,
key: key2,
parentEventKeys,
parentKeys,
isLeaf: true
};
registerMenuInfo(eventKey, menuInfo);
onBeforeUnmount(function() {
unRegisterMenuInfo(eventKey);
});
watch(activeKeys, function() {
isActive.value = !!activeKeys.value.find(function(val) {
return val === key2;
});
}, {
immediate: true
});
var mergedDisabled = computed(function() {
return disabled.value || props3.disabled;
});
var selected = computed(function() {
return selectedKeys.value.includes(key2);
});
var classNames2 = computed(function() {
var _ref2;
var itemCls = "".concat(prefixCls.value, "-item");
return _ref2 = {}, _defineProperty$q(_ref2, "".concat(itemCls), true), _defineProperty$q(_ref2, "".concat(itemCls, "-danger"), props3.danger), _defineProperty$q(_ref2, "".concat(itemCls, "-active"), isActive.value), _defineProperty$q(_ref2, "".concat(itemCls, "-selected"), selected.value), _defineProperty$q(_ref2, "".concat(itemCls, "-disabled"), mergedDisabled.value), _ref2;
});
var getEventInfo = function getEventInfo2(e2) {
return {
key: key2,
eventKey,
keyPath: keysPath.value,
eventKeyPath: [].concat(_toConsumableArray(parentEventKeys.value), [eventKey]),
domEvent: e2,
item: _objectSpread2$1(_objectSpread2$1({}, props3), attrs)
};
};
var onInternalClick = function onInternalClick2(e2) {
if (mergedDisabled.value) {
return;
}
var info = getEventInfo(e2);
emit("click", e2);
onItemClick2(info);
};
var onMouseEnter = function onMouseEnter2(event) {
if (!mergedDisabled.value) {
changeActiveKeys(keysPath.value);
emit("mouseenter", event);
}
};
var onMouseLeave = function onMouseLeave2(event) {
if (!mergedDisabled.value) {
changeActiveKeys([]);
emit("mouseleave", event);
}
};
var onInternalKeyDown = function onInternalKeyDown2(e2) {
emit("keydown", e2);
if (e2.which === KeyCode$1.ENTER) {
var info = getEventInfo(e2);
emit("click", e2);
onItemClick2(info);
}
};
var onInternalFocus = function onInternalFocus2(e2) {
changeActiveKeys(keysPath.value);
emit("focus", e2);
};
var renderItemChildren = function renderItemChildren2(icon, children) {
var wrapNode = createVNode("span", {
"class": "".concat(prefixCls.value, "-title-content")
}, [children]);
if (!icon || isValidElement(children) && children.type === "span") {
if (children && inlineCollapsed.value && firstLevel && typeof children === "string") {
return createVNode("div", {
"class": "".concat(prefixCls.value, "-inline-collapsed-noicon")
}, [children.charAt(0)]);
}
}
return wrapNode;
};
var directionStyle = useDirectionStyle(computed(function() {
return keysPath.value.length;
}));
return function() {
var _props$title, _slots$title, _slots$default, _ref3;
if (isMeasure)
return null;
var title = (_props$title = props3.title) !== null && _props$title !== void 0 ? _props$title : (_slots$title = slots.title) === null || _slots$title === void 0 ? void 0 : _slots$title.call(slots);
var children = flattenChildren((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots));
var childrenLength = children.length;
var tooltipTitle = title;
if (typeof title === "undefined") {
tooltipTitle = firstLevel && childrenLength ? children : "";
} else if (title === false) {
tooltipTitle = "";
}
var tooltipProps3 = {
title: tooltipTitle
};
if (!siderCollapsed.value && !inlineCollapsed.value) {
tooltipProps3.title = null;
tooltipProps3.visible = false;
}
var optionRoleProps = {};
if (props3.role === "option") {
optionRoleProps["aria-selected"] = selected.value;
}
var icon = getPropsSlot(slots, props3, "icon");
return createVNode(__unplugin_components_0$3, _objectSpread2$1(_objectSpread2$1({}, tooltipProps3), {}, {
"placement": rtl2.value ? "left" : "right",
"overlayClassName": "".concat(prefixCls.value, "-inline-collapsed-tooltip")
}), {
default: function _default3() {
return [createVNode(Overflow$1.Item, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
"component": "li"
}, attrs), {}, {
"id": props3.id,
"style": _objectSpread2$1(_objectSpread2$1({}, attrs.style || {}), directionStyle.value),
"class": [classNames2.value, (_ref3 = {}, _defineProperty$q(_ref3, "".concat(attrs.class), !!attrs.class), _defineProperty$q(_ref3, "".concat(prefixCls.value, "-item-only-child"), (icon ? childrenLength + 1 : childrenLength) === 1), _ref3)],
"role": props3.role || "menuitem",
"tabindex": props3.disabled ? null : -1,
"data-menu-id": key2,
"aria-disabled": props3.disabled
}, optionRoleProps), {}, {
"onMouseenter": onMouseEnter,
"onMouseleave": onMouseLeave,
"onClick": onInternalClick,
"onKeydown": onInternalKeyDown,
"onFocus": onInternalFocus,
"title": typeof title === "string" ? title : void 0
}), {
default: function _default4() {
return [cloneElement(icon, {
class: "".concat(prefixCls.value, "-item-icon")
}, false), renderItemChildren(icon, children)];
}
})];
}
});
};
}
});
var autoAdjustOverflow = {
adjustX: 1,
adjustY: 1
};
var placements = {
topLeft: {
points: ["bl", "tl"],
overflow: autoAdjustOverflow,
offset: [0, -7]
},
bottomLeft: {
points: ["tl", "bl"],
overflow: autoAdjustOverflow,
offset: [0, 7]
},
leftTop: {
points: ["tr", "tl"],
overflow: autoAdjustOverflow,
offset: [-4, 0]
},
rightTop: {
points: ["tl", "tr"],
overflow: autoAdjustOverflow,
offset: [4, 0]
}
};
var placementsRtl = {
topLeft: {
points: ["bl", "tl"],
overflow: autoAdjustOverflow,
offset: [0, -7]
},
bottomLeft: {
points: ["tl", "bl"],
overflow: autoAdjustOverflow,
offset: [0, 7]
},
rightTop: {
points: ["tr", "tl"],
overflow: autoAdjustOverflow,
offset: [-4, 0]
},
leftTop: {
points: ["tl", "tr"],
overflow: autoAdjustOverflow,
offset: [4, 0]
}
};
var popupPlacementMap = {
horizontal: "bottomLeft",
vertical: "rightTop",
"vertical-left": "rightTop",
"vertical-right": "leftTop"
};
const PopupTrigger = defineComponent({
compatConfig: {
MODE: 3
},
name: "PopupTrigger",
inheritAttrs: false,
props: {
prefixCls: String,
mode: String,
visible: Boolean,
// popup: React.ReactNode;
popupClassName: String,
popupOffset: Array,
disabled: Boolean,
onVisibleChange: Function
},
slots: ["popup"],
emits: ["visibleChange"],
setup: function setup43(props3, _ref) {
var slots = _ref.slots, emit = _ref.emit;
var innerVisible = ref(false);
var _useInjectMenu = useInjectMenu(), getPopupContainer = _useInjectMenu.getPopupContainer, rtl2 = _useInjectMenu.rtl, subMenuOpenDelay = _useInjectMenu.subMenuOpenDelay, subMenuCloseDelay = _useInjectMenu.subMenuCloseDelay, builtinPlacements = _useInjectMenu.builtinPlacements, triggerSubMenuAction = _useInjectMenu.triggerSubMenuAction, isRootMenu = _useInjectMenu.isRootMenu, forceSubMenuRender = _useInjectMenu.forceSubMenuRender, motion = _useInjectMenu.motion, defaultMotions = _useInjectMenu.defaultMotions;
var forceRender = useInjectForceRender();
var placement = computed(function() {
return rtl2.value ? _objectSpread2$1(_objectSpread2$1({}, placementsRtl), builtinPlacements.value) : _objectSpread2$1(_objectSpread2$1({}, placements), builtinPlacements.value);
});
var popupPlacement = computed(function() {
return popupPlacementMap[props3.mode];
});
var visibleRef = ref();
watch(function() {
return props3.visible;
}, function(visible) {
wrapperRaf.cancel(visibleRef.value);
visibleRef.value = wrapperRaf(function() {
innerVisible.value = visible;
});
}, {
immediate: true
});
onBeforeUnmount(function() {
wrapperRaf.cancel(visibleRef.value);
});
var onVisibleChange = function onVisibleChange2(visible) {
emit("visibleChange", visible);
};
var mergedMotion = computed(function() {
var _defaultMotions$value, _defaultMotions$value2;
var m2 = motion.value || ((_defaultMotions$value = defaultMotions.value) === null || _defaultMotions$value === void 0 ? void 0 : _defaultMotions$value[props3.mode]) || ((_defaultMotions$value2 = defaultMotions.value) === null || _defaultMotions$value2 === void 0 ? void 0 : _defaultMotions$value2.other);
var res = typeof m2 === "function" ? m2() : m2;
return res ? getTransitionProps(res.name, {
css: true
}) : void 0;
});
return function() {
var prefixCls = props3.prefixCls, popupClassName = props3.popupClassName, mode = props3.mode, popupOffset = props3.popupOffset, disabled = props3.disabled;
return createVNode(Trigger, {
"prefixCls": prefixCls,
"popupClassName": classNames("".concat(prefixCls, "-popup"), _defineProperty$q({}, "".concat(prefixCls, "-rtl"), rtl2.value), popupClassName),
"stretch": mode === "horizontal" ? "minWidth" : null,
"getPopupContainer": isRootMenu.value ? getPopupContainer.value : function(triggerNode) {
return triggerNode.parentNode;
},
"builtinPlacements": placement.value,
"popupPlacement": popupPlacement.value,
"popupVisible": innerVisible.value,
"popupAlign": popupOffset && {
offset: popupOffset
},
"action": disabled ? [] : [triggerSubMenuAction.value],
"mouseEnterDelay": subMenuOpenDelay.value,
"mouseLeaveDelay": subMenuCloseDelay.value,
"onPopupVisibleChange": onVisibleChange,
"forceRender": forceRender || forceSubMenuRender.value,
"popupAnimation": mergedMotion.value
}, {
popup: slots.popup,
default: slots.default
});
};
}
});
var InternalSubMenuList = function InternalSubMenuList2(_props, _ref) {
var _slots$default;
var slots = _ref.slots, attrs = _ref.attrs;
var _useInjectMenu = useInjectMenu(), prefixCls = _useInjectMenu.prefixCls, mode = _useInjectMenu.mode;
return createVNode("ul", _objectSpread2$1(_objectSpread2$1({}, attrs), {}, {
"class": classNames(prefixCls.value, "".concat(prefixCls.value, "-sub"), "".concat(prefixCls.value, "-").concat(mode.value === "inline" ? "inline" : "vertical")),
"data-menu-list": true
}), [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]);
};
InternalSubMenuList.displayName = "SubMenuList";
const SubMenuList = InternalSubMenuList;
const InlineSubMenuList = defineComponent({
compatConfig: {
MODE: 3
},
name: "InlineSubMenuList",
inheritAttrs: false,
props: {
id: String,
open: Boolean,
keyPath: Array
},
setup: function setup44(props3, _ref) {
var slots = _ref.slots;
var fixedMode = computed(function() {
return "inline";
});
var _useInjectMenu = useInjectMenu(), motion = _useInjectMenu.motion, mode = _useInjectMenu.mode, defaultMotions = _useInjectMenu.defaultMotions;
var sameModeRef = computed(function() {
return mode.value === fixedMode.value;
});
var destroy3 = ref(!sameModeRef.value);
var mergedOpen = computed(function() {
return sameModeRef.value ? props3.open : false;
});
watch(mode, function() {
if (sameModeRef.value) {
destroy3.value = false;
}
}, {
flush: "post"
});
var mergedMotion = computed(function() {
var _defaultMotions$value, _defaultMotions$value2;
var m2 = motion.value || ((_defaultMotions$value = defaultMotions.value) === null || _defaultMotions$value === void 0 ? void 0 : _defaultMotions$value[fixedMode.value]) || ((_defaultMotions$value2 = defaultMotions.value) === null || _defaultMotions$value2 === void 0 ? void 0 : _defaultMotions$value2.other);
var res = typeof m2 === "function" ? m2() : m2;
return _objectSpread2$1(_objectSpread2$1({}, res), {}, {
appear: props3.keyPath.length <= 1
});
});
return function() {
var _slots$default;
if (destroy3.value) {
return null;
}
return createVNode(MenuContextProvider, {
"mode": fixedMode.value
}, {
default: function _default3() {
return [createVNode(Transition, mergedMotion.value, {
default: function _default4() {
return [withDirectives(createVNode(SubMenuList, {
"id": props3.id
}, {
default: function _default5() {
return [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
}
}), [[vShow, mergedOpen.value]])];
}
})];
}
});
};
}
});
var indexGuid = 0;
var subMenuProps = function subMenuProps2() {
return {
icon: PropTypes$1.any,
title: PropTypes$1.any,
disabled: Boolean,
level: Number,
popupClassName: String,
popupOffset: Array,
internalPopupClose: Boolean,
eventKey: String,
expandIcon: Function,
onMouseenter: Function,
onMouseleave: Function,
onTitleClick: Function
};
};
const SubMenu = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASubMenu",
inheritAttrs: false,
props: subMenuProps(),
slots: ["icon", "title", "expandIcon"],
// emits: ['titleClick', 'mouseenter', 'mouseleave'],
setup: function setup45(props3, _ref) {
var _props$eventKey, _parentInfo$childrenE;
var slots = _ref.slots, attrs = _ref.attrs, emit = _ref.emit;
useProvideFirstLevel(false);
var isMeasure = useMeasure();
var instance = getCurrentInstance();
var vnodeKey = _typeof$2(instance.vnode.key) === "symbol" ? String(instance.vnode.key) : instance.vnode.key;
devWarning(_typeof$2(instance.vnode.key) !== "symbol", "SubMenu", 'SubMenu `:key="'.concat(String(vnodeKey), '"` not support Symbol type'));
var key2 = isValid$2(vnodeKey) ? vnodeKey : "sub_menu_".concat(++indexGuid, "_$$_not_set_key");
var eventKey = (_props$eventKey = props3.eventKey) !== null && _props$eventKey !== void 0 ? _props$eventKey : isValid$2(vnodeKey) ? "sub_menu_".concat(++indexGuid, "_$$_").concat(vnodeKey) : key2;
var _useInjectKeyPath = useInjectKeyPath(), parentEventKeys = _useInjectKeyPath.parentEventKeys, parentInfo = _useInjectKeyPath.parentInfo, parentKeys = _useInjectKeyPath.parentKeys;
var keysPath = computed(function() {
return [].concat(_toConsumableArray(parentKeys.value), [key2]);
});
var childrenEventKeys = ref([]);
var menuInfo = {
eventKey,
key: key2,
parentEventKeys,
childrenEventKeys,
parentKeys
};
(_parentInfo$childrenE = parentInfo.childrenEventKeys) === null || _parentInfo$childrenE === void 0 ? void 0 : _parentInfo$childrenE.value.push(eventKey);
onBeforeUnmount(function() {
if (parentInfo.childrenEventKeys) {
var _parentInfo$childrenE2;
parentInfo.childrenEventKeys.value = (_parentInfo$childrenE2 = parentInfo.childrenEventKeys) === null || _parentInfo$childrenE2 === void 0 ? void 0 : _parentInfo$childrenE2.value.filter(function(k2) {
return k2 != eventKey;
});
}
});
useProvideKeyPath$1(eventKey, key2, menuInfo);
var _useInjectMenu = useInjectMenu(), prefixCls = _useInjectMenu.prefixCls, activeKeys = _useInjectMenu.activeKeys, contextDisabled = _useInjectMenu.disabled, changeActiveKeys = _useInjectMenu.changeActiveKeys, mode = _useInjectMenu.mode, inlineCollapsed = _useInjectMenu.inlineCollapsed, antdMenuTheme = _useInjectMenu.antdMenuTheme, openKeys = _useInjectMenu.openKeys, overflowDisabled = _useInjectMenu.overflowDisabled, onOpenChange = _useInjectMenu.onOpenChange, registerMenuInfo = _useInjectMenu.registerMenuInfo, unRegisterMenuInfo = _useInjectMenu.unRegisterMenuInfo, selectedSubMenuKeys = _useInjectMenu.selectedSubMenuKeys, menuExpandIcon = _useInjectMenu.expandIcon;
var hasKey = vnodeKey !== void 0 && vnodeKey !== null;
var forceRender = !isMeasure && (useInjectForceRender() || !hasKey);
useProvideForceRender(forceRender);
if (isMeasure && hasKey || !isMeasure && !hasKey || forceRender) {
registerMenuInfo(eventKey, menuInfo);
onBeforeUnmount(function() {
unRegisterMenuInfo(eventKey);
});
}
var subMenuPrefixCls = computed(function() {
return "".concat(prefixCls.value, "-submenu");
});
var mergedDisabled = computed(function() {
return contextDisabled.value || props3.disabled;
});
var elementRef = ref();
var popupRef = ref();
var originOpen = computed(function() {
return openKeys.value.includes(key2);
});
var open2 = computed(function() {
return !overflowDisabled.value && originOpen.value;
});
var childrenSelected = computed(function() {
return selectedSubMenuKeys.value.includes(key2);
});
var isActive = ref(false);
watch(activeKeys, function() {
isActive.value = !!activeKeys.value.find(function(val) {
return val === key2;
});
}, {
immediate: true
});
var onInternalTitleClick = function onInternalTitleClick2(e2) {
if (mergedDisabled.value) {
return;
}
emit("titleClick", e2, key2);
if (mode.value === "inline") {
onOpenChange(key2, !originOpen.value);
}
};
var onMouseEnter = function onMouseEnter2(event) {
if (!mergedDisabled.value) {
changeActiveKeys(keysPath.value);
emit("mouseenter", event);
}
};
var onMouseLeave = function onMouseLeave2(event) {
if (!mergedDisabled.value) {
changeActiveKeys([]);
emit("mouseleave", event);
}
};
var directionStyle = useDirectionStyle(computed(function() {
return keysPath.value.length;
}));
var onPopupVisibleChange = function onPopupVisibleChange2(newVisible) {
if (mode.value !== "inline") {
onOpenChange(key2, newVisible);
}
};
var onInternalFocus = function onInternalFocus2() {
changeActiveKeys(keysPath.value);
};
var popupId = eventKey && "".concat(eventKey, "-popup");
var popupClassName = computed(function() {
return classNames(prefixCls.value, "".concat(prefixCls.value, "-").concat(antdMenuTheme.value), props3.popupClassName);
});
var renderTitle = function renderTitle2(title, icon) {
if (!icon) {
return inlineCollapsed.value && !parentKeys.value.length && title && typeof title === "string" ? createVNode("div", {
"class": "".concat(prefixCls.value, "-inline-collapsed-noicon")
}, [title.charAt(0)]) : createVNode("span", {
"class": "".concat(prefixCls.value, "-title-content")
}, [title]);
}
var titleIsSpan = isValidElement(title) && title.type === "span";
return createVNode(Fragment, null, [cloneElement(icon, {
class: "".concat(prefixCls.value, "-item-icon")
}, false), titleIsSpan ? title : createVNode("span", {
"class": "".concat(prefixCls.value, "-title-content")
}, [title])]);
};
var triggerModeRef = computed(function() {
return mode.value !== "inline" && keysPath.value.length > 1 ? "vertical" : mode.value;
});
var renderMode = computed(function() {
return mode.value === "horizontal" ? "vertical" : mode.value;
});
var subMenuTriggerModeRef = computed(function() {
return triggerModeRef.value === "horizontal" ? "vertical" : triggerModeRef.value;
});
var baseTitleNode = function baseTitleNode2() {
var subMenuPrefixClsValue = subMenuPrefixCls.value;
var icon = getPropsSlot(slots, props3, "icon");
var expandIcon = props3.expandIcon || slots.expandIcon || menuExpandIcon.value;
var title = renderTitle(getPropsSlot(slots, props3, "title"), icon);
return createVNode("div", {
"style": directionStyle.value,
"class": "".concat(subMenuPrefixClsValue, "-title"),
"tabindex": mergedDisabled.value ? null : -1,
"ref": elementRef,
"title": typeof title === "string" ? title : null,
"data-menu-id": key2,
"aria-expanded": open2.value,
"aria-haspopup": true,
"aria-controls": popupId,
"aria-disabled": mergedDisabled.value,
"onClick": onInternalTitleClick,
"onFocus": onInternalFocus
}, [title, mode.value !== "horizontal" && expandIcon ? expandIcon(_objectSpread2$1(_objectSpread2$1({}, props3), {}, {
isOpen: open2.value
})) : createVNode("i", {
"class": "".concat(subMenuPrefixClsValue, "-arrow")
}, null)]);
};
return function() {
var _classNames;
if (isMeasure) {
var _slots$default;
if (!hasKey) {
return null;
}
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
}
var subMenuPrefixClsValue = subMenuPrefixCls.value;
var titleNode = function titleNode2() {
return null;
};
if (!overflowDisabled.value && mode.value !== "inline") {
titleNode = function titleNode2() {
return createVNode(PopupTrigger, {
"mode": triggerModeRef.value,
"prefixCls": subMenuPrefixClsValue,
"visible": !props3.internalPopupClose && open2.value,
"popupClassName": popupClassName.value,
"popupOffset": props3.popupOffset,
"disabled": mergedDisabled.value,
"onVisibleChange": onPopupVisibleChange
}, {
default: function _default3() {
return [baseTitleNode()];
},
popup: function popup() {
return createVNode(MenuContextProvider, {
"mode": subMenuTriggerModeRef.value,
"isRootMenu": false
}, {
default: function _default3() {
return [createVNode(SubMenuList, {
"id": popupId,
"ref": popupRef
}, {
default: slots.default
})];
}
});
}
});
};
} else {
titleNode = function titleNode2() {
return createVNode(PopupTrigger, null, {
default: baseTitleNode
});
};
}
return createVNode(MenuContextProvider, {
"mode": renderMode.value
}, {
default: function _default3() {
return [createVNode(Overflow$1.Item, _objectSpread2$1(_objectSpread2$1({
"component": "li"
}, attrs), {}, {
"role": "none",
"class": classNames(subMenuPrefixClsValue, "".concat(subMenuPrefixClsValue, "-").concat(mode.value), attrs.class, (_classNames = {}, _defineProperty$q(_classNames, "".concat(subMenuPrefixClsValue, "-open"), open2.value), _defineProperty$q(_classNames, "".concat(subMenuPrefixClsValue, "-active"), isActive.value), _defineProperty$q(_classNames, "".concat(subMenuPrefixClsValue, "-selected"), childrenSelected.value), _defineProperty$q(_classNames, "".concat(subMenuPrefixClsValue, "-disabled"), mergedDisabled.value), _classNames)),
"onMouseenter": onMouseEnter,
"onMouseleave": onMouseLeave,
"data-submenu-id": key2
}), {
default: function _default4() {
return createVNode(Fragment, null, [titleNode(), !overflowDisabled.value && createVNode(InlineSubMenuList, {
"id": popupId,
"open": open2.value,
"keyPath": keysPath.value
}, {
default: slots.default
})]);
}
})];
}
});
};
}
});
function hasClass(node, className) {
if (node.classList) {
return node.classList.contains(className);
}
var originClass = node.className;
return " ".concat(originClass, " ").indexOf(" ".concat(className, " ")) > -1;
}
function addClass(node, className) {
if (node.classList) {
node.classList.add(className);
} else {
if (!hasClass(node, className)) {
node.className = "".concat(node.className, " ").concat(className);
}
}
}
function removeClass(node, className) {
if (node.classList) {
node.classList.remove(className);
} else {
if (hasClass(node, className)) {
var originClass = node.className;
node.className = " ".concat(originClass, " ").replace(" ".concat(className, " "), " ");
}
}
}
var collapseMotion = function collapseMotion2() {
var name = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "ant-motion-collapse";
var appear = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
return {
name,
appear,
css: true,
onBeforeEnter: function onBeforeEnter(node) {
node.style.height = "0px";
node.style.opacity = "0";
addClass(node, name);
},
onEnter: function onEnter(node) {
nextTick(function() {
node.style.height = "".concat(node.scrollHeight, "px");
node.style.opacity = "1";
});
},
onAfterEnter: function onAfterEnter(node) {
if (node) {
removeClass(node, name);
node.style.height = null;
node.style.opacity = null;
}
},
onBeforeLeave: function onBeforeLeave(node) {
addClass(node, name);
node.style.height = "".concat(node.offsetHeight, "px");
node.style.opacity = null;
},
onLeave: function onLeave(node) {
setTimeout(function() {
node.style.height = "0px";
node.style.opacity = "0";
});
},
onAfterLeave: function onAfterLeave(node) {
if (node) {
removeClass(node, name);
if (node.style) {
node.style.height = null;
node.style.opacity = null;
}
}
}
};
};
const collapseMotion$1 = collapseMotion;
var menuProps = function menuProps2() {
return {
id: String,
prefixCls: String,
disabled: Boolean,
inlineCollapsed: Boolean,
disabledOverflow: Boolean,
forceSubMenuRender: Boolean,
openKeys: Array,
selectedKeys: Array,
activeKey: String,
selectable: {
type: Boolean,
default: true
},
multiple: {
type: Boolean,
default: false
},
motion: Object,
theme: {
type: String,
default: "light"
},
mode: {
type: String,
default: "vertical"
},
inlineIndent: {
type: Number,
default: 24
},
subMenuOpenDelay: {
type: Number,
default: 0.1
},
subMenuCloseDelay: {
type: Number,
default: 0.1
},
builtinPlacements: {
type: Object
},
triggerSubMenuAction: {
type: String,
default: "hover"
},
getPopupContainer: Function,
expandIcon: Function,
onOpenChange: Function,
onSelect: Function,
onDeselect: Function,
onClick: [Function, Array],
onFocus: Function,
onBlur: Function,
onMousedown: Function,
"onUpdate:openKeys": Function,
"onUpdate:selectedKeys": Function,
"onUpdate:activeKey": Function
};
};
var EMPTY_LIST = [];
const Menu = defineComponent({
compatConfig: {
MODE: 3
},
name: "AMenu",
inheritAttrs: false,
props: menuProps(),
slots: ["expandIcon", "overflowedIndicator"],
setup: function setup46(props3, _ref) {
var slots = _ref.slots, emit = _ref.emit, attrs = _ref.attrs;
var _useConfigInject = useConfigInject("menu", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction, getPrefixCls2 = _useConfigInject.getPrefixCls;
var store2 = ref({});
var siderCollapsed = inject(SiderCollapsedKey, ref(void 0));
var inlineCollapsed = computed(function() {
if (siderCollapsed.value !== void 0) {
return siderCollapsed.value;
}
return props3.inlineCollapsed;
});
var isMounted = ref(false);
onMounted(function() {
isMounted.value = true;
});
watchEffect(function() {
devWarning(!(props3.inlineCollapsed === true && props3.mode !== "inline"), "Menu", "`inlineCollapsed` should only be used when `mode` is inline.");
devWarning(!(siderCollapsed.value !== void 0 && props3.inlineCollapsed === true), "Menu", "`inlineCollapsed` not control Menu under Sider. Should set `collapsed` on Sider instead.");
});
var activeKeys = ref([]);
var mergedSelectedKeys = ref([]);
var keyMapStore = ref({});
watch(store2, function() {
var newKeyMapStore = {};
for (var _i = 0, _Object$values = Object.values(store2.value); _i < _Object$values.length; _i++) {
var menuInfo = _Object$values[_i];
newKeyMapStore[menuInfo.key] = menuInfo;
}
keyMapStore.value = newKeyMapStore;
}, {
flush: "post"
});
watchEffect(function() {
if (props3.activeKey !== void 0) {
var keys2 = [];
var menuInfo = props3.activeKey ? keyMapStore.value[props3.activeKey] : void 0;
if (menuInfo && props3.activeKey !== void 0) {
keys2 = uniq([].concat(unref(menuInfo.parentKeys), props3.activeKey));
} else {
keys2 = [];
}
if (!shallowequal(activeKeys.value, keys2)) {
activeKeys.value = keys2;
}
}
});
watch(function() {
return props3.selectedKeys;
}, function(selectedKeys) {
if (selectedKeys) {
mergedSelectedKeys.value = selectedKeys.slice();
}
}, {
immediate: true,
deep: true
});
var selectedSubMenuKeys = ref([]);
watch([keyMapStore, mergedSelectedKeys], function() {
var subMenuParentKeys = [];
mergedSelectedKeys.value.forEach(function(key2) {
var menuInfo = keyMapStore.value[key2];
if (menuInfo) {
subMenuParentKeys = subMenuParentKeys.concat(unref(menuInfo.parentKeys));
}
});
subMenuParentKeys = uniq(subMenuParentKeys);
if (!shallowequal(selectedSubMenuKeys.value, subMenuParentKeys)) {
selectedSubMenuKeys.value = subMenuParentKeys;
}
}, {
immediate: true
});
var triggerSelection = function triggerSelection2(info) {
if (!props3.selectable) {
return;
}
var targetKey = info.key;
var exist = mergedSelectedKeys.value.includes(targetKey);
var newSelectedKeys;
if (props3.multiple) {
if (exist) {
newSelectedKeys = mergedSelectedKeys.value.filter(function(key2) {
return key2 !== targetKey;
});
} else {
newSelectedKeys = [].concat(_toConsumableArray(mergedSelectedKeys.value), [targetKey]);
}
} else {
newSelectedKeys = [targetKey];
}
var selectInfo = _objectSpread2$1(_objectSpread2$1({}, info), {}, {
selectedKeys: newSelectedKeys
});
if (!shallowequal(newSelectedKeys, mergedSelectedKeys.value)) {
if (props3.selectedKeys === void 0) {
mergedSelectedKeys.value = newSelectedKeys;
}
emit("update:selectedKeys", newSelectedKeys);
if (exist && props3.multiple) {
emit("deselect", selectInfo);
} else {
emit("select", selectInfo);
}
}
if (mergedMode.value !== "inline" && !props3.multiple && mergedOpenKeys.value.length) {
triggerOpenKeys(EMPTY_LIST);
}
};
var mergedOpenKeys = ref([]);
watch(function() {
return props3.openKeys;
}, function() {
var openKeys = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : mergedOpenKeys.value;
if (!shallowequal(mergedOpenKeys.value, openKeys)) {
mergedOpenKeys.value = openKeys.slice();
}
}, {
immediate: true,
deep: true
});
var timeout;
var changeActiveKeys = function changeActiveKeys2(keys2) {
clearTimeout(timeout);
timeout = setTimeout(function() {
if (props3.activeKey === void 0) {
activeKeys.value = keys2;
}
emit("update:activeKey", keys2[keys2.length - 1]);
});
};
var disabled = computed(function() {
return !!props3.disabled;
});
var isRtl = computed(function() {
return direction.value === "rtl";
});
var mergedMode = ref("vertical");
var mergedInlineCollapsed = ref(false);
watchEffect(function() {
if ((props3.mode === "inline" || props3.mode === "vertical") && inlineCollapsed.value) {
mergedMode.value = "vertical";
mergedInlineCollapsed.value = inlineCollapsed.value;
} else {
mergedMode.value = props3.mode;
mergedInlineCollapsed.value = false;
}
});
var isInlineMode = computed(function() {
return mergedMode.value === "inline";
});
var triggerOpenKeys = function triggerOpenKeys2(keys2) {
mergedOpenKeys.value = keys2;
emit("update:openKeys", keys2);
emit("openChange", keys2);
};
var inlineCacheOpenKeys = ref(mergedOpenKeys.value);
var mountRef = ref(false);
watch(mergedOpenKeys, function() {
if (isInlineMode.value) {
inlineCacheOpenKeys.value = mergedOpenKeys.value;
}
}, {
immediate: true
});
watch(isInlineMode, function() {
if (!mountRef.value) {
mountRef.value = true;
return;
}
if (isInlineMode.value) {
mergedOpenKeys.value = inlineCacheOpenKeys.value;
} else {
triggerOpenKeys(EMPTY_LIST);
}
}, {
immediate: true
});
var className = computed(function() {
var _ref2;
return _ref2 = {}, _defineProperty$q(_ref2, "".concat(prefixCls.value), true), _defineProperty$q(_ref2, "".concat(prefixCls.value, "-root"), true), _defineProperty$q(_ref2, "".concat(prefixCls.value, "-").concat(mergedMode.value), true), _defineProperty$q(_ref2, "".concat(prefixCls.value, "-inline-collapsed"), mergedInlineCollapsed.value), _defineProperty$q(_ref2, "".concat(prefixCls.value, "-rtl"), isRtl.value), _defineProperty$q(_ref2, "".concat(prefixCls.value, "-").concat(props3.theme), true), _ref2;
});
var rootPrefixCls = computed(function() {
return getPrefixCls2();
});
var defaultMotions = computed(function() {
return {
horizontal: {
name: "".concat(rootPrefixCls.value, "-slide-up")
},
inline: collapseMotion$1,
other: {
name: "".concat(rootPrefixCls.value, "-zoom-big")
}
};
});
useProvideFirstLevel(true);
var getChildrenKeys = function getChildrenKeys2() {
var eventKeys = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
var keys2 = [];
var storeValue = store2.value;
eventKeys.forEach(function(eventKey) {
var _storeValue$eventKey = storeValue[eventKey], key2 = _storeValue$eventKey.key, childrenEventKeys = _storeValue$eventKey.childrenEventKeys;
keys2.push.apply(keys2, [key2].concat(_toConsumableArray(getChildrenKeys2(unref(childrenEventKeys)))));
});
return keys2;
};
var onInternalClick = function onInternalClick2(info) {
emit("click", info);
triggerSelection(info);
};
var onInternalOpenChange = function onInternalOpenChange2(key2, open2) {
var _keyMapStore$value$ke;
var childrenEventKeys = ((_keyMapStore$value$ke = keyMapStore.value[key2]) === null || _keyMapStore$value$ke === void 0 ? void 0 : _keyMapStore$value$ke.childrenEventKeys) || [];
var newOpenKeys = mergedOpenKeys.value.filter(function(k2) {
return k2 !== key2;
});
if (open2) {
newOpenKeys.push(key2);
} else if (mergedMode.value !== "inline") {
var subPathKeys = getChildrenKeys(unref(childrenEventKeys));
newOpenKeys = uniq(newOpenKeys.filter(function(k2) {
return !subPathKeys.includes(k2);
}));
}
if (!shallowequal(mergedOpenKeys, newOpenKeys)) {
triggerOpenKeys(newOpenKeys);
}
};
var registerMenuInfo = function registerMenuInfo2(key2, info) {
store2.value = _objectSpread2$1(_objectSpread2$1({}, store2.value), {}, _defineProperty$q({}, key2, info));
};
var unRegisterMenuInfo = function unRegisterMenuInfo2(key2) {
delete store2.value[key2];
store2.value = _objectSpread2$1({}, store2.value);
};
var lastVisibleIndex = ref(0);
var expandIcon = computed(function() {
return props3.expandIcon || slots.expandIcon ? function(opt) {
var icon = props3.expandIcon || slots.expandIcon;
icon = typeof icon === "function" ? icon(opt) : icon;
return cloneElement(icon, {
class: "".concat(prefixCls.value, "-submenu-expand-icon")
}, false);
} : null;
});
useProvideMenu$1({
store: store2,
prefixCls,
activeKeys,
openKeys: mergedOpenKeys,
selectedKeys: mergedSelectedKeys,
changeActiveKeys,
disabled,
rtl: isRtl,
mode: mergedMode,
inlineIndent: computed(function() {
return props3.inlineIndent;
}),
subMenuCloseDelay: computed(function() {
return props3.subMenuCloseDelay;
}),
subMenuOpenDelay: computed(function() {
return props3.subMenuOpenDelay;
}),
builtinPlacements: computed(function() {
return props3.builtinPlacements;
}),
triggerSubMenuAction: computed(function() {
return props3.triggerSubMenuAction;
}),
getPopupContainer: computed(function() {
return props3.getPopupContainer;
}),
inlineCollapsed: mergedInlineCollapsed,
antdMenuTheme: computed(function() {
return props3.theme;
}),
siderCollapsed,
defaultMotions: computed(function() {
return isMounted.value ? defaultMotions.value : null;
}),
motion: computed(function() {
return isMounted.value ? props3.motion : null;
}),
overflowDisabled: ref(void 0),
onOpenChange: onInternalOpenChange,
onItemClick: onInternalClick,
registerMenuInfo,
unRegisterMenuInfo,
selectedSubMenuKeys,
isRootMenu: ref(true),
expandIcon,
forceSubMenuRender: computed(function() {
return props3.forceSubMenuRender;
})
});
return function() {
var _slots$default, _slots$overflowedIndi;
var childList = flattenChildren((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots));
var allVisible = lastVisibleIndex.value >= childList.length - 1 || mergedMode.value !== "horizontal" || props3.disabledOverflow;
var wrappedChildList = mergedMode.value !== "horizontal" || props3.disabledOverflow ? childList : (
// Need wrap for overflow dropdown that do not response for open
childList.map(function(child, index2) {
return (
// Always wrap provider to avoid sub node re-mount
createVNode(MenuContextProvider, {
"key": child.key,
"overflowDisabled": index2 > lastVisibleIndex.value
}, {
default: function _default3() {
return child;
}
})
);
})
);
var overflowedIndicator = ((_slots$overflowedIndi = slots.overflowedIndicator) === null || _slots$overflowedIndi === void 0 ? void 0 : _slots$overflowedIndi.call(slots)) || createVNode(EllipsisOutlined$1, null, null);
return createVNode(Overflow$1, _objectSpread2$1(_objectSpread2$1({}, attrs), {}, {
"onMousedown": props3.onMousedown,
"prefixCls": "".concat(prefixCls.value, "-overflow"),
"component": "ul",
"itemComponent": __unplugin_components_2$3,
"class": [className.value, attrs.class],
"role": "menu",
"id": props3.id,
"data": wrappedChildList,
"renderRawItem": function renderRawItem(node) {
return node;
},
"renderRawRest": function renderRawRest(omitItems) {
var len = omitItems.length;
var originOmitItems = len ? childList.slice(-len) : null;
return createVNode(Fragment, null, [createVNode(SubMenu, {
"eventKey": OVERFLOW_KEY,
"key": OVERFLOW_KEY,
"title": overflowedIndicator,
"disabled": allVisible,
"internalPopupClose": len === 0
}, {
default: function _default3() {
return originOmitItems;
}
}), createVNode(PathContext, null, {
default: function _default3() {
return [createVNode(SubMenu, {
"eventKey": OVERFLOW_KEY,
"key": OVERFLOW_KEY,
"title": overflowedIndicator,
"disabled": allVisible,
"internalPopupClose": len === 0
}, {
default: function _default4() {
return originOmitItems;
}
})];
}
})]);
},
"maxCount": mergedMode.value !== "horizontal" || props3.disabledOverflow ? Overflow$1.INVALIDATE : Overflow$1.RESPONSIVE,
"ssr": "full",
"data-menu-list": true,
"onVisibleChange": function onVisibleChange(newLastIndex) {
lastVisibleIndex.value = newLastIndex;
}
}), {
default: function _default3() {
return [createVNode(Teleport, {
"to": "body"
}, {
default: function _default4() {
return [createVNode("div", {
"style": {
display: "none"
},
"aria-hidden": true
}, [createVNode(PathContext, null, {
default: function _default5() {
return [wrappedChildList];
}
})])];
}
})];
}
});
};
}
});
var menuItemGroupProps = function menuItemGroupProps2() {
return {
title: PropTypes$1.any
};
};
const ItemGroup = defineComponent({
compatConfig: {
MODE: 3
},
name: "AMenuItemGroup",
inheritAttrs: false,
props: menuItemGroupProps(),
slots: ["title"],
setup: function setup47(props3, _ref) {
var slots = _ref.slots, attrs = _ref.attrs;
var _useInjectMenu = useInjectMenu(), prefixCls = _useInjectMenu.prefixCls;
var groupPrefixCls = computed(function() {
return "".concat(prefixCls.value, "-item-group");
});
var isMeasure = useMeasure();
return function() {
var _slots$default, _slots$default2;
if (isMeasure)
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
return createVNode("li", _objectSpread2$1(_objectSpread2$1({}, attrs), {}, {
"onClick": function onClick2(e2) {
return e2.stopPropagation();
},
"class": groupPrefixCls.value
}), [createVNode("div", {
"title": typeof props3.title === "string" ? props3.title : void 0,
"class": "".concat(groupPrefixCls.value, "-title")
}, [getPropsSlot(slots, props3, "title")]), createVNode("ul", {
"class": "".concat(groupPrefixCls.value, "-list")
}, [(_slots$default2 = slots.default) === null || _slots$default2 === void 0 ? void 0 : _slots$default2.call(slots)])]);
};
}
});
var menuDividerProps = function menuDividerProps2() {
return {
prefixCls: String,
dashed: Boolean
};
};
const Divider = defineComponent({
compatConfig: {
MODE: 3
},
name: "AMenuDivider",
props: menuDividerProps(),
setup: function setup48(props3) {
var _useConfigInject = useConfigInject("menu", props3), prefixCls = _useConfigInject.prefixCls;
var cls = computed(function() {
var _ref;
return _ref = {}, _defineProperty$q(_ref, "".concat(prefixCls.value, "-item-divider"), true), _defineProperty$q(_ref, "".concat(prefixCls.value, "-item-divider-dashed"), !!props3.dashed), _ref;
});
return function() {
return createVNode("li", {
"class": cls.value
}, null);
};
}
});
Menu.install = function(app) {
app.component(Menu.name, Menu);
app.component(__unplugin_components_2$3.name, __unplugin_components_2$3);
app.component(SubMenu.name, SubMenu);
app.component(Divider.name, Divider);
app.component(ItemGroup.name, ItemGroup);
return app;
};
Menu.Item = __unplugin_components_2$3;
Menu.Divider = Divider;
Menu.SubMenu = SubMenu;
Menu.ItemGroup = ItemGroup;
function _createForOfIteratorHelper(o2, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
if (!it) {
if (Array.isArray(o2) || (it = _unsupportedIterableToArray$2(o2)) || allowArrayLike && o2 && typeof o2.length === "number") {
if (it)
o2 = it;
var i2 = 0;
var F2 = function F3() {
};
return {
s: F2,
n: function n2() {
if (i2 >= o2.length)
return {
done: true
};
return {
done: false,
value: o2[i2++]
};
},
e: function e2(_e) {
throw _e;
},
f: F2
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true, didErr = false, err;
return {
s: function s2() {
it = it.call(o2);
},
n: function n2() {
var step = it.next();
normalCompletion = step.done;
return step;
},
e: function e2(_e2) {
didErr = true;
err = _e2;
},
f: function f2() {
try {
if (!normalCompletion && it["return"] != null)
it["return"]();
} finally {
if (didErr)
throw err;
}
}
};
}
var weekday$1 = { exports: {} };
(function(module2, exports2) {
!function(e2, t2) {
module2.exports = t2();
}(commonjsGlobal, function() {
return function(e2, t2) {
t2.prototype.weekday = function(e3) {
var t3 = this.$locale().weekStart || 0, i2 = this.$W, n2 = (i2 < t3 ? i2 + 7 : i2) - t3;
return this.$utils().u(e3) ? n2 : this.subtract(n2, "day").add(e3, "day");
};
};
});
})(weekday$1);
var weekdayExports = weekday$1.exports;
const weekday = /* @__PURE__ */ getDefaultExportFromCjs(weekdayExports);
var localeData$1 = { exports: {} };
(function(module2, exports2) {
!function(n2, e2) {
module2.exports = e2();
}(commonjsGlobal, function() {
return function(n2, e2, t2) {
var r2 = e2.prototype, o2 = function(n3) {
return n3 && (n3.indexOf ? n3 : n3.s);
}, u2 = function(n3, e3, t3, r3, u3) {
var i3 = n3.name ? n3 : n3.$locale(), a3 = o2(i3[e3]), s3 = o2(i3[t3]), f2 = a3 || s3.map(function(n4) {
return n4.slice(0, r3);
});
if (!u3)
return f2;
var d2 = i3.weekStart;
return f2.map(function(n4, e4) {
return f2[(e4 + (d2 || 0)) % 7];
});
}, i2 = function() {
return t2.Ls[t2.locale()];
}, a2 = function(n3, e3) {
return n3.formats[e3] || function(n4) {
return n4.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n5, e4, t3) {
return e4 || t3.slice(1);
});
}(n3.formats[e3.toUpperCase()]);
}, s2 = function() {
var n3 = this;
return { months: function(e3) {
return e3 ? e3.format("MMMM") : u2(n3, "months");
}, monthsShort: function(e3) {
return e3 ? e3.format("MMM") : u2(n3, "monthsShort", "months", 3);
}, firstDayOfWeek: function() {
return n3.$locale().weekStart || 0;
}, weekdays: function(e3) {
return e3 ? e3.format("dddd") : u2(n3, "weekdays");
}, weekdaysMin: function(e3) {
return e3 ? e3.format("dd") : u2(n3, "weekdaysMin", "weekdays", 2);
}, weekdaysShort: function(e3) {
return e3 ? e3.format("ddd") : u2(n3, "weekdaysShort", "weekdays", 3);
}, longDateFormat: function(e3) {
return a2(n3.$locale(), e3);
}, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
};
r2.localeData = function() {
return s2.bind(this)();
}, t2.localeData = function() {
var n3 = i2();
return { firstDayOfWeek: function() {
return n3.weekStart || 0;
}, weekdays: function() {
return t2.weekdays();
}, weekdaysShort: function() {
return t2.weekdaysShort();
}, weekdaysMin: function() {
return t2.weekdaysMin();
}, months: function() {
return t2.months();
}, monthsShort: function() {
return t2.monthsShort();
}, longDateFormat: function(e3) {
return a2(n3, e3);
}, meridiem: n3.meridiem, ordinal: n3.ordinal };
}, t2.months = function() {
return u2(i2(), "months");
}, t2.monthsShort = function() {
return u2(i2(), "monthsShort", "months", 3);
}, t2.weekdays = function(n3) {
return u2(i2(), "weekdays", null, null, n3);
}, t2.weekdaysShort = function(n3) {
return u2(i2(), "weekdaysShort", "weekdays", 3, n3);
}, t2.weekdaysMin = function(n3) {
return u2(i2(), "weekdaysMin", "weekdays", 2, n3);
};
};
});
})(localeData$1);
var localeDataExports = localeData$1.exports;
const localeData = /* @__PURE__ */ getDefaultExportFromCjs(localeDataExports);
var weekOfYear$1 = { exports: {} };
(function(module2, exports2) {
!function(e2, t2) {
module2.exports = t2();
}(commonjsGlobal, function() {
var e2 = "week", t2 = "year";
return function(i2, n2, r2) {
var f2 = n2.prototype;
f2.week = function(i3) {
if (void 0 === i3 && (i3 = null), null !== i3)
return this.add(7 * (i3 - this.week()), "day");
var n3 = this.$locale().yearStart || 1;
if (11 === this.month() && this.date() > 25) {
var f3 = r2(this).startOf(t2).add(1, t2).date(n3), s2 = r2(this).endOf(e2);
if (f3.isBefore(s2))
return 1;
}
var a2 = r2(this).startOf(t2).date(n3).startOf(e2).subtract(1, "millisecond"), o2 = this.diff(a2, e2, true);
return o2 < 0 ? r2(this).startOf("week").week() : Math.ceil(o2);
}, f2.weeks = function(e3) {
return void 0 === e3 && (e3 = null), this.week(e3);
};
};
});
})(weekOfYear$1);
var weekOfYearExports = weekOfYear$1.exports;
const weekOfYear = /* @__PURE__ */ getDefaultExportFromCjs(weekOfYearExports);
var weekYear$1 = { exports: {} };
(function(module2, exports2) {
!function(e2, t2) {
module2.exports = t2();
}(commonjsGlobal, function() {
return function(e2, t2) {
t2.prototype.weekYear = function() {
var e3 = this.month(), t3 = this.week(), n2 = this.year();
return 1 === t3 && 11 === e3 ? n2 + 1 : 0 === e3 && t3 >= 52 ? n2 - 1 : n2;
};
};
});
})(weekYear$1);
var weekYearExports = weekYear$1.exports;
const weekYear = /* @__PURE__ */ getDefaultExportFromCjs(weekYearExports);
var quarterOfYear$1 = { exports: {} };
(function(module2, exports2) {
!function(t2, n2) {
module2.exports = n2();
}(commonjsGlobal, function() {
var t2 = "month", n2 = "quarter";
return function(e2, i2) {
var r2 = i2.prototype;
r2.quarter = function(t3) {
return this.$utils().u(t3) ? Math.ceil((this.month() + 1) / 3) : this.month(this.month() % 3 + 3 * (t3 - 1));
};
var s2 = r2.add;
r2.add = function(e3, i3) {
return e3 = Number(e3), this.$utils().p(i3) === n2 ? this.add(3 * e3, t2) : s2.bind(this)(e3, i3);
};
var u2 = r2.startOf;
r2.startOf = function(e3, i3) {
var r3 = this.$utils(), s3 = !!r3.u(i3) || i3;
if (r3.p(e3) === n2) {
var o2 = this.quarter() - 1;
return s3 ? this.month(3 * o2).startOf(t2).startOf("day") : this.month(3 * o2 + 2).endOf(t2).endOf("day");
}
return u2.bind(this)(e3, i3);
};
};
});
})(quarterOfYear$1);
var quarterOfYearExports = quarterOfYear$1.exports;
const quarterOfYear = /* @__PURE__ */ getDefaultExportFromCjs(quarterOfYearExports);
var advancedFormat$1 = { exports: {} };
(function(module2, exports2) {
!function(e2, t2) {
module2.exports = t2();
}(commonjsGlobal, function() {
return function(e2, t2) {
var r2 = t2.prototype, n2 = r2.format;
r2.format = function(e3) {
var t3 = this, r3 = this.$locale();
if (!this.isValid())
return n2.bind(this)(e3);
var s2 = this.$utils(), a2 = (e3 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e4) {
switch (e4) {
case "Q":
return Math.ceil((t3.$M + 1) / 3);
case "Do":
return r3.ordinal(t3.$D);
case "gggg":
return t3.weekYear();
case "GGGG":
return t3.isoWeekYear();
case "wo":
return r3.ordinal(t3.week(), "W");
case "w":
case "ww":
return s2.s(t3.week(), "w" === e4 ? 1 : 2, "0");
case "W":
case "WW":
return s2.s(t3.isoWeek(), "W" === e4 ? 1 : 2, "0");
case "k":
case "kk":
return s2.s(String(0 === t3.$H ? 24 : t3.$H), "k" === e4 ? 1 : 2, "0");
case "X":
return Math.floor(t3.$d.getTime() / 1e3);
case "x":
return t3.$d.getTime();
case "z":
return "[" + t3.offsetName() + "]";
case "zzz":
return "[" + t3.offsetName("long") + "]";
default:
return e4;
}
});
return n2.bind(this)(a2);
};
};
});
})(advancedFormat$1);
var advancedFormatExports = advancedFormat$1.exports;
const advancedFormat = /* @__PURE__ */ getDefaultExportFromCjs(advancedFormatExports);
var customParseFormat$1 = { exports: {} };
(function(module2, exports2) {
!function(e2, t2) {
module2.exports = t2();
}(commonjsGlobal, function() {
var e2 = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t2 = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n2 = /\d\d/, r2 = /\d\d?/, i2 = /\d*[^-_:/,()\s\d]+/, o2 = {}, s2 = function(e3) {
return (e3 = +e3) + (e3 > 68 ? 1900 : 2e3);
};
var a2 = function(e3) {
return function(t3) {
this[e3] = +t3;
};
}, f2 = [/[+-]\d\d:?(\d\d)?|Z/, function(e3) {
(this.zone || (this.zone = {})).offset = function(e4) {
if (!e4)
return 0;
if ("Z" === e4)
return 0;
var t3 = e4.match(/([+-]|\d\d)/g), n3 = 60 * t3[1] + (+t3[2] || 0);
return 0 === n3 ? 0 : "+" === t3[0] ? -n3 : n3;
}(e3);
}], h2 = function(e3) {
var t3 = o2[e3];
return t3 && (t3.indexOf ? t3 : t3.s.concat(t3.f));
}, u2 = function(e3, t3) {
var n3, r3 = o2.meridiem;
if (r3) {
for (var i3 = 1; i3 <= 24; i3 += 1)
if (e3.indexOf(r3(i3, 0, t3)) > -1) {
n3 = i3 > 12;
break;
}
} else
n3 = e3 === (t3 ? "pm" : "PM");
return n3;
}, d2 = { A: [i2, function(e3) {
this.afternoon = u2(e3, false);
}], a: [i2, function(e3) {
this.afternoon = u2(e3, true);
}], S: [/\d/, function(e3) {
this.milliseconds = 100 * +e3;
}], SS: [n2, function(e3) {
this.milliseconds = 10 * +e3;
}], SSS: [/\d{3}/, function(e3) {
this.milliseconds = +e3;
}], s: [r2, a2("seconds")], ss: [r2, a2("seconds")], m: [r2, a2("minutes")], mm: [r2, a2("minutes")], H: [r2, a2("hours")], h: [r2, a2("hours")], HH: [r2, a2("hours")], hh: [r2, a2("hours")], D: [r2, a2("day")], DD: [n2, a2("day")], Do: [i2, function(e3) {
var t3 = o2.ordinal, n3 = e3.match(/\d+/);
if (this.day = n3[0], t3)
for (var r3 = 1; r3 <= 31; r3 += 1)
t3(r3).replace(/\[|\]/g, "") === e3 && (this.day = r3);
}], M: [r2, a2("month")], MM: [n2, a2("month")], MMM: [i2, function(e3) {
var t3 = h2("months"), n3 = (h2("monthsShort") || t3.map(function(e4) {
return e4.slice(0, 3);
})).indexOf(e3) + 1;
if (n3 < 1)
throw new Error();
this.month = n3 % 12 || n3;
}], MMMM: [i2, function(e3) {
var t3 = h2("months").indexOf(e3) + 1;
if (t3 < 1)
throw new Error();
this.month = t3 % 12 || t3;
}], Y: [/[+-]?\d+/, a2("year")], YY: [n2, function(e3) {
this.year = s2(e3);
}], YYYY: [/\d{4}/, a2("year")], Z: f2, ZZ: f2 };
function c2(n3) {
var r3, i3;
r3 = n3, i3 = o2 && o2.formats;
for (var s3 = (n3 = r3.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t3, n4, r4) {
var o3 = r4 && r4.toUpperCase();
return n4 || i3[r4] || e2[r4] || i3[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e3, t4, n5) {
return t4 || n5.slice(1);
});
})).match(t2), a3 = s3.length, f3 = 0; f3 < a3; f3 += 1) {
var h3 = s3[f3], u3 = d2[h3], c3 = u3 && u3[0], l2 = u3 && u3[1];
s3[f3] = l2 ? { regex: c3, parser: l2 } : h3.replace(/^\[|\]$/g, "");
}
return function(e3) {
for (var t3 = {}, n4 = 0, r4 = 0; n4 < a3; n4 += 1) {
var i4 = s3[n4];
if ("string" == typeof i4)
r4 += i4.length;
else {
var o3 = i4.regex, f4 = i4.parser, h4 = e3.slice(r4), u4 = o3.exec(h4)[0];
f4.call(t3, u4), e3 = e3.replace(u4, "");
}
}
return function(e4) {
var t4 = e4.afternoon;
if (void 0 !== t4) {
var n5 = e4.hours;
t4 ? n5 < 12 && (e4.hours += 12) : 12 === n5 && (e4.hours = 0), delete e4.afternoon;
}
}(t3), t3;
};
}
return function(e3, t3, n3) {
n3.p.customParseFormat = true, e3 && e3.parseTwoDigitYear && (s2 = e3.parseTwoDigitYear);
var r3 = t3.prototype, i3 = r3.parse;
r3.parse = function(e4) {
var t4 = e4.date, r4 = e4.utc, s3 = e4.args;
this.$u = r4;
var a3 = s3[1];
if ("string" == typeof a3) {
var f3 = true === s3[2], h3 = true === s3[3], u3 = f3 || h3, d3 = s3[2];
h3 && (d3 = s3[2]), o2 = this.$locale(), !f3 && d3 && (o2 = n3.Ls[d3]), this.$d = function(e5, t5, n4) {
try {
if (["x", "X"].indexOf(t5) > -1)
return new Date(("X" === t5 ? 1e3 : 1) * e5);
var r5 = c2(t5)(e5), i4 = r5.year, o3 = r5.month, s4 = r5.day, a4 = r5.hours, f4 = r5.minutes, h4 = r5.seconds, u4 = r5.milliseconds, d4 = r5.zone, l3 = /* @__PURE__ */ new Date(), m3 = s4 || (i4 || o3 ? 1 : l3.getDate()), M3 = i4 || l3.getFullYear(), Y2 = 0;
i4 && !o3 || (Y2 = o3 > 0 ? o3 - 1 : l3.getMonth());
var p = a4 || 0, v2 = f4 || 0, D2 = h4 || 0, g2 = u4 || 0;
return d4 ? new Date(Date.UTC(M3, Y2, m3, p, v2, D2, g2 + 60 * d4.offset * 1e3)) : n4 ? new Date(Date.UTC(M3, Y2, m3, p, v2, D2, g2)) : new Date(M3, Y2, m3, p, v2, D2, g2);
} catch (e6) {
return /* @__PURE__ */ new Date("");
}
}(t4, a3, r4), this.init(), d3 && true !== d3 && (this.$L = this.locale(d3).$L), u3 && t4 != this.format(a3) && (this.$d = /* @__PURE__ */ new Date("")), o2 = {};
} else if (a3 instanceof Array)
for (var l2 = a3.length, m2 = 1; m2 <= l2; m2 += 1) {
s3[1] = a3[m2 - 1];
var M2 = n3.apply(this, s3);
if (M2.isValid()) {
this.$d = M2.$d, this.$L = M2.$L, this.init();
break;
}
m2 === l2 && (this.$d = /* @__PURE__ */ new Date(""));
}
else
i3.call(this, e4);
};
};
});
})(customParseFormat$1);
var customParseFormatExports = customParseFormat$1.exports;
const customParseFormat = /* @__PURE__ */ getDefaultExportFromCjs(customParseFormatExports);
dayjs.extend(customParseFormat);
dayjs.extend(advancedFormat);
dayjs.extend(weekday);
dayjs.extend(localeData);
dayjs.extend(weekOfYear);
dayjs.extend(weekYear);
dayjs.extend(quarterOfYear);
dayjs.extend(function(_o, c2) {
var proto = c2.prototype;
var oldFormat = proto.format;
proto.format = function f2(formatStr) {
var str = (formatStr || "").replace("Wo", "wo");
return oldFormat.bind(this)(str);
};
});
var localeMap = {
// ar_EG:
// az_AZ:
// bg_BG:
bn_BD: "bn-bd",
by_BY: "be",
// ca_ES:
// cs_CZ:
// da_DK:
// de_DE:
// el_GR:
en_GB: "en-gb",
en_US: "en",
// es_ES:
// et_EE:
// fa_IR:
// fi_FI:
fr_BE: "fr",
fr_CA: "fr-ca",
// fr_FR:
// ga_IE:
// gl_ES:
// he_IL:
// hi_IN:
// hr_HR:
// hu_HU:
hy_AM: "hy-am",
// id_ID:
// is_IS:
// it_IT:
// ja_JP:
// ka_GE:
// kk_KZ:
// km_KH:
kmr_IQ: "ku",
// kn_IN:
// ko_KR:
// ku_IQ: // previous ku in antd
// lt_LT:
// lv_LV:
// mk_MK:
// ml_IN:
// mn_MN:
// ms_MY:
// nb_NO:
// ne_NP:
nl_BE: "nl-be",
// nl_NL:
// pl_PL:
pt_BR: "pt-br",
// pt_PT:
// ro_RO:
// ru_RU:
// sk_SK:
// sl_SI:
// sr_RS:
// sv_SE:
// ta_IN:
// th_TH:
// tr_TR:
// uk_UA:
// ur_PK:
// vi_VN:
zh_CN: "zh-cn",
zh_HK: "zh-hk",
zh_TW: "zh-tw"
};
var parseLocale = function parseLocale2(locale3) {
var mapLocale = localeMap[locale3];
return mapLocale || locale3.split("_")[0];
};
var parseNoMatchNotice = function parseNoMatchNotice2() {
noteOnce(false, "Not match any format. Please help to fire a issue about this.");
};
var advancedFormatRegex = /\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|k{1,2}|S/g;
function findTargetStr(val, index2, segmentation) {
var items = _toConsumableArray(new Set(val.split(segmentation)));
var idx = 0;
for (var i2 = 0; i2 < items.length; i2++) {
var item = items[i2];
idx += item.length;
if (idx > index2) {
return item;
}
idx += segmentation.length;
}
}
var toDateWithValueFormat = function toDateWithValueFormat2(val, valueFormat) {
if (!val)
return null;
if (dayjs.isDayjs(val)) {
return val;
}
var matchs = valueFormat.matchAll(advancedFormatRegex);
var baseDate = dayjs(val, valueFormat);
if (matchs === null) {
return baseDate;
}
var _iterator = _createForOfIteratorHelper(matchs), _step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
var match2 = _step.value;
var origin = match2[0];
var index2 = match2["index"];
if (origin === "Q") {
var segmentation = val.slice(index2 - 1, index2);
var quarterStr = findTargetStr(val, index2, segmentation).match(/\d+/)[0];
baseDate = baseDate.quarter(parseInt(quarterStr));
}
if (origin.toLowerCase() === "wo") {
var _segmentation = val.slice(index2 - 1, index2);
var weekStr = findTargetStr(val, index2, _segmentation).match(/\d+/)[0];
baseDate = baseDate.week(parseInt(weekStr));
}
if (origin.toLowerCase() === "ww") {
baseDate = baseDate.week(parseInt(val.slice(index2, index2 + origin.length)));
}
if (origin.toLowerCase() === "w") {
baseDate = baseDate.week(parseInt(val.slice(index2, index2 + origin.length + 1)));
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return baseDate;
};
var generateConfig = {
// get
getNow: function getNow() {
return dayjs();
},
getFixedDate: function getFixedDate(string) {
return dayjs(string, ["YYYY-M-DD", "YYYY-MM-DD"]);
},
getEndDate: function getEndDate(date2) {
return date2.endOf("month");
},
getWeekDay: function getWeekDay(date2) {
var clone3 = date2.locale("en");
return clone3.weekday() + clone3.localeData().firstDayOfWeek();
},
getYear: function getYear(date2) {
return date2.year();
},
getMonth: function getMonth(date2) {
return date2.month();
},
getDate: function getDate(date2) {
return date2.date();
},
getHour: function getHour(date2) {
return date2.hour();
},
getMinute: function getMinute(date2) {
return date2.minute();
},
getSecond: function getSecond(date2) {
return date2.second();
},
// set
addYear: function addYear(date2, diff2) {
return date2.add(diff2, "year");
},
addMonth: function addMonth(date2, diff2) {
return date2.add(diff2, "month");
},
addDate: function addDate(date2, diff2) {
return date2.add(diff2, "day");
},
setYear: function setYear(date2, year) {
return date2.year(year);
},
setMonth: function setMonth(date2, month) {
return date2.month(month);
},
setDate: function setDate(date2, num) {
return date2.date(num);
},
setHour: function setHour(date2, hour) {
return date2.hour(hour);
},
setMinute: function setMinute(date2, minute) {
return date2.minute(minute);
},
setSecond: function setSecond(date2, second) {
return date2.second(second);
},
// Compare
isAfter: function isAfter(date1, date2) {
return date1.isAfter(date2);
},
isValidate: function isValidate(date2) {
return date2.isValid();
},
locale: {
getWeekFirstDay: function getWeekFirstDay(locale3) {
return dayjs().locale(parseLocale(locale3)).localeData().firstDayOfWeek();
},
getWeekFirstDate: function getWeekFirstDate(locale3, date2) {
return date2.locale(parseLocale(locale3)).weekday(0);
},
getWeek: function getWeek(locale3, date2) {
return date2.locale(parseLocale(locale3)).week();
},
getShortWeekDays: function getShortWeekDays(locale3) {
return dayjs().locale(parseLocale(locale3)).localeData().weekdaysMin();
},
getShortMonths: function getShortMonths(locale3) {
return dayjs().locale(parseLocale(locale3)).localeData().monthsShort();
},
format: function format(locale3, date2, _format) {
return date2.locale(parseLocale(locale3)).format(_format);
},
parse: function parse(locale3, text, formats) {
var localeStr = parseLocale(locale3);
for (var i2 = 0; i2 < formats.length; i2 += 1) {
var format3 = formats[i2];
var formatText = text;
if (format3.includes("wo") || format3.includes("Wo")) {
var year = formatText.split("-")[0];
var weekStr = formatText.split("-")[1];
var firstWeek = dayjs(year, "YYYY").startOf("year").locale(localeStr);
for (var j2 = 0; j2 <= 52; j2 += 1) {
var nextWeek = firstWeek.add(j2, "week");
if (nextWeek.format("Wo") === weekStr) {
return nextWeek;
}
}
parseNoMatchNotice();
return null;
}
var date2 = dayjs(formatText, format3, true).locale(localeStr);
if (date2.isValid()) {
return date2;
}
}
if (!text) {
parseNoMatchNotice();
}
return null;
}
},
toDate: function toDate(value2, valueFormat) {
if (Array.isArray(value2)) {
return value2.map(function(val) {
return toDateWithValueFormat(val, valueFormat);
});
} else {
return toDateWithValueFormat(value2, valueFormat);
}
},
toString: function toString(value2, valueFormat) {
if (Array.isArray(value2)) {
return value2.map(function(val) {
return dayjs.isDayjs(val) ? val.format(valueFormat) : val;
});
} else {
return dayjs.isDayjs(value2) ? value2.format(valueFormat) : value2;
}
}
};
const dayjsGenerateConfig = generateConfig;
function arrayMap(array, iteratee) {
var index2 = -1, length = array == null ? 0 : array.length, result = Array(length);
while (++index2 < length) {
result[index2] = iteratee(array[index2], index2, array);
}
return result;
}
var symbolTag = "[object Symbol]";
function isSymbol(value2) {
return typeof value2 == "symbol" || isObjectLike(value2) && baseGetTag(value2) == symbolTag;
}
var INFINITY$1 = 1 / 0;
var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
function baseToString(value2) {
if (typeof value2 == "string") {
return value2;
}
if (isArray$2(value2)) {
return arrayMap(value2, baseToString) + "";
}
if (isSymbol(value2)) {
return symbolToString ? symbolToString.call(value2) : "";
}
var result = value2 + "";
return result == "0" && 1 / value2 == -INFINITY$1 ? "-0" : result;
}
function toString2(value2) {
return value2 == null ? "" : baseToString(value2);
}
function useMergeProps(props3) {
var attrs = useAttrs();
return _objectSpread2$1(_objectSpread2$1({}, props3), attrs);
}
var PanelContextKey = Symbol("PanelContextProps");
var useProvidePanel = function useProvidePanel2(props3) {
provide(PanelContextKey, props3);
};
var useInjectPanel = function useInjectPanel2() {
return inject(PanelContextKey, {});
};
var HIDDEN_STYLE = {
visibility: "hidden"
};
function Header(_props, _ref) {
var _slots$default;
var slots = _ref.slots;
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, _props$prevIcon = props3.prevIcon, prevIcon = _props$prevIcon === void 0 ? "‹" : _props$prevIcon, _props$nextIcon = props3.nextIcon, nextIcon = _props$nextIcon === void 0 ? "›" : _props$nextIcon, _props$superPrevIcon = props3.superPrevIcon, superPrevIcon = _props$superPrevIcon === void 0 ? "«" : _props$superPrevIcon, _props$superNextIcon = props3.superNextIcon, superNextIcon = _props$superNextIcon === void 0 ? "»" : _props$superNextIcon, onSuperPrev = props3.onSuperPrev, onSuperNext = props3.onSuperNext, onPrev = props3.onPrev, onNext = props3.onNext;
var _useInjectPanel = useInjectPanel(), hideNextBtn = _useInjectPanel.hideNextBtn, hidePrevBtn = _useInjectPanel.hidePrevBtn;
return createVNode("div", {
"class": prefixCls
}, [onSuperPrev && createVNode("button", {
"type": "button",
"onClick": onSuperPrev,
"tabindex": -1,
"class": "".concat(prefixCls, "-super-prev-btn"),
"style": hidePrevBtn.value ? HIDDEN_STYLE : {}
}, [superPrevIcon]), onPrev && createVNode("button", {
"type": "button",
"onClick": onPrev,
"tabindex": -1,
"class": "".concat(prefixCls, "-prev-btn"),
"style": hidePrevBtn.value ? HIDDEN_STYLE : {}
}, [prevIcon]), createVNode("div", {
"class": "".concat(prefixCls, "-view")
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]), onNext && createVNode("button", {
"type": "button",
"onClick": onNext,
"tabindex": -1,
"class": "".concat(prefixCls, "-next-btn"),
"style": hideNextBtn.value ? HIDDEN_STYLE : {}
}, [nextIcon]), onSuperNext && createVNode("button", {
"type": "button",
"onClick": onSuperNext,
"tabindex": -1,
"class": "".concat(prefixCls, "-super-next-btn"),
"style": hideNextBtn.value ? HIDDEN_STYLE : {}
}, [superNextIcon])]);
}
Header.displayName = "Header";
Header.inheritAttrs = false;
function DecadeHeader(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, generateConfig2 = props3.generateConfig, viewDate = props3.viewDate, onPrevDecades = props3.onPrevDecades, onNextDecades = props3.onNextDecades;
var _useInjectPanel = useInjectPanel(), hideHeader = _useInjectPanel.hideHeader;
if (hideHeader) {
return null;
}
var headerPrefixCls = "".concat(prefixCls, "-header");
var yearNumber = generateConfig2.getYear(viewDate);
var startYear = Math.floor(yearNumber / DECADE_DISTANCE_COUNT) * DECADE_DISTANCE_COUNT;
var endYear = startYear + DECADE_DISTANCE_COUNT - 1;
return createVNode(Header, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": headerPrefixCls,
"onSuperPrev": onPrevDecades,
"onSuperNext": onNextDecades
}), {
default: function _default3() {
return [startYear, createTextVNode("-"), endYear];
}
});
}
DecadeHeader.displayName = "DecadeHeader";
DecadeHeader.inheritAttrs = false;
function setTime(generateConfig2, date2, hour, minute, second) {
var nextTime = generateConfig2.setHour(date2, hour);
nextTime = generateConfig2.setMinute(nextTime, minute);
nextTime = generateConfig2.setSecond(nextTime, second);
return nextTime;
}
function setDateTime(generateConfig2, date2, defaultDate) {
if (!defaultDate) {
return date2;
}
var newDate = date2;
newDate = generateConfig2.setHour(newDate, generateConfig2.getHour(defaultDate));
newDate = generateConfig2.setMinute(newDate, generateConfig2.getMinute(defaultDate));
newDate = generateConfig2.setSecond(newDate, generateConfig2.getSecond(defaultDate));
return newDate;
}
function getLowerBoundTime(hour, minute, second, hourStep, minuteStep, secondStep) {
var lowerBoundHour = Math.floor(hour / hourStep) * hourStep;
if (lowerBoundHour < hour) {
return [lowerBoundHour, 60 - minuteStep, 60 - secondStep];
}
var lowerBoundMinute = Math.floor(minute / minuteStep) * minuteStep;
if (lowerBoundMinute < minute) {
return [lowerBoundHour, lowerBoundMinute, 60 - secondStep];
}
var lowerBoundSecond = Math.floor(second / secondStep) * secondStep;
return [lowerBoundHour, lowerBoundMinute, lowerBoundSecond];
}
function getLastDay(generateConfig2, date2) {
var year = generateConfig2.getYear(date2);
var month = generateConfig2.getMonth(date2) + 1;
var endDate = generateConfig2.getEndDate(generateConfig2.getFixedDate("".concat(year, "-").concat(month, "-01")));
var lastDay = generateConfig2.getDate(endDate);
var monthShow = month < 10 ? "0".concat(month) : "".concat(month);
return "".concat(year, "-").concat(monthShow, "-").concat(lastDay);
}
function PanelBody(_props) {
var _useMergeProps = useMergeProps(_props), prefixCls = _useMergeProps.prefixCls, disabledDate = _useMergeProps.disabledDate, onSelect = _useMergeProps.onSelect, picker = _useMergeProps.picker, rowNum = _useMergeProps.rowNum, colNum = _useMergeProps.colNum, prefixColumn = _useMergeProps.prefixColumn, rowClassName = _useMergeProps.rowClassName, baseDate = _useMergeProps.baseDate, getCellClassName = _useMergeProps.getCellClassName, getCellText = _useMergeProps.getCellText, getCellNode = _useMergeProps.getCellNode, getCellDate = _useMergeProps.getCellDate, generateConfig2 = _useMergeProps.generateConfig, titleCell = _useMergeProps.titleCell, headerCells = _useMergeProps.headerCells;
var _useInjectPanel = useInjectPanel(), onDateMouseenter = _useInjectPanel.onDateMouseenter, onDateMouseleave = _useInjectPanel.onDateMouseleave, mode = _useInjectPanel.mode;
var cellPrefixCls = "".concat(prefixCls, "-cell");
var rows = [];
for (var i2 = 0; i2 < rowNum; i2 += 1) {
var row = [];
var rowStartDate = void 0;
var _loop = function _loop2() {
var _objectSpread22;
var offset3 = i2 * colNum + j2;
var currentDate = getCellDate(baseDate, offset3);
var disabled = getCellDateDisabled({
cellDate: currentDate,
mode: mode.value,
disabledDate,
generateConfig: generateConfig2
});
if (j2 === 0) {
rowStartDate = currentDate;
if (prefixColumn) {
row.push(prefixColumn(rowStartDate));
}
}
var title = titleCell && titleCell(currentDate);
row.push(createVNode("td", {
"key": j2,
"title": title,
"class": classNames(cellPrefixCls, _objectSpread2$1((_objectSpread22 = {}, _defineProperty$q(_objectSpread22, "".concat(cellPrefixCls, "-disabled"), disabled), _defineProperty$q(_objectSpread22, "".concat(cellPrefixCls, "-start"), getCellText(currentDate) === 1 || picker === "year" && Number(title) % 10 === 0), _defineProperty$q(_objectSpread22, "".concat(cellPrefixCls, "-end"), title === getLastDay(generateConfig2, currentDate) || picker === "year" && Number(title) % 10 === 9), _objectSpread22), getCellClassName(currentDate))),
"onClick": function onClick2() {
if (!disabled) {
onSelect(currentDate);
}
},
"onMouseenter": function onMouseenter2() {
if (!disabled && onDateMouseenter) {
onDateMouseenter(currentDate);
}
},
"onMouseleave": function onMouseleave2() {
if (!disabled && onDateMouseleave) {
onDateMouseleave(currentDate);
}
}
}, [getCellNode ? getCellNode(currentDate) : createVNode("div", {
"class": "".concat(cellPrefixCls, "-inner")
}, [getCellText(currentDate)])]));
};
for (var j2 = 0; j2 < colNum; j2 += 1) {
_loop();
}
rows.push(createVNode("tr", {
"key": i2,
"class": rowClassName && rowClassName(rowStartDate)
}, [row]));
}
return createVNode("div", {
"class": "".concat(prefixCls, "-body")
}, [createVNode("table", {
"class": "".concat(prefixCls, "-content")
}, [headerCells && createVNode("thead", null, [createVNode("tr", null, [headerCells])]), createVNode("tbody", null, [rows])])]);
}
PanelBody.displayName = "PanelBody";
PanelBody.inheritAttrs = false;
var DECADE_COL_COUNT = 3;
var DECADE_ROW_COUNT = 4;
function DecadeBody(_props) {
var props3 = useMergeProps(_props);
var DECADE_UNIT_DIFF_DES = DECADE_UNIT_DIFF - 1;
var prefixCls = props3.prefixCls, viewDate = props3.viewDate, generateConfig2 = props3.generateConfig;
var cellPrefixCls = "".concat(prefixCls, "-cell");
var yearNumber = generateConfig2.getYear(viewDate);
var decadeYearNumber = Math.floor(yearNumber / DECADE_UNIT_DIFF) * DECADE_UNIT_DIFF;
var startDecadeYear = Math.floor(yearNumber / DECADE_DISTANCE_COUNT) * DECADE_DISTANCE_COUNT;
var endDecadeYear = startDecadeYear + DECADE_DISTANCE_COUNT - 1;
var baseDecadeYear = generateConfig2.setYear(viewDate, startDecadeYear - Math.ceil((DECADE_COL_COUNT * DECADE_ROW_COUNT * DECADE_UNIT_DIFF - DECADE_DISTANCE_COUNT) / 2));
var getCellClassName = function getCellClassName2(date2) {
var _ref;
var startDecadeNumber = generateConfig2.getYear(date2);
var endDecadeNumber = startDecadeNumber + DECADE_UNIT_DIFF_DES;
return _ref = {}, _defineProperty$q(_ref, "".concat(cellPrefixCls, "-in-view"), startDecadeYear <= startDecadeNumber && endDecadeNumber <= endDecadeYear), _defineProperty$q(_ref, "".concat(cellPrefixCls, "-selected"), startDecadeNumber === decadeYearNumber), _ref;
};
return createVNode(PanelBody, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"rowNum": DECADE_ROW_COUNT,
"colNum": DECADE_COL_COUNT,
"baseDate": baseDecadeYear,
"getCellText": function getCellText(date2) {
var startDecadeNumber = generateConfig2.getYear(date2);
return "".concat(startDecadeNumber, "-").concat(startDecadeNumber + DECADE_UNIT_DIFF_DES);
},
"getCellClassName": getCellClassName,
"getCellDate": function getCellDate(date2, offset3) {
return generateConfig2.addYear(date2, offset3 * DECADE_UNIT_DIFF);
}
}), null);
}
DecadeBody.displayName = "DecadeBody";
DecadeBody.inheritAttrs = false;
var scrollIds = /* @__PURE__ */ new Map();
function waitElementReady(element, callback) {
var id;
function tryOrNextFrame() {
if (isVisible(element)) {
callback();
} else {
id = wrapperRaf(function() {
tryOrNextFrame();
});
}
}
tryOrNextFrame();
return function() {
wrapperRaf.cancel(id);
};
}
function scrollTo(element, to, duration) {
if (scrollIds.get(element)) {
wrapperRaf.cancel(scrollIds.get(element));
}
if (duration <= 0) {
scrollIds.set(element, wrapperRaf(function() {
element.scrollTop = to;
}));
return;
}
var difference = to - element.scrollTop;
var perTick = difference / duration * 10;
scrollIds.set(element, wrapperRaf(function() {
element.scrollTop += perTick;
if (element.scrollTop !== to) {
scrollTo(element, to, duration - 10);
}
}));
}
function createKeydownHandler(event, _ref) {
var onLeftRight = _ref.onLeftRight, onCtrlLeftRight = _ref.onCtrlLeftRight, onUpDown = _ref.onUpDown, onPageUpDown = _ref.onPageUpDown, onEnter = _ref.onEnter;
var which = event.which, ctrlKey = event.ctrlKey, metaKey = event.metaKey;
switch (which) {
case KeyCode$1.LEFT:
if (ctrlKey || metaKey) {
if (onCtrlLeftRight) {
onCtrlLeftRight(-1);
return true;
}
} else if (onLeftRight) {
onLeftRight(-1);
return true;
}
break;
case KeyCode$1.RIGHT:
if (ctrlKey || metaKey) {
if (onCtrlLeftRight) {
onCtrlLeftRight(1);
return true;
}
} else if (onLeftRight) {
onLeftRight(1);
return true;
}
break;
case KeyCode$1.UP:
if (onUpDown) {
onUpDown(-1);
return true;
}
break;
case KeyCode$1.DOWN:
if (onUpDown) {
onUpDown(1);
return true;
}
break;
case KeyCode$1.PAGE_UP:
if (onPageUpDown) {
onPageUpDown(-1);
return true;
}
break;
case KeyCode$1.PAGE_DOWN:
if (onPageUpDown) {
onPageUpDown(1);
return true;
}
break;
case KeyCode$1.ENTER:
if (onEnter) {
onEnter();
return true;
}
break;
}
return false;
}
function getDefaultFormat(format3, picker, showTime, use12Hours) {
var mergedFormat = format3;
if (!mergedFormat) {
switch (picker) {
case "time":
mergedFormat = use12Hours ? "hh:mm:ss a" : "HH:mm:ss";
break;
case "week":
mergedFormat = "gggg-wo";
break;
case "month":
mergedFormat = "YYYY-MM";
break;
case "quarter":
mergedFormat = "YYYY-[Q]Q";
break;
case "year":
mergedFormat = "YYYY";
break;
default:
mergedFormat = showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
}
}
return mergedFormat;
}
function getInputSize(picker, format3, generateConfig2) {
var defaultSize = picker === "time" ? 8 : 10;
var length = typeof format3 === "function" ? format3(generateConfig2.getNow()).length : format3.length;
return Math.max(defaultSize, length) + 2;
}
var globalClickFunc = null;
var clickCallbacks = /* @__PURE__ */ new Set();
function addGlobalMousedownEvent(callback) {
if (!globalClickFunc && typeof window !== "undefined" && window.addEventListener) {
globalClickFunc = function globalClickFunc2(e2) {
_toConsumableArray(clickCallbacks).forEach(function(queueFunc) {
queueFunc(e2);
});
};
window.addEventListener("mousedown", globalClickFunc);
}
clickCallbacks.add(callback);
return function() {
clickCallbacks.delete(callback);
if (clickCallbacks.size === 0) {
window.removeEventListener("mousedown", globalClickFunc);
globalClickFunc = null;
}
};
}
function getTargetFromEvent(e2) {
var target = e2.target;
if (e2.composed && target.shadowRoot) {
var _e$composedPath;
return ((_e$composedPath = e2.composedPath) === null || _e$composedPath === void 0 ? void 0 : _e$composedPath.call(e2)[0]) || target;
}
return target;
}
var getYearNextMode = function getYearNextMode2(next2) {
if (next2 === "month" || next2 === "date") {
return "year";
}
return next2;
};
var getMonthNextMode = function getMonthNextMode2(next2) {
if (next2 === "date") {
return "month";
}
return next2;
};
var getQuarterNextMode = function getQuarterNextMode2(next2) {
if (next2 === "month" || next2 === "date") {
return "quarter";
}
return next2;
};
var getWeekNextMode = function getWeekNextMode2(next2) {
if (next2 === "date") {
return "week";
}
return next2;
};
var PickerModeMap = {
year: getYearNextMode,
month: getMonthNextMode,
quarter: getQuarterNextMode,
week: getWeekNextMode,
time: null,
date: null
};
function elementsContains(elements, target) {
if (process.env.NODE_ENV === "test") {
return false;
}
return elements.some(function(ele) {
return ele && ele.contains(target);
});
}
var DECADE_UNIT_DIFF = 10;
var DECADE_DISTANCE_COUNT = DECADE_UNIT_DIFF * 10;
function DecadePanel(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, onViewDateChange = props3.onViewDateChange, generateConfig2 = props3.generateConfig, viewDate = props3.viewDate, operationRef = props3.operationRef, onSelect = props3.onSelect, onPanelChange = props3.onPanelChange;
var panelPrefixCls = "".concat(prefixCls, "-decade-panel");
operationRef.value = {
onKeydown: function onKeydown(event) {
return createKeydownHandler(event, {
onLeftRight: function onLeftRight(diff2) {
onSelect(generateConfig2.addYear(viewDate, diff2 * DECADE_UNIT_DIFF), "key");
},
onCtrlLeftRight: function onCtrlLeftRight(diff2) {
onSelect(generateConfig2.addYear(viewDate, diff2 * DECADE_DISTANCE_COUNT), "key");
},
onUpDown: function onUpDown(diff2) {
onSelect(generateConfig2.addYear(viewDate, diff2 * DECADE_UNIT_DIFF * DECADE_COL_COUNT), "key");
},
onEnter: function onEnter() {
onPanelChange("year", viewDate);
}
});
}
};
var onDecadesChange = function onDecadesChange2(diff2) {
var newDate = generateConfig2.addYear(viewDate, diff2 * DECADE_DISTANCE_COUNT);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
var onInternalSelect = function onInternalSelect2(date2) {
onSelect(date2, "mouse");
onPanelChange("year", date2);
};
return createVNode("div", {
"class": panelPrefixCls
}, [createVNode(DecadeHeader, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": prefixCls,
"onPrevDecades": function onPrevDecades() {
onDecadesChange(-1);
},
"onNextDecades": function onNextDecades() {
onDecadesChange(1);
}
}), null), createVNode(DecadeBody, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": prefixCls,
"onSelect": onInternalSelect
}), null)]);
}
DecadePanel.displayName = "DecadePanel";
DecadePanel.inheritAttrs = false;
var WEEK_DAY_COUNT = 7;
function isNullEqual(value1, value2) {
if (!value1 && !value2) {
return true;
}
if (!value1 || !value2) {
return false;
}
return void 0;
}
function isSameDecade(generateConfig2, decade1, decade2) {
var equal = isNullEqual(decade1, decade2);
if (typeof equal === "boolean") {
return equal;
}
var num1 = Math.floor(generateConfig2.getYear(decade1) / 10);
var num2 = Math.floor(generateConfig2.getYear(decade2) / 10);
return num1 === num2;
}
function isSameYear(generateConfig2, year1, year2) {
var equal = isNullEqual(year1, year2);
if (typeof equal === "boolean") {
return equal;
}
return generateConfig2.getYear(year1) === generateConfig2.getYear(year2);
}
function getQuarter(generateConfig2, date2) {
var quota = Math.floor(generateConfig2.getMonth(date2) / 3);
return quota + 1;
}
function isSameQuarter(generateConfig2, quarter1, quarter2) {
var equal = isNullEqual(quarter1, quarter2);
if (typeof equal === "boolean") {
return equal;
}
return isSameYear(generateConfig2, quarter1, quarter2) && getQuarter(generateConfig2, quarter1) === getQuarter(generateConfig2, quarter2);
}
function isSameMonth(generateConfig2, month1, month2) {
var equal = isNullEqual(month1, month2);
if (typeof equal === "boolean") {
return equal;
}
return isSameYear(generateConfig2, month1, month2) && generateConfig2.getMonth(month1) === generateConfig2.getMonth(month2);
}
function isSameDate(generateConfig2, date1, date2) {
var equal = isNullEqual(date1, date2);
if (typeof equal === "boolean") {
return equal;
}
return generateConfig2.getYear(date1) === generateConfig2.getYear(date2) && generateConfig2.getMonth(date1) === generateConfig2.getMonth(date2) && generateConfig2.getDate(date1) === generateConfig2.getDate(date2);
}
function isSameTime(generateConfig2, time1, time2) {
var equal = isNullEqual(time1, time2);
if (typeof equal === "boolean") {
return equal;
}
return generateConfig2.getHour(time1) === generateConfig2.getHour(time2) && generateConfig2.getMinute(time1) === generateConfig2.getMinute(time2) && generateConfig2.getSecond(time1) === generateConfig2.getSecond(time2);
}
function isSameWeek(generateConfig2, locale3, date1, date2) {
var equal = isNullEqual(date1, date2);
if (typeof equal === "boolean") {
return equal;
}
return generateConfig2.locale.getWeek(locale3, date1) === generateConfig2.locale.getWeek(locale3, date2);
}
function isEqual(generateConfig2, value1, value2) {
return isSameDate(generateConfig2, value1, value2) && isSameTime(generateConfig2, value1, value2);
}
function isInRange(generateConfig2, startDate, endDate, current) {
if (!startDate || !endDate || !current) {
return false;
}
return !isSameDate(generateConfig2, startDate, current) && !isSameDate(generateConfig2, endDate, current) && generateConfig2.isAfter(current, startDate) && generateConfig2.isAfter(endDate, current);
}
function getWeekStartDate(locale3, generateConfig2, value2) {
var weekFirstDay = generateConfig2.locale.getWeekFirstDay(locale3);
var monthStartDate = generateConfig2.setDate(value2, 1);
var startDateWeekDay = generateConfig2.getWeekDay(monthStartDate);
var alignStartDate = generateConfig2.addDate(monthStartDate, weekFirstDay - startDateWeekDay);
if (generateConfig2.getMonth(alignStartDate) === generateConfig2.getMonth(value2) && generateConfig2.getDate(alignStartDate) > 1) {
alignStartDate = generateConfig2.addDate(alignStartDate, -7);
}
return alignStartDate;
}
function getClosingViewDate(viewDate, picker, generateConfig2) {
var offset3 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;
switch (picker) {
case "year":
return generateConfig2.addYear(viewDate, offset3 * 10);
case "quarter":
case "month":
return generateConfig2.addYear(viewDate, offset3);
default:
return generateConfig2.addMonth(viewDate, offset3);
}
}
function formatValue(value2, _ref) {
var generateConfig2 = _ref.generateConfig, locale3 = _ref.locale, format3 = _ref.format;
return typeof format3 === "function" ? format3(value2) : generateConfig2.locale.format(locale3.locale, value2, format3);
}
function parseValue$1(value2, _ref2) {
var generateConfig2 = _ref2.generateConfig, locale3 = _ref2.locale, formatList = _ref2.formatList;
if (!value2 || typeof formatList[0] === "function") {
return null;
}
return generateConfig2.locale.parse(locale3.locale, value2, formatList);
}
function getCellDateDisabled(_ref3) {
var cellDate = _ref3.cellDate, mode = _ref3.mode, disabledDate = _ref3.disabledDate, generateConfig2 = _ref3.generateConfig;
if (!disabledDate)
return false;
var getDisabledFromRange = function getDisabledFromRange2(currentMode, start, end) {
var current = start;
while (current <= end) {
var date2 = void 0;
switch (currentMode) {
case "date": {
date2 = generateConfig2.setDate(cellDate, current);
if (!disabledDate(date2)) {
return false;
}
break;
}
case "month": {
date2 = generateConfig2.setMonth(cellDate, current);
if (!getCellDateDisabled({
cellDate: date2,
mode: "month",
generateConfig: generateConfig2,
disabledDate
})) {
return false;
}
break;
}
case "year": {
date2 = generateConfig2.setYear(cellDate, current);
if (!getCellDateDisabled({
cellDate: date2,
mode: "year",
generateConfig: generateConfig2,
disabledDate
})) {
return false;
}
break;
}
}
current += 1;
}
return true;
};
switch (mode) {
case "date":
case "week": {
return disabledDate(cellDate);
}
case "month": {
var startDate = 1;
var endDate = generateConfig2.getDate(generateConfig2.getEndDate(cellDate));
return getDisabledFromRange("date", startDate, endDate);
}
case "quarter": {
var startMonth = Math.floor(generateConfig2.getMonth(cellDate) / 3) * 3;
var endMonth = startMonth + 2;
return getDisabledFromRange("month", startMonth, endMonth);
}
case "year": {
return getDisabledFromRange("month", 0, 11);
}
case "decade": {
var year = generateConfig2.getYear(cellDate);
var startYear = Math.floor(year / DECADE_UNIT_DIFF) * DECADE_UNIT_DIFF;
var endYear = startYear + DECADE_UNIT_DIFF - 1;
return getDisabledFromRange("year", startYear, endYear);
}
}
}
function TimeHeader(_props) {
var props3 = useMergeProps(_props);
var _useInjectPanel = useInjectPanel(), hideHeader = _useInjectPanel.hideHeader;
if (hideHeader.value) {
return null;
}
var prefixCls = props3.prefixCls, generateConfig2 = props3.generateConfig, locale3 = props3.locale, value2 = props3.value, format3 = props3.format;
var headerPrefixCls = "".concat(prefixCls, "-header");
return createVNode(Header, {
"prefixCls": headerPrefixCls
}, {
default: function _default3() {
return [value2 ? formatValue(value2, {
locale: locale3,
format: format3,
generateConfig: generateConfig2
}) : " "];
}
});
}
TimeHeader.displayName = "TimeHeader";
TimeHeader.inheritAttrs = false;
const TimeUnitColumn = defineComponent({
name: "TimeUnitColumn",
props: ["prefixCls", "units", "onSelect", "value", "active", "hideDisabledOptions"],
setup: function setup49(props3) {
var _useInjectPanel = useInjectPanel(), open2 = _useInjectPanel.open;
var ulRef = ref(null);
var liRefs = ref(/* @__PURE__ */ new Map());
var scrollRef = ref();
watch(function() {
return props3.value;
}, function() {
var li = liRefs.value.get(props3.value);
if (li && open2.value !== false) {
scrollTo(ulRef.value, li.offsetTop, 120);
}
});
onBeforeUnmount(function() {
var _scrollRef$value;
(_scrollRef$value = scrollRef.value) === null || _scrollRef$value === void 0 ? void 0 : _scrollRef$value.call(scrollRef);
});
watch(open2, function() {
var _scrollRef$value2;
(_scrollRef$value2 = scrollRef.value) === null || _scrollRef$value2 === void 0 ? void 0 : _scrollRef$value2.call(scrollRef);
nextTick(function() {
if (open2.value) {
var li = liRefs.value.get(props3.value);
if (li) {
scrollRef.value = waitElementReady(li, function() {
scrollTo(ulRef.value, li.offsetTop, 0);
});
}
}
});
}, {
immediate: true,
flush: "post"
});
return function() {
var prefixCls = props3.prefixCls, units = props3.units, onSelect = props3.onSelect, value2 = props3.value, active = props3.active, hideDisabledOptions = props3.hideDisabledOptions;
var cellPrefixCls = "".concat(prefixCls, "-cell");
return createVNode("ul", {
"class": classNames("".concat(prefixCls, "-column"), _defineProperty$q({}, "".concat(prefixCls, "-column-active"), active)),
"ref": ulRef,
"style": {
position: "relative"
}
}, [units.map(function(unit) {
var _classNames2;
if (hideDisabledOptions && unit.disabled) {
return null;
}
return createVNode("li", {
"key": unit.value,
"ref": function ref2(element) {
liRefs.value.set(unit.value, element);
},
"class": classNames(cellPrefixCls, (_classNames2 = {}, _defineProperty$q(_classNames2, "".concat(cellPrefixCls, "-disabled"), unit.disabled), _defineProperty$q(_classNames2, "".concat(cellPrefixCls, "-selected"), value2 === unit.value), _classNames2)),
"onClick": function onClick2() {
if (unit.disabled) {
return;
}
onSelect(unit.value);
}
}, [createVNode("div", {
"class": "".concat(cellPrefixCls, "-inner")
}, [unit.label])]);
})]);
};
}
});
function leftPad(str, length) {
var fill = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "0";
var current = String(str);
while (current.length < length) {
current = "".concat(fill).concat(str);
}
return current;
}
var tuple2 = function tuple3() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return args;
};
function toArray$1(val) {
if (val === null || val === void 0) {
return [];
}
return Array.isArray(val) ? val : [val];
}
function getDataOrAriaProps(props3) {
var retProps = {};
Object.keys(props3).forEach(function(key2) {
if ((key2.substr(0, 5) === "data-" || key2.substr(0, 5) === "aria-" || key2 === "role" || key2 === "name") && key2.substr(0, 7) !== "data-__") {
retProps[key2] = props3[key2];
}
});
return retProps;
}
function getValue(values, index2) {
return values ? values[index2] : null;
}
function updateValues(values, value2, index2) {
var newValues = [getValue(values, 0), getValue(values, 1)];
newValues[index2] = typeof value2 === "function" ? value2(newValues[index2]) : value2;
if (!newValues[0] && !newValues[1]) {
return null;
}
return newValues;
}
function generateUnits(start, end, step, disabledUnits) {
var units = [];
for (var i2 = start; i2 <= end; i2 += step) {
units.push({
label: leftPad(i2, 2),
value: i2,
disabled: (disabledUnits || []).includes(i2)
});
}
return units;
}
var TimeBody = defineComponent({
compatConfig: {
MODE: 3
},
name: "TimeBody",
inheritAttrs: false,
props: ["generateConfig", "prefixCls", "operationRef", "activeColumnIndex", "value", "showHour", "showMinute", "showSecond", "use12Hours", "hourStep", "minuteStep", "secondStep", "disabledHours", "disabledMinutes", "disabledSeconds", "disabledTime", "hideDisabledOptions", "onSelect"],
setup: function setup50(props3) {
var originHour = computed(function() {
return props3.value ? props3.generateConfig.getHour(props3.value) : -1;
});
var isPM = computed(function() {
if (props3.use12Hours) {
return originHour.value >= 12;
} else {
return false;
}
});
var hour = computed(function() {
if (props3.use12Hours) {
return originHour.value % 12;
} else {
return originHour.value;
}
});
var minute = computed(function() {
return props3.value ? props3.generateConfig.getMinute(props3.value) : -1;
});
var second = computed(function() {
return props3.value ? props3.generateConfig.getSecond(props3.value) : -1;
});
var now2 = ref(props3.generateConfig.getNow());
var mergedDisabledHours = ref();
var mergedDisabledMinutes = ref();
var mergedDisabledSeconds = ref();
onBeforeUpdate(function() {
now2.value = props3.generateConfig.getNow();
});
watchEffect(function() {
if (props3.disabledTime) {
var disabledConfig = props3.disabledTime(now2);
var _ref = [disabledConfig.disabledHours, disabledConfig.disabledMinutes, disabledConfig.disabledSeconds];
mergedDisabledHours.value = _ref[0];
mergedDisabledMinutes.value = _ref[1];
mergedDisabledSeconds.value = _ref[2];
} else {
var _ref2 = [props3.disabledHours, props3.disabledMinutes, props3.disabledSeconds];
mergedDisabledHours.value = _ref2[0];
mergedDisabledMinutes.value = _ref2[1];
mergedDisabledSeconds.value = _ref2[2];
}
});
var setTime$1 = function setTime$12(isNewPM, newHour, newMinute, newSecond) {
var newDate = props3.value || props3.generateConfig.getNow();
var mergedHour = Math.max(0, newHour);
var mergedMinute = Math.max(0, newMinute);
var mergedSecond = Math.max(0, newSecond);
newDate = setTime(props3.generateConfig, newDate, !props3.use12Hours || !isNewPM ? mergedHour : mergedHour + 12, mergedMinute, mergedSecond);
return newDate;
};
var rawHours = computed(function() {
var _props$hourStep;
return generateUnits(0, 23, (_props$hourStep = props3.hourStep) !== null && _props$hourStep !== void 0 ? _props$hourStep : 1, mergedDisabledHours.value && mergedDisabledHours.value());
});
var AMPMDisabled = computed(function() {
if (!props3.use12Hours) {
return [false, false];
}
var AMPMDisabled2 = [true, true];
rawHours.value.forEach(function(_ref3) {
var disabled = _ref3.disabled, hourValue = _ref3.value;
if (disabled)
return;
if (hourValue >= 12) {
AMPMDisabled2[1] = false;
} else {
AMPMDisabled2[0] = false;
}
});
return AMPMDisabled2;
});
var hours = computed(function() {
if (!props3.use12Hours)
return rawHours.value;
return rawHours.value.filter(isPM.value ? function(hourMeta) {
return hourMeta.value >= 12;
} : function(hourMeta) {
return hourMeta.value < 12;
}).map(function(hourMeta) {
var hourValue = hourMeta.value % 12;
var hourLabel = hourValue === 0 ? "12" : leftPad(hourValue, 2);
return _objectSpread2$1(_objectSpread2$1({}, hourMeta), {}, {
label: hourLabel,
value: hourValue
});
});
});
var minutes = computed(function() {
var _props$minuteStep;
return generateUnits(0, 59, (_props$minuteStep = props3.minuteStep) !== null && _props$minuteStep !== void 0 ? _props$minuteStep : 1, mergedDisabledMinutes.value && mergedDisabledMinutes.value(originHour.value));
});
var seconds = computed(function() {
var _props$secondStep;
return generateUnits(0, 59, (_props$secondStep = props3.secondStep) !== null && _props$secondStep !== void 0 ? _props$secondStep : 1, mergedDisabledSeconds.value && mergedDisabledSeconds.value(originHour.value, minute.value));
});
return function() {
var prefixCls = props3.prefixCls, operationRef = props3.operationRef, activeColumnIndex = props3.activeColumnIndex, showHour = props3.showHour, showMinute = props3.showMinute, showSecond = props3.showSecond, use12Hours = props3.use12Hours, hideDisabledOptions = props3.hideDisabledOptions, onSelect = props3.onSelect;
var columns = [];
var contentPrefixCls = "".concat(prefixCls, "-content");
var columnPrefixCls = "".concat(prefixCls, "-time-panel");
operationRef.value = {
onUpDown: function onUpDown(diff2) {
var column = columns[activeColumnIndex];
if (column) {
var valueIndex = column.units.findIndex(function(unit) {
return unit.value === column.value;
});
var unitLen = column.units.length;
for (var i2 = 1; i2 < unitLen; i2 += 1) {
var nextUnit = column.units[(valueIndex + diff2 * i2 + unitLen) % unitLen];
if (nextUnit.disabled !== true) {
column.onSelect(nextUnit.value);
break;
}
}
}
}
};
function addColumnNode(condition, node, columnValue, units, onColumnSelect) {
if (condition !== false) {
columns.push({
node: cloneElement(node, {
prefixCls: columnPrefixCls,
value: columnValue,
active: activeColumnIndex === columns.length,
onSelect: onColumnSelect,
units,
hideDisabledOptions
}),
onSelect: onColumnSelect,
value: columnValue,
units
});
}
}
addColumnNode(showHour, createVNode(TimeUnitColumn, {
"key": "hour"
}, null), hour.value, hours.value, function(num) {
onSelect(setTime$1(isPM.value, num, minute.value, second.value), "mouse");
});
addColumnNode(showMinute, createVNode(TimeUnitColumn, {
"key": "minute"
}, null), minute.value, minutes.value, function(num) {
onSelect(setTime$1(isPM.value, hour.value, num, second.value), "mouse");
});
addColumnNode(showSecond, createVNode(TimeUnitColumn, {
"key": "second"
}, null), second.value, seconds.value, function(num) {
onSelect(setTime$1(isPM.value, hour.value, minute.value, num), "mouse");
});
var PMIndex = -1;
if (typeof isPM.value === "boolean") {
PMIndex = isPM.value ? 1 : 0;
}
addColumnNode(use12Hours === true, createVNode(TimeUnitColumn, {
"key": "12hours"
}, null), PMIndex, [{
label: "AM",
value: 0,
disabled: AMPMDisabled.value[0]
}, {
label: "PM",
value: 1,
disabled: AMPMDisabled.value[1]
}], function(num) {
onSelect(setTime$1(!!num, hour.value, minute.value, second.value), "mouse");
});
return createVNode("div", {
"class": contentPrefixCls
}, [columns.map(function(_ref4) {
var node = _ref4.node;
return node;
})]);
};
}
});
const TimeBody$1 = TimeBody;
var countBoolean = function countBoolean2(boolList) {
return boolList.filter(function(bool) {
return bool !== false;
}).length;
};
function TimePanel(_props) {
var props3 = useMergeProps(_props);
var generateConfig2 = props3.generateConfig, _props$format = props3.format, format3 = _props$format === void 0 ? "HH:mm:ss" : _props$format, prefixCls = props3.prefixCls, active = props3.active, operationRef = props3.operationRef, showHour = props3.showHour, showMinute = props3.showMinute, showSecond = props3.showSecond, _props$use12Hours = props3.use12Hours, use12Hours = _props$use12Hours === void 0 ? false : _props$use12Hours, onSelect = props3.onSelect, value2 = props3.value;
var panelPrefixCls = "".concat(prefixCls, "-time-panel");
var bodyOperationRef = ref();
var activeColumnIndex = ref(-1);
var columnsCount = countBoolean([showHour, showMinute, showSecond, use12Hours]);
operationRef.value = {
onKeydown: function onKeydown(event) {
return createKeydownHandler(event, {
onLeftRight: function onLeftRight(diff2) {
activeColumnIndex.value = (activeColumnIndex.value + diff2 + columnsCount) % columnsCount;
},
onUpDown: function onUpDown(diff2) {
if (activeColumnIndex.value === -1) {
activeColumnIndex.value = 0;
} else if (bodyOperationRef.value) {
bodyOperationRef.value.onUpDown(diff2);
}
},
onEnter: function onEnter() {
onSelect(value2 || generateConfig2.getNow(), "key");
activeColumnIndex.value = -1;
}
});
},
onBlur: function onBlur2() {
activeColumnIndex.value = -1;
}
};
return createVNode("div", {
"class": classNames(panelPrefixCls, _defineProperty$q({}, "".concat(panelPrefixCls, "-active"), active))
}, [createVNode(TimeHeader, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"format": format3,
"prefixCls": prefixCls
}), null), createVNode(TimeBody$1, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": prefixCls,
"activeColumnIndex": activeColumnIndex.value,
"operationRef": bodyOperationRef
}), null)]);
}
TimePanel.displayName = "TimePanel";
TimePanel.inheritAttrs = false;
function useCellClassName(_ref) {
var cellPrefixCls = _ref.cellPrefixCls, generateConfig2 = _ref.generateConfig, rangedValue = _ref.rangedValue, hoverRangedValue = _ref.hoverRangedValue, isInView = _ref.isInView, isSameCell = _ref.isSameCell, offsetCell = _ref.offsetCell, today = _ref.today, value2 = _ref.value;
function getClassName(currentDate) {
var _ref2;
var prevDate = offsetCell(currentDate, -1);
var nextDate = offsetCell(currentDate, 1);
var rangeStart = getValue(rangedValue, 0);
var rangeEnd = getValue(rangedValue, 1);
var hoverStart = getValue(hoverRangedValue, 0);
var hoverEnd = getValue(hoverRangedValue, 1);
var isRangeHovered = isInRange(generateConfig2, hoverStart, hoverEnd, currentDate);
function isRangeStart(date2) {
return isSameCell(rangeStart, date2);
}
function isRangeEnd(date2) {
return isSameCell(rangeEnd, date2);
}
var isHoverStart = isSameCell(hoverStart, currentDate);
var isHoverEnd = isSameCell(hoverEnd, currentDate);
var isHoverEdgeStart = (isRangeHovered || isHoverEnd) && (!isInView(prevDate) || isRangeEnd(prevDate));
var isHoverEdgeEnd = (isRangeHovered || isHoverStart) && (!isInView(nextDate) || isRangeStart(nextDate));
return _ref2 = {}, _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-in-view"), isInView(currentDate)), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-in-range"), isInRange(generateConfig2, rangeStart, rangeEnd, currentDate)), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-start"), isRangeStart(currentDate)), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-end"), isRangeEnd(currentDate)), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-start-single"), isRangeStart(currentDate) && !rangeEnd), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-end-single"), isRangeEnd(currentDate) && !rangeStart), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-start-near-hover"), isRangeStart(currentDate) && (isSameCell(prevDate, hoverStart) || isInRange(generateConfig2, hoverStart, hoverEnd, prevDate))), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-end-near-hover"), isRangeEnd(currentDate) && (isSameCell(nextDate, hoverEnd) || isInRange(generateConfig2, hoverStart, hoverEnd, nextDate))), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-hover"), isRangeHovered), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-hover-start"), isHoverStart), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-hover-end"), isHoverEnd), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-hover-edge-start"), isHoverEdgeStart), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-hover-edge-end"), isHoverEdgeEnd), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-hover-edge-start-near-range"), isHoverEdgeStart && isSameCell(prevDate, rangeEnd)), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-range-hover-edge-end-near-range"), isHoverEdgeEnd && isSameCell(nextDate, rangeStart)), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-today"), isSameCell(today, currentDate)), _defineProperty$q(_ref2, "".concat(cellPrefixCls, "-selected"), isSameCell(value2, currentDate)), _ref2;
}
return getClassName;
}
var RangeContextKey = Symbol("RangeContextProps");
var useProvideRange = function useProvideRange2(props3) {
provide(RangeContextKey, props3);
};
var useInjectRange = function useInjectRange2() {
return inject(RangeContextKey, {
rangedValue: ref(),
hoverRangedValue: ref(),
inRange: ref(),
panelPosition: ref()
});
};
var RangeContextProvider = defineComponent({
compatConfig: {
MODE: 3
},
name: "PanelContextProvider",
inheritAttrs: false,
props: {
value: {
type: Object,
default: function _default2() {
return {};
}
}
},
setup: function setup51(props3, _ref) {
var slots = _ref.slots;
var value2 = {
rangedValue: ref(props3.value.rangedValue),
hoverRangedValue: ref(props3.value.hoverRangedValue),
inRange: ref(props3.value.inRange),
panelPosition: ref(props3.value.panelPosition)
};
useProvideRange(value2);
watch(function() {
return props3.value;
}, function() {
Object.keys(props3.value).forEach(function(key2) {
if (value2[key2]) {
value2[key2].value = props3.value[key2];
}
});
});
return function() {
var _slots$default;
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
};
}
});
function DateBody(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, generateConfig2 = props3.generateConfig, prefixColumn = props3.prefixColumn, locale3 = props3.locale, rowCount = props3.rowCount, viewDate = props3.viewDate, value2 = props3.value, dateRender = props3.dateRender;
var _useInjectRange = useInjectRange(), rangedValue = _useInjectRange.rangedValue, hoverRangedValue = _useInjectRange.hoverRangedValue;
var baseDate = getWeekStartDate(locale3.locale, generateConfig2, viewDate);
var cellPrefixCls = "".concat(prefixCls, "-cell");
var weekFirstDay = generateConfig2.locale.getWeekFirstDay(locale3.locale);
var today = generateConfig2.getNow();
var headerCells = [];
var weekDaysLocale = locale3.shortWeekDays || (generateConfig2.locale.getShortWeekDays ? generateConfig2.locale.getShortWeekDays(locale3.locale) : []);
if (prefixColumn) {
headerCells.push(createVNode("th", {
"key": "empty",
"aria-label": "empty cell"
}, null));
}
for (var i2 = 0; i2 < WEEK_DAY_COUNT; i2 += 1) {
headerCells.push(createVNode("th", {
"key": i2
}, [weekDaysLocale[(i2 + weekFirstDay) % WEEK_DAY_COUNT]]));
}
var getCellClassName = useCellClassName({
cellPrefixCls,
today,
value: value2,
generateConfig: generateConfig2,
rangedValue: prefixColumn ? null : rangedValue.value,
hoverRangedValue: prefixColumn ? null : hoverRangedValue.value,
isSameCell: function isSameCell(current, target) {
return isSameDate(generateConfig2, current, target);
},
isInView: function isInView(date2) {
return isSameMonth(generateConfig2, date2, viewDate);
},
offsetCell: function offsetCell(date2, offset3) {
return generateConfig2.addDate(date2, offset3);
}
});
var getCellNode = dateRender ? function(date2) {
return dateRender({
current: date2,
today
});
} : void 0;
return createVNode(PanelBody, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"rowNum": rowCount,
"colNum": WEEK_DAY_COUNT,
"baseDate": baseDate,
"getCellNode": getCellNode,
"getCellText": generateConfig2.getDate,
"getCellClassName": getCellClassName,
"getCellDate": generateConfig2.addDate,
"titleCell": function titleCell(date2) {
return formatValue(date2, {
locale: locale3,
format: "YYYY-MM-DD",
generateConfig: generateConfig2
});
},
"headerCells": headerCells
}), null);
}
DateBody.displayName = "DateBody";
DateBody.inheritAttrs = false;
DateBody.props = [
"prefixCls",
"generateConfig",
"value?",
"viewDate",
"locale",
"rowCount",
"onSelect",
"dateRender?",
"disabledDate?",
// Used for week panel
"prefixColumn?",
"rowClassName?"
];
function DateHeader(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, generateConfig2 = props3.generateConfig, locale3 = props3.locale, viewDate = props3.viewDate, onNextMonth = props3.onNextMonth, onPrevMonth = props3.onPrevMonth, onNextYear = props3.onNextYear, onPrevYear = props3.onPrevYear, onYearClick = props3.onYearClick, onMonthClick = props3.onMonthClick;
var _useInjectPanel = useInjectPanel(), hideHeader = _useInjectPanel.hideHeader;
if (hideHeader.value) {
return null;
}
var headerPrefixCls = "".concat(prefixCls, "-header");
var monthsLocale = locale3.shortMonths || (generateConfig2.locale.getShortMonths ? generateConfig2.locale.getShortMonths(locale3.locale) : []);
var month = generateConfig2.getMonth(viewDate);
var yearNode = createVNode("button", {
"type": "button",
"key": "year",
"onClick": onYearClick,
"tabindex": -1,
"class": "".concat(prefixCls, "-year-btn")
}, [formatValue(viewDate, {
locale: locale3,
format: locale3.yearFormat,
generateConfig: generateConfig2
})]);
var monthNode = createVNode("button", {
"type": "button",
"key": "month",
"onClick": onMonthClick,
"tabindex": -1,
"class": "".concat(prefixCls, "-month-btn")
}, [locale3.monthFormat ? formatValue(viewDate, {
locale: locale3,
format: locale3.monthFormat,
generateConfig: generateConfig2
}) : monthsLocale[month]]);
var monthYearNodes = locale3.monthBeforeYear ? [monthNode, yearNode] : [yearNode, monthNode];
return createVNode(Header, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": headerPrefixCls,
"onSuperPrev": onPrevYear,
"onPrev": onPrevMonth,
"onNext": onNextMonth,
"onSuperNext": onNextYear
}), {
default: function _default3() {
return [monthYearNodes];
}
});
}
DateHeader.displayName = "DateHeader";
DateHeader.inheritAttrs = false;
var DATE_ROW_COUNT = 6;
function DatePanel(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, _props$panelName = props3.panelName, panelName = _props$panelName === void 0 ? "date" : _props$panelName, keyboardConfig = props3.keyboardConfig, active = props3.active, operationRef = props3.operationRef, generateConfig2 = props3.generateConfig, value2 = props3.value, viewDate = props3.viewDate, onViewDateChange = props3.onViewDateChange, onPanelChange = props3.onPanelChange, _onSelect = props3.onSelect;
var panelPrefixCls = "".concat(prefixCls, "-").concat(panelName, "-panel");
operationRef.value = {
onKeydown: function onKeydown(event) {
return createKeydownHandler(event, _objectSpread2$1({
onLeftRight: function onLeftRight(diff2) {
_onSelect(generateConfig2.addDate(value2 || viewDate, diff2), "key");
},
onCtrlLeftRight: function onCtrlLeftRight(diff2) {
_onSelect(generateConfig2.addYear(value2 || viewDate, diff2), "key");
},
onUpDown: function onUpDown(diff2) {
_onSelect(generateConfig2.addDate(value2 || viewDate, diff2 * WEEK_DAY_COUNT), "key");
},
onPageUpDown: function onPageUpDown(diff2) {
_onSelect(generateConfig2.addMonth(value2 || viewDate, diff2), "key");
}
}, keyboardConfig));
}
};
var onYearChange = function onYearChange2(diff2) {
var newDate = generateConfig2.addYear(viewDate, diff2);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
var onMonthChange = function onMonthChange2(diff2) {
var newDate = generateConfig2.addMonth(viewDate, diff2);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
return createVNode("div", {
"class": classNames(panelPrefixCls, _defineProperty$q({}, "".concat(panelPrefixCls, "-active"), active))
}, [createVNode(DateHeader, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": prefixCls,
"value": value2,
"viewDate": viewDate,
"onPrevYear": function onPrevYear() {
onYearChange(-1);
},
"onNextYear": function onNextYear() {
onYearChange(1);
},
"onPrevMonth": function onPrevMonth() {
onMonthChange(-1);
},
"onNextMonth": function onNextMonth() {
onMonthChange(1);
},
"onMonthClick": function onMonthClick() {
onPanelChange("month", viewDate);
},
"onYearClick": function onYearClick() {
onPanelChange("year", viewDate);
}
}), null), createVNode(DateBody, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"onSelect": function onSelect(date2) {
return _onSelect(date2, "mouse");
},
"prefixCls": prefixCls,
"value": value2,
"viewDate": viewDate,
"rowCount": DATE_ROW_COUNT
}), null)]);
}
DatePanel.displayName = "DatePanel";
DatePanel.inheritAttrs = false;
var ACTIVE_PANEL = tuple2("date", "time");
function DatetimePanel(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, operationRef = props3.operationRef, generateConfig2 = props3.generateConfig, value2 = props3.value, defaultValue = props3.defaultValue, disabledTime = props3.disabledTime, showTime = props3.showTime, onSelect = props3.onSelect;
var panelPrefixCls = "".concat(prefixCls, "-datetime-panel");
var activePanel = ref(null);
var dateOperationRef = ref({});
var timeOperationRef = ref({});
var timeProps = _typeof$2(showTime) === "object" ? _objectSpread2$1({}, showTime) : {};
function getNextActive(offset3) {
var activeIndex = ACTIVE_PANEL.indexOf(activePanel.value) + offset3;
var nextActivePanel = ACTIVE_PANEL[activeIndex] || null;
return nextActivePanel;
}
var onBlur2 = function onBlur3(e2) {
if (timeOperationRef.value.onBlur) {
timeOperationRef.value.onBlur(e2);
}
activePanel.value = null;
};
operationRef.value = {
onKeydown: function onKeydown(event) {
if (event.which === KeyCode$1.TAB) {
var nextActivePanel = getNextActive(event.shiftKey ? -1 : 1);
activePanel.value = nextActivePanel;
if (nextActivePanel) {
event.preventDefault();
}
return true;
}
if (activePanel.value) {
var _ref = activePanel.value === "date" ? dateOperationRef : timeOperationRef;
if (_ref.value && _ref.value.onKeydown) {
_ref.value.onKeydown(event);
}
return true;
}
if ([KeyCode$1.LEFT, KeyCode$1.RIGHT, KeyCode$1.UP, KeyCode$1.DOWN].includes(event.which)) {
activePanel.value = "date";
return true;
}
return false;
},
onBlur: onBlur2,
onClose: onBlur2
};
var onInternalSelect = function onInternalSelect2(date2, source) {
var selectedDate = date2;
if (source === "date" && !value2 && timeProps.defaultValue) {
selectedDate = generateConfig2.setHour(selectedDate, generateConfig2.getHour(timeProps.defaultValue));
selectedDate = generateConfig2.setMinute(selectedDate, generateConfig2.getMinute(timeProps.defaultValue));
selectedDate = generateConfig2.setSecond(selectedDate, generateConfig2.getSecond(timeProps.defaultValue));
} else if (source === "time" && !value2 && defaultValue) {
selectedDate = generateConfig2.setYear(selectedDate, generateConfig2.getYear(defaultValue));
selectedDate = generateConfig2.setMonth(selectedDate, generateConfig2.getMonth(defaultValue));
selectedDate = generateConfig2.setDate(selectedDate, generateConfig2.getDate(defaultValue));
}
if (onSelect) {
onSelect(selectedDate, "mouse");
}
};
var disabledTimes = disabledTime ? disabledTime(value2 || null) : {};
return createVNode("div", {
"class": classNames(panelPrefixCls, _defineProperty$q({}, "".concat(panelPrefixCls, "-active"), activePanel.value))
}, [createVNode(DatePanel, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"operationRef": dateOperationRef,
"active": activePanel.value === "date",
"onSelect": function onSelect2(date2) {
onInternalSelect(setDateTime(generateConfig2, date2, !value2 && _typeof$2(showTime) === "object" ? showTime.defaultValue : null), "date");
}
}), null), createVNode(TimePanel, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"format": void 0
}, timeProps), disabledTimes), {}, {
"disabledTime": null,
"defaultValue": void 0,
"operationRef": timeOperationRef,
"active": activePanel.value === "time",
"onSelect": function onSelect2(date2) {
onInternalSelect(date2, "time");
}
}), null)]);
}
DatetimePanel.displayName = "DatetimePanel";
DatetimePanel.inheritAttrs = false;
function WeekPanel(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, generateConfig2 = props3.generateConfig, locale3 = props3.locale, value2 = props3.value;
var cellPrefixCls = "".concat(prefixCls, "-cell");
var prefixColumn = function prefixColumn2(date2) {
return createVNode("td", {
"key": "week",
"class": classNames(cellPrefixCls, "".concat(cellPrefixCls, "-week"))
}, [generateConfig2.locale.getWeek(locale3.locale, date2)]);
};
var rowPrefixCls = "".concat(prefixCls, "-week-panel-row");
var rowClassName = function rowClassName2(date2) {
return classNames(rowPrefixCls, _defineProperty$q({}, "".concat(rowPrefixCls, "-selected"), isSameWeek(generateConfig2, locale3.locale, value2, date2)));
};
return createVNode(DatePanel, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"panelName": "week",
"prefixColumn": prefixColumn,
"rowClassName": rowClassName,
"keyboardConfig": {
onLeftRight: null
}
}), null);
}
WeekPanel.displayName = "WeekPanel";
WeekPanel.inheritAttrs = false;
function MonthHeader(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, generateConfig2 = props3.generateConfig, locale3 = props3.locale, viewDate = props3.viewDate, onNextYear = props3.onNextYear, onPrevYear = props3.onPrevYear, onYearClick = props3.onYearClick;
var _useInjectPanel = useInjectPanel(), hideHeader = _useInjectPanel.hideHeader;
if (hideHeader.value) {
return null;
}
var headerPrefixCls = "".concat(prefixCls, "-header");
return createVNode(Header, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": headerPrefixCls,
"onSuperPrev": onPrevYear,
"onSuperNext": onNextYear
}), {
default: function _default3() {
return [createVNode("button", {
"type": "button",
"onClick": onYearClick,
"class": "".concat(prefixCls, "-year-btn")
}, [formatValue(viewDate, {
locale: locale3,
format: locale3.yearFormat,
generateConfig: generateConfig2
})])];
}
});
}
MonthHeader.displayName = "MonthHeader";
MonthHeader.inheritAttrs = false;
var MONTH_COL_COUNT = 3;
var MONTH_ROW_COUNT = 4;
function MonthBody(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, locale3 = props3.locale, value2 = props3.value, viewDate = props3.viewDate, generateConfig2 = props3.generateConfig, monthCellRender = props3.monthCellRender;
var _useInjectRange = useInjectRange(), rangedValue = _useInjectRange.rangedValue, hoverRangedValue = _useInjectRange.hoverRangedValue;
var cellPrefixCls = "".concat(prefixCls, "-cell");
var getCellClassName = useCellClassName({
cellPrefixCls,
value: value2,
generateConfig: generateConfig2,
rangedValue: rangedValue.value,
hoverRangedValue: hoverRangedValue.value,
isSameCell: function isSameCell(current, target) {
return isSameMonth(generateConfig2, current, target);
},
isInView: function isInView() {
return true;
},
offsetCell: function offsetCell(date2, offset3) {
return generateConfig2.addMonth(date2, offset3);
}
});
var monthsLocale = locale3.shortMonths || (generateConfig2.locale.getShortMonths ? generateConfig2.locale.getShortMonths(locale3.locale) : []);
var baseMonth = generateConfig2.setMonth(viewDate, 0);
var getCellNode = monthCellRender ? function(date2) {
return monthCellRender({
current: date2,
locale: locale3
});
} : void 0;
return createVNode(PanelBody, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"rowNum": MONTH_ROW_COUNT,
"colNum": MONTH_COL_COUNT,
"baseDate": baseMonth,
"getCellNode": getCellNode,
"getCellText": function getCellText(date2) {
return locale3.monthFormat ? formatValue(date2, {
locale: locale3,
format: locale3.monthFormat,
generateConfig: generateConfig2
}) : monthsLocale[generateConfig2.getMonth(date2)];
},
"getCellClassName": getCellClassName,
"getCellDate": generateConfig2.addMonth,
"titleCell": function titleCell(date2) {
return formatValue(date2, {
locale: locale3,
format: "YYYY-MM",
generateConfig: generateConfig2
});
}
}), null);
}
MonthBody.displayName = "MonthBody";
MonthBody.inheritAttrs = false;
function MonthPanel(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, operationRef = props3.operationRef, onViewDateChange = props3.onViewDateChange, generateConfig2 = props3.generateConfig, value2 = props3.value, viewDate = props3.viewDate, onPanelChange = props3.onPanelChange, _onSelect = props3.onSelect;
var panelPrefixCls = "".concat(prefixCls, "-month-panel");
operationRef.value = {
onKeydown: function onKeydown(event) {
return createKeydownHandler(event, {
onLeftRight: function onLeftRight(diff2) {
_onSelect(generateConfig2.addMonth(value2 || viewDate, diff2), "key");
},
onCtrlLeftRight: function onCtrlLeftRight(diff2) {
_onSelect(generateConfig2.addYear(value2 || viewDate, diff2), "key");
},
onUpDown: function onUpDown(diff2) {
_onSelect(generateConfig2.addMonth(value2 || viewDate, diff2 * MONTH_COL_COUNT), "key");
},
onEnter: function onEnter() {
onPanelChange("date", value2 || viewDate);
}
});
}
};
var onYearChange = function onYearChange2(diff2) {
var newDate = generateConfig2.addYear(viewDate, diff2);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
return createVNode("div", {
"class": panelPrefixCls
}, [createVNode(MonthHeader, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": prefixCls,
"onPrevYear": function onPrevYear() {
onYearChange(-1);
},
"onNextYear": function onNextYear() {
onYearChange(1);
},
"onYearClick": function onYearClick() {
onPanelChange("year", viewDate);
}
}), null), createVNode(MonthBody, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": prefixCls,
"onSelect": function onSelect(date2) {
_onSelect(date2, "mouse");
onPanelChange("date", date2);
}
}), null)]);
}
MonthPanel.displayName = "MonthPanel";
MonthPanel.inheritAttrs = false;
function QuarterHeader(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, generateConfig2 = props3.generateConfig, locale3 = props3.locale, viewDate = props3.viewDate, onNextYear = props3.onNextYear, onPrevYear = props3.onPrevYear, onYearClick = props3.onYearClick;
var _useInjectPanel = useInjectPanel(), hideHeader = _useInjectPanel.hideHeader;
if (hideHeader.value) {
return null;
}
var headerPrefixCls = "".concat(prefixCls, "-header");
return createVNode(Header, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": headerPrefixCls,
"onSuperPrev": onPrevYear,
"onSuperNext": onNextYear
}), {
default: function _default3() {
return [createVNode("button", {
"type": "button",
"onClick": onYearClick,
"class": "".concat(prefixCls, "-year-btn")
}, [formatValue(viewDate, {
locale: locale3,
format: locale3.yearFormat,
generateConfig: generateConfig2
})])];
}
});
}
QuarterHeader.displayName = "QuarterHeader";
QuarterHeader.inheritAttrs = false;
var QUARTER_COL_COUNT = 4;
var QUARTER_ROW_COUNT = 1;
function QuarterBody(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, locale3 = props3.locale, value2 = props3.value, viewDate = props3.viewDate, generateConfig2 = props3.generateConfig;
var _useInjectRange = useInjectRange(), rangedValue = _useInjectRange.rangedValue, hoverRangedValue = _useInjectRange.hoverRangedValue;
var cellPrefixCls = "".concat(prefixCls, "-cell");
var getCellClassName = useCellClassName({
cellPrefixCls,
value: value2,
generateConfig: generateConfig2,
rangedValue: rangedValue.value,
hoverRangedValue: hoverRangedValue.value,
isSameCell: function isSameCell(current, target) {
return isSameQuarter(generateConfig2, current, target);
},
isInView: function isInView() {
return true;
},
offsetCell: function offsetCell(date2, offset3) {
return generateConfig2.addMonth(date2, offset3 * 3);
}
});
var baseQuarter = generateConfig2.setDate(generateConfig2.setMonth(viewDate, 0), 1);
return createVNode(PanelBody, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"rowNum": QUARTER_ROW_COUNT,
"colNum": QUARTER_COL_COUNT,
"baseDate": baseQuarter,
"getCellText": function getCellText(date2) {
return formatValue(date2, {
locale: locale3,
format: locale3.quarterFormat || "[Q]Q",
generateConfig: generateConfig2
});
},
"getCellClassName": getCellClassName,
"getCellDate": function getCellDate(date2, offset3) {
return generateConfig2.addMonth(date2, offset3 * 3);
},
"titleCell": function titleCell(date2) {
return formatValue(date2, {
locale: locale3,
format: "YYYY-[Q]Q",
generateConfig: generateConfig2
});
}
}), null);
}
QuarterBody.displayName = "QuarterBody";
QuarterBody.inheritAttrs = false;
function QuarterPanel(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, operationRef = props3.operationRef, onViewDateChange = props3.onViewDateChange, generateConfig2 = props3.generateConfig, value2 = props3.value, viewDate = props3.viewDate, onPanelChange = props3.onPanelChange, _onSelect = props3.onSelect;
var panelPrefixCls = "".concat(prefixCls, "-quarter-panel");
operationRef.value = {
onKeydown: function onKeydown(event) {
return createKeydownHandler(event, {
onLeftRight: function onLeftRight(diff2) {
_onSelect(generateConfig2.addMonth(value2 || viewDate, diff2 * 3), "key");
},
onCtrlLeftRight: function onCtrlLeftRight(diff2) {
_onSelect(generateConfig2.addYear(value2 || viewDate, diff2), "key");
},
onUpDown: function onUpDown(diff2) {
_onSelect(generateConfig2.addYear(value2 || viewDate, diff2), "key");
}
});
}
};
var onYearChange = function onYearChange2(diff2) {
var newDate = generateConfig2.addYear(viewDate, diff2);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
return createVNode("div", {
"class": panelPrefixCls
}, [createVNode(QuarterHeader, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": prefixCls,
"onPrevYear": function onPrevYear() {
onYearChange(-1);
},
"onNextYear": function onNextYear() {
onYearChange(1);
},
"onYearClick": function onYearClick() {
onPanelChange("year", viewDate);
}
}), null), createVNode(QuarterBody, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": prefixCls,
"onSelect": function onSelect(date2) {
_onSelect(date2, "mouse");
}
}), null)]);
}
QuarterPanel.displayName = "QuarterPanel";
QuarterPanel.inheritAttrs = false;
function YearHeader(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, generateConfig2 = props3.generateConfig, viewDate = props3.viewDate, onPrevDecade = props3.onPrevDecade, onNextDecade = props3.onNextDecade, onDecadeClick = props3.onDecadeClick;
var _useInjectPanel = useInjectPanel(), hideHeader = _useInjectPanel.hideHeader;
if (hideHeader.value) {
return null;
}
var headerPrefixCls = "".concat(prefixCls, "-header");
var yearNumber = generateConfig2.getYear(viewDate);
var startYear = Math.floor(yearNumber / YEAR_DECADE_COUNT) * YEAR_DECADE_COUNT;
var endYear = startYear + YEAR_DECADE_COUNT - 1;
return createVNode(Header, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": headerPrefixCls,
"onSuperPrev": onPrevDecade,
"onSuperNext": onNextDecade
}), {
default: function _default3() {
return [createVNode("button", {
"type": "button",
"onClick": onDecadeClick,
"class": "".concat(prefixCls, "-decade-btn")
}, [startYear, createTextVNode("-"), endYear])];
}
});
}
YearHeader.displayName = "YearHeader";
YearHeader.inheritAttrs = false;
var YEAR_COL_COUNT = 3;
var YEAR_ROW_COUNT = 4;
function YearBody(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, value2 = props3.value, viewDate = props3.viewDate, locale3 = props3.locale, generateConfig2 = props3.generateConfig;
var _useInjectRange = useInjectRange(), rangedValue = _useInjectRange.rangedValue, hoverRangedValue = _useInjectRange.hoverRangedValue;
var yearPrefixCls = "".concat(prefixCls, "-cell");
var yearNumber = generateConfig2.getYear(viewDate);
var startYear = Math.floor(yearNumber / YEAR_DECADE_COUNT) * YEAR_DECADE_COUNT;
var endYear = startYear + YEAR_DECADE_COUNT - 1;
var baseYear = generateConfig2.setYear(viewDate, startYear - Math.ceil((YEAR_COL_COUNT * YEAR_ROW_COUNT - YEAR_DECADE_COUNT) / 2));
var isInView = function isInView2(date2) {
var currentYearNumber = generateConfig2.getYear(date2);
return startYear <= currentYearNumber && currentYearNumber <= endYear;
};
var getCellClassName = useCellClassName({
cellPrefixCls: yearPrefixCls,
value: value2,
generateConfig: generateConfig2,
rangedValue: rangedValue.value,
hoverRangedValue: hoverRangedValue.value,
isSameCell: function isSameCell(current, target) {
return isSameYear(generateConfig2, current, target);
},
isInView,
offsetCell: function offsetCell(date2, offset3) {
return generateConfig2.addYear(date2, offset3);
}
});
return createVNode(PanelBody, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"rowNum": YEAR_ROW_COUNT,
"colNum": YEAR_COL_COUNT,
"baseDate": baseYear,
"getCellText": generateConfig2.getYear,
"getCellClassName": getCellClassName,
"getCellDate": generateConfig2.addYear,
"titleCell": function titleCell(date2) {
return formatValue(date2, {
locale: locale3,
format: "YYYY",
generateConfig: generateConfig2
});
}
}), null);
}
YearBody.displayName = "YearBody";
YearBody.inheritAttrs = false;
var YEAR_DECADE_COUNT = 10;
function YearPanel(_props) {
var props3 = useMergeProps(_props);
var prefixCls = props3.prefixCls, operationRef = props3.operationRef, onViewDateChange = props3.onViewDateChange, generateConfig2 = props3.generateConfig, value2 = props3.value, viewDate = props3.viewDate, sourceMode = props3.sourceMode, _onSelect = props3.onSelect, onPanelChange = props3.onPanelChange;
var panelPrefixCls = "".concat(prefixCls, "-year-panel");
operationRef.value = {
onKeydown: function onKeydown(event) {
return createKeydownHandler(event, {
onLeftRight: function onLeftRight(diff2) {
_onSelect(generateConfig2.addYear(value2 || viewDate, diff2), "key");
},
onCtrlLeftRight: function onCtrlLeftRight(diff2) {
_onSelect(generateConfig2.addYear(value2 || viewDate, diff2 * YEAR_DECADE_COUNT), "key");
},
onUpDown: function onUpDown(diff2) {
_onSelect(generateConfig2.addYear(value2 || viewDate, diff2 * YEAR_COL_COUNT), "key");
},
onEnter: function onEnter() {
onPanelChange(sourceMode === "date" ? "date" : "month", value2 || viewDate);
}
});
}
};
var onDecadeChange = function onDecadeChange2(diff2) {
var newDate = generateConfig2.addYear(viewDate, diff2 * 10);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
return createVNode("div", {
"class": panelPrefixCls
}, [createVNode(YearHeader, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": prefixCls,
"onPrevDecade": function onPrevDecade() {
onDecadeChange(-1);
},
"onNextDecade": function onNextDecade() {
onDecadeChange(1);
},
"onDecadeClick": function onDecadeClick() {
onPanelChange("decade", viewDate);
}
}), null), createVNode(YearBody, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"prefixCls": prefixCls,
"onSelect": function onSelect(date2) {
onPanelChange(sourceMode === "date" ? "date" : "month", date2);
_onSelect(date2, "mouse");
}
}), null)]);
}
YearPanel.displayName = "YearPanel";
YearPanel.inheritAttrs = false;
function getExtraFooter(prefixCls, mode, renderExtraFooter) {
if (!renderExtraFooter) {
return null;
}
return createVNode("div", {
"class": "".concat(prefixCls, "-footer-extra")
}, [renderExtraFooter(mode)]);
}
function getRanges(_ref) {
var prefixCls = _ref.prefixCls, _ref$rangeList = _ref.rangeList, rangeList = _ref$rangeList === void 0 ? [] : _ref$rangeList, _ref$components = _ref.components, components2 = _ref$components === void 0 ? {} : _ref$components, needConfirmButton = _ref.needConfirmButton, onNow = _ref.onNow, onOk = _ref.onOk, okDisabled = _ref.okDisabled, showNow = _ref.showNow, locale3 = _ref.locale;
var presetNode;
var okNode;
if (rangeList.length) {
var Item3 = components2.rangeItem || "span";
presetNode = createVNode(Fragment, null, [rangeList.map(function(_ref2) {
var label = _ref2.label, onClick2 = _ref2.onClick, onMouseenter2 = _ref2.onMouseenter, onMouseleave2 = _ref2.onMouseleave;
return createVNode("li", {
"key": label,
"class": "".concat(prefixCls, "-preset")
}, [createVNode(Item3, {
"onClick": onClick2,
"onMouseenter": onMouseenter2,
"onMouseleave": onMouseleave2
}, {
default: function _default3() {
return [label];
}
})]);
})]);
}
if (needConfirmButton) {
var Button2 = components2.button || "button";
if (onNow && !presetNode && showNow !== false) {
presetNode = createVNode("li", {
"class": "".concat(prefixCls, "-now")
}, [createVNode("a", {
"class": "".concat(prefixCls, "-now-btn"),
"onClick": onNow
}, [locale3.now])]);
}
okNode = needConfirmButton && createVNode("li", {
"class": "".concat(prefixCls, "-ok")
}, [createVNode(Button2, {
"disabled": okDisabled,
"onClick": onOk
}, {
default: function _default3() {
return [locale3.ok];
}
})]);
}
if (!presetNode && !okNode) {
return null;
}
return createVNode("ul", {
"class": "".concat(prefixCls, "-ranges")
}, [presetNode, okNode]);
}
function PickerPanel() {
return defineComponent({
name: "PickerPanel",
inheritAttrs: false,
props: {
prefixCls: String,
locale: Object,
generateConfig: Object,
value: Object,
defaultValue: Object,
pickerValue: Object,
defaultPickerValue: Object,
disabledDate: Function,
mode: String,
picker: {
type: String,
default: "date"
},
tabindex: {
type: [Number, String],
default: 0
},
showNow: {
type: Boolean,
default: void 0
},
showTime: [Boolean, Object],
showToday: Boolean,
renderExtraFooter: Function,
dateRender: Function,
hideHeader: {
type: Boolean,
default: void 0
},
onSelect: Function,
onChange: Function,
onPanelChange: Function,
onMousedown: Function,
onPickerValueChange: Function,
onOk: Function,
components: Object,
direction: String,
hourStep: {
type: Number,
default: 1
},
minuteStep: {
type: Number,
default: 1
},
secondStep: {
type: Number,
default: 1
}
},
setup: function setup99(props3, _ref) {
var attrs = _ref.attrs;
var needConfirmButton = computed(function() {
return props3.picker === "date" && !!props3.showTime || props3.picker === "time";
});
var isHourStepValid = computed(function() {
return 24 % props3.hourStep === 0;
});
var isMinuteStepValid = computed(function() {
return 60 % props3.minuteStep === 0;
});
var isSecondStepValid = computed(function() {
return 60 % props3.secondStep === 0;
});
if (process.env.NODE_ENV !== "production") {
watchEffect(function() {
var generateConfig2 = props3.generateConfig, value2 = props3.value, _props$hourStep = props3.hourStep, hourStep = _props$hourStep === void 0 ? 1 : _props$hourStep, _props$minuteStep = props3.minuteStep, minuteStep = _props$minuteStep === void 0 ? 1 : _props$minuteStep, _props$secondStep = props3.secondStep, secondStep = _props$secondStep === void 0 ? 1 : _props$secondStep;
warning$2(!value2 || generateConfig2.isValidate(value2), "Invalidate date pass to `value`.");
warning$2(!value2 || generateConfig2.isValidate(value2), "Invalidate date pass to `defaultValue`.");
warning$2(isHourStepValid.value, "`hourStep` ".concat(hourStep, " is invalid. It should be a factor of 24."));
warning$2(isMinuteStepValid.value, "`minuteStep` ".concat(minuteStep, " is invalid. It should be a factor of 60."));
warning$2(isSecondStepValid.value, "`secondStep` ".concat(secondStep, " is invalid. It should be a factor of 60."));
});
}
var panelContext = useInjectPanel();
var operationRef = panelContext.operationRef, panelDivRef = panelContext.panelRef, onContextSelect = panelContext.onSelect, hideRanges = panelContext.hideRanges, defaultOpenValue = panelContext.defaultOpenValue;
var _useInjectRange = useInjectRange(), inRange = _useInjectRange.inRange, panelPosition = _useInjectRange.panelPosition, rangedValue = _useInjectRange.rangedValue, hoverRangedValue = _useInjectRange.hoverRangedValue;
var panelRef = ref({});
var _useMergedState = useMergedState(null, {
value: toRef(props3, "value"),
defaultValue: props3.defaultValue,
postState: function postState(val) {
if (!val && defaultOpenValue !== null && defaultOpenValue !== void 0 && defaultOpenValue.value && props3.picker === "time") {
return defaultOpenValue.value;
}
return val;
}
}), _useMergedState2 = _slicedToArray$2(_useMergedState, 2), mergedValue = _useMergedState2[0], setInnerValue = _useMergedState2[1];
var _useMergedState3 = useMergedState(null, {
value: toRef(props3, "pickerValue"),
defaultValue: props3.defaultPickerValue || mergedValue.value,
postState: function postState(date2) {
var generateConfig2 = props3.generateConfig, showTime = props3.showTime, defaultValue = props3.defaultValue;
var now2 = generateConfig2.getNow();
if (!date2)
return now2;
if (!mergedValue.value && props3.showTime) {
if (_typeof$2(showTime) === "object") {
return setDateTime(generateConfig2, Array.isArray(date2) ? date2[0] : date2, showTime.defaultValue || now2);
}
if (defaultValue) {
return setDateTime(generateConfig2, Array.isArray(date2) ? date2[0] : date2, defaultValue);
}
return setDateTime(generateConfig2, Array.isArray(date2) ? date2[0] : date2, now2);
}
return date2;
}
}), _useMergedState4 = _slicedToArray$2(_useMergedState3, 2), viewDate = _useMergedState4[0], setInnerViewDate = _useMergedState4[1];
var setViewDate = function setViewDate2(date2) {
setInnerViewDate(date2);
if (props3.onPickerValueChange) {
props3.onPickerValueChange(date2);
}
};
var getInternalNextMode = function getInternalNextMode2(nextMode) {
var getNextMode = PickerModeMap[props3.picker];
if (getNextMode) {
return getNextMode(nextMode);
}
return nextMode;
};
var _useMergedState5 = useMergedState(function() {
if (props3.picker === "time") {
return "time";
}
return getInternalNextMode("date");
}, {
value: toRef(props3, "mode")
}), _useMergedState6 = _slicedToArray$2(_useMergedState5, 2), mergedMode = _useMergedState6[0], setInnerMode = _useMergedState6[1];
watch(function() {
return props3.picker;
}, function() {
setInnerMode(props3.picker);
});
var sourceMode = ref(mergedMode.value);
var setSourceMode = function setSourceMode2(val) {
sourceMode.value = val;
};
var onInternalPanelChange = function onInternalPanelChange2(newMode, viewValue) {
var onPanelChange = props3.onPanelChange, generateConfig2 = props3.generateConfig;
var nextMode = getInternalNextMode(newMode || mergedMode.value);
setSourceMode(mergedMode.value);
setInnerMode(nextMode);
if (onPanelChange && (mergedMode.value !== nextMode || isEqual(generateConfig2, viewDate.value, viewDate.value))) {
onPanelChange(viewValue, nextMode);
}
};
var triggerSelect = function triggerSelect2(date2, type) {
var forceTriggerSelect = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
var picker = props3.picker, generateConfig2 = props3.generateConfig, onSelect = props3.onSelect, onChange = props3.onChange, disabledDate = props3.disabledDate;
if (mergedMode.value === picker || forceTriggerSelect) {
setInnerValue(date2);
if (onSelect) {
onSelect(date2);
}
if (onContextSelect) {
onContextSelect(date2, type);
}
if (onChange && !isEqual(generateConfig2, date2, mergedValue.value) && !(disabledDate !== null && disabledDate !== void 0 && disabledDate(date2))) {
onChange(date2);
}
}
};
var onInternalKeydown = function onInternalKeydown2(e2) {
if (panelRef.value && panelRef.value.onKeydown) {
if ([KeyCode$1.LEFT, KeyCode$1.RIGHT, KeyCode$1.UP, KeyCode$1.DOWN, KeyCode$1.PAGE_UP, KeyCode$1.PAGE_DOWN, KeyCode$1.ENTER].includes(e2.which)) {
e2.preventDefault();
}
return panelRef.value.onKeydown(e2);
}
{
warning$2(false, "Panel not correct handle keyDown event. Please help to fire issue about this.");
return false;
}
};
var onInternalBlur = function onInternalBlur2(e2) {
if (panelRef.value && panelRef.value.onBlur) {
panelRef.value.onBlur(e2);
}
};
var onNow = function onNow2() {
var generateConfig2 = props3.generateConfig, hourStep = props3.hourStep, minuteStep = props3.minuteStep, secondStep = props3.secondStep;
var now2 = generateConfig2.getNow();
var lowerBoundTime = getLowerBoundTime(generateConfig2.getHour(now2), generateConfig2.getMinute(now2), generateConfig2.getSecond(now2), isHourStepValid.value ? hourStep : 1, isMinuteStepValid.value ? minuteStep : 1, isSecondStepValid.value ? secondStep : 1);
var adjustedNow = setTime(
generateConfig2,
now2,
lowerBoundTime[0],
// hour
lowerBoundTime[1],
// minute
lowerBoundTime[2]
);
triggerSelect(adjustedNow, "submit");
};
var classString = computed(function() {
var _classNames;
var prefixCls = props3.prefixCls, direction = props3.direction;
return classNames("".concat(prefixCls, "-panel"), (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls, "-panel-has-range"), rangedValue && rangedValue.value && rangedValue.value[0] && rangedValue.value[1]), _defineProperty$q(_classNames, "".concat(prefixCls, "-panel-has-range-hover"), hoverRangedValue && hoverRangedValue.value && hoverRangedValue.value[0] && hoverRangedValue.value[1]), _defineProperty$q(_classNames, "".concat(prefixCls, "-panel-rtl"), direction === "rtl"), _classNames));
});
useProvidePanel(_objectSpread2$1(_objectSpread2$1({}, panelContext), {}, {
mode: mergedMode,
hideHeader: computed(function() {
var _panelContext$hideHea;
return props3.hideHeader !== void 0 ? props3.hideHeader : (_panelContext$hideHea = panelContext.hideHeader) === null || _panelContext$hideHea === void 0 ? void 0 : _panelContext$hideHea.value;
}),
hidePrevBtn: computed(function() {
return inRange.value && panelPosition.value === "right";
}),
hideNextBtn: computed(function() {
return inRange.value && panelPosition.value === "left";
})
}));
watch(function() {
return props3.value;
}, function() {
if (props3.value) {
setInnerViewDate(props3.value);
}
});
return function() {
var _props$prefixCls = props3.prefixCls, prefixCls = _props$prefixCls === void 0 ? "ant-picker" : _props$prefixCls, locale3 = props3.locale, generateConfig2 = props3.generateConfig, disabledDate = props3.disabledDate, _props$picker = props3.picker, picker = _props$picker === void 0 ? "date" : _props$picker, _props$tabindex = props3.tabindex, tabindex = _props$tabindex === void 0 ? 0 : _props$tabindex, showNow = props3.showNow, showTime = props3.showTime, showToday = props3.showToday, renderExtraFooter = props3.renderExtraFooter, onMousedown2 = props3.onMousedown, _onOk = props3.onOk, components2 = props3.components;
if (operationRef && panelPosition.value !== "right") {
operationRef.value = {
onKeydown: onInternalKeydown,
onClose: function onClose() {
if (panelRef.value && panelRef.value.onClose) {
panelRef.value.onClose();
}
}
};
}
var panelNode;
var pickerProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, attrs), props3), {}, {
operationRef: panelRef,
prefixCls,
viewDate: viewDate.value,
value: mergedValue.value,
onViewDateChange: setViewDate,
sourceMode: sourceMode.value,
onPanelChange: onInternalPanelChange,
disabledDate
});
delete pickerProps.onChange;
delete pickerProps.onSelect;
switch (mergedMode.value) {
case "decade":
panelNode = createVNode(DecadePanel, _objectSpread2$1(_objectSpread2$1({}, pickerProps), {}, {
"onSelect": function onSelect(date2, type) {
setViewDate(date2);
triggerSelect(date2, type);
}
}), null);
break;
case "year":
panelNode = createVNode(YearPanel, _objectSpread2$1(_objectSpread2$1({}, pickerProps), {}, {
"onSelect": function onSelect(date2, type) {
setViewDate(date2);
triggerSelect(date2, type);
}
}), null);
break;
case "month":
panelNode = createVNode(MonthPanel, _objectSpread2$1(_objectSpread2$1({}, pickerProps), {}, {
"onSelect": function onSelect(date2, type) {
setViewDate(date2);
triggerSelect(date2, type);
}
}), null);
break;
case "quarter":
panelNode = createVNode(QuarterPanel, _objectSpread2$1(_objectSpread2$1({}, pickerProps), {}, {
"onSelect": function onSelect(date2, type) {
setViewDate(date2);
triggerSelect(date2, type);
}
}), null);
break;
case "week":
panelNode = createVNode(WeekPanel, _objectSpread2$1(_objectSpread2$1({}, pickerProps), {}, {
"onSelect": function onSelect(date2, type) {
setViewDate(date2);
triggerSelect(date2, type);
}
}), null);
break;
case "time":
delete pickerProps.showTime;
panelNode = createVNode(TimePanel, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, pickerProps), _typeof$2(showTime) === "object" ? showTime : null), {}, {
"onSelect": function onSelect(date2, type) {
setViewDate(date2);
triggerSelect(date2, type);
}
}), null);
break;
default:
if (showTime) {
panelNode = createVNode(DatetimePanel, _objectSpread2$1(_objectSpread2$1({}, pickerProps), {}, {
"onSelect": function onSelect(date2, type) {
setViewDate(date2);
triggerSelect(date2, type);
}
}), null);
} else {
panelNode = createVNode(DatePanel, _objectSpread2$1(_objectSpread2$1({}, pickerProps), {}, {
"onSelect": function onSelect(date2, type) {
setViewDate(date2);
triggerSelect(date2, type);
}
}), null);
}
}
var extraFooter;
var rangesNode;
if (!(hideRanges !== null && hideRanges !== void 0 && hideRanges.value)) {
extraFooter = getExtraFooter(prefixCls, mergedMode.value, renderExtraFooter);
rangesNode = getRanges({
prefixCls,
components: components2,
needConfirmButton: needConfirmButton.value,
okDisabled: !mergedValue.value || disabledDate && disabledDate(mergedValue.value),
locale: locale3,
showNow,
onNow: needConfirmButton.value && onNow,
onOk: function onOk() {
if (mergedValue.value) {
triggerSelect(mergedValue.value, "submit", true);
if (_onOk) {
_onOk(mergedValue.value);
}
}
}
});
}
var todayNode;
if (showToday && mergedMode.value === "date" && picker === "date" && !showTime) {
var now2 = generateConfig2.getNow();
var todayCls = "".concat(prefixCls, "-today-btn");
var disabled = disabledDate && disabledDate(now2);
todayNode = createVNode("a", {
"class": classNames(todayCls, disabled && "".concat(todayCls, "-disabled")),
"aria-disabled": disabled,
"onClick": function onClick2() {
if (!disabled) {
triggerSelect(now2, "mouse", true);
}
}
}, [locale3.today]);
}
return createVNode("div", {
"tabindex": tabindex,
"class": classNames(classString.value, attrs.class),
"style": attrs.style,
"onKeydown": onInternalKeydown,
"onBlur": onInternalBlur,
"onMousedown": onMousedown2,
"ref": panelDivRef
}, [panelNode, extraFooter || rangesNode || todayNode ? createVNode("div", {
"class": "".concat(prefixCls, "-footer")
}, [extraFooter, rangesNode, todayNode]) : null]);
};
}
});
}
var InterPickerPanel = PickerPanel();
const PickerPanel$1 = function(props3) {
return createVNode(InterPickerPanel, props3);
};
var BUILT_IN_PLACEMENTS = {
bottomLeft: {
points: ["tl", "bl"],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
bottomRight: {
points: ["tr", "br"],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
topLeft: {
points: ["bl", "tl"],
offset: [0, -4],
overflow: {
adjustX: 0,
adjustY: 1
}
},
topRight: {
points: ["br", "tr"],
offset: [0, -4],
overflow: {
adjustX: 0,
adjustY: 1
}
}
};
function PickerTrigger(props3, _ref) {
var _classNames;
var slots = _ref.slots;
var _useMergeProps = useMergeProps(props3), prefixCls = _useMergeProps.prefixCls, popupStyle = _useMergeProps.popupStyle, visible = _useMergeProps.visible, dropdownClassName = _useMergeProps.dropdownClassName, dropdownAlign = _useMergeProps.dropdownAlign, transitionName2 = _useMergeProps.transitionName, getPopupContainer = _useMergeProps.getPopupContainer, range = _useMergeProps.range, popupPlacement = _useMergeProps.popupPlacement, direction = _useMergeProps.direction;
var dropdownPrefixCls = "".concat(prefixCls, "-dropdown");
var getPopupPlacement = function getPopupPlacement2() {
if (popupPlacement !== void 0) {
return popupPlacement;
}
return direction === "rtl" ? "bottomRight" : "bottomLeft";
};
return createVNode(Trigger, {
"showAction": [],
"hideAction": [],
"popupPlacement": getPopupPlacement(),
"builtinPlacements": BUILT_IN_PLACEMENTS,
"prefixCls": dropdownPrefixCls,
"popupTransitionName": transitionName2,
"popupAlign": dropdownAlign,
"popupVisible": visible,
"popupClassName": classNames(dropdownClassName, (_classNames = {}, _defineProperty$q(_classNames, "".concat(dropdownPrefixCls, "-range"), range), _defineProperty$q(_classNames, "".concat(dropdownPrefixCls, "-rtl"), direction === "rtl"), _classNames)),
"popupStyle": popupStyle,
"getPopupContainer": getPopupContainer,
"tryPopPortal": true
}, {
default: slots.default,
popup: slots.popupElement
});
}
function usePickerInput(_ref) {
var open2 = _ref.open, value2 = _ref.value, isClickOutside = _ref.isClickOutside, triggerOpen = _ref.triggerOpen, forwardKeydown = _ref.forwardKeydown, _onKeydown = _ref.onKeydown, blurToCancel = _ref.blurToCancel, onSubmit = _ref.onSubmit, onCancel = _ref.onCancel, _onFocus = _ref.onFocus, _onBlur = _ref.onBlur;
var typing = ref(false);
var focused = ref(false);
var preventBlurRef = ref(false);
var valueChangedRef = ref(false);
var preventDefaultRef = ref(false);
var inputProps3 = computed(function() {
return {
onMousedown: function onMousedown2() {
typing.value = true;
triggerOpen(true);
},
onKeydown: function onKeydown(e2) {
var preventDefault = function preventDefault2() {
preventDefaultRef.value = true;
};
_onKeydown(e2, preventDefault);
if (preventDefaultRef.value)
return;
switch (e2.which) {
case KeyCode$1.ENTER: {
if (!open2.value) {
triggerOpen(true);
} else if (onSubmit() !== false) {
typing.value = true;
}
e2.preventDefault();
return;
}
case KeyCode$1.TAB: {
if (typing.value && open2.value && !e2.shiftKey) {
typing.value = false;
e2.preventDefault();
} else if (!typing.value && open2.value) {
if (!forwardKeydown(e2) && e2.shiftKey) {
typing.value = true;
e2.preventDefault();
}
}
return;
}
case KeyCode$1.ESC: {
typing.value = true;
onCancel();
return;
}
}
if (!open2.value && ![KeyCode$1.SHIFT].includes(e2.which)) {
triggerOpen(true);
} else if (!typing.value) {
forwardKeydown(e2);
}
},
onFocus: function onFocus2(e2) {
typing.value = true;
focused.value = true;
if (_onFocus) {
_onFocus(e2);
}
},
onBlur: function onBlur2(e2) {
if (preventBlurRef.value || !isClickOutside(document.activeElement)) {
preventBlurRef.value = false;
return;
}
if (blurToCancel.value) {
setTimeout(function() {
var _document = document, activeElement = _document.activeElement;
while (activeElement && activeElement.shadowRoot) {
activeElement = activeElement.shadowRoot.activeElement;
}
if (isClickOutside(activeElement)) {
onCancel();
}
}, 0);
} else if (open2.value) {
triggerOpen(false);
if (valueChangedRef.value) {
onSubmit();
}
}
focused.value = false;
if (_onBlur) {
_onBlur(e2);
}
}
};
});
watch(open2, function() {
valueChangedRef.value = false;
});
watch(value2, function() {
valueChangedRef.value = true;
});
var globalMousedownEvent = ref();
onMounted(function() {
globalMousedownEvent.value = addGlobalMousedownEvent(function(e2) {
var target = getTargetFromEvent(e2);
if (open2.value) {
var clickedOutside = isClickOutside(target);
if (!clickedOutside) {
preventBlurRef.value = true;
wrapperRaf(function() {
preventBlurRef.value = false;
});
} else if (!focused.value || clickedOutside) {
triggerOpen(false);
}
}
});
});
onBeforeUnmount(function() {
globalMousedownEvent.value && globalMousedownEvent.value();
});
return [inputProps3, {
focused,
typing
}];
}
function useTextValueMapping(_ref) {
var valueTexts = _ref.valueTexts, onTextChange = _ref.onTextChange;
var text = ref("");
function triggerTextChange(value2) {
text.value = value2;
onTextChange(value2);
}
function resetText() {
text.value = valueTexts.value[0];
}
watch(function() {
return _toConsumableArray(valueTexts.value);
}, function(cur) {
var pre = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
if (cur.join("||") !== pre.join("||") && valueTexts.value.every(function(valText) {
return valText !== text.value;
})) {
resetText();
}
}, {
immediate: true
});
return [text, triggerTextChange, resetText];
}
function useValueTexts(value2, _ref) {
var formatList = _ref.formatList, generateConfig2 = _ref.generateConfig, locale3 = _ref.locale;
var texts = useMemo(function() {
if (!value2.value) {
return [[""], ""];
}
var firstValueText2 = "";
var fullValueTexts2 = [];
for (var i2 = 0; i2 < formatList.value.length; i2 += 1) {
var format3 = formatList.value[i2];
var formatStr = formatValue(value2.value, {
generateConfig: generateConfig2.value,
locale: locale3.value,
format: format3
});
fullValueTexts2.push(formatStr);
if (i2 === 0) {
firstValueText2 = formatStr;
}
}
return [fullValueTexts2, firstValueText2];
}, [value2, formatList], function(next2, prev2) {
return prev2[0] !== next2[0] || !shallowequal(prev2[1], next2[1]);
});
var fullValueTexts = computed(function() {
return texts.value[0];
});
var firstValueText = computed(function() {
return texts.value[1];
});
return [fullValueTexts, firstValueText];
}
function useHoverValue(valueText, _ref) {
var formatList = _ref.formatList, generateConfig2 = _ref.generateConfig, locale3 = _ref.locale;
var innerValue = ref(null);
var rafId;
function setValue(val) {
var immediately = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
wrapperRaf.cancel(rafId);
if (immediately) {
innerValue.value = val;
return;
}
rafId = wrapperRaf(function() {
innerValue.value = val;
});
}
var _useValueTexts = useValueTexts(innerValue, {
formatList,
generateConfig: generateConfig2,
locale: locale3
}), _useValueTexts2 = _slicedToArray$2(_useValueTexts, 2), firstText = _useValueTexts2[1];
function onEnter(date2) {
setValue(date2);
}
function onLeave() {
var immediately = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
setValue(null, immediately);
}
watch(valueText, function() {
onLeave(true);
});
onBeforeUnmount(function() {
wrapperRaf.cancel(rafId);
});
return [firstText, onEnter, onLeave];
}
function legacyPropsWarning(props3) {
var picker = props3.picker, disabledHours = props3.disabledHours, disabledMinutes = props3.disabledMinutes, disabledSeconds = props3.disabledSeconds;
if (picker === "time" && (disabledHours || disabledMinutes || disabledSeconds)) {
warning$2(false, "'disabledHours', 'disabledMinutes', 'disabledSeconds' will be removed in the next major version, please use 'disabledTime' instead.");
}
}
function Picker() {
return defineComponent({
name: "Picker",
inheritAttrs: false,
props: ["prefixCls", "id", "tabindex", "dropdownClassName", "dropdownAlign", "popupStyle", "transitionName", "generateConfig", "locale", "inputReadOnly", "allowClear", "autofocus", "showTime", "showNow", "showHour", "showMinute", "showSecond", "picker", "format", "use12Hours", "value", "defaultValue", "open", "defaultOpen", "defaultOpenValue", "suffixIcon", "clearIcon", "disabled", "disabledDate", "placeholder", "getPopupContainer", "panelRender", "inputRender", "onChange", "onOpenChange", "onFocus", "onBlur", "onMousedown", "onMouseup", "onMouseenter", "onMouseleave", "onContextmenu", "onClick", "onKeydown", "onSelect", "direction", "autocomplete", "showToday", "renderExtraFooter", "dateRender", "minuteStep", "hourStep", "secondStep", "hideDisabledOptions"],
// slots: [
// 'suffixIcon',
// 'clearIcon',
// 'prevIcon',
// 'nextIcon',
// 'superPrevIcon',
// 'superNextIcon',
// 'panelRender',
// ],
setup: function setup99(props3, _ref) {
var attrs = _ref.attrs, expose = _ref.expose;
var inputRef = ref(null);
var picker = computed(function() {
var _props$picker;
return (_props$picker = props3.picker) !== null && _props$picker !== void 0 ? _props$picker : "date";
});
var needConfirmButton = computed(function() {
return picker.value === "date" && !!props3.showTime || picker.value === "time";
});
if (process.env.NODE_ENV !== "production") {
legacyPropsWarning(props3);
}
var formatList = computed(function() {
return toArray$1(getDefaultFormat(props3.format, picker.value, props3.showTime, props3.use12Hours));
});
var panelDivRef = ref(null);
var inputDivRef = ref(null);
var containerRef = ref(null);
var _useMergedState = useMergedState(null, {
value: toRef(props3, "value"),
defaultValue: props3.defaultValue
}), _useMergedState2 = _slicedToArray$2(_useMergedState, 2), mergedValue = _useMergedState2[0], setInnerValue = _useMergedState2[1];
var selectedValue = ref(mergedValue.value);
var setSelectedValue = function setSelectedValue2(val) {
selectedValue.value = val;
};
var operationRef = ref(null);
var _useMergedState3 = useMergedState(false, {
value: toRef(props3, "open"),
defaultValue: props3.defaultOpen,
postState: function postState(postOpen) {
return props3.disabled ? false : postOpen;
},
onChange: function onChange(newOpen) {
if (props3.onOpenChange) {
props3.onOpenChange(newOpen);
}
if (!newOpen && operationRef.value && operationRef.value.onClose) {
operationRef.value.onClose();
}
}
}), _useMergedState4 = _slicedToArray$2(_useMergedState3, 2), mergedOpen = _useMergedState4[0], triggerInnerOpen = _useMergedState4[1];
var _useValueTexts = useValueTexts(selectedValue, {
formatList,
generateConfig: toRef(props3, "generateConfig"),
locale: toRef(props3, "locale")
}), _useValueTexts2 = _slicedToArray$2(_useValueTexts, 2), valueTexts = _useValueTexts2[0], firstValueText = _useValueTexts2[1];
var _useTextValueMapping = useTextValueMapping({
valueTexts,
onTextChange: function onTextChange(newText) {
var inputDate = parseValue$1(newText, {
locale: props3.locale,
formatList: formatList.value,
generateConfig: props3.generateConfig
});
if (inputDate && (!props3.disabledDate || !props3.disabledDate(inputDate))) {
setSelectedValue(inputDate);
}
}
}), _useTextValueMapping2 = _slicedToArray$2(_useTextValueMapping, 3), text = _useTextValueMapping2[0], triggerTextChange = _useTextValueMapping2[1], resetText = _useTextValueMapping2[2];
var triggerChange = function triggerChange2(newValue) {
var onChange = props3.onChange, generateConfig2 = props3.generateConfig, locale3 = props3.locale;
setSelectedValue(newValue);
setInnerValue(newValue);
if (onChange && !isEqual(generateConfig2, mergedValue.value, newValue)) {
onChange(newValue, newValue ? formatValue(newValue, {
generateConfig: generateConfig2,
locale: locale3,
format: formatList.value[0]
}) : "");
}
};
var triggerOpen = function triggerOpen2(newOpen) {
if (props3.disabled && newOpen) {
return;
}
triggerInnerOpen(newOpen);
};
var forwardKeydown = function forwardKeydown2(e2) {
if (mergedOpen.value && operationRef.value && operationRef.value.onKeydown) {
return operationRef.value.onKeydown(e2);
}
{
warning$2(false, "Picker not correct forward Keydown operation. Please help to fire issue about this.");
return false;
}
};
var onInternalMouseup = function onInternalMouseup2() {
if (props3.onMouseup) {
props3.onMouseup.apply(props3, arguments);
}
if (inputRef.value) {
inputRef.value.focus();
triggerOpen(true);
}
};
var _usePickerInput = usePickerInput({
blurToCancel: needConfirmButton,
open: mergedOpen,
value: text,
triggerOpen,
forwardKeydown,
isClickOutside: function isClickOutside(target) {
return !elementsContains([panelDivRef.value, inputDivRef.value, containerRef.value], target);
},
onSubmit: function onSubmit() {
if (
// When user typing disabledDate with keyboard and enter, this value will be empty
!selectedValue.value || // Normal disabled check
props3.disabledDate && props3.disabledDate(selectedValue.value)
) {
return false;
}
triggerChange(selectedValue.value);
triggerOpen(false);
resetText();
return true;
},
onCancel: function onCancel() {
triggerOpen(false);
setSelectedValue(mergedValue.value);
resetText();
},
onKeydown: function onKeydown(e2, preventDefault) {
var _props$onKeydown;
(_props$onKeydown = props3.onKeydown) === null || _props$onKeydown === void 0 ? void 0 : _props$onKeydown.call(props3, e2, preventDefault);
},
onFocus: function onFocus2(e2) {
var _props$onFocus;
(_props$onFocus = props3.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props3, e2);
},
onBlur: function onBlur2(e2) {
var _props$onBlur;
(_props$onBlur = props3.onBlur) === null || _props$onBlur === void 0 ? void 0 : _props$onBlur.call(props3, e2);
}
}), _usePickerInput2 = _slicedToArray$2(_usePickerInput, 2), inputProps3 = _usePickerInput2[0], _usePickerInput2$ = _usePickerInput2[1], focused = _usePickerInput2$.focused, typing = _usePickerInput2$.typing;
watch([mergedOpen, valueTexts], function() {
if (!mergedOpen.value) {
setSelectedValue(mergedValue.value);
if (!valueTexts.value.length || valueTexts.value[0] === "") {
triggerTextChange("");
} else if (firstValueText.value !== text.value) {
resetText();
}
}
});
watch(picker, function() {
if (!mergedOpen.value) {
resetText();
}
});
watch(mergedValue, function() {
setSelectedValue(mergedValue.value);
});
var _useHoverValue = useHoverValue(text, {
formatList,
generateConfig: toRef(props3, "generateConfig"),
locale: toRef(props3, "locale")
}), _useHoverValue2 = _slicedToArray$2(_useHoverValue, 3), hoverValue = _useHoverValue2[0], onEnter = _useHoverValue2[1], onLeave = _useHoverValue2[2];
var onContextSelect = function onContextSelect2(date2, type) {
if (type === "submit" || type !== "key" && !needConfirmButton.value) {
triggerChange(date2);
triggerOpen(false);
}
};
useProvidePanel({
operationRef,
hideHeader: computed(function() {
return picker.value === "time";
}),
panelRef: panelDivRef,
onSelect: onContextSelect,
open: mergedOpen,
defaultOpenValue: toRef(props3, "defaultOpenValue"),
onDateMouseenter: onEnter,
onDateMouseleave: onLeave
});
expose({
focus: function focus() {
if (inputRef.value) {
inputRef.value.focus();
}
},
blur: function blur() {
if (inputRef.value) {
inputRef.value.blur();
}
}
});
var getPortal = useProviderTrigger();
return function() {
var _classNames2;
var _props$prefixCls = props3.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-picker" : _props$prefixCls, id = props3.id, tabindex = props3.tabindex, dropdownClassName = props3.dropdownClassName, dropdownAlign = props3.dropdownAlign, popupStyle = props3.popupStyle, transitionName2 = props3.transitionName, generateConfig2 = props3.generateConfig, locale3 = props3.locale, inputReadOnly = props3.inputReadOnly, allowClear = props3.allowClear, autofocus = props3.autofocus, _props$picker2 = props3.picker, picker2 = _props$picker2 === void 0 ? "date" : _props$picker2, defaultOpenValue = props3.defaultOpenValue, suffixIcon = props3.suffixIcon, clearIcon = props3.clearIcon, disabled = props3.disabled, placeholder = props3.placeholder, getPopupContainer = props3.getPopupContainer, panelRender = props3.panelRender, onMousedown2 = props3.onMousedown, onMouseenter2 = props3.onMouseenter, onMouseleave2 = props3.onMouseleave, onContextmenu2 = props3.onContextmenu, onClick2 = props3.onClick, _onSelect = props3.onSelect, direction = props3.direction, _props$autocomplete = props3.autocomplete, autocomplete = _props$autocomplete === void 0 ? "off" : _props$autocomplete;
var panelProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, props3), attrs), {}, {
class: classNames(_defineProperty$q({}, "".concat(prefixCls, "-panel-focused"), !typing.value)),
style: void 0,
pickerValue: void 0,
onPickerValueChange: void 0,
onChange: null
});
var panelNode = createVNode(PickerPanel$1, _objectSpread2$1(_objectSpread2$1({}, panelProps), {}, {
"generateConfig": generateConfig2,
"value": selectedValue.value,
"locale": locale3,
"tabindex": -1,
"onSelect": function onSelect(date2) {
_onSelect === null || _onSelect === void 0 ? void 0 : _onSelect(date2);
setSelectedValue(date2);
},
"direction": direction,
"onPanelChange": function onPanelChange(viewDate, mode) {
var onPanelChange2 = props3.onPanelChange;
onLeave(true);
onPanelChange2 === null || onPanelChange2 === void 0 ? void 0 : onPanelChange2(viewDate, mode);
}
}), null);
if (panelRender) {
panelNode = panelRender(panelNode);
}
var panel = createVNode("div", {
"class": "".concat(prefixCls, "-panel-container"),
"onMousedown": function onMousedown3(e2) {
e2.preventDefault();
}
}, [panelNode]);
var suffixNode;
if (suffixIcon) {
suffixNode = createVNode("span", {
"class": "".concat(prefixCls, "-suffix")
}, [suffixIcon]);
}
var clearNode;
if (allowClear && mergedValue.value && !disabled) {
clearNode = createVNode("span", {
"onMousedown": function onMousedown3(e2) {
e2.preventDefault();
e2.stopPropagation();
},
"onMouseup": function onMouseup(e2) {
e2.preventDefault();
e2.stopPropagation();
triggerChange(null);
triggerOpen(false);
},
"class": "".concat(prefixCls, "-clear"),
"role": "button"
}, [clearIcon || createVNode("span", {
"class": "".concat(prefixCls, "-clear-btn")
}, null)]);
}
var mergedInputProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
id,
tabindex,
disabled,
readonly: inputReadOnly || typeof formatList.value[0] === "function" || !typing.value,
value: hoverValue.value || text.value,
onInput: function onInput(e2) {
triggerTextChange(e2.target.value);
},
autofocus,
placeholder,
ref: inputRef,
title: text.value
}, inputProps3.value), {}, {
size: getInputSize(picker2, formatList.value[0], generateConfig2)
}, getDataOrAriaProps(props3)), {}, {
autocomplete
});
var inputNode = props3.inputRender ? props3.inputRender(mergedInputProps) : createVNode("input", mergedInputProps, null);
if (process.env.NODE_ENV !== "production") {
warning$2(!defaultOpenValue, "`defaultOpenValue` may confuse user for the current value status. Please use `defaultValue` instead.");
}
var popupPlacement = direction === "rtl" ? "bottomRight" : "bottomLeft";
return createVNode(PickerTrigger, {
"visible": mergedOpen.value,
"popupStyle": popupStyle,
"prefixCls": prefixCls,
"dropdownClassName": dropdownClassName,
"dropdownAlign": dropdownAlign,
"getPopupContainer": getPopupContainer,
"transitionName": transitionName2,
"popupPlacement": popupPlacement,
"direction": direction
}, {
default: function _default3() {
return [createVNode("div", {
"ref": containerRef,
"class": classNames(prefixCls, attrs.class, (_classNames2 = {}, _defineProperty$q(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _defineProperty$q(_classNames2, "".concat(prefixCls, "-focused"), focused.value), _defineProperty$q(_classNames2, "".concat(prefixCls, "-rtl"), direction === "rtl"), _classNames2)),
"style": attrs.style,
"onMousedown": onMousedown2,
"onMouseup": onInternalMouseup,
"onMouseenter": onMouseenter2,
"onMouseleave": onMouseleave2,
"onContextmenu": onContextmenu2,
"onClick": onClick2
}, [createVNode("div", {
"class": classNames("".concat(prefixCls, "-input"), _defineProperty$q({}, "".concat(prefixCls, "-input-placeholder"), !!hoverValue.value)),
"ref": inputDivRef
}, [inputNode, suffixNode, clearNode]), getPortal()])];
},
popupElement: function popupElement() {
return panel;
}
});
};
}
});
}
const Picker$1 = Picker();
function useRangeDisabled(_ref, openRecordsRef) {
var picker = _ref.picker, locale3 = _ref.locale, selectedValue = _ref.selectedValue, disabledDate = _ref.disabledDate, disabled = _ref.disabled, generateConfig2 = _ref.generateConfig;
var startDate = computed(function() {
return getValue(selectedValue.value, 0);
});
var endDate = computed(function() {
return getValue(selectedValue.value, 1);
});
function weekFirstDate(date2) {
return generateConfig2.value.locale.getWeekFirstDate(locale3.value.locale, date2);
}
function monthNumber(date2) {
var year = generateConfig2.value.getYear(date2);
var month = generateConfig2.value.getMonth(date2);
return year * 100 + month;
}
function quarterNumber(date2) {
var year = generateConfig2.value.getYear(date2);
var quarter = getQuarter(generateConfig2.value, date2);
return year * 10 + quarter;
}
var disabledStartDate = function disabledStartDate2(date2) {
var _disabledDate$value;
if (disabledDate && disabledDate !== null && disabledDate !== void 0 && (_disabledDate$value = disabledDate.value) !== null && _disabledDate$value !== void 0 && _disabledDate$value.call(disabledDate, date2)) {
return true;
}
if (disabled[1] && endDate) {
return !isSameDate(generateConfig2.value, date2, endDate.value) && generateConfig2.value.isAfter(date2, endDate.value);
}
if (openRecordsRef.value[1] && endDate.value) {
switch (picker.value) {
case "quarter":
return quarterNumber(date2) > quarterNumber(endDate.value);
case "month":
return monthNumber(date2) > monthNumber(endDate.value);
case "week":
return weekFirstDate(date2) > weekFirstDate(endDate.value);
default:
return !isSameDate(generateConfig2.value, date2, endDate.value) && generateConfig2.value.isAfter(date2, endDate.value);
}
}
return false;
};
var disabledEndDate = function disabledEndDate2(date2) {
var _disabledDate$value2;
if ((_disabledDate$value2 = disabledDate.value) !== null && _disabledDate$value2 !== void 0 && _disabledDate$value2.call(disabledDate, date2)) {
return true;
}
if (disabled[0] && startDate) {
return !isSameDate(generateConfig2.value, date2, endDate.value) && generateConfig2.value.isAfter(startDate.value, date2);
}
if (openRecordsRef.value[0] && startDate.value) {
switch (picker.value) {
case "quarter":
return quarterNumber(date2) < quarterNumber(startDate.value);
case "month":
return monthNumber(date2) < monthNumber(startDate.value);
case "week":
return weekFirstDate(date2) < weekFirstDate(startDate.value);
default:
return !isSameDate(generateConfig2.value, date2, startDate.value) && generateConfig2.value.isAfter(startDate.value, date2);
}
}
return false;
};
return [disabledStartDate, disabledEndDate];
}
function getStartEndDistance(startDate, endDate, picker, generateConfig2) {
var startNext = getClosingViewDate(startDate, picker, generateConfig2, 1);
function getDistance(compareFunc) {
if (compareFunc(startDate, endDate)) {
return "same";
}
if (compareFunc(startNext, endDate)) {
return "closing";
}
return "far";
}
switch (picker) {
case "year":
return getDistance(function(start, end) {
return isSameDecade(generateConfig2, start, end);
});
case "quarter":
case "month":
return getDistance(function(start, end) {
return isSameYear(generateConfig2, start, end);
});
default:
return getDistance(function(start, end) {
return isSameMonth(generateConfig2, start, end);
});
}
}
function getRangeViewDate(values, index2, picker, generateConfig2) {
var startDate = getValue(values, 0);
var endDate = getValue(values, 1);
if (index2 === 0) {
return startDate;
}
if (startDate && endDate) {
var distance = getStartEndDistance(startDate, endDate, picker, generateConfig2);
switch (distance) {
case "same":
return startDate;
case "closing":
return startDate;
default:
return getClosingViewDate(endDate, picker, generateConfig2, -1);
}
}
return startDate;
}
function useRangeViewDates(_ref) {
var values = _ref.values, picker = _ref.picker, defaultDates = _ref.defaultDates, generateConfig2 = _ref.generateConfig;
var defaultViewDates = ref([getValue(defaultDates, 0), getValue(defaultDates, 1)]);
var viewDates = ref(null);
var startDate = computed(function() {
return getValue(values.value, 0);
});
var endDate = computed(function() {
return getValue(values.value, 1);
});
var getViewDate = function getViewDate2(index2) {
if (defaultViewDates.value[index2]) {
return defaultViewDates.value[index2];
}
return getValue(viewDates.value, index2) || getRangeViewDate(values.value, index2, picker.value, generateConfig2.value) || startDate.value || endDate.value || generateConfig2.value.getNow();
};
var startViewDate = ref(null);
var endViewDate = ref(null);
watchEffect(function() {
startViewDate.value = getViewDate(0);
endViewDate.value = getViewDate(1);
});
function setViewDate(viewDate, index2) {
if (viewDate) {
var newViewDates = updateValues(viewDates.value, viewDate, index2);
defaultViewDates.value = updateValues(defaultViewDates.value, null, index2) || [null, null];
var anotherIndex = (index2 + 1) % 2;
if (!getValue(values.value, anotherIndex)) {
newViewDates = updateValues(newViewDates, viewDate, anotherIndex);
}
viewDates.value = newViewDates;
} else if (startDate.value || endDate.value) {
viewDates.value = null;
}
}
return [startViewDate, endViewDate, setViewDate];
}
function tryOnScopeDispose(fn) {
if (getCurrentScope()) {
onScopeDispose(fn);
return true;
}
return false;
}
function resolveUnref(r2) {
return typeof r2 === "function" ? r2() : unref(r2);
}
function unrefElement(elRef) {
var _plain$$el;
var plain = resolveUnref(elRef);
return (_plain$$el = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _plain$$el !== void 0 ? _plain$$el : plain;
}
function tryOnMounted(fn) {
var sync = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
if (getCurrentInstance())
onMounted(fn);
else if (sync)
fn();
else
nextTick(fn);
}
function useSupported(callback) {
var sync = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
var isSupported = ref();
var update = function update2() {
return isSupported.value = Boolean(callback());
};
update();
tryOnMounted(update, sync);
return isSupported;
}
var _window, _window$navigator;
var isClient = typeof window !== "undefined";
isClient && ((_window = window) === null || _window === void 0 ? void 0 : (_window$navigator = _window.navigator) === null || _window$navigator === void 0 ? void 0 : _window$navigator.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
var defaultWindow = isClient ? window : void 0;
var _excluded$d = ["window"];
function useResizeObserver(target, callback) {
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
var _options$window = options.window, window2 = _options$window === void 0 ? defaultWindow : _options$window, observerOptions = _objectWithoutProperties$2(options, _excluded$d);
var observer;
var isSupported = useSupported(function() {
return window2 && "ResizeObserver" in window2;
});
var cleanup2 = function cleanup3() {
if (observer) {
observer.disconnect();
observer = void 0;
}
};
var stopWatch = watch(function() {
return unrefElement(target);
}, function(el) {
cleanup2();
if (isSupported.value && window2 && el) {
observer = new ResizeObserver(callback);
observer.observe(el, observerOptions);
}
}, {
immediate: true,
flush: "post"
});
var stop = function stop2() {
cleanup2();
stopWatch();
};
tryOnScopeDispose(stop);
return {
isSupported,
stop
};
}
function useElementSize(target) {
var initialSize = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
width: 0,
height: 0
};
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
var _options$box = options.box, box = _options$box === void 0 ? "content-box" : _options$box;
var width = ref(initialSize.width);
var height = ref(initialSize.height);
useResizeObserver(target, function(_ref) {
var _ref2 = _slicedToArray$2(_ref, 1), entry = _ref2[0];
var boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
if (boxSize) {
width.value = boxSize.reduce(function(acc, _ref3) {
var inlineSize = _ref3.inlineSize;
return acc + inlineSize;
}, 0);
height.value = boxSize.reduce(function(acc, _ref4) {
var blockSize = _ref4.blockSize;
return acc + blockSize;
}, 0);
} else {
width.value = entry.contentRect.width;
height.value = entry.contentRect.height;
}
}, options);
watch(function() {
return unrefElement(target);
}, function(ele) {
width.value = ele ? initialSize.width : 0;
height.value = ele ? initialSize.height : 0;
});
return {
width,
height
};
}
function reorderValues(values, generateConfig2) {
if (values && values[0] && values[1] && generateConfig2.isAfter(values[0], values[1])) {
return [values[1], values[0]];
}
return values;
}
function canValueTrigger(value2, index2, disabled, allowEmpty) {
if (value2) {
return true;
}
if (allowEmpty && allowEmpty[index2]) {
return true;
}
if (disabled[(index2 + 1) % 2]) {
return true;
}
return false;
}
function RangerPicker() {
return defineComponent({
name: "RangerPicker",
inheritAttrs: false,
props: ["prefixCls", "id", "popupStyle", "dropdownClassName", "transitionName", "dropdownAlign", "getPopupContainer", "generateConfig", "locale", "placeholder", "autofocus", "disabled", "format", "picker", "showTime", "showNow", "showHour", "showMinute", "showSecond", "use12Hours", "separator", "value", "defaultValue", "defaultPickerValue", "open", "defaultOpen", "disabledDate", "disabledTime", "dateRender", "panelRender", "ranges", "allowEmpty", "allowClear", "suffixIcon", "clearIcon", "pickerRef", "inputReadOnly", "mode", "renderExtraFooter", "onChange", "onOpenChange", "onPanelChange", "onCalendarChange", "onFocus", "onBlur", "onMousedown", "onMouseup", "onMouseenter", "onMouseleave", "onClick", "onOk", "onKeydown", "components", "order", "direction", "activePickerIndex", "autocomplete", "minuteStep", "hourStep", "secondStep", "hideDisabledOptions", "disabledMinutes"],
setup: function setup99(props3, _ref) {
var attrs = _ref.attrs, expose = _ref.expose;
var needConfirmButton = computed(function() {
return props3.picker === "date" && !!props3.showTime || props3.picker === "time";
});
var getPortal = useProviderTrigger();
var openRecordsRef = ref({});
var containerRef = ref(null);
var panelDivRef = ref(null);
var startInputDivRef = ref(null);
var endInputDivRef = ref(null);
var separatorRef = ref(null);
var startInputRef = ref(null);
var endInputRef = ref(null);
var arrowRef = ref(null);
if (process.env.NODE_ENV !== "production") {
legacyPropsWarning(props3);
}
var formatList = computed(function() {
return toArray$1(getDefaultFormat(props3.format, props3.picker, props3.showTime, props3.use12Hours));
});
var _useMergedState = useMergedState(0, {
value: toRef(props3, "activePickerIndex")
}), _useMergedState2 = _slicedToArray$2(_useMergedState, 2), mergedActivePickerIndex = _useMergedState2[0], setMergedActivePickerIndex = _useMergedState2[1];
var operationRef = ref(null);
var mergedDisabled = computed(function() {
var disabled = props3.disabled;
if (Array.isArray(disabled)) {
return disabled;
}
return [disabled || false, disabled || false];
});
var _useMergedState3 = useMergedState(null, {
value: toRef(props3, "value"),
defaultValue: props3.defaultValue,
postState: function postState(values) {
return props3.picker === "time" && !props3.order ? values : reorderValues(values, props3.generateConfig);
}
}), _useMergedState4 = _slicedToArray$2(_useMergedState3, 2), mergedValue = _useMergedState4[0], setInnerValue = _useMergedState4[1];
var _useRangeViewDates = useRangeViewDates({
values: mergedValue,
picker: toRef(props3, "picker"),
defaultDates: props3.defaultPickerValue,
generateConfig: toRef(props3, "generateConfig")
}), _useRangeViewDates2 = _slicedToArray$2(_useRangeViewDates, 3), startViewDate = _useRangeViewDates2[0], endViewDate = _useRangeViewDates2[1], setViewDate = _useRangeViewDates2[2];
var _useMergedState5 = useMergedState(mergedValue.value, {
postState: function postState(values) {
var postValues = values;
if (mergedDisabled.value[0] && mergedDisabled.value[1]) {
return postValues;
}
for (var i2 = 0; i2 < 2; i2 += 1) {
if (mergedDisabled.value[i2] && !getValue(postValues, i2) && !getValue(props3.allowEmpty, i2)) {
postValues = updateValues(postValues, props3.generateConfig.getNow(), i2);
}
}
return postValues;
}
}), _useMergedState6 = _slicedToArray$2(_useMergedState5, 2), selectedValue = _useMergedState6[0], setSelectedValue = _useMergedState6[1];
var _useMergedState7 = useMergedState([props3.picker, props3.picker], {
value: toRef(props3, "mode")
}), _useMergedState8 = _slicedToArray$2(_useMergedState7, 2), mergedModes = _useMergedState8[0], setInnerModes = _useMergedState8[1];
watch(function() {
return props3.picker;
}, function() {
setInnerModes([props3.picker, props3.picker]);
});
var triggerModesChange = function triggerModesChange2(modes, values) {
var _props$onPanelChange;
setInnerModes(modes);
(_props$onPanelChange = props3.onPanelChange) === null || _props$onPanelChange === void 0 ? void 0 : _props$onPanelChange.call(props3, values, modes);
};
var _useRangeDisabled = useRangeDisabled({
picker: toRef(props3, "picker"),
selectedValue,
locale: toRef(props3, "locale"),
disabled: mergedDisabled,
disabledDate: toRef(props3, "disabledDate"),
generateConfig: toRef(props3, "generateConfig")
}, openRecordsRef), _useRangeDisabled2 = _slicedToArray$2(_useRangeDisabled, 2), disabledStartDate = _useRangeDisabled2[0], disabledEndDate = _useRangeDisabled2[1];
var _useMergedState9 = useMergedState(false, {
value: toRef(props3, "open"),
defaultValue: props3.defaultOpen,
postState: function postState(postOpen) {
return mergedDisabled.value[mergedActivePickerIndex.value] ? false : postOpen;
},
onChange: function onChange(newOpen) {
var _props$onOpenChange;
(_props$onOpenChange = props3.onOpenChange) === null || _props$onOpenChange === void 0 ? void 0 : _props$onOpenChange.call(props3, newOpen);
if (!newOpen && operationRef.value && operationRef.value.onClose) {
operationRef.value.onClose();
}
}
}), _useMergedState10 = _slicedToArray$2(_useMergedState9, 2), mergedOpen = _useMergedState10[0], triggerInnerOpen = _useMergedState10[1];
var startOpen = computed(function() {
return mergedOpen.value && mergedActivePickerIndex.value === 0;
});
var endOpen = computed(function() {
return mergedOpen.value && mergedActivePickerIndex.value === 1;
});
var panelLeft = ref(0);
var arrowLeft = ref(0);
var popupMinWidth = ref(0);
var _useElementSize = useElementSize(containerRef), containerWidth = _useElementSize.width;
watch([mergedOpen, containerWidth], function() {
if (!mergedOpen.value && containerRef.value) {
popupMinWidth.value = containerWidth.value;
}
});
var _useElementSize2 = useElementSize(panelDivRef), panelDivWidth = _useElementSize2.width;
var _useElementSize3 = useElementSize(arrowRef), arrowWidth = _useElementSize3.width;
var _useElementSize4 = useElementSize(startInputDivRef), startInputDivWidth = _useElementSize4.width;
var _useElementSize5 = useElementSize(separatorRef), separatorWidth = _useElementSize5.width;
watch([mergedActivePickerIndex, mergedOpen, panelDivWidth, arrowWidth, startInputDivWidth, separatorWidth, function() {
return props3.direction;
}], function() {
arrowLeft.value = 0;
if (mergedOpen.value && mergedActivePickerIndex.value) {
if (startInputDivRef.value && separatorRef.value && panelDivRef.value) {
arrowLeft.value = startInputDivWidth.value + separatorWidth.value;
if (panelDivWidth.value && arrowWidth.value && arrowLeft.value > panelDivWidth.value - arrowWidth.value - (props3.direction === "rtl" || arrowRef.value.offsetLeft > arrowLeft.value ? 0 : arrowRef.value.offsetLeft)) {
panelLeft.value = arrowLeft.value;
}
}
} else if (mergedActivePickerIndex.value === 0) {
panelLeft.value = 0;
}
}, {
immediate: true
});
var triggerRef = ref();
function _triggerOpen(newOpen, index2) {
if (newOpen) {
clearTimeout(triggerRef.value);
openRecordsRef.value[index2] = true;
setMergedActivePickerIndex(index2);
triggerInnerOpen(newOpen);
if (!mergedOpen.value) {
setViewDate(null, index2);
}
} else if (mergedActivePickerIndex.value === index2) {
triggerInnerOpen(newOpen);
var openRecords = openRecordsRef.value;
triggerRef.value = setTimeout(function() {
if (openRecords === openRecordsRef.value) {
openRecordsRef.value = {};
}
});
}
}
function triggerOpenAndFocus(index2) {
_triggerOpen(true, index2);
setTimeout(function() {
var inputRef = [startInputRef, endInputRef][index2];
if (inputRef.value) {
inputRef.value.focus();
}
}, 0);
}
function triggerChange(newValue, sourceIndex) {
var values = newValue;
var startValue = getValue(values, 0);
var endValue = getValue(values, 1);
var generateConfig2 = props3.generateConfig, locale3 = props3.locale, picker = props3.picker, order = props3.order, onCalendarChange = props3.onCalendarChange, allowEmpty = props3.allowEmpty, onChange = props3.onChange, showTime = props3.showTime;
if (startValue && endValue && generateConfig2.isAfter(startValue, endValue)) {
if (
// WeekPicker only compare week
picker === "week" && !isSameWeek(generateConfig2, locale3.locale, startValue, endValue) || // QuotaPicker only compare week
picker === "quarter" && !isSameQuarter(generateConfig2, startValue, endValue) || // Other non-TimePicker compare date
picker !== "week" && picker !== "quarter" && picker !== "time" && !(showTime ? isEqual(generateConfig2, startValue, endValue) : isSameDate(generateConfig2, startValue, endValue))
) {
if (sourceIndex === 0) {
values = [startValue, null];
endValue = null;
} else {
startValue = null;
values = [null, endValue];
}
openRecordsRef.value = _defineProperty$q({}, sourceIndex, true);
} else if (picker !== "time" || order !== false) {
values = reorderValues(values, generateConfig2);
}
}
setSelectedValue(values);
var startStr2 = values && values[0] ? formatValue(values[0], {
generateConfig: generateConfig2,
locale: locale3,
format: formatList.value[0]
}) : "";
var endStr2 = values && values[1] ? formatValue(values[1], {
generateConfig: generateConfig2,
locale: locale3,
format: formatList.value[0]
}) : "";
if (onCalendarChange) {
var info = {
range: sourceIndex === 0 ? "start" : "end"
};
onCalendarChange(values, [startStr2, endStr2], info);
}
var canStartValueTrigger = canValueTrigger(startValue, 0, mergedDisabled.value, allowEmpty);
var canEndValueTrigger = canValueTrigger(endValue, 1, mergedDisabled.value, allowEmpty);
var canTrigger = values === null || canStartValueTrigger && canEndValueTrigger;
if (canTrigger) {
setInnerValue(values);
if (onChange && (!isEqual(generateConfig2, getValue(mergedValue.value, 0), startValue) || !isEqual(generateConfig2, getValue(mergedValue.value, 1), endValue))) {
onChange(values, [startStr2, endStr2]);
}
}
var nextOpenIndex = null;
if (sourceIndex === 0 && !mergedDisabled.value[1]) {
nextOpenIndex = 1;
} else if (sourceIndex === 1 && !mergedDisabled.value[0]) {
nextOpenIndex = 0;
}
if (nextOpenIndex !== null && nextOpenIndex !== mergedActivePickerIndex.value && (!openRecordsRef.value[nextOpenIndex] || !getValue(values, nextOpenIndex)) && getValue(values, sourceIndex)) {
triggerOpenAndFocus(nextOpenIndex);
} else {
_triggerOpen(false, sourceIndex);
}
}
var forwardKeydown = function forwardKeydown2(e2) {
if (mergedOpen && operationRef.value && operationRef.value.onKeydown) {
return operationRef.value.onKeydown(e2);
}
{
warning$2(false, "Picker not correct forward Keydown operation. Please help to fire issue about this.");
return false;
}
};
var sharedTextHooksProps = {
formatList,
generateConfig: toRef(props3, "generateConfig"),
locale: toRef(props3, "locale")
};
var _useValueTexts = useValueTexts(computed(function() {
return getValue(selectedValue.value, 0);
}), sharedTextHooksProps), _useValueTexts2 = _slicedToArray$2(_useValueTexts, 2), startValueTexts = _useValueTexts2[0], firstStartValueText = _useValueTexts2[1];
var _useValueTexts3 = useValueTexts(computed(function() {
return getValue(selectedValue.value, 1);
}), sharedTextHooksProps), _useValueTexts4 = _slicedToArray$2(_useValueTexts3, 2), endValueTexts = _useValueTexts4[0], firstEndValueText = _useValueTexts4[1];
var _onTextChange = function onTextChange(newText, index2) {
var inputDate = parseValue$1(newText, {
locale: props3.locale,
formatList: formatList.value,
generateConfig: props3.generateConfig
});
var disabledFunc = index2 === 0 ? disabledStartDate : disabledEndDate;
if (inputDate && !disabledFunc(inputDate)) {
setSelectedValue(updateValues(selectedValue.value, inputDate, index2));
setViewDate(inputDate, index2);
}
};
var _useTextValueMapping = useTextValueMapping({
valueTexts: startValueTexts,
onTextChange: function onTextChange(newText) {
return _onTextChange(newText, 0);
}
}), _useTextValueMapping2 = _slicedToArray$2(_useTextValueMapping, 3), startText = _useTextValueMapping2[0], triggerStartTextChange = _useTextValueMapping2[1], resetStartText = _useTextValueMapping2[2];
var _useTextValueMapping3 = useTextValueMapping({
valueTexts: endValueTexts,
onTextChange: function onTextChange(newText) {
return _onTextChange(newText, 1);
}
}), _useTextValueMapping4 = _slicedToArray$2(_useTextValueMapping3, 3), endText = _useTextValueMapping4[0], triggerEndTextChange = _useTextValueMapping4[1], resetEndText = _useTextValueMapping4[2];
var _useState = useState(null), _useState2 = _slicedToArray$2(_useState, 2), rangeHoverValue = _useState2[0], setRangeHoverValue = _useState2[1];
var _useState3 = useState(null), _useState4 = _slicedToArray$2(_useState3, 2), hoverRangedValue = _useState4[0], setHoverRangedValue = _useState4[1];
var _useHoverValue = useHoverValue(startText, sharedTextHooksProps), _useHoverValue2 = _slicedToArray$2(_useHoverValue, 3), startHoverValue = _useHoverValue2[0], onStartEnter = _useHoverValue2[1], onStartLeave = _useHoverValue2[2];
var _useHoverValue3 = useHoverValue(endText, sharedTextHooksProps), _useHoverValue4 = _slicedToArray$2(_useHoverValue3, 3), endHoverValue = _useHoverValue4[0], onEndEnter = _useHoverValue4[1], onEndLeave = _useHoverValue4[2];
var onDateMouseenter = function onDateMouseenter2(date2) {
setHoverRangedValue(updateValues(selectedValue.value, date2, mergedActivePickerIndex.value));
if (mergedActivePickerIndex.value === 0) {
onStartEnter(date2);
} else {
onEndEnter(date2);
}
};
var onDateMouseleave = function onDateMouseleave2() {
setHoverRangedValue(updateValues(selectedValue.value, null, mergedActivePickerIndex.value));
if (mergedActivePickerIndex.value === 0) {
onStartLeave();
} else {
onEndLeave();
}
};
var getSharedInputHookProps = function getSharedInputHookProps2(index2, resetText) {
return {
forwardKeydown,
onBlur: function onBlur2(e2) {
var _props$onBlur;
(_props$onBlur = props3.onBlur) === null || _props$onBlur === void 0 ? void 0 : _props$onBlur.call(props3, e2);
},
isClickOutside: function isClickOutside(target) {
return !elementsContains([panelDivRef.value, startInputDivRef.value, endInputDivRef.value, containerRef.value], target);
},
onFocus: function onFocus2(e2) {
var _props$onFocus;
setMergedActivePickerIndex(index2);
(_props$onFocus = props3.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props3, e2);
},
triggerOpen: function triggerOpen(newOpen) {
_triggerOpen(newOpen, index2);
},
onSubmit: function onSubmit() {
if (
// When user typing disabledDate with keyboard and enter, this value will be empty
!selectedValue.value || // Normal disabled check
props3.disabledDate && props3.disabledDate(selectedValue.value[index2])
) {
return false;
}
triggerChange(selectedValue.value, index2);
resetText();
},
onCancel: function onCancel() {
_triggerOpen(false, index2);
setSelectedValue(mergedValue.value);
resetText();
}
};
};
var _usePickerInput = usePickerInput(_objectSpread2$1(_objectSpread2$1({}, getSharedInputHookProps(0, resetStartText)), {}, {
blurToCancel: needConfirmButton,
open: startOpen,
value: startText,
onKeydown: function onKeydown(e2, preventDefault) {
var _props$onKeydown;
(_props$onKeydown = props3.onKeydown) === null || _props$onKeydown === void 0 ? void 0 : _props$onKeydown.call(props3, e2, preventDefault);
}
})), _usePickerInput2 = _slicedToArray$2(_usePickerInput, 2), startInputProps = _usePickerInput2[0], _usePickerInput2$ = _usePickerInput2[1], startFocused = _usePickerInput2$.focused, startTyping = _usePickerInput2$.typing;
var _usePickerInput3 = usePickerInput(_objectSpread2$1(_objectSpread2$1({}, getSharedInputHookProps(1, resetEndText)), {}, {
blurToCancel: needConfirmButton,
open: endOpen,
value: endText,
onKeydown: function onKeydown(e2, preventDefault) {
var _props$onKeydown2;
(_props$onKeydown2 = props3.onKeydown) === null || _props$onKeydown2 === void 0 ? void 0 : _props$onKeydown2.call(props3, e2, preventDefault);
}
})), _usePickerInput4 = _slicedToArray$2(_usePickerInput3, 2), endInputProps = _usePickerInput4[0], _usePickerInput4$ = _usePickerInput4[1], endFocused = _usePickerInput4$.focused, endTyping = _usePickerInput4$.typing;
var onPickerClick = function onPickerClick2(e2) {
var _props$onClick;
(_props$onClick = props3.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props3, e2);
if (!mergedOpen.value && !startInputRef.value.contains(e2.target) && !endInputRef.value.contains(e2.target)) {
if (!mergedDisabled.value[0]) {
triggerOpenAndFocus(0);
} else if (!mergedDisabled.value[1]) {
triggerOpenAndFocus(1);
}
}
};
var onPickerMousedown = function onPickerMousedown2(e2) {
var _props$onMousedown;
(_props$onMousedown = props3.onMousedown) === null || _props$onMousedown === void 0 ? void 0 : _props$onMousedown.call(props3, e2);
if (mergedOpen.value && (startFocused.value || endFocused.value) && !startInputRef.value.contains(e2.target) && !endInputRef.value.contains(e2.target)) {
e2.preventDefault();
}
};
var startStr = computed(function() {
var _mergedValue$value;
return (_mergedValue$value = mergedValue.value) !== null && _mergedValue$value !== void 0 && _mergedValue$value[0] ? formatValue(mergedValue.value[0], {
locale: props3.locale,
format: "YYYYMMDDHHmmss",
generateConfig: props3.generateConfig
}) : "";
});
var endStr = computed(function() {
var _mergedValue$value2;
return (_mergedValue$value2 = mergedValue.value) !== null && _mergedValue$value2 !== void 0 && _mergedValue$value2[1] ? formatValue(mergedValue.value[1], {
locale: props3.locale,
format: "YYYYMMDDHHmmss",
generateConfig: props3.generateConfig
}) : "";
});
watch([mergedOpen, startValueTexts, endValueTexts], function() {
if (!mergedOpen.value) {
setSelectedValue(mergedValue.value);
if (!startValueTexts.value.length || startValueTexts.value[0] === "") {
triggerStartTextChange("");
} else if (firstStartValueText.value !== startText.value) {
resetStartText();
}
if (!endValueTexts.value.length || endValueTexts.value[0] === "") {
triggerEndTextChange("");
} else if (firstEndValueText.value !== endText.value) {
resetEndText();
}
}
});
watch([startStr, endStr], function() {
setSelectedValue(mergedValue.value);
});
if (process.env.NODE_ENV !== "production") {
watchEffect(function() {
var value2 = props3.value, disabled = props3.disabled;
if (value2 && Array.isArray(disabled) && (getValue(disabled, 0) && !getValue(value2, 0) || getValue(disabled, 1) && !getValue(value2, 1))) {
warning$2(false, "`disabled` should not set with empty `value`. You should set `allowEmpty` or `value` instead.");
}
});
}
expose({
focus: function focus() {
if (startInputRef.value) {
startInputRef.value.focus();
}
},
blur: function blur() {
if (startInputRef.value) {
startInputRef.value.blur();
}
if (endInputRef.value) {
endInputRef.value.blur();
}
}
});
var rangeList = computed(function() {
return Object.keys(props3.ranges || {}).map(function(label) {
var range = props3.ranges[label];
var newValues = typeof range === "function" ? range() : range;
return {
label,
onClick: function onClick2() {
triggerChange(newValues, null);
_triggerOpen(false, mergedActivePickerIndex.value);
},
onMouseenter: function onMouseenter2() {
setRangeHoverValue(newValues);
},
onMouseleave: function onMouseleave2() {
setRangeHoverValue(null);
}
};
});
});
var panelHoverRangedValue = computed(function() {
if (mergedOpen.value && hoverRangedValue.value && hoverRangedValue.value[0] && hoverRangedValue.value[1] && props3.generateConfig.isAfter(hoverRangedValue.value[1], hoverRangedValue.value[0])) {
return hoverRangedValue.value;
} else {
return null;
}
});
function renderPanel() {
var panelPosition = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
var panelProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var generateConfig2 = props3.generateConfig, showTime = props3.showTime, dateRender = props3.dateRender, direction = props3.direction, _disabledTime = props3.disabledTime, prefixCls = props3.prefixCls, locale3 = props3.locale;
var panelShowTime = showTime;
if (showTime && _typeof$2(showTime) === "object" && showTime.defaultValue) {
var timeDefaultValues = showTime.defaultValue;
panelShowTime = _objectSpread2$1(_objectSpread2$1({}, showTime), {}, {
defaultValue: getValue(timeDefaultValues, mergedActivePickerIndex.value) || void 0
});
}
var panelDateRender = null;
if (dateRender) {
panelDateRender = function panelDateRender2(_ref2) {
var date2 = _ref2.current, today = _ref2.today;
return dateRender({
current: date2,
today,
info: {
range: mergedActivePickerIndex.value ? "end" : "start"
}
});
};
}
return createVNode(RangeContextProvider, {
"value": {
inRange: true,
panelPosition,
rangedValue: rangeHoverValue.value || selectedValue.value,
hoverRangedValue: panelHoverRangedValue.value
}
}, {
default: function _default3() {
return [createVNode(PickerPanel$1, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, props3), panelProps), {}, {
"dateRender": panelDateRender,
"showTime": panelShowTime,
"mode": mergedModes.value[mergedActivePickerIndex.value],
"generateConfig": generateConfig2,
"style": void 0,
"direction": direction,
"disabledDate": mergedActivePickerIndex.value === 0 ? disabledStartDate : disabledEndDate,
"disabledTime": function disabledTime(date2) {
if (_disabledTime) {
return _disabledTime(date2, mergedActivePickerIndex.value === 0 ? "start" : "end");
}
return false;
},
"class": classNames(_defineProperty$q({}, "".concat(prefixCls, "-panel-focused"), mergedActivePickerIndex.value === 0 ? !startTyping.value : !endTyping.value)),
"value": getValue(selectedValue.value, mergedActivePickerIndex.value),
"locale": locale3,
"tabIndex": -1,
"onPanelChange": function onPanelChange(date2, newMode) {
if (mergedActivePickerIndex.value === 0) {
onStartLeave(true);
}
if (mergedActivePickerIndex.value === 1) {
onEndLeave(true);
}
triggerModesChange(updateValues(mergedModes.value, newMode, mergedActivePickerIndex.value), updateValues(selectedValue.value, date2, mergedActivePickerIndex.value));
var viewDate = date2;
if (panelPosition === "right" && mergedModes.value[mergedActivePickerIndex.value] === newMode) {
viewDate = getClosingViewDate(viewDate, newMode, generateConfig2, -1);
}
setViewDate(viewDate, mergedActivePickerIndex.value);
},
"onOk": null,
"onSelect": void 0,
"onChange": void 0,
"defaultValue": mergedActivePickerIndex.value === 0 ? getValue(selectedValue.value, 1) : getValue(selectedValue.value, 0)
}), null)];
}
});
}
var onContextSelect = function onContextSelect2(date2, type) {
var values = updateValues(selectedValue.value, date2, mergedActivePickerIndex.value);
if (type === "submit" || type !== "key" && !needConfirmButton.value) {
triggerChange(values, mergedActivePickerIndex.value);
if (mergedActivePickerIndex.value === 0) {
onStartLeave();
} else {
onEndLeave();
}
} else {
setSelectedValue(values);
}
};
useProvidePanel({
operationRef,
hideHeader: computed(function() {
return props3.picker === "time";
}),
onDateMouseenter,
onDateMouseleave,
hideRanges: computed(function() {
return true;
}),
onSelect: onContextSelect,
open: mergedOpen
});
return function() {
var _classNames2, _classNames3, _classNames4;
var _props$prefixCls = props3.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-picker" : _props$prefixCls, id = props3.id, popupStyle = props3.popupStyle, dropdownClassName = props3.dropdownClassName, transitionName2 = props3.transitionName, dropdownAlign = props3.dropdownAlign, getPopupContainer = props3.getPopupContainer, generateConfig2 = props3.generateConfig, locale3 = props3.locale, placeholder = props3.placeholder, autofocus = props3.autofocus, _props$picker = props3.picker, picker = _props$picker === void 0 ? "date" : _props$picker, showTime = props3.showTime, _props$separator = props3.separator, separator = _props$separator === void 0 ? "~" : _props$separator, disabledDate = props3.disabledDate, panelRender = props3.panelRender, allowClear = props3.allowClear, suffixIcon = props3.suffixIcon, clearIcon = props3.clearIcon, inputReadOnly = props3.inputReadOnly, renderExtraFooter = props3.renderExtraFooter, onMouseenter2 = props3.onMouseenter, onMouseleave2 = props3.onMouseleave, onMouseup = props3.onMouseup, _onOk = props3.onOk, components2 = props3.components, direction = props3.direction, _props$autocomplete = props3.autocomplete, autocomplete = _props$autocomplete === void 0 ? "off" : _props$autocomplete;
var arrowPositionStyle = direction === "rtl" ? {
right: "".concat(arrowLeft.value, "px")
} : {
left: "".concat(arrowLeft.value, "px")
};
function renderPanels() {
var panels;
var extraNode = getExtraFooter(prefixCls, mergedModes.value[mergedActivePickerIndex.value], renderExtraFooter);
var rangesNode = getRanges({
prefixCls,
components: components2,
needConfirmButton: needConfirmButton.value,
okDisabled: !getValue(selectedValue.value, mergedActivePickerIndex.value) || disabledDate && disabledDate(selectedValue.value[mergedActivePickerIndex.value]),
locale: locale3,
rangeList: rangeList.value,
onOk: function onOk() {
if (getValue(selectedValue.value, mergedActivePickerIndex.value)) {
triggerChange(selectedValue.value, mergedActivePickerIndex.value);
if (_onOk) {
_onOk(selectedValue.value);
}
}
}
});
if (picker !== "time" && !showTime) {
var viewDate = mergedActivePickerIndex.value === 0 ? startViewDate.value : endViewDate.value;
var nextViewDate = getClosingViewDate(viewDate, picker, generateConfig2);
var currentMode = mergedModes.value[mergedActivePickerIndex.value];
var showDoublePanel = currentMode === picker;
var leftPanel = renderPanel(showDoublePanel ? "left" : false, {
pickerValue: viewDate,
onPickerValueChange: function onPickerValueChange(newViewDate) {
setViewDate(newViewDate, mergedActivePickerIndex.value);
}
});
var rightPanel = renderPanel("right", {
pickerValue: nextViewDate,
onPickerValueChange: function onPickerValueChange(newViewDate) {
setViewDate(getClosingViewDate(newViewDate, picker, generateConfig2, -1), mergedActivePickerIndex.value);
}
});
if (direction === "rtl") {
panels = createVNode(Fragment, null, [rightPanel, showDoublePanel && leftPanel]);
} else {
panels = createVNode(Fragment, null, [leftPanel, showDoublePanel && rightPanel]);
}
} else {
panels = renderPanel();
}
var mergedNodes = createVNode(Fragment, null, [createVNode("div", {
"class": "".concat(prefixCls, "-panels")
}, [panels]), (extraNode || rangesNode) && createVNode("div", {
"class": "".concat(prefixCls, "-footer")
}, [extraNode, rangesNode])]);
if (panelRender) {
mergedNodes = panelRender(mergedNodes);
}
return createVNode("div", {
"class": "".concat(prefixCls, "-panel-container"),
"style": {
marginLeft: "".concat(panelLeft.value, "px")
},
"ref": panelDivRef,
"onMousedown": function onMousedown2(e2) {
e2.preventDefault();
}
}, [mergedNodes]);
}
var rangePanel = createVNode("div", {
"class": classNames("".concat(prefixCls, "-range-wrapper"), "".concat(prefixCls, "-").concat(picker, "-range-wrapper")),
"style": {
minWidth: "".concat(popupMinWidth.value, "px")
}
}, [createVNode("div", {
"ref": arrowRef,
"class": "".concat(prefixCls, "-range-arrow"),
"style": arrowPositionStyle
}, null), renderPanels()]);
var suffixNode;
if (suffixIcon) {
suffixNode = createVNode("span", {
"class": "".concat(prefixCls, "-suffix")
}, [suffixIcon]);
}
var clearNode;
if (allowClear && (getValue(mergedValue.value, 0) && !mergedDisabled.value[0] || getValue(mergedValue.value, 1) && !mergedDisabled.value[1])) {
clearNode = createVNode("span", {
"onMousedown": function onMousedown2(e2) {
e2.preventDefault();
e2.stopPropagation();
},
"onMouseup": function onMouseup2(e2) {
e2.preventDefault();
e2.stopPropagation();
var values = mergedValue.value;
if (!mergedDisabled.value[0]) {
values = updateValues(values, null, 0);
}
if (!mergedDisabled.value[1]) {
values = updateValues(values, null, 1);
}
triggerChange(values, null);
_triggerOpen(false, mergedActivePickerIndex.value);
},
"class": "".concat(prefixCls, "-clear")
}, [clearIcon || createVNode("span", {
"class": "".concat(prefixCls, "-clear-btn")
}, null)]);
}
var inputSharedProps = {
size: getInputSize(picker, formatList.value[0], generateConfig2)
};
var activeBarLeft = 0;
var activeBarWidth = 0;
if (startInputDivRef.value && endInputDivRef.value && separatorRef.value) {
if (mergedActivePickerIndex.value === 0) {
activeBarWidth = startInputDivRef.value.offsetWidth;
} else {
activeBarLeft = arrowLeft.value;
activeBarWidth = endInputDivRef.value.offsetWidth;
}
}
var activeBarPositionStyle = direction === "rtl" ? {
right: "".concat(activeBarLeft, "px")
} : {
left: "".concat(activeBarLeft, "px")
};
return createVNode(PickerTrigger, {
"visible": mergedOpen.value,
"popupStyle": popupStyle,
"prefixCls": prefixCls,
"dropdownClassName": dropdownClassName,
"dropdownAlign": dropdownAlign,
"getPopupContainer": getPopupContainer,
"transitionName": transitionName2,
"range": true,
"direction": direction
}, {
default: function _default3() {
return [createVNode("div", _objectSpread2$1({
"ref": containerRef,
"class": classNames(prefixCls, "".concat(prefixCls, "-range"), attrs.class, (_classNames2 = {}, _defineProperty$q(_classNames2, "".concat(prefixCls, "-disabled"), mergedDisabled.value[0] && mergedDisabled.value[1]), _defineProperty$q(_classNames2, "".concat(prefixCls, "-focused"), mergedActivePickerIndex.value === 0 ? startFocused.value : endFocused.value), _defineProperty$q(_classNames2, "".concat(prefixCls, "-rtl"), direction === "rtl"), _classNames2)),
"style": attrs.style,
"onClick": onPickerClick,
"onMouseenter": onMouseenter2,
"onMouseleave": onMouseleave2,
"onMousedown": onPickerMousedown,
"onMouseup": onMouseup
}, getDataOrAriaProps(props3)), [createVNode("div", {
"class": classNames("".concat(prefixCls, "-input"), (_classNames3 = {}, _defineProperty$q(_classNames3, "".concat(prefixCls, "-input-active"), mergedActivePickerIndex.value === 0), _defineProperty$q(_classNames3, "".concat(prefixCls, "-input-placeholder"), !!startHoverValue.value), _classNames3)),
"ref": startInputDivRef
}, [createVNode("input", _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
"id": id,
"disabled": mergedDisabled.value[0],
"readonly": inputReadOnly || typeof formatList.value[0] === "function" || !startTyping.value,
"value": startHoverValue.value || startText.value,
"onInput": function onInput(e2) {
triggerStartTextChange(e2.target.value);
},
"autofocus": autofocus,
"placeholder": getValue(placeholder, 0) || "",
"ref": startInputRef
}, startInputProps.value), inputSharedProps), {}, {
"autocomplete": autocomplete
}), null)]), createVNode("div", {
"class": "".concat(prefixCls, "-range-separator"),
"ref": separatorRef
}, [separator]), createVNode("div", {
"class": classNames("".concat(prefixCls, "-input"), (_classNames4 = {}, _defineProperty$q(_classNames4, "".concat(prefixCls, "-input-active"), mergedActivePickerIndex.value === 1), _defineProperty$q(_classNames4, "".concat(prefixCls, "-input-placeholder"), !!endHoverValue.value), _classNames4)),
"ref": endInputDivRef
}, [createVNode("input", _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
"disabled": mergedDisabled.value[1],
"readonly": inputReadOnly || typeof formatList.value[0] === "function" || !endTyping.value,
"value": endHoverValue.value || endText.value,
"onInput": function onInput(e2) {
triggerEndTextChange(e2.target.value);
},
"placeholder": getValue(placeholder, 1) || "",
"ref": endInputRef
}, endInputProps.value), inputSharedProps), {}, {
"autocomplete": autocomplete
}), null)]), createVNode("div", {
"class": "".concat(prefixCls, "-active-bar"),
"style": _objectSpread2$1(_objectSpread2$1({}, activeBarPositionStyle), {}, {
width: "".concat(activeBarWidth, "px"),
position: "absolute"
})
}, null), suffixNode, clearNode, getPortal()])];
},
popupElement: function popupElement() {
return rangePanel;
}
});
};
}
});
}
var InterRangerPicker = RangerPicker();
const VCRangePicker = InterRangerPicker;
var _excluded$c = ["prefixCls", "name", "id", "type", "disabled", "readonly", "tabindex", "autofocus", "value", "required"];
var checkboxProps$1 = {
prefixCls: String,
name: String,
id: String,
type: String,
defaultChecked: {
type: [Boolean, Number],
default: void 0
},
checked: {
type: [Boolean, Number],
default: void 0
},
disabled: Boolean,
tabindex: {
type: [Number, String]
},
readonly: Boolean,
autofocus: Boolean,
value: PropTypes$1.any,
required: Boolean
};
const VcCheckbox = defineComponent({
compatConfig: {
MODE: 3
},
name: "Checkbox",
inheritAttrs: false,
props: initDefaultProps$1(checkboxProps$1, {
prefixCls: "rc-checkbox",
type: "checkbox",
defaultChecked: false
}),
emits: ["click", "change"],
setup: function setup52(props3, _ref) {
var attrs = _ref.attrs, emit = _ref.emit, expose = _ref.expose;
var checked = ref(props3.checked === void 0 ? props3.defaultChecked : props3.checked);
var inputRef = ref();
watch(function() {
return props3.checked;
}, function() {
checked.value = props3.checked;
});
expose({
focus: function focus() {
var _inputRef$value;
(_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 ? void 0 : _inputRef$value.focus();
},
blur: function blur() {
var _inputRef$value2;
(_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 ? void 0 : _inputRef$value2.blur();
}
});
var eventShiftKey = ref();
var handleChange = function handleChange2(e2) {
if (props3.disabled) {
return;
}
if (props3.checked === void 0) {
checked.value = e2.target.checked;
}
e2.shiftKey = eventShiftKey.value;
var eventObj = {
target: _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
checked: e2.target.checked
}),
stopPropagation: function stopPropagation() {
e2.stopPropagation();
},
preventDefault: function preventDefault() {
e2.preventDefault();
},
nativeEvent: e2
};
if (props3.checked !== void 0) {
inputRef.value.checked = !!props3.checked;
}
emit("change", eventObj);
eventShiftKey.value = false;
};
var onClick2 = function onClick3(e2) {
emit("click", e2);
eventShiftKey.value = e2.shiftKey;
};
return function() {
var _classNames;
var prefixCls = props3.prefixCls, name = props3.name, id = props3.id, type = props3.type, disabled = props3.disabled, readonly = props3.readonly, tabindex = props3.tabindex, autofocus = props3.autofocus, value2 = props3.value, required = props3.required, others = _objectWithoutProperties$2(props3, _excluded$c);
var className = attrs.class, onFocus2 = attrs.onFocus, onBlur2 = attrs.onBlur, onKeydown = attrs.onKeydown, onKeypress = attrs.onKeypress, onKeyup = attrs.onKeyup;
var othersAndAttrs = _objectSpread2$1(_objectSpread2$1({}, others), attrs);
var globalProps = Object.keys(othersAndAttrs).reduce(function(prev2, key2) {
if (key2.substr(0, 5) === "aria-" || key2.substr(0, 5) === "data-" || key2 === "role") {
prev2[key2] = othersAndAttrs[key2];
}
return prev2;
}, {});
var classString = classNames(prefixCls, className, (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls, "-checked"), checked.value), _defineProperty$q(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames));
var inputProps3 = _objectSpread2$1(_objectSpread2$1({
name,
id,
type,
readonly,
disabled,
tabindex,
class: "".concat(prefixCls, "-input"),
checked: !!checked.value,
autofocus,
value: value2
}, globalProps), {}, {
onChange: handleChange,
onClick: onClick2,
onFocus: onFocus2,
onBlur: onBlur2,
onKeydown,
onKeypress,
onKeyup,
required
});
return createVNode("span", {
"class": classString
}, [createVNode("input", _objectSpread2$1({
"ref": inputRef
}, inputProps3), null), createVNode("span", {
"class": "".concat(prefixCls, "-inner")
}, null)]);
};
}
});
var _excluded$b = ["prefixCls", "id"];
var radioProps = function radioProps2() {
return {
prefixCls: String,
checked: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
isGroup: {
type: Boolean,
default: void 0
},
value: PropTypes$1.any,
name: String,
id: String,
autofocus: {
type: Boolean,
default: void 0
},
onChange: Function,
onFocus: Function,
onBlur: Function,
onClick: Function,
"onUpdate:checked": Function,
"onUpdate:value": Function
};
};
const Radio = defineComponent({
compatConfig: {
MODE: 3
},
name: "ARadio",
props: radioProps(),
// emits: ['update:checked', 'update:value', 'change', 'blur', 'focus'],
setup: function setup53(props3, _ref) {
var emit = _ref.emit, expose = _ref.expose, slots = _ref.slots;
var formItemContext = useInjectFormItemContext();
var vcCheckbox = ref();
var radioGroupContext = inject("radioGroupContext", void 0);
var _useConfigInject = useConfigInject("radio", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction;
var focus = function focus2() {
vcCheckbox.value.focus();
};
var blur = function blur2() {
vcCheckbox.value.blur();
};
expose({
focus,
blur
});
var handleChange = function handleChange2(event) {
var targetChecked = event.target.checked;
emit("update:checked", targetChecked);
emit("update:value", targetChecked);
emit("change", event);
formItemContext.onFieldChange();
};
var onChange = function onChange2(e2) {
emit("change", e2);
if (radioGroupContext && radioGroupContext.onRadioChange) {
radioGroupContext.onRadioChange(e2);
}
};
return function() {
var _classNames;
var radioGroup = radioGroupContext;
props3.prefixCls;
var _props$id = props3.id, id = _props$id === void 0 ? formItemContext.id.value : _props$id, restProps = _objectWithoutProperties$2(props3, _excluded$b);
var rProps = _objectSpread2$1({
prefixCls: prefixCls.value,
id
}, omit(restProps, ["onUpdate:checked", "onUpdate:value"]));
if (radioGroup) {
rProps.name = radioGroup.props.name;
rProps.onChange = onChange;
rProps.checked = props3.value === radioGroup.stateValue.value;
rProps.disabled = props3.disabled || radioGroup.props.disabled;
} else {
rProps.onChange = handleChange;
}
var wrapperClassString = classNames((_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls.value, "-wrapper"), true), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-wrapper-checked"), rProps.checked), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-wrapper-disabled"), rProps.disabled), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-wrapper-rtl"), direction.value === "rtl"), _classNames));
return createVNode("label", {
"class": wrapperClassString
}, [createVNode(VcCheckbox, _objectSpread2$1(_objectSpread2$1({}, rProps), {}, {
"type": "radio",
"ref": vcCheckbox
}), null), slots.default && createVNode("span", null, [slots.default()])]);
};
}
});
var RadioGroupSizeTypes = tuple$1("large", "default", "small");
var radioGroupProps = function radioGroupProps2() {
return {
prefixCls: String,
value: PropTypes$1.any,
size: PropTypes$1.oneOf(RadioGroupSizeTypes),
options: {
type: Array
},
disabled: {
type: Boolean,
default: void 0
},
name: String,
buttonStyle: {
type: String,
default: "outline"
},
id: String,
optionType: {
type: String,
default: "default"
},
onChange: Function,
"onUpdate:value": Function
};
};
const __unplugin_components_1$4 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ARadioGroup",
props: radioGroupProps(),
// emits: ['update:value', 'change'],
setup: function setup54(props3, _ref) {
var slots = _ref.slots, emit = _ref.emit;
var formItemContext = useInjectFormItemContext();
var _useConfigInject = useConfigInject("radio", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction, size = _useConfigInject.size;
var stateValue = ref(props3.value);
var updatingValue = ref(false);
watch(function() {
return props3.value;
}, function(val) {
stateValue.value = val;
updatingValue.value = false;
});
var onRadioChange = function onRadioChange2(ev) {
var lastValue = stateValue.value;
var value2 = ev.target.value;
if (!("value" in props3)) {
stateValue.value = value2;
}
if (!updatingValue.value && value2 !== lastValue) {
updatingValue.value = true;
emit("update:value", value2);
emit("change", ev);
formItemContext.onFieldChange();
}
nextTick(function() {
updatingValue.value = false;
});
};
provide("radioGroupContext", {
onRadioChange,
stateValue,
props: props3
});
return function() {
var _classNames;
var options = props3.options, optionType = props3.optionType, buttonStyle = props3.buttonStyle, _props$id = props3.id, id = _props$id === void 0 ? formItemContext.id.value : _props$id;
var groupPrefixCls = "".concat(prefixCls.value, "-group");
var classString = classNames(groupPrefixCls, "".concat(groupPrefixCls, "-").concat(buttonStyle), (_classNames = {}, _defineProperty$q(_classNames, "".concat(groupPrefixCls, "-").concat(size.value), size.value), _defineProperty$q(_classNames, "".concat(groupPrefixCls, "-rtl"), direction.value === "rtl"), _classNames));
var children = null;
if (options && options.length > 0) {
var optionsPrefixCls = optionType === "button" ? "".concat(prefixCls.value, "-button") : prefixCls.value;
children = options.map(function(option) {
if (typeof option === "string" || typeof option === "number") {
return createVNode(Radio, {
"key": option,
"prefixCls": optionsPrefixCls,
"disabled": props3.disabled,
"value": option,
"checked": stateValue.value === option
}, {
default: function _default3() {
return [option];
}
});
}
var value2 = option.value, disabled = option.disabled, label = option.label;
return createVNode(Radio, {
"key": "radio-group-value-options-".concat(value2),
"prefixCls": optionsPrefixCls,
"disabled": disabled || props3.disabled,
"value": value2,
"checked": stateValue.value === value2
}, {
default: function _default3() {
return [label];
}
});
});
} else {
var _slots$default;
children = (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
}
return createVNode("div", {
"class": classString,
"id": id
}, [children]);
};
}
});
const __unplugin_components_0$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ARadioButton",
props: radioProps(),
setup: function setup55(props3, _ref) {
var slots = _ref.slots;
var _useConfigInject = useConfigInject("radio-button", props3), prefixCls = _useConfigInject.prefixCls;
var radioGroupContext = inject("radioGroupContext", void 0);
return function() {
var _slots$default;
var rProps = _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
prefixCls: prefixCls.value
});
if (radioGroupContext) {
rProps.onChange = radioGroupContext.onRadioChange;
rProps.checked = rProps.value === radioGroupContext.stateValue.value;
rProps.disabled = rProps.disabled || radioGroupContext.props.disabled;
}
return createVNode(Radio, rProps, {
default: function _default3() {
return [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
}
});
};
}
});
Radio.Group = __unplugin_components_1$4;
Radio.Button = __unplugin_components_0$2;
Radio.install = function(app) {
app.component(Radio.name, Radio);
app.component(Radio.Group.name, Radio.Group);
app.component(Radio.Button.name, Radio.Button);
return app;
};
function useRaf(callback) {
var rafRef = ref();
var removedRef = ref(false);
function trigger2() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (!removedRef.value) {
wrapperRaf.cancel(rafRef.value);
rafRef.value = wrapperRaf(function() {
callback.apply(void 0, args);
});
}
}
onBeforeUnmount(function() {
removedRef.value = true;
wrapperRaf.cancel(rafRef.value);
});
return trigger2;
}
function useRafState(defaultState) {
var batchRef = ref([]);
var state = ref(typeof defaultState === "function" ? defaultState() : defaultState);
var flushUpdate = useRaf(function() {
var value2 = state.value;
batchRef.value.forEach(function(callback) {
value2 = callback(value2);
});
batchRef.value = [];
state.value = value2;
});
function updater(callback) {
batchRef.value.push(callback);
flushUpdate();
}
return [state, updater];
}
const TabNode = defineComponent({
compatConfig: {
MODE: 3
},
name: "TabNode",
props: {
id: {
type: String
},
prefixCls: {
type: String
},
tab: {
type: Object
},
active: {
type: Boolean
},
closable: {
type: Boolean
},
editable: {
type: Object
},
onClick: {
type: Function
},
onResize: {
type: Function
},
renderWrapper: {
type: Function
},
removeAriaLabel: {
type: String
},
// onRemove: { type: Function as PropType<() => void> },
onFocus: {
type: Function
}
},
emits: ["click", "resize", "remove", "focus"],
setup: function setup56(props3, _ref) {
var expose = _ref.expose, attrs = _ref.attrs;
var domRef = ref();
function onInternalClick(e2) {
var _props$tab;
if ((_props$tab = props3.tab) !== null && _props$tab !== void 0 && _props$tab.disabled) {
return;
}
props3.onClick(e2);
}
expose({
domRef
});
function onRemoveTab(event) {
var _props$tab2;
event.preventDefault();
event.stopPropagation();
props3.editable.onEdit("remove", {
key: (_props$tab2 = props3.tab) === null || _props$tab2 === void 0 ? void 0 : _props$tab2.key,
event
});
}
var removable = computed(function() {
var _props$tab3;
return props3.editable && props3.closable !== false && !((_props$tab3 = props3.tab) !== null && _props$tab3 !== void 0 && _props$tab3.disabled);
});
return function() {
var _classNames, _editable$removeIcon;
var prefixCls = props3.prefixCls, id = props3.id, active = props3.active, _props$tab4 = props3.tab, key2 = _props$tab4.key, tab = _props$tab4.tab, disabled = _props$tab4.disabled, closeIcon = _props$tab4.closeIcon, renderWrapper = props3.renderWrapper, removeAriaLabel = props3.removeAriaLabel, editable = props3.editable, onFocus2 = props3.onFocus;
var tabPrefix = "".concat(prefixCls, "-tab");
var node = createVNode("div", {
"key": key2,
"ref": domRef,
"class": classNames(tabPrefix, (_classNames = {}, _defineProperty$q(_classNames, "".concat(tabPrefix, "-with-remove"), removable.value), _defineProperty$q(_classNames, "".concat(tabPrefix, "-active"), active), _defineProperty$q(_classNames, "".concat(tabPrefix, "-disabled"), disabled), _classNames)),
"style": attrs.style,
"onClick": onInternalClick
}, [createVNode("div", {
"role": "tab",
"aria-selected": active,
"id": id && "".concat(id, "-tab-").concat(key2),
"class": "".concat(tabPrefix, "-btn"),
"aria-controls": id && "".concat(id, "-panel-").concat(key2),
"aria-disabled": disabled,
"tabindex": disabled ? null : 0,
"onClick": function onClick2(e2) {
e2.stopPropagation();
onInternalClick(e2);
},
"onKeydown": function onKeydown(e2) {
if ([KeyCode$1.SPACE, KeyCode$1.ENTER].includes(e2.which)) {
e2.preventDefault();
onInternalClick(e2);
}
},
"onFocus": onFocus2
}, [typeof tab === "function" ? tab() : tab]), removable.value && createVNode("button", {
"type": "button",
"aria-label": removeAriaLabel || "remove",
"tabindex": 0,
"class": "".concat(tabPrefix, "-remove"),
"onClick": function onClick2(e2) {
e2.stopPropagation();
onRemoveTab(e2);
}
}, [(closeIcon === null || closeIcon === void 0 ? void 0 : closeIcon()) || ((_editable$removeIcon = editable.removeIcon) === null || _editable$removeIcon === void 0 ? void 0 : _editable$removeIcon.call(editable)) || "×"])]);
return renderWrapper ? renderWrapper(node) : node;
};
}
});
var DEFAULT_SIZE$1 = {
width: 0,
height: 0,
left: 0,
top: 0
};
function useOffsets(tabs, tabSizes) {
var offsetMap = ref(/* @__PURE__ */ new Map());
watchEffect(function() {
var _tabsValue$;
var map = /* @__PURE__ */ new Map();
var tabsValue = tabs.value;
var lastOffset = tabSizes.value.get((_tabsValue$ = tabsValue[0]) === null || _tabsValue$ === void 0 ? void 0 : _tabsValue$.key) || DEFAULT_SIZE$1;
var rightOffset = lastOffset.left + lastOffset.width;
for (var i2 = 0; i2 < tabsValue.length; i2 += 1) {
var key2 = tabsValue[i2].key;
var data2 = tabSizes.value.get(key2);
if (!data2) {
var _tabsValue;
data2 = tabSizes.value.get((_tabsValue = tabsValue[i2 - 1]) === null || _tabsValue === void 0 ? void 0 : _tabsValue.key) || DEFAULT_SIZE$1;
}
var entity = map.get(key2) || _objectSpread2$1({}, data2);
entity.right = rightOffset - entity.left - entity.width;
map.set(key2, entity);
}
offsetMap.value = new Map(map);
});
return offsetMap;
}
const AddButton = defineComponent({
compatConfig: {
MODE: 3
},
name: "AddButton",
inheritAttrs: false,
props: {
prefixCls: String,
editable: {
type: Object
},
locale: {
type: Object,
default: void 0
}
},
setup: function setup57(props3, _ref) {
var expose = _ref.expose, attrs = _ref.attrs;
var domRef = ref();
expose({
domRef
});
return function() {
var prefixCls = props3.prefixCls, editable = props3.editable, locale3 = props3.locale;
if (!editable || editable.showAdd === false) {
return null;
}
return createVNode("button", {
"ref": domRef,
"type": "button",
"class": "".concat(prefixCls, "-nav-add"),
"style": attrs.style,
"aria-label": (locale3 === null || locale3 === void 0 ? void 0 : locale3.addAriaLabel) || "Add tab",
"onClick": function onClick2(event) {
editable.onEdit("add", {
event
});
}
}, [editable.addIcon ? editable.addIcon() : "+"]);
};
}
});
var operationNodeProps = {
prefixCls: {
type: String
},
id: {
type: String
},
tabs: {
type: Object
},
rtl: {
type: Boolean
},
tabBarGutter: {
type: Number
},
activeKey: {
type: [String, Number]
},
mobile: {
type: Boolean
},
moreIcon: PropTypes$1.any,
moreTransitionName: {
type: String
},
editable: {
type: Object
},
locale: {
type: Object,
default: void 0
},
removeAriaLabel: String,
onTabClick: {
type: Function
}
};
const OperationNode = defineComponent({
compatConfig: {
MODE: 3
},
name: "OperationNode",
inheritAttrs: false,
props: operationNodeProps,
emits: ["tabClick"],
slots: ["moreIcon"],
setup: function setup58(props3, _ref) {
var attrs = _ref.attrs, slots = _ref.slots;
var _useState = useState(false), _useState2 = _slicedToArray$2(_useState, 2), open2 = _useState2[0], setOpen = _useState2[1];
var _useState3 = useState(null), _useState4 = _slicedToArray$2(_useState3, 2), selectedKey = _useState4[0], setSelectedKey = _useState4[1];
var selectOffset = function selectOffset2(offset3) {
var enabledTabs = props3.tabs.filter(function(tab2) {
return !tab2.disabled;
});
var selectedIndex = enabledTabs.findIndex(function(tab2) {
return tab2.key === selectedKey.value;
}) || 0;
var len = enabledTabs.length;
for (var i2 = 0; i2 < len; i2 += 1) {
selectedIndex = (selectedIndex + offset3 + len) % len;
var tab = enabledTabs[selectedIndex];
if (!tab.disabled) {
setSelectedKey(tab.key);
return;
}
}
};
var onKeyDown = function onKeyDown2(e2) {
var which = e2.which;
if (!open2.value) {
if ([KeyCode$1.DOWN, KeyCode$1.SPACE, KeyCode$1.ENTER].includes(which)) {
setOpen(true);
e2.preventDefault();
}
return;
}
switch (which) {
case KeyCode$1.UP:
selectOffset(-1);
e2.preventDefault();
break;
case KeyCode$1.DOWN:
selectOffset(1);
e2.preventDefault();
break;
case KeyCode$1.ESC:
setOpen(false);
break;
case KeyCode$1.SPACE:
case KeyCode$1.ENTER:
if (selectedKey.value !== null)
props3.onTabClick(selectedKey.value, e2);
break;
}
};
var popupId = computed(function() {
return "".concat(props3.id, "-more-popup");
});
var selectedItemId = computed(function() {
return selectedKey.value !== null ? "".concat(popupId.value, "-").concat(selectedKey.value) : null;
});
var onRemoveTab = function onRemoveTab2(event, key2) {
event.preventDefault();
event.stopPropagation();
props3.editable.onEdit("remove", {
key: key2,
event
});
};
onMounted(function() {
watch(selectedKey, function() {
var ele = document.getElementById(selectedItemId.value);
if (ele && ele.scrollIntoView) {
ele.scrollIntoView(false);
}
}, {
flush: "post",
immediate: true
});
});
watch(open2, function() {
if (!open2.value) {
setSelectedKey(null);
}
});
return function() {
var _slots$moreIcon;
var prefixCls = props3.prefixCls, id = props3.id, tabs = props3.tabs, locale3 = props3.locale, mobile = props3.mobile, _props$moreIcon = props3.moreIcon, moreIcon = _props$moreIcon === void 0 ? ((_slots$moreIcon = slots.moreIcon) === null || _slots$moreIcon === void 0 ? void 0 : _slots$moreIcon.call(slots)) || createVNode(EllipsisOutlined$1, null, null) : _props$moreIcon, moreTransitionName = props3.moreTransitionName, editable = props3.editable, tabBarGutter = props3.tabBarGutter, rtl2 = props3.rtl, onTabClick = props3.onTabClick;
var dropdownPrefix = "".concat(prefixCls, "-dropdown");
var dropdownAriaLabel = locale3 === null || locale3 === void 0 ? void 0 : locale3.dropdownAriaLabel;
var moreStyle = _defineProperty$q({}, rtl2 ? "marginRight" : "marginLeft", tabBarGutter);
if (!tabs.length) {
moreStyle.visibility = "hidden";
moreStyle.order = 1;
}
var overlayClassName = classNames(_defineProperty$q({}, "".concat(dropdownPrefix, "-rtl"), rtl2));
var moreNode = mobile ? null : createVNode(Dropdown$2, {
"prefixCls": dropdownPrefix,
"trigger": ["hover"],
"visible": open2.value,
"transitionName": moreTransitionName,
"onVisibleChange": setOpen,
"overlayClassName": overlayClassName,
"mouseEnterDelay": 0.1,
"mouseLeaveDelay": 0.1
}, {
overlay: function overlay() {
return createVNode(Menu, {
"onClick": function onClick2(_ref2) {
var key2 = _ref2.key, domEvent = _ref2.domEvent;
onTabClick(key2, domEvent);
setOpen(false);
},
"id": popupId.value,
"tabindex": -1,
"role": "listbox",
"aria-activedescendant": selectedItemId.value,
"selectedKeys": [selectedKey.value],
"aria-label": dropdownAriaLabel !== void 0 ? dropdownAriaLabel : "expanded dropdown"
}, {
default: function _default3() {
return [tabs.map(function(tab) {
var _tab$closeIcon, _editable$removeIcon;
var removable = editable && tab.closable !== false && !tab.disabled;
return createVNode(__unplugin_components_2$3, {
"key": tab.key,
"id": "".concat(popupId.value, "-").concat(tab.key),
"role": "option",
"aria-controls": id && "".concat(id, "-panel-").concat(tab.key),
"disabled": tab.disabled
}, {
default: function _default4() {
return [createVNode("span", null, [typeof tab.tab === "function" ? tab.tab() : tab.tab]), removable && createVNode("button", {
"type": "button",
"aria-label": props3.removeAriaLabel || "remove",
"tabindex": 0,
"class": "".concat(dropdownPrefix, "-menu-item-remove"),
"onClick": function onClick2(e2) {
e2.stopPropagation();
onRemoveTab(e2, tab.key);
}
}, [((_tab$closeIcon = tab.closeIcon) === null || _tab$closeIcon === void 0 ? void 0 : _tab$closeIcon.call(tab)) || ((_editable$removeIcon = editable.removeIcon) === null || _editable$removeIcon === void 0 ? void 0 : _editable$removeIcon.call(editable)) || "×"])];
}
});
})];
}
});
},
default: function _default3() {
return createVNode("button", {
"type": "button",
"class": "".concat(prefixCls, "-nav-more"),
"style": moreStyle,
"tabindex": -1,
"aria-hidden": "true",
"aria-haspopup": "listbox",
"aria-controls": popupId.value,
"id": "".concat(id, "-more"),
"aria-expanded": open2.value,
"onKeydown": onKeyDown
}, [moreIcon]);
}
});
return createVNode("div", {
"class": classNames("".concat(prefixCls, "-nav-operations"), attrs.class),
"style": attrs.style
}, [moreNode, createVNode(AddButton, {
"prefixCls": prefixCls,
"locale": locale3,
"editable": editable
}, null)]);
};
}
});
var TabsContextKey = Symbol("tabsContextKey");
var useProvideTabs = function useProvideTabs2(props3) {
provide(TabsContextKey, props3);
};
var useInjectTabs = function useInjectTabs2() {
return inject(TabsContextKey, {
tabs: ref([]),
prefixCls: ref()
});
};
defineComponent({
compatConfig: {
MODE: 3
},
name: "TabsContextProvider",
inheritAttrs: false,
props: {
tabs: {
type: Object,
default: void 0
},
prefixCls: {
type: String,
default: void 0
}
},
setup: function setup59(props3, _ref) {
var slots = _ref.slots;
useProvideTabs(toRefs(props3));
return function() {
var _slots$default;
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
};
}
});
var MIN_SWIPE_DISTANCE = 0.1;
var STOP_SWIPE_DISTANCE = 0.01;
var REFRESH_INTERVAL = 20;
var SPEED_OFF_MULTIPLE = Math.pow(0.995, REFRESH_INTERVAL);
function useTouchMove(domRef, onOffset) {
var _useState = useState(), _useState2 = _slicedToArray$2(_useState, 2), touchPosition = _useState2[0], setTouchPosition = _useState2[1];
var _useState3 = useState(0), _useState4 = _slicedToArray$2(_useState3, 2), lastTimestamp = _useState4[0], setLastTimestamp = _useState4[1];
var _useState5 = useState(0), _useState6 = _slicedToArray$2(_useState5, 2), lastTimeDiff = _useState6[0], setLastTimeDiff = _useState6[1];
var _useState7 = useState(), _useState8 = _slicedToArray$2(_useState7, 2), lastOffset = _useState8[0], setLastOffset = _useState8[1];
var motionInterval = ref();
function onTouchStart(e2) {
var _e$touches$ = e2.touches[0], screenX = _e$touches$.screenX, screenY = _e$touches$.screenY;
setTouchPosition({
x: screenX,
y: screenY
});
clearInterval(motionInterval.value);
}
function onTouchMove(e2) {
if (!touchPosition.value)
return;
e2.preventDefault();
var _e$touches$2 = e2.touches[0], screenX = _e$touches$2.screenX, screenY = _e$touches$2.screenY;
var offsetX = screenX - touchPosition.value.x;
var offsetY = screenY - touchPosition.value.y;
onOffset(offsetX, offsetY);
setTouchPosition({
x: screenX,
y: screenY
});
var now2 = Date.now();
setLastTimeDiff(now2 - lastTimestamp.value);
setLastTimestamp(now2);
setLastOffset({
x: offsetX,
y: offsetY
});
}
function onTouchEnd() {
if (!touchPosition.value)
return;
var lastOffsetValue = lastOffset.value;
setTouchPosition(null);
setLastOffset(null);
if (lastOffsetValue) {
var distanceX = lastOffsetValue.x / lastTimeDiff.value;
var distanceY = lastOffsetValue.y / lastTimeDiff.value;
var absX = Math.abs(distanceX);
var absY = Math.abs(distanceY);
if (Math.max(absX, absY) < MIN_SWIPE_DISTANCE)
return;
var currentX = distanceX;
var currentY = distanceY;
motionInterval.value = setInterval(function() {
if (Math.abs(currentX) < STOP_SWIPE_DISTANCE && Math.abs(currentY) < STOP_SWIPE_DISTANCE) {
clearInterval(motionInterval.value);
return;
}
currentX *= SPEED_OFF_MULTIPLE;
currentY *= SPEED_OFF_MULTIPLE;
onOffset(currentX * REFRESH_INTERVAL, currentY * REFRESH_INTERVAL);
}, REFRESH_INTERVAL);
}
}
var lastWheelDirectionRef = ref();
function onWheel(e2) {
var deltaX = e2.deltaX, deltaY = e2.deltaY;
var mixed = 0;
var absX = Math.abs(deltaX);
var absY = Math.abs(deltaY);
if (absX === absY) {
mixed = lastWheelDirectionRef.value === "x" ? deltaX : deltaY;
} else if (absX > absY) {
mixed = deltaX;
lastWheelDirectionRef.value = "x";
} else {
mixed = deltaY;
lastWheelDirectionRef.value = "y";
}
if (onOffset(-mixed, -mixed)) {
e2.preventDefault();
}
}
var touchEventsRef = ref({
onTouchStart,
onTouchMove,
onTouchEnd,
onWheel
});
function onProxyTouchStart(e2) {
touchEventsRef.value.onTouchStart(e2);
}
function onProxyTouchMove(e2) {
touchEventsRef.value.onTouchMove(e2);
}
function onProxyTouchEnd(e2) {
touchEventsRef.value.onTouchEnd(e2);
}
function onProxyWheel(e2) {
touchEventsRef.value.onWheel(e2);
}
onMounted(function() {
var _domRef$value, _domRef$value2;
document.addEventListener("touchmove", onProxyTouchMove, {
passive: false
});
document.addEventListener("touchend", onProxyTouchEnd, {
passive: false
});
(_domRef$value = domRef.value) === null || _domRef$value === void 0 ? void 0 : _domRef$value.addEventListener("touchstart", onProxyTouchStart, {
passive: false
});
(_domRef$value2 = domRef.value) === null || _domRef$value2 === void 0 ? void 0 : _domRef$value2.addEventListener("wheel", onProxyWheel, {
passive: false
});
});
onBeforeUnmount(function() {
document.removeEventListener("touchmove", onProxyTouchMove);
document.removeEventListener("touchend", onProxyTouchEnd);
});
}
function useSyncState(defaultState, onChange) {
var stateRef = ref(defaultState);
function setState2(updater) {
var newValue = typeof updater === "function" ? updater(stateRef.value) : updater;
if (newValue !== stateRef.value) {
onChange(newValue, stateRef.value);
}
stateRef.value = newValue;
}
return [stateRef, setState2];
}
var useRefs = function useRefs2() {
var refs = ref(/* @__PURE__ */ new Map());
var setRef = function setRef2(key2) {
return function(el) {
refs.value.set(key2, el);
};
};
onBeforeUpdate(function() {
refs.value = /* @__PURE__ */ new Map();
});
return [setRef, refs];
};
const useRefs$1 = useRefs;
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
function isKey(value2, object) {
if (isArray$2(value2)) {
return false;
}
var type = typeof value2;
if (type == "number" || type == "symbol" || type == "boolean" || value2 == null || isSymbol(value2)) {
return true;
}
return reIsPlainProp.test(value2) || !reIsDeepProp.test(value2) || object != null && value2 in Object(object);
}
var FUNC_ERROR_TEXT = "Expected a function";
function memoize(func, resolver) {
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments, key2 = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache;
if (cache2.has(key2)) {
return cache2.get(key2);
}
var result = func.apply(this, args);
memoized.cache = cache2.set(key2, result) || cache2;
return result;
};
memoized.cache = new (memoize.Cache || MapCache)();
return memoized;
}
memoize.Cache = MapCache;
var MAX_MEMOIZE_SIZE = 500;
function memoizeCapped(func) {
var result = memoize(func, function(key2) {
if (cache2.size === MAX_MEMOIZE_SIZE) {
cache2.clear();
}
return key2;
});
var cache2 = result.cache;
return result;
}
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar = /\\(\\)?/g;
var stringToPath = memoizeCapped(function(string) {
var result = [];
if (string.charCodeAt(0) === 46) {
result.push("");
}
string.replace(rePropName, function(match2, number2, quote, subString) {
result.push(quote ? subString.replace(reEscapeChar, "$1") : number2 || match2);
});
return result;
});
const stringToPath$1 = stringToPath;
function castPath(value2, object) {
if (isArray$2(value2)) {
return value2;
}
return isKey(value2, object) ? [value2] : stringToPath$1(toString2(value2));
}
var INFINITY = 1 / 0;
function toKey(value2) {
if (typeof value2 == "string" || isSymbol(value2)) {
return value2;
}
var result = value2 + "";
return result == "0" && 1 / value2 == -INFINITY ? "-0" : result;
}
function baseGet(object, path) {
path = castPath(path, object);
var index2 = 0, length = path.length;
while (object != null && index2 < length) {
object = object[toKey(path[index2++])];
}
return index2 && index2 == length ? object : void 0;
}
var defineProperty = function() {
try {
var func = getNative(Object, "defineProperty");
func({}, "", {});
return func;
} catch (e2) {
}
}();
const defineProperty$1 = defineProperty;
function baseAssignValue(object, key2, value2) {
if (key2 == "__proto__" && defineProperty$1) {
defineProperty$1(object, key2, {
"configurable": true,
"enumerable": true,
"value": value2,
"writable": true
});
} else {
object[key2] = value2;
}
}
var objectProto = Object.prototype;
var hasOwnProperty$2 = objectProto.hasOwnProperty;
function assignValue(object, key2, value2) {
var objValue = object[key2];
if (!(hasOwnProperty$2.call(object, key2) && eq(objValue, value2)) || value2 === void 0 && !(key2 in object)) {
baseAssignValue(object, key2, value2);
}
}
function baseSet(object, path, value2, customizer) {
if (!isObject$2(object)) {
return object;
}
path = castPath(path, object);
var index2 = -1, length = path.length, lastIndex = length - 1, nested = object;
while (nested != null && ++index2 < length) {
var key2 = toKey(path[index2]), newValue = value2;
if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") {
return object;
}
if (index2 != lastIndex) {
var objValue = nested[key2];
newValue = customizer ? customizer(objValue, key2, nested) : void 0;
if (newValue === void 0) {
newValue = isObject$2(objValue) ? objValue : isIndex(path[index2 + 1]) ? [] : {};
}
}
assignValue(nested, key2, newValue);
nested = nested[key2];
}
return object;
}
function basePickBy(object, paths, predicate) {
var index2 = -1, length = paths.length, result = {};
while (++index2 < length) {
var path = paths[index2], value2 = baseGet(object, path);
if (predicate(value2, path)) {
baseSet(result, castPath(path, object), value2);
}
}
return result;
}
function baseHasIn(object, key2) {
return object != null && key2 in Object(object);
}
function hasPath(object, path, hasFunc) {
path = castPath(path, object);
var index2 = -1, length = path.length, result = false;
while (++index2 < length) {
var key2 = toKey(path[index2]);
if (!(result = object != null && hasFunc(object, key2))) {
break;
}
object = object[key2];
}
if (result || ++index2 != length) {
return result;
}
length = object == null ? 0 : object.length;
return !!length && isLength(length) && isIndex(key2, length) && (isArray$2(object) || isArguments$1(object));
}
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}
function basePick(object, paths) {
return basePickBy(object, paths, function(value2, path) {
return hasIn(object, path);
});
}
var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : void 0;
function isFlattenable(value2) {
return isArray$2(value2) || isArguments$1(value2) || !!(spreadableSymbol && value2 && value2[spreadableSymbol]);
}
function baseFlatten(array, depth, predicate, isStrict, result) {
var index2 = -1, length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index2 < length) {
var value2 = array[index2];
if (depth > 0 && predicate(value2)) {
if (depth > 1) {
baseFlatten(value2, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value2);
}
} else if (!isStrict) {
result[result.length] = value2;
}
}
return result;
}
function flatten(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, 1) : [];
}
function apply$1(func, thisArg, args) {
switch (args.length) {
case 0:
return func.call(thisArg);
case 1:
return func.call(thisArg, args[0]);
case 2:
return func.call(thisArg, args[0], args[1]);
case 3:
return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
var nativeMax = Math.max;
function overRest(func, start, transform2) {
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
return function() {
var args = arguments, index2 = -1, length = nativeMax(args.length - start, 0), array = Array(length);
while (++index2 < length) {
array[index2] = args[start + index2];
}
index2 = -1;
var otherArgs = Array(start + 1);
while (++index2 < start) {
otherArgs[index2] = args[index2];
}
otherArgs[start] = transform2(array);
return apply$1(func, this, otherArgs);
};
}
function constant(value2) {
return function() {
return value2;
};
}
function identity(value2) {
return value2;
}
var baseSetToString = !defineProperty$1 ? identity : function(func, string) {
return defineProperty$1(func, "toString", {
"configurable": true,
"enumerable": false,
"value": constant(string),
"writable": true
});
};
const baseSetToString$1 = baseSetToString;
var HOT_COUNT = 800, HOT_SPAN = 16;
var nativeNow = Date.now;
function shortOut(func) {
var count = 0, lastCalled = 0;
return function() {
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count = 0;
}
return func.apply(void 0, arguments);
};
}
var setToString = shortOut(baseSetToString$1);
const setToString$1 = setToString;
function flatRest(func) {
return setToString$1(overRest(func, void 0, flatten), func + "");
}
var pick$1 = flatRest(function(object, paths) {
return object == null ? {} : basePick(object, paths);
});
const pick$2 = pick$1;
var DEFAULT_SIZE = {
width: 0,
height: 0,
left: 0,
top: 0,
right: 0
};
var tabNavListProps = function tabNavListProps2() {
return {
id: {
type: String
},
tabPosition: {
type: String
},
activeKey: {
type: [String, Number]
},
rtl: {
type: Boolean
},
animated: {
type: Object,
default: void 0
},
editable: {
type: Object
},
moreIcon: PropTypes$1.any,
moreTransitionName: {
type: String
},
mobile: {
type: Boolean
},
tabBarGutter: {
type: Number
},
renderTabBar: {
type: Function
},
locale: {
type: Object,
default: void 0
},
onTabClick: {
type: Function
},
onTabScroll: {
type: Function
}
};
};
const TabNavList = defineComponent({
compatConfig: {
MODE: 3
},
name: "TabNavList",
inheritAttrs: false,
props: tabNavListProps(),
slots: ["moreIcon", "leftExtra", "rightExtra", "tabBarExtraContent"],
emits: ["tabClick", "tabScroll"],
setup: function setup60(props3, _ref) {
var attrs = _ref.attrs, slots = _ref.slots;
var _useInjectTabs = useInjectTabs(), tabs = _useInjectTabs.tabs, prefixCls = _useInjectTabs.prefixCls;
var tabsWrapperRef = ref();
var tabListRef = ref();
var operationsRef = ref();
var innerAddButtonRef = ref();
var _useRefs = useRefs$1(), _useRefs2 = _slicedToArray$2(_useRefs, 2), setRef = _useRefs2[0], btnRefs = _useRefs2[1];
var tabPositionTopOrBottom = computed(function() {
return props3.tabPosition === "top" || props3.tabPosition === "bottom";
});
var _useSyncState = useSyncState(0, function(next2, prev2) {
if (tabPositionTopOrBottom.value && props3.onTabScroll) {
props3.onTabScroll({
direction: next2 > prev2 ? "left" : "right"
});
}
}), _useSyncState2 = _slicedToArray$2(_useSyncState, 2), transformLeft = _useSyncState2[0], setTransformLeft = _useSyncState2[1];
var _useSyncState3 = useSyncState(0, function(next2, prev2) {
if (!tabPositionTopOrBottom.value && props3.onTabScroll) {
props3.onTabScroll({
direction: next2 > prev2 ? "top" : "bottom"
});
}
}), _useSyncState4 = _slicedToArray$2(_useSyncState3, 2), transformTop = _useSyncState4[0], setTransformTop = _useSyncState4[1];
var _useState = useState(0), _useState2 = _slicedToArray$2(_useState, 2), wrapperScrollWidth = _useState2[0], setWrapperScrollWidth = _useState2[1];
var _useState3 = useState(0), _useState4 = _slicedToArray$2(_useState3, 2), wrapperScrollHeight = _useState4[0], setWrapperScrollHeight = _useState4[1];
var _useState5 = useState(null), _useState6 = _slicedToArray$2(_useState5, 2), wrapperWidth = _useState6[0], setWrapperWidth = _useState6[1];
var _useState7 = useState(null), _useState8 = _slicedToArray$2(_useState7, 2), wrapperHeight = _useState8[0], setWrapperHeight = _useState8[1];
var _useState9 = useState(0), _useState10 = _slicedToArray$2(_useState9, 2), addWidth = _useState10[0], setAddWidth = _useState10[1];
var _useState11 = useState(0), _useState12 = _slicedToArray$2(_useState11, 2), addHeight = _useState12[0], setAddHeight = _useState12[1];
var _useRafState = useRafState(/* @__PURE__ */ new Map()), _useRafState2 = _slicedToArray$2(_useRafState, 2), tabSizes = _useRafState2[0], setTabSizes = _useRafState2[1];
var tabOffsets = useOffsets(tabs, tabSizes);
var operationsHiddenClassName = computed(function() {
return "".concat(prefixCls.value, "-nav-operations-hidden");
});
var transformMin = ref(0);
var transformMax = ref(0);
watchEffect(function() {
if (!tabPositionTopOrBottom.value) {
transformMin.value = Math.min(0, wrapperHeight.value - wrapperScrollHeight.value);
transformMax.value = 0;
} else if (props3.rtl) {
transformMin.value = 0;
transformMax.value = Math.max(0, wrapperScrollWidth.value - wrapperWidth.value);
} else {
transformMin.value = Math.min(0, wrapperWidth.value - wrapperScrollWidth.value);
transformMax.value = 0;
}
});
var alignInRange = function alignInRange2(value2) {
if (value2 < transformMin.value) {
return transformMin.value;
}
if (value2 > transformMax.value) {
return transformMax.value;
}
return value2;
};
var touchMovingRef = ref();
var _useState13 = useState(), _useState14 = _slicedToArray$2(_useState13, 2), lockAnimation = _useState14[0], setLockAnimation = _useState14[1];
var doLockAnimation = function doLockAnimation2() {
setLockAnimation(Date.now());
};
var clearTouchMoving = function clearTouchMoving2() {
clearTimeout(touchMovingRef.value);
};
var doMove = function doMove2(setState2, offset3) {
setState2(function(value2) {
var newValue = alignInRange(value2 + offset3);
return newValue;
});
};
useTouchMove(tabsWrapperRef, function(offsetX, offsetY) {
if (tabPositionTopOrBottom.value) {
if (wrapperWidth.value >= wrapperScrollWidth.value) {
return false;
}
doMove(setTransformLeft, offsetX);
} else {
if (wrapperHeight.value >= wrapperScrollHeight.value) {
return false;
}
doMove(setTransformTop, offsetY);
}
clearTouchMoving();
doLockAnimation();
return true;
});
watch(lockAnimation, function() {
clearTouchMoving();
if (lockAnimation.value) {
touchMovingRef.value = setTimeout(function() {
setLockAnimation(0);
}, 100);
}
});
var scrollToTab = function scrollToTab2() {
var key2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : props3.activeKey;
var tabOffset = tabOffsets.value.get(key2) || {
width: 0,
height: 0,
left: 0,
right: 0,
top: 0
};
if (tabPositionTopOrBottom.value) {
var newTransform = transformLeft.value;
if (props3.rtl) {
if (tabOffset.right < transformLeft.value) {
newTransform = tabOffset.right;
} else if (tabOffset.right + tabOffset.width > transformLeft.value + wrapperWidth.value) {
newTransform = tabOffset.right + tabOffset.width - wrapperWidth.value;
}
} else if (tabOffset.left < -transformLeft.value) {
newTransform = -tabOffset.left;
} else if (tabOffset.left + tabOffset.width > -transformLeft.value + wrapperWidth.value) {
newTransform = -(tabOffset.left + tabOffset.width - wrapperWidth.value);
}
setTransformTop(0);
setTransformLeft(alignInRange(newTransform));
} else {
var _newTransform = transformTop.value;
if (tabOffset.top < -transformTop.value) {
_newTransform = -tabOffset.top;
} else if (tabOffset.top + tabOffset.height > -transformTop.value + wrapperHeight.value) {
_newTransform = -(tabOffset.top + tabOffset.height - wrapperHeight.value);
}
setTransformLeft(0);
setTransformTop(alignInRange(_newTransform));
}
};
var visibleStart = ref(0);
var visibleEnd = ref(0);
watchEffect(function() {
var _ref3;
var unit;
var position;
var transformSize;
var basicSize;
var tabContentSize;
var addSize;
var tabOffsetsValue = tabOffsets.value;
if (["top", "bottom"].includes(props3.tabPosition)) {
unit = "width";
basicSize = wrapperWidth.value;
tabContentSize = wrapperScrollWidth.value;
addSize = addWidth.value;
position = props3.rtl ? "right" : "left";
transformSize = Math.abs(transformLeft.value);
} else {
unit = "height";
basicSize = wrapperHeight.value;
tabContentSize = wrapperScrollWidth.value;
addSize = addHeight.value;
position = "top";
transformSize = -transformTop.value;
}
var mergedBasicSize = basicSize;
if (tabContentSize + addSize > basicSize && tabContentSize < basicSize) {
mergedBasicSize = basicSize - addSize;
}
var tabsVal = tabs.value;
if (!tabsVal.length) {
var _ref2;
return _ref2 = [0, 0], visibleStart.value = _ref2[0], visibleEnd.value = _ref2[1], _ref2;
}
var len = tabsVal.length;
var endIndex = len;
for (var i2 = 0; i2 < len; i2 += 1) {
var offset3 = tabOffsetsValue.get(tabsVal[i2].key) || DEFAULT_SIZE;
if (offset3[position] + offset3[unit] > transformSize + mergedBasicSize) {
endIndex = i2 - 1;
break;
}
}
var startIndex = 0;
for (var _i = len - 1; _i >= 0; _i -= 1) {
var _offset = tabOffsetsValue.get(tabsVal[_i].key) || DEFAULT_SIZE;
if (_offset[position] < transformSize) {
startIndex = _i + 1;
break;
}
}
return _ref3 = [startIndex, endIndex], visibleStart.value = _ref3[0], visibleEnd.value = _ref3[1], _ref3;
});
var onListHolderResize = function onListHolderResize2() {
var _tabsWrapperRef$value, _tabsWrapperRef$value2, _innerAddButtonRef$va, _tabListRef$value, _tabListRef$value2;
var offsetWidth = ((_tabsWrapperRef$value = tabsWrapperRef.value) === null || _tabsWrapperRef$value === void 0 ? void 0 : _tabsWrapperRef$value.offsetWidth) || 0;
var offsetHeight = ((_tabsWrapperRef$value2 = tabsWrapperRef.value) === null || _tabsWrapperRef$value2 === void 0 ? void 0 : _tabsWrapperRef$value2.offsetHeight) || 0;
var addDom = ((_innerAddButtonRef$va = innerAddButtonRef.value) === null || _innerAddButtonRef$va === void 0 ? void 0 : _innerAddButtonRef$va.$el) || {};
var newAddWidth = addDom.offsetWidth || 0;
var newAddHeight = addDom.offsetHeight || 0;
setWrapperWidth(offsetWidth);
setWrapperHeight(offsetHeight);
setAddWidth(newAddWidth);
setAddHeight(newAddHeight);
var newWrapperScrollWidth = (((_tabListRef$value = tabListRef.value) === null || _tabListRef$value === void 0 ? void 0 : _tabListRef$value.offsetWidth) || 0) - newAddWidth;
var newWrapperScrollHeight = (((_tabListRef$value2 = tabListRef.value) === null || _tabListRef$value2 === void 0 ? void 0 : _tabListRef$value2.offsetHeight) || 0) - newAddHeight;
setWrapperScrollWidth(newWrapperScrollWidth);
setWrapperScrollHeight(newWrapperScrollHeight);
setTabSizes(function() {
var newSizes = /* @__PURE__ */ new Map();
tabs.value.forEach(function(_ref4) {
var key2 = _ref4.key;
var btnRef = btnRefs.value.get(key2);
var btnNode = (btnRef === null || btnRef === void 0 ? void 0 : btnRef.$el) || btnRef;
if (btnNode) {
newSizes.set(key2, {
width: btnNode.offsetWidth,
height: btnNode.offsetHeight,
left: btnNode.offsetLeft,
top: btnNode.offsetTop
});
}
});
return newSizes;
});
};
var hiddenTabs = computed(function() {
return [].concat(_toConsumableArray(tabs.value.slice(0, visibleStart.value)), _toConsumableArray(tabs.value.slice(visibleEnd.value + 1)));
});
var _useState15 = useState(), _useState16 = _slicedToArray$2(_useState15, 2), inkStyle = _useState16[0], setInkStyle = _useState16[1];
var activeTabOffset = computed(function() {
return tabOffsets.value.get(props3.activeKey);
});
var inkBarRafRef = ref();
var cleanInkBarRaf = function cleanInkBarRaf2() {
wrapperRaf.cancel(inkBarRafRef.value);
};
watch([activeTabOffset, tabPositionTopOrBottom, function() {
return props3.rtl;
}], function() {
var newInkStyle = {};
if (activeTabOffset.value) {
if (tabPositionTopOrBottom.value) {
if (props3.rtl) {
newInkStyle.right = toPx(activeTabOffset.value.right);
} else {
newInkStyle.left = toPx(activeTabOffset.value.left);
}
newInkStyle.width = toPx(activeTabOffset.value.width);
} else {
newInkStyle.top = toPx(activeTabOffset.value.top);
newInkStyle.height = toPx(activeTabOffset.value.height);
}
}
cleanInkBarRaf();
inkBarRafRef.value = wrapperRaf(function() {
setInkStyle(newInkStyle);
});
});
watch([function() {
return props3.activeKey;
}, activeTabOffset, tabOffsets, tabPositionTopOrBottom], function() {
scrollToTab();
}, {
flush: "post"
});
watch([function() {
return props3.rtl;
}, function() {
return props3.tabBarGutter;
}, function() {
return props3.activeKey;
}, function() {
return tabs.value;
}], function() {
onListHolderResize();
}, {
flush: "post"
});
var ExtraContent = function ExtraContent2(_ref5) {
var position = _ref5.position, prefixCls2 = _ref5.prefixCls, extra = _ref5.extra;
if (!extra)
return null;
var content = extra === null || extra === void 0 ? void 0 : extra({
position
});
return content ? createVNode("div", {
"class": "".concat(prefixCls2, "-extra-content")
}, [content]) : null;
};
onBeforeUnmount(function() {
clearTouchMoving();
cleanInkBarRaf();
});
return function() {
var _classNames;
var id = props3.id, animated = props3.animated, activeKey = props3.activeKey, rtl2 = props3.rtl, editable = props3.editable, locale3 = props3.locale, tabPosition = props3.tabPosition, tabBarGutter = props3.tabBarGutter, onTabClick = props3.onTabClick;
var className = attrs.class, style = attrs.style;
var pre = prefixCls.value;
var hasDropdown = !!hiddenTabs.value.length;
var wrapPrefix = "".concat(pre, "-nav-wrap");
var pingLeft;
var pingRight;
var pingTop;
var pingBottom;
if (tabPositionTopOrBottom.value) {
if (rtl2) {
pingRight = transformLeft.value > 0;
pingLeft = transformLeft.value + wrapperWidth.value < wrapperScrollWidth.value;
} else {
pingLeft = transformLeft.value < 0;
pingRight = -transformLeft.value + wrapperWidth.value < wrapperScrollWidth.value;
}
} else {
pingTop = transformTop.value < 0;
pingBottom = -transformTop.value + wrapperHeight.value < wrapperScrollHeight.value;
}
var tabNodeStyle = {};
if (tabPosition === "top" || tabPosition === "bottom") {
tabNodeStyle[rtl2 ? "marginRight" : "marginLeft"] = typeof tabBarGutter === "number" ? "".concat(tabBarGutter, "px") : tabBarGutter;
} else {
tabNodeStyle.marginTop = typeof tabBarGutter === "number" ? "".concat(tabBarGutter, "px") : tabBarGutter;
}
var tabNodes = tabs.value.map(function(tab, i2) {
var key2 = tab.key;
return createVNode(TabNode, {
"id": id,
"prefixCls": pre,
"key": key2,
"tab": tab,
"style": i2 === 0 ? void 0 : tabNodeStyle,
"closable": tab.closable,
"editable": editable,
"active": key2 === activeKey,
"removeAriaLabel": locale3 === null || locale3 === void 0 ? void 0 : locale3.removeAriaLabel,
"ref": setRef(key2),
"onClick": function onClick2(e2) {
onTabClick(key2, e2);
},
"onFocus": function onFocus2() {
scrollToTab(key2);
doLockAnimation();
if (!tabsWrapperRef.value) {
return;
}
if (!rtl2) {
tabsWrapperRef.value.scrollLeft = 0;
}
tabsWrapperRef.value.scrollTop = 0;
}
}, slots);
});
return createVNode("div", {
"role": "tablist",
"class": classNames("".concat(pre, "-nav"), className),
"style": style,
"onKeydown": function onKeydown() {
doLockAnimation();
}
}, [createVNode(ExtraContent, {
"position": "left",
"prefixCls": pre,
"extra": slots.leftExtra
}, null), createVNode(ResizeObserver$1, {
"onResize": onListHolderResize
}, {
default: function _default3() {
return [createVNode("div", {
"class": classNames(wrapPrefix, (_classNames = {}, _defineProperty$q(_classNames, "".concat(wrapPrefix, "-ping-left"), pingLeft), _defineProperty$q(_classNames, "".concat(wrapPrefix, "-ping-right"), pingRight), _defineProperty$q(_classNames, "".concat(wrapPrefix, "-ping-top"), pingTop), _defineProperty$q(_classNames, "".concat(wrapPrefix, "-ping-bottom"), pingBottom), _classNames)),
"ref": tabsWrapperRef
}, [createVNode(ResizeObserver$1, {
"onResize": onListHolderResize
}, {
default: function _default4() {
return [createVNode("div", {
"ref": tabListRef,
"class": "".concat(pre, "-nav-list"),
"style": {
transform: "translate(".concat(transformLeft.value, "px, ").concat(transformTop.value, "px)"),
transition: lockAnimation.value ? "none" : void 0
}
}, [tabNodes, createVNode(AddButton, {
"ref": innerAddButtonRef,
"prefixCls": pre,
"locale": locale3,
"editable": editable,
"style": _objectSpread2$1(_objectSpread2$1({}, tabNodes.length === 0 ? void 0 : tabNodeStyle), {}, {
visibility: hasDropdown ? "hidden" : null
})
}, null), createVNode("div", {
"class": classNames("".concat(pre, "-ink-bar"), _defineProperty$q({}, "".concat(pre, "-ink-bar-animated"), animated.inkBar)),
"style": inkStyle.value
}, null)])];
}
})])];
}
}), createVNode(OperationNode, _objectSpread2$1(_objectSpread2$1({}, props3), {}, {
"removeAriaLabel": locale3 === null || locale3 === void 0 ? void 0 : locale3.removeAriaLabel,
"ref": operationsRef,
"prefixCls": pre,
"tabs": hiddenTabs.value,
"class": !hasDropdown && operationsHiddenClassName.value
}), pick$2(slots, ["moreIcon"])), createVNode(ExtraContent, {
"position": "right",
"prefixCls": pre,
"extra": slots.rightExtra
}, null), createVNode(ExtraContent, {
"position": "right",
"prefixCls": pre,
"extra": slots.tabBarExtraContent
}, null)]);
};
}
});
const TabPanelList = defineComponent({
compatConfig: {
MODE: 3
},
name: "TabPanelList",
inheritAttrs: false,
props: {
activeKey: {
type: [String, Number]
},
id: {
type: String
},
rtl: {
type: Boolean
},
animated: {
type: Object,
default: void 0
},
tabPosition: {
type: String
},
destroyInactiveTabPane: {
type: Boolean
}
},
setup: function setup61(props3) {
var _useInjectTabs = useInjectTabs(), tabs = _useInjectTabs.tabs, prefixCls = _useInjectTabs.prefixCls;
return function() {
var id = props3.id, activeKey = props3.activeKey, animated = props3.animated, tabPosition = props3.tabPosition, rtl2 = props3.rtl, destroyInactiveTabPane = props3.destroyInactiveTabPane;
var tabPaneAnimated = animated.tabPane;
var pre = prefixCls.value;
var activeIndex = tabs.value.findIndex(function(tab) {
return tab.key === activeKey;
});
return createVNode("div", {
"class": "".concat(pre, "-content-holder")
}, [createVNode("div", {
"class": ["".concat(pre, "-content"), "".concat(pre, "-content-").concat(tabPosition), _defineProperty$q({}, "".concat(pre, "-content-animated"), tabPaneAnimated)],
"style": activeIndex && tabPaneAnimated ? _defineProperty$q({}, rtl2 ? "marginRight" : "marginLeft", "-".concat(activeIndex, "00%")) : null
}, [tabs.value.map(function(tab) {
return cloneElement(tab.node, {
key: tab.key,
prefixCls: pre,
tabKey: tab.key,
id,
animated: tabPaneAnimated,
active: tab.key === activeKey,
destroyInactiveTabPane
});
})])]);
};
}
});
var PlusOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" } }, { "tag": "path", "attrs": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" } }] }, "name": "plus", "theme": "outlined" };
const PlusOutlinedSvg = PlusOutlined$2;
function _objectSpread$6(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$6(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$6(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var PlusOutlined = function PlusOutlined2(props3, context) {
var p = _objectSpread$6({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$6({}, p, {
"icon": PlusOutlinedSvg
}), null);
};
PlusOutlined.displayName = "PlusOutlined";
PlusOutlined.inheritAttrs = false;
const PlusOutlined$1 = PlusOutlined;
var uuid$2 = 0;
var tabsProps = function tabsProps2() {
return {
prefixCls: {
type: String
},
id: {
type: String
},
activeKey: {
type: [String, Number]
},
defaultActiveKey: {
type: [String, Number]
},
direction: {
type: String
},
animated: {
type: [Boolean, Object]
},
renderTabBar: {
type: Function
},
tabBarGutter: {
type: Number
},
tabBarStyle: {
type: Object
},
tabPosition: {
type: String
},
destroyInactiveTabPane: {
type: Boolean
},
hideAdd: Boolean,
type: {
type: String
},
size: {
type: String
},
centered: Boolean,
onEdit: {
type: Function
},
onChange: {
type: Function
},
onTabClick: {
type: Function
},
onTabScroll: {
type: Function
},
"onUpdate:activeKey": {
type: Function
},
// Accessibility
locale: {
type: Object,
default: void 0
},
onPrevClick: Function,
onNextClick: Function,
tabBarExtraContent: PropTypes$1.any
};
};
function parseTabList(children) {
return children.map(function(node) {
if (isValidElement(node)) {
var props3 = _objectSpread2$1({}, node.props || {});
for (var _i = 0, _Object$entries = Object.entries(props3); _i < _Object$entries.length; _i++) {
var _Object$entries$_i = _slicedToArray$2(_Object$entries[_i], 2), k2 = _Object$entries$_i[0], v2 = _Object$entries$_i[1];
delete props3[k2];
props3[camelize$1(k2)] = v2;
}
var slots = node.children || {};
var key2 = node.key !== void 0 ? node.key : void 0;
var _props$tab = props3.tab, tab = _props$tab === void 0 ? slots.tab : _props$tab, disabled = props3.disabled, forceRender = props3.forceRender, closable = props3.closable, animated = props3.animated, active = props3.active, destroyInactiveTabPane = props3.destroyInactiveTabPane;
return _objectSpread2$1(_objectSpread2$1({
key: key2
}, props3), {}, {
node,
closeIcon: slots.closeIcon,
tab,
disabled: disabled === "" || disabled,
forceRender: forceRender === "" || forceRender,
closable: closable === "" || closable,
animated: animated === "" || animated,
active: active === "" || active,
destroyInactiveTabPane: destroyInactiveTabPane === "" || destroyInactiveTabPane
});
}
return null;
}).filter(function(tab) {
return tab;
});
}
var InternalTabs = defineComponent({
compatConfig: {
MODE: 3
},
name: "InternalTabs",
inheritAttrs: false,
props: _objectSpread2$1(_objectSpread2$1({}, initDefaultProps$1(tabsProps(), {
tabPosition: "top",
animated: {
inkBar: true,
tabPane: false
}
})), {}, {
tabs: {
type: Array
}
}),
slots: ["tabBarExtraContent", "leftExtra", "rightExtra", "moreIcon", "addIcon", "removeIcon", "renderTabBar"],
// emits: ['tabClick', 'tabScroll', 'change', 'update:activeKey'],
setup: function setup62(props3, _ref) {
var attrs = _ref.attrs, slots = _ref.slots;
devWarning(!(props3.onPrevClick !== void 0) && !(props3.onNextClick !== void 0), "Tabs", "`onPrevClick / @prevClick` and `onNextClick / @nextClick` has been removed. Please use `onTabScroll / @tabScroll` instead.");
devWarning(!(props3.tabBarExtraContent !== void 0), "Tabs", "`tabBarExtraContent` prop has been removed. Please use `rightExtra` slot instead.");
devWarning(!(slots.tabBarExtraContent !== void 0), "Tabs", "`tabBarExtraContent` slot is deprecated. Please use `rightExtra` slot instead.");
var _useConfigInject = useConfigInject("tabs", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction, size = _useConfigInject.size, rootPrefixCls = _useConfigInject.rootPrefixCls;
var rtl2 = computed(function() {
return direction.value === "rtl";
});
var mergedAnimated = computed(function() {
var animated = props3.animated, tabPosition = props3.tabPosition;
if (animated === false || ["left", "right"].includes(tabPosition)) {
return {
inkBar: false,
tabPane: false
};
} else if (animated === true) {
return {
inkBar: true,
tabPane: true
};
} else {
return _objectSpread2$1({
inkBar: true,
tabPane: false
}, _typeof$2(animated) === "object" ? animated : {});
}
});
var _useState = useState(false), _useState2 = _slicedToArray$2(_useState, 2), mobile = _useState2[0], setMobile = _useState2[1];
onMounted(function() {
setMobile(isMobile$2());
});
var _useMergedState = useMergedState(function() {
var _props$tabs$;
return (_props$tabs$ = props3.tabs[0]) === null || _props$tabs$ === void 0 ? void 0 : _props$tabs$.key;
}, {
value: computed(function() {
return props3.activeKey;
}),
defaultValue: props3.defaultActiveKey
}), _useMergedState2 = _slicedToArray$2(_useMergedState, 2), mergedActiveKey = _useMergedState2[0], setMergedActiveKey = _useMergedState2[1];
var _useState3 = useState(function() {
return props3.tabs.findIndex(function(tab) {
return tab.key === mergedActiveKey.value;
});
}), _useState4 = _slicedToArray$2(_useState3, 2), activeIndex = _useState4[0], setActiveIndex = _useState4[1];
watchEffect(function() {
var newActiveIndex = props3.tabs.findIndex(function(tab) {
return tab.key === mergedActiveKey.value;
});
if (newActiveIndex === -1) {
var _props$tabs$newActive;
newActiveIndex = Math.max(0, Math.min(activeIndex.value, props3.tabs.length - 1));
setMergedActiveKey((_props$tabs$newActive = props3.tabs[newActiveIndex]) === null || _props$tabs$newActive === void 0 ? void 0 : _props$tabs$newActive.key);
}
setActiveIndex(newActiveIndex);
});
var _useMergedState3 = useMergedState(null, {
value: computed(function() {
return props3.id;
})
}), _useMergedState4 = _slicedToArray$2(_useMergedState3, 2), mergedId = _useMergedState4[0], setMergedId = _useMergedState4[1];
var mergedTabPosition = computed(function() {
if (mobile.value && !["left", "right"].includes(props3.tabPosition)) {
return "top";
} else {
return props3.tabPosition;
}
});
onMounted(function() {
if (!props3.id) {
setMergedId("rc-tabs-".concat(process.env.NODE_ENV === "test" ? "test" : uuid$2));
uuid$2 += 1;
}
});
var onInternalTabClick = function onInternalTabClick2(key2, e2) {
var _props$onTabClick;
(_props$onTabClick = props3.onTabClick) === null || _props$onTabClick === void 0 ? void 0 : _props$onTabClick.call(props3, key2, e2);
var isActiveChanged = key2 !== mergedActiveKey.value;
setMergedActiveKey(key2);
if (isActiveChanged) {
var _props$onChange;
(_props$onChange = props3.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props3, key2);
}
};
useProvideTabs({
tabs: computed(function() {
return props3.tabs;
}),
prefixCls
});
return function() {
var _classNames;
var id = props3.id, type = props3.type, tabBarGutter = props3.tabBarGutter, tabBarStyle = props3.tabBarStyle, locale3 = props3.locale, destroyInactiveTabPane = props3.destroyInactiveTabPane, _props$renderTabBar = props3.renderTabBar, renderTabBar = _props$renderTabBar === void 0 ? slots.renderTabBar : _props$renderTabBar, onTabScroll = props3.onTabScroll, hideAdd = props3.hideAdd, centered = props3.centered;
var sharedProps = {
id: mergedId.value,
activeKey: mergedActiveKey.value,
animated: mergedAnimated.value,
tabPosition: mergedTabPosition.value,
rtl: rtl2.value,
mobile: mobile.value
};
var editable;
if (type === "editable-card") {
editable = {
onEdit: function onEdit(editType, _ref2) {
var _props$onEdit;
var key2 = _ref2.key, event = _ref2.event;
(_props$onEdit = props3.onEdit) === null || _props$onEdit === void 0 ? void 0 : _props$onEdit.call(props3, editType === "add" ? event : key2, editType);
},
removeIcon: function removeIcon() {
return createVNode(CloseOutlined$1, null, null);
},
addIcon: slots.addIcon ? slots.addIcon : function() {
return createVNode(PlusOutlined$1, null, null);
},
showAdd: hideAdd !== true
};
}
var tabNavBar;
var tabNavBarProps = _objectSpread2$1(_objectSpread2$1({}, sharedProps), {}, {
moreTransitionName: "".concat(rootPrefixCls.value, "-slide-up"),
editable,
locale: locale3,
tabBarGutter,
onTabClick: onInternalTabClick,
onTabScroll,
style: tabBarStyle
});
if (renderTabBar) {
tabNavBar = renderTabBar(_objectSpread2$1(_objectSpread2$1({}, tabNavBarProps), {}, {
DefaultTabBar: TabNavList
}));
} else {
tabNavBar = createVNode(TabNavList, tabNavBarProps, pick$2(slots, ["moreIcon", "leftExtra", "rightExtra", "tabBarExtraContent"]));
}
var pre = prefixCls.value;
return createVNode("div", _objectSpread2$1(_objectSpread2$1({}, attrs), {}, {
"id": id,
"class": classNames(pre, "".concat(pre, "-").concat(mergedTabPosition.value), (_classNames = {}, _defineProperty$q(_classNames, "".concat(pre, "-").concat(size.value), size.value), _defineProperty$q(_classNames, "".concat(pre, "-card"), ["card", "editable-card"].includes(type)), _defineProperty$q(_classNames, "".concat(pre, "-editable-card"), type === "editable-card"), _defineProperty$q(_classNames, "".concat(pre, "-centered"), centered), _defineProperty$q(_classNames, "".concat(pre, "-mobile"), mobile.value), _defineProperty$q(_classNames, "".concat(pre, "-editable"), type === "editable-card"), _defineProperty$q(_classNames, "".concat(pre, "-rtl"), rtl2.value), _classNames), attrs.class)
}), [tabNavBar, createVNode(TabPanelList, _objectSpread2$1(_objectSpread2$1({
"destroyInactiveTabPane": destroyInactiveTabPane
}, sharedProps), {}, {
"animated": mergedAnimated.value
}), null)]);
};
}
});
const Tabs = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATabs",
inheritAttrs: false,
props: initDefaultProps$1(tabsProps(), {
tabPosition: "top",
animated: {
inkBar: true,
tabPane: false
}
}),
slots: ["tabBarExtraContent", "leftExtra", "rightExtra", "moreIcon", "addIcon", "removeIcon", "renderTabBar"],
// emits: ['tabClick', 'tabScroll', 'change', 'update:activeKey'],
setup: function setup63(props3, _ref3) {
var attrs = _ref3.attrs, slots = _ref3.slots, emit = _ref3.emit;
var handleChange = function handleChange2(key2) {
emit("update:activeKey", key2);
emit("change", key2);
};
return function() {
var _slots$default;
var tabs = parseTabList(flattenChildren((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)));
return createVNode(InternalTabs, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, omit(props3, ["onUpdate:activeKey"])), attrs), {}, {
"onChange": handleChange,
"tabs": tabs
}), slots);
};
}
});
var tabPaneProps = function tabPaneProps2() {
return {
tab: PropTypes$1.any,
disabled: {
type: Boolean
},
forceRender: {
type: Boolean
},
closable: {
type: Boolean
},
animated: {
type: Boolean
},
active: {
type: Boolean
},
destroyInactiveTabPane: {
type: Boolean
},
// Pass by TabPaneList
prefixCls: {
type: String
},
tabKey: {
type: [String, Number]
},
id: {
type: String
}
// closeIcon: PropTypes.any,
};
};
const __unplugin_components_1$3 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATabPane",
inheritAttrs: false,
__ANT_TAB_PANE: true,
props: tabPaneProps(),
slots: ["closeIcon", "tab"],
setup: function setup64(props3, _ref) {
var attrs = _ref.attrs, slots = _ref.slots;
var visited = ref(props3.forceRender);
watch([function() {
return props3.active;
}, function() {
return props3.destroyInactiveTabPane;
}], function() {
if (props3.active) {
visited.value = true;
} else if (props3.destroyInactiveTabPane) {
visited.value = false;
}
}, {
immediate: true
});
var mergedStyle = computed(function() {
if (!props3.active) {
if (props3.animated) {
return {
visibility: "hidden",
height: 0,
overflowY: "hidden"
};
} else {
return {
display: "none"
};
}
}
return {};
});
return function() {
var _slots$default;
var prefixCls = props3.prefixCls, forceRender = props3.forceRender, id = props3.id, active = props3.active, tabKey = props3.tabKey;
return createVNode("div", {
"id": id && "".concat(id, "-panel-").concat(tabKey),
"role": "tabpanel",
"tabindex": active ? 0 : -1,
"aria-labelledby": id && "".concat(id, "-tab-").concat(tabKey),
"aria-hidden": !active,
"style": [mergedStyle.value, attrs.style],
"class": ["".concat(prefixCls, "-tabpane"), active && "".concat(prefixCls, "-tabpane-active"), attrs.class]
}, [(active || visited.value || forceRender) && ((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots))]);
};
}
});
Tabs.TabPane = __unplugin_components_1$3;
Tabs.install = function(app) {
app.component(Tabs.name, Tabs);
app.component(__unplugin_components_1$3.name, __unplugin_components_1$3);
return app;
};
var canUseDocElement = function canUseDocElement2() {
return canUseDom() && window.document.documentElement;
};
var flexGapSupported;
var detectFlexGapSupported = function detectFlexGapSupported2() {
if (!canUseDocElement()) {
return false;
}
if (flexGapSupported !== void 0) {
return flexGapSupported;
}
var flex = document.createElement("div");
flex.style.display = "flex";
flex.style.flexDirection = "column";
flex.style.rowGap = "1px";
flex.appendChild(document.createElement("div"));
flex.appendChild(document.createElement("div"));
document.body.appendChild(flex);
flexGapSupported = flex.scrollHeight === 1;
document.body.removeChild(flex);
return flexGapSupported;
};
const useFlexGapSupport = function() {
var flexible = ref(false);
onMounted(function() {
flexible.value = detectFlexGapSupported();
});
return flexible;
};
var RowContextKey = Symbol("rowContextKey");
var useProvideRow = function useProvideRow2(state) {
provide(RowContextKey, state);
};
var useInjectRow = function useInjectRow2() {
return inject(RowContextKey, {
gutter: computed(function() {
return void 0;
}),
wrap: computed(function() {
return void 0;
}),
supportFlexGap: computed(function() {
return void 0;
})
});
};
tuple$1("top", "middle", "bottom", "stretch");
tuple$1("start", "end", "center", "space-around", "space-between");
var rowProps = function rowProps2() {
return {
align: String,
justify: String,
prefixCls: String,
gutter: {
type: [Number, Array, Object],
default: 0
},
wrap: {
type: Boolean,
default: void 0
}
};
};
var ARow = defineComponent({
compatConfig: {
MODE: 3
},
name: "ARow",
props: rowProps(),
setup: function setup65(props3, _ref) {
var slots = _ref.slots;
var _useConfigInject = useConfigInject("row", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction;
var token2;
var screens2 = ref({
xs: true,
sm: true,
md: true,
lg: true,
xl: true,
xxl: true,
xxxl: true
});
var supportFlexGap = useFlexGapSupport();
onMounted(function() {
token2 = ResponsiveObserve.subscribe(function(screen) {
var currentGutter = props3.gutter || 0;
if (!Array.isArray(currentGutter) && _typeof$2(currentGutter) === "object" || Array.isArray(currentGutter) && (_typeof$2(currentGutter[0]) === "object" || _typeof$2(currentGutter[1]) === "object")) {
screens2.value = screen;
}
});
});
onBeforeUnmount(function() {
ResponsiveObserve.unsubscribe(token2);
});
var gutter = computed(function() {
var results = [0, 0];
var _props$gutter = props3.gutter, gutter2 = _props$gutter === void 0 ? 0 : _props$gutter;
var normalizedGutter = Array.isArray(gutter2) ? gutter2 : [gutter2, 0];
normalizedGutter.forEach(function(g2, index2) {
if (_typeof$2(g2) === "object") {
for (var i2 = 0; i2 < responsiveArray.length; i2++) {
var breakpoint = responsiveArray[i2];
if (screens2.value[breakpoint] && g2[breakpoint] !== void 0) {
results[index2] = g2[breakpoint];
break;
}
}
} else {
results[index2] = g2 || 0;
}
});
return results;
});
useProvideRow({
gutter,
supportFlexGap,
wrap: computed(function() {
return props3.wrap;
})
});
var classes = computed(function() {
var _classNames;
return classNames(prefixCls.value, (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls.value, "-no-wrap"), props3.wrap === false), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-").concat(props3.justify), props3.justify), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-").concat(props3.align), props3.align), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-rtl"), direction.value === "rtl"), _classNames));
});
var rowStyle = computed(function() {
var gt = gutter.value;
var style = {};
var horizontalGutter = gt[0] > 0 ? "".concat(gt[0] / -2, "px") : void 0;
var verticalGutter = gt[1] > 0 ? "".concat(gt[1] / -2, "px") : void 0;
if (horizontalGutter) {
style.marginLeft = horizontalGutter;
style.marginRight = horizontalGutter;
}
if (supportFlexGap.value) {
style.rowGap = "".concat(gt[1], "px");
} else if (verticalGutter) {
style.marginTop = verticalGutter;
style.marginBottom = verticalGutter;
}
return style;
});
return function() {
var _slots$default;
return createVNode("div", {
"class": classes.value,
"style": rowStyle.value
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]);
};
}
});
const Row$1 = ARow;
function parseFlex(flex) {
if (typeof flex === "number") {
return "".concat(flex, " ").concat(flex, " auto");
}
if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flex)) {
return "0 0 ".concat(flex);
}
return flex;
}
var colProps = function colProps2() {
return {
span: [String, Number],
order: [String, Number],
offset: [String, Number],
push: [String, Number],
pull: [String, Number],
xs: {
type: [String, Number, Object],
default: void 0
},
sm: {
type: [String, Number, Object],
default: void 0
},
md: {
type: [String, Number, Object],
default: void 0
},
lg: {
type: [String, Number, Object],
default: void 0
},
xl: {
type: [String, Number, Object],
default: void 0
},
xxl: {
type: [String, Number, Object],
default: void 0
},
xxxl: {
type: [String, Number, Object],
default: void 0
},
prefixCls: String,
flex: [String, Number]
};
};
const Col$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACol",
props: colProps(),
setup: function setup66(props3, _ref) {
var slots = _ref.slots;
var _useInjectRow = useInjectRow(), gutter = _useInjectRow.gutter, supportFlexGap = _useInjectRow.supportFlexGap, wrap = _useInjectRow.wrap;
var _useConfigInject = useConfigInject("col", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction;
var classes = computed(function() {
var _classNames;
var span = props3.span, order = props3.order, offset3 = props3.offset, push = props3.push, pull = props3.pull;
var pre = prefixCls.value;
var sizeClassObj = {};
["xs", "sm", "md", "lg", "xl", "xxl", "xxxl"].forEach(function(size) {
var _objectSpread22;
var sizeProps = {};
var propSize = props3[size];
if (typeof propSize === "number") {
sizeProps.span = propSize;
} else if (_typeof$2(propSize) === "object") {
sizeProps = propSize || {};
}
sizeClassObj = _objectSpread2$1(_objectSpread2$1({}, sizeClassObj), {}, (_objectSpread22 = {}, _defineProperty$q(_objectSpread22, "".concat(pre, "-").concat(size, "-").concat(sizeProps.span), sizeProps.span !== void 0), _defineProperty$q(_objectSpread22, "".concat(pre, "-").concat(size, "-order-").concat(sizeProps.order), sizeProps.order || sizeProps.order === 0), _defineProperty$q(_objectSpread22, "".concat(pre, "-").concat(size, "-offset-").concat(sizeProps.offset), sizeProps.offset || sizeProps.offset === 0), _defineProperty$q(_objectSpread22, "".concat(pre, "-").concat(size, "-push-").concat(sizeProps.push), sizeProps.push || sizeProps.push === 0), _defineProperty$q(_objectSpread22, "".concat(pre, "-").concat(size, "-pull-").concat(sizeProps.pull), sizeProps.pull || sizeProps.pull === 0), _defineProperty$q(_objectSpread22, "".concat(pre, "-rtl"), direction.value === "rtl"), _objectSpread22));
});
return classNames(pre, (_classNames = {}, _defineProperty$q(_classNames, "".concat(pre, "-").concat(span), span !== void 0), _defineProperty$q(_classNames, "".concat(pre, "-order-").concat(order), order), _defineProperty$q(_classNames, "".concat(pre, "-offset-").concat(offset3), offset3), _defineProperty$q(_classNames, "".concat(pre, "-push-").concat(push), push), _defineProperty$q(_classNames, "".concat(pre, "-pull-").concat(pull), pull), _classNames), sizeClassObj);
});
var mergedStyle = computed(function() {
var flex = props3.flex;
var gutterVal = gutter.value;
var style = {};
if (gutterVal && gutterVal[0] > 0) {
var horizontalGutter = "".concat(gutterVal[0] / 2, "px");
style.paddingLeft = horizontalGutter;
style.paddingRight = horizontalGutter;
}
if (gutterVal && gutterVal[1] > 0 && !supportFlexGap.value) {
var verticalGutter = "".concat(gutterVal[1] / 2, "px");
style.paddingTop = verticalGutter;
style.paddingBottom = verticalGutter;
}
if (flex) {
style.flex = parseFlex(flex);
if (wrap.value === false && !style.minWidth) {
style.minWidth = 0;
}
}
return style;
});
return function() {
var _slots$default;
return createVNode("div", {
"class": classes.value,
"style": mergedStyle.value
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]);
};
}
});
const Row = withInstall(Row$1);
const Col = withInstall(Col$1);
var TabPane = Tabs.TabPane;
var cardProps = function cardProps2() {
return {
prefixCls: String,
title: PropTypes$1.any,
extra: PropTypes$1.any,
bordered: {
type: Boolean,
default: true
},
bodyStyle: {
type: Object,
default: void 0
},
headStyle: {
type: Object,
default: void 0
},
loading: {
type: Boolean,
default: false
},
hoverable: {
type: Boolean,
default: false
},
type: {
type: String
},
size: {
type: String
},
actions: PropTypes$1.any,
tabList: {
type: Array
},
tabBarExtraContent: PropTypes$1.any,
activeTabKey: String,
defaultActiveTabKey: String,
cover: PropTypes$1.any,
onTabChange: {
type: Function
}
};
};
var Card = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACard",
props: cardProps(),
slots: ["title", "extra", "tabBarExtraContent", "actions", "cover", "customTab"],
setup: function setup67(props3, _ref) {
var slots = _ref.slots;
var _useConfigInject = useConfigInject("card", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction, size = _useConfigInject.size;
var getAction = function getAction2(actions) {
var actionList = actions.map(function(action, index2) {
return isVNode$1(action) && !isEmptyElement(action) || !isVNode$1(action) ? createVNode("li", {
"style": {
width: "".concat(100 / actions.length, "%")
},
"key": "action-".concat(index2)
}, [createVNode("span", null, [action])]) : null;
});
return actionList;
};
var triggerTabChange = function triggerTabChange2(key2) {
var _props$onTabChange;
(_props$onTabChange = props3.onTabChange) === null || _props$onTabChange === void 0 ? void 0 : _props$onTabChange.call(props3, key2);
};
var isContainGrid = function isContainGrid2() {
var obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
var containGrid;
obj.forEach(function(element) {
if (element && isPlainObject$1(element.type) && element.type.__ANT_CARD_GRID) {
containGrid = true;
}
});
return containGrid;
};
return function() {
var _slots$tabBarExtraCon, _slots$title, _slots$extra, _slots$actions, _slots$cover, _slots$default, _classString, _tabsProps;
var _props$headStyle = props3.headStyle, headStyle = _props$headStyle === void 0 ? {} : _props$headStyle, _props$bodyStyle = props3.bodyStyle, bodyStyle = _props$bodyStyle === void 0 ? {} : _props$bodyStyle, loading = props3.loading, _props$bordered = props3.bordered, bordered = _props$bordered === void 0 ? true : _props$bordered, type = props3.type, tabList = props3.tabList, hoverable = props3.hoverable, activeTabKey = props3.activeTabKey, defaultActiveTabKey = props3.defaultActiveTabKey, _props$tabBarExtraCon = props3.tabBarExtraContent, tabBarExtraContent = _props$tabBarExtraCon === void 0 ? filterEmptyWithUndefined((_slots$tabBarExtraCon = slots.tabBarExtraContent) === null || _slots$tabBarExtraCon === void 0 ? void 0 : _slots$tabBarExtraCon.call(slots)) : _props$tabBarExtraCon, _props$title = props3.title, title = _props$title === void 0 ? filterEmptyWithUndefined((_slots$title = slots.title) === null || _slots$title === void 0 ? void 0 : _slots$title.call(slots)) : _props$title, _props$extra = props3.extra, extra = _props$extra === void 0 ? filterEmptyWithUndefined((_slots$extra = slots.extra) === null || _slots$extra === void 0 ? void 0 : _slots$extra.call(slots)) : _props$extra, _props$actions = props3.actions, actions = _props$actions === void 0 ? filterEmptyWithUndefined((_slots$actions = slots.actions) === null || _slots$actions === void 0 ? void 0 : _slots$actions.call(slots)) : _props$actions, _props$cover = props3.cover, cover = _props$cover === void 0 ? filterEmptyWithUndefined((_slots$cover = slots.cover) === null || _slots$cover === void 0 ? void 0 : _slots$cover.call(slots)) : _props$cover;
var children = flattenChildren((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots));
var pre = prefixCls.value;
var classString = (_classString = {}, _defineProperty$q(_classString, "".concat(pre), true), _defineProperty$q(_classString, "".concat(pre, "-loading"), loading), _defineProperty$q(_classString, "".concat(pre, "-bordered"), bordered), _defineProperty$q(_classString, "".concat(pre, "-hoverable"), !!hoverable), _defineProperty$q(_classString, "".concat(pre, "-contain-grid"), isContainGrid(children)), _defineProperty$q(_classString, "".concat(pre, "-contain-tabs"), tabList && tabList.length), _defineProperty$q(_classString, "".concat(pre, "-").concat(size.value), size.value), _defineProperty$q(_classString, "".concat(pre, "-type-").concat(type), !!type), _defineProperty$q(_classString, "".concat(pre, "-rtl"), direction.value === "rtl"), _classString);
var loadingBlockStyle = bodyStyle.padding === 0 || bodyStyle.padding === "0px" ? {
padding: "24px"
} : void 0;
var block = createVNode("div", {
"class": "".concat(pre, "-loading-block")
}, null);
var loadingBlock = createVNode("div", {
"class": "".concat(pre, "-loading-content"),
"style": loadingBlockStyle
}, [createVNode(Row, {
"gutter": 8
}, {
default: function _default3() {
return [createVNode(Col, {
"span": 22
}, {
default: function _default4() {
return [block];
}
})];
}
}), createVNode(Row, {
"gutter": 8
}, {
default: function _default3() {
return [createVNode(Col, {
"span": 8
}, {
default: function _default4() {
return [block];
}
}), createVNode(Col, {
"span": 15
}, {
default: function _default4() {
return [block];
}
})];
}
}), createVNode(Row, {
"gutter": 8
}, {
default: function _default3() {
return [createVNode(Col, {
"span": 6
}, {
default: function _default4() {
return [block];
}
}), createVNode(Col, {
"span": 18
}, {
default: function _default4() {
return [block];
}
})];
}
}), createVNode(Row, {
"gutter": 8
}, {
default: function _default3() {
return [createVNode(Col, {
"span": 13
}, {
default: function _default4() {
return [block];
}
}), createVNode(Col, {
"span": 9
}, {
default: function _default4() {
return [block];
}
})];
}
}), createVNode(Row, {
"gutter": 8
}, {
default: function _default3() {
return [createVNode(Col, {
"span": 4
}, {
default: function _default4() {
return [block];
}
}), createVNode(Col, {
"span": 3
}, {
default: function _default4() {
return [block];
}
}), createVNode(Col, {
"span": 16
}, {
default: function _default4() {
return [block];
}
})];
}
})]);
var hasActiveTabKey = activeTabKey !== void 0;
var tabsProps3 = (_tabsProps = {
size: "large"
}, _defineProperty$q(_tabsProps, hasActiveTabKey ? "activeKey" : "defaultActiveKey", hasActiveTabKey ? activeTabKey : defaultActiveTabKey), _defineProperty$q(_tabsProps, "onChange", triggerTabChange), _defineProperty$q(_tabsProps, "class", "".concat(pre, "-head-tabs")), _tabsProps);
var head;
var tabs = tabList && tabList.length ? createVNode(Tabs, tabsProps3, {
default: function _default3() {
return [tabList.map(function(item) {
var temp = item.tab, itemSlots = item.slots;
var name = itemSlots === null || itemSlots === void 0 ? void 0 : itemSlots.tab;
devWarning(!itemSlots, "Card", "tabList slots is deprecated, Please use `customTab` instead.");
var tab = temp !== void 0 ? temp : slots[name] ? slots[name](item) : null;
tab = renderSlot(slots, "customTab", item, function() {
return [tab];
});
return createVNode(TabPane, {
"tab": tab,
"key": item.key,
"disabled": item.disabled
}, null);
})];
},
rightExtra: tabBarExtraContent ? function() {
return tabBarExtraContent;
} : null
}) : null;
if (title || extra || tabs) {
head = createVNode("div", {
"class": "".concat(pre, "-head"),
"style": headStyle
}, [createVNode("div", {
"class": "".concat(pre, "-head-wrapper")
}, [title && createVNode("div", {
"class": "".concat(pre, "-head-title")
}, [title]), extra && createVNode("div", {
"class": "".concat(pre, "-extra")
}, [extra])]), tabs]);
}
var coverDom = cover ? createVNode("div", {
"class": "".concat(pre, "-cover")
}, [cover]) : null;
var body = createVNode("div", {
"class": "".concat(pre, "-body"),
"style": bodyStyle
}, [loading ? loadingBlock : children]);
var actionDom = actions && actions.length ? createVNode("ul", {
"class": "".concat(pre, "-actions")
}, [getAction(actions)]) : null;
return createVNode("div", {
"class": classString,
"ref": "cardContainerRef"
}, [head, coverDom, children && children.length ? body : null, actionDom]);
};
}
});
const Card$1 = Card;
var cardMetaProps = function cardMetaProps2() {
return {
prefixCls: String,
title: PropTypes$1.any,
description: PropTypes$1.any,
avatar: PropTypes$1.any
};
};
const Meta = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACardMeta",
props: cardMetaProps(),
slots: ["title", "description", "avatar"],
setup: function setup68(props3, _ref) {
var slots = _ref.slots;
var _useConfigInject = useConfigInject("card", props3), prefixCls = _useConfigInject.prefixCls;
return function() {
var classString = _defineProperty$q({}, "".concat(prefixCls.value, "-meta"), true);
var avatar = getPropsSlot(slots, props3, "avatar");
var title = getPropsSlot(slots, props3, "title");
var description = getPropsSlot(slots, props3, "description");
var avatarDom = avatar ? createVNode("div", {
"class": "".concat(prefixCls.value, "-meta-avatar")
}, [avatar]) : null;
var titleDom = title ? createVNode("div", {
"class": "".concat(prefixCls.value, "-meta-title")
}, [title]) : null;
var descriptionDom = description ? createVNode("div", {
"class": "".concat(prefixCls.value, "-meta-description")
}, [description]) : null;
var MetaDetail = titleDom || descriptionDom ? createVNode("div", {
"class": "".concat(prefixCls.value, "-meta-detail")
}, [titleDom, descriptionDom]) : null;
return createVNode("div", {
"class": classString
}, [avatarDom, MetaDetail]);
};
}
});
var cardGridProps = function cardGridProps2() {
return {
prefixCls: String,
hoverable: {
type: Boolean,
default: true
}
};
};
const Grid = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACardGrid",
__ANT_CARD_GRID: true,
props: cardGridProps(),
setup: function setup69(props3, _ref) {
var slots = _ref.slots;
var _useConfigInject = useConfigInject("card", props3), prefixCls = _useConfigInject.prefixCls;
var classNames2 = computed(function() {
var _ref2;
return _ref2 = {}, _defineProperty$q(_ref2, "".concat(prefixCls.value, "-grid"), true), _defineProperty$q(_ref2, "".concat(prefixCls.value, "-grid-hoverable"), props3.hoverable), _ref2;
});
return function() {
var _slots$default;
return createVNode("div", {
"class": classNames2.value
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]);
};
}
});
Card$1.Meta = Meta;
Card$1.Grid = Grid;
Card$1.install = function(app) {
app.component(Card$1.name, Card$1);
app.component(Meta.name, Meta);
app.component(Grid.name, Grid);
return app;
};
var collapseProps = function collapseProps2() {
return {
prefixCls: String,
activeKey: {
type: [Array, Number, String]
},
defaultActiveKey: {
type: [Array, Number, String]
},
accordion: {
type: Boolean,
default: void 0
},
destroyInactivePanel: {
type: Boolean,
default: void 0
},
bordered: {
type: Boolean,
default: void 0
},
expandIcon: Function,
openAnimation: PropTypes$1.object,
expandIconPosition: PropTypes$1.oneOf(tuple$1("left", "right")),
collapsible: {
type: String
},
ghost: {
type: Boolean,
default: void 0
},
onChange: Function,
"onUpdate:activeKey": Function
};
};
var collapsePanelProps = function collapsePanelProps2() {
return {
openAnimation: PropTypes$1.object,
prefixCls: String,
header: PropTypes$1.any,
headerClass: String,
showArrow: {
type: Boolean,
default: void 0
},
isActive: {
type: Boolean,
default: void 0
},
destroyInactivePanel: {
type: Boolean,
default: void 0
},
/** @deprecated Use `collapsible="disabled"` instead */
disabled: {
type: Boolean,
default: void 0
},
accordion: {
type: Boolean,
default: void 0
},
forceRender: {
type: Boolean,
default: void 0
},
expandIcon: Function,
extra: PropTypes$1.any,
panelKey: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number]),
collapsible: {
type: String
},
role: String,
onItemClick: {
type: Function
}
};
};
function getActiveKeysArray(activeKey) {
var currentActiveKey = activeKey;
if (!Array.isArray(currentActiveKey)) {
var activeKeyType = _typeof$2(currentActiveKey);
currentActiveKey = activeKeyType === "number" || activeKeyType === "string" ? [currentActiveKey] : [];
}
return currentActiveKey.map(function(key2) {
return String(key2);
});
}
const Collapse = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACollapse",
inheritAttrs: false,
props: initDefaultProps$1(collapseProps(), {
accordion: false,
destroyInactivePanel: false,
bordered: true,
openAnimation: collapseMotion$1("ant-motion-collapse", false),
expandIconPosition: "left"
}),
slots: ["expandIcon"],
// emits: ['change', 'update:activeKey'],
setup: function setup70(props3, _ref) {
var attrs = _ref.attrs, slots = _ref.slots, emit = _ref.emit;
var stateActiveKey = ref(getActiveKeysArray(firstNotUndefined([props3.activeKey, props3.defaultActiveKey])));
watch(function() {
return props3.activeKey;
}, function() {
stateActiveKey.value = getActiveKeysArray(props3.activeKey);
}, {
deep: true
});
var _useConfigInject = useConfigInject("collapse", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction;
var iconPosition = computed(function() {
var expandIconPosition = props3.expandIconPosition;
if (expandIconPosition !== void 0) {
return expandIconPosition;
}
return direction.value === "rtl" ? "right" : "left";
});
var renderExpandIcon = function renderExpandIcon2(panelProps) {
var _props$expandIcon = props3.expandIcon, expandIcon = _props$expandIcon === void 0 ? slots.expandIcon : _props$expandIcon;
var icon = expandIcon ? expandIcon(panelProps) : createVNode(RightOutlined$1, {
"rotate": panelProps.isActive ? 90 : void 0
}, null);
return createVNode("div", null, [isValidElement(Array.isArray(expandIcon) ? icon[0] : icon) ? cloneElement(icon, {
class: "".concat(prefixCls.value, "-arrow")
}, false) : icon]);
};
var setActiveKey = function setActiveKey2(activeKey) {
if (props3.activeKey === void 0) {
stateActiveKey.value = activeKey;
}
var newKey = props3.accordion ? activeKey[0] : activeKey;
emit("update:activeKey", newKey);
emit("change", newKey);
};
var onClickItem = function onClickItem2(key2) {
var activeKey = stateActiveKey.value;
if (props3.accordion) {
activeKey = activeKey[0] === key2 ? [] : [key2];
} else {
activeKey = _toConsumableArray(activeKey);
var index2 = activeKey.indexOf(key2);
var isActive = index2 > -1;
if (isActive) {
activeKey.splice(index2, 1);
} else {
activeKey.push(key2);
}
}
setActiveKey(activeKey);
};
var getNewChild = function getNewChild2(child, index2) {
var _child$key, _child$children, _child$children$heade;
if (isEmptyElement(child))
return;
var activeKey = stateActiveKey.value;
var accordion = props3.accordion, destroyInactivePanel = props3.destroyInactivePanel, collapsible = props3.collapsible, openAnimation = props3.openAnimation;
var key2 = String((_child$key = child.key) !== null && _child$key !== void 0 ? _child$key : index2);
var _ref2 = child.props || {}, _ref2$header = _ref2.header, header = _ref2$header === void 0 ? (_child$children = child.children) === null || _child$children === void 0 ? void 0 : (_child$children$heade = _child$children.header) === null || _child$children$heade === void 0 ? void 0 : _child$children$heade.call(_child$children) : _ref2$header, headerClass = _ref2.headerClass, childCollapsible = _ref2.collapsible, disabled = _ref2.disabled;
var isActive = false;
if (accordion) {
isActive = activeKey[0] === key2;
} else {
isActive = activeKey.indexOf(key2) > -1;
}
var mergeCollapsible = childCollapsible !== null && childCollapsible !== void 0 ? childCollapsible : collapsible;
if (disabled || disabled === "") {
mergeCollapsible = "disabled";
}
var newProps = {
key: key2,
panelKey: key2,
header,
headerClass,
isActive,
prefixCls: prefixCls.value,
destroyInactivePanel,
openAnimation,
accordion,
onItemClick: mergeCollapsible === "disabled" ? null : onClickItem,
expandIcon: renderExpandIcon,
collapsible: mergeCollapsible
};
return cloneElement(child, newProps);
};
var getItems = function getItems2() {
var _slots$default;
return flattenChildren((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)).map(getNewChild);
};
return function() {
var _classNames;
var accordion = props3.accordion, bordered = props3.bordered, ghost = props3.ghost;
var collapseClassName = classNames((_classNames = {}, _defineProperty$q(_classNames, prefixCls.value, true), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-borderless"), !bordered), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-icon-position-").concat(iconPosition.value), true), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-rtl"), direction.value === "rtl"), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-ghost"), !!ghost), _defineProperty$q(_classNames, attrs.class, !!attrs.class), _classNames));
return createVNode("div", _objectSpread2$1(_objectSpread2$1({
"class": collapseClassName
}, getDataAndAriaProps(attrs)), {}, {
"style": attrs.style,
"role": accordion ? "tablist" : null
}), [getItems()]);
};
}
});
const PanelContent = defineComponent({
compatConfig: {
MODE: 3
},
name: "PanelContent",
props: collapsePanelProps(),
setup: function setup71(props3, _ref) {
var slots = _ref.slots;
var rendered = ref(false);
watchEffect(function() {
if (props3.isActive || props3.forceRender) {
rendered.value = true;
}
});
return function() {
var _classNames, _slots$default;
if (!rendered.value)
return null;
var prefixCls = props3.prefixCls, isActive = props3.isActive, role = props3.role;
return createVNode("div", {
"ref": ref,
"class": classNames("".concat(prefixCls, "-content"), (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls, "-content-active"), isActive), _defineProperty$q(_classNames, "".concat(prefixCls, "-content-inactive"), !isActive), _classNames)),
"role": role
}, [createVNode("div", {
"class": "".concat(prefixCls, "-content-box")
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)])]);
};
}
});
const __unplugin_components_1$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACollapsePanel",
inheritAttrs: false,
props: initDefaultProps$1(collapsePanelProps(), {
showArrow: true,
isActive: false,
onItemClick: function onItemClick() {
},
headerClass: "",
forceRender: false
}),
slots: ["expandIcon", "extra", "header"],
// emits: ['itemClick'],
setup: function setup72(props3, _ref) {
var slots = _ref.slots, emit = _ref.emit, attrs = _ref.attrs;
devWarning(props3.disabled === void 0, "Collapse.Panel", '`disabled` is deprecated. Please use `collapsible="disabled"` instead.');
var _useConfigInject = useConfigInject("collapse", props3), prefixCls = _useConfigInject.prefixCls;
var handleItemClick = function handleItemClick2() {
emit("itemClick", props3.panelKey);
};
var handleKeyPress = function handleKeyPress2(e2) {
if (e2.key === "Enter" || e2.keyCode === 13 || e2.which === 13) {
handleItemClick();
}
};
return function() {
var _slots$header, _slots$extra, _classNames, _classNames2;
var _props$header = props3.header, header = _props$header === void 0 ? (_slots$header = slots.header) === null || _slots$header === void 0 ? void 0 : _slots$header.call(slots) : _props$header, headerClass = props3.headerClass, isActive = props3.isActive, showArrow = props3.showArrow, destroyInactivePanel = props3.destroyInactivePanel, accordion = props3.accordion, forceRender = props3.forceRender, openAnimation = props3.openAnimation, _props$expandIcon = props3.expandIcon, expandIcon = _props$expandIcon === void 0 ? slots.expandIcon : _props$expandIcon, _props$extra = props3.extra, extra = _props$extra === void 0 ? (_slots$extra = slots.extra) === null || _slots$extra === void 0 ? void 0 : _slots$extra.call(slots) : _props$extra, collapsible = props3.collapsible;
var disabled = collapsible === "disabled";
var prefixClsValue = prefixCls.value;
var headerCls = classNames("".concat(prefixClsValue, "-header"), (_classNames = {}, _defineProperty$q(_classNames, headerClass, headerClass), _defineProperty$q(_classNames, "".concat(prefixClsValue, "-header-collapsible-only"), collapsible === "header"), _classNames));
var itemCls = classNames((_classNames2 = {}, _defineProperty$q(_classNames2, "".concat(prefixClsValue, "-item"), true), _defineProperty$q(_classNames2, "".concat(prefixClsValue, "-item-active"), isActive), _defineProperty$q(_classNames2, "".concat(prefixClsValue, "-item-disabled"), disabled), _defineProperty$q(_classNames2, "".concat(prefixClsValue, "-no-arrow"), !showArrow), _defineProperty$q(_classNames2, "".concat(attrs.class), !!attrs.class), _classNames2));
var icon = createVNode("i", {
"class": "arrow"
}, null);
if (showArrow && typeof expandIcon === "function") {
icon = expandIcon(props3);
}
var panelContent = withDirectives(createVNode(PanelContent, {
"prefixCls": prefixClsValue,
"isActive": isActive,
"forceRender": forceRender,
"role": accordion ? "tabpanel" : null
}, {
default: slots.default
}), [[vShow, isActive]]);
var transitionProps = _objectSpread2$1({
appear: false,
css: false
}, openAnimation);
return createVNode("div", _objectSpread2$1(_objectSpread2$1({}, attrs), {}, {
"class": itemCls
}), [createVNode("div", {
"class": headerCls,
"onClick": function onClick2() {
return collapsible !== "header" && handleItemClick();
},
"role": accordion ? "tab" : "button",
"tabindex": disabled ? -1 : 0,
"aria-expanded": isActive,
"onKeypress": handleKeyPress
}, [showArrow && icon, collapsible === "header" ? createVNode("span", {
"onClick": handleItemClick,
"class": "".concat(prefixClsValue, "-header-text")
}, [header]) : header, extra && createVNode("div", {
"class": "".concat(prefixClsValue, "-extra")
}, [extra])]), createVNode(Transition, transitionProps, {
default: function _default3() {
return [!destroyInactivePanel || isActive ? panelContent : null];
}
})]);
};
}
});
Collapse.Panel = __unplugin_components_1$2;
Collapse.install = function(app) {
app.component(Collapse.name, Collapse);
app.component(__unplugin_components_1$2.name, __unplugin_components_1$2);
return app;
};
var abstractCheckboxGroupProps = function abstractCheckboxGroupProps2() {
return {
name: String,
prefixCls: String,
options: {
type: Array,
default: function _default3() {
return [];
}
},
disabled: Boolean,
id: String
};
};
var checkboxGroupProps = function checkboxGroupProps2() {
return _objectSpread2$1(_objectSpread2$1({}, abstractCheckboxGroupProps()), {}, {
defaultValue: {
type: Array
},
value: {
type: Array
},
onChange: {
type: Function
},
"onUpdate:value": {
type: Function
}
});
};
var abstractCheckboxProps = function abstractCheckboxProps2() {
return {
prefixCls: String,
defaultChecked: {
type: Boolean,
default: void 0
},
checked: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
isGroup: {
type: Boolean,
default: void 0
},
value: PropTypes$1.any,
name: String,
id: String,
indeterminate: {
type: Boolean,
default: void 0
},
type: {
type: String,
default: "checkbox"
},
autofocus: {
type: Boolean,
default: void 0
},
onChange: Function,
"onUpdate:checked": Function,
onClick: Function,
skipGroup: {
type: Boolean,
default: false
}
};
};
var checkboxProps = function checkboxProps2() {
return _objectSpread2$1(_objectSpread2$1({}, abstractCheckboxProps()), {}, {
indeterminate: {
type: Boolean,
default: false
}
});
};
var CheckboxGroupContextKey = Symbol("CheckboxGroupContext");
var _excluded$a = ["indeterminate", "skipGroup", "id"], _excluded2$1 = ["onMouseenter", "onMouseleave", "onInput", "class", "style"];
const Checkbox = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACheckbox",
inheritAttrs: false,
__ANT_CHECKBOX: true,
props: checkboxProps(),
// emits: ['change', 'update:checked'],
setup: function setup73(props3, _ref) {
var emit = _ref.emit, attrs = _ref.attrs, slots = _ref.slots, expose = _ref.expose;
var formItemContext = useInjectFormItemContext();
var _useConfigInject = useConfigInject("checkbox", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction;
var checkboxGroup = inject(CheckboxGroupContextKey, void 0);
var uniId = Symbol("checkboxUniId");
watchEffect(function() {
if (!props3.skipGroup && checkboxGroup) {
checkboxGroup.registerValue(uniId, props3.value);
}
});
onBeforeUnmount(function() {
if (checkboxGroup) {
checkboxGroup.cancelValue(uniId);
}
});
onMounted(function() {
warning$1(props3.checked !== void 0 || checkboxGroup || props3.value === void 0, "Checkbox", "`value` is not validate prop, do you mean `checked`?");
});
var handleChange = function handleChange2(event) {
var targetChecked = event.target.checked;
emit("update:checked", targetChecked);
emit("change", event);
};
var checkboxRef = ref();
var focus = function focus2() {
var _checkboxRef$value;
(_checkboxRef$value = checkboxRef.value) === null || _checkboxRef$value === void 0 ? void 0 : _checkboxRef$value.focus();
};
var blur = function blur2() {
var _checkboxRef$value2;
(_checkboxRef$value2 = checkboxRef.value) === null || _checkboxRef$value2 === void 0 ? void 0 : _checkboxRef$value2.blur();
};
expose({
focus,
blur
});
return function() {
var _slots$default, _classNames;
var children = flattenChildren((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots));
var indeterminate = props3.indeterminate, skipGroup = props3.skipGroup, _props$id = props3.id, id = _props$id === void 0 ? formItemContext.id.value : _props$id, restProps = _objectWithoutProperties$2(props3, _excluded$a);
var onMouseenter2 = attrs.onMouseenter, onMouseleave2 = attrs.onMouseleave;
attrs.onInput;
var className = attrs.class, style = attrs.style, restAttrs = _objectWithoutProperties$2(attrs, _excluded2$1);
var checkboxProps3 = _objectSpread2$1(_objectSpread2$1({}, restProps), {}, {
id,
prefixCls: prefixCls.value
}, restAttrs);
if (checkboxGroup && !skipGroup) {
checkboxProps3.onChange = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
emit.apply(void 0, ["change"].concat(args));
checkboxGroup.toggleOption({
label: children,
value: props3.value
});
};
checkboxProps3.name = checkboxGroup.name.value;
checkboxProps3.checked = checkboxGroup.mergedValue.value.indexOf(props3.value) !== -1;
checkboxProps3.disabled = props3.disabled || checkboxGroup.disabled.value;
checkboxProps3.indeterminate = indeterminate;
} else {
checkboxProps3.onChange = handleChange;
}
var classString = classNames((_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls.value, "-wrapper"), true), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-rtl"), direction.value === "rtl"), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-wrapper-checked"), checkboxProps3.checked), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-wrapper-disabled"), checkboxProps3.disabled), _classNames), className);
var checkboxClass = classNames(_defineProperty$q({}, "".concat(prefixCls.value, "-indeterminate"), indeterminate));
return createVNode("label", {
"class": classString,
"style": style,
"onMouseenter": onMouseenter2,
"onMouseleave": onMouseleave2
}, [createVNode(VcCheckbox, _objectSpread2$1(_objectSpread2$1({}, checkboxProps3), {}, {
"class": checkboxClass,
"ref": checkboxRef
}), null), children.length ? createVNode("span", null, [children]) : null]);
};
}
});
const __unplugin_components_2$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACheckboxGroup",
props: checkboxGroupProps(),
// emits: ['change', 'update:value'],
setup: function setup74(props3, _ref) {
var slots = _ref.slots, emit = _ref.emit, expose = _ref.expose;
var formItemContext = useInjectFormItemContext();
var _useConfigInject = useConfigInject("checkbox", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction;
var mergedValue = ref((props3.value === void 0 ? props3.defaultValue : props3.value) || []);
watch(function() {
return props3.value;
}, function() {
mergedValue.value = props3.value || [];
});
var options = computed(function() {
return props3.options.map(function(option) {
if (typeof option === "string" || typeof option === "number") {
return {
label: option,
value: option
};
}
return option;
});
});
var triggerUpdate = ref(Symbol());
var registeredValuesMap = ref(/* @__PURE__ */ new Map());
var cancelValue = function cancelValue2(id) {
registeredValuesMap.value.delete(id);
triggerUpdate.value = Symbol();
};
var registerValue = function registerValue2(id, value2) {
registeredValuesMap.value.set(id, value2);
triggerUpdate.value = Symbol();
};
var registeredValues = ref(/* @__PURE__ */ new Map());
watch(triggerUpdate, function() {
var valuseMap = /* @__PURE__ */ new Map();
var _iterator = _createForOfIteratorHelper(registeredValuesMap.value.values()), _step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
var value2 = _step.value;
valuseMap.set(value2, true);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
registeredValues.value = valuseMap;
});
var toggleOption = function toggleOption2(option) {
var optionIndex = mergedValue.value.indexOf(option.value);
var value2 = _toConsumableArray(mergedValue.value);
if (optionIndex === -1) {
value2.push(option.value);
} else {
value2.splice(optionIndex, 1);
}
if (props3.value === void 0) {
mergedValue.value = value2;
}
var val = value2.filter(function(val2) {
return registeredValues.value.has(val2);
}).sort(function(a2, b2) {
var indexA = options.value.findIndex(function(opt) {
return opt.value === a2;
});
var indexB = options.value.findIndex(function(opt) {
return opt.value === b2;
});
return indexA - indexB;
});
emit("update:value", val);
emit("change", val);
formItemContext.onFieldChange();
};
provide(CheckboxGroupContextKey, {
cancelValue,
registerValue,
toggleOption,
mergedValue,
name: computed(function() {
return props3.name;
}),
disabled: computed(function() {
return props3.disabled;
})
});
expose({
mergedValue
});
return function() {
var _slots$default;
var _props$id = props3.id, id = _props$id === void 0 ? formItemContext.id.value : _props$id;
var children = null;
var groupPrefixCls = "".concat(prefixCls.value, "-group");
if (options.value && options.value.length > 0) {
children = options.value.map(function(option) {
var _slots$label;
return createVNode(Checkbox, {
"prefixCls": prefixCls.value,
"key": option.value.toString(),
"disabled": "disabled" in option ? option.disabled : props3.disabled,
"indeterminate": option.indeterminate,
"value": option.value,
"checked": mergedValue.value.indexOf(option.value) !== -1,
"onChange": option.onChange,
"class": "".concat(groupPrefixCls, "-item")
}, {
default: function _default3() {
return [option.label === void 0 ? (_slots$label = slots.label) === null || _slots$label === void 0 ? void 0 : _slots$label.call(slots, option) : option.label];
}
});
});
}
return createVNode("div", {
"class": [groupPrefixCls, _defineProperty$q({}, "".concat(groupPrefixCls, "-rtl"), direction.value === "rtl")],
"id": id
}, [children || ((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots))]);
};
}
});
Checkbox.Group = __unplugin_components_2$2;
Checkbox.install = function(app) {
app.component(Checkbox.name, Checkbox);
app.component(__unplugin_components_2$2.name, __unplugin_components_2$2);
return app;
};
var PickerButton = function PickerButton2(props3, _ref) {
var attrs = _ref.attrs, slots = _ref.slots;
return createVNode(Button, _objectSpread2$1(_objectSpread2$1({
"size": "small",
"type": "primary"
}, props3), attrs), slots);
};
const PickerButton$1 = PickerButton;
var checkableTagProps = function checkableTagProps2() {
return {
prefixCls: String,
checked: {
type: Boolean,
default: void 0
},
onChange: {
type: Function
},
onClick: {
type: Function
},
"onUpdate:checked": Function
};
};
var CheckableTag = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACheckableTag",
props: checkableTagProps(),
// emits: ['update:checked', 'change', 'click'],
setup: function setup75(props3, _ref) {
var slots = _ref.slots, emit = _ref.emit;
var _useConfigInject = useConfigInject("tag", props3), prefixCls = _useConfigInject.prefixCls;
var handleClick = function handleClick2(e2) {
var checked = props3.checked;
emit("update:checked", !checked);
emit("change", !checked);
emit("click", e2);
};
var cls = computed(function() {
var _classNames;
return classNames(prefixCls.value, (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls.value, "-checkable"), true), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-checkable-checked"), props3.checked), _classNames));
});
return function() {
var _slots$default;
return createVNode("span", {
"class": cls.value,
"onClick": handleClick
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]);
};
}
});
const CheckableTag$1 = CheckableTag;
var PresetColorRegex = new RegExp("^(".concat(PresetColorTypes.join("|"), ")(-inverse)?$"));
var PresetStatusColorRegex = new RegExp("^(".concat(PresetStatusColorTypes.join("|"), ")$"));
var tagProps = function tagProps2() {
return {
prefixCls: String,
color: {
type: String
},
closable: {
type: Boolean,
default: false
},
closeIcon: PropTypes$1.any,
visible: {
type: Boolean,
default: void 0
},
onClose: {
type: Function
},
"onUpdate:visible": Function,
icon: PropTypes$1.any
};
};
var Tag = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATag",
props: tagProps(),
// emits: ['update:visible', 'close'],
slots: ["closeIcon", "icon"],
setup: function setup76(props3, _ref) {
var slots = _ref.slots, emit = _ref.emit, attrs = _ref.attrs;
var _useConfigInject = useConfigInject("tag", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction;
var visible = ref(true);
watchEffect(function() {
if (props3.visible !== void 0) {
visible.value = props3.visible;
}
});
var handleCloseClick = function handleCloseClick2(e2) {
e2.stopPropagation();
emit("update:visible", false);
emit("close", e2);
if (e2.defaultPrevented) {
return;
}
if (props3.visible === void 0) {
visible.value = false;
}
};
var isPresetColor = computed(function() {
var color = props3.color;
if (!color) {
return false;
}
return PresetColorRegex.test(color) || PresetStatusColorRegex.test(color);
});
var tagClassName = computed(function() {
var _classNames;
return classNames(prefixCls.value, (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls.value, "-").concat(props3.color), isPresetColor.value), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-has-color"), props3.color && !isPresetColor.value), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-hidden"), !visible.value), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-rtl"), direction.value === "rtl"), _classNames));
});
return function() {
var _slots$icon, _slots$closeIcon, _slots$default;
var _props$icon = props3.icon, icon = _props$icon === void 0 ? (_slots$icon = slots.icon) === null || _slots$icon === void 0 ? void 0 : _slots$icon.call(slots) : _props$icon, color = props3.color, _props$closeIcon = props3.closeIcon, closeIcon = _props$closeIcon === void 0 ? (_slots$closeIcon = slots.closeIcon) === null || _slots$closeIcon === void 0 ? void 0 : _slots$closeIcon.call(slots) : _props$closeIcon, _props$closable = props3.closable, closable = _props$closable === void 0 ? false : _props$closable;
var renderCloseIcon = function renderCloseIcon2() {
if (closable) {
return closeIcon ? createVNode("span", {
"class": "".concat(prefixCls.value, "-close-icon"),
"onClick": handleCloseClick
}, [closeIcon]) : createVNode(CloseOutlined$1, {
"class": "".concat(prefixCls.value, "-close-icon"),
"onClick": handleCloseClick
}, null);
}
return null;
};
var tagStyle = {
backgroundColor: color && !isPresetColor.value ? color : void 0
};
var iconNode = icon || null;
var children = (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
var kids = iconNode ? createVNode(Fragment, null, [iconNode, createVNode("span", null, [children])]) : children;
var isNeedWave = "onClick" in attrs;
var tagNode = createVNode("span", {
"class": tagClassName.value,
"style": tagStyle
}, [kids, renderCloseIcon()]);
return isNeedWave ? createVNode(Wave, null, {
default: function _default3() {
return [tagNode];
}
}) : tagNode;
};
}
});
Tag.CheckableTag = CheckableTag$1;
Tag.install = function(app) {
app.component(Tag.name, Tag);
app.component(CheckableTag$1.name, CheckableTag$1);
return app;
};
const __unplugin_components_0$1 = Tag;
function PickerTag(props3, _ref) {
var slots = _ref.slots, attrs = _ref.attrs;
return createVNode(__unplugin_components_0$1, _objectSpread2$1(_objectSpread2$1({
"color": "blue"
}, props3), attrs), slots);
}
var CalendarOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z" } }] }, "name": "calendar", "theme": "outlined" };
const CalendarOutlinedSvg = CalendarOutlined$2;
function _objectSpread$5(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$5(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$5(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var CalendarOutlined = function CalendarOutlined2(props3, context) {
var p = _objectSpread$5({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$5({}, p, {
"icon": CalendarOutlinedSvg
}), null);
};
CalendarOutlined.displayName = "CalendarOutlined";
CalendarOutlined.inheritAttrs = false;
const CalendarOutlined$1 = CalendarOutlined;
var ClockCircleOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z" } }] }, "name": "clock-circle", "theme": "outlined" };
const ClockCircleOutlinedSvg = ClockCircleOutlined$2;
function _objectSpread$4(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$4(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$4(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var ClockCircleOutlined = function ClockCircleOutlined2(props3, context) {
var p = _objectSpread$4({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$4({}, p, {
"icon": ClockCircleOutlinedSvg
}), null);
};
ClockCircleOutlined.displayName = "ClockCircleOutlined";
ClockCircleOutlined.inheritAttrs = false;
const ClockCircleOutlined$1 = ClockCircleOutlined;
function getPlaceholder(picker, locale3, customizePlaceholder) {
if (customizePlaceholder !== void 0) {
return customizePlaceholder;
}
if (picker === "year" && locale3.lang.yearPlaceholder) {
return locale3.lang.yearPlaceholder;
}
if (picker === "quarter" && locale3.lang.quarterPlaceholder) {
return locale3.lang.quarterPlaceholder;
}
if (picker === "month" && locale3.lang.monthPlaceholder) {
return locale3.lang.monthPlaceholder;
}
if (picker === "week" && locale3.lang.weekPlaceholder) {
return locale3.lang.weekPlaceholder;
}
if (picker === "time" && locale3.timePickerLocale.placeholder) {
return locale3.timePickerLocale.placeholder;
}
return locale3.lang.placeholder;
}
function getRangePlaceholder(picker, locale3, customizePlaceholder) {
if (customizePlaceholder !== void 0) {
return customizePlaceholder;
}
if (picker === "year" && locale3.lang.yearPlaceholder) {
return locale3.lang.rangeYearPlaceholder;
}
if (picker === "month" && locale3.lang.monthPlaceholder) {
return locale3.lang.rangeMonthPlaceholder;
}
if (picker === "week" && locale3.lang.weekPlaceholder) {
return locale3.lang.rangeWeekPlaceholder;
}
if (picker === "time" && locale3.timePickerLocale.placeholder) {
return locale3.timePickerLocale.rangePlaceholder;
}
return locale3.lang.rangePlaceholder;
}
function commonProps() {
return {
id: String,
dropdownClassName: String,
dropdownAlign: {
type: Object
},
popupStyle: {
type: Object
},
transitionName: String,
placeholder: String,
allowClear: {
type: Boolean,
default: void 0
},
autofocus: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
tabindex: Number,
open: {
type: Boolean,
default: void 0
},
defaultOpen: {
type: Boolean,
default: void 0
},
/** Make input readOnly to avoid popup keyboard in mobile */
inputReadOnly: {
type: Boolean,
default: void 0
},
format: {
type: [String, Function, Array]
},
// Value
// format: string | CustomFormat<DateType> | (string | CustomFormat<DateType>)[];
// Render
// suffixIcon?: VueNode;
// clearIcon?: VueNode;
// prevIcon?: VueNode;
// nextIcon?: VueNode;
// superPrevIcon?: VueNode;
// superNextIcon?: VueNode;
getPopupContainer: {
type: Function
},
panelRender: {
type: Function
},
// // Events
onChange: {
type: Function
},
"onUpdate:value": {
type: Function
},
onOk: {
type: Function
},
onOpenChange: {
type: Function
},
"onUpdate:open": {
type: Function
},
onFocus: {
type: Function
},
onBlur: {
type: Function
},
onMousedown: {
type: Function
},
onMouseup: {
type: Function
},
onMouseenter: {
type: Function
},
onMouseleave: {
type: Function
},
onClick: {
type: Function
},
onContextmenu: {
type: Function
},
onKeydown: {
type: Function
},
// WAI-ARIA
role: String,
name: String,
autocomplete: String,
direction: {
type: String
},
showToday: {
type: Boolean,
default: void 0
},
showTime: {
type: [Boolean, Object],
default: void 0
},
locale: {
type: Object
},
size: {
type: String
},
bordered: {
type: Boolean,
default: void 0
},
dateRender: {
type: Function
},
disabledDate: {
type: Function
},
mode: {
type: String
},
picker: {
type: String
},
valueFormat: String,
/** @deprecated Please use `disabledTime` instead. */
disabledHours: Function,
/** @deprecated Please use `disabledTime` instead. */
disabledMinutes: Function,
/** @deprecated Please use `disabledTime` instead. */
disabledSeconds: Function
};
}
function datePickerProps() {
return {
defaultPickerValue: {
type: [String, Object]
},
defaultValue: {
type: [String, Object]
},
value: {
type: [String, Object]
},
disabledTime: {
type: Function
},
renderExtraFooter: {
type: Function
},
showNow: {
type: Boolean,
default: void 0
},
monthCellRender: {
type: Function
},
// deprecated Please use `monthCellRender"` instead.',
monthCellContentRender: {
type: Function
}
};
}
function rangePickerProps() {
return {
allowEmpty: {
type: Array
},
dateRender: {
type: Function
},
defaultPickerValue: {
type: Array
},
defaultValue: {
type: Array
},
value: {
type: Array
},
disabledTime: {
type: Function
},
disabled: {
type: [Boolean, Array]
},
renderExtraFooter: {
type: Function
},
separator: {
type: String
},
ranges: {
type: Object
},
placeholder: Array,
mode: {
type: Array
},
onChange: {
type: Function
},
"onUpdate:value": {
type: Function
},
onCalendarChange: {
type: Function
},
onPanelChange: {
type: Function
},
onOk: {
type: Function
}
};
}
var _excluded$9 = ["bordered", "placeholder", "suffixIcon", "showToday", "transitionName", "allowClear", "dateRender", "renderExtraFooter", "monthCellRender", "clearIcon", "id"];
function generateSinglePicker(generateConfig2, extraProps) {
function getPicker(picker, displayName) {
var comProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, commonProps()), datePickerProps()), extraProps);
return defineComponent({
compatConfig: {
MODE: 3
},
name: displayName,
inheritAttrs: false,
props: comProps,
slots: [
"suffixIcon",
// 'clearIcon',
"prevIcon",
"nextIcon",
"superPrevIcon",
"superNextIcon",
// 'panelRender',
"dateRender",
"renderExtraFooter",
"monthCellRender"
],
setup: function setup99(_props, _ref) {
var slots = _ref.slots, expose = _ref.expose, attrs = _ref.attrs, emit = _ref.emit;
var props3 = _props;
var formItemContext = useInjectFormItemContext();
devWarning(!(props3.monthCellContentRender || slots.monthCellContentRender), "DatePicker", '`monthCellContentRender` is deprecated. Please use `monthCellRender"` instead.');
devWarning(!attrs.getCalendarContainer, "DatePicker", '`getCalendarContainer` is deprecated. Please use `getPopupContainer"` instead.');
var _useConfigInject = useConfigInject("picker", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction, getPopupContainer = _useConfigInject.getPopupContainer, size = _useConfigInject.size, rootPrefixCls = _useConfigInject.rootPrefixCls;
var pickerRef = ref();
expose({
focus: function focus() {
var _pickerRef$value;
(_pickerRef$value = pickerRef.value) === null || _pickerRef$value === void 0 ? void 0 : _pickerRef$value.focus();
},
blur: function blur() {
var _pickerRef$value2;
(_pickerRef$value2 = pickerRef.value) === null || _pickerRef$value2 === void 0 ? void 0 : _pickerRef$value2.blur();
}
});
var maybeToString = function maybeToString2(date2) {
return props3.valueFormat ? generateConfig2.toString(date2, props3.valueFormat) : date2;
};
var onChange = function onChange2(date2, dateString) {
var value3 = maybeToString(date2);
emit("update:value", value3);
emit("change", value3, dateString);
formItemContext.onFieldChange();
};
var onOpenChange = function onOpenChange2(open2) {
emit("update:open", open2);
emit("openChange", open2);
};
var onFocus2 = function onFocus3(e2) {
emit("focus", e2);
};
var onBlur2 = function onBlur3(e2) {
emit("blur", e2);
formItemContext.onFieldBlur();
};
var onPanelChange = function onPanelChange2(date2, mode) {
var value3 = maybeToString(date2);
emit("panelChange", value3, mode);
};
var onOk = function onOk2(date2) {
var value3 = maybeToString(date2);
emit("ok", value3);
};
var _useLocaleReceiver = useLocaleReceiver("DatePicker", locale2), _useLocaleReceiver2 = _slicedToArray$2(_useLocaleReceiver, 1), contextLocale = _useLocaleReceiver2[0];
var value2 = computed(function() {
if (props3.value) {
return props3.valueFormat ? generateConfig2.toDate(props3.value, props3.valueFormat) : props3.value;
}
return props3.value === "" ? void 0 : props3.value;
});
var defaultValue = computed(function() {
if (props3.defaultValue) {
return props3.valueFormat ? generateConfig2.toDate(props3.defaultValue, props3.valueFormat) : props3.defaultValue;
}
return props3.defaultValue === "" ? void 0 : props3.defaultValue;
});
var defaultPickerValue = computed(function() {
if (props3.defaultPickerValue) {
return props3.valueFormat ? generateConfig2.toDate(props3.defaultPickerValue, props3.valueFormat) : props3.defaultPickerValue;
}
return props3.defaultPickerValue === "" ? void 0 : props3.defaultPickerValue;
});
return function() {
var _slots$suffixIcon, _slots$clearIcon, _classNames, _slots$prevIcon, _slots$nextIcon, _slots$superPrevIcon, _slots$superNextIcon;
var locale3 = _objectSpread2$1(_objectSpread2$1({}, contextLocale.value), props3.locale);
var p = _objectSpread2$1(_objectSpread2$1({}, props3), attrs);
var _p$bordered = p.bordered, bordered = _p$bordered === void 0 ? true : _p$bordered, placeholder = p.placeholder, _p$suffixIcon = p.suffixIcon, suffixIcon = _p$suffixIcon === void 0 ? (_slots$suffixIcon = slots.suffixIcon) === null || _slots$suffixIcon === void 0 ? void 0 : _slots$suffixIcon.call(slots) : _p$suffixIcon, _p$showToday = p.showToday, showToday = _p$showToday === void 0 ? true : _p$showToday, transitionName2 = p.transitionName, _p$allowClear = p.allowClear, allowClear = _p$allowClear === void 0 ? true : _p$allowClear, _p$dateRender = p.dateRender, dateRender = _p$dateRender === void 0 ? slots.dateRender : _p$dateRender, _p$renderExtraFooter = p.renderExtraFooter, renderExtraFooter = _p$renderExtraFooter === void 0 ? slots.renderExtraFooter : _p$renderExtraFooter, _p$monthCellRender = p.monthCellRender, monthCellRender = _p$monthCellRender === void 0 ? slots.monthCellRender || props3.monthCellContentRender || slots.monthCellContentRender : _p$monthCellRender, _p$clearIcon = p.clearIcon, clearIcon = _p$clearIcon === void 0 ? (_slots$clearIcon = slots.clearIcon) === null || _slots$clearIcon === void 0 ? void 0 : _slots$clearIcon.call(slots) : _p$clearIcon, _p$id = p.id, id = _p$id === void 0 ? formItemContext.id.value : _p$id, restProps = _objectWithoutProperties$2(p, _excluded$9);
var showTime = p.showTime === "" ? true : p.showTime;
var format3 = p.format;
var additionalOverrideProps = {};
if (picker) {
additionalOverrideProps.picker = picker;
}
var mergedPicker = picker || p.picker || "date";
additionalOverrideProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, additionalOverrideProps), showTime ? getTimeProps(_objectSpread2$1({
format: format3,
picker: mergedPicker
}, _typeof$2(showTime) === "object" ? showTime : {})) : {}), mergedPicker === "time" ? getTimeProps(_objectSpread2$1(_objectSpread2$1({
format: format3
}, restProps), {}, {
picker: mergedPicker
})) : {});
var pre = prefixCls.value;
return createVNode(Picker$1, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
"monthCellRender": monthCellRender,
"dateRender": dateRender,
"renderExtraFooter": renderExtraFooter,
"ref": pickerRef,
"placeholder": getPlaceholder(mergedPicker, locale3, placeholder),
"suffixIcon": suffixIcon || (mergedPicker === "time" ? createVNode(ClockCircleOutlined$1, null, null) : createVNode(CalendarOutlined$1, null, null)),
"clearIcon": clearIcon || createVNode(CloseCircleFilled$1, null, null),
"allowClear": allowClear,
"transitionName": transitionName2 || "".concat(rootPrefixCls.value, "-slide-up")
}, restProps), additionalOverrideProps), {}, {
"id": id,
"picker": mergedPicker,
"value": value2.value,
"defaultValue": defaultValue.value,
"defaultPickerValue": defaultPickerValue.value,
"showToday": showToday,
"locale": locale3.lang,
"class": classNames((_classNames = {}, _defineProperty$q(_classNames, "".concat(pre, "-").concat(size.value), size.value), _defineProperty$q(_classNames, "".concat(pre, "-borderless"), !bordered), _classNames), attrs.class),
"prefixCls": pre,
"getPopupContainer": attrs.getCalendarContainer || getPopupContainer.value,
"generateConfig": generateConfig2,
"prevIcon": ((_slots$prevIcon = slots.prevIcon) === null || _slots$prevIcon === void 0 ? void 0 : _slots$prevIcon.call(slots)) || createVNode("span", {
"class": "".concat(pre, "-prev-icon")
}, null),
"nextIcon": ((_slots$nextIcon = slots.nextIcon) === null || _slots$nextIcon === void 0 ? void 0 : _slots$nextIcon.call(slots)) || createVNode("span", {
"class": "".concat(pre, "-next-icon")
}, null),
"superPrevIcon": ((_slots$superPrevIcon = slots.superPrevIcon) === null || _slots$superPrevIcon === void 0 ? void 0 : _slots$superPrevIcon.call(slots)) || createVNode("span", {
"class": "".concat(pre, "-super-prev-icon")
}, null),
"superNextIcon": ((_slots$superNextIcon = slots.superNextIcon) === null || _slots$superNextIcon === void 0 ? void 0 : _slots$superNextIcon.call(slots)) || createVNode("span", {
"class": "".concat(pre, "-super-next-icon")
}, null),
"components": Components,
"direction": direction.value,
"onChange": onChange,
"onOpenChange": onOpenChange,
"onFocus": onFocus2,
"onBlur": onBlur2,
"onPanelChange": onPanelChange,
"onOk": onOk
}), null);
};
}
});
}
var DatePicker2 = getPicker(void 0, "ADatePicker");
var WeekPicker2 = getPicker("week", "AWeekPicker");
var MonthPicker2 = getPicker("month", "AMonthPicker");
var YearPicker2 = getPicker("year", "AYearPicker");
var TimePicker2 = getPicker("time", "TimePicker");
var QuarterPicker2 = getPicker("quarter", "AQuarterPicker");
return {
DatePicker: DatePicker2,
WeekPicker: WeekPicker2,
MonthPicker: MonthPicker2,
YearPicker: YearPicker2,
TimePicker: TimePicker2,
QuarterPicker: QuarterPicker2
};
}
var SwapRightOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M873.1 596.2l-164-208A32 32 0 00684 376h-64.8c-6.7 0-10.4 7.7-6.3 13l144.3 183H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h695.9c26.8 0 41.7-30.8 25.2-51.8z" } }] }, "name": "swap-right", "theme": "outlined" };
const SwapRightOutlinedSvg = SwapRightOutlined$2;
function _objectSpread$3(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$3(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$3(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var SwapRightOutlined = function SwapRightOutlined2(props3, context) {
var p = _objectSpread$3({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$3({}, p, {
"icon": SwapRightOutlinedSvg
}), null);
};
SwapRightOutlined.displayName = "SwapRightOutlined";
SwapRightOutlined.inheritAttrs = false;
const SwapRightOutlined$1 = SwapRightOutlined;
var _excluded$8 = ["prefixCls", "bordered", "placeholder", "suffixIcon", "picker", "transitionName", "allowClear", "dateRender", "renderExtraFooter", "separator", "clearIcon", "id"];
function generateRangePicker(generateConfig2, extraProps) {
var RangePicker2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ARangePicker",
inheritAttrs: false,
props: _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, commonProps()), rangePickerProps()), extraProps),
slots: [
"suffixIcon",
// 'clearIcon',
"prevIcon",
"nextIcon",
"superPrevIcon",
"superNextIcon",
// 'panelRender',
"dateRender",
"renderExtraFooter"
// 'separator',
],
setup: function setup99(_props, _ref) {
var expose = _ref.expose, slots = _ref.slots, attrs = _ref.attrs, emit = _ref.emit;
var props3 = _props;
var formItemContext = useInjectFormItemContext();
devWarning(!attrs.getCalendarContainer, "DatePicker", '`getCalendarContainer` is deprecated. Please use `getPopupContainer"` instead.');
var _useConfigInject = useConfigInject("picker", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction, getPopupContainer = _useConfigInject.getPopupContainer, size = _useConfigInject.size, rootPrefixCls = _useConfigInject.rootPrefixCls;
var pickerRef = ref();
expose({
focus: function focus() {
var _pickerRef$value;
(_pickerRef$value = pickerRef.value) === null || _pickerRef$value === void 0 ? void 0 : _pickerRef$value.focus();
},
blur: function blur() {
var _pickerRef$value2;
(_pickerRef$value2 = pickerRef.value) === null || _pickerRef$value2 === void 0 ? void 0 : _pickerRef$value2.blur();
}
});
var maybeToStrings = function maybeToStrings2(dates) {
return props3.valueFormat ? generateConfig2.toString(dates, props3.valueFormat) : dates;
};
var onChange = function onChange2(dates, dateStrings) {
var values = maybeToStrings(dates);
emit("update:value", values);
emit("change", values, dateStrings);
formItemContext.onFieldChange();
};
var onOpenChange = function onOpenChange2(open2) {
emit("update:open", open2);
emit("openChange", open2);
};
var onFocus2 = function onFocus3(e2) {
emit("focus", e2);
};
var onBlur2 = function onBlur3(e2) {
emit("blur", e2);
formItemContext.onFieldBlur();
};
var onPanelChange = function onPanelChange2(dates, modes) {
var values = maybeToStrings(dates);
emit("panelChange", values, modes);
};
var onOk = function onOk2(dates) {
var value3 = maybeToStrings(dates);
emit("ok", value3);
};
var onCalendarChange = function onCalendarChange2(dates, dateStrings, info) {
var values = maybeToStrings(dates);
emit("calendarChange", values, dateStrings, info);
};
var _useLocaleReceiver = useLocaleReceiver("DatePicker", locale2), _useLocaleReceiver2 = _slicedToArray$2(_useLocaleReceiver, 1), contextLocale = _useLocaleReceiver2[0];
var value2 = computed(function() {
if (props3.value) {
return props3.valueFormat ? generateConfig2.toDate(props3.value, props3.valueFormat) : props3.value;
}
return props3.value;
});
var defaultValue = computed(function() {
if (props3.defaultValue) {
return props3.valueFormat ? generateConfig2.toDate(props3.defaultValue, props3.valueFormat) : props3.defaultValue;
}
return props3.defaultValue;
});
var defaultPickerValue = computed(function() {
if (props3.defaultPickerValue) {
return props3.valueFormat ? generateConfig2.toDate(props3.defaultPickerValue, props3.valueFormat) : props3.defaultPickerValue;
}
return props3.defaultPickerValue;
});
return function() {
var _slots$suffixIcon, _slots$separator, _slots$clearIcon, _classNames, _slots$prevIcon, _slots$nextIcon, _slots$superPrevIcon, _slots$superNextIcon;
var locale3 = _objectSpread2$1(_objectSpread2$1({}, contextLocale.value), props3.locale);
var p = _objectSpread2$1(_objectSpread2$1({}, props3), attrs);
p.prefixCls;
var _p$bordered = p.bordered, bordered = _p$bordered === void 0 ? true : _p$bordered, placeholder = p.placeholder, _p$suffixIcon = p.suffixIcon, suffixIcon = _p$suffixIcon === void 0 ? (_slots$suffixIcon = slots.suffixIcon) === null || _slots$suffixIcon === void 0 ? void 0 : _slots$suffixIcon.call(slots) : _p$suffixIcon, _p$picker = p.picker, picker = _p$picker === void 0 ? "date" : _p$picker, transitionName2 = p.transitionName, _p$allowClear = p.allowClear, allowClear = _p$allowClear === void 0 ? true : _p$allowClear, _p$dateRender = p.dateRender, dateRender = _p$dateRender === void 0 ? slots.dateRender : _p$dateRender, _p$renderExtraFooter = p.renderExtraFooter, renderExtraFooter = _p$renderExtraFooter === void 0 ? slots.renderExtraFooter : _p$renderExtraFooter, _p$separator = p.separator, separator = _p$separator === void 0 ? (_slots$separator = slots.separator) === null || _slots$separator === void 0 ? void 0 : _slots$separator.call(slots) : _p$separator, _p$clearIcon = p.clearIcon, clearIcon = _p$clearIcon === void 0 ? (_slots$clearIcon = slots.clearIcon) === null || _slots$clearIcon === void 0 ? void 0 : _slots$clearIcon.call(slots) : _p$clearIcon, _p$id = p.id, id = _p$id === void 0 ? formItemContext.id.value : _p$id, restProps = _objectWithoutProperties$2(p, _excluded$8);
delete restProps["onUpdate:value"];
delete restProps["onUpdate:open"];
var format3 = p.format, showTime = p.showTime;
var additionalOverrideProps = {};
additionalOverrideProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, additionalOverrideProps), showTime ? getTimeProps(_objectSpread2$1({
format: format3,
picker
}, showTime)) : {}), picker === "time" ? getTimeProps(_objectSpread2$1(_objectSpread2$1({
format: format3
}, omit(restProps, ["disabledTime"])), {}, {
picker
})) : {});
var pre = prefixCls.value;
return createVNode(VCRangePicker, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
"dateRender": dateRender,
"renderExtraFooter": renderExtraFooter,
"separator": separator || createVNode("span", {
"aria-label": "to",
"class": "".concat(pre, "-separator")
}, [createVNode(SwapRightOutlined$1, null, null)]),
"ref": pickerRef,
"placeholder": getRangePlaceholder(picker, locale3, placeholder),
"suffixIcon": suffixIcon || (picker === "time" ? createVNode(ClockCircleOutlined$1, null, null) : createVNode(CalendarOutlined$1, null, null)),
"clearIcon": clearIcon || createVNode(CloseCircleFilled$1, null, null),
"allowClear": allowClear,
"transitionName": transitionName2 || "".concat(rootPrefixCls.value, "-slide-up")
}, restProps), additionalOverrideProps), {}, {
"id": id,
"value": value2.value,
"defaultValue": defaultValue.value,
"defaultPickerValue": defaultPickerValue.value,
"picker": picker,
"class": classNames((_classNames = {}, _defineProperty$q(_classNames, "".concat(pre, "-").concat(size.value), size.value), _defineProperty$q(_classNames, "".concat(pre, "-borderless"), !bordered), _classNames), attrs.class),
"locale": locale3.lang,
"prefixCls": pre,
"getPopupContainer": attrs.getCalendarContainer || getPopupContainer.value,
"generateConfig": generateConfig2,
"prevIcon": ((_slots$prevIcon = slots.prevIcon) === null || _slots$prevIcon === void 0 ? void 0 : _slots$prevIcon.call(slots)) || createVNode("span", {
"class": "".concat(pre, "-prev-icon")
}, null),
"nextIcon": ((_slots$nextIcon = slots.nextIcon) === null || _slots$nextIcon === void 0 ? void 0 : _slots$nextIcon.call(slots)) || createVNode("span", {
"class": "".concat(pre, "-next-icon")
}, null),
"superPrevIcon": ((_slots$superPrevIcon = slots.superPrevIcon) === null || _slots$superPrevIcon === void 0 ? void 0 : _slots$superPrevIcon.call(slots)) || createVNode("span", {
"class": "".concat(pre, "-super-prev-icon")
}, null),
"superNextIcon": ((_slots$superNextIcon = slots.superNextIcon) === null || _slots$superNextIcon === void 0 ? void 0 : _slots$superNextIcon.call(slots)) || createVNode("span", {
"class": "".concat(pre, "-super-next-icon")
}, null),
"components": Components,
"direction": direction.value,
"onChange": onChange,
"onOpenChange": onOpenChange,
"onFocus": onFocus2,
"onBlur": onBlur2,
"onPanelChange": onPanelChange,
"onOk": onOk,
"onCalendarChange": onCalendarChange
}), null);
};
}
});
return RangePicker2;
}
var Components = {
button: PickerButton$1,
rangeItem: PickerTag
};
function toArray(list) {
if (!list) {
return [];
}
return Array.isArray(list) ? list : [list];
}
function getTimeProps(props3) {
var format3 = props3.format, picker = props3.picker, showHour = props3.showHour, showMinute = props3.showMinute, showSecond = props3.showSecond, use12Hours = props3.use12Hours;
var firstFormat = toArray(format3)[0];
var showTimeObj = _objectSpread2$1({}, props3);
if (firstFormat && typeof firstFormat === "string") {
if (!firstFormat.includes("s") && showSecond === void 0) {
showTimeObj.showSecond = false;
}
if (!firstFormat.includes("m") && showMinute === void 0) {
showTimeObj.showMinute = false;
}
if (!firstFormat.includes("H") && !firstFormat.includes("h") && showHour === void 0) {
showTimeObj.showHour = false;
}
if ((firstFormat.includes("a") || firstFormat.includes("A")) && use12Hours === void 0) {
showTimeObj.use12Hours = true;
}
}
if (picker === "time") {
return showTimeObj;
}
if (typeof firstFormat === "function") {
delete showTimeObj.format;
}
return {
showTime: showTimeObj
};
}
function generatePicker(generateConfig2, extraProps) {
var _generateSinglePicker = generateSinglePicker(generateConfig2, extraProps), DatePicker2 = _generateSinglePicker.DatePicker, WeekPicker2 = _generateSinglePicker.WeekPicker, MonthPicker2 = _generateSinglePicker.MonthPicker, YearPicker2 = _generateSinglePicker.YearPicker, TimePicker2 = _generateSinglePicker.TimePicker, QuarterPicker2 = _generateSinglePicker.QuarterPicker;
var RangePicker2 = generateRangePicker(generateConfig2, extraProps);
return {
DatePicker: DatePicker2,
WeekPicker: WeekPicker2,
MonthPicker: MonthPicker2,
YearPicker: YearPicker2,
TimePicker: TimePicker2,
QuarterPicker: QuarterPicker2,
RangePicker: RangePicker2
};
}
var _generatePicker = generatePicker(dayjsGenerateConfig), DatePicker = _generatePicker.DatePicker, WeekPicker = _generatePicker.WeekPicker, MonthPicker = _generatePicker.MonthPicker, YearPicker = _generatePicker.YearPicker, TimePicker = _generatePicker.TimePicker, QuarterPicker = _generatePicker.QuarterPicker, RangePicker = _generatePicker.RangePicker;
const DatePicker$1 = _extends(DatePicker, {
WeekPicker,
MonthPicker,
YearPicker,
RangePicker,
TimePicker,
QuarterPicker,
install: function install(app) {
app.component(DatePicker.name, DatePicker);
app.component(RangePicker.name, RangePicker);
app.component(MonthPicker.name, MonthPicker);
app.component(WeekPicker.name, WeekPicker);
app.component(QuarterPicker.name, QuarterPicker);
return app;
}
});
Dropdown$1.Button = DropdownButton;
Dropdown$1.install = function(app) {
app.component(Dropdown$1.name, Dropdown$1);
app.component(DropdownButton.name, DropdownButton);
return app;
};
var cached;
function getScrollBarSize(fresh) {
if (typeof document === "undefined") {
return 0;
}
if (fresh || cached === void 0) {
var inner = document.createElement("div");
inner.style.width = "100%";
inner.style.height = "200px";
var outer = document.createElement("div");
var outerStyle = outer.style;
outerStyle.position = "absolute";
outerStyle.top = "0";
outerStyle.left = "0";
outerStyle.pointerEvents = "none";
outerStyle.visibility = "hidden";
outerStyle.width = "200px";
outerStyle.height = "150px";
outerStyle.overflow = "hidden";
outer.appendChild(inner);
document.body.appendChild(outer);
var widthContained = inner.offsetWidth;
outer.style.overflow = "scroll";
var widthScroll = inner.offsetWidth;
if (widthContained === widthScroll) {
widthScroll = outer.clientWidth;
}
document.body.removeChild(outer);
cached = widthContained - widthScroll;
}
return cached;
}
var props = function props2() {
return {
prefixCls: String,
width: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number]),
height: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number]),
style: {
type: Object,
default: void 0
},
class: String,
placement: {
type: String
},
wrapperClassName: String,
level: {
type: [String, Array]
},
levelMove: {
type: [Number, Function, Array]
},
duration: String,
ease: String,
showMask: {
type: Boolean,
default: void 0
},
maskClosable: {
type: Boolean,
default: void 0
},
maskStyle: {
type: Object,
default: void 0
},
afterVisibleChange: Function,
keyboard: {
type: Boolean,
default: void 0
},
contentWrapperStyle: {
type: Object,
default: void 0
},
autofocus: {
type: Boolean,
default: void 0
},
open: {
type: Boolean,
default: void 0
}
};
};
var drawerProps$1 = function drawerProps() {
return _objectSpread2$1(_objectSpread2$1({}, props()), {}, {
forceRender: {
type: Boolean,
default: void 0
},
getContainer: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.func, PropTypes$1.object, PropTypes$1.looseBool])
});
};
var drawerChildProps = function drawerChildProps2() {
return _objectSpread2$1(_objectSpread2$1({}, props()), {}, {
getContainer: Function,
getOpenCount: Function,
scrollLocker: PropTypes$1.any,
switchScrollingEffect: Function
});
};
function dataToArray(vars) {
if (Array.isArray(vars)) {
return vars;
}
return [vars];
}
var transitionEndObject = {
transition: "transitionend",
WebkitTransition: "webkitTransitionEnd",
MozTransition: "transitionend",
OTransition: "oTransitionEnd otransitionend"
};
var transitionStr = Object.keys(transitionEndObject).filter(function(key2) {
if (typeof document === "undefined") {
return false;
}
var html = document.getElementsByTagName("html")[0];
return key2 in (html ? html.style : {});
})[0];
var transitionEndFun = transitionEndObject[transitionStr];
function addEventListener(target, eventType, callback, options) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, options);
} else if (target.attachEvent) {
target.attachEvent("on".concat(eventType), callback);
}
}
function removeEventListener(target, eventType, callback, options) {
if (target.removeEventListener) {
target.removeEventListener(eventType, callback, options);
} else if (target.attachEvent) {
target.detachEvent("on".concat(eventType), callback);
}
}
function transformArguments(arg, cb) {
var result = typeof arg === "function" ? arg(cb) : arg;
if (Array.isArray(result)) {
if (result.length === 2) {
return result;
}
return [result[0], result[1]];
}
return [result];
}
var isNumeric = function isNumeric2(value2) {
return !isNaN(parseFloat(value2)) && isFinite(value2);
};
var windowIsUndefined = !(typeof window !== "undefined" && window.document && window.document.createElement);
var getTouchParentScroll = function getTouchParentScroll2(root2, currentTarget, differX, differY) {
if (!currentTarget || currentTarget === document || currentTarget instanceof Document) {
return false;
}
if (currentTarget === root2.parentNode) {
return true;
}
var isY = Math.max(Math.abs(differX), Math.abs(differY)) === Math.abs(differY);
var isX = Math.max(Math.abs(differX), Math.abs(differY)) === Math.abs(differX);
var scrollY = currentTarget.scrollHeight - currentTarget.clientHeight;
var scrollX = currentTarget.scrollWidth - currentTarget.clientWidth;
var style = document.defaultView.getComputedStyle(currentTarget);
var overflowY = style.overflowY === "auto" || style.overflowY === "scroll";
var overflowX = style.overflowX === "auto" || style.overflowX === "scroll";
var y2 = scrollY && overflowY;
var x2 = scrollX && overflowX;
if (isY && (!y2 || y2 && (currentTarget.scrollTop >= scrollY && differY < 0 || currentTarget.scrollTop <= 0 && differY > 0)) || isX && (!x2 || x2 && (currentTarget.scrollLeft >= scrollX && differX < 0 || currentTarget.scrollLeft <= 0 && differX > 0))) {
return getTouchParentScroll2(root2, currentTarget.parentNode, differX, differY);
}
return false;
};
var _excluded$7 = ["width", "height", "open", "prefixCls", "placement", "level", "levelMove", "ease", "duration", "getContainer", "onChange", "afterVisibleChange", "showMask", "maskClosable", "maskStyle", "keyboard", "getOpenCount", "scrollLocker", "contentWrapperStyle", "style", "class"];
var currentDrawer = {};
var DrawerChild = defineComponent({
compatConfig: {
MODE: 3
},
inheritAttrs: false,
props: drawerChildProps(),
emits: ["close", "handleClick", "change"],
setup: function setup77(props3, _ref) {
var emit = _ref.emit, slots = _ref.slots;
var state = reactive({
startPos: {
x: null,
y: null
}
});
var timeout;
var contentWrapper = ref();
var dom = ref();
var maskDom = ref();
var handlerDom = ref();
var contentDom = ref();
var levelDom = [];
var drawerId = "drawer_id_".concat(Number((Date.now() + Math.random()).toString().replace(".", Math.round(Math.random() * 9).toString())).toString(16));
var passive = !windowIsUndefined && supportsPassive$1 ? {
passive: false
} : false;
onMounted(function() {
nextTick(function() {
var open2 = props3.open, getContainer4 = props3.getContainer, showMask = props3.showMask, autofocus = props3.autofocus;
var container = getContainer4 === null || getContainer4 === void 0 ? void 0 : getContainer4();
getLevelDom(props3);
if (open2) {
if (container && container.parentNode === document.body) {
currentDrawer[drawerId] = open2;
}
openLevelTransition();
nextTick(function() {
if (autofocus) {
domFocus();
}
});
if (showMask) {
var _props$scrollLocker;
(_props$scrollLocker = props3.scrollLocker) === null || _props$scrollLocker === void 0 ? void 0 : _props$scrollLocker.lock();
}
}
});
});
watch(function() {
return props3.level;
}, function() {
getLevelDom(props3);
}, {
flush: "post"
});
watch(function() {
return props3.open;
}, function() {
var open2 = props3.open, getContainer4 = props3.getContainer, scrollLocker = props3.scrollLocker, showMask = props3.showMask, autofocus = props3.autofocus;
var container = getContainer4 === null || getContainer4 === void 0 ? void 0 : getContainer4();
if (container && container.parentNode === document.body) {
currentDrawer[drawerId] = !!open2;
}
openLevelTransition();
if (open2) {
if (autofocus) {
domFocus();
}
if (showMask) {
scrollLocker === null || scrollLocker === void 0 ? void 0 : scrollLocker.lock();
}
} else {
scrollLocker === null || scrollLocker === void 0 ? void 0 : scrollLocker.unLock();
}
}, {
flush: "post"
});
onUnmounted(function() {
var _props$scrollLocker2;
var open2 = props3.open;
delete currentDrawer[drawerId];
if (open2) {
setLevelTransform(false);
document.body.style.touchAction = "";
}
(_props$scrollLocker2 = props3.scrollLocker) === null || _props$scrollLocker2 === void 0 ? void 0 : _props$scrollLocker2.unLock();
});
watch(function() {
return props3.placement;
}, function(val) {
if (val) {
contentDom.value = null;
}
});
var domFocus = function domFocus2() {
var _dom$value, _dom$value$focus;
(_dom$value = dom.value) === null || _dom$value === void 0 ? void 0 : (_dom$value$focus = _dom$value.focus) === null || _dom$value$focus === void 0 ? void 0 : _dom$value$focus.call(_dom$value);
};
var removeStartHandler = function removeStartHandler2(e2) {
if (e2.touches.length > 1) {
return;
}
state.startPos = {
x: e2.touches[0].clientX,
y: e2.touches[0].clientY
};
};
var removeMoveHandler = function removeMoveHandler2(e2) {
if (e2.changedTouches.length > 1) {
return;
}
var currentTarget = e2.currentTarget;
var differX = e2.changedTouches[0].clientX - state.startPos.x;
var differY = e2.changedTouches[0].clientY - state.startPos.y;
if ((currentTarget === maskDom.value || currentTarget === handlerDom.value || currentTarget === contentDom.value && getTouchParentScroll(currentTarget, e2.target, differX, differY)) && e2.cancelable) {
e2.preventDefault();
}
};
var transitionEnd = function transitionEnd2(e2) {
var dom2 = e2.target;
removeEventListener(dom2, transitionEndFun, transitionEnd2);
dom2.style.transition = "";
};
var onClose = function onClose2(e2) {
emit("close", e2);
};
var onKeyDown = function onKeyDown2(e2) {
if (e2.keyCode === KeyCode$1.ESC) {
e2.stopPropagation();
onClose(e2);
}
};
var onWrapperTransitionEnd = function onWrapperTransitionEnd2(e2) {
var open2 = props3.open, afterVisibleChange2 = props3.afterVisibleChange;
if (e2.target === contentWrapper.value && e2.propertyName.match(/transform$/)) {
dom.value.style.transition = "";
if (!open2 && getCurrentDrawerSome()) {
document.body.style.overflowX = "";
if (maskDom.value) {
maskDom.value.style.left = "";
maskDom.value.style.width = "";
}
}
if (afterVisibleChange2) {
afterVisibleChange2(!!open2);
}
}
};
var horizontalBoolAndPlacementName = computed(function() {
var placement = props3.placement;
var isHorizontal = placement === "left" || placement === "right";
var placementName = "translate".concat(isHorizontal ? "X" : "Y");
return {
isHorizontal,
placementName
};
});
var openLevelTransition = function openLevelTransition2() {
var open2 = props3.open, width = props3.width, height = props3.height;
var _horizontalBoolAndPla = horizontalBoolAndPlacementName.value, isHorizontal = _horizontalBoolAndPla.isHorizontal, placementName = _horizontalBoolAndPla.placementName;
var contentValue = contentDom.value ? contentDom.value.getBoundingClientRect()[isHorizontal ? "width" : "height"] : 0;
var value2 = (isHorizontal ? width : height) || contentValue;
setLevelAndScrolling(open2, placementName, value2);
};
var setLevelTransform = function setLevelTransform2(open2, placementName, value2, right) {
var placement = props3.placement, levelMove = props3.levelMove, duration = props3.duration, ease = props3.ease, showMask = props3.showMask;
levelDom.forEach(function(dom2) {
dom2.style.transition = "transform ".concat(duration, " ").concat(ease);
addEventListener(dom2, transitionEndFun, transitionEnd);
var levelValue = open2 ? value2 : 0;
if (levelMove) {
var $levelMove = transformArguments(levelMove, {
target: dom2,
open: open2
});
levelValue = open2 ? $levelMove[0] : $levelMove[1] || 0;
}
var $value = typeof levelValue === "number" ? "".concat(levelValue, "px") : levelValue;
var placementPos = placement === "left" || placement === "top" ? $value : "-".concat($value);
placementPos = showMask && placement === "right" && right ? "calc(".concat(placementPos, " + ").concat(right, "px)") : placementPos;
dom2.style.transform = levelValue ? "".concat(placementName, "(").concat(placementPos, ")") : "";
});
};
var setLevelAndScrolling = function setLevelAndScrolling2(open2, placementName, value2) {
if (!windowIsUndefined) {
var right = document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth ? getScrollBarSize(true) : 0;
setLevelTransform(open2, placementName, value2, right);
toggleScrollingToDrawerAndBody(right);
}
emit("change", open2);
};
var toggleScrollingToDrawerAndBody = function toggleScrollingToDrawerAndBody2(right) {
var getContainer4 = props3.getContainer, showMask = props3.showMask, open2 = props3.open;
var container = getContainer4 === null || getContainer4 === void 0 ? void 0 : getContainer4();
if (container && container.parentNode === document.body && showMask) {
var eventArray = ["touchstart"];
var domArray = [document.body, maskDom.value, handlerDom.value, contentDom.value];
if (open2 && document.body.style.overflow !== "hidden") {
if (right) {
addScrollingEffect(right);
}
document.body.style.touchAction = "none";
domArray.forEach(function(item, i2) {
if (!item) {
return;
}
addEventListener(item, eventArray[i2] || "touchmove", i2 ? removeMoveHandler : removeStartHandler, passive);
});
} else if (getCurrentDrawerSome()) {
document.body.style.touchAction = "";
if (right) {
remScrollingEffect(right);
}
domArray.forEach(function(item, i2) {
if (!item) {
return;
}
removeEventListener(item, eventArray[i2] || "touchmove", i2 ? removeMoveHandler : removeStartHandler, passive);
});
}
}
};
var addScrollingEffect = function addScrollingEffect2(right) {
var placement = props3.placement, duration = props3.duration, ease = props3.ease;
var widthTransition = "width ".concat(duration, " ").concat(ease);
var transformTransition = "transform ".concat(duration, " ").concat(ease);
dom.value.style.transition = "none";
switch (placement) {
case "right":
dom.value.style.transform = "translateX(-".concat(right, "px)");
break;
case "top":
case "bottom":
dom.value.style.width = "calc(100% - ".concat(right, "px)");
dom.value.style.transform = "translateZ(0)";
break;
}
clearTimeout(timeout);
timeout = setTimeout(function() {
if (dom.value) {
dom.value.style.transition = "".concat(transformTransition, ",").concat(widthTransition);
dom.value.style.width = "";
dom.value.style.transform = "";
}
});
};
var remScrollingEffect = function remScrollingEffect2(right) {
var placement = props3.placement, duration = props3.duration, ease = props3.ease;
dom.value.style.transition = "none";
var heightTransition;
var widthTransition = "width ".concat(duration, " ").concat(ease);
var transformTransition = "transform ".concat(duration, " ").concat(ease);
switch (placement) {
case "left": {
dom.value.style.width = "100%";
widthTransition = "width 0s ".concat(ease, " ").concat(duration);
break;
}
case "right": {
dom.value.style.transform = "translateX(".concat(right, "px)");
dom.value.style.width = "100%";
widthTransition = "width 0s ".concat(ease, " ").concat(duration);
if (maskDom.value) {
maskDom.value.style.left = "-".concat(right, "px");
maskDom.value.style.width = "calc(100% + ".concat(right, "px)");
}
break;
}
case "top":
case "bottom": {
dom.value.style.width = "calc(100% + ".concat(right, "px)");
dom.value.style.height = "100%";
dom.value.style.transform = "translateZ(0)";
heightTransition = "height 0s ".concat(ease, " ").concat(duration);
break;
}
}
clearTimeout(timeout);
timeout = setTimeout(function() {
if (dom.value) {
dom.value.style.transition = "".concat(transformTransition, ",").concat(heightTransition ? "".concat(heightTransition, ",") : "").concat(widthTransition);
dom.value.style.transform = "";
dom.value.style.width = "";
dom.value.style.height = "";
}
});
};
var getCurrentDrawerSome = function getCurrentDrawerSome2() {
return !Object.keys(currentDrawer).some(function(key2) {
return currentDrawer[key2];
});
};
var getLevelDom = function getLevelDom2(_ref2) {
var level = _ref2.level, getContainer4 = _ref2.getContainer;
if (windowIsUndefined) {
return;
}
var container = getContainer4 === null || getContainer4 === void 0 ? void 0 : getContainer4();
var parent = container ? container.parentNode : null;
levelDom = [];
if (level === "all") {
var children = parent ? Array.prototype.slice.call(parent.children) : [];
children.forEach(function(child) {
if (child.nodeName !== "SCRIPT" && child.nodeName !== "STYLE" && child.nodeName !== "LINK" && child !== container) {
levelDom.push(child);
}
});
} else if (level) {
dataToArray(level).forEach(function(key2) {
document.querySelectorAll(key2).forEach(function(item) {
levelDom.push(item);
});
});
}
};
var onHandleClick = function onHandleClick2(e2) {
emit("handleClick", e2);
};
var canOpen = ref(false);
watch(dom, function() {
nextTick(function() {
canOpen.value = true;
});
});
return function() {
var _classnames, _slots$default, _slots$handler;
var width = props3.width, height = props3.height, $open = props3.open, prefixCls = props3.prefixCls, placement = props3.placement;
props3.level;
props3.levelMove;
props3.ease;
props3.duration;
props3.getContainer;
props3.onChange;
props3.afterVisibleChange;
var showMask = props3.showMask, maskClosable = props3.maskClosable, maskStyle = props3.maskStyle, keyboard = props3.keyboard;
props3.getOpenCount;
props3.scrollLocker;
var contentWrapperStyle = props3.contentWrapperStyle, style = props3.style, className = props3.class, otherProps = _objectWithoutProperties$2(props3, _excluded$7);
var open2 = $open && canOpen.value;
var wrapperClassName = classNames(prefixCls, (_classnames = {}, _defineProperty$q(_classnames, "".concat(prefixCls, "-").concat(placement), true), _defineProperty$q(_classnames, "".concat(prefixCls, "-open"), open2), _defineProperty$q(_classnames, className, !!className), _defineProperty$q(_classnames, "no-mask", !showMask), _classnames));
var placementName = horizontalBoolAndPlacementName.value.placementName;
var placementPos = placement === "left" || placement === "top" ? "-100%" : "100%";
var transform2 = open2 ? "" : "".concat(placementName, "(").concat(placementPos, ")");
return createVNode("div", _objectSpread2$1(_objectSpread2$1({}, omit(otherProps, ["switchScrollingEffect", "autofocus"])), {}, {
"tabindex": -1,
"class": wrapperClassName,
"style": style,
"ref": dom,
"onKeydown": open2 && keyboard ? onKeyDown : void 0,
"onTransitionend": onWrapperTransitionEnd
}), [showMask && createVNode("div", {
"class": "".concat(prefixCls, "-mask"),
"onClick": maskClosable ? onClose : void 0,
"style": maskStyle,
"ref": maskDom
}, null), createVNode("div", {
"class": "".concat(prefixCls, "-content-wrapper"),
"style": _objectSpread2$1({
transform: transform2,
msTransform: transform2,
width: isNumeric(width) ? "".concat(width, "px") : width,
height: isNumeric(height) ? "".concat(height, "px") : height
}, contentWrapperStyle),
"ref": contentWrapper
}, [createVNode("div", {
"class": "".concat(prefixCls, "-content"),
"ref": contentDom
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]), slots.handler ? createVNode("div", {
"onClick": onHandleClick,
"ref": handlerDom
}, [(_slots$handler = slots.handler) === null || _slots$handler === void 0 ? void 0 : _slots$handler.call(slots)]) : null])]);
};
}
});
const Child = DrawerChild;
function setStyle(style) {
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var _options$element = options.element, element = _options$element === void 0 ? document.body : _options$element;
var oldStyle = {};
var styleKeys = Object.keys(style);
styleKeys.forEach(function(key2) {
oldStyle[key2] = element.style[key2];
});
styleKeys.forEach(function(key2) {
element.style[key2] = style[key2];
});
return oldStyle;
}
function isBodyOverflowing() {
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
}
var cacheStyle$1 = {};
const switchScrollingEffect = function(close3) {
if (!isBodyOverflowing() && !close3) {
return;
}
var scrollingEffectClassName2 = "ant-scrolling-effect";
var scrollingEffectClassNameReg2 = new RegExp("".concat(scrollingEffectClassName2), "g");
var bodyClassName = document.body.className;
if (close3) {
if (!scrollingEffectClassNameReg2.test(bodyClassName))
return;
setStyle(cacheStyle$1);
cacheStyle$1 = {};
document.body.className = bodyClassName.replace(scrollingEffectClassNameReg2, "").trim();
return;
}
var scrollBarSize = getScrollBarSize();
if (scrollBarSize) {
cacheStyle$1 = setStyle({
position: "relative",
width: "calc(100% - ".concat(scrollBarSize, "px)")
});
if (!scrollingEffectClassNameReg2.test(bodyClassName)) {
var addClassName = "".concat(bodyClassName, " ").concat(scrollingEffectClassName2);
document.body.className = addClassName.trim();
}
}
};
var locks = [];
var scrollingEffectClassName = "ant-scrolling-effect";
var scrollingEffectClassNameReg = new RegExp("".concat(scrollingEffectClassName), "g");
var uuid$1 = 0;
var cacheStyle = /* @__PURE__ */ new Map();
var ScrollLocker = /* @__PURE__ */ _createClass(function ScrollLocker2(_options) {
var _this = this;
_classCallCheck(this, ScrollLocker2);
_defineProperty$q(this, "getContainer", function() {
var _this$options;
return (_this$options = _this.options) === null || _this$options === void 0 ? void 0 : _this$options.container;
});
_defineProperty$q(this, "reLock", function(options) {
var findLock = locks.find(function(_ref) {
var target = _ref.target;
return target === _this.lockTarget;
});
if (findLock) {
_this.unLock();
}
_this.options = options;
if (findLock) {
findLock.options = options;
_this.lock();
}
});
_defineProperty$q(this, "lock", function() {
var _this$options3;
if (locks.some(function(_ref2) {
var target = _ref2.target;
return target === _this.lockTarget;
})) {
return;
}
if (locks.some(function(_ref3) {
var _this$options2;
var options = _ref3.options;
return (options === null || options === void 0 ? void 0 : options.container) === ((_this$options2 = _this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.container);
})) {
locks = [].concat(_toConsumableArray(locks), [{
target: _this.lockTarget,
options: _this.options
}]);
return;
}
var scrollBarSize = 0;
var container = ((_this$options3 = _this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.container) || document.body;
if (container === document.body && window.innerWidth - document.documentElement.clientWidth > 0 || container.scrollHeight > container.clientHeight) {
scrollBarSize = getScrollBarSize();
}
var containerClassName = container.className;
if (locks.filter(function(_ref4) {
var _this$options4;
var options = _ref4.options;
return (options === null || options === void 0 ? void 0 : options.container) === ((_this$options4 = _this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.container);
}).length === 0) {
cacheStyle.set(container, setStyle({
width: scrollBarSize !== 0 ? "calc(100% - ".concat(scrollBarSize, "px)") : void 0,
overflow: "hidden",
overflowX: "hidden",
overflowY: "hidden"
}, {
element: container
}));
}
if (!scrollingEffectClassNameReg.test(containerClassName)) {
var addClassName = "".concat(containerClassName, " ").concat(scrollingEffectClassName);
container.className = addClassName.trim();
}
locks = [].concat(_toConsumableArray(locks), [{
target: _this.lockTarget,
options: _this.options
}]);
});
_defineProperty$q(this, "unLock", function() {
var _this$options5;
var findLock = locks.find(function(_ref5) {
var target = _ref5.target;
return target === _this.lockTarget;
});
locks = locks.filter(function(_ref6) {
var target = _ref6.target;
return target !== _this.lockTarget;
});
if (!findLock || locks.some(function(_ref7) {
var _findLock$options;
var options = _ref7.options;
return (options === null || options === void 0 ? void 0 : options.container) === ((_findLock$options = findLock.options) === null || _findLock$options === void 0 ? void 0 : _findLock$options.container);
})) {
return;
}
var container = ((_this$options5 = _this.options) === null || _this$options5 === void 0 ? void 0 : _this$options5.container) || document.body;
var containerClassName = container.className;
if (!scrollingEffectClassNameReg.test(containerClassName))
return;
setStyle(cacheStyle.get(container), {
element: container
});
cacheStyle.delete(container);
container.className = container.className.replace(scrollingEffectClassNameReg, "").trim();
});
this.lockTarget = uuid$1++;
this.options = _options;
});
var openCount = 0;
var supportDom = canUseDom();
var cacheOverflow = {};
var getParent2 = function getParent3(getContainer4) {
if (!supportDom) {
return null;
}
if (getContainer4) {
if (typeof getContainer4 === "string") {
return document.querySelectorAll(getContainer4)[0];
}
if (typeof getContainer4 === "function") {
return getContainer4();
}
if (_typeof$2(getContainer4) === "object" && getContainer4 instanceof window.HTMLElement) {
return getContainer4;
}
}
return document.body;
};
const Portal = defineComponent({
compatConfig: {
MODE: 3
},
name: "PortalWrapper",
inheritAttrs: false,
props: {
wrapperClassName: String,
forceRender: {
type: Boolean,
default: void 0
},
getContainer: PropTypes$1.any,
visible: {
type: Boolean,
default: void 0
}
},
setup: function setup78(props3, _ref) {
var slots = _ref.slots;
var container = ref();
var componentRef = ref();
var rafId = ref();
var scrollLocker = new ScrollLocker({
container: getParent2(props3.getContainer)
});
var removeCurrentContainer = function removeCurrentContainer2() {
var _container$value, _container$value$pare;
(_container$value = container.value) === null || _container$value === void 0 ? void 0 : (_container$value$pare = _container$value.parentNode) === null || _container$value$pare === void 0 ? void 0 : _container$value$pare.removeChild(container.value);
};
var attachToParent = function attachToParent2() {
var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
if (force || container.value && !container.value.parentNode) {
var parent = getParent2(props3.getContainer);
if (parent) {
parent.appendChild(container.value);
return true;
}
return false;
}
return true;
};
var getContainer4 = function getContainer5() {
if (!supportDom) {
return null;
}
if (!container.value) {
container.value = document.createElement("div");
attachToParent(true);
}
setWrapperClassName();
return container.value;
};
var setWrapperClassName = function setWrapperClassName2() {
var wrapperClassName = props3.wrapperClassName;
if (container.value && wrapperClassName && wrapperClassName !== container.value.className) {
container.value.className = wrapperClassName;
}
};
onUpdated(function() {
setWrapperClassName();
attachToParent();
});
var switchScrolling = function switchScrolling2() {
if (openCount === 1 && !Object.keys(cacheOverflow).length) {
switchScrollingEffect();
cacheOverflow = setStyle({
overflow: "hidden",
overflowX: "hidden",
overflowY: "hidden"
});
} else if (!openCount) {
setStyle(cacheOverflow);
cacheOverflow = {};
switchScrollingEffect(true);
}
};
var instance = getCurrentInstance();
onMounted(function() {
var init = false;
watch([function() {
return props3.visible;
}, function() {
return props3.getContainer;
}], function(_ref2, _ref3) {
var _ref4 = _slicedToArray$2(_ref2, 2), visible = _ref4[0], getContainer5 = _ref4[1];
var _ref5 = _slicedToArray$2(_ref3, 2), prevVisible = _ref5[0], prevGetContainer = _ref5[1];
if (supportDom && getParent2(props3.getContainer) === document.body) {
if (visible && !prevVisible) {
openCount += 1;
} else if (init) {
openCount -= 1;
}
}
if (init) {
var getContainerIsFunc = typeof getContainer5 === "function" && typeof prevGetContainer === "function";
if (getContainerIsFunc ? getContainer5.toString() !== prevGetContainer.toString() : getContainer5 !== prevGetContainer) {
removeCurrentContainer();
}
if (visible && visible !== prevVisible && supportDom && getParent2(getContainer5) !== scrollLocker.getContainer()) {
scrollLocker.reLock({
container: getParent2(getContainer5)
});
}
}
init = true;
}, {
immediate: true,
flush: "post"
});
nextTick(function() {
if (!attachToParent()) {
rafId.value = wrapperRaf(function() {
instance.update();
});
}
});
});
onBeforeUnmount(function() {
var visible = props3.visible, getContainer5 = props3.getContainer;
if (supportDom && getParent2(getContainer5) === document.body) {
openCount = visible && openCount ? openCount - 1 : openCount;
}
removeCurrentContainer();
wrapperRaf.cancel(rafId.value);
});
return function() {
var forceRender = props3.forceRender, visible = props3.visible;
var portal = null;
var childProps = {
getOpenCount: function getOpenCount2() {
return openCount;
},
getContainer: getContainer4,
switchScrollingEffect: switchScrolling,
scrollLocker
};
if (forceRender || visible || componentRef.value) {
portal = createVNode(Portal$1, {
"getContainer": getContainer4,
"ref": componentRef
}, {
default: function _default3() {
var _slots$default;
return (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots, childProps);
}
});
}
return portal;
};
}
});
var _excluded$6 = ["afterVisibleChange", "getContainer", "wrapperClassName", "forceRender"], _excluded2 = ["visible", "afterClose"];
var DrawerWrapper = defineComponent({
compatConfig: {
MODE: 3
},
inheritAttrs: false,
props: initDefaultProps$1(drawerProps$1(), {
prefixCls: "drawer",
placement: "left",
getContainer: "body",
level: "all",
duration: ".3s",
ease: "cubic-bezier(0.78, 0.14, 0.15, 0.86)",
afterVisibleChange: function afterVisibleChange() {
},
showMask: true,
maskClosable: true,
maskStyle: {},
wrapperClassName: "",
keyboard: true,
forceRender: false,
autofocus: true
}),
emits: ["handleClick", "close"],
slots: ["handler"],
setup: function setup79(props3, _ref) {
var emit = _ref.emit, slots = _ref.slots;
var dom = ref(null);
var onHandleClick = function onHandleClick2(e2) {
emit("handleClick", e2);
};
var onClose = function onClose2(e2) {
emit("close", e2);
};
return function() {
props3.afterVisibleChange;
var getContainer4 = props3.getContainer, wrapperClassName = props3.wrapperClassName, forceRender = props3.forceRender, otherProps = _objectWithoutProperties$2(props3, _excluded$6);
var portal = null;
if (!getContainer4) {
return createVNode("div", {
"class": wrapperClassName,
"ref": dom
}, [createVNode(Child, _objectSpread2$1(_objectSpread2$1({}, otherProps), {}, {
"open": props3.open,
"getContainer": function getContainer5() {
return dom.value;
},
"onClose": onClose,
"onHandleClick": onHandleClick
}), slots)]);
}
var $forceRender = !!slots.handler || forceRender;
if ($forceRender || props3.open || dom.value) {
portal = createVNode(Portal, {
"visible": props3.open,
"forceRender": $forceRender,
"getContainer": getContainer4,
"wrapperClassName": wrapperClassName
}, {
default: function _default3(_ref2) {
var visible = _ref2.visible, afterClose = _ref2.afterClose, rest = _objectWithoutProperties$2(_ref2, _excluded2);
return createVNode(Child, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
"ref": dom
}, otherProps), rest), {}, {
"open": visible !== void 0 ? visible : props3.open,
"afterVisibleChange": afterClose !== void 0 ? afterClose : props3.afterVisibleChange,
"onClose": onClose,
"onHandleClick": onHandleClick
}), slots);
}
});
}
return portal;
};
}
});
const Drawer$1 = DrawerWrapper;
var _excluded$5 = ["width", "height", "visible", "placement", "mask", "wrapClassName", "class"];
var PlacementTypes = tuple$1("top", "right", "bottom", "left");
tuple$1("default", "large");
var defaultPushState = {
distance: 180
};
var drawerProps2 = function drawerProps3() {
return {
autofocus: {
type: Boolean,
default: void 0
},
closable: {
type: Boolean,
default: void 0
},
closeIcon: PropTypes$1.any,
destroyOnClose: {
type: Boolean,
default: void 0
},
forceRender: {
type: Boolean,
default: void 0
},
getContainer: PropTypes$1.any,
maskClosable: {
type: Boolean,
default: void 0
},
mask: {
type: Boolean,
default: void 0
},
maskStyle: {
type: Object,
default: void 0
},
/** @deprecated Use `style` instead */
wrapStyle: {
type: Object,
default: void 0
},
style: {
type: Object,
default: void 0
},
class: PropTypes$1.any,
/** @deprecated Use `class` instead */
wrapClassName: String,
size: {
type: String
},
drawerStyle: {
type: Object,
default: void 0
},
headerStyle: {
type: Object,
default: void 0
},
bodyStyle: {
type: Object,
default: void 0
},
contentWrapperStyle: {
type: Object,
default: void 0
},
title: PropTypes$1.any,
visible: {
type: Boolean,
default: void 0
},
width: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number]),
height: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number]),
zIndex: Number,
prefixCls: String,
push: PropTypes$1.oneOfType([PropTypes$1.looseBool, {
type: Object
}]),
placement: PropTypes$1.oneOf(PlacementTypes),
keyboard: {
type: Boolean,
default: void 0
},
extra: PropTypes$1.any,
footer: PropTypes$1.any,
footerStyle: {
type: Object,
default: void 0
},
level: PropTypes$1.any,
levelMove: {
type: [Number, Array, Function]
},
handle: PropTypes$1.any,
/** @deprecated Use `@afterVisibleChange` instead */
afterVisibleChange: Function,
onAfterVisibleChange: Function,
"onUpdate:visible": Function,
onClose: Function
};
};
var Drawer = defineComponent({
compatConfig: {
MODE: 3
},
name: "ADrawer",
inheritAttrs: false,
props: initDefaultProps$1(drawerProps2(), {
closable: true,
placement: "right",
maskClosable: true,
mask: true,
level: null,
keyboard: true,
push: defaultPushState
}),
slots: ["closeIcon", "title", "extra", "footer", "handle"],
// emits: ['update:visible', 'close', 'afterVisibleChange'],
setup: function setup80(props3, _ref) {
var emit = _ref.emit, slots = _ref.slots, attrs = _ref.attrs;
var sPush = ref(false);
var destroyClose = ref(false);
var vcDrawer = ref(null);
var parentDrawerOpts = inject("parentDrawerOpts", null);
var _useConfigInject = useConfigInject("drawer", props3), prefixCls = _useConfigInject.prefixCls;
devWarning(!props3.afterVisibleChange, "Drawer", "`afterVisibleChange` prop is deprecated, please use `@afterVisibleChange` event instead");
devWarning(props3.wrapStyle === void 0, "Drawer", "`wrapStyle` prop is deprecated, please use `style` instead");
devWarning(props3.wrapClassName === void 0, "Drawer", "`wrapClassName` prop is deprecated, please use `class` instead");
var setPush = function setPush2() {
sPush.value = true;
};
var setPull = function setPull2() {
sPush.value = false;
nextTick(function() {
domFocus();
});
};
provide("parentDrawerOpts", {
setPush,
setPull
});
onMounted(function() {
var visible = props3.visible;
if (visible && parentDrawerOpts) {
parentDrawerOpts.setPush();
}
});
onUnmounted(function() {
if (parentDrawerOpts) {
parentDrawerOpts.setPull();
}
});
watch(function() {
return props3.visible;
}, function(visible) {
if (parentDrawerOpts) {
if (visible) {
parentDrawerOpts.setPush();
} else {
parentDrawerOpts.setPull();
}
}
}, {
flush: "post"
});
var domFocus = function domFocus2() {
var _vcDrawer$value, _vcDrawer$value$domFo;
(_vcDrawer$value = vcDrawer.value) === null || _vcDrawer$value === void 0 ? void 0 : (_vcDrawer$value$domFo = _vcDrawer$value.domFocus) === null || _vcDrawer$value$domFo === void 0 ? void 0 : _vcDrawer$value$domFo.call(_vcDrawer$value);
};
var close3 = function close4(e2) {
emit("update:visible", false);
emit("close", e2);
};
var afterVisibleChange2 = function afterVisibleChange3(visible) {
var _props$afterVisibleCh;
(_props$afterVisibleCh = props3.afterVisibleChange) === null || _props$afterVisibleCh === void 0 ? void 0 : _props$afterVisibleCh.call(props3, visible);
emit("afterVisibleChange", visible);
};
var destroyOnClose = computed(function() {
return props3.destroyOnClose && !props3.visible;
});
var onDestroyTransitionEnd = function onDestroyTransitionEnd2() {
var isDestroyOnClose = destroyOnClose.value;
if (!isDestroyOnClose) {
return;
}
if (!props3.visible) {
destroyClose.value = true;
}
};
var pushTransform = computed(function() {
var push = props3.push, placement = props3.placement;
var distance;
if (typeof push === "boolean") {
distance = push ? defaultPushState.distance : 0;
} else {
distance = push.distance;
}
distance = parseFloat(String(distance || 0));
if (placement === "left" || placement === "right") {
return "translateX(".concat(placement === "left" ? distance : -distance, "px)");
}
if (placement === "top" || placement === "bottom") {
return "translateY(".concat(placement === "top" ? distance : -distance, "px)");
}
return null;
});
var offsetStyle = computed(function() {
var visible = props3.visible, mask = props3.mask, placement = props3.placement, _props$size = props3.size, size = _props$size === void 0 ? "default" : _props$size, width = props3.width, height = props3.height;
if (!visible && !mask) {
return {};
}
var val = {};
if (placement === "left" || placement === "right") {
var defaultWidth = size === "large" ? 736 : 378;
val.width = typeof width === "undefined" ? defaultWidth : width;
val.width = typeof val.width === "string" ? val.width : "".concat(val.width, "px");
} else {
var defaultHeight = size === "large" ? 736 : 378;
val.height = typeof height === "undefined" ? defaultHeight : height;
val.height = typeof val.height === "string" ? val.height : "".concat(val.height, "px");
}
return val;
});
var drawerStyle = computed(function() {
var zIndex = props3.zIndex, wrapStyle = props3.wrapStyle, mask = props3.mask, style = props3.style;
var val = mask ? {} : offsetStyle.value;
return _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
zIndex,
transform: sPush.value ? pushTransform.value : void 0
}, val), wrapStyle), style);
});
var renderHeader = function renderHeader2(prefixCls2) {
var closable = props3.closable, headerStyle = props3.headerStyle;
var extra = getPropsSlot(slots, props3, "extra");
var title = getPropsSlot(slots, props3, "title");
if (!title && !closable) {
return null;
}
return createVNode("div", {
"class": classNames("".concat(prefixCls2, "-header"), _defineProperty$q({}, "".concat(prefixCls2, "-header-close-only"), closable && !title && !extra)),
"style": headerStyle
}, [createVNode("div", {
"class": "".concat(prefixCls2, "-header-title")
}, [renderCloseIcon(prefixCls2), title && createVNode("div", {
"class": "".concat(prefixCls2, "-title")
}, [title])]), extra && createVNode("div", {
"class": "".concat(prefixCls2, "-extra")
}, [extra])]);
};
var renderCloseIcon = function renderCloseIcon2(prefixCls2) {
var _slots$closeIcon;
var closable = props3.closable;
var $closeIcon = slots.closeIcon ? (_slots$closeIcon = slots.closeIcon) === null || _slots$closeIcon === void 0 ? void 0 : _slots$closeIcon.call(slots) : props3.closeIcon;
return closable && createVNode("button", {
"key": "closer",
"onClick": close3,
"aria-label": "Close",
"class": "".concat(prefixCls2, "-close")
}, [$closeIcon === void 0 ? createVNode(CloseOutlined$1, null, null) : $closeIcon]);
};
var renderBody = function renderBody2(prefixCls2) {
var _slots$default;
if (destroyClose.value && !props3.visible) {
return null;
}
destroyClose.value = false;
var bodyStyle = props3.bodyStyle, drawerStyle2 = props3.drawerStyle;
var containerStyle = {};
var isDestroyOnClose = destroyOnClose.value;
if (isDestroyOnClose) {
containerStyle.opacity = 0;
containerStyle.transition = "opacity .3s";
}
return createVNode("div", {
"class": "".concat(prefixCls2, "-wrapper-body"),
"style": _objectSpread2$1(_objectSpread2$1({}, containerStyle), drawerStyle2),
"onTransitionend": onDestroyTransitionEnd
}, [renderHeader(prefixCls2), createVNode("div", {
"key": "body",
"class": "".concat(prefixCls2, "-body"),
"style": bodyStyle
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]), renderFooter(prefixCls2)]);
};
var renderFooter = function renderFooter2(prefixCls2) {
var footer = getPropsSlot(slots, props3, "footer");
if (!footer) {
return null;
}
var footerClassName = "".concat(prefixCls2, "-footer");
return createVNode("div", {
"class": footerClassName,
"style": props3.footerStyle
}, [footer]);
};
return function() {
var _classnames2;
props3.width;
props3.height;
var visible = props3.visible, placement = props3.placement, mask = props3.mask, wrapClassName = props3.wrapClassName, className = props3.class, rest = _objectWithoutProperties$2(props3, _excluded$5);
var val = mask ? offsetStyle.value : {};
var haveMask = mask ? "" : "no-mask";
var vcDrawerProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, attrs), omit(rest, ["size", "closeIcon", "closable", "destroyOnClose", "drawerStyle", "headerStyle", "bodyStyle", "title", "push", "wrapStyle", "onAfterVisibleChange", "onClose", "onUpdate:visible"])), val), {}, {
onClose: close3,
afterVisibleChange: afterVisibleChange2,
handler: false,
prefixCls: prefixCls.value,
open: visible,
showMask: mask,
placement,
class: classNames((_classnames2 = {}, _defineProperty$q(_classnames2, className, className), _defineProperty$q(_classnames2, wrapClassName, !!wrapClassName), _defineProperty$q(_classnames2, haveMask, !!haveMask), _classnames2)),
style: drawerStyle.value,
ref: vcDrawer
});
return createVNode(Drawer$1, vcDrawerProps, {
handler: props3.handle ? function() {
return props3.handle;
} : slots.handle,
default: function _default3() {
return renderBody(prefixCls.value);
}
});
};
}
});
const __unplugin_components_1$1 = withInstall(Drawer);
var inputProps = function inputProps2() {
return {
id: String,
prefixCls: String,
inputPrefixCls: String,
defaultValue: PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number]),
value: {
type: [String, Number, Symbol],
default: void 0
},
placeholder: {
type: [String, Number]
},
autocomplete: String,
type: {
type: String,
default: "text"
},
name: String,
size: {
type: String
},
disabled: {
type: Boolean,
default: void 0
},
readonly: {
type: Boolean,
default: void 0
},
addonBefore: PropTypes$1.any,
addonAfter: PropTypes$1.any,
prefix: PropTypes$1.any,
suffix: PropTypes$1.any,
autofocus: {
type: Boolean,
default: void 0
},
allowClear: {
type: Boolean,
default: void 0
},
lazy: {
type: Boolean,
default: true
},
maxlength: Number,
loading: {
type: Boolean,
default: void 0
},
bordered: {
type: Boolean,
default: void 0
},
showCount: {
type: [Boolean, Object]
},
htmlSize: Number,
onPressEnter: Function,
onKeydown: Function,
onKeyup: Function,
onFocus: Function,
onBlur: Function,
onChange: Function,
onInput: Function,
"onUpdate:value": Function,
valueModifiers: Object,
hidden: Boolean
};
};
const inputProps$1 = inputProps;
var textAreaProps = function textAreaProps2() {
return _objectSpread2$1(_objectSpread2$1({}, omit(inputProps(), ["prefix", "addonBefore", "addonAfter", "suffix"])), {}, {
rows: Number,
autosize: {
type: [Boolean, Object],
default: void 0
},
autoSize: {
type: [Boolean, Object],
default: void 0
},
onResize: {
type: Function
},
onCompositionstart: Function,
onCompositionend: Function,
valueModifiers: Object
});
};
function getInputClassName(prefixCls, bordered, size, disabled, direction) {
var _classNames;
return classNames(prefixCls, (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls, "-sm"), size === "small"), _defineProperty$q(_classNames, "".concat(prefixCls, "-lg"), size === "large"), _defineProperty$q(_classNames, "".concat(prefixCls, "-disabled"), disabled), _defineProperty$q(_classNames, "".concat(prefixCls, "-rtl"), direction === "rtl"), _defineProperty$q(_classNames, "".concat(prefixCls, "-borderless"), !bordered), _classNames));
}
var isValid2 = function isValid3(value2) {
return value2 !== void 0 && value2 !== null && (Array.isArray(value2) ? filterEmpty(value2).length : true);
};
function hasPrefixSuffix(propsAndSlots) {
return isValid2(propsAndSlots.prefix) || isValid2(propsAndSlots.suffix) || isValid2(propsAndSlots.allowClear);
}
function hasAddon(propsAndSlots) {
return isValid2(propsAndSlots.addonBefore) || isValid2(propsAndSlots.addonAfter);
}
var ClearableInputType = ["text", "input"];
const ClearableLabeledInput = defineComponent({
compatConfig: {
MODE: 3
},
name: "ClearableLabeledInput",
inheritAttrs: false,
props: {
prefixCls: String,
inputType: PropTypes$1.oneOf(tuple$1("text", "input")),
value: PropTypes$1.any,
defaultValue: PropTypes$1.any,
allowClear: {
type: Boolean,
default: void 0
},
element: PropTypes$1.any,
handleReset: Function,
disabled: {
type: Boolean,
default: void 0
},
direction: {
type: String
},
size: {
type: String
},
suffix: PropTypes$1.any,
prefix: PropTypes$1.any,
addonBefore: PropTypes$1.any,
addonAfter: PropTypes$1.any,
readonly: {
type: Boolean,
default: void 0
},
focused: {
type: Boolean,
default: void 0
},
bordered: {
type: Boolean,
default: true
},
triggerFocus: {
type: Function
},
hidden: Boolean
},
setup: function setup81(props3, _ref) {
var slots = _ref.slots, attrs = _ref.attrs;
var containerRef = ref();
var onInputMouseUp = function onInputMouseUp2(e2) {
var _containerRef$value;
if ((_containerRef$value = containerRef.value) !== null && _containerRef$value !== void 0 && _containerRef$value.contains(e2.target)) {
var triggerFocus2 = props3.triggerFocus;
triggerFocus2 === null || triggerFocus2 === void 0 ? void 0 : triggerFocus2();
}
};
var renderClearIcon = function renderClearIcon2(prefixCls) {
var _classNames;
var allowClear = props3.allowClear, value2 = props3.value, disabled = props3.disabled, readonly = props3.readonly, handleReset = props3.handleReset, _props$suffix = props3.suffix, suffix = _props$suffix === void 0 ? slots.suffix : _props$suffix;
if (!allowClear) {
return null;
}
var needClear = !disabled && !readonly && value2;
var className = "".concat(prefixCls, "-clear-icon");
return createVNode(CloseCircleFilled$1, {
"onClick": handleReset,
"onMousedown": function onMousedown2(e2) {
return e2.preventDefault();
},
"class": classNames((_classNames = {}, _defineProperty$q(_classNames, "".concat(className, "-hidden"), !needClear), _defineProperty$q(_classNames, "".concat(className, "-has-suffix"), !!suffix), _classNames), className),
"role": "button"
}, null);
};
var renderSuffix = function renderSuffix2(prefixCls) {
var _slots$suffix;
var _props$suffix2 = props3.suffix, suffix = _props$suffix2 === void 0 ? (_slots$suffix = slots.suffix) === null || _slots$suffix === void 0 ? void 0 : _slots$suffix.call(slots) : _props$suffix2, allowClear = props3.allowClear;
if (suffix || allowClear) {
return createVNode("span", {
"class": "".concat(prefixCls, "-suffix")
}, [renderClearIcon(prefixCls), suffix]);
}
return null;
};
var renderLabeledIcon = function renderLabeledIcon2(prefixCls, element) {
var _slots$prefix, _slots$suffix2, _classNames2;
var focused = props3.focused, value2 = props3.value, _props$prefix = props3.prefix, prefix = _props$prefix === void 0 ? (_slots$prefix = slots.prefix) === null || _slots$prefix === void 0 ? void 0 : _slots$prefix.call(slots) : _props$prefix, size = props3.size, _props$suffix3 = props3.suffix, suffix = _props$suffix3 === void 0 ? (_slots$suffix2 = slots.suffix) === null || _slots$suffix2 === void 0 ? void 0 : _slots$suffix2.call(slots) : _props$suffix3, disabled = props3.disabled, allowClear = props3.allowClear, direction = props3.direction, readonly = props3.readonly, bordered = props3.bordered, hidden = props3.hidden, _props$addonAfter = props3.addonAfter, addonAfter = _props$addonAfter === void 0 ? slots.addonAfter : _props$addonAfter, _props$addonBefore = props3.addonBefore, addonBefore = _props$addonBefore === void 0 ? slots.addonBefore : _props$addonBefore;
var suffixNode = renderSuffix(prefixCls);
if (!hasPrefixSuffix({
prefix,
suffix,
allowClear
})) {
return cloneElement(element, {
value: value2
});
}
var prefixNode = prefix ? createVNode("span", {
"class": "".concat(prefixCls, "-prefix")
}, [prefix]) : null;
var affixWrapperCls = classNames("".concat(prefixCls, "-affix-wrapper"), (_classNames2 = {}, _defineProperty$q(_classNames2, "".concat(prefixCls, "-affix-wrapper-focused"), focused), _defineProperty$q(_classNames2, "".concat(prefixCls, "-affix-wrapper-disabled"), disabled), _defineProperty$q(_classNames2, "".concat(prefixCls, "-affix-wrapper-sm"), size === "small"), _defineProperty$q(_classNames2, "".concat(prefixCls, "-affix-wrapper-lg"), size === "large"), _defineProperty$q(_classNames2, "".concat(prefixCls, "-affix-wrapper-input-with-clear-btn"), suffix && allowClear && value2), _defineProperty$q(_classNames2, "".concat(prefixCls, "-affix-wrapper-rtl"), direction === "rtl"), _defineProperty$q(_classNames2, "".concat(prefixCls, "-affix-wrapper-readonly"), readonly), _defineProperty$q(_classNames2, "".concat(prefixCls, "-affix-wrapper-borderless"), !bordered), _defineProperty$q(_classNames2, "".concat(attrs.class), !hasAddon({
addonAfter,
addonBefore
}) && attrs.class), _classNames2));
return createVNode("span", {
"ref": containerRef,
"class": affixWrapperCls,
"style": attrs.style,
"onMouseup": onInputMouseUp,
"hidden": hidden
}, [prefixNode, cloneElement(element, {
style: null,
value: value2,
class: getInputClassName(prefixCls, bordered, size, disabled)
}), suffixNode]);
};
var renderInputWithLabel = function renderInputWithLabel2(prefixCls, labeledElement) {
var _slots$addonBefore, _slots$addonAfter, _classNames5;
var _props$addonBefore2 = props3.addonBefore, addonBefore = _props$addonBefore2 === void 0 ? (_slots$addonBefore = slots.addonBefore) === null || _slots$addonBefore === void 0 ? void 0 : _slots$addonBefore.call(slots) : _props$addonBefore2, _props$addonAfter2 = props3.addonAfter, addonAfter = _props$addonAfter2 === void 0 ? (_slots$addonAfter = slots.addonAfter) === null || _slots$addonAfter === void 0 ? void 0 : _slots$addonAfter.call(slots) : _props$addonAfter2, size = props3.size, direction = props3.direction, hidden = props3.hidden, disabled = props3.disabled;
if (!hasAddon({
addonBefore,
addonAfter
})) {
return labeledElement;
}
var wrapperClassName = "".concat(prefixCls, "-group");
var addonClassName = "".concat(wrapperClassName, "-addon");
var mergedAddonClassName = classNames(addonClassName, _defineProperty$q({}, "".concat(addonClassName, "-disabled"), disabled));
var addonBeforeNode = addonBefore ? createVNode("span", {
"class": mergedAddonClassName
}, [addonBefore]) : null;
var addonAfterNode = addonAfter ? createVNode("span", {
"class": mergedAddonClassName
}, [addonAfter]) : null;
var mergedWrapperClassName = classNames("".concat(prefixCls, "-wrapper"), wrapperClassName, _defineProperty$q({}, "".concat(wrapperClassName, "-rtl"), direction === "rtl"));
var mergedGroupClassName = classNames("".concat(prefixCls, "-group-wrapper"), (_classNames5 = {}, _defineProperty$q(_classNames5, "".concat(prefixCls, "-group-wrapper-sm"), size === "small"), _defineProperty$q(_classNames5, "".concat(prefixCls, "-group-wrapper-lg"), size === "large"), _defineProperty$q(_classNames5, "".concat(prefixCls, "-group-wrapper-rtl"), direction === "rtl"), _classNames5), attrs.class);
return createVNode("span", {
"class": mergedGroupClassName,
"style": attrs.style,
"hidden": hidden
}, [createVNode("span", {
"class": mergedWrapperClassName
}, [addonBeforeNode, cloneElement(labeledElement, {
style: null
}), addonAfterNode])]);
};
var renderTextAreaWithClearIcon = function renderTextAreaWithClearIcon2(prefixCls, element) {
var _classNames6;
var value2 = props3.value, allowClear = props3.allowClear, direction = props3.direction, bordered = props3.bordered, hidden = props3.hidden, _props$addonAfter3 = props3.addonAfter, addonAfter = _props$addonAfter3 === void 0 ? slots.addonAfter : _props$addonAfter3, _props$addonBefore3 = props3.addonBefore, addonBefore = _props$addonBefore3 === void 0 ? slots.addonBefore : _props$addonBefore3;
if (!allowClear) {
return cloneElement(element, {
value: value2
});
}
var affixWrapperCls = classNames("".concat(prefixCls, "-affix-wrapper"), "".concat(prefixCls, "-affix-wrapper-textarea-with-clear-btn"), (_classNames6 = {}, _defineProperty$q(_classNames6, "".concat(prefixCls, "-affix-wrapper-rtl"), direction === "rtl"), _defineProperty$q(_classNames6, "".concat(prefixCls, "-affix-wrapper-borderless"), !bordered), _defineProperty$q(_classNames6, "".concat(attrs.class), !hasAddon({
addonAfter,
addonBefore
}) && attrs.class), _classNames6));
return createVNode("span", {
"class": affixWrapperCls,
"style": attrs.style,
"hidden": hidden
}, [cloneElement(element, {
style: null,
value: value2
}), renderClearIcon(prefixCls)]);
};
return function() {
var _slots$element;
var prefixCls = props3.prefixCls, inputType = props3.inputType, _props$element = props3.element, element = _props$element === void 0 ? (_slots$element = slots.element) === null || _slots$element === void 0 ? void 0 : _slots$element.call(slots) : _props$element;
if (inputType === ClearableInputType[0]) {
return renderTextAreaWithClearIcon(prefixCls, element);
}
return renderInputWithLabel(prefixCls, renderLabeledIcon(prefixCls, element));
};
}
});
function fixControlledValue(value2) {
if (typeof value2 === "undefined" || value2 === null) {
return "";
}
return String(value2);
}
function resolveOnChange(target, e2, onChange, targetValue) {
if (!onChange) {
return;
}
var event = e2;
if (e2.type === "click") {
Object.defineProperty(event, "target", {
writable: true
});
Object.defineProperty(event, "currentTarget", {
writable: true
});
var currentTarget = target.cloneNode(true);
event.target = currentTarget;
event.currentTarget = currentTarget;
currentTarget.value = "";
onChange(event);
return;
}
if (targetValue !== void 0) {
Object.defineProperty(event, "target", {
writable: true
});
Object.defineProperty(event, "currentTarget", {
writable: true
});
event.target = target;
event.currentTarget = target;
target.value = targetValue;
onChange(event);
return;
}
onChange(event);
}
function triggerFocus(element, option) {
if (!element)
return;
element.focus(option);
var _ref = option || {}, cursor = _ref.cursor;
if (cursor) {
var len = element.value.length;
switch (cursor) {
case "start":
element.setSelectionRange(0, 0);
break;
case "end":
element.setSelectionRange(len, len);
break;
default:
element.setSelectionRange(0, len);
}
}
}
const Input = defineComponent({
compatConfig: {
MODE: 3
},
name: "AInput",
inheritAttrs: false,
props: inputProps$1(),
setup: function setup82(props3, _ref2) {
var slots = _ref2.slots, attrs = _ref2.attrs, expose = _ref2.expose, emit = _ref2.emit;
var inputRef = ref();
var clearableInputRef = ref();
var removePasswordTimeout;
var formItemContext = useInjectFormItemContext();
var _useConfigInject = useConfigInject("input", props3), direction = _useConfigInject.direction, prefixCls = _useConfigInject.prefixCls, size = _useConfigInject.size, autocomplete = _useConfigInject.autocomplete;
var stateValue = ref(props3.value === void 0 ? props3.defaultValue : props3.value);
var focused = ref(false);
watch(function() {
return props3.value;
}, function() {
stateValue.value = props3.value;
});
watch(function() {
return props3.disabled;
}, function() {
if (props3.value !== void 0) {
stateValue.value = props3.value;
}
if (props3.disabled) {
focused.value = false;
}
});
var clearPasswordValueAttribute = function clearPasswordValueAttribute2() {
removePasswordTimeout = setTimeout(function() {
var _inputRef$value;
if (((_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 ? void 0 : _inputRef$value.getAttribute("type")) === "password" && inputRef.value.hasAttribute("value")) {
inputRef.value.removeAttribute("value");
}
});
};
var focus = function focus2(option) {
triggerFocus(inputRef.value, option);
};
var blur = function blur2() {
var _inputRef$value2;
(_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 ? void 0 : _inputRef$value2.blur();
};
var setSelectionRange = function setSelectionRange2(start, end, direction2) {
var _inputRef$value3;
(_inputRef$value3 = inputRef.value) === null || _inputRef$value3 === void 0 ? void 0 : _inputRef$value3.setSelectionRange(start, end, direction2);
};
var select = function select2() {
var _inputRef$value4;
(_inputRef$value4 = inputRef.value) === null || _inputRef$value4 === void 0 ? void 0 : _inputRef$value4.select();
};
expose({
focus,
blur,
input: inputRef,
stateValue,
setSelectionRange,
select
});
var onFocus2 = function onFocus3(e2) {
var onFocus4 = props3.onFocus;
focused.value = true;
onFocus4 === null || onFocus4 === void 0 ? void 0 : onFocus4(e2);
nextTick(function() {
clearPasswordValueAttribute();
});
};
var onBlur2 = function onBlur3(e2) {
var onBlur4 = props3.onBlur;
focused.value = false;
onBlur4 === null || onBlur4 === void 0 ? void 0 : onBlur4(e2);
formItemContext.onFieldBlur();
nextTick(function() {
clearPasswordValueAttribute();
});
};
var triggerChange = function triggerChange2(e2) {
emit("update:value", e2.target.value);
emit("change", e2);
emit("input", e2);
formItemContext.onFieldChange();
};
var instance = getCurrentInstance();
var setValue = function setValue2(value2, callback) {
if (stateValue.value === value2) {
return;
}
if (props3.value === void 0) {
stateValue.value = value2;
} else {
nextTick(function() {
if (inputRef.value.value !== stateValue.value) {
instance.update();
}
});
}
nextTick(function() {
callback && callback();
});
};
var handleReset = function handleReset2(e2) {
resolveOnChange(inputRef.value, e2, triggerChange);
setValue("", function() {
focus();
});
};
var handleChange = function handleChange2(e2) {
var _e$target = e2.target, value2 = _e$target.value, composing = _e$target.composing;
if ((e2.isComposing || composing) && props3.lazy || stateValue.value === value2)
return;
var newVal = e2.target.value;
resolveOnChange(inputRef.value, e2, triggerChange);
setValue(newVal, function() {
clearPasswordValueAttribute();
});
};
var handleKeyDown = function handleKeyDown2(e2) {
if (e2.keyCode === 13) {
emit("pressEnter", e2);
}
emit("keydown", e2);
};
onMounted(function() {
clearPasswordValueAttribute();
});
onBeforeUnmount(function() {
clearTimeout(removePasswordTimeout);
});
var renderInput = function renderInput2() {
var _otherProps$id;
var _props$addonBefore = props3.addonBefore, addonBefore = _props$addonBefore === void 0 ? slots.addonBefore : _props$addonBefore, _props$addonAfter = props3.addonAfter, addonAfter = _props$addonAfter === void 0 ? slots.addonAfter : _props$addonAfter, disabled = props3.disabled, _props$bordered = props3.bordered, bordered = _props$bordered === void 0 ? true : _props$bordered, _props$valueModifiers = props3.valueModifiers, valueModifiers = _props$valueModifiers === void 0 ? {} : _props$valueModifiers, htmlSize = props3.htmlSize;
var otherProps = omit(props3, [
"prefixCls",
"onPressEnter",
"addonBefore",
"addonAfter",
"prefix",
"suffix",
"allowClear",
// Input elements must be either controlled or uncontrolled,
// specify either the value prop, or the defaultValue prop, but not both.
"defaultValue",
"size",
"bordered",
"htmlSize",
"lazy",
"showCount",
"valueModifiers"
]);
var inputProps3 = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, otherProps), attrs), {}, {
autocomplete: autocomplete.value,
onChange: handleChange,
onInput: handleChange,
onFocus: onFocus2,
onBlur: onBlur2,
onKeydown: handleKeyDown,
class: classNames(getInputClassName(prefixCls.value, bordered, size.value, disabled, direction.value), _defineProperty$q({}, attrs.class, attrs.class && !addonBefore && !addonAfter)),
ref: inputRef,
key: "ant-input",
size: htmlSize,
id: (_otherProps$id = otherProps.id) !== null && _otherProps$id !== void 0 ? _otherProps$id : formItemContext.id.value
});
if (valueModifiers.lazy) {
delete inputProps3.onInput;
}
if (!inputProps3.autofocus) {
delete inputProps3.autofocus;
}
var inputNode = createVNode("input", omit(inputProps3, ["size"]), null);
return withDirectives(inputNode, [[antInputDirective]]);
};
var renderShowCountSuffix = function renderShowCountSuffix2() {
var _slots$suffix;
var value2 = stateValue.value;
var maxlength = props3.maxlength, _props$suffix = props3.suffix, suffix = _props$suffix === void 0 ? (_slots$suffix = slots.suffix) === null || _slots$suffix === void 0 ? void 0 : _slots$suffix.call(slots) : _props$suffix, showCount = props3.showCount;
var hasMaxLength = Number(maxlength) > 0;
if (suffix || showCount) {
var valueLength = _toConsumableArray(fixControlledValue(value2)).length;
var dataCount = null;
if (_typeof$2(showCount) === "object") {
dataCount = showCount.formatter({
count: valueLength,
maxlength
});
} else {
dataCount = "".concat(valueLength).concat(hasMaxLength ? " / ".concat(maxlength) : "");
}
return createVNode(Fragment, null, [!!showCount && createVNode("span", {
"class": classNames("".concat(prefixCls.value, "-show-count-suffix"), _defineProperty$q({}, "".concat(prefixCls.value, "-show-count-has-suffix"), !!suffix))
}, [dataCount]), suffix]);
}
return null;
};
return function() {
var inputProps3 = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, attrs), props3), {}, {
prefixCls: prefixCls.value,
inputType: "input",
value: fixControlledValue(stateValue.value),
handleReset,
focused: focused.value && !props3.disabled
});
return createVNode(ClearableLabeledInput, _objectSpread2$1(_objectSpread2$1({}, omit(inputProps3, ["element", "valueModifiers", "suffix", "showCount"])), {}, {
"ref": clearableInputRef
}), _objectSpread2$1(_objectSpread2$1({}, slots), {}, {
element: renderInput,
suffix: renderShowCountSuffix
}));
};
}
});
const __unplugin_components_2$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AInputGroup",
props: {
prefixCls: String,
size: {
type: String
},
compact: {
type: Boolean,
default: void 0
},
onMouseenter: {
type: Function
},
onMouseleave: {
type: Function
},
onFocus: {
type: Function
},
onBlur: {
type: Function
}
},
setup: function setup83(props3, _ref) {
var slots = _ref.slots;
var _useConfigInject = useConfigInject("input-group", props3), prefixCls = _useConfigInject.prefixCls, direction = _useConfigInject.direction;
var cls = computed(function() {
var _ref2;
var pre = prefixCls.value;
return _ref2 = {}, _defineProperty$q(_ref2, "".concat(pre), true), _defineProperty$q(_ref2, "".concat(pre, "-lg"), props3.size === "large"), _defineProperty$q(_ref2, "".concat(pre, "-sm"), props3.size === "small"), _defineProperty$q(_ref2, "".concat(pre, "-compact"), props3.compact), _defineProperty$q(_ref2, "".concat(pre, "-rtl"), direction.value === "rtl"), _ref2;
});
return function() {
var _slots$default;
return createVNode("span", {
"class": cls.value,
"onMouseenter": props3.onMouseenter,
"onMouseleave": props3.onMouseleave,
"onFocus": props3.onFocus,
"onBlur": props3.onBlur
}, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]);
};
}
});
var applePhone = /iPhone/i;
var appleIpod = /iPod/i;
var appleTablet = /iPad/i;
var androidPhone = /\bAndroid(?:.+)Mobile\b/i;
var androidTablet = /Android/i;
var amazonPhone = /\bAndroid(?:.+)SD4930UR\b/i;
var amazonTablet = /\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i;
var windowsPhone = /Windows Phone/i;
var windowsTablet = /\bWindows(?:.+)ARM\b/i;
var otherBlackberry = /BlackBerry/i;
var otherBlackberry10 = /BB10/i;
var otherOpera = /Opera Mini/i;
var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i;
var otherFirefox = /Mobile(?:.+)Firefox\b/i;
function match$1(regex, userAgent) {
return regex.test(userAgent);
}
function isMobile(userAgent) {
var ua = userAgent || (typeof navigator !== "undefined" ? navigator.userAgent : "");
var tmp = ua.split("[FBAN");
if (typeof tmp[1] !== "undefined") {
var _tmp = tmp;
var _tmp2 = _slicedToArray$2(_tmp, 1);
ua = _tmp2[0];
}
tmp = ua.split("Twitter");
if (typeof tmp[1] !== "undefined") {
var _tmp3 = tmp;
var _tmp4 = _slicedToArray$2(_tmp3, 1);
ua = _tmp4[0];
}
var result = {
apple: {
phone: match$1(applePhone, ua) && !match$1(windowsPhone, ua),
ipod: match$1(appleIpod, ua),
tablet: !match$1(applePhone, ua) && match$1(appleTablet, ua) && !match$1(windowsPhone, ua),
device: (match$1(applePhone, ua) || match$1(appleIpod, ua) || match$1(appleTablet, ua)) && !match$1(windowsPhone, ua)
},
amazon: {
phone: match$1(amazonPhone, ua),
tablet: !match$1(amazonPhone, ua) && match$1(amazonTablet, ua),
device: match$1(amazonPhone, ua) || match$1(amazonTablet, ua)
},
android: {
phone: !match$1(windowsPhone, ua) && match$1(amazonPhone, ua) || !match$1(windowsPhone, ua) && match$1(androidPhone, ua),
tablet: !match$1(windowsPhone, ua) && !match$1(amazonPhone, ua) && !match$1(androidPhone, ua) && (match$1(amazonTablet, ua) || match$1(androidTablet, ua)),
device: !match$1(windowsPhone, ua) && (match$1(amazonPhone, ua) || match$1(amazonTablet, ua) || match$1(androidPhone, ua) || match$1(androidTablet, ua)) || match$1(/\bokhttp\b/i, ua)
},
windows: {
phone: match$1(windowsPhone, ua),
tablet: match$1(windowsTablet, ua),
device: match$1(windowsPhone, ua) || match$1(windowsTablet, ua)
},
other: {
blackberry: match$1(otherBlackberry, ua),
blackberry10: match$1(otherBlackberry10, ua),
opera: match$1(otherOpera, ua),
firefox: match$1(otherFirefox, ua),
chrome: match$1(otherChrome, ua),
device: match$1(otherBlackberry, ua) || match$1(otherBlackberry10, ua) || match$1(otherOpera, ua) || match$1(otherFirefox, ua) || match$1(otherChrome, ua)
},
// Additional
any: null,
phone: null,
tablet: null
};
result.any = result.apple.device || result.android.device || result.windows.device || result.other.device;
result.phone = result.apple.phone || result.android.phone || result.windows.phone;
result.tablet = result.apple.tablet || result.android.tablet || result.windows.tablet;
return result;
}
var defaultResult = _objectSpread2$1(_objectSpread2$1({}, isMobile()), {}, {
isMobile
});
const isMobile$1 = defaultResult;
var _excluded$4 = ["disabled", "loading", "addonAfter", "suffix"];
const __unplugin_components_0 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AInputSearch",
inheritAttrs: false,
props: _objectSpread2$1(_objectSpread2$1({}, inputProps$1()), {}, {
inputPrefixCls: String,
// 不能设置默认值 https://github.com/vueComponent/ant-design-vue/issues/1916
enterButton: PropTypes$1.any,
onSearch: {
type: Function
}
}),
setup: function setup84(props3, _ref) {
var slots = _ref.slots, attrs = _ref.attrs, expose = _ref.expose, emit = _ref.emit;
var inputRef = ref();
var focus = function focus2() {
var _inputRef$value;
(_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 ? void 0 : _inputRef$value.focus();
};
var blur = function blur2() {
var _inputRef$value2;
(_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 ? void 0 : _inputRef$value2.blur();
};
expose({
focus,
blur
});
var onChange = function onChange2(e2) {
emit("update:value", e2.target.value);
if (e2 && e2.target && e2.type === "click") {
emit("search", e2.target.value, e2);
}
emit("change", e2);
};
var onMousedown2 = function onMousedown3(e2) {
var _inputRef$value3;
if (document.activeElement === ((_inputRef$value3 = inputRef.value) === null || _inputRef$value3 === void 0 ? void 0 : _inputRef$value3.input)) {
e2.preventDefault();
}
};
var onSearch = function onSearch2(e2) {
var _inputRef$value4;
emit("search", (_inputRef$value4 = inputRef.value) === null || _inputRef$value4 === void 0 ? void 0 : _inputRef$value4.stateValue, e2);
if (!isMobile$1.tablet) {
inputRef.value.focus();
}
};
var _useConfigInject = useConfigInject("input-search", props3), prefixCls = _useConfigInject.prefixCls, getPrefixCls2 = _useConfigInject.getPrefixCls, direction = _useConfigInject.direction, size = _useConfigInject.size;
var inputPrefixCls = computed(function() {
return getPrefixCls2("input", props3.inputPrefixCls);
});
return function() {
var _slots$addonAfter, _slots$suffix, _slots$enterButton, _slots$enterButton2, _classNames;
var disabled = props3.disabled, loading = props3.loading, _props$addonAfter = props3.addonAfter, addonAfter = _props$addonAfter === void 0 ? (_slots$addonAfter = slots.addonAfter) === null || _slots$addonAfter === void 0 ? void 0 : _slots$addonAfter.call(slots) : _props$addonAfter, _props$suffix = props3.suffix, suffix = _props$suffix === void 0 ? (_slots$suffix = slots.suffix) === null || _slots$suffix === void 0 ? void 0 : _slots$suffix.call(slots) : _props$suffix, restProps = _objectWithoutProperties$2(props3, _excluded$4);
var _props$enterButton = props3.enterButton, enterButton = _props$enterButton === void 0 ? (_slots$enterButton = (_slots$enterButton2 = slots.enterButton) === null || _slots$enterButton2 === void 0 ? void 0 : _slots$enterButton2.call(slots)) !== null && _slots$enterButton !== void 0 ? _slots$enterButton : false : _props$enterButton;
enterButton = enterButton || enterButton === "";
var searchIcon = typeof enterButton === "boolean" ? createVNode(SearchOutlined$1, null, null) : null;
var btnClassName = "".concat(prefixCls.value, "-button");
var enterButtonAsElement = Array.isArray(enterButton) ? enterButton[0] : enterButton;
var button;
var isAntdButton = enterButtonAsElement.type && isPlainObject$1(enterButtonAsElement.type) && enterButtonAsElement.type.__ANT_BUTTON;
if (isAntdButton || enterButtonAsElement.tagName === "button") {
button = cloneElement(enterButtonAsElement, _objectSpread2$1({
onMousedown: onMousedown2,
onClick: onSearch,
key: "enterButton"
}, isAntdButton ? {
class: btnClassName,
size: size.value
} : {}), false);
} else {
var iconOnly = searchIcon && !enterButton;
button = createVNode(Button, {
"class": btnClassName,
"type": enterButton ? "primary" : void 0,
"size": size.value,
"disabled": disabled,
"key": "enterButton",
"onMousedown": onMousedown2,
"onClick": onSearch,
"loading": loading,
"icon": iconOnly ? searchIcon : null
}, {
default: function _default3() {
return [iconOnly ? null : searchIcon || enterButton];
}
});
}
if (addonAfter) {
button = [button, addonAfter];
}
var cls = classNames(prefixCls.value, (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls.value, "-rtl"), direction.value === "rtl"), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-").concat(size.value), !!size.value), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-with-button"), !!enterButton), _classNames), attrs.class);
return createVNode(Input, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
"ref": inputRef
}, omit(restProps, ["onUpdate:value", "onSearch", "enterButton"])), attrs), {}, {
"onPressEnter": onSearch,
"size": size.value,
"prefixCls": inputPrefixCls.value,
"addonAfter": button,
"suffix": suffix,
"onChange": onChange,
"class": cls,
"disabled": disabled
}), slots);
};
}
});
var HIDDEN_TEXTAREA_STYLE = "\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n";
var SIZING_STYLE = ["letter-spacing", "line-height", "padding-top", "padding-bottom", "font-family", "font-weight", "font-size", "font-variant", "text-rendering", "text-transform", "width", "text-indent", "padding-left", "padding-right", "border-width", "box-sizing", "word-break"];
var computedStyleCache = {};
var hiddenTextarea;
function calculateNodeStyling(node) {
var useCache2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
var nodeRef = node.getAttribute("id") || node.getAttribute("data-reactid") || node.getAttribute("name");
if (useCache2 && computedStyleCache[nodeRef]) {
return computedStyleCache[nodeRef];
}
var style = window.getComputedStyle(node);
var boxSizing = style.getPropertyValue("box-sizing") || style.getPropertyValue("-moz-box-sizing") || style.getPropertyValue("-webkit-box-sizing");
var paddingSize = parseFloat(style.getPropertyValue("padding-bottom")) + parseFloat(style.getPropertyValue("padding-top"));
var borderSize = parseFloat(style.getPropertyValue("border-bottom-width")) + parseFloat(style.getPropertyValue("border-top-width"));
var sizingStyle = SIZING_STYLE.map(function(name) {
return "".concat(name, ":").concat(style.getPropertyValue(name));
}).join(";");
var nodeInfo = {
sizingStyle,
paddingSize,
borderSize,
boxSizing
};
if (useCache2 && nodeRef) {
computedStyleCache[nodeRef] = nodeInfo;
}
return nodeInfo;
}
function calculateNodeHeight(uiTextNode) {
var useCache2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
var minRows = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
var maxRows = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
if (!hiddenTextarea) {
hiddenTextarea = document.createElement("textarea");
hiddenTextarea.setAttribute("tab-index", "-1");
hiddenTextarea.setAttribute("aria-hidden", "true");
document.body.appendChild(hiddenTextarea);
}
if (uiTextNode.getAttribute("wrap")) {
hiddenTextarea.setAttribute("wrap", uiTextNode.getAttribute("wrap"));
} else {
hiddenTextarea.removeAttribute("wrap");
}
var _calculateNodeStyling = calculateNodeStyling(uiTextNode, useCache2), paddingSize = _calculateNodeStyling.paddingSize, borderSize = _calculateNodeStyling.borderSize, boxSizing = _calculateNodeStyling.boxSizing, sizingStyle = _calculateNodeStyling.sizingStyle;
hiddenTextarea.setAttribute("style", "".concat(sizingStyle, ";").concat(HIDDEN_TEXTAREA_STYLE));
hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || "";
var minHeight = Number.MIN_SAFE_INTEGER;
var maxHeight = Number.MAX_SAFE_INTEGER;
var height = hiddenTextarea.scrollHeight;
var overflowY;
if (boxSizing === "border-box") {
height += borderSize;
} else if (boxSizing === "content-box") {
height -= paddingSize;
}
if (minRows !== null || maxRows !== null) {
hiddenTextarea.value = " ";
var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
if (minRows !== null) {
minHeight = singleRowHeight * minRows;
if (boxSizing === "border-box") {
minHeight = minHeight + paddingSize + borderSize;
}
height = Math.max(minHeight, height);
}
if (maxRows !== null) {
maxHeight = singleRowHeight * maxRows;
if (boxSizing === "border-box") {
maxHeight = maxHeight + paddingSize + borderSize;
}
overflowY = height > maxHeight ? "" : "hidden";
height = Math.min(maxHeight, height);
}
}
return {
height: "".concat(height, "px"),
minHeight: "".concat(minHeight, "px"),
maxHeight: "".concat(maxHeight, "px"),
overflowY,
resize: "none"
};
}
var RESIZE_STATUS_NONE = 0;
var RESIZE_STATUS_RESIZING = 1;
var RESIZE_STATUS_RESIZED = 2;
var ResizableTextArea = defineComponent({
compatConfig: {
MODE: 3
},
name: "ResizableTextArea",
inheritAttrs: false,
props: textAreaProps(),
setup: function setup85(props3, _ref) {
var attrs = _ref.attrs, emit = _ref.emit, expose = _ref.expose;
var nextFrameActionId;
var resizeFrameId;
var textAreaRef = ref();
var textareaStyles = ref({});
var resizeStatus = ref(RESIZE_STATUS_NONE);
onBeforeUnmount(function() {
wrapperRaf.cancel(nextFrameActionId);
wrapperRaf.cancel(resizeFrameId);
});
var fixFirefoxAutoScroll = function fixFirefoxAutoScroll2() {
try {
if (document.activeElement === textAreaRef.value) {
var currentStart = textAreaRef.value.selectionStart;
var currentEnd = textAreaRef.value.selectionEnd;
textAreaRef.value.setSelectionRange(currentStart, currentEnd);
}
} catch (e2) {
}
};
var resizeTextarea = function resizeTextarea2() {
var autoSize = props3.autoSize || props3.autosize;
if (!autoSize || !textAreaRef.value) {
return;
}
var minRows = autoSize.minRows, maxRows = autoSize.maxRows;
textareaStyles.value = calculateNodeHeight(textAreaRef.value, false, minRows, maxRows);
resizeStatus.value = RESIZE_STATUS_RESIZING;
wrapperRaf.cancel(resizeFrameId);
resizeFrameId = wrapperRaf(function() {
resizeStatus.value = RESIZE_STATUS_RESIZED;
resizeFrameId = wrapperRaf(function() {
resizeStatus.value = RESIZE_STATUS_NONE;
fixFirefoxAutoScroll();
});
});
};
var resizeOnNextFrame = function resizeOnNextFrame2() {
wrapperRaf.cancel(nextFrameActionId);
nextFrameActionId = wrapperRaf(resizeTextarea);
};
var handleResize = function handleResize2(size) {
if (resizeStatus.value !== RESIZE_STATUS_NONE) {
return;
}
emit("resize", size);
var autoSize = props3.autoSize || props3.autosize;
if (autoSize) {
resizeOnNextFrame();
}
};
warning$1(props3.autosize === void 0, "Input.TextArea", "autosize is deprecated, please use autoSize instead.");
var renderTextArea = function renderTextArea2() {
var prefixCls = props3.prefixCls, autoSize = props3.autoSize, autosize = props3.autosize, disabled = props3.disabled;
var otherProps = omit(props3, ["prefixCls", "onPressEnter", "autoSize", "autosize", "defaultValue", "allowClear", "type", "lazy", "maxlength", "valueModifiers"]);
var cls = classNames(prefixCls, attrs.class, _defineProperty$q({}, "".concat(prefixCls, "-disabled"), disabled));
var style = [attrs.style, textareaStyles.value, resizeStatus.value === RESIZE_STATUS_RESIZING ? {
overflowX: "hidden",
overflowY: "hidden"
} : null];
var textareaProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, otherProps), attrs), {}, {
style,
class: cls
});
if (!textareaProps.autofocus) {
delete textareaProps.autofocus;
}
if (textareaProps.rows === 0) {
delete textareaProps.rows;
}
return createVNode(ResizeObserver$1, {
"onResize": handleResize,
"disabled": !(autoSize || autosize)
}, {
default: function _default3() {
return [withDirectives(createVNode("textarea", _objectSpread2$1(_objectSpread2$1({}, textareaProps), {}, {
"ref": textAreaRef
}), null), [[antInputDirective]])];
}
});
};
watch(function() {
return props3.value;
}, function() {
nextTick(function() {
resizeTextarea();
});
});
onMounted(function() {
nextTick(function() {
resizeTextarea();
});
});
var instance = getCurrentInstance();
expose({
resizeTextarea,
textArea: textAreaRef,
instance
});
return function() {
return renderTextArea();
};
}
});
const ResizableTextArea$1 = ResizableTextArea;
function fixEmojiLength(value2, maxLength) {
return _toConsumableArray(value2 || "").slice(0, maxLength).join("");
}
function setTriggerValue(isCursorInEnd, preValue, triggerValue, maxLength) {
var newTriggerValue = triggerValue;
if (isCursorInEnd) {
newTriggerValue = fixEmojiLength(triggerValue, maxLength);
} else if (_toConsumableArray(preValue || "").length < triggerValue.length && _toConsumableArray(triggerValue || "").length > maxLength) {
newTriggerValue = preValue;
}
return newTriggerValue;
}
const TextArea = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATextarea",
inheritAttrs: false,
props: textAreaProps(),
setup: function setup86(props3, _ref) {
var attrs = _ref.attrs, expose = _ref.expose, emit = _ref.emit;
var formItemContext = useInjectFormItemContext();
var stateValue = ref(props3.value === void 0 ? props3.defaultValue : props3.value);
var resizableTextArea = ref();
var mergedValue = ref("");
var _useConfigInject = useConfigInject("input", props3), prefixCls = _useConfigInject.prefixCls, size = _useConfigInject.size, direction = _useConfigInject.direction;
var showCount = computed(function() {
return props3.showCount === "" || props3.showCount || false;
});
var hasMaxLength = computed(function() {
return Number(props3.maxlength) > 0;
});
var compositing = ref(false);
var oldCompositionValueRef = ref();
var oldSelectionStartRef = ref(0);
var onInternalCompositionStart = function onInternalCompositionStart2(e2) {
compositing.value = true;
oldCompositionValueRef.value = mergedValue.value;
oldSelectionStartRef.value = e2.currentTarget.selectionStart;
emit("compositionstart", e2);
};
var onInternalCompositionEnd = function onInternalCompositionEnd2(e2) {
compositing.value = false;
var triggerValue = e2.currentTarget.value;
if (hasMaxLength.value) {
var _oldCompositionValueR;
var isCursorInEnd = oldSelectionStartRef.value >= props3.maxlength + 1 || oldSelectionStartRef.value === ((_oldCompositionValueR = oldCompositionValueRef.value) === null || _oldCompositionValueR === void 0 ? void 0 : _oldCompositionValueR.length);
triggerValue = setTriggerValue(isCursorInEnd, oldCompositionValueRef.value, triggerValue, props3.maxlength);
}
if (triggerValue !== mergedValue.value) {
setValue(triggerValue);
resolveOnChange(e2.currentTarget, e2, triggerChange, triggerValue);
}
emit("compositionend", e2);
};
var instance = getCurrentInstance();
watch(function() {
return props3.value;
}, function() {
if ("value" in instance.vnode.props || {}) {
var _props$value;
stateValue.value = (_props$value = props3.value) !== null && _props$value !== void 0 ? _props$value : "";
}
});
var focus = function focus2(option) {
var _resizableTextArea$va;
triggerFocus((_resizableTextArea$va = resizableTextArea.value) === null || _resizableTextArea$va === void 0 ? void 0 : _resizableTextArea$va.textArea, option);
};
var blur = function blur2() {
var _resizableTextArea$va2, _resizableTextArea$va3;
(_resizableTextArea$va2 = resizableTextArea.value) === null || _resizableTextArea$va2 === void 0 ? void 0 : (_resizableTextArea$va3 = _resizableTextArea$va2.textArea) === null || _resizableTextArea$va3 === void 0 ? void 0 : _resizableTextArea$va3.blur();
};
var setValue = function setValue2(value2, callback) {
if (stateValue.value === value2) {
return;
}
if (props3.value === void 0) {
stateValue.value = value2;
} else {
nextTick(function() {
if (resizableTextArea.value.textArea.value !== mergedValue.value) {
var _resizableTextArea$va4, _resizableTextArea$va5, _resizableTextArea$va6;
(_resizableTextArea$va4 = resizableTextArea.value) === null || _resizableTextArea$va4 === void 0 ? void 0 : (_resizableTextArea$va5 = (_resizableTextArea$va6 = _resizableTextArea$va4.instance).update) === null || _resizableTextArea$va5 === void 0 ? void 0 : _resizableTextArea$va5.call(_resizableTextArea$va6);
}
});
}
nextTick(function() {
callback && callback();
});
};
var handleKeyDown = function handleKeyDown2(e2) {
if (e2.keyCode === 13) {
emit("pressEnter", e2);
}
emit("keydown", e2);
};
var onBlur2 = function onBlur3(e2) {
var onBlur4 = props3.onBlur;
onBlur4 === null || onBlur4 === void 0 ? void 0 : onBlur4(e2);
formItemContext.onFieldBlur();
};
var triggerChange = function triggerChange2(e2) {
emit("update:value", e2.target.value);
emit("change", e2);
emit("input", e2);
formItemContext.onFieldChange();
};
var handleReset = function handleReset2(e2) {
resolveOnChange(resizableTextArea.value.textArea, e2, triggerChange);
setValue("", function() {
focus();
});
};
var handleChange = function handleChange2(e2) {
var composing = e2.target.composing;
var triggerValue = e2.target.value;
compositing.value = !!(e2.isComposing || composing);
if (compositing.value && props3.lazy || stateValue.value === triggerValue)
return;
if (hasMaxLength.value) {
var target = e2.target;
var isCursorInEnd = target.selectionStart >= props3.maxlength + 1 || target.selectionStart === triggerValue.length || !target.selectionStart;
triggerValue = setTriggerValue(isCursorInEnd, mergedValue.value, triggerValue, props3.maxlength);
}
resolveOnChange(e2.currentTarget, e2, triggerChange, triggerValue);
setValue(triggerValue);
};
var renderTextArea = function renderTextArea2() {
var _class, _props$valueModifiers, _resizeProps$id;
var style = attrs.style, customClass = attrs.class;
var _props$bordered = props3.bordered, bordered = _props$bordered === void 0 ? true : _props$bordered;
var resizeProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, omit(props3, ["allowClear"])), attrs), {}, {
style: showCount.value ? {} : style,
class: (_class = {}, _defineProperty$q(_class, "".concat(prefixCls.value, "-borderless"), !bordered), _defineProperty$q(_class, "".concat(customClass), customClass && !showCount.value), _defineProperty$q(_class, "".concat(prefixCls.value, "-sm"), size.value === "small"), _defineProperty$q(_class, "".concat(prefixCls.value, "-lg"), size.value === "large"), _class),
showCount: null,
prefixCls: prefixCls.value,
onInput: handleChange,
onChange: handleChange,
onBlur: onBlur2,
onKeydown: handleKeyDown,
onCompositionstart: onInternalCompositionStart,
onCompositionend: onInternalCompositionEnd
});
if ((_props$valueModifiers = props3.valueModifiers) !== null && _props$valueModifiers !== void 0 && _props$valueModifiers.lazy) {
delete resizeProps.onInput;
}
return createVNode(ResizableTextArea$1, _objectSpread2$1(_objectSpread2$1({}, resizeProps), {}, {
"id": (_resizeProps$id = resizeProps.id) !== null && _resizeProps$id !== void 0 ? _resizeProps$id : formItemContext.id.value,
"ref": resizableTextArea,
"maxlength": props3.maxlength
}), null);
};
expose({
focus,
blur,
resizableTextArea
});
watchEffect(function() {
var val = fixControlledValue(stateValue.value);
if (!compositing.value && hasMaxLength.value && (props3.value === null || props3.value === void 0)) {
val = fixEmojiLength(val, props3.maxlength);
}
mergedValue.value = val;
});
return function() {
var maxlength = props3.maxlength, _props$bordered2 = props3.bordered, bordered = _props$bordered2 === void 0 ? true : _props$bordered2, hidden = props3.hidden;
var style = attrs.style, customClass = attrs.class;
var inputProps3 = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, props3), attrs), {}, {
prefixCls: prefixCls.value,
inputType: "text",
handleReset,
direction: direction.value,
bordered,
style: showCount.value ? void 0 : style
});
var textareaNode = createVNode(ClearableLabeledInput, _objectSpread2$1(_objectSpread2$1({}, inputProps3), {}, {
"value": mergedValue.value
}), {
element: renderTextArea
});
if (showCount.value) {
var valueLength = _toConsumableArray(mergedValue.value).length;
var dataCount = "";
if (_typeof$2(showCount.value) === "object") {
dataCount = showCount.value.formatter({
count: valueLength,
maxlength
});
} else {
dataCount = "".concat(valueLength).concat(hasMaxLength.value ? " / ".concat(maxlength) : "");
}
textareaNode = createVNode("div", {
"hidden": hidden,
"class": classNames("".concat(prefixCls.value, "-textarea"), _defineProperty$q({}, "".concat(prefixCls.value, "-textarea-rtl"), direction.value === "rtl"), "".concat(prefixCls.value, "-textarea-show-count"), customClass),
"style": style,
"data-count": _typeof$2(dataCount) !== "object" ? dataCount : void 0
}, [textareaNode]);
}
return textareaNode;
};
}
});
var EyeOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" } }] }, "name": "eye", "theme": "outlined" };
const EyeOutlinedSvg = EyeOutlined$2;
function _objectSpread$2(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$2(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$2(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var EyeOutlined = function EyeOutlined2(props3, context) {
var p = _objectSpread$2({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$2({}, p, {
"icon": EyeOutlinedSvg
}), null);
};
EyeOutlined.displayName = "EyeOutlined";
EyeOutlined.inheritAttrs = false;
const EyeOutlined$1 = EyeOutlined;
var EyeInvisibleOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" } }, { "tag": "path", "attrs": { "d": "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" } }] }, "name": "eye-invisible", "theme": "outlined" };
const EyeInvisibleOutlinedSvg = EyeInvisibleOutlined$2;
function _objectSpread$1(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty$1(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty$1(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var EyeInvisibleOutlined = function EyeInvisibleOutlined2(props3, context) {
var p = _objectSpread$1({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread$1({}, p, {
"icon": EyeInvisibleOutlinedSvg
}), null);
};
EyeInvisibleOutlined.displayName = "EyeInvisibleOutlined";
EyeInvisibleOutlined.inheritAttrs = false;
const EyeInvisibleOutlined$1 = EyeInvisibleOutlined;
var _excluded$3 = ["size", "visibilityToggle"];
var ActionMap = {
click: "onClick",
hover: "onMouseover"
};
var defaultIconRender = function defaultIconRender2(visible) {
return visible ? createVNode(EyeOutlined$1, null, null) : createVNode(EyeInvisibleOutlined$1, null, null);
};
const Password = defineComponent({
compatConfig: {
MODE: 3
},
name: "AInputPassword",
inheritAttrs: false,
props: _objectSpread2$1(_objectSpread2$1({}, inputProps$1()), {}, {
prefixCls: String,
inputPrefixCls: String,
action: {
type: String,
default: "click"
},
visibilityToggle: {
type: Boolean,
default: true
},
iconRender: Function
}),
setup: function setup87(props3, _ref) {
var slots = _ref.slots, attrs = _ref.attrs, expose = _ref.expose;
var visible = ref(false);
var onVisibleChange = function onVisibleChange2() {
var disabled = props3.disabled;
if (disabled) {
return;
}
visible.value = !visible.value;
};
var inputRef = ref();
var focus = function focus2() {
var _inputRef$value;
(_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 ? void 0 : _inputRef$value.focus();
};
var blur = function blur2() {
var _inputRef$value2;
(_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 ? void 0 : _inputRef$value2.blur();
};
expose({
focus,
blur
});
var getIcon = function getIcon2(prefixCls2) {
var _iconProps;
var action = props3.action, _props$iconRender = props3.iconRender, iconRender = _props$iconRender === void 0 ? slots.iconRender || defaultIconRender : _props$iconRender;
var iconTrigger = ActionMap[action] || "";
var icon = iconRender(visible.value);
var iconProps = (_iconProps = {}, _defineProperty$q(_iconProps, iconTrigger, onVisibleChange), _defineProperty$q(_iconProps, "class", "".concat(prefixCls2, "-icon")), _defineProperty$q(_iconProps, "key", "passwordIcon"), _defineProperty$q(_iconProps, "onMousedown", function onMousedown2(e2) {
e2.preventDefault();
}), _defineProperty$q(_iconProps, "onMouseup", function onMouseup(e2) {
e2.preventDefault();
}), _iconProps);
return cloneElement(isValidElement(icon) ? icon : createVNode("span", null, [icon]), iconProps);
};
var _useConfigInject = useConfigInject("input-password", props3), prefixCls = _useConfigInject.prefixCls, getPrefixCls2 = _useConfigInject.getPrefixCls;
var inputPrefixCls = computed(function() {
return getPrefixCls2("input", props3.inputPrefixCls);
});
var renderPassword = function renderPassword2() {
var size = props3.size, visibilityToggle = props3.visibilityToggle, restProps = _objectWithoutProperties$2(props3, _excluded$3);
var suffixIcon = visibilityToggle && getIcon(prefixCls.value);
var inputClassName = classNames(prefixCls.value, attrs.class, _defineProperty$q({}, "".concat(prefixCls.value, "-").concat(size), !!size));
var omittedProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, omit(restProps, ["suffix", "iconRender", "action"])), attrs), {}, {
type: visible.value ? "text" : "password",
class: inputClassName,
prefixCls: inputPrefixCls.value,
suffix: suffixIcon
});
if (size) {
omittedProps.size = size;
}
return createVNode(Input, _objectSpread2$1({
"ref": inputRef
}, omittedProps), slots);
};
return function() {
return renderPassword();
};
}
});
Input.Group = __unplugin_components_2$1;
Input.Search = __unplugin_components_0;
Input.TextArea = TextArea;
Input.Password = Password;
Input.install = function(app) {
app.component(Input.name, Input);
app.component(Input.Group.name, Input.Group);
app.component(Input.Search.name, Input.Search);
app.component(Input.TextArea.name, Input.TextArea);
app.component(Input.Password.name, Input.Password);
return app;
};
function dialogPropTypes() {
return {
keyboard: {
type: Boolean,
default: void 0
},
mask: {
type: Boolean,
default: void 0
},
afterClose: Function,
closable: {
type: Boolean,
default: void 0
},
maskClosable: {
type: Boolean,
default: void 0
},
visible: {
type: Boolean,
default: void 0
},
destroyOnClose: {
type: Boolean,
default: void 0
},
mousePosition: PropTypes$1.shape({
x: Number,
y: Number
}).loose,
title: PropTypes$1.any,
footer: PropTypes$1.any,
transitionName: String,
maskTransitionName: String,
animation: PropTypes$1.any,
maskAnimation: PropTypes$1.any,
wrapStyle: {
type: Object,
default: void 0
},
bodyStyle: {
type: Object,
default: void 0
},
maskStyle: {
type: Object,
default: void 0
},
prefixCls: String,
wrapClassName: String,
rootClassName: String,
width: [String, Number],
height: [String, Number],
zIndex: Number,
bodyProps: PropTypes$1.any,
maskProps: PropTypes$1.any,
wrapProps: PropTypes$1.any,
getContainer: PropTypes$1.any,
dialogStyle: {
type: Object,
default: void 0
},
dialogClass: String,
closeIcon: PropTypes$1.any,
forceRender: {
type: Boolean,
default: void 0
},
getOpenCount: Function,
// https://github.com/ant-design/ant-design/issues/19771
// https://github.com/react-component/dialog/issues/95
focusTriggerAfterClose: {
type: Boolean,
default: void 0
},
onClose: Function,
modalRender: Function
};
}
function getMotionName(prefixCls, transitionName2, animationName) {
var motionName = transitionName2;
if (!motionName && animationName) {
motionName = "".concat(prefixCls, "-").concat(animationName);
}
return motionName;
}
var uuid = -1;
function getUUID() {
uuid += 1;
return uuid;
}
function getScroll(w2, top) {
var ret = w2["page".concat(top ? "Y" : "X", "Offset")];
var method = "scroll".concat(top ? "Top" : "Left");
if (typeof ret !== "number") {
var d2 = w2.document;
ret = d2.documentElement[method];
if (typeof ret !== "number") {
ret = d2.body[method];
}
}
return ret;
}
function offset$1(el) {
var rect = el.getBoundingClientRect();
var pos = {
left: rect.left,
top: rect.top
};
var doc = el.ownerDocument;
var w2 = doc.defaultView || doc.parentWindow;
pos.left += getScroll(w2);
pos.top += getScroll(w2, true);
return pos;
}
var sentinelStyle = {
width: 0,
height: 0,
overflow: "hidden",
outline: "none"
};
const Content = defineComponent({
compatConfig: {
MODE: 3
},
name: "Content",
inheritAttrs: false,
props: _objectSpread2$1(_objectSpread2$1({}, dialogPropTypes()), {}, {
motionName: String,
ariaId: String,
onVisibleChanged: Function,
onMousedown: Function,
onMouseup: Function
}),
setup: function setup88(props3, _ref) {
var expose = _ref.expose, slots = _ref.slots, attrs = _ref.attrs;
var sentinelStartRef = ref();
var sentinelEndRef = ref();
var dialogRef = ref();
expose({
focus: function focus() {
var _sentinelStartRef$val;
(_sentinelStartRef$val = sentinelStartRef.value) === null || _sentinelStartRef$val === void 0 ? void 0 : _sentinelStartRef$val.focus();
},
changeActive: function changeActive(next2) {
var _document = document, activeElement = _document.activeElement;
if (next2 && activeElement === sentinelEndRef.value) {
sentinelStartRef.value.focus();
} else if (!next2 && activeElement === sentinelStartRef.value) {
sentinelEndRef.value.focus();
}
}
});
var transformOrigin = ref();
var contentStyleRef = computed(function() {
var width = props3.width, height = props3.height;
var contentStyle = {};
if (width !== void 0) {
contentStyle.width = typeof width === "number" ? "".concat(width, "px") : width;
}
if (height !== void 0) {
contentStyle.height = typeof height === "number" ? "".concat(height, "px") : height;
}
if (transformOrigin.value) {
contentStyle.transformOrigin = transformOrigin.value;
}
return contentStyle;
});
var onPrepare = function onPrepare2() {
nextTick(function() {
if (dialogRef.value) {
var elementOffset = offset$1(dialogRef.value);
transformOrigin.value = props3.mousePosition ? "".concat(props3.mousePosition.x - elementOffset.left, "px ").concat(props3.mousePosition.y - elementOffset.top, "px") : "";
}
});
};
var onVisibleChanged = function onVisibleChanged2(visible) {
props3.onVisibleChanged(visible);
};
return function() {
var _slots$footer, _slots$title, _slots$closeIcon, _slots$default;
var prefixCls = props3.prefixCls, _props$footer = props3.footer, footer = _props$footer === void 0 ? (_slots$footer = slots.footer) === null || _slots$footer === void 0 ? void 0 : _slots$footer.call(slots) : _props$footer, _props$title = props3.title, title = _props$title === void 0 ? (_slots$title = slots.title) === null || _slots$title === void 0 ? void 0 : _slots$title.call(slots) : _props$title, ariaId = props3.ariaId, closable = props3.closable, _props$closeIcon = props3.closeIcon, closeIcon = _props$closeIcon === void 0 ? (_slots$closeIcon = slots.closeIcon) === null || _slots$closeIcon === void 0 ? void 0 : _slots$closeIcon.call(slots) : _props$closeIcon, onClose = props3.onClose, bodyStyle = props3.bodyStyle, bodyProps = props3.bodyProps, onMousedown2 = props3.onMousedown, onMouseup = props3.onMouseup, visible = props3.visible, _props$modalRender = props3.modalRender, modalRender = _props$modalRender === void 0 ? slots.modalRender : _props$modalRender, destroyOnClose = props3.destroyOnClose, motionName = props3.motionName;
var footerNode;
if (footer) {
footerNode = createVNode("div", {
"class": "".concat(prefixCls, "-footer")
}, [footer]);
}
var headerNode;
if (title) {
headerNode = createVNode("div", {
"class": "".concat(prefixCls, "-header")
}, [createVNode("div", {
"class": "".concat(prefixCls, "-title"),
"id": ariaId
}, [title])]);
}
var closer;
if (closable) {
closer = createVNode("button", {
"type": "button",
"onClick": onClose,
"aria-label": "Close",
"class": "".concat(prefixCls, "-close")
}, [closeIcon || createVNode("span", {
"class": "".concat(prefixCls, "-close-x")
}, null)]);
}
var content = createVNode("div", {
"class": "".concat(prefixCls, "-content")
}, [closer, headerNode, createVNode("div", _objectSpread2$1({
"class": "".concat(prefixCls, "-body"),
"style": bodyStyle
}, bodyProps), [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]), footerNode]);
var transitionProps = getTransitionProps(motionName);
return createVNode(Transition, _objectSpread2$1(_objectSpread2$1({}, transitionProps), {}, {
"onBeforeEnter": onPrepare,
"onAfterEnter": function onAfterEnter() {
return onVisibleChanged(true);
},
"onAfterLeave": function onAfterLeave() {
return onVisibleChanged(false);
}
}), {
default: function _default3() {
return [visible || !destroyOnClose ? withDirectives(createVNode("div", _objectSpread2$1(_objectSpread2$1({}, attrs), {}, {
"ref": dialogRef,
"key": "dialog-element",
"role": "document",
"style": [contentStyleRef.value, attrs.style],
"class": [prefixCls, attrs.class],
"onMousedown": onMousedown2,
"onMouseup": onMouseup
}), [createVNode("div", {
"tabindex": 0,
"ref": sentinelStartRef,
"style": sentinelStyle,
"aria-hidden": "true"
}, null), modalRender ? modalRender({
originVNode: content
}) : content, createVNode("div", {
"tabindex": 0,
"ref": sentinelEndRef,
"style": sentinelStyle,
"aria-hidden": "true"
}, null)]), [[vShow, visible]]) : null];
}
});
};
}
});
function _objectDestructuringEmpty(obj) {
if (obj == null)
throw new TypeError("Cannot destructure " + obj);
}
const Mask = defineComponent({
compatConfig: {
MODE: 3
},
name: "Mask",
props: {
prefixCls: String,
visible: Boolean,
motionName: String,
maskProps: Object
},
setup: function setup89(props3, _ref) {
_objectDestructuringEmpty(_ref);
return function() {
var prefixCls = props3.prefixCls, visible = props3.visible, maskProps = props3.maskProps, motionName = props3.motionName;
var transitionProps = getTransitionProps(motionName);
return createVNode(Transition, transitionProps, {
default: function _default3() {
return [withDirectives(createVNode("div", _objectSpread2$1({
"class": "".concat(prefixCls, "-mask")
}, maskProps), null), [[vShow, visible]])];
}
});
};
}
});
const Dialog = defineComponent({
compatConfig: {
MODE: 3
},
name: "Dialog",
inheritAttrs: false,
props: initDefaultProps$1(_objectSpread2$1(_objectSpread2$1({}, dialogPropTypes()), {}, {
getOpenCount: Function,
scrollLocker: Object
}), {
mask: true,
visible: false,
keyboard: true,
closable: true,
maskClosable: true,
destroyOnClose: false,
prefixCls: "rc-dialog",
getOpenCount: function getOpenCount() {
return null;
},
focusTriggerAfterClose: true
}),
setup: function setup90(props3, _ref) {
var attrs = _ref.attrs, slots = _ref.slots;
var lastOutSideActiveElementRef = ref();
var wrapperRef = ref();
var contentRef = ref();
var animatedVisible = ref(props3.visible);
var ariaIdRef = ref("vcDialogTitle".concat(getUUID()));
var onDialogVisibleChanged = function onDialogVisibleChanged2(newVisible) {
if (newVisible) {
if (!contains(wrapperRef.value, document.activeElement)) {
var _contentRef$value;
lastOutSideActiveElementRef.value = document.activeElement;
(_contentRef$value = contentRef.value) === null || _contentRef$value === void 0 ? void 0 : _contentRef$value.focus();
}
} else {
var preAnimatedVisible = animatedVisible.value;
animatedVisible.value = false;
if (props3.mask && lastOutSideActiveElementRef.value && props3.focusTriggerAfterClose) {
try {
lastOutSideActiveElementRef.value.focus({
preventScroll: true
});
} catch (e2) {
}
lastOutSideActiveElementRef.value = null;
}
if (preAnimatedVisible) {
var _props$afterClose;
(_props$afterClose = props3.afterClose) === null || _props$afterClose === void 0 ? void 0 : _props$afterClose.call(props3);
}
}
};
var onInternalClose = function onInternalClose2(e2) {
var _props$onClose;
(_props$onClose = props3.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props3, e2);
};
var contentClickRef = ref(false);
var contentTimeoutRef = ref();
var onContentMouseDown = function onContentMouseDown2() {
clearTimeout(contentTimeoutRef.value);
contentClickRef.value = true;
};
var onContentMouseUp = function onContentMouseUp2() {
contentTimeoutRef.value = setTimeout(function() {
contentClickRef.value = false;
});
};
var onWrapperClick = function onWrapperClick2(e2) {
if (!props3.maskClosable)
return null;
if (contentClickRef.value) {
contentClickRef.value = false;
} else if (wrapperRef.value === e2.target) {
onInternalClose(e2);
}
};
var onWrapperKeyDown = function onWrapperKeyDown2(e2) {
if (props3.keyboard && e2.keyCode === KeyCode$1.ESC) {
e2.stopPropagation();
onInternalClose(e2);
return;
}
if (props3.visible) {
if (e2.keyCode === KeyCode$1.TAB) {
contentRef.value.changeActive(!e2.shiftKey);
}
}
};
watch(function() {
return props3.visible;
}, function() {
if (props3.visible) {
animatedVisible.value = true;
}
}, {
flush: "post"
});
onBeforeUnmount(function() {
var _props$scrollLocker;
clearTimeout(contentTimeoutRef.value);
(_props$scrollLocker = props3.scrollLocker) === null || _props$scrollLocker === void 0 ? void 0 : _props$scrollLocker.unLock();
});
watchEffect(function() {
var _props$scrollLocker2;
(_props$scrollLocker2 = props3.scrollLocker) === null || _props$scrollLocker2 === void 0 ? void 0 : _props$scrollLocker2.unLock();
if (animatedVisible.value) {
var _props$scrollLocker3;
(_props$scrollLocker3 = props3.scrollLocker) === null || _props$scrollLocker3 === void 0 ? void 0 : _props$scrollLocker3.lock();
}
});
return function() {
var prefixCls = props3.prefixCls, mask = props3.mask, visible = props3.visible, maskTransitionName = props3.maskTransitionName, maskAnimation = props3.maskAnimation, zIndex = props3.zIndex, wrapClassName = props3.wrapClassName, rootClassName = props3.rootClassName, wrapStyle = props3.wrapStyle, closable = props3.closable, maskProps = props3.maskProps, maskStyle = props3.maskStyle, transitionName2 = props3.transitionName, animation = props3.animation, wrapProps = props3.wrapProps, _props$title = props3.title, title = _props$title === void 0 ? slots.title : _props$title;
var style = attrs.style, className = attrs.class;
return createVNode("div", _objectSpread2$1({
"class": ["".concat(prefixCls, "-root"), rootClassName]
}, pickAttrs(props3, {
data: true
})), [createVNode(Mask, {
"prefixCls": prefixCls,
"visible": mask && visible,
"motionName": getMotionName(prefixCls, maskTransitionName, maskAnimation),
"style": _objectSpread2$1({
zIndex
}, maskStyle),
"maskProps": maskProps
}, null), createVNode("div", _objectSpread2$1({
"tabIndex": -1,
"onKeydown": onWrapperKeyDown,
"class": classNames("".concat(prefixCls, "-wrap"), wrapClassName),
"ref": wrapperRef,
"onClick": onWrapperClick,
"role": "dialog",
"aria-labelledby": title ? ariaIdRef.value : null,
"style": _objectSpread2$1(_objectSpread2$1({
zIndex
}, wrapStyle), {}, {
display: !animatedVisible.value ? "none" : null
})
}, wrapProps), [createVNode(Content, _objectSpread2$1(_objectSpread2$1({}, omit(props3, ["scrollLocker"])), {}, {
"style": style,
"class": className,
"onMousedown": onContentMouseDown,
"onMouseup": onContentMouseUp,
"ref": contentRef,
"closable": closable,
"ariaId": ariaIdRef.value,
"prefixCls": prefixCls,
"visible": visible,
"onClose": onInternalClose,
"onVisibleChanged": onDialogVisibleChanged,
"motionName": getMotionName(prefixCls, transitionName2, animation)
}), slots)])]);
};
}
});
var IDialogPropTypes = dialogPropTypes();
var DialogWrap = defineComponent({
compatConfig: {
MODE: 3
},
name: "DialogWrap",
inheritAttrs: false,
props: initDefaultProps$1(IDialogPropTypes, {
visible: false
}),
setup: function setup91(props3, _ref) {
var attrs = _ref.attrs, slots = _ref.slots;
var animatedVisible = ref(props3.visible);
useProvidePortal({}, {
inTriggerContext: false
});
watch(function() {
return props3.visible;
}, function() {
if (props3.visible) {
animatedVisible.value = true;
}
}, {
flush: "post"
});
return function() {
var visible = props3.visible, getContainer4 = props3.getContainer, forceRender = props3.forceRender, _props$destroyOnClose = props3.destroyOnClose, destroyOnClose = _props$destroyOnClose === void 0 ? false : _props$destroyOnClose, _afterClose = props3.afterClose;
var dialogProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, props3), attrs), {}, {
ref: "_component",
key: "dialog"
});
if (getContainer4 === false) {
return createVNode(Dialog, _objectSpread2$1(_objectSpread2$1({}, dialogProps), {}, {
"getOpenCount": function getOpenCount2() {
return 2;
}
}), slots);
}
if (!forceRender && destroyOnClose && !animatedVisible.value) {
return null;
}
return createVNode(Portal, {
"visible": visible,
"forceRender": forceRender,
"getContainer": getContainer4
}, {
default: function _default3(childProps) {
dialogProps = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, dialogProps), childProps), {}, {
afterClose: function afterClose() {
_afterClose === null || _afterClose === void 0 ? void 0 : _afterClose();
animatedVisible.value = false;
}
});
return createVNode(Dialog, dialogProps, slots);
}
});
};
}
});
const DialogWrap$1 = DialogWrap;
var UpOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" } }] }, "name": "up", "theme": "outlined" };
const UpOutlinedSvg = UpOutlined$2;
function _objectSpread(target) {
for (var i2 = 1; i2 < arguments.length; i2++) {
var source = arguments[i2] != null ? Object(arguments[i2]) : {};
var ownKeys2 = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys2.forEach(function(key2) {
_defineProperty(target, key2, source[key2]);
});
}
return target;
}
function _defineProperty(obj, key2, value2) {
if (key2 in obj) {
Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true });
} else {
obj[key2] = value2;
}
return obj;
}
var UpOutlined = function UpOutlined2(props3, context) {
var p = _objectSpread({}, props3, context.attrs);
return createVNode(AntdIcon, _objectSpread({}, p, {
"icon": UpOutlinedSvg
}), null);
};
UpOutlined.displayName = "UpOutlined";
UpOutlined.inheritAttrs = false;
const UpOutlined$1 = UpOutlined;
function supportBigInt() {
return typeof BigInt === "function";
}
function trimNumber(numStr) {
var str = numStr.trim();
var negative = str.startsWith("-");
if (negative) {
str = str.slice(1);
}
str = str.replace(/(\.\d*[^0])0*$/, "$1").replace(/\.0*$/, "").replace(/^0+/, "");
if (str.startsWith(".")) {
str = "0".concat(str);
}
var trimStr = str || "0";
var splitNumber = trimStr.split(".");
var integerStr = splitNumber[0] || "0";
var decimalStr = splitNumber[1] || "0";
if (integerStr === "0" && decimalStr === "0") {
negative = false;
}
var negativeStr = negative ? "-" : "";
return {
negative,
negativeStr,
trimStr,
integerStr,
decimalStr,
fullStr: "".concat(negativeStr).concat(trimStr)
};
}
function isE(number2) {
var str = String(number2);
return !Number.isNaN(Number(str)) && str.includes("e");
}
function getNumberPrecision(number2) {
var numStr = String(number2);
if (isE(number2)) {
var precision = Number(numStr.slice(numStr.indexOf("e-") + 2));
var decimalMatch = numStr.match(/\.(\d+)/);
if (decimalMatch !== null && decimalMatch !== void 0 && decimalMatch[1]) {
precision += decimalMatch[1].length;
}
return precision;
}
return numStr.includes(".") && validateNumber(numStr) ? numStr.length - numStr.indexOf(".") - 1 : 0;
}
function num2str(number2) {
var numStr = String(number2);
if (isE(number2)) {
if (number2 > Number.MAX_SAFE_INTEGER) {
return String(supportBigInt() ? BigInt(number2).toString() : Number.MAX_SAFE_INTEGER);
}
if (number2 < Number.MIN_SAFE_INTEGER) {
return String(supportBigInt() ? BigInt(number2).toString() : Number.MIN_SAFE_INTEGER);
}
numStr = number2.toFixed(getNumberPrecision(numStr));
}
return trimNumber(numStr).fullStr;
}
function validateNumber(num) {
if (typeof num === "number") {
return !Number.isNaN(num);
}
if (!num) {
return false;
}
return (
// Normal type: 11.28
/^\s*-?\d+(\.\d+)?\s*$/.test(num) || // Pre-number: 1.
/^\s*-?\d+\.\s*$/.test(num) || // Post-number: .1
/^\s*-?\.\d+\s*$/.test(num)
);
}
function isEmpty(value2) {
return !value2 && value2 !== 0 && !Number.isNaN(value2) || !String(value2).trim();
}
var NumberDecimal = /* @__PURE__ */ function() {
function NumberDecimal2(value2) {
_classCallCheck(this, NumberDecimal2);
_defineProperty$q(this, "origin", "");
if (isEmpty(value2)) {
this.empty = true;
return;
}
this.origin = String(value2);
this.number = Number(value2);
}
_createClass(NumberDecimal2, [{
key: "negate",
value: function negate() {
return new NumberDecimal2(-this.toNumber());
}
}, {
key: "add",
value: function add(value2) {
if (this.isInvalidate()) {
return new NumberDecimal2(value2);
}
var target = Number(value2);
if (Number.isNaN(target)) {
return this;
}
var number2 = this.number + target;
if (number2 > Number.MAX_SAFE_INTEGER) {
return new NumberDecimal2(Number.MAX_SAFE_INTEGER);
}
if (number2 < Number.MIN_SAFE_INTEGER) {
return new NumberDecimal2(Number.MIN_SAFE_INTEGER);
}
var maxPrecision = Math.max(getNumberPrecision(this.number), getNumberPrecision(target));
return new NumberDecimal2(number2.toFixed(maxPrecision));
}
}, {
key: "isEmpty",
value: function isEmpty2() {
return this.empty;
}
}, {
key: "isNaN",
value: function isNaN2() {
return Number.isNaN(this.number);
}
}, {
key: "isInvalidate",
value: function isInvalidate() {
return this.isEmpty() || this.isNaN();
}
}, {
key: "equals",
value: function equals(target) {
return this.toNumber() === (target === null || target === void 0 ? void 0 : target.toNumber());
}
}, {
key: "lessEquals",
value: function lessEquals(target) {
return this.add(target.negate().toString()).toNumber() <= 0;
}
}, {
key: "toNumber",
value: function toNumber() {
return this.number;
}
}, {
key: "toString",
value: function toString3() {
var safe = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
if (!safe) {
return this.origin;
}
if (this.isInvalidate()) {
return "";
}
return num2str(this.number);
}
}]);
return NumberDecimal2;
}();
var BigIntDecimal = /* @__PURE__ */ function() {
function BigIntDecimal2(value2) {
_classCallCheck(this, BigIntDecimal2);
_defineProperty$q(this, "origin", "");
if (isEmpty(value2)) {
this.empty = true;
return;
}
this.origin = String(value2);
if (value2 === "-" || Number.isNaN(value2)) {
this.nan = true;
return;
}
var mergedValue = value2;
if (isE(mergedValue)) {
mergedValue = Number(mergedValue);
}
mergedValue = typeof mergedValue === "string" ? mergedValue : num2str(mergedValue);
if (validateNumber(mergedValue)) {
var trimRet = trimNumber(mergedValue);
this.negative = trimRet.negative;
var numbers = trimRet.trimStr.split(".");
this.integer = BigInt(numbers[0]);
var decimalStr = numbers[1] || "0";
this.decimal = BigInt(decimalStr);
this.decimalLen = decimalStr.length;
} else {
this.nan = true;
}
}
_createClass(BigIntDecimal2, [{
key: "getMark",
value: function getMark2() {
return this.negative ? "-" : "";
}
}, {
key: "getIntegerStr",
value: function getIntegerStr() {
return this.integer.toString();
}
}, {
key: "getDecimalStr",
value: function getDecimalStr() {
return this.decimal.toString().padStart(this.decimalLen, "0");
}
/**
* Align BigIntDecimal with same decimal length. e.g. 12.3 + 5 = 1230000
* This is used for add function only.
*/
}, {
key: "alignDecimal",
value: function alignDecimal(decimalLength) {
var str = "".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(decimalLength, "0"));
return BigInt(str);
}
}, {
key: "negate",
value: function negate() {
var clone3 = new BigIntDecimal2(this.toString());
clone3.negative = !clone3.negative;
return clone3;
}
}, {
key: "add",
value: function add(value2) {
if (this.isInvalidate()) {
return new BigIntDecimal2(value2);
}
var offset3 = new BigIntDecimal2(value2);
if (offset3.isInvalidate()) {
return this;
}
var maxDecimalLength = Math.max(this.getDecimalStr().length, offset3.getDecimalStr().length);
var myAlignedDecimal = this.alignDecimal(maxDecimalLength);
var offsetAlignedDecimal = offset3.alignDecimal(maxDecimalLength);
var valueStr = (myAlignedDecimal + offsetAlignedDecimal).toString();
var _trimNumber = trimNumber(valueStr), negativeStr = _trimNumber.negativeStr, trimStr = _trimNumber.trimStr;
var hydrateValueStr = "".concat(negativeStr).concat(trimStr.padStart(maxDecimalLength + 1, "0"));
return new BigIntDecimal2("".concat(hydrateValueStr.slice(0, -maxDecimalLength), ".").concat(hydrateValueStr.slice(-maxDecimalLength)));
}
}, {
key: "isEmpty",
value: function isEmpty2() {
return this.empty;
}
}, {
key: "isNaN",
value: function isNaN2() {
return this.nan;
}
}, {
key: "isInvalidate",
value: function isInvalidate() {
return this.isEmpty() || this.isNaN();
}
}, {
key: "equals",
value: function equals(target) {
return this.toString() === (target === null || target === void 0 ? void 0 : target.toString());
}
}, {
key: "lessEquals",
value: function lessEquals(target) {
return this.add(target.negate().toString()).toNumber() <= 0;
}
}, {
key: "toNumber",
value: function toNumber() {
if (this.isNaN()) {
return NaN;
}
return Number(this.toString());
}
}, {
key: "toString",
value: function toString3() {
var safe = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
if (!safe) {
return this.origin;
}
if (this.isInvalidate()) {
return "";
}
return trimNumber("".concat(this.getMark()).concat(this.getIntegerStr(), ".").concat(this.getDecimalStr())).fullStr;
}
}]);
return BigIntDecimal2;
}();
function getMiniDecimal(value2) {
if (supportBigInt()) {
return new BigIntDecimal(value2);
}
return new NumberDecimal(value2);
}
function toFixed(numStr, separatorStr, precision) {
var cutOnly = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
if (numStr === "") {
return "";
}
var _trimNumber2 = trimNumber(numStr), negativeStr = _trimNumber2.negativeStr, integerStr = _trimNumber2.integerStr, decimalStr = _trimNumber2.decimalStr;
var precisionDecimalStr = "".concat(separatorStr).concat(decimalStr);
var numberWithoutDecimal = "".concat(negativeStr).concat(integerStr);
if (precision >= 0) {
var advancedNum = Number(decimalStr[precision]);
if (advancedNum >= 5 && !cutOnly) {
var advancedDecimal = getMiniDecimal(numStr).add("".concat(negativeStr, "0.").concat("0".repeat(precision)).concat(10 - advancedNum));
return toFixed(advancedDecimal.toString(), separatorStr, precision, cutOnly);
}
if (precision === 0) {
return numberWithoutDecimal;
}
return "".concat(numberWithoutDecimal).concat(separatorStr).concat(decimalStr.padEnd(precision, "0").slice(0, precision));
}
if (precisionDecimalStr === ".0") {
return numberWithoutDecimal;
}
return "".concat(numberWithoutDecimal).concat(precisionDecimalStr);
}
var STEP_INTERVAL = 200;
var STEP_DELAY = 600;
const StepHandler = defineComponent({
compatConfig: {
MODE: 3
},
name: "StepHandler",
inheritAttrs: false,
props: {
prefixCls: String,
upDisabled: Boolean,
downDisabled: Boolean,
onStep: {
type: Function
}
},
slots: ["upNode", "downNode"],
setup: function setup92(props3, _ref) {
var slots = _ref.slots, emit = _ref.emit;
var stepTimeoutRef = ref();
var onStepMouseDown = function onStepMouseDown2(e2, up) {
e2.preventDefault();
emit("step", up);
function loopStep() {
emit("step", up);
stepTimeoutRef.value = setTimeout(loopStep, STEP_INTERVAL);
}
stepTimeoutRef.value = setTimeout(loopStep, STEP_DELAY);
};
var onStopStep = function onStopStep2() {
clearTimeout(stepTimeoutRef.value);
};
onBeforeUnmount(function() {
onStopStep();
});
return function() {
if (isMobile$2()) {
return null;
}
var prefixCls = props3.prefixCls, upDisabled = props3.upDisabled, downDisabled = props3.downDisabled;
var handlerClassName = "".concat(prefixCls, "-handler");
var upClassName = classNames(handlerClassName, "".concat(handlerClassName, "-up"), _defineProperty$q({}, "".concat(handlerClassName, "-up-disabled"), upDisabled));
var downClassName = classNames(handlerClassName, "".concat(handlerClassName, "-down"), _defineProperty$q({}, "".concat(handlerClassName, "-down-disabled"), downDisabled));
var sharedHandlerProps = {
unselectable: "on",
role: "button",
onMouseup: onStopStep,
onMouseleave: onStopStep
};
var upNode = slots.upNode, downNode = slots.downNode;
return createVNode("div", {
"class": "".concat(handlerClassName, "-wrap")
}, [createVNode("span", _objectSpread2$1(_objectSpread2$1({}, sharedHandlerProps), {}, {
"onMousedown": function onMousedown2(e2) {
onStepMouseDown(e2, true);
},
"aria-label": "Increase Value",
"aria-disabled": upDisabled,
"class": upClassName
}), [(upNode === null || upNode === void 0 ? void 0 : upNode()) || createVNode("span", {
"unselectable": "on",
"class": "".concat(prefixCls, "-handler-up-inner")
}, null)]), createVNode("span", _objectSpread2$1(_objectSpread2$1({}, sharedHandlerProps), {}, {
"onMousedown": function onMousedown2(e2) {
onStepMouseDown(e2, false);
},
"aria-label": "Decrease Value",
"aria-disabled": downDisabled,
"class": downClassName
}), [(downNode === null || downNode === void 0 ? void 0 : downNode()) || createVNode("span", {
"unselectable": "on",
"class": "".concat(prefixCls, "-handler-down-inner")
}, null)])]);
};
}
});
function useCursor(inputRef, focused) {
var selectionRef = ref(null);
function recordCursor() {
try {
var _inputRef$value = inputRef.value, start = _inputRef$value.selectionStart, end = _inputRef$value.selectionEnd, value2 = _inputRef$value.value;
var beforeTxt = value2.substring(0, start);
var afterTxt = value2.substring(end);
selectionRef.value = {
start,
end,
value: value2,
beforeTxt,
afterTxt
};
} catch (e2) {
}
}
function restoreCursor() {
if (inputRef.value && selectionRef.value && focused.value) {
try {
var value2 = inputRef.value.value;
var _selectionRef$value = selectionRef.value, beforeTxt = _selectionRef$value.beforeTxt, afterTxt = _selectionRef$value.afterTxt, start = _selectionRef$value.start;
var startPos = value2.length;
if (value2.endsWith(afterTxt)) {
startPos = value2.length - selectionRef.value.afterTxt.length;
} else if (value2.startsWith(beforeTxt)) {
startPos = beforeTxt.length;
} else {
var beforeLastChar = beforeTxt[start - 1];
var newIndex = value2.indexOf(beforeLastChar, start - 1);
if (newIndex !== -1) {
startPos = newIndex + 1;
}
}
inputRef.value.setSelectionRange(startPos, startPos);
} catch (e2) {
warning$2(false, "Something warning of cursor restore. Please fire issue about this: ".concat(e2.message));
}
}
}
return [recordCursor, restoreCursor];
}
const useFrame = function() {
var idRef = ref(0);
var cleanUp = function cleanUp2() {
wrapperRaf.cancel(idRef.value);
};
onBeforeUnmount(function() {
cleanUp();
});
return function(callback) {
cleanUp();
idRef.value = wrapperRaf(function() {
callback();
});
};
};
var _excluded$2 = ["prefixCls", "min", "max", "step", "defaultValue", "value", "disabled", "readonly", "keyboard", "controls", "autofocus", "stringMode", "parser", "formatter", "precision", "decimalSeparator", "onChange", "onInput", "onPressEnter", "onStep", "lazy", "class", "style"];
var getDecimalValue = function getDecimalValue2(stringMode, decimalValue) {
if (stringMode || decimalValue.isEmpty()) {
return decimalValue.toString();
}
return decimalValue.toNumber();
};
var getDecimalIfValidate = function getDecimalIfValidate2(value2) {
var decimal = getMiniDecimal(value2);
return decimal.isInvalidate() ? null : decimal;
};
var inputNumberProps$1 = function inputNumberProps() {
return {
/** value will show as string */
stringMode: {
type: Boolean
},
defaultValue: {
type: [String, Number]
},
value: {
type: [String, Number]
},
prefixCls: {
type: String
},
min: {
type: [String, Number]
},
max: {
type: [String, Number]
},
step: {
type: [String, Number],
default: 1
},
tabindex: {
type: Number
},
controls: {
type: Boolean,
default: true
},
readonly: {
type: Boolean
},
disabled: {
type: Boolean
},
autofocus: {
type: Boolean
},
keyboard: {
type: Boolean,
default: true
},
/** Parse display value to validate number */
parser: {
type: Function
},
/** Transform `value` to display value show in input */
formatter: {
type: Function
},
/** Syntactic sugar of `formatter`. Config precision of display. */
precision: {
type: Number
},
/** Syntactic sugar of `formatter`. Config decimal separator of display. */
decimalSeparator: {
type: String
},
onInput: {
type: Function
},
onChange: {
type: Function
},
onPressEnter: {
type: Function
},
onStep: {
type: Function
},
onBlur: {
type: Function
},
onFocus: {
type: Function
}
};
};
const VcInputNumber = defineComponent({
compatConfig: {
MODE: 3
},
name: "InnerInputNumber",
inheritAttrs: false,
props: _objectSpread2$1(_objectSpread2$1({}, inputNumberProps$1()), {}, {
lazy: Boolean
}),
slots: ["upHandler", "downHandler"],
setup: function setup93(props3, _ref) {
var attrs = _ref.attrs, slots = _ref.slots, emit = _ref.emit, expose = _ref.expose;
var inputRef = ref();
var focus = ref(false);
var userTypingRef = ref(false);
var compositionRef = ref(false);
var decimalValue = ref(getMiniDecimal(props3.value));
function setUncontrolledDecimalValue(newDecimal) {
if (props3.value === void 0) {
decimalValue.value = newDecimal;
}
}
var getPrecision = function getPrecision2(numStr, userTyping) {
if (userTyping) {
return void 0;
}
if (props3.precision >= 0) {
return props3.precision;
}
return Math.max(getNumberPrecision(numStr), getNumberPrecision(props3.step));
};
var mergedParser = function mergedParser2(num) {
var numStr = String(num);
if (props3.parser) {
return props3.parser(numStr);
}
var parsedStr = numStr;
if (props3.decimalSeparator) {
parsedStr = parsedStr.replace(props3.decimalSeparator, ".");
}
return parsedStr.replace(/[^\w.-]+/g, "");
};
var inputValue = ref("");
var mergedFormatter = function mergedFormatter2(number2, userTyping) {
if (props3.formatter) {
return props3.formatter(number2, {
userTyping,
input: String(inputValue.value)
});
}
var str = typeof number2 === "number" ? num2str(number2) : number2;
if (!userTyping) {
var mergedPrecision = getPrecision(str, userTyping);
if (validateNumber(str) && (props3.decimalSeparator || mergedPrecision >= 0)) {
var separatorStr = props3.decimalSeparator || ".";
str = toFixed(str, separatorStr, mergedPrecision);
}
}
return str;
};
var initValue = function() {
var initValue2 = props3.value;
if (decimalValue.value.isInvalidate() && ["string", "number"].includes(_typeof$2(initValue2))) {
return Number.isNaN(initValue2) ? "" : initValue2;
}
return mergedFormatter(decimalValue.value.toString(), false);
}();
inputValue.value = initValue;
function setInputValue(newValue, userTyping) {
inputValue.value = mergedFormatter(
// Invalidate number is sometime passed by external control, we should let it go
// Otherwise is controlled by internal interactive logic which check by userTyping
// You can ref 'show limited value when input is not focused' test for more info.
newValue.isInvalidate() ? newValue.toString(false) : newValue.toString(!userTyping),
userTyping
);
}
var maxDecimal = computed(function() {
return getDecimalIfValidate(props3.max);
});
var minDecimal = computed(function() {
return getDecimalIfValidate(props3.min);
});
var upDisabled = computed(function() {
if (!maxDecimal.value || !decimalValue.value || decimalValue.value.isInvalidate()) {
return false;
}
return maxDecimal.value.lessEquals(decimalValue.value);
});
var downDisabled = computed(function() {
if (!minDecimal.value || !decimalValue.value || decimalValue.value.isInvalidate()) {
return false;
}
return decimalValue.value.lessEquals(minDecimal.value);
});
var _useCursor = useCursor(inputRef, focus), _useCursor2 = _slicedToArray$2(_useCursor, 2), recordCursor = _useCursor2[0], restoreCursor = _useCursor2[1];
var getRangeValue = function getRangeValue2(target) {
if (maxDecimal.value && !target.lessEquals(maxDecimal.value)) {
return maxDecimal.value;
}
if (minDecimal.value && !minDecimal.value.lessEquals(target)) {
return minDecimal.value;
}
return null;
};
var isInRange2 = function isInRange3(target) {
return !getRangeValue(target);
};
var triggerValueUpdate = function triggerValueUpdate2(newValue, userTyping) {
var updateValue = newValue;
var isRangeValidate = isInRange2(updateValue) || updateValue.isEmpty();
if (!updateValue.isEmpty() && !userTyping) {
updateValue = getRangeValue(updateValue) || updateValue;
isRangeValidate = true;
}
if (!props3.readonly && !props3.disabled && isRangeValidate) {
var numStr = updateValue.toString();
var mergedPrecision = getPrecision(numStr, userTyping);
if (mergedPrecision >= 0) {
updateValue = getMiniDecimal(toFixed(numStr, ".", mergedPrecision));
}
if (!updateValue.equals(decimalValue.value)) {
var _props$onChange;
setUncontrolledDecimalValue(updateValue);
(_props$onChange = props3.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props3, updateValue.isEmpty() ? null : getDecimalValue(props3.stringMode, updateValue));
if (props3.value === void 0) {
setInputValue(updateValue, userTyping);
}
}
return updateValue;
}
return decimalValue.value;
};
var onNextPromise = useFrame();
var collectInputValue = function collectInputValue2(inputStr) {
var _props$onInput;
recordCursor();
inputValue.value = inputStr;
if (!compositionRef.value) {
var finalValue = mergedParser(inputStr);
var finalDecimal = getMiniDecimal(finalValue);
if (!finalDecimal.isNaN()) {
triggerValueUpdate(finalDecimal, true);
}
}
(_props$onInput = props3.onInput) === null || _props$onInput === void 0 ? void 0 : _props$onInput.call(props3, inputStr);
onNextPromise(function() {
var nextInputStr = inputStr;
if (!props3.parser) {
nextInputStr = inputStr.replace(/。/g, ".");
}
if (nextInputStr !== inputStr) {
collectInputValue2(nextInputStr);
}
});
};
var onCompositionStart2 = function onCompositionStart3() {
compositionRef.value = true;
};
var onCompositionEnd2 = function onCompositionEnd3() {
compositionRef.value = false;
collectInputValue(inputRef.value.value);
};
var onInternalInput = function onInternalInput2(e2) {
collectInputValue(e2.target.value);
};
var onInternalStep = function onInternalStep2(up) {
var _props$onStep, _inputRef$value;
if (up && upDisabled.value || !up && downDisabled.value) {
return;
}
userTypingRef.value = false;
var stepDecimal = getMiniDecimal(props3.step);
if (!up) {
stepDecimal = stepDecimal.negate();
}
var target = (decimalValue.value || getMiniDecimal(0)).add(stepDecimal.toString());
var updatedValue = triggerValueUpdate(target, false);
(_props$onStep = props3.onStep) === null || _props$onStep === void 0 ? void 0 : _props$onStep.call(props3, getDecimalValue(props3.stringMode, updatedValue), {
offset: props3.step,
type: up ? "up" : "down"
});
(_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 ? void 0 : _inputRef$value.focus();
};
var flushInputValue = function flushInputValue2(userTyping) {
var parsedValue = getMiniDecimal(mergedParser(inputValue.value));
var formatValue2 = parsedValue;
if (!parsedValue.isNaN()) {
formatValue2 = triggerValueUpdate(parsedValue, userTyping);
} else {
formatValue2 = decimalValue.value;
}
if (props3.value !== void 0) {
setInputValue(decimalValue.value, false);
} else if (!formatValue2.isNaN()) {
setInputValue(formatValue2, false);
}
};
var onKeyDown = function onKeyDown2(event) {
var which = event.which;
userTypingRef.value = true;
if (which === KeyCode$1.ENTER) {
var _props$onPressEnter;
if (!compositionRef.value) {
userTypingRef.value = false;
}
flushInputValue(false);
(_props$onPressEnter = props3.onPressEnter) === null || _props$onPressEnter === void 0 ? void 0 : _props$onPressEnter.call(props3, event);
}
if (props3.keyboard === false) {
return;
}
if (!compositionRef.value && [KeyCode$1.UP, KeyCode$1.DOWN].includes(which)) {
onInternalStep(KeyCode$1.UP === which);
event.preventDefault();
}
};
var onKeyUp = function onKeyUp2() {
userTypingRef.value = false;
};
var onBlur2 = function onBlur3(e2) {
flushInputValue(false);
focus.value = false;
userTypingRef.value = false;
emit("blur", e2);
};
watch(function() {
return props3.precision;
}, function() {
if (!decimalValue.value.isInvalidate()) {
setInputValue(decimalValue.value, false);
}
}, {
flush: "post"
});
watch(function() {
return props3.value;
}, function() {
var newValue = getMiniDecimal(props3.value);
decimalValue.value = newValue;
var currentParsedValue = getMiniDecimal(mergedParser(inputValue.value));
if (!newValue.equals(currentParsedValue) || !userTypingRef.value || props3.formatter) {
setInputValue(newValue, userTypingRef.value);
}
}, {
flush: "post"
});
watch(inputValue, function() {
if (props3.formatter) {
restoreCursor();
}
}, {
flush: "post"
});
watch(function() {
return props3.disabled;
}, function(val) {
if (val) {
focus.value = false;
}
});
expose({
focus: function focus2() {
var _inputRef$value2;
(_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 ? void 0 : _inputRef$value2.focus();
},
blur: function blur() {
var _inputRef$value3;
(_inputRef$value3 = inputRef.value) === null || _inputRef$value3 === void 0 ? void 0 : _inputRef$value3.blur();
}
});
return function() {
var _classNames;
var _attrs$props = _objectSpread2$1(_objectSpread2$1({}, attrs), props3), _attrs$props$prefixCl = _attrs$props.prefixCls, prefixCls = _attrs$props$prefixCl === void 0 ? "rc-input-number" : _attrs$props$prefixCl, min = _attrs$props.min, max = _attrs$props.max, _attrs$props$step = _attrs$props.step, step = _attrs$props$step === void 0 ? 1 : _attrs$props$step;
_attrs$props.defaultValue;
_attrs$props.value;
var disabled = _attrs$props.disabled, readonly = _attrs$props.readonly;
_attrs$props.keyboard;
var _attrs$props$controls = _attrs$props.controls, controls = _attrs$props$controls === void 0 ? true : _attrs$props$controls, autofocus = _attrs$props.autofocus;
_attrs$props.stringMode;
_attrs$props.parser;
_attrs$props.formatter;
_attrs$props.precision;
_attrs$props.decimalSeparator;
_attrs$props.onChange;
_attrs$props.onInput;
_attrs$props.onPressEnter;
_attrs$props.onStep;
var lazy = _attrs$props.lazy, className = _attrs$props.class, style = _attrs$props.style, inputProps3 = _objectWithoutProperties$2(_attrs$props, _excluded$2);
var upHandler = slots.upHandler, downHandler = slots.downHandler;
var inputClassName = "".concat(prefixCls, "-input");
var eventProps = {};
if (lazy) {
eventProps.onChange = onInternalInput;
} else {
eventProps.onInput = onInternalInput;
}
return createVNode("div", {
"class": classNames(prefixCls, className, (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls, "-focused"), focus.value), _defineProperty$q(_classNames, "".concat(prefixCls, "-disabled"), disabled), _defineProperty$q(_classNames, "".concat(prefixCls, "-readonly"), readonly), _defineProperty$q(_classNames, "".concat(prefixCls, "-not-a-number"), decimalValue.value.isNaN()), _defineProperty$q(_classNames, "".concat(prefixCls, "-out-of-range"), !decimalValue.value.isInvalidate() && !isInRange2(decimalValue.value)), _classNames)),
"style": style,
"onKeydown": onKeyDown,
"onKeyup": onKeyUp
}, [controls && createVNode(StepHandler, {
"prefixCls": prefixCls,
"upDisabled": upDisabled.value,
"downDisabled": downDisabled.value,
"onStep": onInternalStep
}, {
upNode: upHandler,
downNode: downHandler
}), createVNode("div", {
"class": "".concat(inputClassName, "-wrap")
}, [createVNode("input", _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({
"autofocus": autofocus,
"autocomplete": "off",
"role": "spinbutton",
"aria-valuemin": min,
"aria-valuemax": max,
"aria-valuenow": decimalValue.value.isInvalidate() ? null : decimalValue.value.toString(),
"step": step
}, inputProps3), {}, {
"ref": inputRef,
"class": inputClassName,
"value": inputValue.value,
"disabled": disabled,
"readonly": readonly,
"onFocus": function onFocus2(e2) {
focus.value = true;
emit("focus", e2);
}
}, eventProps), {}, {
"onBlur": onBlur2,
"onCompositionstart": onCompositionStart2,
"onCompositionend": onCompositionEnd2
}), null)])]);
};
}
});
function isValidValue(val) {
return val !== void 0 && val !== null;
}
var _excluded$1 = ["class", "bordered", "readonly", "style", "addonBefore", "addonAfter", "prefix", "valueModifiers"];
var baseProps = inputNumberProps$1();
var inputNumberProps2 = function inputNumberProps3() {
return _objectSpread2$1(_objectSpread2$1({}, baseProps), {}, {
size: {
type: String
},
bordered: {
type: Boolean,
default: true
},
placeholder: String,
name: String,
id: String,
type: String,
addonBefore: PropTypes$1.any,
addonAfter: PropTypes$1.any,
prefix: PropTypes$1.any,
"onUpdate:value": baseProps.onChange,
valueModifiers: Object
});
};
var InputNumber = defineComponent({
compatConfig: {
MODE: 3
},
name: "AInputNumber",
inheritAttrs: false,
props: inputNumberProps2(),
// emits: ['focus', 'blur', 'change', 'input', 'update:value'],
slots: ["addonBefore", "addonAfter", "prefix"],
setup: function setup94(props3, _ref) {
var emit = _ref.emit, expose = _ref.expose, attrs = _ref.attrs, slots = _ref.slots;
var formItemContext = useInjectFormItemContext();
var _useConfigInject = useConfigInject("input-number", props3), prefixCls = _useConfigInject.prefixCls, size = _useConfigInject.size, direction = _useConfigInject.direction;
var mergedValue = ref(props3.value === void 0 ? props3.defaultValue : props3.value);
var focused = ref(false);
watch(function() {
return props3.value;
}, function() {
mergedValue.value = props3.value;
});
var inputNumberRef = ref(null);
var focus = function focus2() {
var _inputNumberRef$value;
(_inputNumberRef$value = inputNumberRef.value) === null || _inputNumberRef$value === void 0 ? void 0 : _inputNumberRef$value.focus();
};
var blur = function blur2() {
var _inputNumberRef$value2;
(_inputNumberRef$value2 = inputNumberRef.value) === null || _inputNumberRef$value2 === void 0 ? void 0 : _inputNumberRef$value2.blur();
};
expose({
focus,
blur
});
var handleChange = function handleChange2(val) {
if (props3.value === void 0) {
mergedValue.value = val;
}
emit("update:value", val);
emit("change", val);
formItemContext.onFieldChange();
};
var handleBlur = function handleBlur2(e2) {
focused.value = false;
emit("blur", e2);
formItemContext.onFieldBlur();
};
var handleFocus = function handleFocus2(e2) {
focused.value = true;
emit("focus", e2);
};
return function() {
var _slots$addonBefore, _slots$addonAfter, _slots$prefix, _classNames;
var _attrs$props = _objectSpread2$1(_objectSpread2$1({}, attrs), props3), className = _attrs$props.class, bordered = _attrs$props.bordered, readonly = _attrs$props.readonly, style = _attrs$props.style, _attrs$props$addonBef = _attrs$props.addonBefore, addonBefore = _attrs$props$addonBef === void 0 ? (_slots$addonBefore = slots.addonBefore) === null || _slots$addonBefore === void 0 ? void 0 : _slots$addonBefore.call(slots) : _attrs$props$addonBef, _attrs$props$addonAft = _attrs$props.addonAfter, addonAfter = _attrs$props$addonAft === void 0 ? (_slots$addonAfter = slots.addonAfter) === null || _slots$addonAfter === void 0 ? void 0 : _slots$addonAfter.call(slots) : _attrs$props$addonAft, _attrs$props$prefix = _attrs$props.prefix, prefix = _attrs$props$prefix === void 0 ? (_slots$prefix = slots.prefix) === null || _slots$prefix === void 0 ? void 0 : _slots$prefix.call(slots) : _attrs$props$prefix, _attrs$props$valueMod = _attrs$props.valueModifiers, valueModifiers = _attrs$props$valueMod === void 0 ? {} : _attrs$props$valueMod, others = _objectWithoutProperties$2(_attrs$props, _excluded$1);
var preCls = prefixCls.value;
var mergeSize = size.value;
var inputNumberClass = classNames((_classNames = {}, _defineProperty$q(_classNames, "".concat(preCls, "-lg"), mergeSize === "large"), _defineProperty$q(_classNames, "".concat(preCls, "-sm"), mergeSize === "small"), _defineProperty$q(_classNames, "".concat(preCls, "-rtl"), direction.value === "rtl"), _defineProperty$q(_classNames, "".concat(preCls, "-readonly"), readonly), _defineProperty$q(_classNames, "".concat(preCls, "-borderless"), !bordered), _classNames), className);
var element = createVNode(VcInputNumber, _objectSpread2$1(_objectSpread2$1({}, omit(others, ["size", "defaultValue"])), {}, {
"ref": inputNumberRef,
"lazy": !!valueModifiers.lazy,
"value": mergedValue.value,
"class": inputNumberClass,
"prefixCls": preCls,
"readonly": readonly,
"onChange": handleChange,
"onBlur": handleBlur,
"onFocus": handleFocus
}), {
upHandler: function upHandler() {
return createVNode(UpOutlined$1, {
"class": "".concat(preCls, "-handler-up-inner")
}, null);
},
downHandler: function downHandler() {
return createVNode(DownOutlined$1, {
"class": "".concat(preCls, "-handler-down-inner")
}, null);
}
});
var hasAddon2 = isValidValue(addonBefore) || isValidValue(addonAfter);
if (isValidValue(prefix)) {
var _classNames2;
var affixWrapperCls = classNames("".concat(preCls, "-affix-wrapper"), (_classNames2 = {}, _defineProperty$q(_classNames2, "".concat(preCls, "-affix-wrapper-focused"), focused.value), _defineProperty$q(_classNames2, "".concat(preCls, "-affix-wrapper-disabled"), props3.disabled), _defineProperty$q(_classNames2, "".concat(preCls, "-affix-wrapper-rtl"), direction.value === "rtl"), _defineProperty$q(_classNames2, "".concat(preCls, "-affix-wrapper-readonly"), readonly), _defineProperty$q(_classNames2, "".concat(preCls, "-affix-wrapper-borderless"), !bordered), _defineProperty$q(_classNames2, "".concat(className), !hasAddon2 && className), _classNames2));
element = createVNode("div", {
"class": affixWrapperCls,
"style": style,
"onMouseup": function onMouseup() {
return inputNumberRef.value.focus();
}
}, [createVNode("span", {
"class": "".concat(preCls, "-prefix")
}, [prefix]), element]);
}
if (hasAddon2) {
var _classNames4;
var wrapperClassName = "".concat(preCls, "-group");
var addonClassName = "".concat(wrapperClassName, "-addon");
var addonBeforeNode = addonBefore ? createVNode("div", {
"class": addonClassName
}, [addonBefore]) : null;
var addonAfterNode = addonAfter ? createVNode("div", {
"class": addonClassName
}, [addonAfter]) : null;
var mergedWrapperClassName = classNames("".concat(preCls, "-wrapper"), wrapperClassName, _defineProperty$q({}, "".concat(wrapperClassName, "-rtl"), direction.value === "rtl"));
var mergedGroupClassName = classNames("".concat(preCls, "-group-wrapper"), (_classNames4 = {}, _defineProperty$q(_classNames4, "".concat(preCls, "-group-wrapper-sm"), mergeSize === "small"), _defineProperty$q(_classNames4, "".concat(preCls, "-group-wrapper-lg"), mergeSize === "large"), _defineProperty$q(_classNames4, "".concat(preCls, "-group-wrapper-rtl"), direction.value === "rtl"), _classNames4), className);
element = createVNode("div", {
"class": mergedGroupClassName,
"style": style
}, [createVNode("div", {
"class": mergedWrapperClassName
}, [addonBeforeNode, element, addonAfterNode])]);
}
return cloneElement(element, {
style
});
};
}
});
const __unplugin_components_1 = _extends(InputNumber, {
install: function install2(app) {
app.component(InputNumber.name, InputNumber);
return app;
}
});
var _excluded = ["prefixCls", "visible", "wrapClassName", "centered", "getContainer", "closeIcon", "focusTriggerAfterClose"];
var mousePosition = null;
var getClickPosition = function getClickPosition2(e2) {
mousePosition = {
x: e2.pageX,
y: e2.pageY
};
setTimeout(function() {
return mousePosition = null;
}, 100);
};
if (canUseDocElement()) {
addEventListenerWrap(document.documentElement, "click", getClickPosition, true);
}
var modalProps = function modalProps2() {
return {
prefixCls: String,
visible: {
type: Boolean,
default: void 0
},
confirmLoading: {
type: Boolean,
default: void 0
},
title: PropTypes$1.any,
closable: {
type: Boolean,
default: void 0
},
closeIcon: PropTypes$1.any,
onOk: Function,
onCancel: Function,
"onUpdate:visible": Function,
onChange: Function,
afterClose: Function,
centered: {
type: Boolean,
default: void 0
},
width: [String, Number],
footer: PropTypes$1.any,
okText: PropTypes$1.any,
okType: String,
cancelText: PropTypes$1.any,
icon: PropTypes$1.any,
maskClosable: {
type: Boolean,
default: void 0
},
forceRender: {
type: Boolean,
default: void 0
},
okButtonProps: Object,
cancelButtonProps: Object,
destroyOnClose: {
type: Boolean,
default: void 0
},
wrapClassName: String,
maskTransitionName: String,
transitionName: String,
getContainer: {
type: [String, Function, Boolean, Object],
default: void 0
},
zIndex: Number,
bodyStyle: {
type: Object,
default: void 0
},
maskStyle: {
type: Object,
default: void 0
},
mask: {
type: Boolean,
default: void 0
},
keyboard: {
type: Boolean,
default: void 0
},
wrapProps: Object,
focusTriggerAfterClose: {
type: Boolean,
default: void 0
},
modalRender: Function
};
};
var destroyFns = [];
const Modal = defineComponent({
compatConfig: {
MODE: 3
},
name: "AModal",
inheritAttrs: false,
props: initDefaultProps$1(modalProps(), {
width: 520,
transitionName: "zoom",
maskTransitionName: "fade",
confirmLoading: false,
visible: false,
okType: "primary"
}),
setup: function setup95(props3, _ref) {
var emit = _ref.emit, slots = _ref.slots, attrs = _ref.attrs;
var _useLocaleReceiver = useLocaleReceiver("Modal"), _useLocaleReceiver2 = _slicedToArray$2(_useLocaleReceiver, 1), locale3 = _useLocaleReceiver2[0];
var _useConfigInject = useConfigInject("modal", props3), prefixCls = _useConfigInject.prefixCls, rootPrefixCls = _useConfigInject.rootPrefixCls, direction = _useConfigInject.direction, getPopupContainer = _useConfigInject.getPopupContainer;
var handleCancel = function handleCancel2(e2) {
emit("update:visible", false);
emit("cancel", e2);
emit("change", false);
};
var handleOk = function handleOk2(e2) {
emit("ok", e2);
};
var renderFooter = function renderFooter2() {
var _slots$okText, _slots$cancelText;
var _props$okText = props3.okText, okText = _props$okText === void 0 ? (_slots$okText = slots.okText) === null || _slots$okText === void 0 ? void 0 : _slots$okText.call(slots) : _props$okText, okType = props3.okType, _props$cancelText = props3.cancelText, cancelText = _props$cancelText === void 0 ? (_slots$cancelText = slots.cancelText) === null || _slots$cancelText === void 0 ? void 0 : _slots$cancelText.call(slots) : _props$cancelText, confirmLoading = props3.confirmLoading;
return createVNode(Fragment, null, [createVNode(Button, _objectSpread2$1({
"onClick": handleCancel
}, props3.cancelButtonProps), {
default: function _default3() {
return [cancelText || locale3.value.cancelText];
}
}), createVNode(Button, _objectSpread2$1(_objectSpread2$1({}, convertLegacyProps(okType)), {}, {
"loading": confirmLoading,
"onClick": handleOk
}, props3.okButtonProps), {
default: function _default3() {
return [okText || locale3.value.okText];
}
})]);
};
return function() {
var _slots$closeIcon, _classNames;
props3.prefixCls;
var visible = props3.visible, wrapClassName = props3.wrapClassName, centered = props3.centered, getContainer4 = props3.getContainer, _props$closeIcon = props3.closeIcon, _closeIcon = _props$closeIcon === void 0 ? (_slots$closeIcon = slots.closeIcon) === null || _slots$closeIcon === void 0 ? void 0 : _slots$closeIcon.call(slots) : _props$closeIcon, _props$focusTriggerAf = props3.focusTriggerAfterClose, focusTriggerAfterClose = _props$focusTriggerAf === void 0 ? true : _props$focusTriggerAf, restProps = _objectWithoutProperties$2(props3, _excluded);
var wrapClassNameExtended = classNames(wrapClassName, (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls.value, "-centered"), !!centered), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-wrap-rtl"), direction.value === "rtl"), _classNames));
return createVNode(DialogWrap$1, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, restProps), attrs), {}, {
"getContainer": getContainer4 || getPopupContainer.value,
"prefixCls": prefixCls.value,
"wrapClassName": wrapClassNameExtended,
"visible": visible,
"mousePosition": mousePosition,
"onClose": handleCancel,
"focusTriggerAfterClose": focusTriggerAfterClose,
"transitionName": getTransitionName$1(rootPrefixCls.value, "zoom", props3.transitionName),
"maskTransitionName": getTransitionName$1(rootPrefixCls.value, "fade", props3.maskTransitionName)
}), _objectSpread2$1(_objectSpread2$1({}, slots), {}, {
footer: slots.footer || renderFooter,
closeIcon: function closeIcon() {
return createVNode("span", {
"class": "".concat(prefixCls.value, "-close-x")
}, [_closeIcon || createVNode(CloseOutlined$1, {
"class": "".concat(prefixCls.value, "-close-icon")
}, null)]);
}
}));
};
}
});
var useDestroyed = function useDestroyed2() {
var destroyed = ref(false);
onBeforeUnmount(function() {
destroyed.value = true;
});
return destroyed;
};
const useDestroyed$1 = useDestroyed;
var actionButtonProps = {
type: {
type: String
},
actionFn: Function,
close: Function,
autofocus: Boolean,
prefixCls: String,
buttonProps: Object,
emitEvent: Boolean,
quitOnNullishReturnValue: Boolean
};
function isThenable(thing) {
return !!(thing && !!thing.then);
}
const ActionButton = defineComponent({
compatConfig: {
MODE: 3
},
name: "ActionButton",
props: actionButtonProps,
setup: function setup96(props3, _ref) {
var slots = _ref.slots;
var clickedRef = ref(false);
var buttonRef = ref();
var loading = ref(false);
var timeoutId;
var isDestroyed = useDestroyed$1();
onMounted(function() {
if (props3.autofocus) {
timeoutId = setTimeout(function() {
var _buttonRef$value$$el;
return (_buttonRef$value$$el = buttonRef.value.$el) === null || _buttonRef$value$$el === void 0 ? void 0 : _buttonRef$value$$el.focus();
});
}
});
onBeforeUnmount(function() {
clearTimeout(timeoutId);
});
var handlePromiseOnOk = function handlePromiseOnOk2(returnValueOfOnOk) {
var close3 = props3.close;
if (!isThenable(returnValueOfOnOk)) {
return;
}
loading.value = true;
returnValueOfOnOk.then(function() {
if (!isDestroyed.value) {
loading.value = false;
}
close3.apply(void 0, arguments);
clickedRef.value = false;
}, function(e2) {
console.error(e2);
if (!isDestroyed.value) {
loading.value = false;
}
clickedRef.value = false;
});
};
var onClick2 = function onClick3(e2) {
var actionFn = props3.actionFn, _props$close = props3.close, close3 = _props$close === void 0 ? function() {
} : _props$close;
if (clickedRef.value) {
return;
}
clickedRef.value = true;
if (!actionFn) {
close3();
return;
}
var returnValueOfOnOk;
if (props3.emitEvent) {
returnValueOfOnOk = actionFn(e2);
if (props3.quitOnNullishReturnValue && !isThenable(returnValueOfOnOk)) {
clickedRef.value = false;
close3(e2);
return;
}
} else if (actionFn.length) {
returnValueOfOnOk = actionFn(close3);
clickedRef.value = false;
} else {
returnValueOfOnOk = actionFn();
if (!returnValueOfOnOk) {
close3();
return;
}
}
handlePromiseOnOk(returnValueOfOnOk);
};
return function() {
var type = props3.type, prefixCls = props3.prefixCls, buttonProps3 = props3.buttonProps;
return createVNode(Button, _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, convertLegacyProps(type)), {}, {
"onClick": onClick2,
"loading": loading.value,
"prefixCls": prefixCls
}, buttonProps3), {}, {
"ref": buttonRef
}), slots);
};
}
});
function renderSomeContent(someContent) {
if (typeof someContent === "function") {
return someContent();
}
return someContent;
}
const ConfirmDialog = defineComponent({
name: "ConfirmDialog",
inheritAttrs: false,
props: ["icon", "onCancel", "onOk", "close", "closable", "zIndex", "afterClose", "visible", "keyboard", "centered", "getContainer", "maskStyle", "okButtonProps", "cancelButtonProps", "okType", "prefixCls", "okCancel", "width", "mask", "maskClosable", "okText", "cancelText", "autoFocusButton", "transitionName", "maskTransitionName", "type", "title", "content", "direction", "rootPrefixCls", "bodyStyle", "closeIcon", "modalRender", "focusTriggerAfterClose", "wrapClassName"],
setup: function setup97(props3, _ref) {
var attrs = _ref.attrs;
var _useLocaleReceiver = useLocaleReceiver("Modal"), _useLocaleReceiver2 = _slicedToArray$2(_useLocaleReceiver, 1), locale3 = _useLocaleReceiver2[0];
return function() {
var icon = props3.icon, onCancel = props3.onCancel, onOk = props3.onOk, close3 = props3.close, _props$closable = props3.closable, closable = _props$closable === void 0 ? false : _props$closable, zIndex = props3.zIndex, afterClose = props3.afterClose, visible = props3.visible, keyboard = props3.keyboard, centered = props3.centered, getContainer4 = props3.getContainer, maskStyle = props3.maskStyle, okButtonProps = props3.okButtonProps, cancelButtonProps = props3.cancelButtonProps, _props$okCancel = props3.okCancel, okCancel = _props$okCancel === void 0 ? true : _props$okCancel, _props$width = props3.width, width = _props$width === void 0 ? 416 : _props$width, _props$mask = props3.mask, mask = _props$mask === void 0 ? true : _props$mask, _props$maskClosable = props3.maskClosable, maskClosable = _props$maskClosable === void 0 ? false : _props$maskClosable, type = props3.type, title = props3.title, content = props3.content, direction = props3.direction, closeIcon = props3.closeIcon, modalRender = props3.modalRender, focusTriggerAfterClose = props3.focusTriggerAfterClose, rootPrefixCls = props3.rootPrefixCls, bodyStyle = props3.bodyStyle, wrapClassName = props3.wrapClassName;
var okType = props3.okType || "primary";
var prefixCls = props3.prefixCls || "ant-modal";
var contentPrefixCls = "".concat(prefixCls, "-confirm");
var style = attrs.style || {};
var okText = renderSomeContent(props3.okText) || (okCancel ? locale3.value.okText : locale3.value.justOkText);
var cancelText = renderSomeContent(props3.cancelText) || locale3.value.cancelText;
var autoFocusButton = props3.autoFocusButton === null ? false : props3.autoFocusButton || "ok";
var classString = classNames(contentPrefixCls, "".concat(contentPrefixCls, "-").concat(type), "".concat(prefixCls, "-").concat(type), _defineProperty$q({}, "".concat(contentPrefixCls, "-rtl"), direction === "rtl"), attrs.class);
var cancelButton = okCancel && createVNode(ActionButton, {
"actionFn": onCancel,
"close": close3,
"autofocus": autoFocusButton === "cancel",
"buttonProps": cancelButtonProps,
"prefixCls": "".concat(rootPrefixCls, "-btn")
}, {
default: function _default3() {
return [cancelText];
}
});
return createVNode(Modal, {
"prefixCls": prefixCls,
"class": classString,
"wrapClassName": classNames(_defineProperty$q({}, "".concat(contentPrefixCls, "-centered"), !!centered), wrapClassName),
"onCancel": function onCancel2(e2) {
return close3({
triggerCancel: true
}, e2);
},
"visible": visible,
"title": "",
"footer": "",
"transitionName": getTransitionName$1(rootPrefixCls, "zoom", props3.transitionName),
"maskTransitionName": getTransitionName$1(rootPrefixCls, "fade", props3.maskTransitionName),
"mask": mask,
"maskClosable": maskClosable,
"maskStyle": maskStyle,
"style": style,
"bodyStyle": bodyStyle,
"width": width,
"zIndex": zIndex,
"afterClose": afterClose,
"keyboard": keyboard,
"centered": centered,
"getContainer": getContainer4,
"closable": closable,
"closeIcon": closeIcon,
"modalRender": modalRender,
"focusTriggerAfterClose": focusTriggerAfterClose
}, {
default: function _default3() {
return [createVNode("div", {
"class": "".concat(contentPrefixCls, "-body-wrapper")
}, [createVNode("div", {
"class": "".concat(contentPrefixCls, "-body")
}, [renderSomeContent(icon), title === void 0 ? null : createVNode("span", {
"class": "".concat(contentPrefixCls, "-title")
}, [renderSomeContent(title)]), createVNode("div", {
"class": "".concat(contentPrefixCls, "-content")
}, [renderSomeContent(content)])]), createVNode("div", {
"class": "".concat(contentPrefixCls, "-btns")
}, [cancelButton, createVNode(ActionButton, {
"type": okType,
"actionFn": onOk,
"close": close3,
"autofocus": autoFocusButton === "ok",
"buttonProps": okButtonProps,
"prefixCls": "".concat(rootPrefixCls, "-btn")
}, {
default: function _default4() {
return [okText];
}
})])])];
}
});
};
}
});
var confirm = function confirm2(config) {
var container = document.createDocumentFragment();
var currentConfig = _objectSpread2$1(_objectSpread2$1({}, omit(config, ["parentContext", "appContext"])), {}, {
close: close3,
visible: true
});
var confirmDialogInstance = null;
function destroy3() {
if (confirmDialogInstance) {
render(null, container);
confirmDialogInstance.component.update();
confirmDialogInstance = null;
}
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var triggerCancel = args.some(function(param) {
return param && param.triggerCancel;
});
if (config.onCancel && triggerCancel) {
config.onCancel.apply(config, args);
}
for (var i2 = 0; i2 < destroyFns.length; i2++) {
var fn = destroyFns[i2];
if (fn === close3) {
destroyFns.splice(i2, 1);
break;
}
}
}
function close3() {
var _this = this;
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
currentConfig = _objectSpread2$1(_objectSpread2$1({}, currentConfig), {}, {
visible: false,
afterClose: function afterClose() {
if (typeof config.afterClose === "function") {
config.afterClose();
}
destroy3.apply(_this, args);
}
});
update(currentConfig);
}
function update(configUpdate) {
if (typeof configUpdate === "function") {
currentConfig = configUpdate(currentConfig);
} else {
currentConfig = _objectSpread2$1(_objectSpread2$1({}, currentConfig), configUpdate);
}
if (confirmDialogInstance) {
_extends(confirmDialogInstance.component.props, currentConfig);
confirmDialogInstance.component.update();
}
}
var Wrapper = function Wrapper2(p) {
var global2 = globalConfigForApi;
var rootPrefixCls = global2.prefixCls;
var prefixCls = p.prefixCls || "".concat(rootPrefixCls, "-modal");
return createVNode(ConfigProvider$1, _objectSpread2$1(_objectSpread2$1({}, global2), {}, {
"notUpdateGlobalConfig": true,
"prefixCls": rootPrefixCls
}), {
default: function _default3() {
return [createVNode(ConfirmDialog, _objectSpread2$1(_objectSpread2$1({}, p), {}, {
"rootPrefixCls": rootPrefixCls,
"prefixCls": prefixCls
}), null)];
}
});
};
function render$1(props3) {
var vm = createVNode(Wrapper, _objectSpread2$1({}, props3));
vm.appContext = config.parentContext || config.appContext || vm.appContext;
render(vm, container);
return vm;
}
confirmDialogInstance = render$1(currentConfig);
destroyFns.push(close3);
return {
destroy: close3,
update
};
};
const confirm$1 = confirm;
function withWarn(props3) {
return _objectSpread2$1(_objectSpread2$1({
icon: function icon() {
return createVNode(ExclamationCircleOutlined$1, null, null);
},
okCancel: false
}, props3), {}, {
type: "warning"
});
}
function withInfo(props3) {
return _objectSpread2$1(_objectSpread2$1({
icon: function icon() {
return createVNode(InfoCircleOutlined$1, null, null);
},
okCancel: false
}, props3), {}, {
type: "info"
});
}
function withSuccess(props3) {
return _objectSpread2$1(_objectSpread2$1({
icon: function icon() {
return createVNode(CheckCircleOutlined$1, null, null);
},
okCancel: false
}, props3), {}, {
type: "success"
});
}
function withError(props3) {
return _objectSpread2$1(_objectSpread2$1({
icon: function icon() {
return createVNode(CloseCircleOutlined$1, null, null);
},
okCancel: false
}, props3), {}, {
type: "error"
});
}
function withConfirm(props3) {
return _objectSpread2$1(_objectSpread2$1({
icon: function icon() {
return createVNode(ExclamationCircleOutlined$1, null, null);
},
okCancel: true
}, props3), {}, {
type: "confirm"
});
}
function modalWarn(props3) {
return confirm$1(withWarn(props3));
}
Modal.info = function infoFn(props3) {
return confirm$1(withInfo(props3));
};
Modal.success = function successFn(props3) {
return confirm$1(withSuccess(props3));
};
Modal.error = function errorFn(props3) {
return confirm$1(withError(props3));
};
Modal.warning = modalWarn;
Modal.warn = modalWarn;
Modal.confirm = function confirmFn(props3) {
return confirm$1(withConfirm(props3));
};
Modal.destroyAll = function destroyAllFn() {
while (destroyFns.length) {
var close3 = destroyFns.pop();
if (close3) {
close3();
}
}
};
Modal.install = function(app) {
app.component(Modal.name, Modal);
return app;
};
var spaceSize = {
small: 8,
middle: 16,
large: 24
};
var spaceProps = function spaceProps2() {
return {
prefixCls: String,
size: {
type: [String, Number, Array]
},
direction: PropTypes$1.oneOf(tuple$1("horizontal", "vertical")).def("horizontal"),
align: PropTypes$1.oneOf(tuple$1("start", "end", "center", "baseline")),
wrap: {
type: Boolean,
default: void 0
}
};
};
function getNumberSize(size) {
return typeof size === "string" ? spaceSize[size] : size || 0;
}
var Space = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASpace",
props: spaceProps(),
slots: ["split"],
setup: function setup98(props3, _ref) {
var slots = _ref.slots;
var _useConfigInject = useConfigInject("space", props3), prefixCls = _useConfigInject.prefixCls, space = _useConfigInject.space, directionConfig = _useConfigInject.direction;
var supportFlexGap = useFlexGapSupport();
var size = computed(function() {
var _ref2, _props$size, _space$value;
return (_ref2 = (_props$size = props3.size) !== null && _props$size !== void 0 ? _props$size : (_space$value = space.value) === null || _space$value === void 0 ? void 0 : _space$value.size) !== null && _ref2 !== void 0 ? _ref2 : "small";
});
var horizontalSize = ref();
var verticalSize = ref();
watch(size, function() {
var _map = (Array.isArray(size.value) ? size.value : [size.value, size.value]).map(function(item) {
return getNumberSize(item);
});
var _map2 = _slicedToArray$2(_map, 2);
horizontalSize.value = _map2[0];
verticalSize.value = _map2[1];
}, {
immediate: true
});
var mergedAlign = computed(function() {
return props3.align === void 0 && props3.direction === "horizontal" ? "center" : props3.align;
});
var cn = computed(function() {
var _classNames;
return classNames(prefixCls.value, "".concat(prefixCls.value, "-").concat(props3.direction), (_classNames = {}, _defineProperty$q(_classNames, "".concat(prefixCls.value, "-rtl"), directionConfig.value === "rtl"), _defineProperty$q(_classNames, "".concat(prefixCls.value, "-align-").concat(mergedAlign.value), mergedAlign.value), _classNames));
});
var marginDirection = computed(function() {
return directionConfig.value === "rtl" ? "marginLeft" : "marginRight";
});
var style = computed(function() {
var gapStyle = {};
if (supportFlexGap.value) {
gapStyle.columnGap = "".concat(horizontalSize.value, "px");
gapStyle.rowGap = "".concat(verticalSize.value, "px");
}
return _objectSpread2$1(_objectSpread2$1({}, gapStyle), props3.wrap && {
flexWrap: "wrap",
marginBottom: "".concat(-verticalSize.value, "px")
});
});
return function() {
var _slots$default, _slots$split;
var wrap = props3.wrap, _props$direction = props3.direction, direction = _props$direction === void 0 ? "horizontal" : _props$direction;
var children = (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
var items = filterEmpty(children);
var len = items.length;
if (len === 0) {
return null;
}
var split = (_slots$split = slots.split) === null || _slots$split === void 0 ? void 0 : _slots$split.call(slots);
var itemClassName = "".concat(prefixCls.value, "-item");
var horizontalSizeVal = horizontalSize.value;
var latestIndex = len - 1;
return createVNode("div", {
"class": cn.value,
"style": style.value
}, [items.map(function(child, index2) {
var originIndex = children.indexOf(child);
var itemStyle = {};
if (!supportFlexGap.value) {
if (direction === "vertical") {
if (index2 < latestIndex) {
itemStyle = {
marginBottom: "".concat(horizontalSizeVal / (split ? 2 : 1), "px")
};
}
} else {
itemStyle = _objectSpread2$1(_objectSpread2$1({}, index2 < latestIndex && _defineProperty$q({}, marginDirection.value, "".concat(horizontalSizeVal / (split ? 2 : 1), "px"))), wrap && {
paddingBottom: "".concat(verticalSize.value, "px")
});
}
}
return createVNode(Fragment, {
"key": originIndex
}, [createVNode("div", {
"class": itemClassName,
"style": itemStyle
}, [child]), index2 < latestIndex && split && createVNode("span", {
"class": "".concat(itemClassName, "-split"),
"style": itemStyle
}, [split])]);
})]);
};
}
});
const __unplugin_components_2 = withInstall(Space);
/*!
* shared v9.8.0
* (c) 2023 kazuya kawaguchi
* Released under the MIT License.
*/
const inBrowser = typeof window !== "undefined";
let mark;
let measure;
if (process.env.NODE_ENV !== "production") {
const perf2 = inBrowser && window.performance;
if (perf2 && perf2.mark && perf2.measure && perf2.clearMarks && // @ts-ignore browser compat
perf2.clearMeasures) {
mark = (tag) => {
perf2.mark(tag);
};
measure = (name, startTag, endTag) => {
perf2.measure(name, startTag, endTag);
perf2.clearMarks(startTag);
perf2.clearMarks(endTag);
};
}
}
const RE_ARGS$1 = /\{([0-9a-zA-Z]+)\}/g;
function format$2(message2, ...args) {
if (args.length === 1 && isObject$1(args[0])) {
args = args[0];
}
if (!args || !args.hasOwnProperty) {
args = {};
}
return message2.replace(RE_ARGS$1, (match2, identifier) => {
return args.hasOwnProperty(identifier) ? args[identifier] : "";
});
}
const makeSymbol = (name, shareable = false) => !shareable ? Symbol(name) : Symbol.for(name);
const generateFormatCacheKey = (locale3, key2, source) => friendlyJSONstringify({ l: locale3, k: key2, s: source });
const friendlyJSONstringify = (json) => JSON.stringify(json).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/\u0027/g, "\\u0027");
const isNumber$1 = (val) => typeof val === "number" && isFinite(val);
const isDate$1 = (val) => toTypeString(val) === "[object Date]";
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
const isEmptyObject = (val) => isPlainObject(val) && Object.keys(val).length === 0;
const assign$1 = Object.assign;
let _globalThis;
const getGlobalThis = () => {
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
};
function escapeHtml(rawText) {
return rawText.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
}
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
function hasOwn2(obj, key2) {
return hasOwnProperty$1.call(obj, key2);
}
const isArray = Array.isArray;
const isFunction2 = (val) => typeof val === "function";
const isString$2 = (val) => typeof val === "string";
const isBoolean = (val) => typeof val === "boolean";
const isObject$1 = (val) => val !== null && typeof val === "object";
const isPromise = (val) => {
return isObject$1(val) && isFunction2(val.then) && isFunction2(val.catch);
};
const objectToString = Object.prototype.toString;
const toTypeString = (value2) => objectToString.call(value2);
const isPlainObject = (val) => {
if (!isObject$1(val))
return false;
const proto = Object.getPrototypeOf(val);
return proto === null || proto.constructor === Object;
};
const toDisplayString = (val) => {
return val == null ? "" : isArray(val) || isPlainObject(val) && val.toString === objectToString ? JSON.stringify(val, null, 2) : String(val);
};
function join$1(items, separator = "") {
return items.reduce((str, item, index2) => index2 === 0 ? str + item : str + separator + item, "");
}
const RANGE = 2;
function generateCodeFrame(source, start = 0, end = source.length) {
const lines = source.split(/\r?\n/);
let count = 0;
const res = [];
for (let i2 = 0; i2 < lines.length; i2++) {
count += lines[i2].length + 1;
if (count >= start) {
for (let j2 = i2 - RANGE; j2 <= i2 + RANGE || end > count; j2++) {
if (j2 < 0 || j2 >= lines.length)
continue;
const line = j2 + 1;
res.push(`${line}${" ".repeat(3 - String(line).length)}| ${lines[j2]}`);
const lineLength = lines[j2].length;
if (j2 === i2) {
const pad3 = start - (count - lineLength) + 1;
const length = Math.max(1, end > count ? lineLength - pad3 : end - start);
res.push(` | ` + " ".repeat(pad3) + "^".repeat(length));
} else if (j2 > i2) {
if (end > count) {
const length = Math.max(Math.min(end - count, lineLength), 1);
res.push(` | ` + "^".repeat(length));
}
count += lineLength + 1;
}
}
break;
}
}
return res.join("\n");
}
function incrementer(code2) {
let current = code2;
return () => ++current;
}
function warn(msg, err) {
if (typeof console !== "undefined") {
console.warn(`[intlify] ` + msg);
if (err) {
console.warn(err.stack);
}
}
}
const hasWarned = {};
function warnOnce(msg) {
if (!hasWarned[msg]) {
hasWarned[msg] = true;
warn(msg);
}
}
function createEmitter() {
const events = /* @__PURE__ */ new Map();
const emitter = {
events,
on(event, handler2) {
const handlers = events.get(event);
const added = handlers && handlers.push(handler2);
if (!added) {
events.set(event, [handler2]);
}
},
off(event, handler2) {
const handlers = events.get(event);
if (handlers) {
handlers.splice(handlers.indexOf(handler2) >>> 0, 1);
}
},
emit(event, payload) {
(events.get(event) || []).slice().map((handler2) => handler2(payload));
(events.get("*") || []).slice().map((handler2) => handler2(event, payload));
}
};
return emitter;
}
const isNotObjectOrIsArray = (val) => !isObject$1(val) || isArray(val);
function deepCopy(src2, des) {
if (isNotObjectOrIsArray(src2) || isNotObjectOrIsArray(des)) {
throw new Error("Invalid value");
}
for (const key2 in src2) {
if (hasOwn2(src2, key2)) {
if (isNotObjectOrIsArray(src2[key2]) || isNotObjectOrIsArray(des[key2])) {
des[key2] = src2[key2];
} else {
deepCopy(src2[key2], des[key2]);
}
}
}
}
/*!
* message-compiler v9.8.0
* (c) 2023 kazuya kawaguchi
* Released under the MIT License.
*/
function createPosition(line, column, offset3) {
return { line, column, offset: offset3 };
}
function createLocation(start, end, source) {
const loc = { start, end };
if (source != null) {
loc.source = source;
}
return loc;
}
const RE_ARGS = /\{([0-9a-zA-Z]+)\}/g;
function format$1(message2, ...args) {
if (args.length === 1 && isObject2(args[0])) {
args = args[0];
}
if (!args || !args.hasOwnProperty) {
args = {};
}
return message2.replace(RE_ARGS, (match2, identifier) => {
return args.hasOwnProperty(identifier) ? args[identifier] : "";
});
}
const assign = Object.assign;
const isString$1 = (val) => typeof val === "string";
const isObject2 = (val) => val !== null && typeof val === "object";
function join(items, separator = "") {
return items.reduce((str, item, index2) => index2 === 0 ? str + item : str + separator + item, "");
}
const CompileErrorCodes = {
// tokenizer error codes
EXPECTED_TOKEN: 1,
INVALID_TOKEN_IN_PLACEHOLDER: 2,
UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER: 3,
UNKNOWN_ESCAPE_SEQUENCE: 4,
INVALID_UNICODE_ESCAPE_SEQUENCE: 5,
UNBALANCED_CLOSING_BRACE: 6,
UNTERMINATED_CLOSING_BRACE: 7,
EMPTY_PLACEHOLDER: 8,
NOT_ALLOW_NEST_PLACEHOLDER: 9,
INVALID_LINKED_FORMAT: 10,
// parser error codes
MUST_HAVE_MESSAGES_IN_PLURAL: 11,
UNEXPECTED_EMPTY_LINKED_MODIFIER: 12,
UNEXPECTED_EMPTY_LINKED_KEY: 13,
UNEXPECTED_LEXICAL_ANALYSIS: 14,
// generator error codes
UNHANDLED_CODEGEN_NODE_TYPE: 15,
// minifier error codes
UNHANDLED_MINIFIER_NODE_TYPE: 16,
// Special value for higher-order compilers to pick up the last code
// to avoid collision of error codes. This should always be kept as the last
// item.
__EXTEND_POINT__: 17
};
const errorMessages$2 = {
// tokenizer error messages
[CompileErrorCodes.EXPECTED_TOKEN]: `Expected token: '{0}'`,
[CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER]: `Invalid token in placeholder: '{0}'`,
[CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]: `Unterminated single quote in placeholder`,
[CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE]: `Unknown escape sequence: \\{0}`,
[CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE]: `Invalid unicode escape sequence: {0}`,
[CompileErrorCodes.UNBALANCED_CLOSING_BRACE]: `Unbalanced closing brace`,
[CompileErrorCodes.UNTERMINATED_CLOSING_BRACE]: `Unterminated closing brace`,
[CompileErrorCodes.EMPTY_PLACEHOLDER]: `Empty placeholder`,
[CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER]: `Not allowed nest placeholder`,
[CompileErrorCodes.INVALID_LINKED_FORMAT]: `Invalid linked format`,
// parser error messages
[CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL]: `Plural must have messages`,
[CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER]: `Unexpected empty linked modifier`,
[CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY]: `Unexpected empty linked key`,
[CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS]: `Unexpected lexical analysis in token: '{0}'`,
// generator error messages
[CompileErrorCodes.UNHANDLED_CODEGEN_NODE_TYPE]: `unhandled codegen node type: '{0}'`,
// minimizer error messages
[CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE]: `unhandled mimifier node type: '{0}'`
};
function createCompileError(code2, loc, options = {}) {
const { domain, messages: messages2, args } = options;
const msg = format$1((messages2 || errorMessages$2)[code2] || "", ...args || []);
const error = new SyntaxError(String(msg));
error.code = code2;
if (loc) {
error.location = loc;
}
error.domain = domain;
return error;
}
function defaultOnError(error) {
throw error;
}
const RE_HTML_TAG = /<\/?[\w\s="/.':;#-\/]+>/;
const detectHtmlTag = (source) => RE_HTML_TAG.test(source);
const CHAR_SP = " ";
const CHAR_CR = "\r";
const CHAR_LF = "\n";
const CHAR_LS = String.fromCharCode(8232);
const CHAR_PS = String.fromCharCode(8233);
function createScanner(str) {
const _buf = str;
let _index = 0;
let _line = 1;
let _column = 1;
let _peekOffset = 0;
const isCRLF = (index3) => _buf[index3] === CHAR_CR && _buf[index3 + 1] === CHAR_LF;
const isLF = (index3) => _buf[index3] === CHAR_LF;
const isPS = (index3) => _buf[index3] === CHAR_PS;
const isLS = (index3) => _buf[index3] === CHAR_LS;
const isLineEnd = (index3) => isCRLF(index3) || isLF(index3) || isPS(index3) || isLS(index3);
const index2 = () => _index;
const line = () => _line;
const column = () => _column;
const peekOffset = () => _peekOffset;
const charAt = (offset3) => isCRLF(offset3) || isPS(offset3) || isLS(offset3) ? CHAR_LF : _buf[offset3];
const currentChar = () => charAt(_index);
const currentPeek = () => charAt(_index + _peekOffset);
function next2() {
_peekOffset = 0;
if (isLineEnd(_index)) {
_line++;
_column = 0;
}
if (isCRLF(_index)) {
_index++;
}
_index++;
_column++;
return _buf[_index];
}
function peek() {
if (isCRLF(_index + _peekOffset)) {
_peekOffset++;
}
_peekOffset++;
return _buf[_index + _peekOffset];
}
function reset2() {
_index = 0;
_line = 1;
_column = 1;
_peekOffset = 0;
}
function resetPeek(offset3 = 0) {
_peekOffset = offset3;
}
function skipToPeek() {
const target = _index + _peekOffset;
while (target !== _index) {
next2();
}
_peekOffset = 0;
}
return {
index: index2,
line,
column,
peekOffset,
charAt,
currentChar,
currentPeek,
next: next2,
peek,
reset: reset2,
resetPeek,
skipToPeek
};
}
const EOF = void 0;
const DOT = ".";
const LITERAL_DELIMITER = "'";
const ERROR_DOMAIN$3 = "tokenizer";
function createTokenizer(source, options = {}) {
const location = options.location !== false;
const _scnr = createScanner(source);
const currentOffset = () => _scnr.index();
const currentPosition = () => createPosition(_scnr.line(), _scnr.column(), _scnr.index());
const _initLoc = currentPosition();
const _initOffset = currentOffset();
const _context = {
currentType: 14,
offset: _initOffset,
startLoc: _initLoc,
endLoc: _initLoc,
lastType: 14,
lastOffset: _initOffset,
lastStartLoc: _initLoc,
lastEndLoc: _initLoc,
braceNest: 0,
inLinked: false,
text: ""
};
const context = () => _context;
const { onError } = options;
function emitError(code2, pos, offset3, ...args) {
const ctx = context();
pos.column += offset3;
pos.offset += offset3;
if (onError) {
const loc = location ? createLocation(ctx.startLoc, pos) : null;
const err = createCompileError(code2, loc, {
domain: ERROR_DOMAIN$3,
args
});
onError(err);
}
}
function getToken(context2, type, value2) {
context2.endLoc = currentPosition();
context2.currentType = type;
const token2 = { type };
if (location) {
token2.loc = createLocation(context2.startLoc, context2.endLoc);
}
if (value2 != null) {
token2.value = value2;
}
return token2;
}
const getEndToken = (context2) => getToken(
context2,
14
/* TokenTypes.EOF */
);
function eat(scnr, ch) {
if (scnr.currentChar() === ch) {
scnr.next();
return ch;
} else {
emitError(CompileErrorCodes.EXPECTED_TOKEN, currentPosition(), 0, ch);
return "";
}
}
function peekSpaces(scnr) {
let buf = "";
while (scnr.currentPeek() === CHAR_SP || scnr.currentPeek() === CHAR_LF) {
buf += scnr.currentPeek();
scnr.peek();
}
return buf;
}
function skipSpaces(scnr) {
const buf = peekSpaces(scnr);
scnr.skipToPeek();
return buf;
}
function isIdentifierStart(ch) {
if (ch === EOF) {
return false;
}
const cc = ch.charCodeAt(0);
return cc >= 97 && cc <= 122 || // a-z
cc >= 65 && cc <= 90 || // A-Z
cc === 95;
}
function isNumberStart(ch) {
if (ch === EOF) {
return false;
}
const cc = ch.charCodeAt(0);
return cc >= 48 && cc <= 57;
}
function isNamedIdentifierStart(scnr, context2) {
const { currentType } = context2;
if (currentType !== 2) {
return false;
}
peekSpaces(scnr);
const ret = isIdentifierStart(scnr.currentPeek());
scnr.resetPeek();
return ret;
}
function isListIdentifierStart(scnr, context2) {
const { currentType } = context2;
if (currentType !== 2) {
return false;
}
peekSpaces(scnr);
const ch = scnr.currentPeek() === "-" ? scnr.peek() : scnr.currentPeek();
const ret = isNumberStart(ch);
scnr.resetPeek();
return ret;
}
function isLiteralStart(scnr, context2) {
const { currentType } = context2;
if (currentType !== 2) {
return false;
}
peekSpaces(scnr);
const ret = scnr.currentPeek() === LITERAL_DELIMITER;
scnr.resetPeek();
return ret;
}
function isLinkedDotStart(scnr, context2) {
const { currentType } = context2;
if (currentType !== 8) {
return false;
}
peekSpaces(scnr);
const ret = scnr.currentPeek() === ".";
scnr.resetPeek();
return ret;
}
function isLinkedModifierStart(scnr, context2) {
const { currentType } = context2;
if (currentType !== 9) {
return false;
}
peekSpaces(scnr);
const ret = isIdentifierStart(scnr.currentPeek());
scnr.resetPeek();
return ret;
}
function isLinkedDelimiterStart(scnr, context2) {
const { currentType } = context2;
if (!(currentType === 8 || currentType === 12)) {
return false;
}
peekSpaces(scnr);
const ret = scnr.currentPeek() === ":";
scnr.resetPeek();
return ret;
}
function isLinkedReferStart(scnr, context2) {
const { currentType } = context2;
if (currentType !== 10) {
return false;
}
const fn = () => {
const ch = scnr.currentPeek();
if (ch === "{") {
return isIdentifierStart(scnr.peek());
} else if (ch === "@" || ch === "%" || ch === "|" || ch === ":" || ch === "." || ch === CHAR_SP || !ch) {
return false;
} else if (ch === CHAR_LF) {
scnr.peek();
return fn();
} else {
return isIdentifierStart(ch);
}
};
const ret = fn();
scnr.resetPeek();
return ret;
}
function isPluralStart(scnr) {
peekSpaces(scnr);
const ret = scnr.currentPeek() === "|";
scnr.resetPeek();
return ret;
}
function detectModuloStart(scnr) {
const spaces = peekSpaces(scnr);
const ret = scnr.currentPeek() === "%" && scnr.peek() === "{";
scnr.resetPeek();
return {
isModulo: ret,
hasSpace: spaces.length > 0
};
}
function isTextStart(scnr, reset2 = true) {
const fn = (hasSpace = false, prev2 = "", detectModulo = false) => {
const ch = scnr.currentPeek();
if (ch === "{") {
return prev2 === "%" ? false : hasSpace;
} else if (ch === "@" || !ch) {
return prev2 === "%" ? true : hasSpace;
} else if (ch === "%") {
scnr.peek();
return fn(hasSpace, "%", true);
} else if (ch === "|") {
return prev2 === "%" || detectModulo ? true : !(prev2 === CHAR_SP || prev2 === CHAR_LF);
} else if (ch === CHAR_SP) {
scnr.peek();
return fn(true, CHAR_SP, detectModulo);
} else if (ch === CHAR_LF) {
scnr.peek();
return fn(true, CHAR_LF, detectModulo);
} else {
return true;
}
};
const ret = fn();
reset2 && scnr.resetPeek();
return ret;
}
function takeChar(scnr, fn) {
const ch = scnr.currentChar();
if (ch === EOF) {
return EOF;
}
if (fn(ch)) {
scnr.next();
return ch;
}
return null;
}
function takeIdentifierChar(scnr) {
const closure = (ch) => {
const cc = ch.charCodeAt(0);
return cc >= 97 && cc <= 122 || // a-z
cc >= 65 && cc <= 90 || // A-Z
cc >= 48 && cc <= 57 || // 0-9
cc === 95 || // _
cc === 36;
};
return takeChar(scnr, closure);
}
function takeDigit(scnr) {
const closure = (ch) => {
const cc = ch.charCodeAt(0);
return cc >= 48 && cc <= 57;
};
return takeChar(scnr, closure);
}
function takeHexDigit(scnr) {
const closure = (ch) => {
const cc = ch.charCodeAt(0);
return cc >= 48 && cc <= 57 || // 0-9
cc >= 65 && cc <= 70 || // A-F
cc >= 97 && cc <= 102;
};
return takeChar(scnr, closure);
}
function getDigits(scnr) {
let ch = "";
let num = "";
while (ch = takeDigit(scnr)) {
num += ch;
}
return num;
}
function readModulo(scnr) {
skipSpaces(scnr);
const ch = scnr.currentChar();
if (ch !== "%") {
emitError(CompileErrorCodes.EXPECTED_TOKEN, currentPosition(), 0, ch);
}
scnr.next();
return "%";
}
function readText(scnr) {
let buf = "";
while (true) {
const ch = scnr.currentChar();
if (ch === "{" || ch === "}" || ch === "@" || ch === "|" || !ch) {
break;
} else if (ch === "%") {
if (isTextStart(scnr)) {
buf += ch;
scnr.next();
} else {
break;
}
} else if (ch === CHAR_SP || ch === CHAR_LF) {
if (isTextStart(scnr)) {
buf += ch;
scnr.next();
} else if (isPluralStart(scnr)) {
break;
} else {
buf += ch;
scnr.next();
}
} else {
buf += ch;
scnr.next();
}
}
return buf;
}
function readNamedIdentifier(scnr) {
skipSpaces(scnr);
let ch = "";
let name = "";
while (ch = takeIdentifierChar(scnr)) {
name += ch;
}
if (scnr.currentChar() === EOF) {
emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);
}
return name;
}
function readListIdentifier(scnr) {
skipSpaces(scnr);
let value2 = "";
if (scnr.currentChar() === "-") {
scnr.next();
value2 += `-${getDigits(scnr)}`;
} else {
value2 += getDigits(scnr);
}
if (scnr.currentChar() === EOF) {
emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);
}
return value2;
}
function readLiteral(scnr) {
skipSpaces(scnr);
eat(scnr, `'`);
let ch = "";
let literal = "";
const fn = (x2) => x2 !== LITERAL_DELIMITER && x2 !== CHAR_LF;
while (ch = takeChar(scnr, fn)) {
if (ch === "\\") {
literal += readEscapeSequence(scnr);
} else {
literal += ch;
}
}
const current = scnr.currentChar();
if (current === CHAR_LF || current === EOF) {
emitError(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER, currentPosition(), 0);
if (current === CHAR_LF) {
scnr.next();
eat(scnr, `'`);
}
return literal;
}
eat(scnr, `'`);
return literal;
}
function readEscapeSequence(scnr) {
const ch = scnr.currentChar();
switch (ch) {
case "\\":
case `'`:
scnr.next();
return `\\${ch}`;
case "u":
return readUnicodeEscapeSequence(scnr, ch, 4);
case "U":
return readUnicodeEscapeSequence(scnr, ch, 6);
default:
emitError(CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE, currentPosition(), 0, ch);
return "";
}
}
function readUnicodeEscapeSequence(scnr, unicode, digits) {
eat(scnr, unicode);
let sequence = "";
for (let i2 = 0; i2 < digits; i2++) {
const ch = takeHexDigit(scnr);
if (!ch) {
emitError(CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE, currentPosition(), 0, `\\${unicode}${sequence}${scnr.currentChar()}`);
break;
}
sequence += ch;
}
return `\\${unicode}${sequence}`;
}
function readInvalidIdentifier(scnr) {
skipSpaces(scnr);
let ch = "";
let identifiers = "";
const closure = (ch2) => ch2 !== "{" && ch2 !== "}" && ch2 !== CHAR_SP && ch2 !== CHAR_LF;
while (ch = takeChar(scnr, closure)) {
identifiers += ch;
}
return identifiers;
}
function readLinkedModifier(scnr) {
let ch = "";
let name = "";
while (ch = takeIdentifierChar(scnr)) {
name += ch;
}
return name;
}
function readLinkedRefer(scnr) {
const fn = (detect = false, buf) => {
const ch = scnr.currentChar();
if (ch === "{" || ch === "%" || ch === "@" || ch === "|" || ch === "(" || ch === ")" || !ch) {
return buf;
} else if (ch === CHAR_SP) {
return buf;
} else if (ch === CHAR_LF || ch === DOT) {
buf += ch;
scnr.next();
return fn(detect, buf);
} else {
buf += ch;
scnr.next();
return fn(true, buf);
}
};
return fn(false, "");
}
function readPlural(scnr) {
skipSpaces(scnr);
const plural = eat(
scnr,
"|"
/* TokenChars.Pipe */
);
skipSpaces(scnr);
return plural;
}
function readTokenInPlaceholder(scnr, context2) {
let token2 = null;
const ch = scnr.currentChar();
switch (ch) {
case "{":
if (context2.braceNest >= 1) {
emitError(CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER, currentPosition(), 0);
}
scnr.next();
token2 = getToken(
context2,
2,
"{"
/* TokenChars.BraceLeft */
);
skipSpaces(scnr);
context2.braceNest++;
return token2;
case "}":
if (context2.braceNest > 0 && context2.currentType === 2) {
emitError(CompileErrorCodes.EMPTY_PLACEHOLDER, currentPosition(), 0);
}
scnr.next();
token2 = getToken(
context2,
3,
"}"
/* TokenChars.BraceRight */
);
context2.braceNest--;
context2.braceNest > 0 && skipSpaces(scnr);
if (context2.inLinked && context2.braceNest === 0) {
context2.inLinked = false;
}
return token2;
case "@":
if (context2.braceNest > 0) {
emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);
}
token2 = readTokenInLinked(scnr, context2) || getEndToken(context2);
context2.braceNest = 0;
return token2;
default:
let validNamedIdentifier = true;
let validListIdentifier = true;
let validLiteral = true;
if (isPluralStart(scnr)) {
if (context2.braceNest > 0) {
emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);
}
token2 = getToken(context2, 1, readPlural(scnr));
context2.braceNest = 0;
context2.inLinked = false;
return token2;
}
if (context2.braceNest > 0 && (context2.currentType === 5 || context2.currentType === 6 || context2.currentType === 7)) {
emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);
context2.braceNest = 0;
return readToken(scnr, context2);
}
if (validNamedIdentifier = isNamedIdentifierStart(scnr, context2)) {
token2 = getToken(context2, 5, readNamedIdentifier(scnr));
skipSpaces(scnr);
return token2;
}
if (validListIdentifier = isListIdentifierStart(scnr, context2)) {
token2 = getToken(context2, 6, readListIdentifier(scnr));
skipSpaces(scnr);
return token2;
}
if (validLiteral = isLiteralStart(scnr, context2)) {
token2 = getToken(context2, 7, readLiteral(scnr));
skipSpaces(scnr);
return token2;
}
if (!validNamedIdentifier && !validListIdentifier && !validLiteral) {
token2 = getToken(context2, 13, readInvalidIdentifier(scnr));
emitError(CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER, currentPosition(), 0, token2.value);
skipSpaces(scnr);
return token2;
}
break;
}
return token2;
}
function readTokenInLinked(scnr, context2) {
const { currentType } = context2;
let token2 = null;
const ch = scnr.currentChar();
if ((currentType === 8 || currentType === 9 || currentType === 12 || currentType === 10) && (ch === CHAR_LF || ch === CHAR_SP)) {
emitError(CompileErrorCodes.INVALID_LINKED_FORMAT, currentPosition(), 0);
}
switch (ch) {
case "@":
scnr.next();
token2 = getToken(
context2,
8,
"@"
/* TokenChars.LinkedAlias */
);
context2.inLinked = true;
return token2;
case ".":
skipSpaces(scnr);
scnr.next();
return getToken(
context2,
9,
"."
/* TokenChars.LinkedDot */
);
case ":":
skipSpaces(scnr);
scnr.next();
return getToken(
context2,
10,
":"
/* TokenChars.LinkedDelimiter */
);
default:
if (isPluralStart(scnr)) {
token2 = getToken(context2, 1, readPlural(scnr));
context2.braceNest = 0;
context2.inLinked = false;
return token2;
}
if (isLinkedDotStart(scnr, context2) || isLinkedDelimiterStart(scnr, context2)) {
skipSpaces(scnr);
return readTokenInLinked(scnr, context2);
}
if (isLinkedModifierStart(scnr, context2)) {
skipSpaces(scnr);
return getToken(context2, 12, readLinkedModifier(scnr));
}
if (isLinkedReferStart(scnr, context2)) {
skipSpaces(scnr);
if (ch === "{") {
return readTokenInPlaceholder(scnr, context2) || token2;
} else {
return getToken(context2, 11, readLinkedRefer(scnr));
}
}
if (currentType === 8) {
emitError(CompileErrorCodes.INVALID_LINKED_FORMAT, currentPosition(), 0);
}
context2.braceNest = 0;
context2.inLinked = false;
return readToken(scnr, context2);
}
}
function readToken(scnr, context2) {
let token2 = {
type: 14
/* TokenTypes.EOF */
};
if (context2.braceNest > 0) {
return readTokenInPlaceholder(scnr, context2) || getEndToken(context2);
}
if (context2.inLinked) {
return readTokenInLinked(scnr, context2) || getEndToken(context2);
}
const ch = scnr.currentChar();
switch (ch) {
case "{":
return readTokenInPlaceholder(scnr, context2) || getEndToken(context2);
case "}":
emitError(CompileErrorCodes.UNBALANCED_CLOSING_BRACE, currentPosition(), 0);
scnr.next();
return getToken(
context2,
3,
"}"
/* TokenChars.BraceRight */
);
case "@":
return readTokenInLinked(scnr, context2) || getEndToken(context2);
default:
if (isPluralStart(scnr)) {
token2 = getToken(context2, 1, readPlural(scnr));
context2.braceNest = 0;
context2.inLinked = false;
return token2;
}
const { isModulo, hasSpace } = detectModuloStart(scnr);
if (isModulo) {
return hasSpace ? getToken(context2, 0, readText(scnr)) : getToken(context2, 4, readModulo(scnr));
}
if (isTextStart(scnr)) {
return getToken(context2, 0, readText(scnr));
}
break;
}
return token2;
}
function nextToken() {
const { currentType, offset: offset3, startLoc, endLoc } = _context;
_context.lastType = currentType;
_context.lastOffset = offset3;
_context.lastStartLoc = startLoc;
_context.lastEndLoc = endLoc;
_context.offset = currentOffset();
_context.startLoc = currentPosition();
if (_scnr.currentChar() === EOF) {
return getToken(
_context,
14
/* TokenTypes.EOF */
);
}
return readToken(_scnr, _context);
}
return {
nextToken,
currentOffset,
currentPosition,
context
};
}
const ERROR_DOMAIN$2 = "parser";
const KNOWN_ESCAPES = /(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;
function fromEscapeSequence(match2, codePoint4, codePoint6) {
switch (match2) {
case `\\\\`:
return `\\`;
case `\\'`:
return `'`;
default: {
const codePoint = parseInt(codePoint4 || codePoint6, 16);
if (codePoint <= 55295 || codePoint >= 57344) {
return String.fromCodePoint(codePoint);
}
return "�";
}
}
}
function createParser(options = {}) {
const location = options.location !== false;
const { onError } = options;
function emitError(tokenzer, code2, start, offset3, ...args) {
const end = tokenzer.currentPosition();
end.offset += offset3;
end.column += offset3;
if (onError) {
const loc = location ? createLocation(start, end) : null;
const err = createCompileError(code2, loc, {
domain: ERROR_DOMAIN$2,
args
});
onError(err);
}
}
function startNode(type, offset3, loc) {
const node = { type };
if (location) {
node.start = offset3;
node.end = offset3;
node.loc = { start: loc, end: loc };
}
return node;
}
function endNode(node, offset3, pos, type) {
if (type) {
node.type = type;
}
if (location) {
node.end = offset3;
if (node.loc) {
node.loc.end = pos;
}
}
}
function parseText(tokenizer, value2) {
const context = tokenizer.context();
const node = startNode(3, context.offset, context.startLoc);
node.value = value2;
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
return node;
}
function parseList(tokenizer, index2) {
const context = tokenizer.context();
const { lastOffset: offset3, lastStartLoc: loc } = context;
const node = startNode(5, offset3, loc);
node.index = parseInt(index2, 10);
tokenizer.nextToken();
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
return node;
}
function parseNamed(tokenizer, key2) {
const context = tokenizer.context();
const { lastOffset: offset3, lastStartLoc: loc } = context;
const node = startNode(4, offset3, loc);
node.key = key2;
tokenizer.nextToken();
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
return node;
}
function parseLiteral(tokenizer, value2) {
const context = tokenizer.context();
const { lastOffset: offset3, lastStartLoc: loc } = context;
const node = startNode(9, offset3, loc);
node.value = value2.replace(KNOWN_ESCAPES, fromEscapeSequence);
tokenizer.nextToken();
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
return node;
}
function parseLinkedModifier(tokenizer) {
const token2 = tokenizer.nextToken();
const context = tokenizer.context();
const { lastOffset: offset3, lastStartLoc: loc } = context;
const node = startNode(8, offset3, loc);
if (token2.type !== 12) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER, context.lastStartLoc, 0);
node.value = "";
endNode(node, offset3, loc);
return {
nextConsumeToken: token2,
node
};
}
if (token2.value == null) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token2));
}
node.value = token2.value || "";
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
return {
node
};
}
function parseLinkedKey(tokenizer, value2) {
const context = tokenizer.context();
const node = startNode(7, context.offset, context.startLoc);
node.value = value2;
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
return node;
}
function parseLinked(tokenizer) {
const context = tokenizer.context();
const linkedNode = startNode(6, context.offset, context.startLoc);
let token2 = tokenizer.nextToken();
if (token2.type === 9) {
const parsed = parseLinkedModifier(tokenizer);
linkedNode.modifier = parsed.node;
token2 = parsed.nextConsumeToken || tokenizer.nextToken();
}
if (token2.type !== 10) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token2));
}
token2 = tokenizer.nextToken();
if (token2.type === 2) {
token2 = tokenizer.nextToken();
}
switch (token2.type) {
case 11:
if (token2.value == null) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token2));
}
linkedNode.key = parseLinkedKey(tokenizer, token2.value || "");
break;
case 5:
if (token2.value == null) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token2));
}
linkedNode.key = parseNamed(tokenizer, token2.value || "");
break;
case 6:
if (token2.value == null) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token2));
}
linkedNode.key = parseList(tokenizer, token2.value || "");
break;
case 7:
if (token2.value == null) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token2));
}
linkedNode.key = parseLiteral(tokenizer, token2.value || "");
break;
default:
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY, context.lastStartLoc, 0);
const nextContext = tokenizer.context();
const emptyLinkedKeyNode = startNode(7, nextContext.offset, nextContext.startLoc);
emptyLinkedKeyNode.value = "";
endNode(emptyLinkedKeyNode, nextContext.offset, nextContext.startLoc);
linkedNode.key = emptyLinkedKeyNode;
endNode(linkedNode, nextContext.offset, nextContext.startLoc);
return {
nextConsumeToken: token2,
node: linkedNode
};
}
endNode(linkedNode, tokenizer.currentOffset(), tokenizer.currentPosition());
return {
node: linkedNode
};
}
function parseMessage(tokenizer) {
const context = tokenizer.context();
const startOffset = context.currentType === 1 ? tokenizer.currentOffset() : context.offset;
const startLoc = context.currentType === 1 ? context.endLoc : context.startLoc;
const node = startNode(2, startOffset, startLoc);
node.items = [];
let nextToken = null;
do {
const token2 = nextToken || tokenizer.nextToken();
nextToken = null;
switch (token2.type) {
case 0:
if (token2.value == null) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token2));
}
node.items.push(parseText(tokenizer, token2.value || ""));
break;
case 6:
if (token2.value == null) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token2));
}
node.items.push(parseList(tokenizer, token2.value || ""));
break;
case 5:
if (token2.value == null) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token2));
}
node.items.push(parseNamed(tokenizer, token2.value || ""));
break;
case 7:
if (token2.value == null) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token2));
}
node.items.push(parseLiteral(tokenizer, token2.value || ""));
break;
case 8:
const parsed = parseLinked(tokenizer);
node.items.push(parsed.node);
nextToken = parsed.nextConsumeToken || null;
break;
}
} while (context.currentType !== 14 && context.currentType !== 1);
const endOffset = context.currentType === 1 ? context.lastOffset : tokenizer.currentOffset();
const endLoc = context.currentType === 1 ? context.lastEndLoc : tokenizer.currentPosition();
endNode(node, endOffset, endLoc);
return node;
}
function parsePlural(tokenizer, offset3, loc, msgNode) {
const context = tokenizer.context();
let hasEmptyMessage = msgNode.items.length === 0;
const node = startNode(1, offset3, loc);
node.cases = [];
node.cases.push(msgNode);
do {
const msg = parseMessage(tokenizer);
if (!hasEmptyMessage) {
hasEmptyMessage = msg.items.length === 0;
}
node.cases.push(msg);
} while (context.currentType !== 14);
if (hasEmptyMessage) {
emitError(tokenizer, CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL, loc, 0);
}
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
return node;
}
function parseResource(tokenizer) {
const context = tokenizer.context();
const { offset: offset3, startLoc } = context;
const msgNode = parseMessage(tokenizer);
if (context.currentType === 14) {
return msgNode;
} else {
return parsePlural(tokenizer, offset3, startLoc, msgNode);
}
}
function parse4(source) {
const tokenizer = createTokenizer(source, assign({}, options));
const context = tokenizer.context();
const node = startNode(0, context.offset, context.startLoc);
if (location && node.loc) {
node.loc.source = source;
}
node.body = parseResource(tokenizer);
if (options.onCacheKey) {
node.cacheKey = options.onCacheKey(source);
}
if (context.currentType !== 14) {
emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, source[context.offset] || "");
}
endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());
return node;
}
return { parse: parse4 };
}
function getTokenCaption(token2) {
if (token2.type === 14) {
return "EOF";
}
const name = (token2.value || "").replace(/\r?\n/gu, "\\n");
return name.length > 10 ? name.slice(0, 9) + "…" : name;
}
function createTransformer(ast, options = {}) {
const _context = {
ast,
helpers: /* @__PURE__ */ new Set()
};
const context = () => _context;
const helper = (name) => {
_context.helpers.add(name);
return name;
};
return { context, helper };
}
function traverseNodes(nodes, transformer) {
for (let i2 = 0; i2 < nodes.length; i2++) {
traverseNode(nodes[i2], transformer);
}
}
function traverseNode(node, transformer) {
switch (node.type) {
case 1:
traverseNodes(node.cases, transformer);
transformer.helper(
"plural"
/* HelperNameMap.PLURAL */
);
break;
case 2:
traverseNodes(node.items, transformer);
break;
case 6:
const linked = node;
traverseNode(linked.key, transformer);
transformer.helper(
"linked"
/* HelperNameMap.LINKED */
);
transformer.helper(
"type"
/* HelperNameMap.TYPE */
);
break;
case 5:
transformer.helper(
"interpolate"
/* HelperNameMap.INTERPOLATE */
);
transformer.helper(
"list"
/* HelperNameMap.LIST */
);
break;
case 4:
transformer.helper(
"interpolate"
/* HelperNameMap.INTERPOLATE */
);
transformer.helper(
"named"
/* HelperNameMap.NAMED */
);
break;
}
}
function transform(ast, options = {}) {
const transformer = createTransformer(ast);
transformer.helper(
"normalize"
/* HelperNameMap.NORMALIZE */
);
ast.body && traverseNode(ast.body, transformer);
const context = transformer.context();
ast.helpers = Array.from(context.helpers);
}
function optimize(ast) {
const body = ast.body;
if (body.type === 2) {
optimizeMessageNode(body);
} else {
body.cases.forEach((c2) => optimizeMessageNode(c2));
}
return ast;
}
function optimizeMessageNode(message2) {
if (message2.items.length === 1) {
const item = message2.items[0];
if (item.type === 3 || item.type === 9) {
message2.static = item.value;
delete item.value;
}
} else {
const values = [];
for (let i2 = 0; i2 < message2.items.length; i2++) {
const item = message2.items[i2];
if (!(item.type === 3 || item.type === 9)) {
break;
}
if (item.value == null) {
break;
}
values.push(item.value);
}
if (values.length === message2.items.length) {
message2.static = join(values);
for (let i2 = 0; i2 < message2.items.length; i2++) {
const item = message2.items[i2];
if (item.type === 3 || item.type === 9) {
delete item.value;
}
}
}
}
}
const ERROR_DOMAIN$1 = "minifier";
function minify(node) {
node.t = node.type;
switch (node.type) {
case 0:
const resource = node;
minify(resource.body);
resource.b = resource.body;
delete resource.body;
break;
case 1:
const plural = node;
const cases = plural.cases;
for (let i2 = 0; i2 < cases.length; i2++) {
minify(cases[i2]);
}
plural.c = cases;
delete plural.cases;
break;
case 2:
const message2 = node;
const items = message2.items;
for (let i2 = 0; i2 < items.length; i2++) {
minify(items[i2]);
}
message2.i = items;
delete message2.items;
if (message2.static) {
message2.s = message2.static;
delete message2.static;
}
break;
case 3:
case 9:
case 8:
case 7:
const valueNode = node;
if (valueNode.value) {
valueNode.v = valueNode.value;
delete valueNode.value;
}
break;
case 6:
const linked = node;
minify(linked.key);
linked.k = linked.key;
delete linked.key;
if (linked.modifier) {
minify(linked.modifier);
linked.m = linked.modifier;
delete linked.modifier;
}
break;
case 5:
const list = node;
list.i = list.index;
delete list.index;
break;
case 4:
const named = node;
named.k = named.key;
delete named.key;
break;
default: {
throw createCompileError(CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE, null, {
domain: ERROR_DOMAIN$1,
args: [node.type]
});
}
}
delete node.type;
}
const ERROR_DOMAIN = "parser";
function createCodeGenerator(ast, options) {
const { sourceMap, filename, breakLineCode, needIndent: _needIndent } = options;
const location = options.location !== false;
const _context = {
filename,
code: "",
column: 1,
line: 1,
offset: 0,
map: void 0,
breakLineCode,
needIndent: _needIndent,
indentLevel: 0
};
if (location && ast.loc) {
_context.source = ast.loc.source;
}
const context = () => _context;
function push(code2, node) {
_context.code += code2;
}
function _newline(n2, withBreakLine = true) {
const _breakLineCode = withBreakLine ? breakLineCode : "";
push(_needIndent ? _breakLineCode + ` `.repeat(n2) : _breakLineCode);
}
function indent(withNewLine = true) {
const level = ++_context.indentLevel;
withNewLine && _newline(level);
}
function deindent(withNewLine = true) {
const level = --_context.indentLevel;
withNewLine && _newline(level);
}
function newline() {
_newline(_context.indentLevel);
}
const helper = (key2) => `_${key2}`;
const needIndent = () => _context.needIndent;
return {
context,
push,
indent,
deindent,
newline,
helper,
needIndent
};
}
function generateLinkedNode(generator, node) {
const { helper } = generator;
generator.push(`${helper(
"linked"
/* HelperNameMap.LINKED */
)}(`);
generateNode(generator, node.key);
if (node.modifier) {
generator.push(`, `);
generateNode(generator, node.modifier);
generator.push(`, _type`);
} else {
generator.push(`, undefined, _type`);
}
generator.push(`)`);
}
function generateMessageNode(generator, node) {
const { helper, needIndent } = generator;
generator.push(`${helper(
"normalize"
/* HelperNameMap.NORMALIZE */
)}([`);
generator.indent(needIndent());
const length = node.items.length;
for (let i2 = 0; i2 < length; i2++) {
generateNode(generator, node.items[i2]);
if (i2 === length - 1) {
break;
}
generator.push(", ");
}
generator.deindent(needIndent());
generator.push("])");
}
function generatePluralNode(generator, node) {
const { helper, needIndent } = generator;
if (node.cases.length > 1) {
generator.push(`${helper(
"plural"
/* HelperNameMap.PLURAL */
)}([`);
generator.indent(needIndent());
const length = node.cases.length;
for (let i2 = 0; i2 < length; i2++) {
generateNode(generator, node.cases[i2]);
if (i2 === length - 1) {
break;
}
generator.push(", ");
}
generator.deindent(needIndent());
generator.push(`])`);
}
}
function generateResource(generator, node) {
if (node.body) {
generateNode(generator, node.body);
} else {
generator.push("null");
}
}
function generateNode(generator, node) {
const { helper } = generator;
switch (node.type) {
case 0:
generateResource(generator, node);
break;
case 1:
generatePluralNode(generator, node);
break;
case 2:
generateMessageNode(generator, node);
break;
case 6:
generateLinkedNode(generator, node);
break;
case 8:
generator.push(JSON.stringify(node.value), node);
break;
case 7:
generator.push(JSON.stringify(node.value), node);
break;
case 5:
generator.push(`${helper(
"interpolate"
/* HelperNameMap.INTERPOLATE */
)}(${helper(
"list"
/* HelperNameMap.LIST */
)}(${node.index}))`, node);
break;
case 4:
generator.push(`${helper(
"interpolate"
/* HelperNameMap.INTERPOLATE */
)}(${helper(
"named"
/* HelperNameMap.NAMED */
)}(${JSON.stringify(node.key)}))`, node);
break;
case 9:
generator.push(JSON.stringify(node.value), node);
break;
case 3:
generator.push(JSON.stringify(node.value), node);
break;
default: {
throw createCompileError(CompileErrorCodes.UNHANDLED_CODEGEN_NODE_TYPE, null, {
domain: ERROR_DOMAIN,
args: [node.type]
});
}
}
}
const generate = (ast, options = {}) => {
const mode = isString$1(options.mode) ? options.mode : "normal";
const filename = isString$1(options.filename) ? options.filename : "message.intl";
const sourceMap = !!options.sourceMap;
const breakLineCode = options.breakLineCode != null ? options.breakLineCode : mode === "arrow" ? ";" : "\n";
const needIndent = options.needIndent ? options.needIndent : mode !== "arrow";
const helpers = ast.helpers || [];
const generator = createCodeGenerator(ast, {
mode,
filename,
sourceMap,
breakLineCode,
needIndent
});
generator.push(mode === "normal" ? `function __msg__ (ctx) {` : `(ctx) => {`);
generator.indent(needIndent);
if (helpers.length > 0) {
generator.push(`const { ${join(helpers.map((s2) => `${s2}: _${s2}`), ", ")} } = ctx`);
generator.newline();
}
generator.push(`return `);
generateNode(generator, ast);
generator.deindent(needIndent);
generator.push(`}`);
delete ast.helpers;
const { code: code2, map } = generator.context();
return {
ast,
code: code2,
map: map ? map.toJSON() : void 0
// eslint-disable-line @typescript-eslint/no-explicit-any
};
};
function baseCompile$1(source, options = {}) {
const assignedOptions = assign({}, options);
const jit = !!assignedOptions.jit;
const enalbeMinify = !!assignedOptions.minify;
const enambeOptimize = assignedOptions.optimize == null ? true : assignedOptions.optimize;
const parser2 = createParser(assignedOptions);
const ast = parser2.parse(source);
if (!jit) {
transform(ast, assignedOptions);
return generate(ast, assignedOptions);
} else {
enambeOptimize && optimize(ast);
enalbeMinify && minify(ast);
return { ast, code: "" };
}
}
/*!
* core-base v9.8.0
* (c) 2023 kazuya kawaguchi
* Released under the MIT License.
*/
function initFeatureFlags$1() {
if (typeof __INTLIFY_PROD_DEVTOOLS__ !== "boolean") {
getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false;
}
if (typeof __INTLIFY_JIT_COMPILATION__ !== "boolean") {
getGlobalThis().__INTLIFY_JIT_COMPILATION__ = false;
}
if (typeof __INTLIFY_DROP_MESSAGE_COMPILER__ !== "boolean") {
getGlobalThis().__INTLIFY_DROP_MESSAGE_COMPILER__ = false;
}
}
const pathStateMachine = [];
pathStateMachine[
0
/* States.BEFORE_PATH */
] = {
[
"w"
/* PathCharTypes.WORKSPACE */
]: [
0
/* States.BEFORE_PATH */
],
[
"i"
/* PathCharTypes.IDENT */
]: [
3,
0
/* Actions.APPEND */
],
[
"["
/* PathCharTypes.LEFT_BRACKET */
]: [
4
/* States.IN_SUB_PATH */
],
[
"o"
/* PathCharTypes.END_OF_FAIL */
]: [
7
/* States.AFTER_PATH */
]
};
pathStateMachine[
1
/* States.IN_PATH */
] = {
[
"w"
/* PathCharTypes.WORKSPACE */
]: [
1
/* States.IN_PATH */
],
[
"."
/* PathCharTypes.DOT */
]: [
2
/* States.BEFORE_IDENT */
],
[
"["
/* PathCharTypes.LEFT_BRACKET */
]: [
4
/* States.IN_SUB_PATH */
],
[
"o"
/* PathCharTypes.END_OF_FAIL */
]: [
7
/* States.AFTER_PATH */
]
};
pathStateMachine[
2
/* States.BEFORE_IDENT */
] = {
[
"w"
/* PathCharTypes.WORKSPACE */
]: [
2
/* States.BEFORE_IDENT */
],
[
"i"
/* PathCharTypes.IDENT */
]: [
3,
0
/* Actions.APPEND */
],
[
"0"
/* PathCharTypes.ZERO */
]: [
3,
0
/* Actions.APPEND */
]
};
pathStateMachine[
3
/* States.IN_IDENT */
] = {
[
"i"
/* PathCharTypes.IDENT */
]: [
3,
0
/* Actions.APPEND */
],
[
"0"
/* PathCharTypes.ZERO */
]: [
3,
0
/* Actions.APPEND */
],
[
"w"
/* PathCharTypes.WORKSPACE */
]: [
1,
1
/* Actions.PUSH */
],
[
"."
/* PathCharTypes.DOT */
]: [
2,
1
/* Actions.PUSH */
],
[
"["
/* PathCharTypes.LEFT_BRACKET */
]: [
4,
1
/* Actions.PUSH */
],
[
"o"
/* PathCharTypes.END_OF_FAIL */
]: [
7,
1
/* Actions.PUSH */
]
};
pathStateMachine[
4
/* States.IN_SUB_PATH */
] = {
[
"'"
/* PathCharTypes.SINGLE_QUOTE */
]: [
5,
0
/* Actions.APPEND */
],
[
'"'
/* PathCharTypes.DOUBLE_QUOTE */
]: [
6,
0
/* Actions.APPEND */
],
[
"["
/* PathCharTypes.LEFT_BRACKET */
]: [
4,
2
/* Actions.INC_SUB_PATH_DEPTH */
],
[
"]"
/* PathCharTypes.RIGHT_BRACKET */
]: [
1,
3
/* Actions.PUSH_SUB_PATH */
],
[
"o"
/* PathCharTypes.END_OF_FAIL */
]: 8,
[
"l"
/* PathCharTypes.ELSE */
]: [
4,
0
/* Actions.APPEND */
]
};
pathStateMachine[
5
/* States.IN_SINGLE_QUOTE */
] = {
[
"'"
/* PathCharTypes.SINGLE_QUOTE */
]: [
4,
0
/* Actions.APPEND */
],
[
"o"
/* PathCharTypes.END_OF_FAIL */
]: 8,
[
"l"
/* PathCharTypes.ELSE */
]: [
5,
0
/* Actions.APPEND */
]
};
pathStateMachine[
6
/* States.IN_DOUBLE_QUOTE */
] = {
[
'"'
/* PathCharTypes.DOUBLE_QUOTE */
]: [
4,
0
/* Actions.APPEND */
],
[
"o"
/* PathCharTypes.END_OF_FAIL */
]: 8,
[
"l"
/* PathCharTypes.ELSE */
]: [
6,
0
/* Actions.APPEND */
]
};
const literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
function isLiteral(exp) {
return literalValueRE.test(exp);
}
function stripQuotes(str) {
const a2 = str.charCodeAt(0);
const b2 = str.charCodeAt(str.length - 1);
return a2 === b2 && (a2 === 34 || a2 === 39) ? str.slice(1, -1) : str;
}
function getPathCharType(ch) {
if (ch === void 0 || ch === null) {
return "o";
}
const code2 = ch.charCodeAt(0);
switch (code2) {
case 91:
case 93:
case 46:
case 34:
case 39:
return ch;
case 95:
case 36:
case 45:
return "i";
case 9:
case 10:
case 13:
case 160:
case 65279:
case 8232:
case 8233:
return "w";
}
return "i";
}
function formatSubPath(path) {
const trimmed = path.trim();
if (path.charAt(0) === "0" && isNaN(parseInt(path))) {
return false;
}
return isLiteral(trimmed) ? stripQuotes(trimmed) : "*" + trimmed;
}
function parse$1(path) {
const keys2 = [];
let index2 = -1;
let mode = 0;
let subPathDepth = 0;
let c2;
let key2;
let newChar;
let type;
let transition;
let action;
let typeMap;
const actions = [];
actions[
0
/* Actions.APPEND */
] = () => {
if (key2 === void 0) {
key2 = newChar;
} else {
key2 += newChar;
}
};
actions[
1
/* Actions.PUSH */
] = () => {
if (key2 !== void 0) {
keys2.push(key2);
key2 = void 0;
}
};
actions[
2
/* Actions.INC_SUB_PATH_DEPTH */
] = () => {
actions[
0
/* Actions.APPEND */
]();
subPathDepth++;
};
actions[
3
/* Actions.PUSH_SUB_PATH */
] = () => {
if (subPathDepth > 0) {
subPathDepth--;
mode = 4;
actions[
0
/* Actions.APPEND */
]();
} else {
subPathDepth = 0;
if (key2 === void 0) {
return false;
}
key2 = formatSubPath(key2);
if (key2 === false) {
return false;
} else {
actions[
1
/* Actions.PUSH */
]();
}
}
};
function maybeUnescapeQuote() {
const nextChar = path[index2 + 1];
if (mode === 5 && nextChar === "'" || mode === 6 && nextChar === '"') {
index2++;
newChar = "\\" + nextChar;
actions[
0
/* Actions.APPEND */
]();
return true;
}
}
while (mode !== null) {
index2++;
c2 = path[index2];
if (c2 === "\\" && maybeUnescapeQuote()) {
continue;
}
type = getPathCharType(c2);
typeMap = pathStateMachine[mode];
transition = typeMap[type] || typeMap[
"l"
/* PathCharTypes.ELSE */
] || 8;
if (transition === 8) {
return;
}
mode = transition[0];
if (transition[1] !== void 0) {
action = actions[transition[1]];
if (action) {
newChar = c2;
if (action() === false) {
return;
}
}
}
if (mode === 7) {
return keys2;
}
}
}
const cache = /* @__PURE__ */ new Map();
function resolveWithKeyValue(obj, path) {
return isObject$1(obj) ? obj[path] : null;
}
function resolveValue(obj, path) {
if (!isObject$1(obj)) {
return null;
}
let hit = cache.get(path);
if (!hit) {
hit = parse$1(path);
if (hit) {
cache.set(path, hit);
}
}
if (!hit) {
return null;
}
const len = hit.length;
let last = obj;
let i2 = 0;
while (i2 < len) {
const val = last[hit[i2]];
if (val === void 0) {
return null;
}
if (isFunction2(last)) {
return null;
}
last = val;
i2++;
}
return last;
}
const DEFAULT_MODIFIER = (str) => str;
const DEFAULT_MESSAGE = (ctx) => "";
const DEFAULT_MESSAGE_DATA_TYPE = "text";
const DEFAULT_NORMALIZE = (values) => values.length === 0 ? "" : join$1(values);
const DEFAULT_INTERPOLATE = toDisplayString;
function pluralDefault(choice, choicesLength) {
choice = Math.abs(choice);
if (choicesLength === 2) {
return choice ? choice > 1 ? 1 : 0 : 1;
}
return choice ? Math.min(choice, 2) : 0;
}
function getPluralIndex(options) {
const index2 = isNumber$1(options.pluralIndex) ? options.pluralIndex : -1;
return options.named && (isNumber$1(options.named.count) || isNumber$1(options.named.n)) ? isNumber$1(options.named.count) ? options.named.count : isNumber$1(options.named.n) ? options.named.n : index2 : index2;
}
function normalizeNamed(pluralIndex, props3) {
if (!props3.count) {
props3.count = pluralIndex;
}
if (!props3.n) {
props3.n = pluralIndex;
}
}
function createMessageContext(options = {}) {
const locale3 = options.locale;
const pluralIndex = getPluralIndex(options);
const pluralRule = isObject$1(options.pluralRules) && isString$2(locale3) && isFunction2(options.pluralRules[locale3]) ? options.pluralRules[locale3] : pluralDefault;
const orgPluralRule = isObject$1(options.pluralRules) && isString$2(locale3) && isFunction2(options.pluralRules[locale3]) ? pluralDefault : void 0;
const plural = (messages2) => {
return messages2[pluralRule(pluralIndex, messages2.length, orgPluralRule)];
};
const _list = options.list || [];
const list = (index2) => _list[index2];
const _named = options.named || {};
isNumber$1(options.pluralIndex) && normalizeNamed(pluralIndex, _named);
const named = (key2) => _named[key2];
function message2(key2) {
const msg = isFunction2(options.messages) ? options.messages(key2) : isObject$1(options.messages) ? options.messages[key2] : false;
return !msg ? options.parent ? options.parent.message(key2) : DEFAULT_MESSAGE : msg;
}
const _modifier = (name) => options.modifiers ? options.modifiers[name] : DEFAULT_MODIFIER;
const normalize = isPlainObject(options.processor) && isFunction2(options.processor.normalize) ? options.processor.normalize : DEFAULT_NORMALIZE;
const interpolate = isPlainObject(options.processor) && isFunction2(options.processor.interpolate) ? options.processor.interpolate : DEFAULT_INTERPOLATE;
const type = isPlainObject(options.processor) && isString$2(options.processor.type) ? options.processor.type : DEFAULT_MESSAGE_DATA_TYPE;
const linked = (key2, ...args) => {
const [arg1, arg2] = args;
let type2 = "text";
let modifier = "";
if (args.length === 1) {
if (isObject$1(arg1)) {
modifier = arg1.modifier || modifier;
type2 = arg1.type || type2;
} else if (isString$2(arg1)) {
modifier = arg1 || modifier;
}
} else if (args.length === 2) {
if (isString$2(arg1)) {
modifier = arg1 || modifier;
}
if (isString$2(arg2)) {
type2 = arg2 || type2;
}
}
const ret = message2(key2)(ctx);
const msg = (
// The message in vnode resolved with linked are returned as an array by processor.nomalize
type2 === "vnode" && isArray(ret) && modifier ? ret[0] : ret
);
return modifier ? _modifier(modifier)(msg, type2) : msg;
};
const ctx = {
[
"list"
/* HelperNameMap.LIST */
]: list,
[
"named"
/* HelperNameMap.NAMED */
]: named,
[
"plural"
/* HelperNameMap.PLURAL */
]: plural,
[
"linked"
/* HelperNameMap.LINKED */
]: linked,
[
"message"
/* HelperNameMap.MESSAGE */
]: message2,
[
"type"
/* HelperNameMap.TYPE */
]: type,
[
"interpolate"
/* HelperNameMap.INTERPOLATE */
]: interpolate,
[
"normalize"
/* HelperNameMap.NORMALIZE */
]: normalize,
[
"values"
/* HelperNameMap.VALUES */
]: assign$1({}, _list, _named)
};
return ctx;
}
let devtools = null;
function setDevToolsHook(hook) {
devtools = hook;
}
function initI18nDevTools(i18n2, version, meta) {
devtools && devtools.emit("i18n:init", {
timestamp: Date.now(),
i18n: i18n2,
version,
meta
});
}
const translateDevTools = /* @__PURE__ */ createDevToolsHook(
"function:translate"
/* IntlifyDevToolsHooks.FunctionTranslate */
);
function createDevToolsHook(hook) {
return (payloads) => devtools && devtools.emit(hook, payloads);
}
const CoreWarnCodes = {
NOT_FOUND_KEY: 1,
FALLBACK_TO_TRANSLATE: 2,
CANNOT_FORMAT_NUMBER: 3,
FALLBACK_TO_NUMBER_FORMAT: 4,
CANNOT_FORMAT_DATE: 5,
FALLBACK_TO_DATE_FORMAT: 6,
EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER: 7,
__EXTEND_POINT__: 8
};
const warnMessages$1 = {
[CoreWarnCodes.NOT_FOUND_KEY]: `Not found '{key}' key in '{locale}' locale messages.`,
[CoreWarnCodes.FALLBACK_TO_TRANSLATE]: `Fall back to translate '{key}' key with '{target}' locale.`,
[CoreWarnCodes.CANNOT_FORMAT_NUMBER]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
[CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]: `Fall back to number format '{key}' key with '{target}' locale.`,
[CoreWarnCodes.CANNOT_FORMAT_DATE]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
[CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]: `Fall back to datetime format '{key}' key with '{target}' locale.`,
[CoreWarnCodes.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]: `This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future.`
};
function getWarnMessage$1(code2, ...args) {
return format$2(warnMessages$1[code2], ...args);
}
const code$2 = CompileErrorCodes.__EXTEND_POINT__;
const inc$2 = incrementer(code$2);
const CoreErrorCodes = {
INVALID_ARGUMENT: code$2,
INVALID_DATE_ARGUMENT: inc$2(),
INVALID_ISO_DATE_ARGUMENT: inc$2(),
NOT_SUPPORT_NON_STRING_MESSAGE: inc$2(),
NOT_SUPPORT_LOCALE_PROMISE_VALUE: inc$2(),
NOT_SUPPORT_LOCALE_ASYNC_FUNCTION: inc$2(),
NOT_SUPPORT_LOCALE_TYPE: inc$2(),
__EXTEND_POINT__: inc$2()
// 25
};
function createCoreError(code2) {
return createCompileError(code2, null, process.env.NODE_ENV !== "production" ? { messages: errorMessages$1 } : void 0);
}
const errorMessages$1 = {
[CoreErrorCodes.INVALID_ARGUMENT]: "Invalid arguments",
[CoreErrorCodes.INVALID_DATE_ARGUMENT]: "The date provided is an invalid Date object.Make sure your Date represents a valid date.",
[CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT]: "The argument provided is not a valid ISO date string",
[CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE]: "Not support non-string message",
[CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE]: "cannot support promise value",
[CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]: "cannot support async function",
[CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE]: "cannot support locale type"
};
function getLocale(context, options) {
return options.locale != null ? resolveLocale(options.locale) : resolveLocale(context.locale);
}
let _resolveLocale;
function resolveLocale(locale3) {
if (isString$2(locale3)) {
return locale3;
} else {
if (isFunction2(locale3)) {
if (locale3.resolvedOnce && _resolveLocale != null) {
return _resolveLocale;
} else if (locale3.constructor.name === "Function") {
const resolve = locale3();
if (isPromise(resolve)) {
throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_PROMISE_VALUE);
}
return _resolveLocale = resolve;
} else {
throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION);
}
} else {
throw createCoreError(CoreErrorCodes.NOT_SUPPORT_LOCALE_TYPE);
}
}
}
function fallbackWithSimple(ctx, fallback, start) {
return [.../* @__PURE__ */ new Set([
start,
...isArray(fallback) ? fallback : isObject$1(fallback) ? Object.keys(fallback) : isString$2(fallback) ? [fallback] : [start]
])];
}
function fallbackWithLocaleChain(ctx, fallback, start) {
const startLocale = isString$2(start) ? start : DEFAULT_LOCALE;
const context = ctx;
if (!context.__localeChainCache) {
context.__localeChainCache = /* @__PURE__ */ new Map();
}
let chain = context.__localeChainCache.get(startLocale);
if (!chain) {
chain = [];
let block = [start];
while (isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
const defaults = isArray(fallback) || !isPlainObject(fallback) ? fallback : fallback["default"] ? fallback["default"] : null;
block = isString$2(defaults) ? [defaults] : defaults;
if (isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(startLocale, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i2 = 0; i2 < block.length && isBoolean(follow); i2++) {
const locale3 = block[i2];
if (isString$2(locale3)) {
follow = appendLocaleToChain(chain, block[i2], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale3, blocks) {
let follow;
const tokens = locale3.split("-");
do {
const target = tokens.join("-");
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== "!";
const locale3 = target.replace(/!/g, "");
chain.push(locale3);
if ((isArray(blocks) || isPlainObject(blocks)) && blocks[locale3]) {
follow = blocks[locale3];
}
}
}
return follow;
}
const VERSION$2 = "9.8.0";
const NOT_REOSLVED = -1;
const DEFAULT_LOCALE = "en-US";
const MISSING_RESOLVE_VALUE = "";
const capitalize = (str) => `${str.charAt(0).toLocaleUpperCase()}${str.substr(1)}`;
function getDefaultLinkedModifiers() {
return {
upper: (val, type) => {
return type === "text" && isString$2(val) ? val.toUpperCase() : type === "vnode" && isObject$1(val) && "__v_isVNode" in val ? val.children.toUpperCase() : val;
},
lower: (val, type) => {
return type === "text" && isString$2(val) ? val.toLowerCase() : type === "vnode" && isObject$1(val) && "__v_isVNode" in val ? val.children.toLowerCase() : val;
},
capitalize: (val, type) => {
return type === "text" && isString$2(val) ? capitalize(val) : type === "vnode" && isObject$1(val) && "__v_isVNode" in val ? capitalize(val.children) : val;
}
};
}
let _compiler;
function registerMessageCompiler(compiler) {
_compiler = compiler;
}
let _resolver;
function registerMessageResolver(resolver) {
_resolver = resolver;
}
let _fallbacker;
function registerLocaleFallbacker(fallbacker) {
_fallbacker = fallbacker;
}
let _additionalMeta = null;
const setAdditionalMeta = /* @__NO_SIDE_EFFECTS__ */ (meta) => {
_additionalMeta = meta;
};
const getAdditionalMeta = /* @__NO_SIDE_EFFECTS__ */ () => _additionalMeta;
let _fallbackContext = null;
const setFallbackContext = (context) => {
_fallbackContext = context;
};
const getFallbackContext = () => _fallbackContext;
let _cid = 0;
function createCoreContext(options = {}) {
const onWarn = isFunction2(options.onWarn) ? options.onWarn : warn;
const version = isString$2(options.version) ? options.version : VERSION$2;
const locale3 = isString$2(options.locale) || isFunction2(options.locale) ? options.locale : DEFAULT_LOCALE;
const _locale = isFunction2(locale3) ? DEFAULT_LOCALE : locale3;
const fallbackLocale = isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || isString$2(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : _locale;
const messages2 = isPlainObject(options.messages) ? options.messages : { [_locale]: {} };
const datetimeFormats = isPlainObject(options.datetimeFormats) ? options.datetimeFormats : { [_locale]: {} };
const numberFormats = isPlainObject(options.numberFormats) ? options.numberFormats : { [_locale]: {} };
const modifiers = assign$1({}, options.modifiers || {}, getDefaultLinkedModifiers());
const pluralRules = options.pluralRules || {};
const missing = isFunction2(options.missing) ? options.missing : null;
const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn) ? options.missingWarn : true;
const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn) ? options.fallbackWarn : true;
const fallbackFormat = !!options.fallbackFormat;
const unresolving = !!options.unresolving;
const postTranslation = isFunction2(options.postTranslation) ? options.postTranslation : null;
const processor = isPlainObject(options.processor) ? options.processor : null;
const warnHtmlMessage = isBoolean(options.warnHtmlMessage) ? options.warnHtmlMessage : true;
const escapeParameter = !!options.escapeParameter;
const messageCompiler = isFunction2(options.messageCompiler) ? options.messageCompiler : _compiler;
if (process.env.NODE_ENV !== "production" && true && true && isFunction2(options.messageCompiler)) {
warnOnce(getWarnMessage$1(CoreWarnCodes.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));
}
const messageResolver = isFunction2(options.messageResolver) ? options.messageResolver : _resolver || resolveWithKeyValue;
const localeFallbacker = isFunction2(options.localeFallbacker) ? options.localeFallbacker : _fallbacker || fallbackWithSimple;
const fallbackContext = isObject$1(options.fallbackContext) ? options.fallbackContext : void 0;
const internalOptions = options;
const __datetimeFormatters = isObject$1(internalOptions.__datetimeFormatters) ? internalOptions.__datetimeFormatters : /* @__PURE__ */ new Map();
const __numberFormatters = isObject$1(internalOptions.__numberFormatters) ? internalOptions.__numberFormatters : /* @__PURE__ */ new Map();
const __meta = isObject$1(internalOptions.__meta) ? internalOptions.__meta : {};
_cid++;
const context = {
version,
cid: _cid,
locale: locale3,
fallbackLocale,
messages: messages2,
modifiers,
pluralRules,
missing,
missingWarn,
fallbackWarn,
fallbackFormat,
unresolving,
postTranslation,
processor,
warnHtmlMessage,
escapeParameter,
messageCompiler,
messageResolver,
localeFallbacker,
fallbackContext,
onWarn,
__meta
};
{
context.datetimeFormats = datetimeFormats;
context.numberFormats = numberFormats;
context.__datetimeFormatters = __datetimeFormatters;
context.__numberFormatters = __numberFormatters;
}
if (process.env.NODE_ENV !== "production") {
context.__v_emitter = internalOptions.__v_emitter != null ? internalOptions.__v_emitter : void 0;
}
if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) {
initI18nDevTools(context, version, __meta);
}
return context;
}
function isTranslateFallbackWarn(fallback, key2) {
return fallback instanceof RegExp ? fallback.test(key2) : fallback;
}
function isTranslateMissingWarn(missing, key2) {
return missing instanceof RegExp ? missing.test(key2) : missing;
}
function handleMissing(context, key2, locale3, missingWarn, type) {
const { missing, onWarn } = context;
if (process.env.NODE_ENV !== "production") {
const emitter = context.__v_emitter;
if (emitter) {
emitter.emit("missing", {
locale: locale3,
key: key2,
type,
groupId: `${type}:${key2}`
});
}
}
if (missing !== null) {
const ret = missing(context, locale3, key2, type);
return isString$2(ret) ? ret : key2;
} else {
if (process.env.NODE_ENV !== "production" && isTranslateMissingWarn(missingWarn, key2)) {
onWarn(getWarnMessage$1(CoreWarnCodes.NOT_FOUND_KEY, { key: key2, locale: locale3 }));
}
return key2;
}
}
function updateFallbackLocale(ctx, locale3, fallback) {
const context = ctx;
context.__localeChainCache = /* @__PURE__ */ new Map();
ctx.localeFallbacker(ctx, fallback, locale3);
}
function format2(ast) {
const msg = (ctx) => formatParts(ctx, ast);
return msg;
}
function formatParts(ctx, ast) {
const body = ast.b || ast.body;
if ((body.t || body.type) === 1) {
const plural = body;
const cases = plural.c || plural.cases;
return ctx.plural(cases.reduce((messages2, c2) => [
...messages2,
formatMessageParts(ctx, c2)
], []));
} else {
return formatMessageParts(ctx, body);
}
}
function formatMessageParts(ctx, node) {
const _static = node.s || node.static;
if (_static) {
return ctx.type === "text" ? _static : ctx.normalize([_static]);
} else {
const messages2 = (node.i || node.items).reduce((acm, c2) => [...acm, formatMessagePart(ctx, c2)], []);
return ctx.normalize(messages2);
}
}
function formatMessagePart(ctx, node) {
const type = node.t || node.type;
switch (type) {
case 3:
const text = node;
return text.v || text.value;
case 9:
const literal = node;
return literal.v || literal.value;
case 4:
const named = node;
return ctx.interpolate(ctx.named(named.k || named.key));
case 5:
const list = node;
return ctx.interpolate(ctx.list(list.i != null ? list.i : list.index));
case 6:
const linked = node;
const modifier = linked.m || linked.modifier;
return ctx.linked(formatMessagePart(ctx, linked.k || linked.key), modifier ? formatMessagePart(ctx, modifier) : void 0, ctx.type);
case 7:
const linkedKey = node;
return linkedKey.v || linkedKey.value;
case 8:
const linkedModifier = node;
return linkedModifier.v || linkedModifier.value;
default:
throw new Error(`unhandled node type on format message part: ${type}`);
}
}
const WARN_MESSAGE = `Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.`;
function checkHtmlMessage(source, warnHtmlMessage) {
if (warnHtmlMessage && detectHtmlTag(source)) {
warn(format$2(WARN_MESSAGE, { source }));
}
}
const defaultOnCacheKey = (message2) => message2;
let compileCache = /* @__PURE__ */ Object.create(null);
const isMessageAST = (val) => isObject$1(val) && (val.t === 0 || val.type === 0) && ("b" in val || "body" in val);
function baseCompile(message2, options = {}) {
let detectError = false;
const onError = options.onError || defaultOnError;
options.onError = (err) => {
detectError = true;
onError(err);
};
return { ...baseCompile$1(message2, options), detectError };
}
const compileToFunction = /* @__NO_SIDE_EFFECTS__ */ (message2, context) => {
if (!isString$2(message2)) {
throw createCoreError(CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE);
}
{
const warnHtmlMessage = isBoolean(context.warnHtmlMessage) ? context.warnHtmlMessage : true;
process.env.NODE_ENV !== "production" && checkHtmlMessage(message2, warnHtmlMessage);
const onCacheKey = context.onCacheKey || defaultOnCacheKey;
const cacheKey = onCacheKey(message2);
const cached2 = compileCache[cacheKey];
if (cached2) {
return cached2;
}
const { code: code2, detectError } = baseCompile(message2, context);
const msg = new Function(`return ${code2}`)();
return !detectError ? compileCache[cacheKey] = msg : msg;
}
};
function compile(message2, context) {
if (__INTLIFY_JIT_COMPILATION__ && !__INTLIFY_DROP_MESSAGE_COMPILER__ && isString$2(message2)) {
const warnHtmlMessage = isBoolean(context.warnHtmlMessage) ? context.warnHtmlMessage : true;
process.env.NODE_ENV !== "production" && checkHtmlMessage(message2, warnHtmlMessage);
const onCacheKey = context.onCacheKey || defaultOnCacheKey;
const cacheKey = onCacheKey(message2);
const cached2 = compileCache[cacheKey];
if (cached2) {
return cached2;
}
const { ast, detectError } = baseCompile(message2, {
...context,
location: process.env.NODE_ENV !== "production",
jit: true
});
const msg = format2(ast);
return !detectError ? compileCache[cacheKey] = msg : msg;
} else {
if (process.env.NODE_ENV !== "production" && !isMessageAST(message2)) {
warn(`the message that is resolve with key '${context.key}' is not supported for jit compilation`);
return () => message2;
}
const cacheKey = message2.cacheKey;
if (cacheKey) {
const cached2 = compileCache[cacheKey];
if (cached2) {
return cached2;
}
return compileCache[cacheKey] = format2(message2);
} else {
return format2(message2);
}
}
}
const NOOP_MESSAGE_FUNCTION = () => "";
const isMessageFunction = (val) => isFunction2(val);
function translate(context, ...args) {
const { fallbackFormat, postTranslation, unresolving, messageCompiler, fallbackLocale, messages: messages2 } = context;
const [key2, options] = parseTranslateArgs(...args);
const missingWarn = isBoolean(options.missingWarn) ? options.missingWarn : context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn) ? options.fallbackWarn : context.fallbackWarn;
const escapeParameter = isBoolean(options.escapeParameter) ? options.escapeParameter : context.escapeParameter;
const resolvedMessage = !!options.resolvedMessage;
const defaultMsgOrKey = isString$2(options.default) || isBoolean(options.default) ? !isBoolean(options.default) ? options.default : !messageCompiler ? () => key2 : key2 : fallbackFormat ? !messageCompiler ? () => key2 : key2 : "";
const enableDefaultMsg = fallbackFormat || defaultMsgOrKey !== "";
const locale3 = getLocale(context, options);
escapeParameter && escapeParams(options);
let [formatScope, targetLocale, message2] = !resolvedMessage ? resolveMessageFormat(context, key2, locale3, fallbackLocale, fallbackWarn, missingWarn) : [
key2,
locale3,
messages2[locale3] || {}
];
let format3 = formatScope;
let cacheBaseKey = key2;
if (!resolvedMessage && !(isString$2(format3) || isMessageAST(format3) || isMessageFunction(format3))) {
if (enableDefaultMsg) {
format3 = defaultMsgOrKey;
cacheBaseKey = format3;
}
}
if (!resolvedMessage && (!(isString$2(format3) || isMessageAST(format3) || isMessageFunction(format3)) || !isString$2(targetLocale))) {
return unresolving ? NOT_REOSLVED : key2;
}
if (process.env.NODE_ENV !== "production" && isString$2(format3) && context.messageCompiler == null) {
warn(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${key2}'.`);
return key2;
}
let occurred = false;
const onError = () => {
occurred = true;
};
const msg = !isMessageFunction(format3) ? compileMessageFormat(context, key2, targetLocale, format3, cacheBaseKey, onError) : format3;
if (occurred) {
return format3;
}
const ctxOptions = getMessageContextOptions(context, targetLocale, message2, options);
const msgContext = createMessageContext(ctxOptions);
const messaged = evaluateMessage(context, msg, msgContext);
const ret = postTranslation ? postTranslation(messaged, key2) : messaged;
if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) {
const payloads = {
timestamp: Date.now(),
key: isString$2(key2) ? key2 : isMessageFunction(format3) ? format3.key : "",
locale: targetLocale || (isMessageFunction(format3) ? format3.locale : ""),
format: isString$2(format3) ? format3 : isMessageFunction(format3) ? format3.source : "",
message: ret
};
payloads.meta = assign$1({}, context.__meta, /* @__PURE__ */ getAdditionalMeta() || {});
translateDevTools(payloads);
}
return ret;
}
function escapeParams(options) {
if (isArray(options.list)) {
options.list = options.list.map((item) => isString$2(item) ? escapeHtml(item) : item);
} else if (isObject$1(options.named)) {
Object.keys(options.named).forEach((key2) => {
if (isString$2(options.named[key2])) {
options.named[key2] = escapeHtml(options.named[key2]);
}
});
}
}
function resolveMessageFormat(context, key2, locale3, fallbackLocale, fallbackWarn, missingWarn) {
const { messages: messages2, onWarn, messageResolver: resolveValue2, localeFallbacker } = context;
const locales = localeFallbacker(context, fallbackLocale, locale3);
let message2 = {};
let targetLocale;
let format3 = null;
let from = locale3;
let to = null;
const type = "translate";
for (let i2 = 0; i2 < locales.length; i2++) {
targetLocale = to = locales[i2];
if (process.env.NODE_ENV !== "production" && locale3 !== targetLocale && isTranslateFallbackWarn(fallbackWarn, key2)) {
onWarn(getWarnMessage$1(CoreWarnCodes.FALLBACK_TO_TRANSLATE, {
key: key2,
target: targetLocale
}));
}
if (process.env.NODE_ENV !== "production" && locale3 !== targetLocale) {
const emitter = context.__v_emitter;
if (emitter) {
emitter.emit("fallback", {
type,
key: key2,
from,
to,
groupId: `${type}:${key2}`
});
}
}
message2 = messages2[targetLocale] || {};
let start = null;
let startTag;
let endTag;
if (process.env.NODE_ENV !== "production" && inBrowser) {
start = window.performance.now();
startTag = "intlify-message-resolve-start";
endTag = "intlify-message-resolve-end";
mark && mark(startTag);
}
if ((format3 = resolveValue2(message2, key2)) === null) {
format3 = message2[key2];
}
if (process.env.NODE_ENV !== "production" && inBrowser) {
const end = window.performance.now();
const emitter = context.__v_emitter;
if (emitter && start && format3) {
emitter.emit("message-resolve", {
type: "message-resolve",
key: key2,
message: format3,
time: end - start,
groupId: `${type}:${key2}`
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure("intlify message resolve", startTag, endTag);
}
}
if (isString$2(format3) || isMessageAST(format3) || isMessageFunction(format3)) {
break;
}
const missingRet = handleMissing(
context,
// eslint-disable-line @typescript-eslint/no-explicit-any
key2,
targetLocale,
missingWarn,
type
);
if (missingRet !== key2) {
format3 = missingRet;
}
from = to;
}
return [format3, targetLocale, message2];
}
function compileMessageFormat(context, key2, targetLocale, format3, cacheBaseKey, onError) {
const { messageCompiler, warnHtmlMessage } = context;
if (isMessageFunction(format3)) {
const msg2 = format3;
msg2.locale = msg2.locale || targetLocale;
msg2.key = msg2.key || key2;
return msg2;
}
if (messageCompiler == null) {
const msg2 = () => format3;
msg2.locale = targetLocale;
msg2.key = key2;
return msg2;
}
let start = null;
let startTag;
let endTag;
if (process.env.NODE_ENV !== "production" && inBrowser) {
start = window.performance.now();
startTag = "intlify-message-compilation-start";
endTag = "intlify-message-compilation-end";
mark && mark(startTag);
}
const msg = messageCompiler(format3, getCompileContext(context, targetLocale, cacheBaseKey, format3, warnHtmlMessage, onError));
if (process.env.NODE_ENV !== "production" && inBrowser) {
const end = window.performance.now();
const emitter = context.__v_emitter;
if (emitter && start) {
emitter.emit("message-compilation", {
type: "message-compilation",
message: format3,
time: end - start,
groupId: `${"translate"}:${key2}`
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure("intlify message compilation", startTag, endTag);
}
}
msg.locale = targetLocale;
msg.key = key2;
msg.source = format3;
return msg;
}
function evaluateMessage(context, msg, msgCtx) {
let start = null;
let startTag;
let endTag;
if (process.env.NODE_ENV !== "production" && inBrowser) {
start = window.performance.now();
startTag = "intlify-message-evaluation-start";
endTag = "intlify-message-evaluation-end";
mark && mark(startTag);
}
const messaged = msg(msgCtx);
if (process.env.NODE_ENV !== "production" && inBrowser) {
const end = window.performance.now();
const emitter = context.__v_emitter;
if (emitter && start) {
emitter.emit("message-evaluation", {
type: "message-evaluation",
value: messaged,
time: end - start,
groupId: `${"translate"}:${msg.key}`
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure("intlify message evaluation", startTag, endTag);
}
}
return messaged;
}
function parseTranslateArgs(...args) {
const [arg1, arg2, arg3] = args;
const options = {};
if (!isString$2(arg1) && !isNumber$1(arg1) && !isMessageFunction(arg1) && !isMessageAST(arg1)) {
throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);
}
const key2 = isNumber$1(arg1) ? String(arg1) : isMessageFunction(arg1) ? arg1 : arg1;
if (isNumber$1(arg2)) {
options.plural = arg2;
} else if (isString$2(arg2)) {
options.default = arg2;
} else if (isPlainObject(arg2) && !isEmptyObject(arg2)) {
options.named = arg2;
} else if (isArray(arg2)) {
options.list = arg2;
}
if (isNumber$1(arg3)) {
options.plural = arg3;
} else if (isString$2(arg3)) {
options.default = arg3;
} else if (isPlainObject(arg3)) {
assign$1(options, arg3);
}
return [key2, options];
}
function getCompileContext(context, locale3, key2, source, warnHtmlMessage, onError) {
return {
locale: locale3,
key: key2,
warnHtmlMessage,
onError: (err) => {
onError && onError(err);
if (process.env.NODE_ENV !== "production") {
const _source = getSourceForCodeFrame(source);
const message2 = `Message compilation error: ${err.message}`;
const codeFrame = err.location && _source && generateCodeFrame(_source, err.location.start.offset, err.location.end.offset);
const emitter = context.__v_emitter;
if (emitter && _source) {
emitter.emit("compile-error", {
message: _source,
error: err.message,
start: err.location && err.location.start.offset,
end: err.location && err.location.end.offset,
groupId: `${"translate"}:${key2}`
});
}
console.error(codeFrame ? `${message2}
${codeFrame}` : message2);
} else {
throw err;
}
},
onCacheKey: (source2) => generateFormatCacheKey(locale3, key2, source2)
};
}
function getSourceForCodeFrame(source) {
if (isString$2(source)) {
return source;
} else {
if (source.loc && source.loc.source) {
return source.loc.source;
}
}
}
function getMessageContextOptions(context, locale3, message2, options) {
const { modifiers, pluralRules, messageResolver: resolveValue2, fallbackLocale, fallbackWarn, missingWarn, fallbackContext } = context;
const resolveMessage = (key2) => {
let val = resolveValue2(message2, key2);
if (val == null && fallbackContext) {
const [, , message3] = resolveMessageFormat(fallbackContext, key2, locale3, fallbackLocale, fallbackWarn, missingWarn);
val = resolveValue2(message3, key2);
}
if (isString$2(val) || isMessageAST(val)) {
let occurred = false;
const onError = () => {
occurred = true;
};
const msg = compileMessageFormat(context, key2, locale3, val, key2, onError);
return !occurred ? msg : NOOP_MESSAGE_FUNCTION;
} else if (isMessageFunction(val)) {
return val;
} else {
return NOOP_MESSAGE_FUNCTION;
}
};
const ctxOptions = {
locale: locale3,
modifiers,
pluralRules,
messages: resolveMessage
};
if (context.processor) {
ctxOptions.processor = context.processor;
}
if (options.list) {
ctxOptions.list = options.list;
}
if (options.named) {
ctxOptions.named = options.named;
}
if (isNumber$1(options.plural)) {
ctxOptions.pluralIndex = options.plural;
}
return ctxOptions;
}
const intlDefined = typeof Intl !== "undefined";
const Availabilities = {
dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== "undefined",
numberFormat: intlDefined && typeof Intl.NumberFormat !== "undefined"
};
function datetime(context, ...args) {
const { datetimeFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;
const { __datetimeFormatters } = context;
if (process.env.NODE_ENV !== "production" && !Availabilities.dateTimeFormat) {
onWarn(getWarnMessage$1(CoreWarnCodes.CANNOT_FORMAT_DATE));
return MISSING_RESOLVE_VALUE;
}
const [key2, value2, options, overrides] = parseDateTimeArgs(...args);
const missingWarn = isBoolean(options.missingWarn) ? options.missingWarn : context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn) ? options.fallbackWarn : context.fallbackWarn;
const part = !!options.part;
const locale3 = getLocale(context, options);
const locales = localeFallbacker(
context,
// eslint-disable-line @typescript-eslint/no-explicit-any
fallbackLocale,
locale3
);
if (!isString$2(key2) || key2 === "") {
return new Intl.DateTimeFormat(locale3, overrides).format(value2);
}
let datetimeFormat = {};
let targetLocale;
let format3 = null;
let from = locale3;
let to = null;
const type = "datetime format";
for (let i2 = 0; i2 < locales.length; i2++) {
targetLocale = to = locales[i2];
if (process.env.NODE_ENV !== "production" && locale3 !== targetLocale && isTranslateFallbackWarn(fallbackWarn, key2)) {
onWarn(getWarnMessage$1(CoreWarnCodes.FALLBACK_TO_DATE_FORMAT, {
key: key2,
target: targetLocale
}));
}
if (process.env.NODE_ENV !== "production" && locale3 !== targetLocale) {
const emitter = context.__v_emitter;
if (emitter) {
emitter.emit("fallback", {
type,
key: key2,
from,
to,
groupId: `${type}:${key2}`
});
}
}
datetimeFormat = datetimeFormats[targetLocale] || {};
format3 = datetimeFormat[key2];
if (isPlainObject(format3))
break;
handleMissing(context, key2, targetLocale, missingWarn, type);
from = to;
}
if (!isPlainObject(format3) || !isString$2(targetLocale)) {
return unresolving ? NOT_REOSLVED : key2;
}
let id = `${targetLocale}__${key2}`;
if (!isEmptyObject(overrides)) {
id = `${id}__${JSON.stringify(overrides)}`;
}
let formatter = __datetimeFormatters.get(id);
if (!formatter) {
formatter = new Intl.DateTimeFormat(targetLocale, assign$1({}, format3, overrides));
__datetimeFormatters.set(id, formatter);
}
return !part ? formatter.format(value2) : formatter.formatToParts(value2);
}
const DATETIME_FORMAT_OPTIONS_KEYS = [
"localeMatcher",
"weekday",
"era",
"year",
"month",
"day",
"hour",
"minute",
"second",
"timeZoneName",
"formatMatcher",
"hour12",
"timeZone",
"dateStyle",
"timeStyle",
"calendar",
"dayPeriod",
"numberingSystem",
"hourCycle",
"fractionalSecondDigits"
];
function parseDateTimeArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
const options = {};
let overrides = {};
let value2;
if (isString$2(arg1)) {
const matches = arg1.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);
if (!matches) {
throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);
}
const dateTime = matches[3] ? matches[3].trim().startsWith("T") ? `${matches[1].trim()}${matches[3].trim()}` : `${matches[1].trim()}T${matches[3].trim()}` : matches[1].trim();
value2 = new Date(dateTime);
try {
value2.toISOString();
} catch (e2) {
throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);
}
} else if (isDate$1(arg1)) {
if (isNaN(arg1.getTime())) {
throw createCoreError(CoreErrorCodes.INVALID_DATE_ARGUMENT);
}
value2 = arg1;
} else if (isNumber$1(arg1)) {
value2 = arg1;
} else {
throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);
}
if (isString$2(arg2)) {
options.key = arg2;
} else if (isPlainObject(arg2)) {
Object.keys(arg2).forEach((key2) => {
if (DATETIME_FORMAT_OPTIONS_KEYS.includes(key2)) {
overrides[key2] = arg2[key2];
} else {
options[key2] = arg2[key2];
}
});
}
if (isString$2(arg3)) {
options.locale = arg3;
} else if (isPlainObject(arg3)) {
overrides = arg3;
}
if (isPlainObject(arg4)) {
overrides = arg4;
}
return [options.key || "", value2, options, overrides];
}
function clearDateTimeFormat(ctx, locale3, format3) {
const context = ctx;
for (const key2 in format3) {
const id = `${locale3}__${key2}`;
if (!context.__datetimeFormatters.has(id)) {
continue;
}
context.__datetimeFormatters.delete(id);
}
}
function number(context, ...args) {
const { numberFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;
const { __numberFormatters } = context;
if (process.env.NODE_ENV !== "production" && !Availabilities.numberFormat) {
onWarn(getWarnMessage$1(CoreWarnCodes.CANNOT_FORMAT_NUMBER));
return MISSING_RESOLVE_VALUE;
}
const [key2, value2, options, overrides] = parseNumberArgs(...args);
const missingWarn = isBoolean(options.missingWarn) ? options.missingWarn : context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn) ? options.fallbackWarn : context.fallbackWarn;
const part = !!options.part;
const locale3 = getLocale(context, options);
const locales = localeFallbacker(
context,
// eslint-disable-line @typescript-eslint/no-explicit-any
fallbackLocale,
locale3
);
if (!isString$2(key2) || key2 === "") {
return new Intl.NumberFormat(locale3, overrides).format(value2);
}
let numberFormat = {};
let targetLocale;
let format3 = null;
let from = locale3;
let to = null;
const type = "number format";
for (let i2 = 0; i2 < locales.length; i2++) {
targetLocale = to = locales[i2];
if (process.env.NODE_ENV !== "production" && locale3 !== targetLocale && isTranslateFallbackWarn(fallbackWarn, key2)) {
onWarn(getWarnMessage$1(CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT, {
key: key2,
target: targetLocale
}));
}
if (process.env.NODE_ENV !== "production" && locale3 !== targetLocale) {
const emitter = context.__v_emitter;
if (emitter) {
emitter.emit("fallback", {
type,
key: key2,
from,
to,
groupId: `${type}:${key2}`
});
}
}
numberFormat = numberFormats[targetLocale] || {};
format3 = numberFormat[key2];
if (isPlainObject(format3))
break;
handleMissing(context, key2, targetLocale, missingWarn, type);
from = to;
}
if (!isPlainObject(format3) || !isString$2(targetLocale)) {
return unresolving ? NOT_REOSLVED : key2;
}
let id = `${targetLocale}__${key2}`;
if (!isEmptyObject(overrides)) {
id = `${id}__${JSON.stringify(overrides)}`;
}
let formatter = __numberFormatters.get(id);
if (!formatter) {
formatter = new Intl.NumberFormat(targetLocale, assign$1({}, format3, overrides));
__numberFormatters.set(id, formatter);
}
return !part ? formatter.format(value2) : formatter.formatToParts(value2);
}
const NUMBER_FORMAT_OPTIONS_KEYS = [
"localeMatcher",
"style",
"currency",
"currencyDisplay",
"currencySign",
"useGrouping",
"minimumIntegerDigits",
"minimumFractionDigits",
"maximumFractionDigits",
"minimumSignificantDigits",
"maximumSignificantDigits",
"compactDisplay",
"notation",
"signDisplay",
"unit",
"unitDisplay",
"roundingMode",
"roundingPriority",
"roundingIncrement",
"trailingZeroDisplay"
];
function parseNumberArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
const options = {};
let overrides = {};
if (!isNumber$1(arg1)) {
throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);
}
const value2 = arg1;
if (isString$2(arg2)) {
options.key = arg2;
} else if (isPlainObject(arg2)) {
Object.keys(arg2).forEach((key2) => {
if (NUMBER_FORMAT_OPTIONS_KEYS.includes(key2)) {
overrides[key2] = arg2[key2];
} else {
options[key2] = arg2[key2];
}
});
}
if (isString$2(arg3)) {
options.locale = arg3;
} else if (isPlainObject(arg3)) {
overrides = arg3;
}
if (isPlainObject(arg4)) {
overrides = arg4;
}
return [options.key || "", value2, options, overrides];
}
function clearNumberFormat(ctx, locale3, format3) {
const context = ctx;
for (const key2 in format3) {
const id = `${locale3}__${key2}`;
if (!context.__numberFormatters.has(id)) {
continue;
}
context.__numberFormatters.delete(id);
}
}
{
initFeatureFlags$1();
}
function getDevtoolsGlobalHook() {
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
}
function getTarget() {
return typeof navigator !== "undefined" && typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
}
const isProxyAvailable = typeof Proxy === "function";
const HOOK_SETUP = "devtools-plugin:setup";
const HOOK_PLUGIN_SETTINGS_SET = "plugin:settings:set";
let supported;
let perf;
function isPerformanceSupported() {
var _a;
if (supported !== void 0) {
return supported;
}
if (typeof window !== "undefined" && window.performance) {
supported = true;
perf = window.performance;
} else if (typeof global !== "undefined" && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
supported = true;
perf = global.perf_hooks.performance;
} else {
supported = false;
}
return supported;
}
function now$1() {
return isPerformanceSupported() ? perf.now() : Date.now();
}
class ApiProxy {
constructor(plugin, hook) {
this.target = null;
this.targetQueue = [];
this.onQueue = [];
this.plugin = plugin;
this.hook = hook;
const defaultSettings = {};
if (plugin.settings) {
for (const id in plugin.settings) {
const item = plugin.settings[id];
defaultSettings[id] = item.defaultValue;
}
}
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
let currentSettings = Object.assign({}, defaultSettings);
try {
const raw = localStorage.getItem(localSettingsSaveId);
const data2 = JSON.parse(raw);
Object.assign(currentSettings, data2);
} catch (e2) {
}
this.fallbacks = {
getSettings() {
return currentSettings;
},
setSettings(value2) {
try {
localStorage.setItem(localSettingsSaveId, JSON.stringify(value2));
} catch (e2) {
}
currentSettings = value2;
},
now() {
return now$1();
}
};
if (hook) {
hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value2) => {
if (pluginId === this.plugin.id) {
this.fallbacks.setSettings(value2);
}
});
}
this.proxiedOn = new Proxy({}, {
get: (_target, prop) => {
if (this.target) {
return this.target.on[prop];
} else {
return (...args) => {
this.onQueue.push({
method: prop,
args
});
};
}
}
});
this.proxiedTarget = new Proxy({}, {
get: (_target, prop) => {
if (this.target) {
return this.target[prop];
} else if (prop === "on") {
return this.proxiedOn;
} else if (Object.keys(this.fallbacks).includes(prop)) {
return (...args) => {
this.targetQueue.push({
method: prop,
args,
resolve: () => {
}
});
return this.fallbacks[prop](...args);
};
} else {
return (...args) => {
return new Promise((resolve) => {
this.targetQueue.push({
method: prop,
args,
resolve
});
});
};
}
}
});
}
async setRealTarget(target) {
this.target = target;
for (const item of this.onQueue) {
this.target.on[item.method](...item.args);
}
for (const item of this.targetQueue) {
item.resolve(await this.target[item.method](...item.args));
}
}
}
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
const descriptor = pluginDescriptor;
const target = getTarget();
const hook = getDevtoolsGlobalHook();
const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
} else {
const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
list.push({
pluginDescriptor: descriptor,
setupFn,
proxy
});
if (proxy)
setupFn(proxy.proxiedTarget);
}
}
/*!
* vue-i18n v9.8.0
* (c) 2023 kazuya kawaguchi
* Released under the MIT License.
*/
const VERSION$1 = "9.8.0";
function initFeatureFlags() {
if (typeof __VUE_I18N_FULL_INSTALL__ !== "boolean") {
getGlobalThis().__VUE_I18N_FULL_INSTALL__ = true;
}
if (typeof __VUE_I18N_LEGACY_API__ !== "boolean") {
getGlobalThis().__VUE_I18N_LEGACY_API__ = true;
}
if (typeof __INTLIFY_JIT_COMPILATION__ !== "boolean") {
getGlobalThis().__INTLIFY_JIT_COMPILATION__ = false;
}
if (typeof __INTLIFY_DROP_MESSAGE_COMPILER__ !== "boolean") {
getGlobalThis().__INTLIFY_DROP_MESSAGE_COMPILER__ = false;
}
if (typeof __INTLIFY_PROD_DEVTOOLS__ !== "boolean") {
getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false;
}
}
const code$1 = CoreWarnCodes.__EXTEND_POINT__;
const inc$1 = incrementer(code$1);
const I18nWarnCodes = {
FALLBACK_TO_ROOT: code$1,
NOT_SUPPORTED_PRESERVE: inc$1(),
NOT_SUPPORTED_FORMATTER: inc$1(),
NOT_SUPPORTED_PRESERVE_DIRECTIVE: inc$1(),
NOT_SUPPORTED_GET_CHOICE_INDEX: inc$1(),
COMPONENT_NAME_LEGACY_COMPATIBLE: inc$1(),
NOT_FOUND_PARENT_SCOPE: inc$1(),
IGNORE_OBJ_FLATTEN: inc$1(),
NOTICE_DROP_ALLOW_COMPOSITION: inc$1()
// 17
};
const warnMessages = {
[I18nWarnCodes.FALLBACK_TO_ROOT]: `Fall back to {type} '{key}' with root locale.`,
[I18nWarnCodes.NOT_SUPPORTED_PRESERVE]: `Not supported 'preserve'.`,
[I18nWarnCodes.NOT_SUPPORTED_FORMATTER]: `Not supported 'formatter'.`,
[I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE]: `Not supported 'preserveDirectiveContent'.`,
[I18nWarnCodes.NOT_SUPPORTED_GET_CHOICE_INDEX]: `Not supported 'getChoiceIndex'.`,
[I18nWarnCodes.COMPONENT_NAME_LEGACY_COMPATIBLE]: `Component name legacy compatible: '{name}' -> 'i18n'`,
[I18nWarnCodes.NOT_FOUND_PARENT_SCOPE]: `Not found parent scope. use the global scope.`,
[I18nWarnCodes.IGNORE_OBJ_FLATTEN]: `Ignore object flatten: '{key}' key has an string value`,
[I18nWarnCodes.NOTICE_DROP_ALLOW_COMPOSITION]: `'allowComposition' option will be dropped in the next major version. For more information, please see 👉 https://tinyurl.com/2p97mcze`
};
function getWarnMessage(code2, ...args) {
return format$2(warnMessages[code2], ...args);
}
const code = CoreErrorCodes.__EXTEND_POINT__;
const inc = incrementer(code);
const I18nErrorCodes = {
// composer module errors
UNEXPECTED_RETURN_TYPE: code,
// legacy module errors
INVALID_ARGUMENT: inc(),
// i18n module errors
MUST_BE_CALL_SETUP_TOP: inc(),
NOT_INSTALLED: inc(),
NOT_AVAILABLE_IN_LEGACY_MODE: inc(),
// directive module errors
REQUIRED_VALUE: inc(),
INVALID_VALUE: inc(),
// vue-devtools errors
CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN: inc(),
NOT_INSTALLED_WITH_PROVIDE: inc(),
// unexpected error
UNEXPECTED_ERROR: inc(),
// not compatible legacy vue-i18n constructor
NOT_COMPATIBLE_LEGACY_VUE_I18N: inc(),
// bridge support vue 2.x only
BRIDGE_SUPPORT_VUE_2_ONLY: inc(),
// need to define `i18n` option in `allowComposition: true` and `useScope: 'local' at `useI18n``
MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION: inc(),
// Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly
NOT_AVAILABLE_COMPOSITION_IN_LEGACY: inc(),
// for enhancement
__EXTEND_POINT__: inc()
// 40
};
function createI18nError(code2, ...args) {
return createCompileError(code2, null, process.env.NODE_ENV !== "production" ? { messages: errorMessages, args } : void 0);
}
const errorMessages = {
[I18nErrorCodes.UNEXPECTED_RETURN_TYPE]: "Unexpected return type in composer",
[I18nErrorCodes.INVALID_ARGUMENT]: "Invalid argument",
[I18nErrorCodes.MUST_BE_CALL_SETUP_TOP]: "Must be called at the top of a `setup` function",
[I18nErrorCodes.NOT_INSTALLED]: "Need to install with `app.use` function",
[I18nErrorCodes.UNEXPECTED_ERROR]: "Unexpected error",
[I18nErrorCodes.NOT_AVAILABLE_IN_LEGACY_MODE]: "Not available in legacy mode",
[I18nErrorCodes.REQUIRED_VALUE]: `Required in value: {0}`,
[I18nErrorCodes.INVALID_VALUE]: `Invalid value`,
[I18nErrorCodes.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]: `Cannot setup vue-devtools plugin`,
[I18nErrorCodes.NOT_INSTALLED_WITH_PROVIDE]: "Need to install with `provide` function",
[I18nErrorCodes.NOT_COMPATIBLE_LEGACY_VUE_I18N]: "Not compatible legacy VueI18n.",
[I18nErrorCodes.BRIDGE_SUPPORT_VUE_2_ONLY]: "vue-i18n-bridge support Vue 2.x only",
[I18nErrorCodes.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION]: "Must define ‘i18n’ option or custom block in Composition API with using local scope in Legacy API mode",
[I18nErrorCodes.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]: "Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"
};
const TranslateVNodeSymbol = /* @__PURE__ */ makeSymbol("__translateVNode");
const DatetimePartsSymbol = /* @__PURE__ */ makeSymbol("__datetimeParts");
const NumberPartsSymbol = /* @__PURE__ */ makeSymbol("__numberParts");
const EnableEmitter = /* @__PURE__ */ makeSymbol("__enableEmitter");
const DisableEmitter = /* @__PURE__ */ makeSymbol("__disableEmitter");
const SetPluralRulesSymbol = makeSymbol("__setPluralRules");
const InejctWithOptionSymbol = /* @__PURE__ */ makeSymbol("__injectWithOption");
const DisposeSymbol = /* @__PURE__ */ makeSymbol("__dispose");
function handleFlatJson(obj) {
if (!isObject$1(obj)) {
return obj;
}
for (const key2 in obj) {
if (!hasOwn2(obj, key2)) {
continue;
}
if (!key2.includes(".")) {
if (isObject$1(obj[key2])) {
handleFlatJson(obj[key2]);
}
} else {
const subKeys = key2.split(".");
const lastIndex = subKeys.length - 1;
let currentObj = obj;
let hasStringValue = false;
for (let i2 = 0; i2 < lastIndex; i2++) {
if (!(subKeys[i2] in currentObj)) {
currentObj[subKeys[i2]] = {};
}
if (!isObject$1(currentObj[subKeys[i2]])) {
process.env.NODE_ENV !== "production" && warn(getWarnMessage(I18nWarnCodes.IGNORE_OBJ_FLATTEN, {
key: subKeys[i2]
}));
hasStringValue = true;
break;
}
currentObj = currentObj[subKeys[i2]];
}
if (!hasStringValue) {
currentObj[subKeys[lastIndex]] = obj[key2];
delete obj[key2];
}
if (isObject$1(currentObj[subKeys[lastIndex]])) {
handleFlatJson(currentObj[subKeys[lastIndex]]);
}
}
}
return obj;
}
function getLocaleMessages(locale3, options) {
const { messages: messages2, __i18n, messageResolver, flatJson } = options;
const ret = isPlainObject(messages2) ? messages2 : isArray(__i18n) ? {} : { [locale3]: {} };
if (isArray(__i18n)) {
__i18n.forEach((custom) => {
if ("locale" in custom && "resource" in custom) {
const { locale: locale4, resource } = custom;
if (locale4) {
ret[locale4] = ret[locale4] || {};
deepCopy(resource, ret[locale4]);
} else {
deepCopy(resource, ret);
}
} else {
isString$2(custom) && deepCopy(JSON.parse(custom), ret);
}
});
}
if (messageResolver == null && flatJson) {
for (const key2 in ret) {
if (hasOwn2(ret, key2)) {
handleFlatJson(ret[key2]);
}
}
}
return ret;
}
function getComponentOptions(instance) {
return instance.type;
}
function adjustI18nResources(gl, options, componentOptions) {
let messages2 = isObject$1(options.messages) ? options.messages : {};
if ("__i18nGlobal" in componentOptions) {
messages2 = getLocaleMessages(gl.locale.value, {
messages: messages2,
__i18n: componentOptions.__i18nGlobal
});
}
const locales = Object.keys(messages2);
if (locales.length) {
locales.forEach((locale3) => {
gl.mergeLocaleMessage(locale3, messages2[locale3]);
});
}
{
if (isObject$1(options.datetimeFormats)) {
const locales2 = Object.keys(options.datetimeFormats);
if (locales2.length) {
locales2.forEach((locale3) => {
gl.mergeDateTimeFormat(locale3, options.datetimeFormats[locale3]);
});
}
}
if (isObject$1(options.numberFormats)) {
const locales2 = Object.keys(options.numberFormats);
if (locales2.length) {
locales2.forEach((locale3) => {
gl.mergeNumberFormat(locale3, options.numberFormats[locale3]);
});
}
}
}
}
function createTextNode(key2) {
return createVNode(Text, null, key2, 0);
}
const DEVTOOLS_META = "__INTLIFY_META__";
const NOOP_RETURN_ARRAY = () => [];
const NOOP_RETURN_FALSE = () => false;
let composerID = 0;
function defineCoreMissingHandler(missing) {
return (ctx, locale3, key2, type) => {
return missing(locale3, key2, getCurrentInstance() || void 0, type);
};
}
const getMetaInfo = /* @__NO_SIDE_EFFECTS__ */ () => {
const instance = getCurrentInstance();
let meta = null;
return instance && (meta = getComponentOptions(instance)[DEVTOOLS_META]) ? { [DEVTOOLS_META]: meta } : null;
};
function createComposer(options = {}, VueI18nLegacy) {
const { __root, __injectWithOption } = options;
const _isGlobal = __root === void 0;
const flatJson = options.flatJson;
let _inheritLocale = isBoolean(options.inheritLocale) ? options.inheritLocale : true;
const _locale = ref(
// prettier-ignore
__root && _inheritLocale ? __root.locale.value : isString$2(options.locale) ? options.locale : DEFAULT_LOCALE
);
const _fallbackLocale = ref(
// prettier-ignore
__root && _inheritLocale ? __root.fallbackLocale.value : isString$2(options.fallbackLocale) || isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : _locale.value
);
const _messages = ref(getLocaleMessages(_locale.value, options));
const _datetimeFormats = ref(isPlainObject(options.datetimeFormats) ? options.datetimeFormats : { [_locale.value]: {} });
const _numberFormats = ref(isPlainObject(options.numberFormats) ? options.numberFormats : { [_locale.value]: {} });
let _missingWarn = __root ? __root.missingWarn : isBoolean(options.missingWarn) || isRegExp(options.missingWarn) ? options.missingWarn : true;
let _fallbackWarn = __root ? __root.fallbackWarn : isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn) ? options.fallbackWarn : true;
let _fallbackRoot = __root ? __root.fallbackRoot : isBoolean(options.fallbackRoot) ? options.fallbackRoot : true;
let _fallbackFormat = !!options.fallbackFormat;
let _missing = isFunction2(options.missing) ? options.missing : null;
let _runtimeMissing = isFunction2(options.missing) ? defineCoreMissingHandler(options.missing) : null;
let _postTranslation = isFunction2(options.postTranslation) ? options.postTranslation : null;
let _warnHtmlMessage = __root ? __root.warnHtmlMessage : isBoolean(options.warnHtmlMessage) ? options.warnHtmlMessage : true;
let _escapeParameter = !!options.escapeParameter;
const _modifiers = __root ? __root.modifiers : isPlainObject(options.modifiers) ? options.modifiers : {};
let _pluralRules = options.pluralRules || __root && __root.pluralRules;
let _context;
const getCoreContext = () => {
_isGlobal && setFallbackContext(null);
const ctxOptions = {
version: VERSION$1,
locale: _locale.value,
fallbackLocale: _fallbackLocale.value,
messages: _messages.value,
modifiers: _modifiers,
pluralRules: _pluralRules,
missing: _runtimeMissing === null ? void 0 : _runtimeMissing,
missingWarn: _missingWarn,
fallbackWarn: _fallbackWarn,
fallbackFormat: _fallbackFormat,
unresolving: true,
postTranslation: _postTranslation === null ? void 0 : _postTranslation,
warnHtmlMessage: _warnHtmlMessage,
escapeParameter: _escapeParameter,
messageResolver: options.messageResolver,
messageCompiler: options.messageCompiler,
__meta: { framework: "vue" }
};
{
ctxOptions.datetimeFormats = _datetimeFormats.value;
ctxOptions.numberFormats = _numberFormats.value;
ctxOptions.__datetimeFormatters = isPlainObject(_context) ? _context.__datetimeFormatters : void 0;
ctxOptions.__numberFormatters = isPlainObject(_context) ? _context.__numberFormatters : void 0;
}
if (process.env.NODE_ENV !== "production") {
ctxOptions.__v_emitter = isPlainObject(_context) ? _context.__v_emitter : void 0;
}
const ctx = createCoreContext(ctxOptions);
_isGlobal && setFallbackContext(ctx);
return ctx;
};
_context = getCoreContext();
updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);
function trackReactivityValues() {
return [
_locale.value,
_fallbackLocale.value,
_messages.value,
_datetimeFormats.value,
_numberFormats.value
];
}
const locale3 = computed({
get: () => _locale.value,
set: (val) => {
_locale.value = val;
_context.locale = _locale.value;
}
});
const fallbackLocale = computed({
get: () => _fallbackLocale.value,
set: (val) => {
_fallbackLocale.value = val;
_context.fallbackLocale = _fallbackLocale.value;
updateFallbackLocale(_context, _locale.value, val);
}
});
const messages2 = computed(() => _messages.value);
const datetimeFormats = /* @__PURE__ */ computed(() => _datetimeFormats.value);
const numberFormats = /* @__PURE__ */ computed(() => _numberFormats.value);
function getPostTranslationHandler() {
return isFunction2(_postTranslation) ? _postTranslation : null;
}
function setPostTranslationHandler(handler2) {
_postTranslation = handler2;
_context.postTranslation = handler2;
}
function getMissingHandler() {
return _missing;
}
function setMissingHandler(handler2) {
if (handler2 !== null) {
_runtimeMissing = defineCoreMissingHandler(handler2);
}
_missing = handler2;
_context.missing = _runtimeMissing;
}
function isResolvedTranslateMessage(type, arg) {
return type !== "translate" || !arg.resolvedMessage;
}
const wrapWithDeps = (fn, argumentParser, warnType, fallbackSuccess, fallbackFail, successCondition) => {
trackReactivityValues();
let ret;
try {
if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) {
/* @__PURE__ */ setAdditionalMeta(/* @__PURE__ */ getMetaInfo());
}
if (!_isGlobal) {
_context.fallbackContext = __root ? getFallbackContext() : void 0;
}
ret = fn(_context);
} finally {
if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__)
;
if (!_isGlobal) {
_context.fallbackContext = void 0;
}
}
if (warnType !== "translate exists" && // for not `te` (e.g `t`)
isNumber$1(ret) && ret === NOT_REOSLVED || warnType === "translate exists" && !ret) {
const [key2, arg2] = argumentParser();
if (process.env.NODE_ENV !== "production" && __root && isString$2(key2) && isResolvedTranslateMessage(warnType, arg2)) {
if (_fallbackRoot && (isTranslateFallbackWarn(_fallbackWarn, key2) || isTranslateMissingWarn(_missingWarn, key2))) {
warn(getWarnMessage(I18nWarnCodes.FALLBACK_TO_ROOT, {
key: key2,
type: warnType
}));
}
if (process.env.NODE_ENV !== "production") {
const { __v_emitter: emitter } = _context;
if (emitter && _fallbackRoot) {
emitter.emit("fallback", {
type: warnType,
key: key2,
to: "global",
groupId: `${warnType}:${key2}`
});
}
}
}
return __root && _fallbackRoot ? fallbackSuccess(__root) : fallbackFail(key2);
} else if (successCondition(ret)) {
return ret;
} else {
throw createI18nError(I18nErrorCodes.UNEXPECTED_RETURN_TYPE);
}
};
function t2(...args) {
return wrapWithDeps((context) => Reflect.apply(translate, null, [context, ...args]), () => parseTranslateArgs(...args), "translate", (root2) => Reflect.apply(root2.t, root2, [...args]), (key2) => key2, (val) => isString$2(val));
}
function rt(...args) {
const [arg1, arg2, arg3] = args;
if (arg3 && !isObject$1(arg3)) {
throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT);
}
return t2(...[arg1, arg2, assign$1({ resolvedMessage: true }, arg3 || {})]);
}
function d2(...args) {
return wrapWithDeps((context) => Reflect.apply(datetime, null, [context, ...args]), () => parseDateTimeArgs(...args), "datetime format", (root2) => Reflect.apply(root2.d, root2, [...args]), () => MISSING_RESOLVE_VALUE, (val) => isString$2(val));
}
function n2(...args) {
return wrapWithDeps((context) => Reflect.apply(number, null, [context, ...args]), () => parseNumberArgs(...args), "number format", (root2) => Reflect.apply(root2.n, root2, [...args]), () => MISSING_RESOLVE_VALUE, (val) => isString$2(val));
}
function normalize(values) {
return values.map((val) => isString$2(val) || isNumber$1(val) || isBoolean(val) ? createTextNode(String(val)) : val);
}
const interpolate = (val) => val;
const processor = {
normalize,
interpolate,
type: "vnode"
};
function translateVNode(...args) {
return wrapWithDeps(
(context) => {
let ret;
const _context2 = context;
try {
_context2.processor = processor;
ret = Reflect.apply(translate, null, [_context2, ...args]);
} finally {
_context2.processor = null;
}
return ret;
},
() => parseTranslateArgs(...args),
"translate",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(root2) => root2[TranslateVNodeSymbol](...args),
(key2) => [createTextNode(key2)],
(val) => isArray(val)
);
}
function numberParts(...args) {
return wrapWithDeps(
(context) => Reflect.apply(number, null, [context, ...args]),
() => parseNumberArgs(...args),
"number format",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(root2) => root2[NumberPartsSymbol](...args),
NOOP_RETURN_ARRAY,
(val) => isString$2(val) || isArray(val)
);
}
function datetimeParts(...args) {
return wrapWithDeps(
(context) => Reflect.apply(datetime, null, [context, ...args]),
() => parseDateTimeArgs(...args),
"datetime format",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(root2) => root2[DatetimePartsSymbol](...args),
NOOP_RETURN_ARRAY,
(val) => isString$2(val) || isArray(val)
);
}
function setPluralRules(rules) {
_pluralRules = rules;
_context.pluralRules = _pluralRules;
}
function te(key2, locale4) {
return wrapWithDeps(() => {
if (!key2) {
return false;
}
const targetLocale = isString$2(locale4) ? locale4 : _locale.value;
const message2 = getLocaleMessage(targetLocale);
const resolved = _context.messageResolver(message2, key2);
return isMessageAST(resolved) || isMessageFunction(resolved) || isString$2(resolved);
}, () => [key2], "translate exists", (root2) => {
return Reflect.apply(root2.te, root2, [key2, locale4]);
}, NOOP_RETURN_FALSE, (val) => isBoolean(val));
}
function resolveMessages(key2) {
let messages3 = null;
const locales = fallbackWithLocaleChain(_context, _fallbackLocale.value, _locale.value);
for (let i2 = 0; i2 < locales.length; i2++) {
const targetLocaleMessages = _messages.value[locales[i2]] || {};
const messageValue = _context.messageResolver(targetLocaleMessages, key2);
if (messageValue != null) {
messages3 = messageValue;
break;
}
}
return messages3;
}
function tm(key2) {
const messages3 = resolveMessages(key2);
return messages3 != null ? messages3 : __root ? __root.tm(key2) || {} : {};
}
function getLocaleMessage(locale4) {
return _messages.value[locale4] || {};
}
function setLocaleMessage(locale4, message2) {
if (flatJson) {
const _message = { [locale4]: message2 };
for (const key2 in _message) {
if (hasOwn2(_message, key2)) {
handleFlatJson(_message[key2]);
}
}
message2 = _message[locale4];
}
_messages.value[locale4] = message2;
_context.messages = _messages.value;
}
function mergeLocaleMessage(locale4, message2) {
_messages.value[locale4] = _messages.value[locale4] || {};
const _message = { [locale4]: message2 };
for (const key2 in _message) {
if (hasOwn2(_message, key2)) {
handleFlatJson(_message[key2]);
}
}
message2 = _message[locale4];
deepCopy(message2, _messages.value[locale4]);
_context.messages = _messages.value;
}
function getDateTimeFormat(locale4) {
return _datetimeFormats.value[locale4] || {};
}
function setDateTimeFormat(locale4, format3) {
_datetimeFormats.value[locale4] = format3;
_context.datetimeFormats = _datetimeFormats.value;
clearDateTimeFormat(_context, locale4, format3);
}
function mergeDateTimeFormat(locale4, format3) {
_datetimeFormats.value[locale4] = assign$1(_datetimeFormats.value[locale4] || {}, format3);
_context.datetimeFormats = _datetimeFormats.value;
clearDateTimeFormat(_context, locale4, format3);
}
function getNumberFormat(locale4) {
return _numberFormats.value[locale4] || {};
}
function setNumberFormat(locale4, format3) {
_numberFormats.value[locale4] = format3;
_context.numberFormats = _numberFormats.value;
clearNumberFormat(_context, locale4, format3);
}
function mergeNumberFormat(locale4, format3) {
_numberFormats.value[locale4] = assign$1(_numberFormats.value[locale4] || {}, format3);
_context.numberFormats = _numberFormats.value;
clearNumberFormat(_context, locale4, format3);
}
composerID++;
if (__root && inBrowser) {
watch(__root.locale, (val) => {
if (_inheritLocale) {
_locale.value = val;
_context.locale = val;
updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);
}
});
watch(__root.fallbackLocale, (val) => {
if (_inheritLocale) {
_fallbackLocale.value = val;
_context.fallbackLocale = val;
updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);
}
});
}
const composer = {
id: composerID,
locale: locale3,
fallbackLocale,
get inheritLocale() {
return _inheritLocale;
},
set inheritLocale(val) {
_inheritLocale = val;
if (val && __root) {
_locale.value = __root.locale.value;
_fallbackLocale.value = __root.fallbackLocale.value;
updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);
}
},
get availableLocales() {
return Object.keys(_messages.value).sort();
},
messages: messages2,
get modifiers() {
return _modifiers;
},
get pluralRules() {
return _pluralRules || {};
},
get isGlobal() {
return _isGlobal;
},
get missingWarn() {
return _missingWarn;
},
set missingWarn(val) {
_missingWarn = val;
_context.missingWarn = _missingWarn;
},
get fallbackWarn() {
return _fallbackWarn;
},
set fallbackWarn(val) {
_fallbackWarn = val;
_context.fallbackWarn = _fallbackWarn;
},
get fallbackRoot() {
return _fallbackRoot;
},
set fallbackRoot(val) {
_fallbackRoot = val;
},
get fallbackFormat() {
return _fallbackFormat;
},
set fallbackFormat(val) {
_fallbackFormat = val;
_context.fallbackFormat = _fallbackFormat;
},
get warnHtmlMessage() {
return _warnHtmlMessage;
},
set warnHtmlMessage(val) {
_warnHtmlMessage = val;
_context.warnHtmlMessage = val;
},
get escapeParameter() {
return _escapeParameter;
},
set escapeParameter(val) {
_escapeParameter = val;
_context.escapeParameter = val;
},
t: t2,
getLocaleMessage,
setLocaleMessage,
mergeLocaleMessage,
getPostTranslationHandler,
setPostTranslationHandler,
getMissingHandler,
setMissingHandler,
[SetPluralRulesSymbol]: setPluralRules
};
{
composer.datetimeFormats = datetimeFormats;
composer.numberFormats = numberFormats;
composer.rt = rt;
composer.te = te;
composer.tm = tm;
composer.d = d2;
composer.n = n2;
composer.getDateTimeFormat = getDateTimeFormat;
composer.setDateTimeFormat = setDateTimeFormat;
composer.mergeDateTimeFormat = mergeDateTimeFormat;
composer.getNumberFormat = getNumberFormat;
composer.setNumberFormat = setNumberFormat;
composer.mergeNumberFormat = mergeNumberFormat;
composer[InejctWithOptionSymbol] = __injectWithOption;
composer[TranslateVNodeSymbol] = translateVNode;
composer[DatetimePartsSymbol] = datetimeParts;
composer[NumberPartsSymbol] = numberParts;
}
if (process.env.NODE_ENV !== "production") {
composer[EnableEmitter] = (emitter) => {
_context.__v_emitter = emitter;
};
composer[DisableEmitter] = () => {
_context.__v_emitter = void 0;
};
}
return composer;
}
function convertComposerOptions(options) {
const locale3 = isString$2(options.locale) ? options.locale : DEFAULT_LOCALE;
const fallbackLocale = isString$2(options.fallbackLocale) || isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : locale3;
const missing = isFunction2(options.missing) ? options.missing : void 0;
const missingWarn = isBoolean(options.silentTranslationWarn) || isRegExp(options.silentTranslationWarn) ? !options.silentTranslationWarn : true;
const fallbackWarn = isBoolean(options.silentFallbackWarn) || isRegExp(options.silentFallbackWarn) ? !options.silentFallbackWarn : true;
const fallbackRoot = isBoolean(options.fallbackRoot) ? options.fallbackRoot : true;
const fallbackFormat = !!options.formatFallbackMessages;
const modifiers = isPlainObject(options.modifiers) ? options.modifiers : {};
const pluralizationRules = options.pluralizationRules;
const postTranslation = isFunction2(options.postTranslation) ? options.postTranslation : void 0;
const warnHtmlMessage = isString$2(options.warnHtmlInMessage) ? options.warnHtmlInMessage !== "off" : true;
const escapeParameter = !!options.escapeParameterHtml;
const inheritLocale = isBoolean(options.sync) ? options.sync : true;
if (process.env.NODE_ENV !== "production" && options.formatter) {
warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER));
}
if (process.env.NODE_ENV !== "production" && options.preserveDirectiveContent) {
warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE));
}
let messages2 = options.messages;
if (isPlainObject(options.sharedMessages)) {
const sharedMessages = options.sharedMessages;
const locales = Object.keys(sharedMessages);
messages2 = locales.reduce((messages3, locale4) => {
const message2 = messages3[locale4] || (messages3[locale4] = {});
assign$1(message2, sharedMessages[locale4]);
return messages3;
}, messages2 || {});
}
const { __i18n, __root, __injectWithOption } = options;
const datetimeFormats = options.datetimeFormats;
const numberFormats = options.numberFormats;
const flatJson = options.flatJson;
return {
locale: locale3,
fallbackLocale,
messages: messages2,
flatJson,
datetimeFormats,
numberFormats,
missing,
missingWarn,
fallbackWarn,
fallbackRoot,
fallbackFormat,
modifiers,
pluralRules: pluralizationRules,
postTranslation,
warnHtmlMessage,
escapeParameter,
messageResolver: options.messageResolver,
inheritLocale,
__i18n,
__root,
__injectWithOption
};
}
function createVueI18n(options = {}, VueI18nLegacy) {
{
const composer = createComposer(convertComposerOptions(options));
const { __extender } = options;
const vueI18n = {
// id
id: composer.id,
// locale
get locale() {
return composer.locale.value;
},
set locale(val) {
composer.locale.value = val;
},
// fallbackLocale
get fallbackLocale() {
return composer.fallbackLocale.value;
},
set fallbackLocale(val) {
composer.fallbackLocale.value = val;
},
// messages
get messages() {
return composer.messages.value;
},
// datetimeFormats
get datetimeFormats() {
return composer.datetimeFormats.value;
},
// numberFormats
get numberFormats() {
return composer.numberFormats.value;
},
// availableLocales
get availableLocales() {
return composer.availableLocales;
},
// formatter
get formatter() {
process.env.NODE_ENV !== "production" && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER));
return {
interpolate() {
return [];
}
};
},
set formatter(val) {
process.env.NODE_ENV !== "production" && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER));
},
// missing
get missing() {
return composer.getMissingHandler();
},
set missing(handler2) {
composer.setMissingHandler(handler2);
},
// silentTranslationWarn
get silentTranslationWarn() {
return isBoolean(composer.missingWarn) ? !composer.missingWarn : composer.missingWarn;
},
set silentTranslationWarn(val) {
composer.missingWarn = isBoolean(val) ? !val : val;
},
// silentFallbackWarn
get silentFallbackWarn() {
return isBoolean(composer.fallbackWarn) ? !composer.fallbackWarn : composer.fallbackWarn;
},
set silentFallbackWarn(val) {
composer.fallbackWarn = isBoolean(val) ? !val : val;
},
// modifiers
get modifiers() {
return composer.modifiers;
},
// formatFallbackMessages
get formatFallbackMessages() {
return composer.fallbackFormat;
},
set formatFallbackMessages(val) {
composer.fallbackFormat = val;
},
// postTranslation
get postTranslation() {
return composer.getPostTranslationHandler();
},
set postTranslation(handler2) {
composer.setPostTranslationHandler(handler2);
},
// sync
get sync() {
return composer.inheritLocale;
},
set sync(val) {
composer.inheritLocale = val;
},
// warnInHtmlMessage
get warnHtmlInMessage() {
return composer.warnHtmlMessage ? "warn" : "off";
},
set warnHtmlInMessage(val) {
composer.warnHtmlMessage = val !== "off";
},
// escapeParameterHtml
get escapeParameterHtml() {
return composer.escapeParameter;
},
set escapeParameterHtml(val) {
composer.escapeParameter = val;
},
// preserveDirectiveContent
get preserveDirectiveContent() {
process.env.NODE_ENV !== "production" && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE));
return true;
},
set preserveDirectiveContent(val) {
process.env.NODE_ENV !== "production" && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE));
},
// pluralizationRules
get pluralizationRules() {
return composer.pluralRules || {};
},
// for internal
__composer: composer,
// t
t(...args) {
const [arg1, arg2, arg3] = args;
const options2 = {};
let list = null;
let named = null;
if (!isString$2(arg1)) {
throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT);
}
const key2 = arg1;
if (isString$2(arg2)) {
options2.locale = arg2;
} else if (isArray(arg2)) {
list = arg2;
} else if (isPlainObject(arg2)) {
named = arg2;
}
if (isArray(arg3)) {
list = arg3;
} else if (isPlainObject(arg3)) {
named = arg3;
}
return Reflect.apply(composer.t, composer, [
key2,
list || named || {},
options2
]);
},
rt(...args) {
return Reflect.apply(composer.rt, composer, [...args]);
},
// tc
tc(...args) {
const [arg1, arg2, arg3] = args;
const options2 = { plural: 1 };
let list = null;
let named = null;
if (!isString$2(arg1)) {
throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT);
}
const key2 = arg1;
if (isString$2(arg2)) {
options2.locale = arg2;
} else if (isNumber$1(arg2)) {
options2.plural = arg2;
} else if (isArray(arg2)) {
list = arg2;
} else if (isPlainObject(arg2)) {
named = arg2;
}
if (isString$2(arg3)) {
options2.locale = arg3;
} else if (isArray(arg3)) {
list = arg3;
} else if (isPlainObject(arg3)) {
named = arg3;
}
return Reflect.apply(composer.t, composer, [
key2,
list || named || {},
options2
]);
},
// te
te(key2, locale3) {
return composer.te(key2, locale3);
},
// tm
tm(key2) {
return composer.tm(key2);
},
// getLocaleMessage
getLocaleMessage(locale3) {
return composer.getLocaleMessage(locale3);
},
// setLocaleMessage
setLocaleMessage(locale3, message2) {
composer.setLocaleMessage(locale3, message2);
},
// mergeLocaleMessage
mergeLocaleMessage(locale3, message2) {
composer.mergeLocaleMessage(locale3, message2);
},
// d
d(...args) {
return Reflect.apply(composer.d, composer, [...args]);
},
// getDateTimeFormat
getDateTimeFormat(locale3) {
return composer.getDateTimeFormat(locale3);
},
// setDateTimeFormat
setDateTimeFormat(locale3, format3) {
composer.setDateTimeFormat(locale3, format3);
},
// mergeDateTimeFormat
mergeDateTimeFormat(locale3, format3) {
composer.mergeDateTimeFormat(locale3, format3);
},
// n
n(...args) {
return Reflect.apply(composer.n, composer, [...args]);
},
// getNumberFormat
getNumberFormat(locale3) {
return composer.getNumberFormat(locale3);
},
// setNumberFormat
setNumberFormat(locale3, format3) {
composer.setNumberFormat(locale3, format3);
},
// mergeNumberFormat
mergeNumberFormat(locale3, format3) {
composer.mergeNumberFormat(locale3, format3);
},
// getChoiceIndex
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getChoiceIndex(choice, choicesLength) {
process.env.NODE_ENV !== "production" && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_GET_CHOICE_INDEX));
return -1;
}
};
vueI18n.__extender = __extender;
if (process.env.NODE_ENV !== "production") {
vueI18n.__enableEmitter = (emitter) => {
const __composer = composer;
__composer[EnableEmitter] && __composer[EnableEmitter](emitter);
};
vueI18n.__disableEmitter = () => {
const __composer = composer;
__composer[DisableEmitter] && __composer[DisableEmitter]();
};
}
return vueI18n;
}
}
const baseFormatProps = {
tag: {
type: [String, Object]
},
locale: {
type: String
},
scope: {
type: String,
// NOTE: avoid https://github.com/microsoft/rushstack/issues/1050
validator: (val) => val === "parent" || val === "global",
default: "parent"
/* ComponentI18nScope */
},
i18n: {
type: Object
}
};
function getInterpolateArg({ slots }, keys2) {
if (keys2.length === 1 && keys2[0] === "default") {
const ret = slots.default ? slots.default() : [];
return ret.reduce((slot, current) => {
return [
...slot,
// prettier-ignore
...current.type === Fragment ? current.children : [current]
];
}, []);
} else {
return keys2.reduce((arg, key2) => {
const slot = slots[key2];
if (slot) {
arg[key2] = slot();
}
return arg;
}, {});
}
}
function getFragmentableTag(tag) {
return Fragment;
}
const TranslationImpl = /* @__PURE__ */ defineComponent({
/* eslint-disable */
name: "i18n-t",
props: assign$1({
keypath: {
type: String,
required: true
},
plural: {
type: [Number, String],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
validator: (val) => isNumber$1(val) || !isNaN(val)
}
}, baseFormatProps),
/* eslint-enable */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
setup(props3, context) {
const { slots, attrs } = context;
const i18n2 = props3.i18n || useI18n({
useScope: props3.scope,
__useComponent: true
});
return () => {
const keys2 = Object.keys(slots).filter((key2) => key2 !== "_");
const options = {};
if (props3.locale) {
options.locale = props3.locale;
}
if (props3.plural !== void 0) {
options.plural = isString$2(props3.plural) ? +props3.plural : props3.plural;
}
const arg = getInterpolateArg(context, keys2);
const children = i18n2[TranslateVNodeSymbol](props3.keypath, arg, options);
const assignedAttrs = assign$1({}, attrs);
const tag = isString$2(props3.tag) || isObject$1(props3.tag) ? props3.tag : getFragmentableTag();
return h$1(tag, assignedAttrs, children);
};
}
});
const Translation = TranslationImpl;
function isVNode(target) {
return isArray(target) && !isString$2(target[0]);
}
function renderFormatter(props3, context, slotKeys, partFormatter) {
const { slots, attrs } = context;
return () => {
const options = { part: true };
let overrides = {};
if (props3.locale) {
options.locale = props3.locale;
}
if (isString$2(props3.format)) {
options.key = props3.format;
} else if (isObject$1(props3.format)) {
if (isString$2(props3.format.key)) {
options.key = props3.format.key;
}
overrides = Object.keys(props3.format).reduce((options2, prop) => {
return slotKeys.includes(prop) ? assign$1({}, options2, { [prop]: props3.format[prop] }) : options2;
}, {});
}
const parts = partFormatter(...[props3.value, options, overrides]);
let children = [options.key];
if (isArray(parts)) {
children = parts.map((part, index2) => {
const slot = slots[part.type];
const node = slot ? slot({ [part.type]: part.value, index: index2, parts }) : [part.value];
if (isVNode(node)) {
node[0].key = `${part.type}-${index2}`;
}
return node;
});
} else if (isString$2(parts)) {
children = [parts];
}
const assignedAttrs = assign$1({}, attrs);
const tag = isString$2(props3.tag) || isObject$1(props3.tag) ? props3.tag : getFragmentableTag();
return h$1(tag, assignedAttrs, children);
};
}
const NumberFormatImpl = /* @__PURE__ */ defineComponent({
/* eslint-disable */
name: "i18n-n",
props: assign$1({
value: {
type: Number,
required: true
},
format: {
type: [String, Object]
}
}, baseFormatProps),
/* eslint-enable */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
setup(props3, context) {
const i18n2 = props3.i18n || useI18n({
useScope: "parent",
__useComponent: true
});
return renderFormatter(props3, context, NUMBER_FORMAT_OPTIONS_KEYS, (...args) => (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n2[NumberPartsSymbol](...args)
));
}
});
const NumberFormat = NumberFormatImpl;
const DatetimeFormatImpl = /* @__PURE__ */ defineComponent({
/* eslint-disable */
name: "i18n-d",
props: assign$1({
value: {
type: [Number, Date],
required: true
},
format: {
type: [String, Object]
}
}, baseFormatProps),
/* eslint-enable */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
setup(props3, context) {
const i18n2 = props3.i18n || useI18n({
useScope: "parent",
__useComponent: true
});
return renderFormatter(props3, context, DATETIME_FORMAT_OPTIONS_KEYS, (...args) => (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n2[DatetimePartsSymbol](...args)
));
}
});
const DatetimeFormat = DatetimeFormatImpl;
function getComposer$2(i18n2, instance) {
const i18nInternal = i18n2;
if (i18n2.mode === "composition") {
return i18nInternal.__getInstance(instance) || i18n2.global;
} else {
const vueI18n = i18nInternal.__getInstance(instance);
return vueI18n != null ? vueI18n.__composer : i18n2.global.__composer;
}
}
function vTDirective(i18n2) {
const _process = (binding) => {
const { instance, modifiers, value: value2 } = binding;
if (!instance || !instance.$) {
throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);
}
const composer = getComposer$2(i18n2, instance.$);
if (process.env.NODE_ENV !== "production" && modifiers.preserve) {
warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE));
}
const parsedValue = parseValue(value2);
return [
Reflect.apply(composer.t, composer, [...makeParams(parsedValue)]),
composer
];
};
const register2 = (el, binding) => {
const [textContent, composer] = _process(binding);
if (inBrowser && i18n2.global === composer) {
el.__i18nWatcher = watch(composer.locale, () => {
binding.instance && binding.instance.$forceUpdate();
});
}
el.__composer = composer;
el.textContent = textContent;
};
const unregister2 = (el) => {
if (inBrowser && el.__i18nWatcher) {
el.__i18nWatcher();
el.__i18nWatcher = void 0;
delete el.__i18nWatcher;
}
if (el.__composer) {
el.__composer = void 0;
delete el.__composer;
}
};
const update = (el, { value: value2 }) => {
if (el.__composer) {
const composer = el.__composer;
const parsedValue = parseValue(value2);
el.textContent = Reflect.apply(composer.t, composer, [
...makeParams(parsedValue)
]);
}
};
const getSSRProps = (binding) => {
const [textContent] = _process(binding);
return { textContent };
};
return {
created: register2,
unmounted: unregister2,
beforeUpdate: update,
getSSRProps
};
}
function parseValue(value2) {
if (isString$2(value2)) {
return { path: value2 };
} else if (isPlainObject(value2)) {
if (!("path" in value2)) {
throw createI18nError(I18nErrorCodes.REQUIRED_VALUE, "path");
}
return value2;
} else {
throw createI18nError(I18nErrorCodes.INVALID_VALUE);
}
}
function makeParams(value2) {
const { path, locale: locale3, args, choice, plural } = value2;
const options = {};
const named = args || {};
if (isString$2(locale3)) {
options.locale = locale3;
}
if (isNumber$1(choice)) {
options.plural = choice;
}
if (isNumber$1(plural)) {
options.plural = plural;
}
return [path, named, options];
}
function apply(app, i18n2, ...options) {
const pluginOptions = isPlainObject(options[0]) ? options[0] : {};
const useI18nComponentName = !!pluginOptions.useI18nComponentName;
const globalInstall = isBoolean(pluginOptions.globalInstall) ? pluginOptions.globalInstall : true;
if (process.env.NODE_ENV !== "production" && globalInstall && useI18nComponentName) {
warn(getWarnMessage(I18nWarnCodes.COMPONENT_NAME_LEGACY_COMPATIBLE, {
name: Translation.name
}));
}
if (globalInstall) {
[!useI18nComponentName ? Translation.name : "i18n", "I18nT"].forEach((name) => app.component(name, Translation));
[NumberFormat.name, "I18nN"].forEach((name) => app.component(name, NumberFormat));
[DatetimeFormat.name, "I18nD"].forEach((name) => app.component(name, DatetimeFormat));
}
{
app.directive("t", vTDirective(i18n2));
}
}
const VueDevToolsLabels = {
[
"vue-devtools-plugin-vue-i18n"
/* VueDevToolsIDs.PLUGIN */
]: "Vue I18n devtools",
[
"vue-i18n-resource-inspector"
/* VueDevToolsIDs.CUSTOM_INSPECTOR */
]: "I18n Resources",
[
"vue-i18n-timeline"
/* VueDevToolsIDs.TIMELINE */
]: "Vue I18n"
};
const VueDevToolsPlaceholders = {
[
"vue-i18n-resource-inspector"
/* VueDevToolsIDs.CUSTOM_INSPECTOR */
]: "Search for scopes ..."
};
const VueDevToolsTimelineColors = {
[
"vue-i18n-timeline"
/* VueDevToolsIDs.TIMELINE */
]: 16764185
};
const VUE_I18N_COMPONENT_TYPES = "vue-i18n: composer properties";
let devtoolsApi;
async function enableDevTools(app, i18n2) {
return new Promise((resolve, reject) => {
try {
setupDevtoolsPlugin({
id: "vue-devtools-plugin-vue-i18n",
label: VueDevToolsLabels[
"vue-devtools-plugin-vue-i18n"
/* VueDevToolsIDs.PLUGIN */
],
packageName: "vue-i18n",
homepage: "https://vue-i18n.intlify.dev",
logo: "https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",
componentStateTypes: [VUE_I18N_COMPONENT_TYPES],
app
// eslint-disable-line @typescript-eslint/no-explicit-any
}, (api2) => {
devtoolsApi = api2;
api2.on.visitComponentTree(({ componentInstance, treeNode }) => {
updateComponentTreeTags(componentInstance, treeNode, i18n2);
});
api2.on.inspectComponent(({ componentInstance, instanceData }) => {
if (componentInstance.vnode.el && componentInstance.vnode.el.__VUE_I18N__ && instanceData) {
if (i18n2.mode === "legacy") {
if (componentInstance.vnode.el.__VUE_I18N__ !== i18n2.global.__composer) {
inspectComposer(instanceData, componentInstance.vnode.el.__VUE_I18N__);
}
} else {
inspectComposer(instanceData, componentInstance.vnode.el.__VUE_I18N__);
}
}
});
api2.addInspector({
id: "vue-i18n-resource-inspector",
label: VueDevToolsLabels[
"vue-i18n-resource-inspector"
/* VueDevToolsIDs.CUSTOM_INSPECTOR */
],
icon: "language",
treeFilterPlaceholder: VueDevToolsPlaceholders[
"vue-i18n-resource-inspector"
/* VueDevToolsIDs.CUSTOM_INSPECTOR */
]
});
api2.on.getInspectorTree((payload) => {
if (payload.app === app && payload.inspectorId === "vue-i18n-resource-inspector") {
registerScope(payload, i18n2);
}
});
const roots = /* @__PURE__ */ new Map();
api2.on.getInspectorState(async (payload) => {
if (payload.app === app && payload.inspectorId === "vue-i18n-resource-inspector") {
api2.unhighlightElement();
inspectScope(payload, i18n2);
if (payload.nodeId === "global") {
if (!roots.has(payload.app)) {
const [root2] = await api2.getComponentInstances(payload.app);
roots.set(payload.app, root2);
}
api2.highlightElement(roots.get(payload.app));
} else {
const instance = getComponentInstance(payload.nodeId, i18n2);
instance && api2.highlightElement(instance);
}
}
});
api2.on.editInspectorState((payload) => {
if (payload.app === app && payload.inspectorId === "vue-i18n-resource-inspector") {
editScope(payload, i18n2);
}
});
api2.addTimelineLayer({
id: "vue-i18n-timeline",
label: VueDevToolsLabels[
"vue-i18n-timeline"
/* VueDevToolsIDs.TIMELINE */
],
color: VueDevToolsTimelineColors[
"vue-i18n-timeline"
/* VueDevToolsIDs.TIMELINE */
]
});
resolve(true);
});
} catch (e2) {
console.error(e2);
reject(false);
}
});
}
function getI18nScopeLable(instance) {
return instance.type.name || instance.type.displayName || instance.type.__file || "Anonymous";
}
function updateComponentTreeTags(instance, treeNode, i18n2) {
const global2 = i18n2.mode === "composition" ? i18n2.global : i18n2.global.__composer;
if (instance && instance.vnode.el && instance.vnode.el.__VUE_I18N__) {
if (instance.vnode.el.__VUE_I18N__ !== global2) {
const tag = {
label: `i18n (${getI18nScopeLable(instance)} Scope)`,
textColor: 0,
backgroundColor: 16764185
};
treeNode.tags.push(tag);
}
}
}
function inspectComposer(instanceData, composer) {
const type = VUE_I18N_COMPONENT_TYPES;
instanceData.state.push({
type,
key: "locale",
editable: true,
value: composer.locale.value
});
instanceData.state.push({
type,
key: "availableLocales",
editable: false,
value: composer.availableLocales
});
instanceData.state.push({
type,
key: "fallbackLocale",
editable: true,
value: composer.fallbackLocale.value
});
instanceData.state.push({
type,
key: "inheritLocale",
editable: true,
value: composer.inheritLocale
});
instanceData.state.push({
type,
key: "messages",
editable: false,
value: getLocaleMessageValue(composer.messages.value)
});
{
instanceData.state.push({
type,
key: "datetimeFormats",
editable: false,
value: composer.datetimeFormats.value
});
instanceData.state.push({
type,
key: "numberFormats",
editable: false,
value: composer.numberFormats.value
});
}
}
function getLocaleMessageValue(messages2) {
const value2 = {};
Object.keys(messages2).forEach((key2) => {
const v2 = messages2[key2];
if (isFunction2(v2) && "source" in v2) {
value2[key2] = getMessageFunctionDetails(v2);
} else if (isMessageAST(v2) && v2.loc && v2.loc.source) {
value2[key2] = v2.loc.source;
} else if (isObject$1(v2)) {
value2[key2] = getLocaleMessageValue(v2);
} else {
value2[key2] = v2;
}
});
return value2;
}
const ESC = {
"<": "<",
">": ">",
'"': """,
"&": "&"
};
function escape(s2) {
return s2.replace(/[<>"&]/g, escapeChar);
}
function escapeChar(a2) {
return ESC[a2] || a2;
}
function getMessageFunctionDetails(func) {
const argString = func.source ? `("${escape(func.source)}")` : `(?)`;
return {
_custom: {
type: "function",
display: `<span>ƒ</span> ${argString}`
}
};
}
function registerScope(payload, i18n2) {
payload.rootNodes.push({
id: "global",
label: "Global Scope"
});
const global2 = i18n2.mode === "composition" ? i18n2.global : i18n2.global.__composer;
for (const [keyInstance, instance] of i18n2.__instances) {
const composer = i18n2.mode === "composition" ? instance : instance.__composer;
if (global2 === composer) {
continue;
}
payload.rootNodes.push({
id: composer.id.toString(),
label: `${getI18nScopeLable(keyInstance)} Scope`
});
}
}
function getComponentInstance(nodeId, i18n2) {
let instance = null;
if (nodeId !== "global") {
for (const [component, composer] of i18n2.__instances.entries()) {
if (composer.id.toString() === nodeId) {
instance = component;
break;
}
}
}
return instance;
}
function getComposer$1(nodeId, i18n2) {
if (nodeId === "global") {
return i18n2.mode === "composition" ? i18n2.global : i18n2.global.__composer;
} else {
const instance = Array.from(i18n2.__instances.values()).find((item) => item.id.toString() === nodeId);
if (instance) {
return i18n2.mode === "composition" ? instance : instance.__composer;
} else {
return null;
}
}
}
function inspectScope(payload, i18n2) {
const composer = getComposer$1(payload.nodeId, i18n2);
if (composer) {
payload.state = makeScopeInspectState(composer);
}
return null;
}
function makeScopeInspectState(composer) {
const state = {};
const localeType = "Locale related info";
const localeStates = [
{
type: localeType,
key: "locale",
editable: true,
value: composer.locale.value
},
{
type: localeType,
key: "fallbackLocale",
editable: true,
value: composer.fallbackLocale.value
},
{
type: localeType,
key: "availableLocales",
editable: false,
value: composer.availableLocales
},
{
type: localeType,
key: "inheritLocale",
editable: true,
value: composer.inheritLocale
}
];
state[localeType] = localeStates;
const localeMessagesType = "Locale messages info";
const localeMessagesStates = [
{
type: localeMessagesType,
key: "messages",
editable: false,
value: getLocaleMessageValue(composer.messages.value)
}
];
state[localeMessagesType] = localeMessagesStates;
{
const datetimeFormatsType = "Datetime formats info";
const datetimeFormatsStates = [
{
type: datetimeFormatsType,
key: "datetimeFormats",
editable: false,
value: composer.datetimeFormats.value
}
];
state[datetimeFormatsType] = datetimeFormatsStates;
const numberFormatsType = "Datetime formats info";
const numberFormatsStates = [
{
type: numberFormatsType,
key: "numberFormats",
editable: false,
value: composer.numberFormats.value
}
];
state[numberFormatsType] = numberFormatsStates;
}
return state;
}
function addTimelineEvent(event, payload) {
if (devtoolsApi) {
let groupId;
if (payload && "groupId" in payload) {
groupId = payload.groupId;
delete payload.groupId;
}
devtoolsApi.addTimelineEvent({
layerId: "vue-i18n-timeline",
event: {
title: event,
groupId,
time: Date.now(),
meta: {},
data: payload || {},
logType: event === "compile-error" ? "error" : event === "fallback" || event === "missing" ? "warning" : "default"
}
});
}
}
function editScope(payload, i18n2) {
const composer = getComposer$1(payload.nodeId, i18n2);
if (composer) {
const [field] = payload.path;
if (field === "locale" && isString$2(payload.state.value)) {
composer.locale.value = payload.state.value;
} else if (field === "fallbackLocale" && (isString$2(payload.state.value) || isArray(payload.state.value) || isObject$1(payload.state.value))) {
composer.fallbackLocale.value = payload.state.value;
} else if (field === "inheritLocale" && isBoolean(payload.state.value)) {
composer.inheritLocale = payload.state.value;
}
}
}
function defineMixin(vuei18n, composer, i18n2) {
return {
beforeCreate() {
const instance = getCurrentInstance();
if (!instance) {
throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);
}
const options = this.$options;
if (options.i18n) {
const optionsI18n = options.i18n;
if (options.__i18n) {
optionsI18n.__i18n = options.__i18n;
}
optionsI18n.__root = composer;
if (this === this.$root) {
this.$i18n = mergeToGlobal(vuei18n, optionsI18n);
} else {
optionsI18n.__injectWithOption = true;
optionsI18n.__extender = i18n2.__vueI18nExtend;
this.$i18n = createVueI18n(optionsI18n);
const _vueI18n = this.$i18n;
if (_vueI18n.__extender) {
_vueI18n.__disposer = _vueI18n.__extender(this.$i18n);
}
}
} else if (options.__i18n) {
if (this === this.$root) {
this.$i18n = mergeToGlobal(vuei18n, options);
} else {
this.$i18n = createVueI18n({
__i18n: options.__i18n,
__injectWithOption: true,
__extender: i18n2.__vueI18nExtend,
__root: composer
});
const _vueI18n = this.$i18n;
if (_vueI18n.__extender) {
_vueI18n.__disposer = _vueI18n.__extender(this.$i18n);
}
}
} else {
this.$i18n = vuei18n;
}
if (options.__i18nGlobal) {
adjustI18nResources(composer, options, options);
}
this.$t = (...args) => this.$i18n.t(...args);
this.$rt = (...args) => this.$i18n.rt(...args);
this.$tc = (...args) => this.$i18n.tc(...args);
this.$te = (key2, locale3) => this.$i18n.te(key2, locale3);
this.$d = (...args) => this.$i18n.d(...args);
this.$n = (...args) => this.$i18n.n(...args);
this.$tm = (key2) => this.$i18n.tm(key2);
i18n2.__setInstance(instance, this.$i18n);
},
mounted() {
if ((process.env.NODE_ENV !== "production" || false) && true && this.$el && this.$i18n) {
const _vueI18n = this.$i18n;
this.$el.__VUE_I18N__ = _vueI18n.__composer;
const emitter = this.__v_emitter = createEmitter();
_vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter);
emitter.on("*", addTimelineEvent);
}
},
unmounted() {
const instance = getCurrentInstance();
if (!instance) {
throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);
}
const _vueI18n = this.$i18n;
if ((process.env.NODE_ENV !== "production" || false) && true && this.$el && this.$el.__VUE_I18N__) {
if (this.__v_emitter) {
this.__v_emitter.off("*", addTimelineEvent);
delete this.__v_emitter;
}
if (this.$i18n) {
_vueI18n.__disableEmitter && _vueI18n.__disableEmitter();
delete this.$el.__VUE_I18N__;
}
}
delete this.$t;
delete this.$rt;
delete this.$tc;
delete this.$te;
delete this.$d;
delete this.$n;
delete this.$tm;
if (_vueI18n.__disposer) {
_vueI18n.__disposer();
delete _vueI18n.__disposer;
delete _vueI18n.__extender;
}
i18n2.__deleteInstance(instance);
delete this.$i18n;
}
};
}
function mergeToGlobal(g2, options) {
g2.locale = options.locale || g2.locale;
g2.fallbackLocale = options.fallbackLocale || g2.fallbackLocale;
g2.missing = options.missing || g2.missing;
g2.silentTranslationWarn = options.silentTranslationWarn || g2.silentFallbackWarn;
g2.silentFallbackWarn = options.silentFallbackWarn || g2.silentFallbackWarn;
g2.formatFallbackMessages = options.formatFallbackMessages || g2.formatFallbackMessages;
g2.postTranslation = options.postTranslation || g2.postTranslation;
g2.warnHtmlInMessage = options.warnHtmlInMessage || g2.warnHtmlInMessage;
g2.escapeParameterHtml = options.escapeParameterHtml || g2.escapeParameterHtml;
g2.sync = options.sync || g2.sync;
g2.__composer[SetPluralRulesSymbol](options.pluralizationRules || g2.pluralizationRules);
const messages2 = getLocaleMessages(g2.locale, {
messages: options.messages,
__i18n: options.__i18n
});
Object.keys(messages2).forEach((locale3) => g2.mergeLocaleMessage(locale3, messages2[locale3]));
if (options.datetimeFormats) {
Object.keys(options.datetimeFormats).forEach((locale3) => g2.mergeDateTimeFormat(locale3, options.datetimeFormats[locale3]));
}
if (options.numberFormats) {
Object.keys(options.numberFormats).forEach((locale3) => g2.mergeNumberFormat(locale3, options.numberFormats[locale3]));
}
return g2;
}
const I18nInjectionKey = /* @__PURE__ */ makeSymbol("global-vue-i18n");
function createI18n(options = {}, VueI18nLegacy) {
const __legacyMode = __VUE_I18N_LEGACY_API__ && isBoolean(options.legacy) ? options.legacy : __VUE_I18N_LEGACY_API__;
const __globalInjection = isBoolean(options.globalInjection) ? options.globalInjection : true;
const __allowComposition = __VUE_I18N_LEGACY_API__ && __legacyMode ? !!options.allowComposition : true;
const __instances = /* @__PURE__ */ new Map();
const [globalScope, __global] = createGlobal(options, __legacyMode);
const symbol = /* @__PURE__ */ makeSymbol(process.env.NODE_ENV !== "production" ? "vue-i18n" : "");
if (process.env.NODE_ENV !== "production") {
if (__legacyMode && __allowComposition && true) {
warn(getWarnMessage(I18nWarnCodes.NOTICE_DROP_ALLOW_COMPOSITION));
}
}
function __getInstance(component) {
return __instances.get(component) || null;
}
function __setInstance(component, instance) {
__instances.set(component, instance);
}
function __deleteInstance(component) {
__instances.delete(component);
}
{
const i18n2 = {
// mode
get mode() {
return __VUE_I18N_LEGACY_API__ && __legacyMode ? "legacy" : "composition";
},
// allowComposition
get allowComposition() {
return __allowComposition;
},
// install plugin
async install(app, ...options2) {
if ((process.env.NODE_ENV !== "production" || false) && true) {
app.__VUE_I18N__ = i18n2;
}
app.__VUE_I18N_SYMBOL__ = symbol;
app.provide(app.__VUE_I18N_SYMBOL__, i18n2);
if (isPlainObject(options2[0])) {
const opts = options2[0];
i18n2.__composerExtend = opts.__composerExtend;
i18n2.__vueI18nExtend = opts.__vueI18nExtend;
}
let globalReleaseHandler = null;
if (!__legacyMode && __globalInjection) {
globalReleaseHandler = injectGlobalFields(app, i18n2.global);
}
if (__VUE_I18N_FULL_INSTALL__) {
apply(app, i18n2, ...options2);
}
if (__VUE_I18N_LEGACY_API__ && __legacyMode) {
app.mixin(defineMixin(__global, __global.__composer, i18n2));
}
const unmountApp = app.unmount;
app.unmount = () => {
globalReleaseHandler && globalReleaseHandler();
i18n2.dispose();
unmountApp();
};
if ((process.env.NODE_ENV !== "production" || false) && true) {
const ret = await enableDevTools(app, i18n2);
if (!ret) {
throw createI18nError(I18nErrorCodes.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);
}
const emitter = createEmitter();
if (__legacyMode) {
const _vueI18n = __global;
_vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter);
} else {
const _composer = __global;
_composer[EnableEmitter] && _composer[EnableEmitter](emitter);
}
emitter.on("*", addTimelineEvent);
}
},
// global accessor
get global() {
return __global;
},
dispose() {
globalScope.stop();
},
// @internal
__instances,
// @internal
__getInstance,
// @internal
__setInstance,
// @internal
__deleteInstance
};
return i18n2;
}
}
function useI18n(options = {}) {
const instance = getCurrentInstance();
if (instance == null) {
throw createI18nError(I18nErrorCodes.MUST_BE_CALL_SETUP_TOP);
}
if (!instance.isCE && instance.appContext.app != null && !instance.appContext.app.__VUE_I18N_SYMBOL__) {
throw createI18nError(I18nErrorCodes.NOT_INSTALLED);
}
const i18n2 = getI18nInstance(instance);
const gl = getGlobalComposer(i18n2);
const componentOptions = getComponentOptions(instance);
const scope = getScope(options, componentOptions);
if (__VUE_I18N_LEGACY_API__) {
if (i18n2.mode === "legacy" && !options.__useComponent) {
if (!i18n2.allowComposition) {
throw createI18nError(I18nErrorCodes.NOT_AVAILABLE_IN_LEGACY_MODE);
}
return useI18nForLegacy(instance, scope, gl, options);
}
}
if (scope === "global") {
adjustI18nResources(gl, options, componentOptions);
return gl;
}
if (scope === "parent") {
let composer2 = getComposer(i18n2, instance, options.__useComponent);
if (composer2 == null) {
if (process.env.NODE_ENV !== "production") {
warn(getWarnMessage(I18nWarnCodes.NOT_FOUND_PARENT_SCOPE));
}
composer2 = gl;
}
return composer2;
}
const i18nInternal = i18n2;
let composer = i18nInternal.__getInstance(instance);
if (composer == null) {
const composerOptions = assign$1({}, options);
if ("__i18n" in componentOptions) {
composerOptions.__i18n = componentOptions.__i18n;
}
if (gl) {
composerOptions.__root = gl;
}
composer = createComposer(composerOptions);
if (i18nInternal.__composerExtend) {
composer[DisposeSymbol] = i18nInternal.__composerExtend(composer);
}
setupLifeCycle(i18nInternal, instance, composer);
i18nInternal.__setInstance(instance, composer);
}
return composer;
}
function createGlobal(options, legacyMode, VueI18nLegacy) {
const scope = effectScope();
{
const obj = __VUE_I18N_LEGACY_API__ && legacyMode ? scope.run(() => createVueI18n(options)) : scope.run(() => createComposer(options));
if (obj == null) {
throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);
}
return [scope, obj];
}
}
function getI18nInstance(instance) {
{
const i18n2 = inject(!instance.isCE ? instance.appContext.app.__VUE_I18N_SYMBOL__ : I18nInjectionKey);
if (!i18n2) {
throw createI18nError(!instance.isCE ? I18nErrorCodes.UNEXPECTED_ERROR : I18nErrorCodes.NOT_INSTALLED_WITH_PROVIDE);
}
return i18n2;
}
}
function getScope(options, componentOptions) {
return isEmptyObject(options) ? "__i18n" in componentOptions ? "local" : "global" : !options.useScope ? "local" : options.useScope;
}
function getGlobalComposer(i18n2) {
return i18n2.mode === "composition" ? i18n2.global : i18n2.global.__composer;
}
function getComposer(i18n2, target, useComponent = false) {
let composer = null;
const root2 = target.root;
let current = getParentComponentInstance(target, useComponent);
while (current != null) {
const i18nInternal = i18n2;
if (i18n2.mode === "composition") {
composer = i18nInternal.__getInstance(current);
} else {
if (__VUE_I18N_LEGACY_API__) {
const vueI18n = i18nInternal.__getInstance(current);
if (vueI18n != null) {
composer = vueI18n.__composer;
if (useComponent && composer && !composer[InejctWithOptionSymbol]) {
composer = null;
}
}
}
}
if (composer != null) {
break;
}
if (root2 === current) {
break;
}
current = current.parent;
}
return composer;
}
function getParentComponentInstance(target, useComponent = false) {
if (target == null) {
return null;
}
{
return !useComponent ? target.parent : target.vnode.ctx || target.parent;
}
}
function setupLifeCycle(i18n2, target, composer) {
let emitter = null;
{
onMounted(() => {
if ((process.env.NODE_ENV !== "production" || false) && true && target.vnode.el) {
target.vnode.el.__VUE_I18N__ = composer;
emitter = createEmitter();
const _composer = composer;
_composer[EnableEmitter] && _composer[EnableEmitter](emitter);
emitter.on("*", addTimelineEvent);
}
}, target);
onUnmounted(() => {
const _composer = composer;
if ((process.env.NODE_ENV !== "production" || false) && true && target.vnode.el && target.vnode.el.__VUE_I18N__) {
emitter && emitter.off("*", addTimelineEvent);
_composer[DisableEmitter] && _composer[DisableEmitter]();
delete target.vnode.el.__VUE_I18N__;
}
i18n2.__deleteInstance(target);
const dispose = _composer[DisposeSymbol];
if (dispose) {
dispose();
delete _composer[DisposeSymbol];
}
}, target);
}
}
function useI18nForLegacy(instance, scope, root2, options = {}) {
const isLocalScope = scope === "local";
const _composer = shallowRef(null);
if (isLocalScope && instance.proxy && !(instance.proxy.$options.i18n || instance.proxy.$options.__i18n)) {
throw createI18nError(I18nErrorCodes.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION);
}
const _inheritLocale = isBoolean(options.inheritLocale) ? options.inheritLocale : !isString$2(options.locale);
const _locale = ref(
// prettier-ignore
!isLocalScope || _inheritLocale ? root2.locale.value : isString$2(options.locale) ? options.locale : DEFAULT_LOCALE
);
const _fallbackLocale = ref(
// prettier-ignore
!isLocalScope || _inheritLocale ? root2.fallbackLocale.value : isString$2(options.fallbackLocale) || isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : _locale.value
);
const _messages = ref(getLocaleMessages(_locale.value, options));
const _datetimeFormats = ref(isPlainObject(options.datetimeFormats) ? options.datetimeFormats : { [_locale.value]: {} });
const _numberFormats = ref(isPlainObject(options.numberFormats) ? options.numberFormats : { [_locale.value]: {} });
const _missingWarn = isLocalScope ? root2.missingWarn : isBoolean(options.missingWarn) || isRegExp(options.missingWarn) ? options.missingWarn : true;
const _fallbackWarn = isLocalScope ? root2.fallbackWarn : isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn) ? options.fallbackWarn : true;
const _fallbackRoot = isLocalScope ? root2.fallbackRoot : isBoolean(options.fallbackRoot) ? options.fallbackRoot : true;
const _fallbackFormat = !!options.fallbackFormat;
const _missing = isFunction2(options.missing) ? options.missing : null;
const _postTranslation = isFunction2(options.postTranslation) ? options.postTranslation : null;
const _warnHtmlMessage = isLocalScope ? root2.warnHtmlMessage : isBoolean(options.warnHtmlMessage) ? options.warnHtmlMessage : true;
const _escapeParameter = !!options.escapeParameter;
const _modifiers = isLocalScope ? root2.modifiers : isPlainObject(options.modifiers) ? options.modifiers : {};
const _pluralRules = options.pluralRules || isLocalScope && root2.pluralRules;
function trackReactivityValues() {
return [
_locale.value,
_fallbackLocale.value,
_messages.value,
_datetimeFormats.value,
_numberFormats.value
];
}
const locale3 = computed({
get: () => {
return _composer.value ? _composer.value.locale.value : _locale.value;
},
set: (val) => {
if (_composer.value) {
_composer.value.locale.value = val;
}
_locale.value = val;
}
});
const fallbackLocale = computed({
get: () => {
return _composer.value ? _composer.value.fallbackLocale.value : _fallbackLocale.value;
},
set: (val) => {
if (_composer.value) {
_composer.value.fallbackLocale.value = val;
}
_fallbackLocale.value = val;
}
});
const messages2 = computed(() => {
if (_composer.value) {
return _composer.value.messages.value;
} else {
return _messages.value;
}
});
const datetimeFormats = computed(() => _datetimeFormats.value);
const numberFormats = computed(() => _numberFormats.value);
function getPostTranslationHandler() {
return _composer.value ? _composer.value.getPostTranslationHandler() : _postTranslation;
}
function setPostTranslationHandler(handler2) {
if (_composer.value) {
_composer.value.setPostTranslationHandler(handler2);
}
}
function getMissingHandler() {
return _composer.value ? _composer.value.getMissingHandler() : _missing;
}
function setMissingHandler(handler2) {
if (_composer.value) {
_composer.value.setMissingHandler(handler2);
}
}
function warpWithDeps(fn) {
trackReactivityValues();
return fn();
}
function t2(...args) {
return _composer.value ? warpWithDeps(() => Reflect.apply(_composer.value.t, null, [...args])) : warpWithDeps(() => "");
}
function rt(...args) {
return _composer.value ? Reflect.apply(_composer.value.rt, null, [...args]) : "";
}
function d2(...args) {
return _composer.value ? warpWithDeps(() => Reflect.apply(_composer.value.d, null, [...args])) : warpWithDeps(() => "");
}
function n2(...args) {
return _composer.value ? warpWithDeps(() => Reflect.apply(_composer.value.n, null, [...args])) : warpWithDeps(() => "");
}
function tm(key2) {
return _composer.value ? _composer.value.tm(key2) : {};
}
function te(key2, locale4) {
return _composer.value ? _composer.value.te(key2, locale4) : false;
}
function getLocaleMessage(locale4) {
return _composer.value ? _composer.value.getLocaleMessage(locale4) : {};
}
function setLocaleMessage(locale4, message2) {
if (_composer.value) {
_composer.value.setLocaleMessage(locale4, message2);
_messages.value[locale4] = message2;
}
}
function mergeLocaleMessage(locale4, message2) {
if (_composer.value) {
_composer.value.mergeLocaleMessage(locale4, message2);
}
}
function getDateTimeFormat(locale4) {
return _composer.value ? _composer.value.getDateTimeFormat(locale4) : {};
}
function setDateTimeFormat(locale4, format3) {
if (_composer.value) {
_composer.value.setDateTimeFormat(locale4, format3);
_datetimeFormats.value[locale4] = format3;
}
}
function mergeDateTimeFormat(locale4, format3) {
if (_composer.value) {
_composer.value.mergeDateTimeFormat(locale4, format3);
}
}
function getNumberFormat(locale4) {
return _composer.value ? _composer.value.getNumberFormat(locale4) : {};
}
function setNumberFormat(locale4, format3) {
if (_composer.value) {
_composer.value.setNumberFormat(locale4, format3);
_numberFormats.value[locale4] = format3;
}
}
function mergeNumberFormat(locale4, format3) {
if (_composer.value) {
_composer.value.mergeNumberFormat(locale4, format3);
}
}
const wrapper = {
get id() {
return _composer.value ? _composer.value.id : -1;
},
locale: locale3,
fallbackLocale,
messages: messages2,
datetimeFormats,
numberFormats,
get inheritLocale() {
return _composer.value ? _composer.value.inheritLocale : _inheritLocale;
},
set inheritLocale(val) {
if (_composer.value) {
_composer.value.inheritLocale = val;
}
},
get availableLocales() {
return _composer.value ? _composer.value.availableLocales : Object.keys(_messages.value);
},
get modifiers() {
return _composer.value ? _composer.value.modifiers : _modifiers;
},
get pluralRules() {
return _composer.value ? _composer.value.pluralRules : _pluralRules;
},
get isGlobal() {
return _composer.value ? _composer.value.isGlobal : false;
},
get missingWarn() {
return _composer.value ? _composer.value.missingWarn : _missingWarn;
},
set missingWarn(val) {
if (_composer.value) {
_composer.value.missingWarn = val;
}
},
get fallbackWarn() {
return _composer.value ? _composer.value.fallbackWarn : _fallbackWarn;
},
set fallbackWarn(val) {
if (_composer.value) {
_composer.value.missingWarn = val;
}
},
get fallbackRoot() {
return _composer.value ? _composer.value.fallbackRoot : _fallbackRoot;
},
set fallbackRoot(val) {
if (_composer.value) {
_composer.value.fallbackRoot = val;
}
},
get fallbackFormat() {
return _composer.value ? _composer.value.fallbackFormat : _fallbackFormat;
},
set fallbackFormat(val) {
if (_composer.value) {
_composer.value.fallbackFormat = val;
}
},
get warnHtmlMessage() {
return _composer.value ? _composer.value.warnHtmlMessage : _warnHtmlMessage;
},
set warnHtmlMessage(val) {
if (_composer.value) {
_composer.value.warnHtmlMessage = val;
}
},
get escapeParameter() {
return _composer.value ? _composer.value.escapeParameter : _escapeParameter;
},
set escapeParameter(val) {
if (_composer.value) {
_composer.value.escapeParameter = val;
}
},
t: t2,
getPostTranslationHandler,
setPostTranslationHandler,
getMissingHandler,
setMissingHandler,
rt,
d: d2,
n: n2,
tm,
te,
getLocaleMessage,
setLocaleMessage,
mergeLocaleMessage,
getDateTimeFormat,
setDateTimeFormat,
mergeDateTimeFormat,
getNumberFormat,
setNumberFormat,
mergeNumberFormat
};
function sync(composer) {
composer.locale.value = _locale.value;
composer.fallbackLocale.value = _fallbackLocale.value;
Object.keys(_messages.value).forEach((locale4) => {
composer.mergeLocaleMessage(locale4, _messages.value[locale4]);
});
Object.keys(_datetimeFormats.value).forEach((locale4) => {
composer.mergeDateTimeFormat(locale4, _datetimeFormats.value[locale4]);
});
Object.keys(_numberFormats.value).forEach((locale4) => {
composer.mergeNumberFormat(locale4, _numberFormats.value[locale4]);
});
composer.escapeParameter = _escapeParameter;
composer.fallbackFormat = _fallbackFormat;
composer.fallbackRoot = _fallbackRoot;
composer.fallbackWarn = _fallbackWarn;
composer.missingWarn = _missingWarn;
composer.warnHtmlMessage = _warnHtmlMessage;
}
onBeforeMount(() => {
if (instance.proxy == null || instance.proxy.$i18n == null) {
throw createI18nError(I18nErrorCodes.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);
}
const composer = _composer.value = instance.proxy.$i18n.__composer;
if (scope === "global") {
_locale.value = composer.locale.value;
_fallbackLocale.value = composer.fallbackLocale.value;
_messages.value = composer.messages.value;
_datetimeFormats.value = composer.datetimeFormats.value;
_numberFormats.value = composer.numberFormats.value;
} else if (isLocalScope) {
sync(composer);
}
});
return wrapper;
}
const globalExportProps = [
"locale",
"fallbackLocale",
"availableLocales"
];
const globalExportMethods = ["t", "rt", "d", "n", "tm", "te"];
function injectGlobalFields(app, composer) {
const i18n2 = /* @__PURE__ */ Object.create(null);
globalExportProps.forEach((prop) => {
const desc = Object.getOwnPropertyDescriptor(composer, prop);
if (!desc) {
throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);
}
const wrap = isRef(desc.value) ? {
get() {
return desc.value.value;
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
set(val) {
desc.value.value = val;
}
} : {
get() {
return desc.get && desc.get();
}
};
Object.defineProperty(i18n2, prop, wrap);
});
app.config.globalProperties.$i18n = i18n2;
globalExportMethods.forEach((method) => {
const desc = Object.getOwnPropertyDescriptor(composer, method);
if (!desc || !desc.value) {
throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);
}
Object.defineProperty(app.config.globalProperties, `$${method}`, desc);
});
const dispose = () => {
delete app.config.globalProperties.$i18n;
globalExportMethods.forEach((method) => {
delete app.config.globalProperties[`$${method}`];
});
};
return dispose;
}
{
initFeatureFlags();
}
if (__INTLIFY_JIT_COMPILATION__) {
registerMessageCompiler(compile);
} else {
registerMessageCompiler(compileToFunction);
}
registerMessageResolver(resolveValue);
registerLocaleFallbacker(fallbackWithLocaleChain);
if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) {
const target = getGlobalThis();
target.__INTLIFY__ = true;
setDevToolsHook(target.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__);
}
if (process.env.NODE_ENV !== "production")
;
const mZhLocale = {
datePicker: {
preset: {
title: "预设",
values: [
"前10秒",
"前30秒",
"前1分钟",
"前5分钟",
"前10分钟",
"前15分钟",
"前30分钟",
"前60分钟",
"前12小时",
"今天",
"本周",
"本月",
"本季度",
"本年度",
"昨天",
"前天",
"上周",
"上月",
"上季度",
"上年度",
"所有时间"
]
},
real: {
title: "实时",
values: ["30秒窗口", "1分钟窗口", "5分钟窗口", "30分钟窗口", "1小时窗口", "3小时窗口"],
units: ["秒前", "分钟前", "小时前", "天前", "周前", "个月前", "季度前", "年前"],
earliest: "最早"
},
relative: {
title: "相对时间",
to: "至",
now: "现在(实时)"
},
absolute: {
title: "绝对时间",
between: "介于",
before: "在此之前",
since: "在此之后",
betweenPlaceholder: "开始时间-结束时间",
singlePlaceHolder: "选择时间"
},
confirm: "确定",
invalidTime: "无效的时间",
validateMsg: [
"时间不能为空",
"开始时间不能等于结束时间",
"开始时间不能大于当前时间",
"结束时间不能早于开始时间",
"验证通过"
],
before: "之前",
after: "之后",
now: "现在",
immediately: "立即"
},
cronPicker: {
usePickerBtnText: "使用时间选择",
title: "定时任务时间选择",
frequency: "运行频次",
time: "运行时间",
confirm: "确认",
cancel: "取消",
timePicker: "时间选择",
viewTenTimes: "查看未来10次运行时间",
cronExpression: "Cron表达式",
cronInput: "请输入Cron表达式",
parse: "解析",
ruleType: "规则类型",
monthly: "每月",
workly: "最近的那个工作日",
lastDay: "本月最后一天",
which: "第",
weekOfWeek: "周的星期",
lastWeek: "本月最后一个星期",
appoint: "指定",
every: "每",
from: "从",
weekly: "星期",
dailyExecution: "每日执行",
startEvery: "开始,每隔",
day: "日",
executeOnce: "执行一次",
execute: "执行",
second: "秒",
minute: "分",
hour: "时",
date: "日",
month: "月",
week: "周",
year: "年",
unspecific: "不指定",
values: ["每分钟", "每小时", "每天", "每周", "每月", "每年"],
weekValues: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
monthValues: [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"
]
},
multipleFilter: {
filterTemplate: "筛选模板",
placeholder: "为快捷搜索命名",
clear: "清除",
save: "保存",
tips: "给当前的搜索和筛选条件进行命名并保存,方便在今后进行快速过滤相关资源",
search: "搜索",
noMatch: "无匹配项",
clear1: "清空",
apply: "应用选择"
}
};
const mEnLocale = {
datePicker: {
preset: {
title: "Preset",
values: [
"Last 10 seconds",
"Last 30 seconds",
"Last 1 minute",
"Last 5 minutes",
"Last 10 minutes",
"Last 15 minutes",
"Last 30 minutes",
"Last 60 minutes",
"Last 12 hours",
"Today",
"Week to date",
"Month to date",
"Quarter to date",
"Year to date",
"Yesterday",
"The day before yesterday",
"Last week",
"Last month",
"Last quarter",
"Last year",
"All time"
]
},
real: {
title: "Real Time",
values: [
"30 second window",
"1 minute window",
"5 minute window",
"30 minute window",
"1 hour window",
"3 hour window"
],
units: [
"Seconds Ago",
"Minutes Ago",
"Hours Ago",
"Days Ago",
"Weeks Ago",
"Months Ago",
"Quarters Ago",
"Years Ago"
],
earliest: "Earliest"
},
relative: {
title: "Relative Time",
to: "to",
now: "now (real time) "
},
absolute: {
title: "Absolute Time",
between: "Between",
before: "Before",
since: "Since",
betweenPlaceholder: "Start date-End date",
singlePlaceHolder: "Select time"
},
confirm: "Ok",
invalidTime: "invalid time",
validateMsg: [
"Time cannot be empty",
"Start time cannot be equal to end time",
"Start time cannot be greater than current time",
"end time cannot be earlier than start time",
"Verified Passed"
],
before: "before",
after: "after",
now: "now",
immediately: "immediately"
},
cronPicker: {
usePickerBtnText: "Use time selection",
title: "Scheduled task time selection",
frequency: "Running frequency",
time: "Running time",
confirm: "Confirm",
cancel: "Cancel",
timePicker: "TimePicker",
viewTenTimes: "View the next 10 runtime times",
cronExpression: "Cron expression",
cronInput: "Please enter a Cron expression",
parse: "analysis",
ruleType: "Rule Type",
monthly: "every month",
workly: " the most recent working day",
lastDay: "last day of the month",
which: "the",
weekOfWeek: "week of the week",
lastWeek: "last week of the Month",
appoint: "appoint",
every: "Every ",
from: "from ",
weekly: "the week",
dailyExecution: "daily execution",
startEvery: " start, every",
day: "day",
executeOnce: " execute once",
execute: " execute",
second: "second",
minute: "minute",
hour: "hour",
date: "date",
month: "month",
week: "week",
year: "year",
unspecific: "unSpecified",
values: ["Every minute", "Every hour", "Every day", "Every week", "Every month", "Every year"],
weekValues: ["Sun", "Mon", "Tues", "Wed", "Thur", "Fri", "Sat"],
monthValues: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"June",
"July",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
]
},
multipleFilter: {
filterTemplate: "Filter Template",
placeholder: "Name the quick search",
clear: "Clear",
save: "Save",
tips: "Name and save the current search and filter conditions, so that you can quickly filter related resources in the future",
search: "search",
noMatch: "no match",
clear1: "clear",
apply: "application selection"
}
};
const messages = {
en_US: {
...mEnLocale
},
zh_CN: {
...mZhLocale
}
};
let currentLang = store("lang") || store("currentLang") || "zh_CN";
const lang = currentLang === "zh_CN" ? mZhLocale : mEnLocale;
const i18n = createI18n({
legacy: false,
// 使用composition API
locale: currentLang,
//调用localstorage中存储的数据,或者默认赋值为”zh_CN“
globalInjection: true,
// 表明使用全局t函数
messages
});
let value = i18n.global.t;
const $t = (path) => {
const array = path.split(".");
let current = lang;
for (let i2 = 0, j2 = array.length; i2 < j2; i2++) {
const property = array[i2];
value = current[property];
if (i2 === j2 - 1)
return value;
if (!value)
return "";
current = value;
}
return "";
};
const presetValues = [
{
label: $t("datePicker.preset.values")[0],
startTime: "-10s",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[1],
startTime: "-30s",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[2],
startTime: "-1m",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[3],
startTime: "-5m",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[4],
startTime: "-10m",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[5],
startTime: "-15m",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[6],
startTime: "-30m",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[7],
startTime: "-60m",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[8],
startTime: "-12h@m",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[9],
startTime: "@d",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[10],
startTime: "@w1",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[11],
startTime: "@mon",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[12],
startTime: "@q",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[13],
startTime: "@y",
endTime: "now"
},
{
label: $t("datePicker.preset.values")[14],
startTime: "-1d@d",
endTime: "@d"
},
{
label: $t("datePicker.preset.values")[15],
startTime: "-2d@d",
endTime: "-1d@d"
},
{
label: $t("datePicker.preset.values")[16],
startTime: "-7d@w1",
endTime: "@w1"
},
{
label: $t("datePicker.preset.values")[17],
startTime: "-1mon@mon",
endTime: "@mon"
},
{
label: $t("datePicker.preset.values")[18],
startTime: "-1q@q",
endTime: "@q"
},
{
label: $t("datePicker.preset.values")[19],
startTime: "-1y@y",
endTime: "@y"
},
{
label: $t("datePicker.preset.values")[20],
startTime: "",
endTime: ""
}
];
const realTimeValues = [
{
label: $t("datePicker.real.values")[0],
value: 30,
unit: "s"
},
{
label: $t("datePicker.real.values")[1],
value: 1,
unit: "m"
},
{
label: $t("datePicker.real.values")[2],
value: 5,
unit: "m"
},
{
label: $t("datePicker.real.values")[3],
value: 30,
unit: "m"
},
{
label: $t("datePicker.real.values")[4],
value: 1,
unit: "h"
},
{
label: $t("datePicker.real.values")[5],
value: 3,
unit: "h"
}
];
const timeUnits = [
{
label: $t("datePicker.real.units")[0],
value: "s",
momentUnit: "second"
},
{
label: $t("datePicker.real.units")[1],
value: "m",
momentUnit: "minute"
},
{
label: $t("datePicker.real.units")[2],
value: "h",
momentUnit: "hour"
},
{
label: $t("datePicker.real.units")[3],
value: "d",
momentUnit: "day"
},
{
label: $t("datePicker.real.units")[4],
value: "w",
momentUnit: "week"
},
{
label: $t("datePicker.real.units")[5],
value: "mon",
momentUnit: "month"
},
{
label: $t("datePicker.real.units")[6],
value: "q",
momentUnit: "quarter"
},
{
label: $t("datePicker.real.units")[7],
value: "y",
momentUnit: "year"
}
];
function getTimeType(startTime, endTime, values) {
const types = ["preset", "real", "relative", "absolute"];
let result = { isMatch: false, activeIndex: -1, type: "" };
for (let i2 = 0; i2 < types.length; i2++) {
const type = types[i2];
switch (type) {
case "preset":
result = isMatchPreset(startTime, endTime, values);
break;
case "real":
result = isMatchRealTime(startTime, endTime);
break;
case "relative":
result = isMatchRelativeTime(startTime, endTime);
break;
case "absolute":
result = isMatchAbsoluteTime(startTime, endTime);
break;
}
result.type = type;
if (result.isMatch) {
break;
}
}
return result;
}
function isMatchPreset(startTime, endTime, values) {
let activeIndex = "";
if (values.length > 0) {
activeIndex = values.findIndex(
(item) => item.startTime == startTime && item.endTime == endTime
);
} else {
activeIndex = presetValues.findIndex(
(item) => item.startTime == startTime && item.endTime == endTime
);
}
const isMatch = activeIndex == -1 ? false : true;
return {
isMatch,
activeIndex
};
}
function isMatchRealTime(startTime, endTime) {
const matchStartTime = startTime.match(/^rt-(\d+)(s|m|h|d|w|mon|q|y)$/);
const matchEndTime = endTime.match(/^rtnow$/);
const isMatch = matchStartTime && matchEndTime ? true : false;
let activeIndex = -1;
if (isMatch) {
activeIndex = realTimeValues.findIndex(
(item) => item.value == matchStartTime[1] && item.unit == matchStartTime[2]
);
}
return {
isMatch,
activeIndex
};
}
function isMatchRelativeTime(startTime, endTime) {
const matchStartTime = startTime.match(/^-(\d+)(s|m|h|d|w|mon|q|y)$/);
const matchEndTime = endTime.match(/^-(\d+)(s|m|h|d|w|mon|q|y)$/);
const isMatch = matchStartTime && matchEndTime || matchStartTime && endTime == "now" ? true : false;
return {
isMatch,
activeIndex: -1
//相对时间不存在快捷菜单
};
}
function isMatchAbsoluteTime(startTime, endTime) {
const matchStartTime = startTime.match(/^\d{10}$/);
const matchEndTime = endTime.match(/^\d{10}$/);
let isMatch = false;
if (matchStartTime && endTime == "now") {
isMatch = true;
} else if (matchEndTime && startTime == "") {
isMatch = true;
} else if (matchStartTime && matchEndTime) {
isMatch = true;
} else {
isMatch = false;
}
return {
isMatch,
activeIndex: -1
//绝对时间不存在快捷菜单
};
}
function getLabelText(type, startTime, endTime, values, format3 = "YYYY-MM-DD HH:mm:ss") {
let labelText = "";
switch (type) {
case "preset":
labelText = getPresetLabelText(startTime, endTime, values);
break;
case "real":
labelText = getRealLabelText(startTime, endTime);
break;
case "relative":
labelText = getRelativeLabelText(startTime, endTime);
break;
case "absolute":
labelText = getAbsoluteLabelText(startTime, endTime, format3);
break;
}
return labelText;
}
function getPresetLabelText(startTime, endTime, values) {
let obj = {};
if (values.length > 0) {
obj = values.find((item) => {
return item.startTime == startTime && item.endTime == endTime;
});
} else {
obj = presetValues.find((item) => {
return item.startTime == startTime && item.endTime == endTime;
});
}
if (obj) {
return obj.label;
} else {
return "";
}
}
function getRealLabelText(startTime, endTime) {
let textStr = "";
const matchStartTime = startTime.match(/^rt-(\d+)(s|m|h|d|w|mon|q|y)$/);
if (matchStartTime && endTime == "rtnow") {
const value2 = matchStartTime[1];
const unit = matchStartTime[2];
const timeUnitLabel = getTimeUnitLabel(unit);
textStr = `${value2}${timeUnitLabel} ${$t("datePicker.relative.to")} ${$t(
"datePicker.immediately"
)}`;
}
return textStr;
}
function getRelativeLabelText(startTime, endTime) {
let textStr = "";
const matchStartTime = startTime.match(/^-(\d+)(s|m|h|d|w|mon|q|y)$/);
const matchEndTime = endTime.match(/^-(\d+)(s|m|h|d|w|mon|q|y)$/);
if (matchStartTime && matchEndTime) {
const startValue = matchStartTime[1];
const startUnit = matchStartTime[2];
const startUnitLabel = getTimeUnitLabel(startUnit);
const endValue = matchEndTime[1];
const endUnit = matchEndTime[2];
const endUnitLabel = getTimeUnitLabel(endUnit);
textStr = `${startValue}${startUnitLabel} ${$t(
"datePicker.relative.to"
)} ${endValue}${endUnitLabel}`;
} else if (matchStartTime && endTime == "now") {
const startValue = matchStartTime[1];
const startUnit = matchStartTime[2];
const startUnitLabel = getTimeUnitLabel(startUnit);
textStr = `${startValue}${startUnitLabel} ${$t("datePicker.relative.to")} ${$t(
"datePicker.now"
)}`;
}
return textStr;
}
function getAbsoluteLabelText(startTime, endTime, format3 = "YYYY-MM-DD HH:mm:ss") {
const dateFormat2 = "YYYY-MM-DD HH:mm:ss";
let textStr = "";
if (format3 === "unix") {
if (endTime == "") {
textStr = `${dayjs.unix(startTime).format(dateFormat2)} ${$t("datePicker.after")}`;
} else if (startTime == "") {
textStr = `${dayjs.unix(endTime).format(dateFormat2)} ${$t("datePicker.before")}`;
} else {
textStr = `${dayjs.unix(startTime).format(dateFormat2)} - ${dayjs.unix(endTime).format(dateFormat2)}`;
}
} else {
if (endTime == "") {
textStr = `${startTime} ${$t("datePicker.after")}`;
} else if (startTime == "") {
textStr = `${endTime} ${$t("datePicker.before")}`;
} else {
textStr = `${startTime} - ${endTime}`;
}
}
return textStr;
}
function getTimeUnitLabel(unit) {
const timeUnit = timeUnits.find((item) => item.value == unit);
if (timeUnit) {
return timeUnit.label;
} else {
return "";
}
}
function isTimeNumber(value2) {
const num = Number(value2);
if (Number.isInteger(num) && num > 0) {
return true;
} else {
return false;
}
}
function compareDate(startValue, startUnit, endValue, endUnit) {
const startMomentUnit = getMomentUnit(startUnit);
const startMoment = dayjs().subtract(startValue, startMomentUnit);
let endMoment = dayjs();
if (endValue !== "now") {
const endMomentUnit = getMomentUnit(endUnit);
endMoment = dayjs().subtract(Number(endValue), endMomentUnit);
}
if (endMoment.isBefore(startMoment)) {
return {
isValid: false,
msg: $t("datePicker.validateMsg")[3]
};
} else if (startMoment.isSame(endMoment)) {
return {
isValid: false,
msg: $t("datePicker.validateMsg")[1]
};
} else {
return {
isValid: true,
msg: $t("datePicker.validateMsg")[4]
};
}
}
function getMomentUnit(unit) {
const timeUnit = timeUnits.find((item) => item.value == unit);
if (timeUnit) {
return timeUnit.momentUnit;
} else {
return "";
}
}
const _hoisted_1$i = { class: "dm-date-picker__real" };
const _hoisted_2$d = { class: "quick-select-box" };
const _hoisted_3$9 = { class: "custom-time-box" };
const _hoisted_4$8 = { class: "text-span" };
const _sfc_main$m = /* @__PURE__ */ defineComponent({
__name: "index",
emits: ["change"],
setup(__props, { expose: __expose, emit: __emit2 }) {
let isError = ref(false);
let quickTags = ref(realTimeValues);
let startTimeValue = ref(5);
let startTimeUnit = ref("s");
let activeTagIndex = ref(-1);
const clickTag = (index2) => {
activeTagIndex.value = index2;
let currentTag = quickTags.value[index2];
startTimeValue.value = currentTag.value;
startTimeUnit.value = currentTag.unit;
};
const validateDate = (value2) => {
let flag = isTimeNumber(value2);
isError.value = !flag;
return flag;
};
const updateActiveTag = (value2, unit) => {
let index2 = quickTags.value.findIndex((item) => item.value == value2 && item.unit == unit);
activeTagIndex.value = index2;
};
const changeInput = (value2) => {
let flag = validateDate(value2);
if (flag) {
updateActiveTag(value2, startTimeUnit.value);
}
};
const changeSelect = (unit) => {
updateActiveTag(startTimeValue.value, unit);
};
const setValue = (startTime, endTime) => {
let matchStartTime = startTime.match(/^rt-(\d+)(s|m|h|d|w|mon|q|y)$/);
if (matchStartTime && endTime == "rtnow") {
startTimeValue.value = matchStartTime[1];
startTimeUnit.value = matchStartTime[2];
updateActiveTag(startTimeValue.value, startTimeUnit.value);
}
};
const emit = __emit2;
const onSubmit = () => {
let flag = validateDate(startTimeValue.value);
if (flag) {
let value2 = {
date: [`rt-${startTimeValue.value}${startTimeUnit.value}`, `rtnow`],
type: "real"
};
emit("change", value2);
}
};
__expose({ setValue });
return (_ctx, _cache) => {
const _component_a_tag = __unplugin_components_0$1;
const _component_a_input_number = __unplugin_components_1;
const _component_a_select_option = SelectOption;
const _component_a_select = __unplugin_components_0$4;
const _component_a_button = Button;
return openBlock(), createElementBlock("div", _hoisted_1$i, [
createElementVNode("div", _hoisted_2$d, [
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(quickTags), (tag, index2) => {
return openBlock(), createBlock(_component_a_tag, {
key: index2,
class: normalizeClass([{ "active-tag": unref(activeTagIndex) == index2 }]),
onClick: ($event) => clickTag(index2)
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(tag.label), 1)
]),
_: 2
}, 1032, ["class", "onClick"]);
}), 128))
]),
createElementVNode("div", _hoisted_3$9, [
createElementVNode("span", _hoisted_4$8, toDisplayString$1(unref($t)("datePicker.real.earliest")) + ":", 1),
createVNode(_component_a_input_number, {
id: "inputNumber",
value: unref(startTimeValue),
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => isRef(startTimeValue) ? startTimeValue.value = $event : startTimeValue = $event),
min: 1,
onChange: changeInput
}, null, 8, ["value"]),
createVNode(_component_a_select, {
value: unref(startTimeUnit),
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => isRef(startTimeUnit) ? startTimeUnit.value = $event : startTimeUnit = $event),
onChange: changeSelect,
dropdownMatchSelectWidth: false
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(timeUnits), (item, index2) => {
return openBlock(), createBlock(_component_a_select_option, {
key: index2,
label: item.label,
value: item.value
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(item.label), 1)
]),
_: 2
}, 1032, ["label", "value"]);
}), 128))
]),
_: 1
}, 8, ["value"]),
createVNode(_component_a_button, {
type: "primary",
onClick: onSubmit
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("datePicker.confirm")), 1)
]),
_: 1
})
]),
withDirectives(createElementVNode("div", { class: "error-text" }, toDisplayString$1(unref($t)("datePicker.invalidTime")), 513), [
[vShow, unref(isError)]
])
]);
};
}
});
const _hoisted_1$h = { class: "dm-date-picker__preset" };
const _sfc_main$l = /* @__PURE__ */ defineComponent({
__name: "index",
props: {
customPresetValues: { default: () => [] }
},
emits: ["change"],
setup(__props, { expose: __expose, emit: __emit2 }) {
const props3 = __props;
const quickTags = computed(() => {
return props3.customPresetValues.length ? props3.customPresetValues : presetValues;
});
let activeTagIndex = ref(-1);
const emit = __emit2;
const clickTag = (index2) => {
activeTagIndex.value = index2;
let tag = quickTags.value[index2];
emit("change", {
date: [tag.startTime, tag.endTime],
type: "preset"
});
};
const setValue = (startTime, endTime) => {
let index2 = quickTags.value.findIndex((item) => {
return item.startTime == startTime && item.endTime == endTime;
});
activeTagIndex.value = index2;
console.log("调用preset中的方法");
};
__expose({ setValue });
return (_ctx, _cache) => {
const _component_a_tag = __unplugin_components_0$1;
return openBlock(), createElementBlock("div", _hoisted_1$h, [
(openBlock(true), createElementBlock(Fragment, null, renderList(quickTags.value, (tag, index2) => {
return openBlock(), createBlock(_component_a_tag, {
key: index2,
class: normalizeClass([{ "active-tag": unref(activeTagIndex) == index2 }]),
onClick: ($event) => clickTag(index2)
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(tag.label), 1)
]),
_: 2
}, 1032, ["class", "onClick"]);
}), 128))
]);
};
}
});
const _hoisted_1$g = { class: "dm-date-picker__relative" };
const _hoisted_2$c = { class: "custom-time-box" };
const _hoisted_3$8 = { class: "start-time-box" };
const _hoisted_4$7 = { class: "time-text" };
const _hoisted_5$5 = { class: "end-time-box" };
const _sfc_main$k = /* @__PURE__ */ defineComponent({
__name: "index",
props: {
customRelativeStartUnits: { default: () => [] },
customRelativeEndUnits: { default: () => [] },
disabledRelativeEndUnit: { type: Boolean, default: false },
relativeStartMaxValue: {}
},
emits: ["change"],
setup(__props, { expose: __expose, emit: __emit2 }) {
const props3 = __props;
const quickStartUnits = computed(() => {
return props3.customRelativeStartUnits.length ? props3.customRelativeStartUnits : timeUnits;
});
const quickEndUnits = computed(() => {
return props3.disabledRelativeEndUnit ? [] : props3.customRelativeEndUnits.length ? props3.customRelativeEndUnits : timeUnits;
});
const startMaxValue = computed(() => {
return props3.relativeStartMaxValue === -1 ? null : startTimeUnit.value === quickStartUnits.value[quickStartUnits.value.length - 1].value ? props3.relativeStartMaxValue : null;
});
const isError = ref(false);
const errorMsg = ref("");
const startTimeValue = ref(5);
const startTimeUnit = ref(quickStartUnits.value[0].value || "s");
const endTimeValue = ref("now");
const endTimeUnit = ref("");
const showEndTimeValue = ref(false);
const validateDate = () => {
let startFlag = isTimeNumber(startTimeValue.value);
let endFlag = true;
if (endTimeValue.value !== "now") {
endFlag = isTimeNumber(endTimeValue.value);
}
if (startFlag && endFlag) {
let result = compareDate(
startTimeValue.value,
startTimeUnit.value,
endTimeValue.value,
endTimeUnit.value
);
isError.value = !result.isValid;
errorMsg.value = result.msg;
return result.isValid;
} else {
isError.value = true;
errorMsg.value = $t("datePicker.invalidTime");
return false;
}
};
const emit = __emit2;
const onSubmit = () => {
if (validateDate()) {
let startTime = `-${startTimeValue.value}${startTimeUnit.value}`;
let endTime = "now";
if (endTimeValue.value != "now") {
endTime = `-${endTimeValue.value}${endTimeUnit.value}`;
}
let value2 = {
date: [startTime, endTime],
type: "relative"
};
emit("change", value2);
} else {
console.warn("验证有误");
}
};
const changeUnit = (type) => {
if (endTimeUnit.value == "") {
endTimeValue.value = "now";
showEndTimeValue.value = false;
} else {
endTimeValue.value = "1";
showEndTimeValue.value = true;
}
if (type === "start") {
startTimeValue.value = props3.relativeStartMaxValue !== -1 && startTimeUnit.value === quickStartUnits.value[quickStartUnits.value.length - 1].value && startTimeValue.value > props3.relativeStartMaxValue ? props3.relativeStartMaxValue : startTimeValue.value;
}
validateDate();
};
const setValue = (startTime, endTime) => {
let start_obj = startTime.match(/^-(\d+)(s|m|h|d|w|mon|q|y)$/);
let end_obj = endTime.match(/^-(\d+)(s|m|h|d|w|mon|q|y)$/);
if (start_obj && end_obj) {
startTimeValue.value = start_obj[1];
startTimeUnit.value = start_obj[2];
endTimeValue.value = end_obj[1];
endTimeUnit.value = end_obj[2];
showEndTimeValue.value = true;
} else if (start_obj && endTime == "now") {
startTimeValue.value = start_obj[1];
startTimeUnit.value = start_obj[2];
endTimeValue.value = "now";
endTimeUnit.value = "";
showEndTimeValue.value = false;
}
validateDate();
};
__expose({ setValue });
return (_ctx, _cache) => {
const _component_a_input_number = __unplugin_components_1;
const _component_a_select_option = SelectOption;
const _component_a_select = __unplugin_components_0$4;
const _component_a_button = Button;
return openBlock(), createElementBlock("div", _hoisted_1$g, [
createElementVNode("div", _hoisted_2$c, [
createElementVNode("div", _hoisted_3$8, [
createVNode(_component_a_input_number, {
id: "inputNumber",
value: startTimeValue.value,
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => startTimeValue.value = $event),
min: 1,
max: startMaxValue.value,
onChange: _cache[1] || (_cache[1] = ($event) => validateDate())
}, null, 8, ["value", "max"]),
createVNode(_component_a_select, {
value: startTimeUnit.value,
"onUpdate:value": _cache[2] || (_cache[2] = ($event) => startTimeUnit.value = $event),
onChange: _cache[3] || (_cache[3] = ($event) => changeUnit("start")),
dropdownMatchSelectWidth: false
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(quickStartUnits.value, (item, index2) => {
return openBlock(), createBlock(_component_a_select_option, {
key: index2,
value: item.value
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(item.label), 1)
]),
_: 2
}, 1032, ["value"]);
}), 128))
]),
_: 1
}, 8, ["value"])
]),
createElementVNode("div", _hoisted_4$7, toDisplayString$1(unref($t)("datePicker.relative.to")), 1),
createElementVNode("div", _hoisted_5$5, [
withDirectives(createVNode(_component_a_input_number, {
id: "inputNumber",
value: endTimeValue.value,
"onUpdate:value": _cache[4] || (_cache[4] = ($event) => endTimeValue.value = $event),
min: 1,
onChange: _cache[5] || (_cache[5] = ($event) => validateDate())
}, null, 8, ["value"]), [
[vShow, showEndTimeValue.value]
]),
createVNode(_component_a_select, {
value: endTimeUnit.value,
"onUpdate:value": _cache[6] || (_cache[6] = ($event) => endTimeUnit.value = $event),
onChange: _cache[7] || (_cache[7] = ($event) => changeUnit("end")),
dropdownMatchSelectWidth: false
}, {
default: withCtx(() => [
createVNode(_component_a_select_option, { value: "" }, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("datePicker.relative.now")), 1)
]),
_: 1
}),
(openBlock(true), createElementBlock(Fragment, null, renderList(quickEndUnits.value, (item, index2) => {
return openBlock(), createBlock(_component_a_select_option, {
key: index2,
value: item.value
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(item.label), 1)
]),
_: 2
}, 1032, ["value"]);
}), 128))
]),
_: 1
}, 8, ["value"]),
createVNode(_component_a_button, {
type: "primary",
onClick: onSubmit
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("datePicker.confirm")), 1)
]),
_: 1
})
])
]),
withDirectives(createElementVNode("div", { class: "error-text" }, toDisplayString$1(errorMsg.value), 513), [
[vShow, isError.value]
])
]);
};
}
});
var locale$3 = {
locale: "zh_CN",
today: "今天",
now: "此刻",
backToToday: "返回今天",
ok: "确定",
timeSelect: "选择时间",
dateSelect: "选择日期",
weekSelect: "选择周",
clear: "清除",
month: "月",
year: "年",
previousMonth: "上个月 (翻页上键)",
nextMonth: "下个月 (翻页下键)",
monthSelect: "选择月份",
yearSelect: "选择年份",
decadeSelect: "选择年代",
yearFormat: "YYYY年",
dayFormat: "D日",
dateFormat: "YYYY年M月D日",
dateTimeFormat: "YYYY年M月D日 HH时mm分ss秒",
previousYear: "上一年 (Control键加左方向键)",
nextYear: "下一年 (Control键加右方向键)",
previousDecade: "上一年代",
nextDecade: "下一年代",
previousCentury: "上一世纪",
nextCentury: "下一世纪"
};
const CalendarLocale = locale$3;
var locale$2 = {
placeholder: "请选择时间",
rangePlaceholder: ["开始时间", "结束时间"]
};
const TimePickerLocale = locale$2;
var locale = {
lang: _objectSpread2$1({
placeholder: "请选择日期",
yearPlaceholder: "请选择年份",
quarterPlaceholder: "请选择季度",
monthPlaceholder: "请选择月份",
weekPlaceholder: "请选择周",
rangePlaceholder: ["开始日期", "结束日期"],
rangeYearPlaceholder: ["开始年份", "结束年份"],
rangeMonthPlaceholder: ["开始月份", "结束月份"],
rangeQuarterPlaceholder: ["开始季度", "结束季度"],
rangeWeekPlaceholder: ["开始周", "结束周"]
}, CalendarLocale),
timePickerLocale: _objectSpread2$1({}, TimePickerLocale)
};
locale.lang.ok = "确定";
const locale$1 = locale;
const _hoisted_1$f = { class: "dm-date-picker__absolute" };
const _hoisted_2$b = { class: "custom-time-box" };
const _hoisted_3$7 = { class: "time-type" };
const _hoisted_4$6 = { class: "date-picker-box" };
const dateFormat = "YYYY-MM-DD HH:mm:ss";
const _sfc_main$j = /* @__PURE__ */ defineComponent({
__name: "index",
props: {
dateFormatBack: { default: "YYYY-MM-DD HH:mm:ss" }
},
emits: ["change"],
setup(__props, { expose: __expose, emit: __emit2 }) {
const props3 = __props;
const rangeType = ref("between");
const singleTime = ref("");
const rangeTime = ref([]);
const isError = ref(false);
const errorMsg = ref("");
const validateDate = () => {
isError.value = false;
errorMsg.value = "";
switch (rangeType.value) {
case "before":
if (singleTime.value == "") {
isError.value = true;
errorMsg.value = $t("datePicker.validateMsg")[0];
}
break;
case "between":
if (!Array.isArray(rangeTime.value) || rangeTime.value.length != 2) {
isError.value = true;
errorMsg.value = $t("datePicker.validateMsg")[0];
} else {
if (new Date(rangeTime.value[0]).getTime() == new Date(rangeTime.value[1]).getTime()) {
isError.value = true;
errorMsg.value = $t("datePicker.validateMsg")[1];
}
}
break;
case "after":
if (singleTime.value == "") {
isError.value = true;
errorMsg.value = $t("datePicker.validateMsg")[0];
}
break;
}
};
const emit = __emit2;
const setDateFormat = (time) => {
if (!props3.dateFormatBack) {
return time;
} else if (props3.dateFormatBack === "unix") {
return dayjs(time).unix();
} else {
return dayjs(time).format(props3.dateFormatBack);
}
};
const onSubmit = () => {
validateDate();
if (!isError.value) {
let value2 = {
date: [],
type: "absolute"
};
if (rangeType.value == "between") {
value2.date = [setDateFormat(rangeTime.value[0]), setDateFormat(rangeTime.value[1])];
} else if (rangeType.value == "before") {
let startTime = "";
let endTime = setDateFormat(singleTime.value);
value2.date = [startTime, endTime];
} else {
let startTime = setDateFormat(singleTime.value);
let endTime = "";
value2.date = [startTime, endTime];
}
emit("change", value2);
} else {
return false;
}
};
let locales = ref("");
let lang2 = store("lang") || store("currentLang") || "zh_CN";
if (lang2 === "zh_CN") {
locales.value = locale$1;
} else {
locales.value = locale2;
}
const setValue = (startTime, endTime) => {
if (props3.dateFormatBack === "unix") {
if (endTime == "") {
rangeType.value = "after";
singleTime.value = dayjs.unix(startTime).format(dateFormat);
} else if (startTime == "") {
rangeType.value = "before";
singleTime.value = dayjs.unix(endTime).format(dateFormat);
} else {
rangeType.value = "between";
rangeTime.value = [
dayjs.unix(startTime).format(dateFormat),
dayjs.unix(endTime).format(dateFormat)
];
}
} else {
if (endTime == "") {
rangeType.value = "after";
singleTime.value = startTime;
} else if (startTime == "") {
rangeType.value = "before";
singleTime.value = endTime;
} else {
rangeType.value = "between";
rangeTime.value = [startTime, endTime];
}
}
};
__expose({ setValue });
return (_ctx, _cache) => {
const _component_a_select_option = SelectOption;
const _component_a_select = __unplugin_components_0$4;
const _component_a_range_picker = RangePicker;
const _component_a_date_picker = DatePicker$1;
const _component_a_button = Button;
return openBlock(), createElementBlock("div", _hoisted_1$f, [
createElementVNode("div", _hoisted_2$b, [
createElementVNode("div", _hoisted_3$7, [
createVNode(_component_a_select, {
value: rangeType.value,
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => rangeType.value = $event)
}, {
default: withCtx(() => [
createVNode(_component_a_select_option, { value: "between" }, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("datePicker.absolute.between")), 1)
]),
_: 1
}),
createVNode(_component_a_select_option, { value: "before" }, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("datePicker.absolute.before")), 1)
]),
_: 1
}),
createVNode(_component_a_select_option, { value: "after" }, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("datePicker.absolute.since")), 1)
]),
_: 1
})
]),
_: 1
}, 8, ["value"])
]),
createElementVNode("div", _hoisted_4$6, [
rangeType.value == "between" ? (openBlock(), createBlock(_component_a_range_picker, {
key: 0,
locale: unref(locales),
value: rangeTime.value,
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => rangeTime.value = $event),
format: dateFormat,
valueFormat: dateFormat,
"show-time": "",
onChange: validateDate
}, null, 8, ["locale", "value"])) : (openBlock(), createBlock(_component_a_date_picker, {
key: 1,
format: dateFormat,
valueFormat: dateFormat,
locale: unref(locales),
value: singleTime.value,
"onUpdate:value": _cache[2] || (_cache[2] = ($event) => singleTime.value = $event),
"show-time": "",
onChange: validateDate
}, null, 8, ["locale", "value"])),
createVNode(_component_a_button, {
type: "primary",
onClick: onSubmit
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("datePicker.confirm")), 1)
]),
_: 1
})
]),
withDirectives(createElementVNode("div", { class: "error-text" }, toDisplayString$1(errorMsg.value), 513), [
[vShow, isError.value]
])
])
]);
};
}
});
const _hoisted_1$e = { class: "dm-date-picker" };
const _hoisted_2$a = { key: 0 };
const _hoisted_3$6 = { key: 1 };
const _hoisted_4$5 = ["title", "disabled"];
const _sfc_main$i = /* @__PURE__ */ defineComponent({
...{
name: "dm-date-picker"
},
__name: "index",
props: {
placement: { default: "bottom" },
disabled: { type: Boolean, default: false },
value: { default: () => ["", ""] },
items: { default: () => ["preset", "real", "relative", "absolute"] },
presetValues: { default: () => [] },
relativeStartUnits: { default: () => [] },
relativeEndUnits: { default: () => [] },
disabledRelativeEndUnit: { type: Boolean, default: false },
relativeStartMaxValue: { default: -1 },
onlyShowText: { type: Boolean, default: false },
showTooltip: { type: Boolean, default: false },
dateFormat: { default: "YYYY-MM-DD HH:mm:ss" }
},
emits: ["change", "update:value"],
setup(__props, { emit: __emit2 }) {
const visible = ref(false);
const timeCard = ref();
const preset = ref();
const real = ref();
const relative = ref();
const absolute = ref();
let activeKey = ref("");
const props3 = __props;
const emit = __emit2;
const timeValue = useVModel(props3, "value", emit);
const startTime = computed(() => {
return timeValue.value.length === 2 ? timeValue.value[0].toString() : "";
});
const endTime = computed(() => {
return timeValue.value.length === 2 ? timeValue.value[1].toString() : "";
});
const timeTypeInfo = computed(() => {
return getTimeType(startTime.value, endTime.value, props3.presetValues);
});
const labelText = computed(() => {
return getLabelText(
timeTypeInfo.value.type,
startTime.value,
endTime.value,
props3.presetValues,
props3.dateFormat
);
});
const publicChild = (data2) => {
data2.setValue(startTime.value, endTime.value);
};
const getChildFun = () => {
switch (timeTypeInfo.value.type) {
case "preset":
publicChild(preset.value[0]);
break;
case "real":
publicChild(real.value[0]);
break;
case "relative":
publicChild(relative.value[0]);
break;
case "absolute":
publicChild(absolute.value[0]);
break;
}
};
watch(
() => visible.value,
() => {
if (props3.disabled) {
visible.value = false;
}
if (visible.value) {
activeKey.value = timeTypeInfo.value.type;
setTimeout(() => {
getChildFun();
}, 300);
} else {
activeKey.value = "";
}
}
);
const timeChange = (data2) => {
timeValue.value = data2.date;
const lableEmit = getLabelText(
data2.type,
data2.date[0] || "",
data2.date[1] || "",
props3.presetValues
);
emit("change", { ...data2, ...{ label: lableEmit } });
visible.value = false;
};
return (_ctx, _cache) => {
const _component_a_tooltip = __unplugin_components_0$3;
const _component_a_collapse_panel = __unplugin_components_1$2;
const _component_a_collapse = Collapse;
const _component_a_card = Card$1;
const _component_a_popover = __unplugin_components_6;
return openBlock(), createBlock(unref(ConfigProvider$1), { prefixCls: "dm-ui" }, {
default: withCtx(() => [
createElementVNode("div", _hoisted_1$e, [
_ctx.onlyShowText ? (openBlock(), createElementBlock("div", _hoisted_2$a, [
_ctx.showTooltip ? (openBlock(), createBlock(_component_a_tooltip, {
key: 0,
title: labelText.value,
placement: "top"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(labelText.value), 1)
]),
_: 1
}, 8, ["title"])) : (openBlock(), createElementBlock("span", _hoisted_3$6, toDisplayString$1(labelText.value), 1))
])) : (openBlock(), createBlock(_component_a_popover, {
key: 1,
visible: visible.value,
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => visible.value = $event),
trigger: "click",
placement: _ctx.placement,
overlayClassName: "dm-date-picker-popover"
}, {
content: withCtx(() => [
createVNode(_component_a_card, {
ref_key: "timeCard",
ref: timeCard,
class: "dm-date-picker__card",
bordered: false
}, {
default: withCtx(() => [
createVNode(_component_a_collapse, {
activeKey: unref(activeKey),
"onUpdate:activeKey": _cache[0] || (_cache[0] = ($event) => isRef(activeKey) ? activeKey.value = $event : activeKey = $event),
accordion: "",
"expand-icon-position": "right"
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(props3.items, (item) => {
return openBlock(), createBlock(_component_a_collapse_panel, {
header: unref($t)(`datePicker.${item}.title`),
key: item
}, {
default: withCtx(() => [
item == "preset" ? (openBlock(), createBlock(_sfc_main$l, {
key: 0,
onChange: timeChange,
"custom-preset-values": _ctx.presetValues,
ref_for: true,
ref_key: "preset",
ref: preset
}, null, 8, ["custom-preset-values"])) : item == "real" ? (openBlock(), createBlock(_sfc_main$m, {
key: 1,
ref_for: true,
ref_key: "real",
ref: real,
onChange: timeChange
}, null, 512)) : item == "relative" ? (openBlock(), createBlock(_sfc_main$k, {
key: 2,
onChange: timeChange,
"custom-relative-start-units": _ctx.relativeStartUnits,
"custom-relative-end-units": _ctx.relativeEndUnits,
"disabled-relative-end-unit": _ctx.disabledRelativeEndUnit,
"relative-start-max-value": _ctx.relativeStartMaxValue,
ref_for: true,
ref_key: "relative",
ref: relative
}, null, 8, ["custom-relative-start-units", "custom-relative-end-units", "disabled-relative-end-unit", "relative-start-max-value"])) : item == "absolute" ? (openBlock(), createBlock(_sfc_main$j, {
key: 3,
dateFormatBack: props3.dateFormat,
onChange: timeChange,
ref_for: true,
ref_key: "absolute",
ref: absolute
}, null, 8, ["dateFormatBack"])) : createCommentVNode("", true)
]),
_: 2
}, 1032, ["header"]);
}), 128))
]),
_: 1
}, 8, ["activeKey"])
]),
_: 1
}, 512)
]),
default: withCtx(() => [
createElementVNode("div", {
class: normalizeClass({ "time-content": true, "disabled-style": _ctx.disabled }),
title: labelText.value,
disabled: _ctx.disabled
}, [
createTextVNode(toDisplayString$1(labelText.value) + " ", 1),
createVNode(unref(DownOutlined$3))
], 10, _hoisted_4$5)
]),
_: 1
}, 8, ["visible", "placement"]))
])
]),
_: 1
});
};
}
});
const style_less_vue_type_style_index_0_src_true_lang$2 = "";
_sfc_main$i.install = (app) => {
app.component(_sfc_main$i.name, _sfc_main$i);
return app;
};
const token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Q{1,3}|([HhMsDm])\1?|"[^"]*"|'[^']*'/g;
const shorten = (arr, sLen) => {
const newArr = [];
for (let i2 = 0, len = arr.length; i2 < len; i2++) {
newArr.push(arr[i2].substr(0, sLen));
}
return newArr;
};
const pad = (val, len) => {
val = String(val);
len = len || 2;
while (val.length < len) {
val = "0" + val;
}
return val;
};
const CRON_TIMES_LIST = [
// {
// label: "实时",
// value: ""
// },
{
label: $t("cronPicker.values")[0],
value: "minute"
},
{
label: $t("cronPicker.values")[1],
value: "hour"
},
{
label: $t("cronPicker.values")[2],
value: "day"
},
{
label: $t("cronPicker.values")[3],
value: "week"
},
{
label: $t("cronPicker.values")[4],
value: "month"
},
{
label: $t("cronPicker.values")[5],
value: "year"
}
];
const PICKER_TYPE_LIST = ["minute", "hour", "day", "week", "month", "year"];
const COLUMNS_MAP = {
year: "month_day_hour_minute_second".split("_"),
month: "day_hour_minute_second".split("_"),
week: "week_hour_minute_second".split("_"),
day: "hour_minute_second".split("_"),
hour: "minute_second".split("_"),
minute: "second".split("_"),
default: "hour_minute_second".split("_")
};
const COLUMNS_HEADER_MAP = {
year: $t("cronPicker.year"),
month: $t("cronPicker.month"),
week: $t("cronPicker.week"),
day: $t("cronPicker.day"),
hour: $t("cronPicker.hour"),
minute: $t("cronPicker.minute"),
second: $t("cronPicker.second")
};
const WEEK_NAMES = $t("cronPicker.weekValues");
const MONTH_NAMES = $t("cronPicker.monthValues");
const COLUMNS_DATA_MAP = {
month: Array.from(new Array(12).keys()).map((v2) => {
return {
text: MONTH_NAMES[v2],
value: v2 + 1
};
}),
week: Array.from(new Array(7).keys()).map((v2) => {
return {
text: WEEK_NAMES[v2],
value: v2 + 1
};
}),
day: Array.from(new Array(31).keys()).map((v2) => {
return {
text: pad(v2 + 1),
value: v2 + 1
};
}),
hour: Array.from(new Array(24).keys()).map((v2) => {
return {
text: pad(v2),
value: v2
};
}),
minute: Array.from(new Array(60).keys()).map((v2) => {
return {
text: pad(v2),
value: v2
};
}),
second: Array.from(new Array(60).keys()).map((v2) => {
return {
text: pad(v2),
value: v2
};
})
};
function generatorColumnsHeader(type) {
const columns = COLUMNS_MAP[type];
return columns.map((column) => COLUMNS_HEADER_MAP[column]);
}
function generatorColumnsData(type) {
const columns = COLUMNS_MAP[type];
return columns.map((column) => ({
name: column,
data: COLUMNS_DATA_MAP[column]
}));
}
function scrollTop(el, from = 0, to, duration = 500, endCallback) {
if (typeof window !== "undefined" && !window.requestAnimationFrame) {
window.requestAnimationFrame = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
return window.setTimeout(callback, 1e3 / 60);
};
}
const difference = Math.abs(from - to);
const step = Math.ceil(difference / duration * 50);
function scroll(start, end, step2) {
if (start === end) {
endCallback && endCallback();
return;
}
let d2 = start + step2 > end ? end : start + step2;
if (start > end) {
d2 = start - step2 < end ? end : start - step2;
}
if (el === window) {
typeof window !== "undefined" && window.scrollTo(d2, d2);
} else {
el.scrollTop = d2;
}
typeof window !== "undefined" && window.requestAnimationFrame(() => scroll(d2, end, step2));
}
scroll(from, to, step);
}
const DEFAULT_PICKER_FORMAT = {
year: "MM/dd HH:mm:ss",
month: "dd HH:mm:ss",
week: "ddd HH:mm:ss",
day: "HH:mm:ss",
hour: "mm:ss",
minute: "ss",
default: "HH:mm:ss"
};
const dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
const monthNames = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
];
const monthNamesShort = shorten(monthNames, 3);
shorten(dayNames, 3);
const defaulti18n = {
dayNamesShort: WEEK_NAMES,
dayNames: WEEK_NAMES,
monthNamesShort,
monthNames
};
const getPartValue = (value2, type) => value2[type];
const formatFlags = {
D: function(value2) {
return getPartValue(value2, "week");
},
DD: function(value2) {
return pad(getPartValue(value2, "week"));
},
d: function(value2) {
return getPartValue(value2, "day");
},
dd: function(value2) {
return pad(getPartValue(value2, "day"));
},
ddd: function(value2, i18n2) {
return i18n2.dayNamesShort[getPartValue(value2, "week") - 1];
},
dddd: function(value2, i18n2) {
return i18n2.dayNames[getPartValue(value2, "week") - 1];
},
M: function(value2) {
return getPartValue(value2, "month");
},
MM: function(value2) {
return pad(getPartValue(value2, "month"));
},
MMM: function(value2, i18n2) {
return i18n2.monthNamesShort[getPartValue(value2, "month")];
},
MMMM: function(value2, i18n2) {
return i18n2.monthNames[getPartValue(value2, "month")];
},
h: function(value2) {
return getPartValue(value2, "hour") % 12 || 12;
},
hh: function(value2) {
return pad(getPartValue(value2, "hour") % 12 || 12);
},
H: function(value2) {
return getPartValue(value2, "hour");
},
HH: function(value2) {
return pad(getPartValue(value2, "hour"));
},
m: function(value2) {
return getPartValue(value2, "minute");
},
mm: function(value2) {
return pad(getPartValue(value2, "minute"));
},
s: function(value2) {
return getPartValue(value2, "second");
},
ss: function(value2) {
return pad(getPartValue(value2, "second"));
}
};
const formatPickerTime = (value2, format3, i18nSettings) => {
const i18n2 = i18nSettings || defaulti18n;
return format3.replace(token, function($0) {
return $0 in formatFlags ? formatFlags[$0](value2, i18n2) : $0.slice(1, $0.length - 1);
});
};
const DATE_FORMATTER = function(value2, format3) {
return formatPickerTime(value2, format3);
};
const TYPE_VALUE_RESOLVER_MAP = {
default: {
formatter: DATE_FORMATTER,
parser(text) {
if (text === void 0 || text === "")
return null;
return text;
}
},
year: {
formatter: DATE_FORMATTER
},
month: {
formatter: DATE_FORMATTER
},
week: {
formatter: DATE_FORMATTER
},
day: {
formatter: DATE_FORMATTER
},
hour: {
formatter: DATE_FORMATTER
},
minute: {
formatter: DATE_FORMATTER
}
};
const CRON_TPL = "{second} {minute} {hour} {day} {month} {week}";
const DEFAULT_CRON_VALUE = {
second: "*",
minute: "*",
hour: "*",
day: "*",
month: "*",
week: "*"
};
const renderTpl = (tpl, objVal) => {
Object.entries(objVal).map((item) => {
tpl = tpl.replace(`{${item[0]}}`, item[1]);
});
return tpl;
};
const genCronExprByType = (type, value2) => {
return renderTpl(
CRON_TPL,
Object.assign(
{},
DEFAULT_CRON_VALUE,
!type || value2,
type === "week" ? { day: "?" } : { week: "?" }
)
);
};
const genRunStrByCron = (cronStr) => {
const cronValues = {};
const cronArr = cronStr.split(" ");
const cronTime = ["second", "minute", "hour", "day", "month", "week"];
cronArr.forEach((value2, index2) => {
const key2 = cronTime[index2];
if (value2 !== "*" && value2 !== "?") {
cronValues[key2] = parseInt(value2);
}
});
let unitKey = "";
if (!cronStr.includes("*")) {
unitKey = "year";
} else if (cronStr.includes("* * * * ?")) {
unitKey = "minute";
} else if (cronStr.includes("* * * ?")) {
unitKey = "hour";
} else if (cronStr.includes("* * ?")) {
unitKey = "day";
} else if (cronStr.includes("* ?")) {
unitKey = "month";
} else if (cronStr.includes("? *")) {
unitKey = "week";
}
return { runType: unitKey, runTimes: cronValues };
};
const _hoisted_1$d = { class: "cron-picker-picker-panel-inner" };
const _hoisted_2$9 = { class: "cron-picker-picker-panel-header" };
const _hoisted_3$5 = { class: "cron-picker-picker-panel-body" };
const _hoisted_4$4 = { class: "cron-picker-picker-panel-column-ul" };
const _hoisted_5$4 = ["onClick"];
const _sfc_main$h = /* @__PURE__ */ defineComponent({
__name: "index",
props: {
type: {},
value: {},
runTimes: {}
},
emits: ["update:runTimes"],
setup(__props, { expose: __expose, emit: __emit2 }) {
const props3 = __props;
const emit = __emit2;
const valueRunTimes = useVModel(props3, "runTimes", emit);
const pickerColumnsHeader = computed(() => {
return generatorColumnsHeader(props3.type);
});
const pickerColumnsData = computed(() => {
return generatorColumnsData(props3.type);
});
const setRunTimes = (name, value2) => {
valueRunTimes.value[name] = value2;
};
const handleCellClick = (list, cell) => {
setRunTimes(list.name, cell.value);
scroll(
list.name,
list.data.findIndex((item) => item.value === cell.value)
);
};
const listRefs = {};
const nodeItemRef = (el, name) => {
if (el && listRefs) {
listRefs[name] = el;
}
};
const scroll = (type, index2) => {
let refElm = listRefs[type];
const from = refElm.scrollTop;
const to = 32 * index2;
scrollTop(refElm, from, to, 500);
};
const updateScroll = () => {
pickerColumnsData.value.forEach((column) => {
const type = column.name;
console.log(props3.value);
const selectedColumnValue = props3.value[type] || column.data[0].value;
let refElm = listRefs[type];
nextTick(() => {
refElm.scrollTop = 32 * column.data.findIndex((item) => item.value === selectedColumnValue);
});
});
};
__expose({ updateScroll });
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1$d, [
createElementVNode("div", _hoisted_2$9, [
(openBlock(true), createElementBlock(Fragment, null, renderList(pickerColumnsHeader.value, (column, index2) => {
return openBlock(), createElementBlock("div", {
class: "cron-picker-picker-panel-column-title",
key: index2
}, toDisplayString$1(column), 1);
}), 128))
]),
createElementVNode("div", _hoisted_3$5, [
(openBlock(true), createElementBlock(Fragment, null, renderList(pickerColumnsData.value, (list, index2) => {
return openBlock(), createElementBlock("div", {
class: "cron-picker-picker-panel-column-list",
key: index2,
ref_for: true,
ref: (el) => nodeItemRef(el, list.name)
}, [
createElementVNode("ul", _hoisted_4$4, [
(openBlock(true), createElementBlock(Fragment, null, renderList(list.data, (cell) => {
return openBlock(), createElementBlock("li", {
key: cell.text,
class: normalizeClass([
"cron-picker-picker-panel-column-cell",
{
"cron-picker-picker-panel-column-cell-selected": _ctx.value[list.name] === cell.value
}
]),
onClick: ($event) => handleCellClick(list, cell)
}, toDisplayString$1(cell.text), 11, _hoisted_5$4);
}), 128))
])
]);
}), 128))
])
]);
};
}
});
const _sfc_main$g = /* @__PURE__ */ defineComponent({
__name: "index",
props: {
size: { default: "default" },
title: { default: $t("cronPicker.title") },
placement: { default: "bottomLeft" },
panelVisible: { type: Boolean },
disabled: { type: Boolean, default: false },
runtypeList: { default: () => [] },
runTypes: { default: () => [] },
runTimes: {},
format: { default: "" },
runType: {}
},
emits: ["update:runTimes"],
setup(__props, { emit: __emit2 }) {
const visible = ref(false);
const props3 = __props;
const emit = __emit2;
const valueRunTimes = useVModel(props3, "runTimes", emit);
const calcPanelWidth = ref(0);
const isValidType = computed(() => {
console.log(props3.runType);
return PICKER_TYPE_LIST.includes(props3.runType);
});
const formatPickerTime2 = () => {
const format3 = DEFAULT_PICKER_FORMAT[isValidType.value ? props3.runType : "default"];
const { formatter } = TYPE_VALUE_RESOLVER_MAP[props3.runType] || TYPE_VALUE_RESOLVER_MAP["default"];
return formatter(valueRunTimes.value, props3.format || format3);
};
const inputValue = computed(() => {
return formatPickerTime2();
});
const pickerInput = ref();
const pickerPanel = ref();
watch(
() => visible.value,
(val) => {
if (val) {
calcPanelWidth.value = pickerInput.value.$el.offsetWidth;
nextTick(() => {
pickerPanel.value && pickerPanel.value.updateScroll();
});
}
}
);
return (_ctx, _cache) => {
const _component_a_input = Input;
const _component_a_popover = __unplugin_components_6;
return openBlock(), createBlock(_component_a_popover, {
visible: visible.value,
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => visible.value = $event),
trigger: "click",
disabled: _ctx.disabled,
placement: "bottomLeft",
overlayClassName: "cron-picker-picker-panel",
overlayStyle: { width: `${calcPanelWidth.value}px` },
align: {
offset: [0, -2],
overflow: {
adjustX: 1,
adjustY: 1
},
points: ["tl", "tl"],
targetOffset: [0, 0]
}
}, {
content: withCtx(() => [
isValidType.value ? (openBlock(), createBlock(_sfc_main$h, {
key: 0,
ref_key: "pickerPanel",
ref: pickerPanel,
type: _ctx.runType,
value: _ctx.runTimes,
runTimes: unref(valueRunTimes),
"onUpdate:runTimes": _cache[1] || (_cache[1] = ($event) => isRef(valueRunTimes) ? valueRunTimes.value = $event : null)
}, null, 8, ["type", "value", "runTimes"])) : createCommentVNode("", true)
]),
default: withCtx(() => [
createVNode(_component_a_input, {
ref_key: "pickerInput",
ref: pickerInput,
value: inputValue.value,
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
disabled: !isValidType.value,
class: "cron-picker-picker-input"
}, {
suffix: withCtx(() => [
createVNode(unref(ClockCircleOutlined$3))
]),
_: 1
}, 8, ["value", "disabled"])
]),
_: 1
}, 8, ["visible", "disabled", "overlayStyle"]);
};
}
});
function generateArray(min, max, labels) {
const specifies = [];
let index2 = 0;
for (let specify = min; specify <= max; specify += 1) {
specifies.push({ value: specify, label: labels ? labels[index2] : specify.toString() });
index2 += 1;
}
return specifies;
}
function zerofill(value2) {
const prefix = value2 < 10 ? "0" : "";
return `${prefix}${value2}`;
}
const MIN_SECOND = 0;
const MAX_SECOND = 59;
const MIN_MINUTE = 0;
const MAX_MINUTE = 59;
const MIN_HOUR = 0;
const MAX_HOUR = 23;
const MIN_DATE = 1;
const MAX_DATE$1 = 31;
const MIN_MONTH = 1;
const MAX_MONTH = 12;
const MIN_WEEK = 1;
const MAX_WEEK = 7;
const TYPE = {
EVERY: "*",
RANGE: "-",
STEP: "/",
SPECIFY: ",",
UNSPECIFIC: "?",
LAST_DAY: "L",
WELL: "#",
WEEKDAY: "W"
};
const Alias = {
second: $t("cronPicker.second"),
minute: $t("cronPicker.minute"),
hour: $t("cronPicker.hour"),
date: $t("cronPicker.date"),
month: $t("cronPicker.month"),
week: $t("cronPicker.week")
};
const FIELDS = [
{ value: "second", min: MIN_SECOND, max: MAX_SECOND, label: $t("cronPicker.second") },
{ value: "minute", min: MIN_MINUTE, max: MAX_MINUTE, label: $t("cronPicker.minute") },
{ value: "hour", min: MIN_HOUR, max: MAX_HOUR, label: $t("cronPicker.hour") },
{ value: "date", min: MIN_DATE, max: MAX_DATE$1, label: $t("cronPicker.date") },
{ value: "month", min: MIN_MONTH, max: MAX_MONTH, label: $t("cronPicker.month") },
{ value: "week", min: MIN_WEEK, max: MAX_WEEK, label: $t("cronPicker.week") }
];
const DEFAULT_CRON_EXPRESSION = "* * * * *";
const _hoisted_1$c = { class: "check-box" };
const _hoisted_2$8 = { class: "check-box-list" };
const _sfc_main$f = /* @__PURE__ */ defineComponent({
__name: "cron-base",
props: {
modelValue: {
type: String
},
field: {
type: Object,
default: () => {
}
}
},
emits: ["update:modelValue"],
setup(__props, { emit: __emit2 }) {
const radioValue = ref(TYPE.EVERY);
const props3 = __props;
const emits = __emit2;
const range = ref([props3.field.min, props3.field.min + 1]);
const rangeLeft = ref([props3.field.min, props3.field.max - 1]);
const step = ref([props3.field.min, 1]);
const stepLeft = ref([props3.field.min, props3.field.max]);
const wellRight = ref([props3.field.min, props3.field.max]);
const stepRight = ref([1, props3.field.max]);
const specify = ref([]);
const specifies = ref(generateArray(props3.field.min, props3.field.max));
const weekday2 = ref(1);
const lastDayOfWeek = ref(1);
const well = ref([1, props3.field.min]);
const rangeRight = computed(() => {
const { min, max } = props3.field;
return [range.value[0] + 1, max];
});
const isUnspecific = computed(() => {
return ["date", "month", "week"].includes(props3.field.value);
});
const label = computed(() => {
return {
every: `${$t("cronPicker.every")}${Alias[props3.field.value]}`,
start: props3.field.value === "week" ? `${$t("cronPicker.from")}${$t("cronPicker.weekly")}` : $t("cronPicker.from"),
middle: props3.field.value === "week" ? `~${$t("cronPicker.weekly")}` : "~",
end: props3.field.value === "week" ? `${$t("cronPicker.dailyExecution")}` : `${$t("cronPicker.every")}${Alias[props3.field.value]}${$t("cronPicker.execute")}`,
rangeMiddle: props3.field.value === "week" ? $t("cronPicker.startEvery") : `${Alias[props3.field.value]}${$t("cronPicker.startEvery")}`,
rangeEnd: props3.field.value === "week" ? `${$t("cronPicker.day")}${$t("cronPicker.executeOnce")}` : `${Alias[props3.field.value]}${$t("cronPicker.executeOnce")}`
};
});
const currentValue = computed(() => {
const type = radioValue.value;
switch (type) {
case TYPE.EVERY:
case TYPE.UNSPECIFIC:
return type;
case TYPE.RANGE:
return range.value.join(type);
case TYPE.STEP:
return step.value.join(type);
case TYPE.WELL:
return well.value.join(type);
case TYPE.WEEKDAY:
return `${weekday2.value}${type}`;
case TYPE.LAST_DAY:
return props3.field.value === "date" ? type : `${lastDayOfWeek.value}${type}`;
case TYPE.SPECIFY:
return specify.value.length ? [...specify.value].sort((a2, b2) => a2 - b2).join(type) : `${specifies.value[0].value}`;
default:
return "*";
}
});
watch(currentValue, (newVal) => {
emits("update:modelValue", newVal);
});
watch(
() => props3.modelValue,
(newVal) => {
const nowValue = newVal;
if ([TYPE.EVERY, TYPE.UNSPECIFIC].includes(nowValue)) {
radioValue.value = nowValue;
} else if (nowValue.includes(TYPE.RANGE)) {
radioValue.value = TYPE.RANGE;
range.value = nowValue.split(TYPE.RANGE).map((i2) => parseInt(i2));
} else if (nowValue.includes(TYPE.STEP)) {
radioValue.value = TYPE.STEP;
step.value = nowValue.split(TYPE.STEP).map((i2) => parseInt(i2));
} else if (nowValue.includes(TYPE.WELL)) {
radioValue.value = TYPE.WELL;
well.value = nowValue.split(TYPE.WELL).map((i2) => parseInt(i2));
} else if (nowValue.includes(TYPE.WEEKDAY)) {
radioValue.value = TYPE.WEEKDAY;
weekday2.value = parseInt(nowValue);
} else if (nowValue.includes(TYPE.LAST_DAY)) {
radioValue.value = TYPE.LAST_DAY;
lastDayOfWeek.value = parseInt(nowValue);
} else {
radioValue.value = TYPE.SPECIFY;
specify.value = nowValue.split(TYPE.SPECIFY).map((i2) => parseInt(i2));
}
},
{ immediate: true }
);
const onrangeLeftChange = (value2) => {
const [start, end] = range.value;
if (value2 >= end) {
range.value[1] = value2 + 1;
}
};
const onCheckboxGroupChange = (value2) => {
if (value2.length === 0) {
radioValue.value = TYPE.EVERY;
} else {
radioValue.value = TYPE.SPECIFY;
}
};
return (_ctx, _cache) => {
const _component_a_radio = Radio;
const _component_a_input_number = __unplugin_components_1;
const _component_a_checkbox_group = __unplugin_components_2$2;
const _component_a_radio_group = __unplugin_components_1$4;
return openBlock(), createBlock(_component_a_radio_group, {
class: "radio-group",
value: radioValue.value,
"onUpdate:value": _cache[9] || (_cache[9] = ($event) => radioValue.value = $event)
}, {
default: withCtx(() => [
createVNode(_component_a_radio, {
value: unref(TYPE).EVERY
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(label.value.every), 1)
]),
_: 1
}, 8, ["value"]),
isUnspecific.value ? (openBlock(), createBlock(_component_a_radio, {
key: 0,
value: unref(TYPE).UNSPECIFIC
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.unspecific")), 1)
]),
_: 1
}, 8, ["value"])) : createCommentVNode("", true),
createVNode(_component_a_radio, {
value: unref(TYPE).RANGE
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(label.value.start) + " ", 1),
createVNode(_component_a_input_number, {
value: range.value[0],
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => range.value[0] = $event),
valueModifiers: { tirm: true },
min: rangeLeft.value[0],
max: rangeLeft.value[1],
onChange: onrangeLeftChange
}, null, 8, ["value", "min", "max"]),
createTextVNode(" " + toDisplayString$1(label.value.middle) + " ", 1),
createVNode(_component_a_input_number, {
value: range.value[1],
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => range.value[1] = $event),
valueModifiers: { tirm: true },
min: rangeRight.value[0],
max: rangeRight.value[1]
}, null, 8, ["value", "min", "max"]),
createTextVNode(" " + toDisplayString$1(label.value.end), 1)
]),
_: 1
}, 8, ["value"]),
__props.field.value != "week" ? (openBlock(), createBlock(_component_a_radio, {
key: 1,
value: unref(TYPE).STEP
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(label.value.start) + " ", 1),
createVNode(_component_a_input_number, {
value: step.value[0],
"onUpdate:value": _cache[2] || (_cache[2] = ($event) => step.value[0] = $event),
valueModifiers: { tirm: true },
min: stepLeft.value[0],
max: stepLeft.value[1],
onChange: onrangeLeftChange
}, null, 8, ["value", "min", "max"]),
createTextVNode(" " + toDisplayString$1(label.value.rangeMiddle) + " ", 1),
createVNode(_component_a_input_number, {
value: step.value[1],
"onUpdate:value": _cache[3] || (_cache[3] = ($event) => step.value[1] = $event),
valueModifiers: { tirm: true },
min: stepRight.value[0],
max: stepRight.value[1]
}, null, 8, ["value", "min", "max"]),
createTextVNode(" " + toDisplayString$1(label.value.rangeEnd), 1)
]),
_: 1
}, 8, ["value"])) : createCommentVNode("", true),
__props.field.value === "date" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
createVNode(_component_a_radio, {
value: unref(TYPE).WEEKDAY
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.monthly")) + " ", 1),
createVNode(_component_a_input_number, {
value: weekday2.value,
"onUpdate:value": _cache[4] || (_cache[4] = ($event) => weekday2.value = $event),
valueModifiers: { trim: true },
min: rangeLeft.value[0],
max: rangeLeft.value[1]
}, null, 8, ["value", "min", "max"]),
createTextVNode(" " + toDisplayString$1(unref($t)("cronPicker.day")) + toDisplayString$1(unref($t)("cronPicker.workly")), 1)
]),
_: 1
}, 8, ["value"]),
createVNode(_component_a_radio, {
value: unref(TYPE).LAST_DAY
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.lastDay")), 1)
]),
_: 1
}, 8, ["value"])
], 64)) : createCommentVNode("", true),
__props.field.value === "week" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
createVNode(_component_a_radio, {
value: unref(TYPE).WELL
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.which")) + " ", 1),
createVNode(_component_a_input_number, {
value: well.value[0],
"onUpdate:value": _cache[5] || (_cache[5] = ($event) => well.value[0] = $event),
valueModifiers: { trim: true },
min: 1,
max: 4
}, null, 8, ["value"]),
createTextVNode(" " + toDisplayString$1(unref($t)("cronPicker.weekOfWeek")) + " ", 1),
createVNode(_component_a_input_number, {
value: well.value[1],
"onUpdate:value": _cache[6] || (_cache[6] = ($event) => well.value[1] = $event),
valueModifiers: { trim: true },
min: wellRight.value[0],
max: wellRight.value[1]
}, null, 8, ["value", "min", "max"])
]),
_: 1
}, 8, ["value"]),
createVNode(_component_a_radio, {
value: unref(TYPE).LAST_DAY
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.lastWeek")) + " ", 1),
createVNode(_component_a_input_number, {
value: lastDayOfWeek.value,
"onUpdate:value": _cache[7] || (_cache[7] = ($event) => lastDayOfWeek.value = $event),
valueModifiers: { trim: true },
min: wellRight.value[0],
max: wellRight.value[1]
}, null, 8, ["value", "min", "max"])
]),
_: 1
}, 8, ["value"])
], 64)) : createCommentVNode("", true),
createVNode(_component_a_radio, {
value: unref(TYPE).SPECIFY
}, {
default: withCtx(() => [
createElementVNode("div", _hoisted_1$c, [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.appoint")) + " ", 1),
createElementVNode("div", _hoisted_2$8, [
createVNode(_component_a_checkbox_group, {
value: specify.value,
"onUpdate:value": _cache[8] || (_cache[8] = ($event) => specify.value = $event),
options: specifies.value,
onChange: onCheckboxGroupChange
}, null, 8, ["value", "options"])
])
])
]),
_: 1
}, 8, ["value"])
]),
_: 1
}, 8, ["value"]);
};
}
});
const cronBase_vue_vue_type_style_index_0_scoped_dffc3d18_lang = "";
const CronBase = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-dffc3d18"]]);
const _hoisted_1$b = { class: "cron-wrapper" };
const _hoisted_2$7 = { class: "expression" };
const _hoisted_3$4 = { class: "expression-title" };
const _hoisted_4$3 = { class: "title-cron" };
const _hoisted_5$3 = { class: "expression-title expression-content" };
const _hoisted_6$2 = { class: "title-item" };
const _hoisted_7$2 = ["value"];
const _hoisted_8$2 = { class: "title-item" };
const _hoisted_9$2 = ["value"];
const _hoisted_10$2 = { class: "title-item" };
const _hoisted_11$1 = ["value"];
const _hoisted_12$1 = { class: "title-item" };
const _hoisted_13$1 = ["value"];
const _hoisted_14$1 = { class: "title-item" };
const _hoisted_15 = ["value"];
const _hoisted_16 = { class: "title-item" };
const _hoisted_17 = ["value"];
const _hoisted_18 = { class: "title-cron" };
const _sfc_main$e = /* @__PURE__ */ defineComponent({
__name: "pop-tab",
props: {
modelValue: {
type: String,
default: DEFAULT_CRON_EXPRESSION
}
},
emits: ["update:modelValue", "parse"],
setup(__props, { emit: __emit2 }) {
const props3 = __props;
const emits = __emit2;
const activeKey = ref(FIELDS[0].value);
const cron = reactive({ second: "", minute: "", hour: "", date: "", month: "", week: "" });
const contabValue = ref("");
watch(
() => props3.modelValue,
(newVal) => {
let [second, minute, hour, date2, month, week] = newVal.split(" ");
Object.assign(cron, {
second: second || "*",
minute: minute || "*",
hour: hour || "*",
date: date2 || "*",
month: month || "*",
week: week || "?"
});
},
{ immediate: true }
);
watch(
cron,
(newVal) => {
contabValue.value = Object.values(newVal).join(" ");
emits("update:modelValue", Object.values(newVal).join(" "));
},
{ deep: true, immediate: true }
);
const getSearch = (val) => {
let [second, minute, hour, date2, month, week] = val.split(" ");
Object.assign(cron, { second, minute, hour, date: date2, month, week });
emits("parse", contabValue.value);
};
return (_ctx, _cache) => {
const _component_a_input_search = __unplugin_components_0;
const _component_a_tab_pane = __unplugin_components_1$3;
const _component_a_tabs = Tabs;
return openBlock(), createElementBlock("div", _hoisted_1$b, [
createElementVNode("div", _hoisted_2$7, [
createElementVNode("div", _hoisted_3$4, [
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(FIELDS), (field) => {
return openBlock(), createElementBlock("div", {
class: "title-item",
key: field.value
}, toDisplayString$1(field.label), 1);
}), 128)),
createElementVNode("div", _hoisted_4$3, toDisplayString$1(unref($t)("cronPicker.cronExpression")), 1)
]),
createElementVNode("div", _hoisted_5$3, [
createElementVNode("div", _hoisted_6$2, [
createElementVNode("input", {
type: "text",
class: "tab-input",
value: cron.second,
readonly: ""
}, null, 8, _hoisted_7$2)
]),
createElementVNode("div", _hoisted_8$2, [
createElementVNode("input", {
type: "text",
class: "tab-input",
value: cron.minute,
readonly: ""
}, null, 8, _hoisted_9$2)
]),
createElementVNode("div", _hoisted_10$2, [
createElementVNode("input", {
type: "text",
class: "tab-input",
value: cron.hour,
readonly: ""
}, null, 8, _hoisted_11$1)
]),
createElementVNode("div", _hoisted_12$1, [
createElementVNode("input", {
type: "text",
class: "tab-input",
value: cron.date,
readonly: ""
}, null, 8, _hoisted_13$1)
]),
createElementVNode("div", _hoisted_14$1, [
createElementVNode("input", {
type: "text",
class: "tab-input",
value: cron.month,
readonly: ""
}, null, 8, _hoisted_15)
]),
createElementVNode("div", _hoisted_16, [
createElementVNode("input", {
type: "text",
class: "tab-input",
value: cron.week,
readonly: ""
}, null, 8, _hoisted_17)
]),
createElementVNode("div", _hoisted_18, [
createVNode(_component_a_input_search, {
placeholder: unref($t)("cronPicker.cronInput"),
"enter-button": unref($t)("cronPicker.parse"),
value: contabValue.value,
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => contabValue.value = $event),
onSearch: getSearch
}, null, 8, ["placeholder", "enter-button", "value"])
])
])
]),
createVNode(_component_a_tabs, {
class: "cron-tabs",
activeKey: activeKey.value,
"onUpdate:activeKey": _cache[1] || (_cache[1] = ($event) => activeKey.value = $event)
}, {
leftExtra: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.ruleType")), 1)
]),
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(FIELDS), (field) => {
return openBlock(), createBlock(_component_a_tab_pane, {
tab: field.label,
key: field.value
}, {
default: withCtx(() => [
createVNode(CronBase, {
modelValue: cron[field.value],
"onUpdate:modelValue": ($event) => cron[field.value] = $event,
field
}, null, 8, ["modelValue", "onUpdate:modelValue", "field"])
]),
_: 2
}, 1032, ["tab"]);
}), 128))
]),
_: 1
}, 8, ["activeKey"])
]);
};
}
});
const popTab_vue_vue_type_style_index_0_scoped_81b11e20_lang = "";
const PopTab = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-81b11e20"]]);
const _hoisted_1$a = { class: "result-wrapper" };
const _hoisted_2$6 = { class: "result-wrapper-title" };
const _hoisted_3$3 = { class: "result-wrapper-content" };
const _sfc_main$d = /* @__PURE__ */ defineComponent({
__name: "cron-tab-result",
props: {
previews: {
type: Array,
default: () => []
}
},
emits: ["emptyPre"],
setup(__props, { emit: __emit2 }) {
const emits = __emit2;
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1$a, [
createElementVNode("div", _hoisted_2$6, toDisplayString$1(unref($t)("cronPicker.viewTenTimes")), 1),
createElementVNode("div", _hoisted_3$3, [
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.previews, (preview, index2) => {
return openBlock(), createElementBlock("div", { key: index2 }, toDisplayString$1(preview), 1);
}), 128)),
__props.previews.length > 0 ? (openBlock(), createBlock(unref(CloseCircleOutlined$3), {
key: 0,
class: "close",
onClick: _cache[0] || (_cache[0] = ($event) => emits("emptyPre"))
})) : createCommentVNode("", true)
])
]);
};
}
});
const cronTabResult_vue_vue_type_style_index_0_lang = "";
var luxon$1 = {};
Object.defineProperty(luxon$1, "__esModule", { value: true });
class LuxonError extends Error {
}
class InvalidDateTimeError extends LuxonError {
constructor(reason) {
super(`Invalid DateTime: ${reason.toMessage()}`);
}
}
class InvalidIntervalError extends LuxonError {
constructor(reason) {
super(`Invalid Interval: ${reason.toMessage()}`);
}
}
class InvalidDurationError extends LuxonError {
constructor(reason) {
super(`Invalid Duration: ${reason.toMessage()}`);
}
}
class ConflictingSpecificationError extends LuxonError {
}
class InvalidUnitError extends LuxonError {
constructor(unit) {
super(`Invalid unit ${unit}`);
}
}
class InvalidArgumentError extends LuxonError {
}
class ZoneIsAbstractError extends LuxonError {
constructor() {
super("Zone is an abstract class");
}
}
const n = "numeric", s = "short", l = "long";
const DATE_SHORT = {
year: n,
month: n,
day: n
};
const DATE_MED = {
year: n,
month: s,
day: n
};
const DATE_MED_WITH_WEEKDAY = {
year: n,
month: s,
day: n,
weekday: s
};
const DATE_FULL = {
year: n,
month: l,
day: n
};
const DATE_HUGE = {
year: n,
month: l,
day: n,
weekday: l
};
const TIME_SIMPLE = {
hour: n,
minute: n
};
const TIME_WITH_SECONDS = {
hour: n,
minute: n,
second: n
};
const TIME_WITH_SHORT_OFFSET = {
hour: n,
minute: n,
second: n,
timeZoneName: s
};
const TIME_WITH_LONG_OFFSET = {
hour: n,
minute: n,
second: n,
timeZoneName: l
};
const TIME_24_SIMPLE = {
hour: n,
minute: n,
hourCycle: "h23"
};
const TIME_24_WITH_SECONDS = {
hour: n,
minute: n,
second: n,
hourCycle: "h23"
};
const TIME_24_WITH_SHORT_OFFSET = {
hour: n,
minute: n,
second: n,
hourCycle: "h23",
timeZoneName: s
};
const TIME_24_WITH_LONG_OFFSET = {
hour: n,
minute: n,
second: n,
hourCycle: "h23",
timeZoneName: l
};
const DATETIME_SHORT = {
year: n,
month: n,
day: n,
hour: n,
minute: n
};
const DATETIME_SHORT_WITH_SECONDS = {
year: n,
month: n,
day: n,
hour: n,
minute: n,
second: n
};
const DATETIME_MED = {
year: n,
month: s,
day: n,
hour: n,
minute: n
};
const DATETIME_MED_WITH_SECONDS = {
year: n,
month: s,
day: n,
hour: n,
minute: n,
second: n
};
const DATETIME_MED_WITH_WEEKDAY = {
year: n,
month: s,
day: n,
weekday: s,
hour: n,
minute: n
};
const DATETIME_FULL = {
year: n,
month: l,
day: n,
hour: n,
minute: n,
timeZoneName: s
};
const DATETIME_FULL_WITH_SECONDS = {
year: n,
month: l,
day: n,
hour: n,
minute: n,
second: n,
timeZoneName: s
};
const DATETIME_HUGE = {
year: n,
month: l,
day: n,
weekday: l,
hour: n,
minute: n,
timeZoneName: l
};
const DATETIME_HUGE_WITH_SECONDS = {
year: n,
month: l,
day: n,
weekday: l,
hour: n,
minute: n,
second: n,
timeZoneName: l
};
class Zone {
/**
* The type of zone
* @abstract
* @type {string}
*/
get type() {
throw new ZoneIsAbstractError();
}
/**
* The name of this zone.
* @abstract
* @type {string}
*/
get name() {
throw new ZoneIsAbstractError();
}
get ianaName() {
return this.name;
}
/**
* Returns whether the offset is known to be fixed for the whole year.
* @abstract
* @type {boolean}
*/
get isUniversal() {
throw new ZoneIsAbstractError();
}
/**
* Returns the offset's common name (such as EST) at the specified timestamp
* @abstract
* @param {number} ts - Epoch milliseconds for which to get the name
* @param {Object} opts - Options to affect the format
* @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
* @param {string} opts.locale - What locale to return the offset name in.
* @return {string}
*/
offsetName(ts, opts) {
throw new ZoneIsAbstractError();
}
/**
* Returns the offset's value as a string
* @abstract
* @param {number} ts - Epoch milliseconds for which to get the offset
* @param {string} format - What style of offset to return.
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
* @return {string}
*/
formatOffset(ts, format3) {
throw new ZoneIsAbstractError();
}
/**
* Return the offset in minutes for this zone at the specified timestamp.
* @abstract
* @param {number} ts - Epoch milliseconds for which to compute the offset
* @return {number}
*/
offset(ts) {
throw new ZoneIsAbstractError();
}
/**
* Return whether this Zone is equal to another zone
* @abstract
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
equals(otherZone) {
throw new ZoneIsAbstractError();
}
/**
* Return whether this Zone is valid.
* @abstract
* @type {boolean}
*/
get isValid() {
throw new ZoneIsAbstractError();
}
}
let singleton$1 = null;
class SystemZone extends Zone {
/**
* Get a singleton instance of the local zone
* @return {SystemZone}
*/
static get instance() {
if (singleton$1 === null) {
singleton$1 = new SystemZone();
}
return singleton$1;
}
/** @override **/
get type() {
return "system";
}
/** @override **/
get name() {
return new Intl.DateTimeFormat().resolvedOptions().timeZone;
}
/** @override **/
get isUniversal() {
return false;
}
/** @override **/
offsetName(ts, {
format: format3,
locale: locale3
}) {
return parseZoneInfo(ts, format3, locale3);
}
/** @override **/
formatOffset(ts, format3) {
return formatOffset(this.offset(ts), format3);
}
/** @override **/
offset(ts) {
return -new Date(ts).getTimezoneOffset();
}
/** @override **/
equals(otherZone) {
return otherZone.type === "system";
}
/** @override **/
get isValid() {
return true;
}
}
let dtfCache = {};
function makeDTF(zone) {
if (!dtfCache[zone]) {
dtfCache[zone] = new Intl.DateTimeFormat("en-US", {
hour12: false,
timeZone: zone,
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
era: "short"
});
}
return dtfCache[zone];
}
const typeToPos = {
year: 0,
month: 1,
day: 2,
era: 3,
hour: 4,
minute: 5,
second: 6
};
function hackyOffset(dtf, date2) {
const formatted = dtf.format(date2).replace(/\u200E/g, ""), parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted), [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;
return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];
}
function partsOffset(dtf, date2) {
const formatted = dtf.formatToParts(date2);
const filled = [];
for (let i2 = 0; i2 < formatted.length; i2++) {
const {
type,
value: value2
} = formatted[i2];
const pos = typeToPos[type];
if (type === "era") {
filled[pos] = value2;
} else if (!isUndefined(pos)) {
filled[pos] = parseInt(value2, 10);
}
}
return filled;
}
let ianaZoneCache = {};
class IANAZone extends Zone {
/**
* @param {string} name - Zone name
* @return {IANAZone}
*/
static create(name) {
if (!ianaZoneCache[name]) {
ianaZoneCache[name] = new IANAZone(name);
}
return ianaZoneCache[name];
}
/**
* Reset local caches. Should only be necessary in testing scenarios.
* @return {void}
*/
static resetCache() {
ianaZoneCache = {};
dtfCache = {};
}
/**
* Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.
* @param {string} s - The string to check validity on
* @example IANAZone.isValidSpecifier("America/New_York") //=> true
* @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false
* @deprecated This method returns false for some valid IANA names. Use isValidZone instead.
* @return {boolean}
*/
static isValidSpecifier(s2) {
return this.isValidZone(s2);
}
/**
* Returns whether the provided string identifies a real zone
* @param {string} zone - The string to check
* @example IANAZone.isValidZone("America/New_York") //=> true
* @example IANAZone.isValidZone("Fantasia/Castle") //=> false
* @example IANAZone.isValidZone("Sport~~blorp") //=> false
* @return {boolean}
*/
static isValidZone(zone) {
if (!zone) {
return false;
}
try {
new Intl.DateTimeFormat("en-US", {
timeZone: zone
}).format();
return true;
} catch (e2) {
return false;
}
}
constructor(name) {
super();
this.zoneName = name;
this.valid = IANAZone.isValidZone(name);
}
/** @override **/
get type() {
return "iana";
}
/** @override **/
get name() {
return this.zoneName;
}
/** @override **/
get isUniversal() {
return false;
}
/** @override **/
offsetName(ts, {
format: format3,
locale: locale3
}) {
return parseZoneInfo(ts, format3, locale3, this.name);
}
/** @override **/
formatOffset(ts, format3) {
return formatOffset(this.offset(ts), format3);
}
/** @override **/
offset(ts) {
const date2 = new Date(ts);
if (isNaN(date2))
return NaN;
const dtf = makeDTF(this.name);
let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts ? partsOffset(dtf, date2) : hackyOffset(dtf, date2);
if (adOrBc === "BC") {
year = -Math.abs(year) + 1;
}
const adjustedHour = hour === 24 ? 0 : hour;
const asUTC = objToLocalTS({
year,
month,
day,
hour: adjustedHour,
minute,
second,
millisecond: 0
});
let asTS = +date2;
const over = asTS % 1e3;
asTS -= over >= 0 ? over : 1e3 + over;
return (asUTC - asTS) / (60 * 1e3);
}
/** @override **/
equals(otherZone) {
return otherZone.type === "iana" && otherZone.name === this.name;
}
/** @override **/
get isValid() {
return this.valid;
}
}
let intlLFCache = {};
function getCachedLF(locString, opts = {}) {
const key2 = JSON.stringify([locString, opts]);
let dtf = intlLFCache[key2];
if (!dtf) {
dtf = new Intl.ListFormat(locString, opts);
intlLFCache[key2] = dtf;
}
return dtf;
}
let intlDTCache = {};
function getCachedDTF(locString, opts = {}) {
const key2 = JSON.stringify([locString, opts]);
let dtf = intlDTCache[key2];
if (!dtf) {
dtf = new Intl.DateTimeFormat(locString, opts);
intlDTCache[key2] = dtf;
}
return dtf;
}
let intlNumCache = {};
function getCachedINF(locString, opts = {}) {
const key2 = JSON.stringify([locString, opts]);
let inf = intlNumCache[key2];
if (!inf) {
inf = new Intl.NumberFormat(locString, opts);
intlNumCache[key2] = inf;
}
return inf;
}
let intlRelCache = {};
function getCachedRTF(locString, opts = {}) {
const {
base,
...cacheKeyOpts
} = opts;
const key2 = JSON.stringify([locString, cacheKeyOpts]);
let inf = intlRelCache[key2];
if (!inf) {
inf = new Intl.RelativeTimeFormat(locString, opts);
intlRelCache[key2] = inf;
}
return inf;
}
let sysLocaleCache = null;
function systemLocale() {
if (sysLocaleCache) {
return sysLocaleCache;
} else {
sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;
return sysLocaleCache;
}
}
let weekInfoCache = {};
function getCachedWeekInfo(locString) {
let data2 = weekInfoCache[locString];
if (!data2) {
const locale3 = new Intl.Locale(locString);
data2 = "getWeekInfo" in locale3 ? locale3.getWeekInfo() : locale3.weekInfo;
weekInfoCache[locString] = data2;
}
return data2;
}
function parseLocaleString(localeStr) {
const xIndex = localeStr.indexOf("-x-");
if (xIndex !== -1) {
localeStr = localeStr.substring(0, xIndex);
}
const uIndex = localeStr.indexOf("-u-");
if (uIndex === -1) {
return [localeStr];
} else {
let options;
let selectedStr;
try {
options = getCachedDTF(localeStr).resolvedOptions();
selectedStr = localeStr;
} catch (e2) {
const smaller = localeStr.substring(0, uIndex);
options = getCachedDTF(smaller).resolvedOptions();
selectedStr = smaller;
}
const {
numberingSystem,
calendar
} = options;
return [selectedStr, numberingSystem, calendar];
}
}
function intlConfigString(localeStr, numberingSystem, outputCalendar) {
if (outputCalendar || numberingSystem) {
if (!localeStr.includes("-u-")) {
localeStr += "-u";
}
if (outputCalendar) {
localeStr += `-ca-${outputCalendar}`;
}
if (numberingSystem) {
localeStr += `-nu-${numberingSystem}`;
}
return localeStr;
} else {
return localeStr;
}
}
function mapMonths(f2) {
const ms = [];
for (let i2 = 1; i2 <= 12; i2++) {
const dt = DateTime.utc(2009, i2, 1);
ms.push(f2(dt));
}
return ms;
}
function mapWeekdays(f2) {
const ms = [];
for (let i2 = 1; i2 <= 7; i2++) {
const dt = DateTime.utc(2016, 11, 13 + i2);
ms.push(f2(dt));
}
return ms;
}
function listStuff(loc, length, englishFn, intlFn) {
const mode = loc.listingMode();
if (mode === "error") {
return null;
} else if (mode === "en") {
return englishFn(length);
} else {
return intlFn(length);
}
}
function supportsFastNumbers(loc) {
if (loc.numberingSystem && loc.numberingSystem !== "latn") {
return false;
} else {
return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === "latn";
}
}
class PolyNumberFormatter {
constructor(intl, forceSimple, opts) {
this.padTo = opts.padTo || 0;
this.floor = opts.floor || false;
const {
padTo,
floor,
...otherOpts
} = opts;
if (!forceSimple || Object.keys(otherOpts).length > 0) {
const intlOpts = {
useGrouping: false,
...opts
};
if (opts.padTo > 0)
intlOpts.minimumIntegerDigits = opts.padTo;
this.inf = getCachedINF(intl, intlOpts);
}
}
format(i2) {
if (this.inf) {
const fixed = this.floor ? Math.floor(i2) : i2;
return this.inf.format(fixed);
} else {
const fixed = this.floor ? Math.floor(i2) : roundTo(i2, 3);
return padStart(fixed, this.padTo);
}
}
}
class PolyDateFormatter {
constructor(dt, intl, opts) {
this.opts = opts;
this.originalZone = void 0;
let z2 = void 0;
if (this.opts.timeZone) {
this.dt = dt;
} else if (dt.zone.type === "fixed") {
const gmtOffset = -1 * (dt.offset / 60);
const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
z2 = offsetZ;
this.dt = dt;
} else {
z2 = "UTC";
this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({
minutes: dt.offset
});
this.originalZone = dt.zone;
}
} else if (dt.zone.type === "system") {
this.dt = dt;
} else if (dt.zone.type === "iana") {
this.dt = dt;
z2 = dt.zone.name;
} else {
z2 = "UTC";
this.dt = dt.setZone("UTC").plus({
minutes: dt.offset
});
this.originalZone = dt.zone;
}
const intlOpts = {
...this.opts
};
intlOpts.timeZone = intlOpts.timeZone || z2;
this.dtf = getCachedDTF(intl, intlOpts);
}
format() {
if (this.originalZone) {
return this.formatToParts().map(({
value: value2
}) => value2).join("");
}
return this.dtf.format(this.dt.toJSDate());
}
formatToParts() {
const parts = this.dtf.formatToParts(this.dt.toJSDate());
if (this.originalZone) {
return parts.map((part) => {
if (part.type === "timeZoneName") {
const offsetName = this.originalZone.offsetName(this.dt.ts, {
locale: this.dt.locale,
format: this.opts.timeZoneName
});
return {
...part,
value: offsetName
};
} else {
return part;
}
});
}
return parts;
}
resolvedOptions() {
return this.dtf.resolvedOptions();
}
}
class PolyRelFormatter {
constructor(intl, isEnglish, opts) {
this.opts = {
style: "long",
...opts
};
if (!isEnglish && hasRelative()) {
this.rtf = getCachedRTF(intl, opts);
}
}
format(count, unit) {
if (this.rtf) {
return this.rtf.format(count, unit);
} else {
return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long");
}
}
formatToParts(count, unit) {
if (this.rtf) {
return this.rtf.formatToParts(count, unit);
} else {
return [];
}
}
}
const fallbackWeekSettings = {
firstDay: 1,
minimalDays: 4,
weekend: [6, 7]
};
class Locale {
static fromOpts(opts) {
return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN);
}
static create(locale3, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {
const specifiedLocale = locale3 || Settings.defaultLocale;
const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;
return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);
}
static resetCache() {
sysLocaleCache = null;
intlDTCache = {};
intlNumCache = {};
intlRelCache = {};
}
static fromObject({
locale: locale3,
numberingSystem,
outputCalendar,
weekSettings
} = {}) {
return Locale.create(locale3, numberingSystem, outputCalendar, weekSettings);
}
constructor(locale3, numbering, outputCalendar, weekSettings, specifiedLocale) {
const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale3);
this.locale = parsedLocale;
this.numberingSystem = numbering || parsedNumberingSystem || null;
this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
this.weekSettings = weekSettings;
this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
this.weekdaysCache = {
format: {},
standalone: {}
};
this.monthsCache = {
format: {},
standalone: {}
};
this.meridiemCache = null;
this.eraCache = {};
this.specifiedLocale = specifiedLocale;
this.fastNumbersCached = null;
}
get fastNumbers() {
if (this.fastNumbersCached == null) {
this.fastNumbersCached = supportsFastNumbers(this);
}
return this.fastNumbersCached;
}
listingMode() {
const isActuallyEn = this.isEnglish();
const hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
return isActuallyEn && hasNoWeirdness ? "en" : "intl";
}
clone(alts) {
if (!alts || Object.getOwnPropertyNames(alts).length === 0) {
return this;
} else {
return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false);
}
}
redefaultToEN(alts = {}) {
return this.clone({
...alts,
defaultToEN: true
});
}
redefaultToSystem(alts = {}) {
return this.clone({
...alts,
defaultToEN: false
});
}
months(length, format3 = false) {
return listStuff(this, length, months, () => {
const intl = format3 ? {
month: length,
day: "numeric"
} : {
month: length
}, formatStr = format3 ? "format" : "standalone";
if (!this.monthsCache[formatStr][length]) {
this.monthsCache[formatStr][length] = mapMonths((dt) => this.extract(dt, intl, "month"));
}
return this.monthsCache[formatStr][length];
});
}
weekdays(length, format3 = false) {
return listStuff(this, length, weekdays, () => {
const intl = format3 ? {
weekday: length,
year: "numeric",
month: "long",
day: "numeric"
} : {
weekday: length
}, formatStr = format3 ? "format" : "standalone";
if (!this.weekdaysCache[formatStr][length]) {
this.weekdaysCache[formatStr][length] = mapWeekdays((dt) => this.extract(dt, intl, "weekday"));
}
return this.weekdaysCache[formatStr][length];
});
}
meridiems() {
return listStuff(this, void 0, () => meridiems, () => {
if (!this.meridiemCache) {
const intl = {
hour: "numeric",
hourCycle: "h12"
};
this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map((dt) => this.extract(dt, intl, "dayperiod"));
}
return this.meridiemCache;
});
}
eras(length) {
return listStuff(this, length, eras, () => {
const intl = {
era: length
};
if (!this.eraCache[length]) {
this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map((dt) => this.extract(dt, intl, "era"));
}
return this.eraCache[length];
});
}
extract(dt, intlOpts, field) {
const df = this.dtFormatter(dt, intlOpts), results = df.formatToParts(), matching = results.find((m2) => m2.type.toLowerCase() === field);
return matching ? matching.value : null;
}
numberFormatter(opts = {}) {
return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);
}
dtFormatter(dt, intlOpts = {}) {
return new PolyDateFormatter(dt, this.intl, intlOpts);
}
relFormatter(opts = {}) {
return new PolyRelFormatter(this.intl, this.isEnglish(), opts);
}
listFormatter(opts = {}) {
return getCachedLF(this.intl, opts);
}
isEnglish() {
return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
}
getWeekSettings() {
if (this.weekSettings) {
return this.weekSettings;
} else if (!hasLocaleWeekInfo()) {
return fallbackWeekSettings;
} else {
return getCachedWeekInfo(this.locale);
}
}
getStartOfWeek() {
return this.getWeekSettings().firstDay;
}
getMinDaysInFirstWeek() {
return this.getWeekSettings().minimalDays;
}
getWeekendDays() {
return this.getWeekSettings().weekend;
}
equals(other) {
return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
}
}
let singleton = null;
class FixedOffsetZone extends Zone {
/**
* Get a singleton instance of UTC
* @return {FixedOffsetZone}
*/
static get utcInstance() {
if (singleton === null) {
singleton = new FixedOffsetZone(0);
}
return singleton;
}
/**
* Get an instance with a specified offset
* @param {number} offset - The offset in minutes
* @return {FixedOffsetZone}
*/
static instance(offset3) {
return offset3 === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset3);
}
/**
* Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6"
* @param {string} s - The offset string to parse
* @example FixedOffsetZone.parseSpecifier("UTC+6")
* @example FixedOffsetZone.parseSpecifier("UTC+06")
* @example FixedOffsetZone.parseSpecifier("UTC-6:00")
* @return {FixedOffsetZone}
*/
static parseSpecifier(s2) {
if (s2) {
const r2 = s2.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
if (r2) {
return new FixedOffsetZone(signedOffset(r2[1], r2[2]));
}
}
return null;
}
constructor(offset3) {
super();
this.fixed = offset3;
}
/** @override **/
get type() {
return "fixed";
}
/** @override **/
get name() {
return this.fixed === 0 ? "UTC" : `UTC${formatOffset(this.fixed, "narrow")}`;
}
get ianaName() {
if (this.fixed === 0) {
return "Etc/UTC";
} else {
return `Etc/GMT${formatOffset(-this.fixed, "narrow")}`;
}
}
/** @override **/
offsetName() {
return this.name;
}
/** @override **/
formatOffset(ts, format3) {
return formatOffset(this.fixed, format3);
}
/** @override **/
get isUniversal() {
return true;
}
/** @override **/
offset() {
return this.fixed;
}
/** @override **/
equals(otherZone) {
return otherZone.type === "fixed" && otherZone.fixed === this.fixed;
}
/** @override **/
get isValid() {
return true;
}
}
class InvalidZone extends Zone {
constructor(zoneName) {
super();
this.zoneName = zoneName;
}
/** @override **/
get type() {
return "invalid";
}
/** @override **/
get name() {
return this.zoneName;
}
/** @override **/
get isUniversal() {
return false;
}
/** @override **/
offsetName() {
return null;
}
/** @override **/
formatOffset() {
return "";
}
/** @override **/
offset() {
return NaN;
}
/** @override **/
equals() {
return false;
}
/** @override **/
get isValid() {
return false;
}
}
function normalizeZone(input, defaultZone2) {
if (isUndefined(input) || input === null) {
return defaultZone2;
} else if (input instanceof Zone) {
return input;
} else if (isString2(input)) {
const lowered = input.toLowerCase();
if (lowered === "default")
return defaultZone2;
else if (lowered === "local" || lowered === "system")
return SystemZone.instance;
else if (lowered === "utc" || lowered === "gmt")
return FixedOffsetZone.utcInstance;
else
return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);
} else if (isNumber(input)) {
return FixedOffsetZone.instance(input);
} else if (typeof input === "object" && "offset" in input && typeof input.offset === "function") {
return input;
} else {
return new InvalidZone(input);
}
}
let now = () => Date.now(), defaultZone = "system", defaultLocale = null, defaultNumberingSystem = null, defaultOutputCalendar = null, twoDigitCutoffYear = 60, throwOnInvalid, defaultWeekSettings = null;
class Settings {
/**
* Get the callback for returning the current timestamp.
* @type {function}
*/
static get now() {
return now;
}
/**
* Set the callback for returning the current timestamp.
* The function should return a number, which will be interpreted as an Epoch millisecond count
* @type {function}
* @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future
* @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time
*/
static set now(n2) {
now = n2;
}
/**
* Set the default time zone to create DateTimes in. Does not affect existing instances.
* Use the value "system" to reset this value to the system's time zone.
* @type {string}
*/
static set defaultZone(zone) {
defaultZone = zone;
}
/**
* Get the default time zone object currently used to create DateTimes. Does not affect existing instances.
* The default value is the system's time zone (the one set on the machine that runs this code).
* @type {Zone}
*/
static get defaultZone() {
return normalizeZone(defaultZone, SystemZone.instance);
}
/**
* Get the default locale to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultLocale() {
return defaultLocale;
}
/**
* Set the default locale to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultLocale(locale3) {
defaultLocale = locale3;
}
/**
* Get the default numbering system to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultNumberingSystem() {
return defaultNumberingSystem;
}
/**
* Set the default numbering system to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultNumberingSystem(numberingSystem) {
defaultNumberingSystem = numberingSystem;
}
/**
* Get the default output calendar to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultOutputCalendar() {
return defaultOutputCalendar;
}
/**
* Set the default output calendar to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultOutputCalendar(outputCalendar) {
defaultOutputCalendar = outputCalendar;
}
/**
* @typedef {Object} WeekSettings
* @property {number} firstDay
* @property {number} minimalDays
* @property {number[]} weekend
*/
/**
* @return {WeekSettings|null}
*/
static get defaultWeekSettings() {
return defaultWeekSettings;
}
/**
* Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
* how many days are required in the first week of a year.
* Does not affect existing instances.
*
* @param {WeekSettings|null} weekSettings
*/
static set defaultWeekSettings(weekSettings) {
defaultWeekSettings = validateWeekSettings(weekSettings);
}
/**
* Get the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
* @type {number}
*/
static get twoDigitCutoffYear() {
return twoDigitCutoffYear;
}
/**
* Set the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
* @type {number}
* @example Settings.twoDigitCutoffYear = 0 // cut-off year is 0, so all 'yy' are interpreted as current century
* @example Settings.twoDigitCutoffYear = 50 // '49' -> 1949; '50' -> 2050
* @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50
* @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50
*/
static set twoDigitCutoffYear(cutoffYear) {
twoDigitCutoffYear = cutoffYear % 100;
}
/**
* Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
* @type {boolean}
*/
static get throwOnInvalid() {
return throwOnInvalid;
}
/**
* Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
* @type {boolean}
*/
static set throwOnInvalid(t2) {
throwOnInvalid = t2;
}
/**
* Reset Luxon's global caches. Should only be necessary in testing scenarios.
* @return {void}
*/
static resetCaches() {
Locale.resetCache();
IANAZone.resetCache();
}
}
class Invalid {
constructor(reason, explanation) {
this.reason = reason;
this.explanation = explanation;
}
toMessage() {
if (this.explanation) {
return `${this.reason}: ${this.explanation}`;
} else {
return this.reason;
}
}
}
const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
function unitOutOfRange(unit, value2) {
return new Invalid("unit out of range", `you specified ${value2} (of type ${typeof value2}) as a ${unit}, which is invalid`);
}
function dayOfWeek(year, month, day) {
const d2 = new Date(Date.UTC(year, month - 1, day));
if (year < 100 && year >= 0) {
d2.setUTCFullYear(d2.getUTCFullYear() - 1900);
}
const js = d2.getUTCDay();
return js === 0 ? 7 : js;
}
function computeOrdinal(year, month, day) {
return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
}
function uncomputeOrdinal(year, ordinal) {
const table = isLeapYear(year) ? leapLadder : nonLeapLadder, month0 = table.findIndex((i2) => i2 < ordinal), day = ordinal - table[month0];
return {
month: month0 + 1,
day
};
}
function isoWeekdayToLocal(isoWeekday, startOfWeek) {
return (isoWeekday - startOfWeek + 7) % 7 + 1;
}
function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {
const {
year,
month,
day
} = gregObj, ordinal = computeOrdinal(year, month, day), weekday2 = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);
let weekNumber = Math.floor((ordinal - weekday2 + 14 - minDaysInFirstWeek) / 7), weekYear2;
if (weekNumber < 1) {
weekYear2 = year - 1;
weekNumber = weeksInWeekYear(weekYear2, minDaysInFirstWeek, startOfWeek);
} else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {
weekYear2 = year + 1;
weekNumber = 1;
} else {
weekYear2 = year;
}
return {
weekYear: weekYear2,
weekNumber,
weekday: weekday2,
...timeObject(gregObj)
};
}
function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {
const {
weekYear: weekYear2,
weekNumber,
weekday: weekday2
} = weekData, weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear2, 1, minDaysInFirstWeek), startOfWeek), yearInDays = daysInYear(weekYear2);
let ordinal = weekNumber * 7 + weekday2 - weekdayOfJan4 - 7 + minDaysInFirstWeek, year;
if (ordinal < 1) {
year = weekYear2 - 1;
ordinal += daysInYear(year);
} else if (ordinal > yearInDays) {
year = weekYear2 + 1;
ordinal -= daysInYear(weekYear2);
} else {
year = weekYear2;
}
const {
month,
day
} = uncomputeOrdinal(year, ordinal);
return {
year,
month,
day,
...timeObject(weekData)
};
}
function gregorianToOrdinal(gregData) {
const {
year,
month,
day
} = gregData;
const ordinal = computeOrdinal(year, month, day);
return {
year,
ordinal,
...timeObject(gregData)
};
}
function ordinalToGregorian(ordinalData) {
const {
year,
ordinal
} = ordinalData;
const {
month,
day
} = uncomputeOrdinal(year, ordinal);
return {
year,
month,
day,
...timeObject(ordinalData)
};
}
function usesLocalWeekValues(obj, loc) {
const hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear);
if (hasLocaleWeekData) {
const hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);
if (hasIsoWeekData) {
throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");
}
if (!isUndefined(obj.localWeekday))
obj.weekday = obj.localWeekday;
if (!isUndefined(obj.localWeekNumber))
obj.weekNumber = obj.localWeekNumber;
if (!isUndefined(obj.localWeekYear))
obj.weekYear = obj.localWeekYear;
delete obj.localWeekday;
delete obj.localWeekNumber;
delete obj.localWeekYear;
return {
minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),
startOfWeek: loc.getStartOfWeek()
};
} else {
return {
minDaysInFirstWeek: 4,
startOfWeek: 1
};
}
}
function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {
const validYear = isInteger(obj.weekYear), validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)), validWeekday = integerBetween(obj.weekday, 1, 7);
if (!validYear) {
return unitOutOfRange("weekYear", obj.weekYear);
} else if (!validWeek) {
return unitOutOfRange("week", obj.weekNumber);
} else if (!validWeekday) {
return unitOutOfRange("weekday", obj.weekday);
} else
return false;
}
function hasInvalidOrdinalData(obj) {
const validYear = isInteger(obj.year), validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
if (!validYear) {
return unitOutOfRange("year", obj.year);
} else if (!validOrdinal) {
return unitOutOfRange("ordinal", obj.ordinal);
} else
return false;
}
function hasInvalidGregorianData(obj) {
const validYear = isInteger(obj.year), validMonth = integerBetween(obj.month, 1, 12), validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
if (!validYear) {
return unitOutOfRange("year", obj.year);
} else if (!validMonth) {
return unitOutOfRange("month", obj.month);
} else if (!validDay) {
return unitOutOfRange("day", obj.day);
} else
return false;
}
function hasInvalidTimeData(obj) {
const {
hour,
minute,
second,
millisecond
} = obj;
const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, validMinute = integerBetween(minute, 0, 59), validSecond = integerBetween(second, 0, 59), validMillisecond = integerBetween(millisecond, 0, 999);
if (!validHour) {
return unitOutOfRange("hour", hour);
} else if (!validMinute) {
return unitOutOfRange("minute", minute);
} else if (!validSecond) {
return unitOutOfRange("second", second);
} else if (!validMillisecond) {
return unitOutOfRange("millisecond", millisecond);
} else
return false;
}
function isUndefined(o2) {
return typeof o2 === "undefined";
}
function isNumber(o2) {
return typeof o2 === "number";
}
function isInteger(o2) {
return typeof o2 === "number" && o2 % 1 === 0;
}
function isString2(o2) {
return typeof o2 === "string";
}
function isDate(o2) {
return Object.prototype.toString.call(o2) === "[object Date]";
}
function hasRelative() {
try {
return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat;
} catch (e2) {
return false;
}
}
function hasLocaleWeekInfo() {
try {
return typeof Intl !== "undefined" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
} catch (e2) {
return false;
}
}
function maybeArray(thing) {
return Array.isArray(thing) ? thing : [thing];
}
function bestBy(arr, by, compare) {
if (arr.length === 0) {
return void 0;
}
return arr.reduce((best, next2) => {
const pair = [by(next2), next2];
if (!best) {
return pair;
} else if (compare(best[0], pair[0]) === best[0]) {
return best;
} else {
return pair;
}
}, null)[1];
}
function pick(obj, keys2) {
return keys2.reduce((a2, k2) => {
a2[k2] = obj[k2];
return a2;
}, {});
}
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
function validateWeekSettings(settings) {
if (settings == null) {
return null;
} else if (typeof settings !== "object") {
throw new InvalidArgumentError("Week settings must be an object");
} else {
if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some((v2) => !integerBetween(v2, 1, 7))) {
throw new InvalidArgumentError("Invalid week settings");
}
return {
firstDay: settings.firstDay,
minimalDays: settings.minimalDays,
weekend: Array.from(settings.weekend)
};
}
}
function integerBetween(thing, bottom, top) {
return isInteger(thing) && thing >= bottom && thing <= top;
}
function floorMod(x2, n2) {
return x2 - n2 * Math.floor(x2 / n2);
}
function padStart(input, n2 = 2) {
const isNeg = input < 0;
let padded;
if (isNeg) {
padded = "-" + ("" + -input).padStart(n2, "0");
} else {
padded = ("" + input).padStart(n2, "0");
}
return padded;
}
function parseInteger(string) {
if (isUndefined(string) || string === null || string === "") {
return void 0;
} else {
return parseInt(string, 10);
}
}
function parseFloating(string) {
if (isUndefined(string) || string === null || string === "") {
return void 0;
} else {
return parseFloat(string);
}
}
function parseMillis(fraction) {
if (isUndefined(fraction) || fraction === null || fraction === "") {
return void 0;
} else {
const f2 = parseFloat("0." + fraction) * 1e3;
return Math.floor(f2);
}
}
function roundTo(number2, digits, towardZero = false) {
const factor = 10 ** digits, rounder = towardZero ? Math.trunc : Math.round;
return rounder(number2 * factor) / factor;
}
function isLeapYear(year) {
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function daysInYear(year) {
return isLeapYear(year) ? 366 : 365;
}
function daysInMonth(year, month) {
const modMonth = floorMod(month - 1, 12) + 1, modYear = year + (month - modMonth) / 12;
if (modMonth === 2) {
return isLeapYear(modYear) ? 29 : 28;
} else {
return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];
}
}
function objToLocalTS(obj) {
let d2 = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond);
if (obj.year < 100 && obj.year >= 0) {
d2 = new Date(d2);
d2.setUTCFullYear(obj.year, obj.month - 1, obj.day);
}
return +d2;
}
function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {
const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);
return -fwdlw + minDaysInFirstWeek - 1;
}
function weeksInWeekYear(weekYear2, minDaysInFirstWeek = 4, startOfWeek = 1) {
const weekOffset = firstWeekOffset(weekYear2, minDaysInFirstWeek, startOfWeek);
const weekOffsetNext = firstWeekOffset(weekYear2 + 1, minDaysInFirstWeek, startOfWeek);
return (daysInYear(weekYear2) - weekOffset + weekOffsetNext) / 7;
}
function untruncateYear(year) {
if (year > 99) {
return year;
} else
return year > Settings.twoDigitCutoffYear ? 1900 + year : 2e3 + year;
}
function parseZoneInfo(ts, offsetFormat, locale3, timeZone = null) {
const date2 = new Date(ts), intlOpts = {
hourCycle: "h23",
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit"
};
if (timeZone) {
intlOpts.timeZone = timeZone;
}
const modified = {
timeZoneName: offsetFormat,
...intlOpts
};
const parsed = new Intl.DateTimeFormat(locale3, modified).formatToParts(date2).find((m2) => m2.type.toLowerCase() === "timezonename");
return parsed ? parsed.value : null;
}
function signedOffset(offHourStr, offMinuteStr) {
let offHour = parseInt(offHourStr, 10);
if (Number.isNaN(offHour)) {
offHour = 0;
}
const offMin = parseInt(offMinuteStr, 10) || 0, offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;
return offHour * 60 + offMinSigned;
}
function asNumber(value2) {
const numericValue = Number(value2);
if (typeof value2 === "boolean" || value2 === "" || Number.isNaN(numericValue))
throw new InvalidArgumentError(`Invalid unit value ${value2}`);
return numericValue;
}
function normalizeObject(obj, normalizer) {
const normalized = {};
for (const u2 in obj) {
if (hasOwnProperty(obj, u2)) {
const v2 = obj[u2];
if (v2 === void 0 || v2 === null)
continue;
normalized[normalizer(u2)] = asNumber(v2);
}
}
return normalized;
}
function formatOffset(offset3, format3) {
const hours = Math.trunc(Math.abs(offset3 / 60)), minutes = Math.trunc(Math.abs(offset3 % 60)), sign = offset3 >= 0 ? "+" : "-";
switch (format3) {
case "short":
return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;
case "narrow":
return `${sign}${hours}${minutes > 0 ? `:${minutes}` : ""}`;
case "techie":
return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;
default:
throw new RangeError(`Value format ${format3} is out of range for property format`);
}
}
function timeObject(obj) {
return pick(obj, ["hour", "minute", "second", "millisecond"]);
}
const monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
const monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
const monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"];
function months(length) {
switch (length) {
case "narrow":
return [...monthsNarrow];
case "short":
return [...monthsShort];
case "long":
return [...monthsLong];
case "numeric":
return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
case "2-digit":
return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
default:
return null;
}
}
const weekdaysLong = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
const weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
const weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"];
function weekdays(length) {
switch (length) {
case "narrow":
return [...weekdaysNarrow];
case "short":
return [...weekdaysShort];
case "long":
return [...weekdaysLong];
case "numeric":
return ["1", "2", "3", "4", "5", "6", "7"];
default:
return null;
}
}
const meridiems = ["AM", "PM"];
const erasLong = ["Before Christ", "Anno Domini"];
const erasShort = ["BC", "AD"];
const erasNarrow = ["B", "A"];
function eras(length) {
switch (length) {
case "narrow":
return [...erasNarrow];
case "short":
return [...erasShort];
case "long":
return [...erasLong];
default:
return null;
}
}
function meridiemForDateTime(dt) {
return meridiems[dt.hour < 12 ? 0 : 1];
}
function weekdayForDateTime(dt, length) {
return weekdays(length)[dt.weekday - 1];
}
function monthForDateTime(dt, length) {
return months(length)[dt.month - 1];
}
function eraForDateTime(dt, length) {
return eras(length)[dt.year < 0 ? 0 : 1];
}
function formatRelativeTime(unit, count, numeric = "always", narrow = false) {
const units = {
years: ["year", "yr."],
quarters: ["quarter", "qtr."],
months: ["month", "mo."],
weeks: ["week", "wk."],
days: ["day", "day", "days"],
hours: ["hour", "hr."],
minutes: ["minute", "min."],
seconds: ["second", "sec."]
};
const lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1;
if (numeric === "auto" && lastable) {
const isDay = unit === "days";
switch (count) {
case 1:
return isDay ? "tomorrow" : `next ${units[unit][0]}`;
case -1:
return isDay ? "yesterday" : `last ${units[unit][0]}`;
case 0:
return isDay ? "today" : `this ${units[unit][0]}`;
}
}
const isInPast = Object.is(count, -0) || count < 0, fmtValue = Math.abs(count), singular = fmtValue === 1, lilUnits = units[unit], fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit;
return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;
}
function stringifyTokens(splits, tokenToString) {
let s2 = "";
for (const token2 of splits) {
if (token2.literal) {
s2 += token2.val;
} else {
s2 += tokenToString(token2.val);
}
}
return s2;
}
const macroTokenToFormatOpts = {
D: DATE_SHORT,
DD: DATE_MED,
DDD: DATE_FULL,
DDDD: DATE_HUGE,
t: TIME_SIMPLE,
tt: TIME_WITH_SECONDS,
ttt: TIME_WITH_SHORT_OFFSET,
tttt: TIME_WITH_LONG_OFFSET,
T: TIME_24_SIMPLE,
TT: TIME_24_WITH_SECONDS,
TTT: TIME_24_WITH_SHORT_OFFSET,
TTTT: TIME_24_WITH_LONG_OFFSET,
f: DATETIME_SHORT,
ff: DATETIME_MED,
fff: DATETIME_FULL,
ffff: DATETIME_HUGE,
F: DATETIME_SHORT_WITH_SECONDS,
FF: DATETIME_MED_WITH_SECONDS,
FFF: DATETIME_FULL_WITH_SECONDS,
FFFF: DATETIME_HUGE_WITH_SECONDS
};
class Formatter {
static create(locale3, opts = {}) {
return new Formatter(locale3, opts);
}
static parseFormat(fmt) {
let current = null, currentFull = "", bracketed = false;
const splits = [];
for (let i2 = 0; i2 < fmt.length; i2++) {
const c2 = fmt.charAt(i2);
if (c2 === "'") {
if (currentFull.length > 0) {
splits.push({
literal: bracketed || /^\s+$/.test(currentFull),
val: currentFull
});
}
current = null;
currentFull = "";
bracketed = !bracketed;
} else if (bracketed) {
currentFull += c2;
} else if (c2 === current) {
currentFull += c2;
} else {
if (currentFull.length > 0) {
splits.push({
literal: /^\s+$/.test(currentFull),
val: currentFull
});
}
currentFull = c2;
current = c2;
}
}
if (currentFull.length > 0) {
splits.push({
literal: bracketed || /^\s+$/.test(currentFull),
val: currentFull
});
}
return splits;
}
static macroTokenToFormatOpts(token2) {
return macroTokenToFormatOpts[token2];
}
constructor(locale3, formatOpts) {
this.opts = formatOpts;
this.loc = locale3;
this.systemLoc = null;
}
formatWithSystemDefault(dt, opts) {
if (this.systemLoc === null) {
this.systemLoc = this.loc.redefaultToSystem();
}
const df = this.systemLoc.dtFormatter(dt, {
...this.opts,
...opts
});
return df.format();
}
dtFormatter(dt, opts = {}) {
return this.loc.dtFormatter(dt, {
...this.opts,
...opts
});
}
formatDateTime(dt, opts) {
return this.dtFormatter(dt, opts).format();
}
formatDateTimeParts(dt, opts) {
return this.dtFormatter(dt, opts).formatToParts();
}
formatInterval(interval, opts) {
const df = this.dtFormatter(interval.start, opts);
return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());
}
resolvedOptions(dt, opts) {
return this.dtFormatter(dt, opts).resolvedOptions();
}
num(n2, p = 0) {
if (this.opts.forceSimple) {
return padStart(n2, p);
}
const opts = {
...this.opts
};
if (p > 0) {
opts.padTo = p;
}
return this.loc.numberFormatter(opts).format(n2);
}
formatDateTimeFromString(dt, fmt) {
const knownEnglish = this.loc.listingMode() === "en", useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", string = (opts, extract) => this.loc.extract(dt, opts, extract), formatOffset2 = (opts) => {
if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {
return "Z";
}
return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : "";
}, meridiem = () => knownEnglish ? meridiemForDateTime(dt) : string({
hour: "numeric",
hourCycle: "h12"
}, "dayperiod"), month = (length, standalone) => knownEnglish ? monthForDateTime(dt, length) : string(standalone ? {
month: length
} : {
month: length,
day: "numeric"
}, "month"), weekday2 = (length, standalone) => knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? {
weekday: length
} : {
weekday: length,
month: "long",
day: "numeric"
}, "weekday"), maybeMacro = (token2) => {
const formatOpts = Formatter.macroTokenToFormatOpts(token2);
if (formatOpts) {
return this.formatWithSystemDefault(dt, formatOpts);
} else {
return token2;
}
}, era = (length) => knownEnglish ? eraForDateTime(dt, length) : string({
era: length
}, "era"), tokenToString = (token2) => {
switch (token2) {
case "S":
return this.num(dt.millisecond);
case "u":
case "SSS":
return this.num(dt.millisecond, 3);
case "s":
return this.num(dt.second);
case "ss":
return this.num(dt.second, 2);
case "uu":
return this.num(Math.floor(dt.millisecond / 10), 2);
case "uuu":
return this.num(Math.floor(dt.millisecond / 100));
case "m":
return this.num(dt.minute);
case "mm":
return this.num(dt.minute, 2);
case "h":
return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);
case "hh":
return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);
case "H":
return this.num(dt.hour);
case "HH":
return this.num(dt.hour, 2);
case "Z":
return formatOffset2({
format: "narrow",
allowZ: this.opts.allowZ
});
case "ZZ":
return formatOffset2({
format: "short",
allowZ: this.opts.allowZ
});
case "ZZZ":
return formatOffset2({
format: "techie",
allowZ: this.opts.allowZ
});
case "ZZZZ":
return dt.zone.offsetName(dt.ts, {
format: "short",
locale: this.loc.locale
});
case "ZZZZZ":
return dt.zone.offsetName(dt.ts, {
format: "long",
locale: this.loc.locale
});
case "z":
return dt.zoneName;
case "a":
return meridiem();
case "d":
return useDateTimeFormatter ? string({
day: "numeric"
}, "day") : this.num(dt.day);
case "dd":
return useDateTimeFormatter ? string({
day: "2-digit"
}, "day") : this.num(dt.day, 2);
case "c":
return this.num(dt.weekday);
case "ccc":
return weekday2("short", true);
case "cccc":
return weekday2("long", true);
case "ccccc":
return weekday2("narrow", true);
case "E":
return this.num(dt.weekday);
case "EEE":
return weekday2("short", false);
case "EEEE":
return weekday2("long", false);
case "EEEEE":
return weekday2("narrow", false);
case "L":
return useDateTimeFormatter ? string({
month: "numeric",
day: "numeric"
}, "month") : this.num(dt.month);
case "LL":
return useDateTimeFormatter ? string({
month: "2-digit",
day: "numeric"
}, "month") : this.num(dt.month, 2);
case "LLL":
return month("short", true);
case "LLLL":
return month("long", true);
case "LLLLL":
return month("narrow", true);
case "M":
return useDateTimeFormatter ? string({
month: "numeric"
}, "month") : this.num(dt.month);
case "MM":
return useDateTimeFormatter ? string({
month: "2-digit"
}, "month") : this.num(dt.month, 2);
case "MMM":
return month("short", false);
case "MMMM":
return month("long", false);
case "MMMMM":
return month("narrow", false);
case "y":
return useDateTimeFormatter ? string({
year: "numeric"
}, "year") : this.num(dt.year);
case "yy":
return useDateTimeFormatter ? string({
year: "2-digit"
}, "year") : this.num(dt.year.toString().slice(-2), 2);
case "yyyy":
return useDateTimeFormatter ? string({
year: "numeric"
}, "year") : this.num(dt.year, 4);
case "yyyyyy":
return useDateTimeFormatter ? string({
year: "numeric"
}, "year") : this.num(dt.year, 6);
case "G":
return era("short");
case "GG":
return era("long");
case "GGGGG":
return era("narrow");
case "kk":
return this.num(dt.weekYear.toString().slice(-2), 2);
case "kkkk":
return this.num(dt.weekYear, 4);
case "W":
return this.num(dt.weekNumber);
case "WW":
return this.num(dt.weekNumber, 2);
case "n":
return this.num(dt.localWeekNumber);
case "nn":
return this.num(dt.localWeekNumber, 2);
case "ii":
return this.num(dt.localWeekYear.toString().slice(-2), 2);
case "iiii":
return this.num(dt.localWeekYear, 4);
case "o":
return this.num(dt.ordinal);
case "ooo":
return this.num(dt.ordinal, 3);
case "q":
return this.num(dt.quarter);
case "qq":
return this.num(dt.quarter, 2);
case "X":
return this.num(Math.floor(dt.ts / 1e3));
case "x":
return this.num(dt.ts);
default:
return maybeMacro(token2);
}
};
return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);
}
formatDurationFromString(dur, fmt) {
const tokenToField = (token2) => {
switch (token2[0]) {
case "S":
return "millisecond";
case "s":
return "second";
case "m":
return "minute";
case "h":
return "hour";
case "d":
return "day";
case "w":
return "week";
case "M":
return "month";
case "y":
return "year";
default:
return null;
}
}, tokenToString = (lildur) => (token2) => {
const mapped = tokenToField(token2);
if (mapped) {
return this.num(lildur.get(mapped), token2.length);
} else {
return token2;
}
}, tokens = Formatter.parseFormat(fmt), realTokens = tokens.reduce((found, {
literal,
val
}) => literal ? found : found.concat(val), []), collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t2) => t2));
return stringifyTokens(tokens, tokenToString(collapsed));
}
}
const ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
function combineRegexes(...regexes) {
const full = regexes.reduce((f2, r2) => f2 + r2.source, "");
return RegExp(`^${full}$`);
}
function combineExtractors(...extractors) {
return (m2) => extractors.reduce(([mergedVals, mergedZone, cursor], ex) => {
const [val, zone, next2] = ex(m2, cursor);
return [{
...mergedVals,
...val
}, zone || mergedZone, next2];
}, [{}, null, 1]).slice(0, 2);
}
function parse2(s2, ...patterns) {
if (s2 == null) {
return [null, null];
}
for (const [regex, extractor] of patterns) {
const m2 = regex.exec(s2);
if (m2) {
return extractor(m2);
}
}
return [null, null];
}
function simpleParse(...keys2) {
return (match2, cursor) => {
const ret = {};
let i2;
for (i2 = 0; i2 < keys2.length; i2++) {
ret[keys2[i2]] = parseInteger(match2[cursor + i2]);
}
return [ret, null, cursor + i2];
};
}
const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/;
const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
const isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`);
const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
const isoOrdinalRegex = /(\d{4})-?(\d{3})/;
const extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay");
const extractISOOrdinalData = simpleParse("year", "ordinal");
const sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/;
const sqlTimeRegex = RegExp(`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`);
const sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);
function int(match2, pos, fallback) {
const m2 = match2[pos];
return isUndefined(m2) ? fallback : parseInteger(m2);
}
function extractISOYmd(match2, cursor) {
const item = {
year: int(match2, cursor),
month: int(match2, cursor + 1, 1),
day: int(match2, cursor + 2, 1)
};
return [item, null, cursor + 3];
}
function extractISOTime(match2, cursor) {
const item = {
hours: int(match2, cursor, 0),
minutes: int(match2, cursor + 1, 0),
seconds: int(match2, cursor + 2, 0),
milliseconds: parseMillis(match2[cursor + 3])
};
return [item, null, cursor + 4];
}
function extractISOOffset(match2, cursor) {
const local = !match2[cursor] && !match2[cursor + 1], fullOffset = signedOffset(match2[cursor + 1], match2[cursor + 2]), zone = local ? null : FixedOffsetZone.instance(fullOffset);
return [{}, zone, cursor + 3];
}
function extractIANAZone(match2, cursor) {
const zone = match2[cursor] ? IANAZone.create(match2[cursor]) : null;
return [{}, zone, cursor + 1];
}
const isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);
const isoDuration = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;
function extractISODuration(match2) {
const [s2, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = match2;
const hasNegativePrefix = s2[0] === "-";
const negativeSeconds = secondStr && secondStr[0] === "-";
const maybeNegate = (num, force = false) => num !== void 0 && (force || num && hasNegativePrefix) ? -num : num;
return [{
years: maybeNegate(parseFloating(yearStr)),
months: maybeNegate(parseFloating(monthStr)),
weeks: maybeNegate(parseFloating(weekStr)),
days: maybeNegate(parseFloating(dayStr)),
hours: maybeNegate(parseFloating(hourStr)),
minutes: maybeNegate(parseFloating(minuteStr)),
seconds: maybeNegate(parseFloating(secondStr), secondStr === "-0"),
milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds)
}];
}
const obsOffsets = {
GMT: 0,
EDT: -4 * 60,
EST: -5 * 60,
CDT: -5 * 60,
CST: -6 * 60,
MDT: -6 * 60,
MST: -7 * 60,
PDT: -7 * 60,
PST: -8 * 60
};
function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
const result = {
year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),
month: monthsShort.indexOf(monthStr) + 1,
day: parseInteger(dayStr),
hour: parseInteger(hourStr),
minute: parseInteger(minuteStr)
};
if (secondStr)
result.second = parseInteger(secondStr);
if (weekdayStr) {
result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1;
}
return result;
}
const rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
function extractRFC2822(match2) {
const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr, obsOffset, milOffset, offHourStr, offMinuteStr] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
let offset3;
if (obsOffset) {
offset3 = obsOffsets[obsOffset];
} else if (milOffset) {
offset3 = 0;
} else {
offset3 = signedOffset(offHourStr, offMinuteStr);
}
return [result, new FixedOffsetZone(offset3)];
}
function preprocessRFC2822(s2) {
return s2.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
}
const rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, rfc850 = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
function extractRFC1123Or850(match2) {
const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
return [result, FixedOffsetZone.utcInstance];
}
function extractASCII(match2) {
const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
return [result, FixedOffsetZone.utcInstance];
}
const isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);
const isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);
const isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);
const isoTimeCombinedRegex = combineRegexes(isoTimeRegex);
const extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone);
const extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset, extractIANAZone);
const extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset, extractIANAZone);
const extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
function parseISODate(s2) {
return parse2(s2, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]);
}
function parseRFC2822Date(s2) {
return parse2(preprocessRFC2822(s2), [rfc2822, extractRFC2822]);
}
function parseHTTPDate(s2) {
return parse2(s2, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]);
}
function parseISODuration(s2) {
return parse2(s2, [isoDuration, extractISODuration]);
}
const extractISOTimeOnly = combineExtractors(extractISOTime);
function parseISOTimeOnly(s2) {
return parse2(s2, [isoTimeOnly, extractISOTimeOnly]);
}
const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
const extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
function parseSQL(s2) {
return parse2(s2, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]);
}
const INVALID$2 = "Invalid Duration";
const lowOrderMatrix = {
weeks: {
days: 7,
hours: 7 * 24,
minutes: 7 * 24 * 60,
seconds: 7 * 24 * 60 * 60,
milliseconds: 7 * 24 * 60 * 60 * 1e3
},
days: {
hours: 24,
minutes: 24 * 60,
seconds: 24 * 60 * 60,
milliseconds: 24 * 60 * 60 * 1e3
},
hours: {
minutes: 60,
seconds: 60 * 60,
milliseconds: 60 * 60 * 1e3
},
minutes: {
seconds: 60,
milliseconds: 60 * 1e3
},
seconds: {
milliseconds: 1e3
}
}, casualMatrix = {
years: {
quarters: 4,
months: 12,
weeks: 52,
days: 365,
hours: 365 * 24,
minutes: 365 * 24 * 60,
seconds: 365 * 24 * 60 * 60,
milliseconds: 365 * 24 * 60 * 60 * 1e3
},
quarters: {
months: 3,
weeks: 13,
days: 91,
hours: 91 * 24,
minutes: 91 * 24 * 60,
seconds: 91 * 24 * 60 * 60,
milliseconds: 91 * 24 * 60 * 60 * 1e3
},
months: {
weeks: 4,
days: 30,
hours: 30 * 24,
minutes: 30 * 24 * 60,
seconds: 30 * 24 * 60 * 60,
milliseconds: 30 * 24 * 60 * 60 * 1e3
},
...lowOrderMatrix
}, daysInYearAccurate = 146097 / 400, daysInMonthAccurate = 146097 / 4800, accurateMatrix = {
years: {
quarters: 4,
months: 12,
weeks: daysInYearAccurate / 7,
days: daysInYearAccurate,
hours: daysInYearAccurate * 24,
minutes: daysInYearAccurate * 24 * 60,
seconds: daysInYearAccurate * 24 * 60 * 60,
milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1e3
},
quarters: {
months: 3,
weeks: daysInYearAccurate / 28,
days: daysInYearAccurate / 4,
hours: daysInYearAccurate * 24 / 4,
minutes: daysInYearAccurate * 24 * 60 / 4,
seconds: daysInYearAccurate * 24 * 60 * 60 / 4,
milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1e3 / 4
},
months: {
weeks: daysInMonthAccurate / 7,
days: daysInMonthAccurate,
hours: daysInMonthAccurate * 24,
minutes: daysInMonthAccurate * 24 * 60,
seconds: daysInMonthAccurate * 24 * 60 * 60,
milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1e3
},
...lowOrderMatrix
};
const orderedUnits$1 = ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"];
const reverseUnits = orderedUnits$1.slice(0).reverse();
function clone$1(dur, alts, clear = false) {
const conf = {
values: clear ? alts.values : {
...dur.values,
...alts.values || {}
},
loc: dur.loc.clone(alts.loc),
conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,
matrix: alts.matrix || dur.matrix
};
return new Duration(conf);
}
function durationToMillis(matrix, vals) {
var _vals$milliseconds;
let sum = (_vals$milliseconds = vals.milliseconds) != null ? _vals$milliseconds : 0;
for (const unit of reverseUnits.slice(1)) {
if (vals[unit]) {
sum += vals[unit] * matrix[unit]["milliseconds"];
}
}
return sum;
}
function normalizeValues(matrix, vals) {
const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;
orderedUnits$1.reduceRight((previous, current) => {
if (!isUndefined(vals[current])) {
if (previous) {
const previousVal = vals[previous] * factor;
const conv = matrix[current][previous];
const rollUp = Math.floor(previousVal / conv);
vals[current] += rollUp * factor;
vals[previous] -= rollUp * conv * factor;
}
return current;
} else {
return previous;
}
}, null);
orderedUnits$1.reduce((previous, current) => {
if (!isUndefined(vals[current])) {
if (previous) {
const fraction = vals[previous] % 1;
vals[previous] -= fraction;
vals[current] += fraction * matrix[previous][current];
}
return current;
} else {
return previous;
}
}, null);
}
function removeZeroes(vals) {
const newVals = {};
for (const [key2, value2] of Object.entries(vals)) {
if (value2 !== 0) {
newVals[key2] = value2;
}
}
return newVals;
}
class Duration {
/**
* @private
*/
constructor(config) {
const accurate = config.conversionAccuracy === "longterm" || false;
let matrix = accurate ? accurateMatrix : casualMatrix;
if (config.matrix) {
matrix = config.matrix;
}
this.values = config.values;
this.loc = config.loc || Locale.create();
this.conversionAccuracy = accurate ? "longterm" : "casual";
this.invalid = config.invalid || null;
this.matrix = matrix;
this.isLuxonDuration = true;
}
/**
* Create Duration from a number of milliseconds.
* @param {number} count of milliseconds
* @param {Object} opts - options for parsing
* @param {string} [opts.locale='en-US'] - the locale to use
* @param {string} opts.numberingSystem - the numbering system to use
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
* @return {Duration}
*/
static fromMillis(count, opts) {
return Duration.fromObject({
milliseconds: count
}, opts);
}
/**
* Create a Duration from a JavaScript object with keys like 'years' and 'hours'.
* If this object is empty then a zero milliseconds duration is returned.
* @param {Object} obj - the object to create the DateTime from
* @param {number} obj.years
* @param {number} obj.quarters
* @param {number} obj.months
* @param {number} obj.weeks
* @param {number} obj.days
* @param {number} obj.hours
* @param {number} obj.minutes
* @param {number} obj.seconds
* @param {number} obj.milliseconds
* @param {Object} [opts=[]] - options for creating this Duration
* @param {string} [opts.locale='en-US'] - the locale to use
* @param {string} opts.numberingSystem - the numbering system to use
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
* @param {string} [opts.matrix=Object] - the custom conversion system to use
* @return {Duration}
*/
static fromObject(obj, opts = {}) {
if (obj == null || typeof obj !== "object") {
throw new InvalidArgumentError(`Duration.fromObject: argument expected to be an object, got ${obj === null ? "null" : typeof obj}`);
}
return new Duration({
values: normalizeObject(obj, Duration.normalizeUnit),
loc: Locale.fromObject(opts),
conversionAccuracy: opts.conversionAccuracy,
matrix: opts.matrix
});
}
/**
* Create a Duration from DurationLike.
*
* @param {Object | number | Duration} durationLike
* One of:
* - object with keys like 'years' and 'hours'.
* - number representing milliseconds
* - Duration instance
* @return {Duration}
*/
static fromDurationLike(durationLike) {
if (isNumber(durationLike)) {
return Duration.fromMillis(durationLike);
} else if (Duration.isDuration(durationLike)) {
return durationLike;
} else if (typeof durationLike === "object") {
return Duration.fromObject(durationLike);
} else {
throw new InvalidArgumentError(`Unknown duration argument ${durationLike} of type ${typeof durationLike}`);
}
}
/**
* Create a Duration from an ISO 8601 duration string.
* @param {string} text - text to parse
* @param {Object} opts - options for parsing
* @param {string} [opts.locale='en-US'] - the locale to use
* @param {string} opts.numberingSystem - the numbering system to use
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
* @param {string} [opts.matrix=Object] - the preset conversion system to use
* @see https://en.wikipedia.org/wiki/ISO_8601#Durations
* @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }
* @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }
* @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }
* @return {Duration}
*/
static fromISO(text, opts) {
const [parsed] = parseISODuration(text);
if (parsed) {
return Duration.fromObject(parsed, opts);
} else {
return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
}
}
/**
* Create a Duration from an ISO 8601 time string.
* @param {string} text - text to parse
* @param {Object} opts - options for parsing
* @param {string} [opts.locale='en-US'] - the locale to use
* @param {string} opts.numberingSystem - the numbering system to use
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
* @param {string} [opts.matrix=Object] - the conversion system to use
* @see https://en.wikipedia.org/wiki/ISO_8601#Times
* @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 }
* @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
* @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
* @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
* @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
* @return {Duration}
*/
static fromISOTime(text, opts) {
const [parsed] = parseISOTimeOnly(text);
if (parsed) {
return Duration.fromObject(parsed, opts);
} else {
return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
}
}
/**
* Create an invalid Duration.
* @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent
* @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
* @return {Duration}
*/
static invalid(reason, explanation = null) {
if (!reason) {
throw new InvalidArgumentError("need to specify a reason the Duration is invalid");
}
const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
if (Settings.throwOnInvalid) {
throw new InvalidDurationError(invalid);
} else {
return new Duration({
invalid
});
}
}
/**
* @private
*/
static normalizeUnit(unit) {
const normalized = {
year: "years",
years: "years",
quarter: "quarters",
quarters: "quarters",
month: "months",
months: "months",
week: "weeks",
weeks: "weeks",
day: "days",
days: "days",
hour: "hours",
hours: "hours",
minute: "minutes",
minutes: "minutes",
second: "seconds",
seconds: "seconds",
millisecond: "milliseconds",
milliseconds: "milliseconds"
}[unit ? unit.toLowerCase() : unit];
if (!normalized)
throw new InvalidUnitError(unit);
return normalized;
}
/**
* Check if an object is a Duration. Works across context boundaries
* @param {object} o
* @return {boolean}
*/
static isDuration(o2) {
return o2 && o2.isLuxonDuration || false;
}
/**
* Get the locale of a Duration, such 'en-GB'
* @type {string}
*/
get locale() {
return this.isValid ? this.loc.locale : null;
}
/**
* Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration
*
* @type {string}
*/
get numberingSystem() {
return this.isValid ? this.loc.numberingSystem : null;
}
/**
* Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:
* * `S` for milliseconds
* * `s` for seconds
* * `m` for minutes
* * `h` for hours
* * `d` for days
* * `w` for weeks
* * `M` for months
* * `y` for years
* Notes:
* * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits
* * Tokens can be escaped by wrapping with single quotes.
* * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting.
* @param {string} fmt - the format string
* @param {Object} opts - options
* @param {boolean} [opts.floor=true] - floor numerical values
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2"
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002"
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000"
* @return {string}
*/
toFormat(fmt, opts = {}) {
const fmtOpts = {
...opts,
floor: opts.round !== false && opts.floor !== false
};
return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2;
}
/**
* Returns a string representation of a Duration with all units included.
* To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
* @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
* @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.
* @example
* ```js
* var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
* dur.toHuman() //=> '1 day, 5 hours, 6 minutes'
* dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes'
* dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min'
* ```
*/
toHuman(opts = {}) {
if (!this.isValid)
return INVALID$2;
const l2 = orderedUnits$1.map((unit) => {
const val = this.values[unit];
if (isUndefined(val)) {
return null;
}
return this.loc.numberFormatter({
style: "unit",
unitDisplay: "long",
...opts,
unit: unit.slice(0, -1)
}).format(val);
}).filter((n2) => n2);
return this.loc.listFormatter({
type: "conjunction",
style: opts.listStyle || "narrow",
...opts
}).format(l2);
}
/**
* Returns a JavaScript object with this Duration's values.
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }
* @return {Object}
*/
toObject() {
if (!this.isValid)
return {};
return {
...this.values
};
}
/**
* Returns an ISO 8601-compliant string representation of this Duration.
* @see https://en.wikipedia.org/wiki/ISO_8601#Durations
* @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'
* @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'
* @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'
* @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'
* @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'
* @return {string}
*/
toISO() {
if (!this.isValid)
return null;
let s2 = "P";
if (this.years !== 0)
s2 += this.years + "Y";
if (this.months !== 0 || this.quarters !== 0)
s2 += this.months + this.quarters * 3 + "M";
if (this.weeks !== 0)
s2 += this.weeks + "W";
if (this.days !== 0)
s2 += this.days + "D";
if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)
s2 += "T";
if (this.hours !== 0)
s2 += this.hours + "H";
if (this.minutes !== 0)
s2 += this.minutes + "M";
if (this.seconds !== 0 || this.milliseconds !== 0)
s2 += roundTo(this.seconds + this.milliseconds / 1e3, 3) + "S";
if (s2 === "P")
s2 += "T0S";
return s2;
}
/**
* Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day.
* Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours.
* @see https://en.wikipedia.org/wiki/ISO_8601#Times
* @param {Object} opts - options
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
* @param {boolean} [opts.includePrefix=false] - include the `T` prefix
* @param {string} [opts.format='extended'] - choose between the basic and extended format
* @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000'
* @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00'
* @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00'
* @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000'
* @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000'
* @return {string}
*/
toISOTime(opts = {}) {
if (!this.isValid)
return null;
const millis = this.toMillis();
if (millis < 0 || millis >= 864e5)
return null;
opts = {
suppressMilliseconds: false,
suppressSeconds: false,
includePrefix: false,
format: "extended",
...opts,
includeOffset: false
};
const dateTime = DateTime.fromMillis(millis, {
zone: "UTC"
});
return dateTime.toISOTime(opts);
}
/**
* Returns an ISO 8601 representation of this Duration appropriate for use in JSON.
* @return {string}
*/
toJSON() {
return this.toISO();
}
/**
* Returns an ISO 8601 representation of this Duration appropriate for use in debugging.
* @return {string}
*/
toString() {
return this.toISO();
}
/**
* Returns a string representation of this Duration appropriate for the REPL.
* @return {string}
*/
[Symbol.for("nodejs.util.inspect.custom")]() {
if (this.isValid) {
return `Duration { values: ${JSON.stringify(this.values)} }`;
} else {
return `Duration { Invalid, reason: ${this.invalidReason} }`;
}
}
/**
* Returns an milliseconds value of this Duration.
* @return {number}
*/
toMillis() {
if (!this.isValid)
return NaN;
return durationToMillis(this.matrix, this.values);
}
/**
* Returns an milliseconds value of this Duration. Alias of {@link toMillis}
* @return {number}
*/
valueOf() {
return this.toMillis();
}
/**
* Make this Duration longer by the specified amount. Return a newly-constructed Duration.
* @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
* @return {Duration}
*/
plus(duration) {
if (!this.isValid)
return this;
const dur = Duration.fromDurationLike(duration), result = {};
for (const k2 of orderedUnits$1) {
if (hasOwnProperty(dur.values, k2) || hasOwnProperty(this.values, k2)) {
result[k2] = dur.get(k2) + this.get(k2);
}
}
return clone$1(this, {
values: result
}, true);
}
/**
* Make this Duration shorter by the specified amount. Return a newly-constructed Duration.
* @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
* @return {Duration}
*/
minus(duration) {
if (!this.isValid)
return this;
const dur = Duration.fromDurationLike(duration);
return this.plus(dur.negate());
}
/**
* Scale this Duration by the specified amount. Return a newly-constructed Duration.
* @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.
* @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 }
* @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 }
* @return {Duration}
*/
mapUnits(fn) {
if (!this.isValid)
return this;
const result = {};
for (const k2 of Object.keys(this.values)) {
result[k2] = asNumber(fn(this.values[k2], k2));
}
return clone$1(this, {
values: result
}, true);
}
/**
* Get the value of unit.
* @param {string} unit - a unit such as 'minute' or 'day'
* @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2
* @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0
* @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3
* @return {number}
*/
get(unit) {
return this[Duration.normalizeUnit(unit)];
}
/**
* "Set" the values of specified units. Return a newly-constructed Duration.
* @param {Object} values - a mapping of units to numbers
* @example dur.set({ years: 2017 })
* @example dur.set({ hours: 8, minutes: 30 })
* @return {Duration}
*/
set(values) {
if (!this.isValid)
return this;
const mixed = {
...this.values,
...normalizeObject(values, Duration.normalizeUnit)
};
return clone$1(this, {
values: mixed
});
}
/**
* "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration.
* @example dur.reconfigure({ locale: 'en-GB' })
* @return {Duration}
*/
reconfigure({
locale: locale3,
numberingSystem,
conversionAccuracy,
matrix
} = {}) {
const loc = this.loc.clone({
locale: locale3,
numberingSystem
});
const opts = {
loc,
matrix,
conversionAccuracy
};
return clone$1(this, opts);
}
/**
* Return the length of the duration in the specified unit.
* @param {string} unit - a unit such as 'minutes' or 'days'
* @example Duration.fromObject({years: 1}).as('days') //=> 365
* @example Duration.fromObject({years: 1}).as('months') //=> 12
* @example Duration.fromObject({hours: 60}).as('days') //=> 2.5
* @return {number}
*/
as(unit) {
return this.isValid ? this.shiftTo(unit).get(unit) : NaN;
}
/**
* Reduce this Duration to its canonical representation in its current units.
* Assuming the overall value of the Duration is positive, this means:
* - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)
* - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise
* the overall value would be negative, see third example)
* - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)
*
* If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.
* @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }
* @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 }
* @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }
* @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 }
* @return {Duration}
*/
normalize() {
if (!this.isValid)
return this;
const vals = this.toObject();
normalizeValues(this.matrix, vals);
return clone$1(this, {
values: vals
}, true);
}
/**
* Rescale units to its largest representation
* @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 }
* @return {Duration}
*/
rescale() {
if (!this.isValid)
return this;
const vals = removeZeroes(this.normalize().shiftToAll().toObject());
return clone$1(this, {
values: vals
}, true);
}
/**
* Convert this Duration into its representation in a different set of units.
* @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }
* @return {Duration}
*/
shiftTo(...units) {
if (!this.isValid)
return this;
if (units.length === 0) {
return this;
}
units = units.map((u2) => Duration.normalizeUnit(u2));
const built = {}, accumulated = {}, vals = this.toObject();
let lastUnit;
for (const k2 of orderedUnits$1) {
if (units.indexOf(k2) >= 0) {
lastUnit = k2;
let own = 0;
for (const ak in accumulated) {
own += this.matrix[ak][k2] * accumulated[ak];
accumulated[ak] = 0;
}
if (isNumber(vals[k2])) {
own += vals[k2];
}
const i2 = Math.trunc(own);
built[k2] = i2;
accumulated[k2] = (own * 1e3 - i2 * 1e3) / 1e3;
} else if (isNumber(vals[k2])) {
accumulated[k2] = vals[k2];
}
}
for (const key2 in accumulated) {
if (accumulated[key2] !== 0) {
built[lastUnit] += key2 === lastUnit ? accumulated[key2] : accumulated[key2] / this.matrix[lastUnit][key2];
}
}
normalizeValues(this.matrix, built);
return clone$1(this, {
values: built
}, true);
}
/**
* Shift this Duration to all available units.
* Same as shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds")
* @return {Duration}
*/
shiftToAll() {
if (!this.isValid)
return this;
return this.shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds");
}
/**
* Return the negative of this Duration.
* @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }
* @return {Duration}
*/
negate() {
if (!this.isValid)
return this;
const negated = {};
for (const k2 of Object.keys(this.values)) {
negated[k2] = this.values[k2] === 0 ? 0 : -this.values[k2];
}
return clone$1(this, {
values: negated
}, true);
}
/**
* Get the years.
* @type {number}
*/
get years() {
return this.isValid ? this.values.years || 0 : NaN;
}
/**
* Get the quarters.
* @type {number}
*/
get quarters() {
return this.isValid ? this.values.quarters || 0 : NaN;
}
/**
* Get the months.
* @type {number}
*/
get months() {
return this.isValid ? this.values.months || 0 : NaN;
}
/**
* Get the weeks
* @type {number}
*/
get weeks() {
return this.isValid ? this.values.weeks || 0 : NaN;
}
/**
* Get the days.
* @type {number}
*/
get days() {
return this.isValid ? this.values.days || 0 : NaN;
}
/**
* Get the hours.
* @type {number}
*/
get hours() {
return this.isValid ? this.values.hours || 0 : NaN;
}
/**
* Get the minutes.
* @type {number}
*/
get minutes() {
return this.isValid ? this.values.minutes || 0 : NaN;
}
/**
* Get the seconds.
* @return {number}
*/
get seconds() {
return this.isValid ? this.values.seconds || 0 : NaN;
}
/**
* Get the milliseconds.
* @return {number}
*/
get milliseconds() {
return this.isValid ? this.values.milliseconds || 0 : NaN;
}
/**
* Returns whether the Duration is invalid. Invalid durations are returned by diff operations
* on invalid DateTimes or Intervals.
* @return {boolean}
*/
get isValid() {
return this.invalid === null;
}
/**
* Returns an error code if this Duration became invalid, or null if the Duration is valid
* @return {string}
*/
get invalidReason() {
return this.invalid ? this.invalid.reason : null;
}
/**
* Returns an explanation of why this Duration became invalid, or null if the Duration is valid
* @type {string}
*/
get invalidExplanation() {
return this.invalid ? this.invalid.explanation : null;
}
/**
* Equality check
* Two Durations are equal iff they have the same units and the same values for each unit.
* @param {Duration} other
* @return {boolean}
*/
equals(other) {
if (!this.isValid || !other.isValid) {
return false;
}
if (!this.loc.equals(other.loc)) {
return false;
}
function eq2(v1, v2) {
if (v1 === void 0 || v1 === 0)
return v2 === void 0 || v2 === 0;
return v1 === v2;
}
for (const u2 of orderedUnits$1) {
if (!eq2(this.values[u2], other.values[u2])) {
return false;
}
}
return true;
}
}
const INVALID$1 = "Invalid Interval";
function validateStartEnd(start, end) {
if (!start || !start.isValid) {
return Interval.invalid("missing or invalid start");
} else if (!end || !end.isValid) {
return Interval.invalid("missing or invalid end");
} else if (end < start) {
return Interval.invalid("end before start", `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`);
} else {
return null;
}
}
class Interval {
/**
* @private
*/
constructor(config) {
this.s = config.start;
this.e = config.end;
this.invalid = config.invalid || null;
this.isLuxonInterval = true;
}
/**
* Create an invalid Interval.
* @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent
* @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
* @return {Interval}
*/
static invalid(reason, explanation = null) {
if (!reason) {
throw new InvalidArgumentError("need to specify a reason the Interval is invalid");
}
const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
if (Settings.throwOnInvalid) {
throw new InvalidIntervalError(invalid);
} else {
return new Interval({
invalid
});
}
}
/**
* Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.
* @param {DateTime|Date|Object} start
* @param {DateTime|Date|Object} end
* @return {Interval}
*/
static fromDateTimes(start, end) {
const builtStart = friendlyDateTime(start), builtEnd = friendlyDateTime(end);
const validateError = validateStartEnd(builtStart, builtEnd);
if (validateError == null) {
return new Interval({
start: builtStart,
end: builtEnd
});
} else {
return validateError;
}
}
/**
* Create an Interval from a start DateTime and a Duration to extend to.
* @param {DateTime|Date|Object} start
* @param {Duration|Object|number} duration - the length of the Interval.
* @return {Interval}
*/
static after(start, duration) {
const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(start);
return Interval.fromDateTimes(dt, dt.plus(dur));
}
/**
* Create an Interval from an end DateTime and a Duration to extend backwards to.
* @param {DateTime|Date|Object} end
* @param {Duration|Object|number} duration - the length of the Interval.
* @return {Interval}
*/
static before(end, duration) {
const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(end);
return Interval.fromDateTimes(dt.minus(dur), dt);
}
/**
* Create an Interval from an ISO 8601 string.
* Accepts `<start>/<end>`, `<start>/<duration>`, and `<duration>/<end>` formats.
* @param {string} text - the ISO string to parse
* @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO}
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
* @return {Interval}
*/
static fromISO(text, opts) {
const [s2, e2] = (text || "").split("/", 2);
if (s2 && e2) {
let start, startIsValid;
try {
start = DateTime.fromISO(s2, opts);
startIsValid = start.isValid;
} catch (e3) {
startIsValid = false;
}
let end, endIsValid;
try {
end = DateTime.fromISO(e2, opts);
endIsValid = end.isValid;
} catch (e3) {
endIsValid = false;
}
if (startIsValid && endIsValid) {
return Interval.fromDateTimes(start, end);
}
if (startIsValid) {
const dur = Duration.fromISO(e2, opts);
if (dur.isValid) {
return Interval.after(start, dur);
}
} else if (endIsValid) {
const dur = Duration.fromISO(s2, opts);
if (dur.isValid) {
return Interval.before(end, dur);
}
}
}
return Interval.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
}
/**
* Check if an object is an Interval. Works across context boundaries
* @param {object} o
* @return {boolean}
*/
static isInterval(o2) {
return o2 && o2.isLuxonInterval || false;
}
/**
* Returns the start of the Interval
* @type {DateTime}
*/
get start() {
return this.isValid ? this.s : null;
}
/**
* Returns the end of the Interval
* @type {DateTime}
*/
get end() {
return this.isValid ? this.e : null;
}
/**
* Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.
* @type {boolean}
*/
get isValid() {
return this.invalidReason === null;
}
/**
* Returns an error code if this Interval is invalid, or null if the Interval is valid
* @type {string}
*/
get invalidReason() {
return this.invalid ? this.invalid.reason : null;
}
/**
* Returns an explanation of why this Interval became invalid, or null if the Interval is valid
* @type {string}
*/
get invalidExplanation() {
return this.invalid ? this.invalid.explanation : null;
}
/**
* Returns the length of the Interval in the specified unit.
* @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.
* @return {number}
*/
length(unit = "milliseconds") {
return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;
}
/**
* Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.
* Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'
* asks 'what dates are included in this interval?', not 'how many days long is this interval?'
* @param {string} [unit='milliseconds'] - the unit of time to count.
* @param {Object} opts - options
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime
* @return {number}
*/
count(unit = "milliseconds", opts) {
if (!this.isValid)
return NaN;
const start = this.start.startOf(unit, opts);
let end;
if (opts != null && opts.useLocaleWeeks) {
end = this.end.reconfigure({
locale: start.locale
});
} else {
end = this.end;
}
end = end.startOf(unit, opts);
return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
}
/**
* Returns whether this Interval's start and end are both in the same unit of time
* @param {string} unit - the unit of time to check sameness on
* @return {boolean}
*/
hasSame(unit) {
return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;
}
/**
* Return whether this Interval has the same start and end DateTimes.
* @return {boolean}
*/
isEmpty() {
return this.s.valueOf() === this.e.valueOf();
}
/**
* Return whether this Interval's start is after the specified DateTime.
* @param {DateTime} dateTime
* @return {boolean}
*/
isAfter(dateTime) {
if (!this.isValid)
return false;
return this.s > dateTime;
}
/**
* Return whether this Interval's end is before the specified DateTime.
* @param {DateTime} dateTime
* @return {boolean}
*/
isBefore(dateTime) {
if (!this.isValid)
return false;
return this.e <= dateTime;
}
/**
* Return whether this Interval contains the specified DateTime.
* @param {DateTime} dateTime
* @return {boolean}
*/
contains(dateTime) {
if (!this.isValid)
return false;
return this.s <= dateTime && this.e > dateTime;
}
/**
* "Sets" the start and/or end dates. Returns a newly-constructed Interval.
* @param {Object} values - the values to set
* @param {DateTime} values.start - the starting DateTime
* @param {DateTime} values.end - the ending DateTime
* @return {Interval}
*/
set({
start,
end
} = {}) {
if (!this.isValid)
return this;
return Interval.fromDateTimes(start || this.s, end || this.e);
}
/**
* Split this Interval at each of the specified DateTimes
* @param {...DateTime} dateTimes - the unit of time to count.
* @return {Array}
*/
splitAt(...dateTimes) {
if (!this.isValid)
return [];
const sorted = dateTimes.map(friendlyDateTime).filter((d2) => this.contains(d2)).sort((a2, b2) => a2.toMillis() - b2.toMillis()), results = [];
let {
s: s2
} = this, i2 = 0;
while (s2 < this.e) {
const added = sorted[i2] || this.e, next2 = +added > +this.e ? this.e : added;
results.push(Interval.fromDateTimes(s2, next2));
s2 = next2;
i2 += 1;
}
return results;
}
/**
* Split this Interval into smaller Intervals, each of the specified length.
* Left over time is grouped into a smaller interval
* @param {Duration|Object|number} duration - The length of each resulting interval.
* @return {Array}
*/
splitBy(duration) {
const dur = Duration.fromDurationLike(duration);
if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) {
return [];
}
let {
s: s2
} = this, idx = 1, next2;
const results = [];
while (s2 < this.e) {
const added = this.start.plus(dur.mapUnits((x2) => x2 * idx));
next2 = +added > +this.e ? this.e : added;
results.push(Interval.fromDateTimes(s2, next2));
s2 = next2;
idx += 1;
}
return results;
}
/**
* Split this Interval into the specified number of smaller intervals.
* @param {number} numberOfParts - The number of Intervals to divide the Interval into.
* @return {Array}
*/
divideEqually(numberOfParts) {
if (!this.isValid)
return [];
return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);
}
/**
* Return whether this Interval overlaps with the specified Interval
* @param {Interval} other
* @return {boolean}
*/
overlaps(other) {
return this.e > other.s && this.s < other.e;
}
/**
* Return whether this Interval's end is adjacent to the specified Interval's start.
* @param {Interval} other
* @return {boolean}
*/
abutsStart(other) {
if (!this.isValid)
return false;
return +this.e === +other.s;
}
/**
* Return whether this Interval's start is adjacent to the specified Interval's end.
* @param {Interval} other
* @return {boolean}
*/
abutsEnd(other) {
if (!this.isValid)
return false;
return +other.e === +this.s;
}
/**
* Return whether this Interval engulfs the start and end of the specified Interval.
* @param {Interval} other
* @return {boolean}
*/
engulfs(other) {
if (!this.isValid)
return false;
return this.s <= other.s && this.e >= other.e;
}
/**
* Return whether this Interval has the same start and end as the specified Interval.
* @param {Interval} other
* @return {boolean}
*/
equals(other) {
if (!this.isValid || !other.isValid) {
return false;
}
return this.s.equals(other.s) && this.e.equals(other.e);
}
/**
* Return an Interval representing the intersection of this Interval and the specified Interval.
* Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.
* Returns null if the intersection is empty, meaning, the intervals don't intersect.
* @param {Interval} other
* @return {Interval}
*/
intersection(other) {
if (!this.isValid)
return this;
const s2 = this.s > other.s ? this.s : other.s, e2 = this.e < other.e ? this.e : other.e;
if (s2 >= e2) {
return null;
} else {
return Interval.fromDateTimes(s2, e2);
}
}
/**
* Return an Interval representing the union of this Interval and the specified Interval.
* Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.
* @param {Interval} other
* @return {Interval}
*/
union(other) {
if (!this.isValid)
return this;
const s2 = this.s < other.s ? this.s : other.s, e2 = this.e > other.e ? this.e : other.e;
return Interval.fromDateTimes(s2, e2);
}
/**
* Merge an array of Intervals into a equivalent minimal set of Intervals.
* Combines overlapping and adjacent Intervals.
* @param {Array} intervals
* @return {Array}
*/
static merge(intervals) {
const [found, final] = intervals.sort((a2, b2) => a2.s - b2.s).reduce(([sofar, current], item) => {
if (!current) {
return [sofar, item];
} else if (current.overlaps(item) || current.abutsStart(item)) {
return [sofar, current.union(item)];
} else {
return [sofar.concat([current]), item];
}
}, [[], null]);
if (final) {
found.push(final);
}
return found;
}
/**
* Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.
* @param {Array} intervals
* @return {Array}
*/
static xor(intervals) {
let start = null, currentCount = 0;
const results = [], ends = intervals.map((i2) => [{
time: i2.s,
type: "s"
}, {
time: i2.e,
type: "e"
}]), flattened = Array.prototype.concat(...ends), arr = flattened.sort((a2, b2) => a2.time - b2.time);
for (const i2 of arr) {
currentCount += i2.type === "s" ? 1 : -1;
if (currentCount === 1) {
start = i2.time;
} else {
if (start && +start !== +i2.time) {
results.push(Interval.fromDateTimes(start, i2.time));
}
start = null;
}
}
return Interval.merge(results);
}
/**
* Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.
* @param {...Interval} intervals
* @return {Array}
*/
difference(...intervals) {
return Interval.xor([this].concat(intervals)).map((i2) => this.intersection(i2)).filter((i2) => i2 && !i2.isEmpty());
}
/**
* Returns a string representation of this Interval appropriate for debugging.
* @return {string}
*/
toString() {
if (!this.isValid)
return INVALID$1;
return `[${this.s.toISO()} – ${this.e.toISO()})`;
}
/**
* Returns a string representation of this Interval appropriate for the REPL.
* @return {string}
*/
[Symbol.for("nodejs.util.inspect.custom")]() {
if (this.isValid) {
return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;
} else {
return `Interval { Invalid, reason: ${this.invalidReason} }`;
}
}
/**
* Returns a localized string representing this Interval. Accepts the same options as the
* Intl.DateTimeFormat constructor and any presets defined by Luxon, such as
* {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method
* is browser-specific, but in general it will return an appropriate representation of the
* Interval in the assigned locale. Defaults to the system's locale if no locale has been
* specified.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
* @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or
* Intl.DateTimeFormat constructor options.
* @param {Object} opts - Options to override the configuration of the start DateTime.
* @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022
* @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022
* @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022
* @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM
* @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p
* @return {string}
*/
toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
return this.isValid ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) : INVALID$1;
}
/**
* Returns an ISO 8601-compliant string representation of this Interval.
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
* @param {Object} opts - The same options as {@link DateTime#toISO}
* @return {string}
*/
toISO(opts) {
if (!this.isValid)
return INVALID$1;
return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;
}
/**
* Returns an ISO 8601-compliant string representation of date of this Interval.
* The time components are ignored.
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
* @return {string}
*/
toISODate() {
if (!this.isValid)
return INVALID$1;
return `${this.s.toISODate()}/${this.e.toISODate()}`;
}
/**
* Returns an ISO 8601-compliant string representation of time of this Interval.
* The date components are ignored.
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
* @param {Object} opts - The same options as {@link DateTime#toISO}
* @return {string}
*/
toISOTime(opts) {
if (!this.isValid)
return INVALID$1;
return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;
}
/**
* Returns a string representation of this Interval formatted according to the specified format
* string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible
* formatting tool.
* @param {string} dateFormat - The format string. This string formats the start and end time.
* See {@link DateTime#toFormat} for details.
* @param {Object} opts - Options.
* @param {string} [opts.separator = ' – '] - A separator to place between the start and end
* representations.
* @return {string}
*/
toFormat(dateFormat2, {
separator = " – "
} = {}) {
if (!this.isValid)
return INVALID$1;
return `${this.s.toFormat(dateFormat2)}${separator}${this.e.toFormat(dateFormat2)}`;
}
/**
* Return a Duration representing the time spanned by this interval.
* @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.
* @param {Object} opts - options that affect the creation of the Duration
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
* @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }
* @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }
* @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }
* @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }
* @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }
* @return {Duration}
*/
toDuration(unit, opts) {
if (!this.isValid) {
return Duration.invalid(this.invalidReason);
}
return this.e.diff(this.s, unit, opts);
}
/**
* Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes
* @param {function} mapFn
* @return {Interval}
* @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())
* @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))
*/
mapEndpoints(mapFn) {
return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));
}
}
class Info {
/**
* Return whether the specified zone contains a DST.
* @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.
* @return {boolean}
*/
static hasDST(zone = Settings.defaultZone) {
const proto = DateTime.now().setZone(zone).set({
month: 12
});
return !zone.isUniversal && proto.offset !== proto.set({
month: 6
}).offset;
}
/**
* Return whether the specified zone is a valid IANA specifier.
* @param {string} zone - Zone to check
* @return {boolean}
*/
static isValidIANAZone(zone) {
return IANAZone.isValidZone(zone);
}
/**
* Converts the input into a {@link Zone} instance.
*
* * If `input` is already a Zone instance, it is returned unchanged.
* * If `input` is a string containing a valid time zone name, a Zone instance
* with that name is returned.
* * If `input` is a string that doesn't refer to a known time zone, a Zone
* instance with {@link Zone#isValid} == false is returned.
* * If `input is a number, a Zone instance with the specified fixed offset
* in minutes is returned.
* * If `input` is `null` or `undefined`, the default zone is returned.
* @param {string|Zone|number} [input] - the value to be converted
* @return {Zone}
*/
static normalizeZone(input) {
return normalizeZone(input, Settings.defaultZone);
}
/**
* Get the weekday on which the week starts according to the given locale.
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.locObj=null] - an existing locale object to use
* @returns {number} the start of the week, 1 for Monday through 7 for Sunday
*/
static getStartOfWeek({
locale: locale3 = null,
locObj = null
} = {}) {
return (locObj || Locale.create(locale3)).getStartOfWeek();
}
/**
* Get the minimum number of days necessary in a week before it is considered part of the next year according
* to the given locale.
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.locObj=null] - an existing locale object to use
* @returns {number}
*/
static getMinimumDaysInFirstWeek({
locale: locale3 = null,
locObj = null
} = {}) {
return (locObj || Locale.create(locale3)).getMinDaysInFirstWeek();
}
/**
* Get the weekdays, which are considered the weekend according to the given locale
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.locObj=null] - an existing locale object to use
* @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday
*/
static getWeekendWeekdays({
locale: locale3 = null,
locObj = null
} = {}) {
return (locObj || Locale.create(locale3)).getWeekendDays().slice();
}
/**
* Return an array of standalone month names.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
* @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long"
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
* @param {string} [opts.locObj=null] - an existing locale object to use
* @param {string} [opts.outputCalendar='gregory'] - the calendar
* @example Info.months()[0] //=> 'January'
* @example Info.months('short')[0] //=> 'Jan'
* @example Info.months('numeric')[0] //=> '1'
* @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'
* @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'
* @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'
* @return {Array}
*/
static months(length = "long", {
locale: locale3 = null,
numberingSystem = null,
locObj = null,
outputCalendar = "gregory"
} = {}) {
return (locObj || Locale.create(locale3, numberingSystem, outputCalendar)).months(length);
}
/**
* Return an array of format month names.
* Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that
* changes the string.
* See {@link Info#months}
* @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long"
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
* @param {string} [opts.locObj=null] - an existing locale object to use
* @param {string} [opts.outputCalendar='gregory'] - the calendar
* @return {Array}
*/
static monthsFormat(length = "long", {
locale: locale3 = null,
numberingSystem = null,
locObj = null,
outputCalendar = "gregory"
} = {}) {
return (locObj || Locale.create(locale3, numberingSystem, outputCalendar)).months(length, true);
}
/**
* Return an array of standalone week names.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
* @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long".
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
* @param {string} [opts.locObj=null] - an existing locale object to use
* @example Info.weekdays()[0] //=> 'Monday'
* @example Info.weekdays('short')[0] //=> 'Mon'
* @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'
* @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'
* @return {Array}
*/
static weekdays(length = "long", {
locale: locale3 = null,
numberingSystem = null,
locObj = null
} = {}) {
return (locObj || Locale.create(locale3, numberingSystem, null)).weekdays(length);
}
/**
* Return an array of format week names.
* Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that
* changes the string.
* See {@link Info#weekdays}
* @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long".
* @param {Object} opts - options
* @param {string} [opts.locale=null] - the locale code
* @param {string} [opts.numberingSystem=null] - the numbering system
* @param {string} [opts.locObj=null] - an existing locale object to use
* @return {Array}
*/
static weekdaysFormat(length = "long", {
locale: locale3 = null,
numberingSystem = null,
locObj = null
} = {}) {
return (locObj || Locale.create(locale3, numberingSystem, null)).weekdays(length, true);
}
/**
* Return an array of meridiems.
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @example Info.meridiems() //=> [ 'AM', 'PM' ]
* @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]
* @return {Array}
*/
static meridiems({
locale: locale3 = null
} = {}) {
return Locale.create(locale3).meridiems();
}
/**
* Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.
* @param {string} [length='short'] - the length of the era representation, such as "short" or "long".
* @param {Object} opts - options
* @param {string} [opts.locale] - the locale code
* @example Info.eras() //=> [ 'BC', 'AD' ]
* @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]
* @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]
* @return {Array}
*/
static eras(length = "short", {
locale: locale3 = null
} = {}) {
return Locale.create(locale3, null, "gregory").eras(length);
}
/**
* Return the set of available features in this environment.
* Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.
* Keys:
* * `relative`: whether this environment supports relative time formatting
* * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale
* @example Info.features() //=> { relative: false, localeWeek: true }
* @return {Object}
*/
static features() {
return {
relative: hasRelative(),
localeWeek: hasLocaleWeekInfo()
};
}
}
function dayDiff(earlier, later) {
const utcDayStart = (dt) => dt.toUTC(0, {
keepLocalTime: true
}).startOf("day").valueOf(), ms = utcDayStart(later) - utcDayStart(earlier);
return Math.floor(Duration.fromMillis(ms).as("days"));
}
function highOrderDiffs(cursor, later, units) {
const differs = [["years", (a2, b2) => b2.year - a2.year], ["quarters", (a2, b2) => b2.quarter - a2.quarter + (b2.year - a2.year) * 4], ["months", (a2, b2) => b2.month - a2.month + (b2.year - a2.year) * 12], ["weeks", (a2, b2) => {
const days = dayDiff(a2, b2);
return (days - days % 7) / 7;
}], ["days", dayDiff]];
const results = {};
const earlier = cursor;
let lowestOrder, highWater;
for (const [unit, differ] of differs) {
if (units.indexOf(unit) >= 0) {
lowestOrder = unit;
results[unit] = differ(cursor, later);
highWater = earlier.plus(results);
if (highWater > later) {
results[unit]--;
cursor = earlier.plus(results);
if (cursor > later) {
highWater = cursor;
results[unit]--;
cursor = earlier.plus(results);
}
} else {
cursor = highWater;
}
}
}
return [cursor, results, highWater, lowestOrder];
}
function diff(earlier, later, units, opts) {
let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);
const remainingMillis = later - cursor;
const lowerOrderUnits = units.filter((u2) => ["hours", "minutes", "seconds", "milliseconds"].indexOf(u2) >= 0);
if (lowerOrderUnits.length === 0) {
if (highWater < later) {
highWater = cursor.plus({
[lowestOrder]: 1
});
}
if (highWater !== cursor) {
results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);
}
}
const duration = Duration.fromObject(results, opts);
if (lowerOrderUnits.length > 0) {
return Duration.fromMillis(remainingMillis, opts).shiftTo(...lowerOrderUnits).plus(duration);
} else {
return duration;
}
}
const numberingSystems = {
arab: "[٠-٩]",
arabext: "[۰-۹]",
bali: "[᭐-᭙]",
beng: "[০-৯]",
deva: "[०-९]",
fullwide: "[0-9]",
gujr: "[૦-૯]",
hanidec: "[〇|一|二|三|四|五|六|七|八|九]",
khmr: "[០-៩]",
knda: "[೦-೯]",
laoo: "[໐-໙]",
limb: "[᥆-᥏]",
mlym: "[൦-൯]",
mong: "[᠐-᠙]",
mymr: "[၀-၉]",
orya: "[୦-୯]",
tamldec: "[௦-௯]",
telu: "[౦-౯]",
thai: "[๐-๙]",
tibt: "[༠-༩]",
latn: "\\d"
};
const numberingSystemsUTF16 = {
arab: [1632, 1641],
arabext: [1776, 1785],
bali: [6992, 7001],
beng: [2534, 2543],
deva: [2406, 2415],
fullwide: [65296, 65303],
gujr: [2790, 2799],
khmr: [6112, 6121],
knda: [3302, 3311],
laoo: [3792, 3801],
limb: [6470, 6479],
mlym: [3430, 3439],
mong: [6160, 6169],
mymr: [4160, 4169],
orya: [2918, 2927],
tamldec: [3046, 3055],
telu: [3174, 3183],
thai: [3664, 3673],
tibt: [3872, 3881]
};
const hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split("");
function parseDigits(str) {
let value2 = parseInt(str, 10);
if (isNaN(value2)) {
value2 = "";
for (let i2 = 0; i2 < str.length; i2++) {
const code2 = str.charCodeAt(i2);
if (str[i2].search(numberingSystems.hanidec) !== -1) {
value2 += hanidecChars.indexOf(str[i2]);
} else {
for (const key2 in numberingSystemsUTF16) {
const [min, max] = numberingSystemsUTF16[key2];
if (code2 >= min && code2 <= max) {
value2 += code2 - min;
}
}
}
}
return parseInt(value2, 10);
} else {
return value2;
}
}
function digitRegex({
numberingSystem
}, append = "") {
return new RegExp(`${numberingSystems[numberingSystem || "latn"]}${append}`);
}
const MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support";
function intUnit(regex, post = (i2) => i2) {
return {
regex,
deser: ([s2]) => post(parseDigits(s2))
};
}
const NBSP = String.fromCharCode(160);
const spaceOrNBSP = `[ ${NBSP}]`;
const spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g");
function fixListRegex(s2) {
return s2.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP);
}
function stripInsensitivities(s2) {
return s2.replace(/\./g, "").replace(spaceOrNBSPRegExp, " ").toLowerCase();
}
function oneOf(strings, startIndex) {
if (strings === null) {
return null;
} else {
return {
regex: RegExp(strings.map(fixListRegex).join("|")),
deser: ([s2]) => strings.findIndex((i2) => stripInsensitivities(s2) === stripInsensitivities(i2)) + startIndex
};
}
}
function offset2(regex, groups) {
return {
regex,
deser: ([, h2, m2]) => signedOffset(h2, m2),
groups
};
}
function simple(regex) {
return {
regex,
deser: ([s2]) => s2
};
}
function escapeToken(value2) {
return value2.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
}
function unitForToken(token2, loc) {
const one = digitRegex(loc), two = digitRegex(loc, "{2}"), three = digitRegex(loc, "{3}"), four = digitRegex(loc, "{4}"), six = digitRegex(loc, "{6}"), oneOrTwo = digitRegex(loc, "{1,2}"), oneToThree = digitRegex(loc, "{1,3}"), oneToSix = digitRegex(loc, "{1,6}"), oneToNine = digitRegex(loc, "{1,9}"), twoToFour = digitRegex(loc, "{2,4}"), fourToSix = digitRegex(loc, "{4,6}"), literal = (t2) => ({
regex: RegExp(escapeToken(t2.val)),
deser: ([s2]) => s2,
literal: true
}), unitate = (t2) => {
if (token2.literal) {
return literal(t2);
}
switch (t2.val) {
case "G":
return oneOf(loc.eras("short"), 0);
case "GG":
return oneOf(loc.eras("long"), 0);
case "y":
return intUnit(oneToSix);
case "yy":
return intUnit(twoToFour, untruncateYear);
case "yyyy":
return intUnit(four);
case "yyyyy":
return intUnit(fourToSix);
case "yyyyyy":
return intUnit(six);
case "M":
return intUnit(oneOrTwo);
case "MM":
return intUnit(two);
case "MMM":
return oneOf(loc.months("short", true), 1);
case "MMMM":
return oneOf(loc.months("long", true), 1);
case "L":
return intUnit(oneOrTwo);
case "LL":
return intUnit(two);
case "LLL":
return oneOf(loc.months("short", false), 1);
case "LLLL":
return oneOf(loc.months("long", false), 1);
case "d":
return intUnit(oneOrTwo);
case "dd":
return intUnit(two);
case "o":
return intUnit(oneToThree);
case "ooo":
return intUnit(three);
case "HH":
return intUnit(two);
case "H":
return intUnit(oneOrTwo);
case "hh":
return intUnit(two);
case "h":
return intUnit(oneOrTwo);
case "mm":
return intUnit(two);
case "m":
return intUnit(oneOrTwo);
case "q":
return intUnit(oneOrTwo);
case "qq":
return intUnit(two);
case "s":
return intUnit(oneOrTwo);
case "ss":
return intUnit(two);
case "S":
return intUnit(oneToThree);
case "SSS":
return intUnit(three);
case "u":
return simple(oneToNine);
case "uu":
return simple(oneOrTwo);
case "uuu":
return intUnit(one);
case "a":
return oneOf(loc.meridiems(), 0);
case "kkkk":
return intUnit(four);
case "kk":
return intUnit(twoToFour, untruncateYear);
case "W":
return intUnit(oneOrTwo);
case "WW":
return intUnit(two);
case "E":
case "c":
return intUnit(one);
case "EEE":
return oneOf(loc.weekdays("short", false), 1);
case "EEEE":
return oneOf(loc.weekdays("long", false), 1);
case "ccc":
return oneOf(loc.weekdays("short", true), 1);
case "cccc":
return oneOf(loc.weekdays("long", true), 1);
case "Z":
case "ZZ":
return offset2(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);
case "ZZZ":
return offset2(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);
case "z":
return simple(/[a-z_+-/]{1,256}?/i);
case " ":
return simple(/[^\S\n\r]/);
default:
return literal(t2);
}
};
const unit = unitate(token2) || {
invalidReason: MISSING_FTP
};
unit.token = token2;
return unit;
}
const partTypeStyleToTokenVal = {
year: {
"2-digit": "yy",
numeric: "yyyyy"
},
month: {
numeric: "M",
"2-digit": "MM",
short: "MMM",
long: "MMMM"
},
day: {
numeric: "d",
"2-digit": "dd"
},
weekday: {
short: "EEE",
long: "EEEE"
},
dayperiod: "a",
dayPeriod: "a",
hour12: {
numeric: "h",
"2-digit": "hh"
},
hour24: {
numeric: "H",
"2-digit": "HH"
},
minute: {
numeric: "m",
"2-digit": "mm"
},
second: {
numeric: "s",
"2-digit": "ss"
},
timeZoneName: {
long: "ZZZZZ",
short: "ZZZ"
}
};
function tokenForPart(part, formatOpts, resolvedOpts) {
const {
type,
value: value2
} = part;
if (type === "literal") {
const isSpace = /^\s+$/.test(value2);
return {
literal: !isSpace,
val: isSpace ? " " : value2
};
}
const style = formatOpts[type];
let actualType = type;
if (type === "hour") {
if (formatOpts.hour12 != null) {
actualType = formatOpts.hour12 ? "hour12" : "hour24";
} else if (formatOpts.hourCycle != null) {
if (formatOpts.hourCycle === "h11" || formatOpts.hourCycle === "h12") {
actualType = "hour12";
} else {
actualType = "hour24";
}
} else {
actualType = resolvedOpts.hour12 ? "hour12" : "hour24";
}
}
let val = partTypeStyleToTokenVal[actualType];
if (typeof val === "object") {
val = val[style];
}
if (val) {
return {
literal: false,
val
};
}
return void 0;
}
function buildRegex(units) {
const re = units.map((u2) => u2.regex).reduce((f2, r2) => `${f2}(${r2.source})`, "");
return [`^${re}$`, units];
}
function match(input, regex, handlers) {
const matches = input.match(regex);
if (matches) {
const all = {};
let matchIndex = 1;
for (const i2 in handlers) {
if (hasOwnProperty(handlers, i2)) {
const h2 = handlers[i2], groups = h2.groups ? h2.groups + 1 : 1;
if (!h2.literal && h2.token) {
all[h2.token.val[0]] = h2.deser(matches.slice(matchIndex, matchIndex + groups));
}
matchIndex += groups;
}
}
return [matches, all];
} else {
return [matches, {}];
}
}
function dateTimeFromMatches(matches) {
const toField = (token2) => {
switch (token2) {
case "S":
return "millisecond";
case "s":
return "second";
case "m":
return "minute";
case "h":
case "H":
return "hour";
case "d":
return "day";
case "o":
return "ordinal";
case "L":
case "M":
return "month";
case "y":
return "year";
case "E":
case "c":
return "weekday";
case "W":
return "weekNumber";
case "k":
return "weekYear";
case "q":
return "quarter";
default:
return null;
}
};
let zone = null;
let specificOffset;
if (!isUndefined(matches.z)) {
zone = IANAZone.create(matches.z);
}
if (!isUndefined(matches.Z)) {
if (!zone) {
zone = new FixedOffsetZone(matches.Z);
}
specificOffset = matches.Z;
}
if (!isUndefined(matches.q)) {
matches.M = (matches.q - 1) * 3 + 1;
}
if (!isUndefined(matches.h)) {
if (matches.h < 12 && matches.a === 1) {
matches.h += 12;
} else if (matches.h === 12 && matches.a === 0) {
matches.h = 0;
}
}
if (matches.G === 0 && matches.y) {
matches.y = -matches.y;
}
if (!isUndefined(matches.u)) {
matches.S = parseMillis(matches.u);
}
const vals = Object.keys(matches).reduce((r2, k2) => {
const f2 = toField(k2);
if (f2) {
r2[f2] = matches[k2];
}
return r2;
}, {});
return [vals, zone, specificOffset];
}
let dummyDateTimeCache = null;
function getDummyDateTime() {
if (!dummyDateTimeCache) {
dummyDateTimeCache = DateTime.fromMillis(1555555555555);
}
return dummyDateTimeCache;
}
function maybeExpandMacroToken(token2, locale3) {
if (token2.literal) {
return token2;
}
const formatOpts = Formatter.macroTokenToFormatOpts(token2.val);
const tokens = formatOptsToTokens(formatOpts, locale3);
if (tokens == null || tokens.includes(void 0)) {
return token2;
}
return tokens;
}
function expandMacroTokens(tokens, locale3) {
return Array.prototype.concat(...tokens.map((t2) => maybeExpandMacroToken(t2, locale3)));
}
function explainFromTokens(locale3, input, format3) {
const tokens = expandMacroTokens(Formatter.parseFormat(format3), locale3), units = tokens.map((t2) => unitForToken(t2, locale3)), disqualifyingUnit = units.find((t2) => t2.invalidReason);
if (disqualifyingUnit) {
return {
input,
tokens,
invalidReason: disqualifyingUnit.invalidReason
};
} else {
const [regexString, handlers] = buildRegex(units), regex = RegExp(regexString, "i"), [rawMatches, matches] = match(input, regex, handlers), [result, zone, specificOffset] = matches ? dateTimeFromMatches(matches) : [null, null, void 0];
if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) {
throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");
}
return {
input,
tokens,
regex,
rawMatches,
matches,
result,
zone,
specificOffset
};
}
}
function parseFromTokens(locale3, input, format3) {
const {
result,
zone,
specificOffset,
invalidReason
} = explainFromTokens(locale3, input, format3);
return [result, zone, specificOffset, invalidReason];
}
function formatOptsToTokens(formatOpts, locale3) {
if (!formatOpts) {
return null;
}
const formatter = Formatter.create(locale3, formatOpts);
const df = formatter.dtFormatter(getDummyDateTime());
const parts = df.formatToParts();
const resolvedOpts = df.resolvedOptions();
return parts.map((p) => tokenForPart(p, formatOpts, resolvedOpts));
}
const INVALID = "Invalid DateTime";
const MAX_DATE = 864e13;
function unsupportedZone(zone) {
return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`);
}
function possiblyCachedWeekData(dt) {
if (dt.weekData === null) {
dt.weekData = gregorianToWeek(dt.c);
}
return dt.weekData;
}
function possiblyCachedLocalWeekData(dt) {
if (dt.localWeekData === null) {
dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek());
}
return dt.localWeekData;
}
function clone2(inst, alts) {
const current = {
ts: inst.ts,
zone: inst.zone,
c: inst.c,
o: inst.o,
loc: inst.loc,
invalid: inst.invalid
};
return new DateTime({
...current,
...alts,
old: current
});
}
function fixOffset(localTS, o2, tz) {
let utcGuess = localTS - o2 * 60 * 1e3;
const o22 = tz.offset(utcGuess);
if (o2 === o22) {
return [utcGuess, o2];
}
utcGuess -= (o22 - o2) * 60 * 1e3;
const o3 = tz.offset(utcGuess);
if (o22 === o3) {
return [utcGuess, o22];
}
return [localTS - Math.min(o22, o3) * 60 * 1e3, Math.max(o22, o3)];
}
function tsToObj(ts, offset3) {
ts += offset3 * 60 * 1e3;
const d2 = new Date(ts);
return {
year: d2.getUTCFullYear(),
month: d2.getUTCMonth() + 1,
day: d2.getUTCDate(),
hour: d2.getUTCHours(),
minute: d2.getUTCMinutes(),
second: d2.getUTCSeconds(),
millisecond: d2.getUTCMilliseconds()
};
}
function objToTS(obj, offset3, zone) {
return fixOffset(objToLocalTS(obj), offset3, zone);
}
function adjustTime(inst, dur) {
const oPre = inst.o, year = inst.c.year + Math.trunc(dur.years), month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, c2 = {
...inst.c,
year,
month,
day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + Math.trunc(dur.weeks) * 7
}, millisToAdd = Duration.fromObject({
years: dur.years - Math.trunc(dur.years),
quarters: dur.quarters - Math.trunc(dur.quarters),
months: dur.months - Math.trunc(dur.months),
weeks: dur.weeks - Math.trunc(dur.weeks),
days: dur.days - Math.trunc(dur.days),
hours: dur.hours,
minutes: dur.minutes,
seconds: dur.seconds,
milliseconds: dur.milliseconds
}).as("milliseconds"), localTS = objToLocalTS(c2);
let [ts, o2] = fixOffset(localTS, oPre, inst.zone);
if (millisToAdd !== 0) {
ts += millisToAdd;
o2 = inst.zone.offset(ts);
}
return {
ts,
o: o2
};
}
function parseDataToDateTime(parsed, parsedZone, opts, format3, text, specificOffset) {
const {
setZone,
zone
} = opts;
if (parsed && Object.keys(parsed).length !== 0 || parsedZone) {
const interpretationZone = parsedZone || zone, inst = DateTime.fromObject(parsed, {
...opts,
zone: interpretationZone,
specificOffset
});
return setZone ? inst : inst.setZone(zone);
} else {
return DateTime.invalid(new Invalid("unparsable", `the input "${text}" can't be parsed as ${format3}`));
}
}
function toTechFormat(dt, format3, allowZ = true) {
return dt.isValid ? Formatter.create(Locale.create("en-US"), {
allowZ,
forceSimple: true
}).formatDateTimeFromString(dt, format3) : null;
}
function toISODate(o2, extended) {
const longFormat = o2.c.year > 9999 || o2.c.year < 0;
let c2 = "";
if (longFormat && o2.c.year >= 0)
c2 += "+";
c2 += padStart(o2.c.year, longFormat ? 6 : 4);
if (extended) {
c2 += "-";
c2 += padStart(o2.c.month);
c2 += "-";
c2 += padStart(o2.c.day);
} else {
c2 += padStart(o2.c.month);
c2 += padStart(o2.c.day);
}
return c2;
}
function toISOTime(o2, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone) {
let c2 = padStart(o2.c.hour);
if (extended) {
c2 += ":";
c2 += padStart(o2.c.minute);
if (o2.c.millisecond !== 0 || o2.c.second !== 0 || !suppressSeconds) {
c2 += ":";
}
} else {
c2 += padStart(o2.c.minute);
}
if (o2.c.millisecond !== 0 || o2.c.second !== 0 || !suppressSeconds) {
c2 += padStart(o2.c.second);
if (o2.c.millisecond !== 0 || !suppressMilliseconds) {
c2 += ".";
c2 += padStart(o2.c.millisecond, 3);
}
}
if (includeOffset) {
if (o2.isOffsetFixed && o2.offset === 0 && !extendedZone) {
c2 += "Z";
} else if (o2.o < 0) {
c2 += "-";
c2 += padStart(Math.trunc(-o2.o / 60));
c2 += ":";
c2 += padStart(Math.trunc(-o2.o % 60));
} else {
c2 += "+";
c2 += padStart(Math.trunc(o2.o / 60));
c2 += ":";
c2 += padStart(Math.trunc(o2.o % 60));
}
}
if (extendedZone) {
c2 += "[" + o2.zone.ianaName + "]";
}
return c2;
}
const defaultUnitValues = {
month: 1,
day: 1,
hour: 0,
minute: 0,
second: 0,
millisecond: 0
}, defaultWeekUnitValues = {
weekNumber: 1,
weekday: 1,
hour: 0,
minute: 0,
second: 0,
millisecond: 0
}, defaultOrdinalUnitValues = {
ordinal: 1,
hour: 0,
minute: 0,
second: 0,
millisecond: 0
};
const orderedUnits = ["year", "month", "day", "hour", "minute", "second", "millisecond"], orderedWeekUnits = ["weekYear", "weekNumber", "weekday", "hour", "minute", "second", "millisecond"], orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"];
function normalizeUnit(unit) {
const normalized = {
year: "year",
years: "year",
month: "month",
months: "month",
day: "day",
days: "day",
hour: "hour",
hours: "hour",
minute: "minute",
minutes: "minute",
quarter: "quarter",
quarters: "quarter",
second: "second",
seconds: "second",
millisecond: "millisecond",
milliseconds: "millisecond",
weekday: "weekday",
weekdays: "weekday",
weeknumber: "weekNumber",
weeksnumber: "weekNumber",
weeknumbers: "weekNumber",
weekyear: "weekYear",
weekyears: "weekYear",
ordinal: "ordinal"
}[unit.toLowerCase()];
if (!normalized)
throw new InvalidUnitError(unit);
return normalized;
}
function normalizeUnitWithLocalWeeks(unit) {
switch (unit.toLowerCase()) {
case "localweekday":
case "localweekdays":
return "localWeekday";
case "localweeknumber":
case "localweeknumbers":
return "localWeekNumber";
case "localweekyear":
case "localweekyears":
return "localWeekYear";
default:
return normalizeUnit(unit);
}
}
function quickDT(obj, opts) {
const zone = normalizeZone(opts.zone, Settings.defaultZone), loc = Locale.fromObject(opts), tsNow = Settings.now();
let ts, o2;
if (!isUndefined(obj.year)) {
for (const u2 of orderedUnits) {
if (isUndefined(obj[u2])) {
obj[u2] = defaultUnitValues[u2];
}
}
const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);
if (invalid) {
return DateTime.invalid(invalid);
}
const offsetProvis = zone.offset(tsNow);
[ts, o2] = objToTS(obj, offsetProvis, zone);
} else {
ts = tsNow;
}
return new DateTime({
ts,
zone,
loc,
o: o2
});
}
function diffRelative(start, end, opts) {
const round = isUndefined(opts.round) ? true : opts.round, format3 = (c2, unit) => {
c2 = roundTo(c2, round || opts.calendary ? 0 : 2, true);
const formatter = end.loc.clone(opts).relFormatter(opts);
return formatter.format(c2, unit);
}, differ = (unit) => {
if (opts.calendary) {
if (!end.hasSame(start, unit)) {
return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);
} else
return 0;
} else {
return end.diff(start, unit).get(unit);
}
};
if (opts.unit) {
return format3(differ(opts.unit), opts.unit);
}
for (const unit of opts.units) {
const count = differ(unit);
if (Math.abs(count) >= 1) {
return format3(count, unit);
}
}
return format3(start > end ? -0 : 0, opts.units[opts.units.length - 1]);
}
function lastOpts(argList) {
let opts = {}, args;
if (argList.length > 0 && typeof argList[argList.length - 1] === "object") {
opts = argList[argList.length - 1];
args = Array.from(argList).slice(0, argList.length - 1);
} else {
args = Array.from(argList);
}
return [opts, args];
}
class DateTime {
/**
* @access private
*/
constructor(config) {
const zone = config.zone || Settings.defaultZone;
let invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null);
this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;
let c2 = null, o2 = null;
if (!invalid) {
const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
if (unchanged) {
[c2, o2] = [config.old.c, config.old.o];
} else {
const ot = zone.offset(this.ts);
c2 = tsToObj(this.ts, ot);
invalid = Number.isNaN(c2.year) ? new Invalid("invalid input") : null;
c2 = invalid ? null : c2;
o2 = invalid ? null : ot;
}
}
this._zone = zone;
this.loc = config.loc || Locale.create();
this.invalid = invalid;
this.weekData = null;
this.localWeekData = null;
this.c = c2;
this.o = o2;
this.isLuxonDateTime = true;
}
// CONSTRUCT
/**
* Create a DateTime for the current instant, in the system's time zone.
*
* Use Settings to override these default values if needed.
* @example DateTime.now().toISO() //~> now in the ISO format
* @return {DateTime}
*/
static now() {
return new DateTime({});
}
/**
* Create a local DateTime
* @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used
* @param {number} [month=1] - The month, 1-indexed
* @param {number} [day=1] - The day of the month, 1-indexed
* @param {number} [hour=0] - The hour of the day, in 24-hour time
* @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59
* @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59
* @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999
* @example DateTime.local() //~> now
* @example DateTime.local({ zone: "America/New_York" }) //~> now, in US east coast time
* @example DateTime.local(2017) //~> 2017-01-01T00:00:00
* @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00
* @example DateTime.local(2017, 3, 12, { locale: "fr" }) //~> 2017-03-12T00:00:00, with a French locale
* @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00
* @example DateTime.local(2017, 3, 12, 5, { zone: "utc" }) //~> 2017-03-12T05:00:00, in UTC
* @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00
* @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10
* @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765
* @return {DateTime}
*/
static local() {
const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
return quickDT({
year,
month,
day,
hour,
minute,
second,
millisecond
}, opts);
}
/**
* Create a DateTime in UTC
* @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used
* @param {number} [month=1] - The month, 1-indexed
* @param {number} [day=1] - The day of the month
* @param {number} [hour=0] - The hour of the day, in 24-hour time
* @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59
* @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59
* @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999
* @param {Object} options - configuration options for the DateTime
* @param {string} [options.locale] - a locale to set on the resulting DateTime instance
* @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance
* @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance
* @example DateTime.utc() //~> now
* @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z
* @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z
* @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z
* @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z
* @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z
* @example DateTime.utc(2017, 3, 12, 5, 45, { locale: "fr" }) //~> 2017-03-12T05:45:00Z with a French locale
* @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z
* @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: "fr" }) //~> 2017-03-12T05:45:10.765Z with a French locale
* @return {DateTime}
*/
static utc() {
const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
opts.zone = FixedOffsetZone.utcInstance;
return quickDT({
year,
month,
day,
hour,
minute,
second,
millisecond
}, opts);
}
/**
* Create a DateTime from a JavaScript Date object. Uses the default zone.
* @param {Date} date - a JavaScript Date object
* @param {Object} options - configuration options for the DateTime
* @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into
* @return {DateTime}
*/
static fromJSDate(date2, options = {}) {
const ts = isDate(date2) ? date2.valueOf() : NaN;
if (Number.isNaN(ts)) {
return DateTime.invalid("invalid input");
}
const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);
if (!zoneToUse.isValid) {
return DateTime.invalid(unsupportedZone(zoneToUse));
}
return new DateTime({
ts,
zone: zoneToUse,
loc: Locale.fromObject(options)
});
}
/**
* Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.
* @param {number} milliseconds - a number of milliseconds since 1970 UTC
* @param {Object} options - configuration options for the DateTime
* @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into
* @param {string} [options.locale] - a locale to set on the resulting DateTime instance
* @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance
* @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance
* @return {DateTime}
*/
static fromMillis(milliseconds, options = {}) {
if (!isNumber(milliseconds)) {
throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`);
} else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {
return DateTime.invalid("Timestamp out of range");
} else {
return new DateTime({
ts: milliseconds,
zone: normalizeZone(options.zone, Settings.defaultZone),
loc: Locale.fromObject(options)
});
}
}
/**
* Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.
* @param {number} seconds - a number of seconds since 1970 UTC
* @param {Object} options - configuration options for the DateTime
* @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into
* @param {string} [options.locale] - a locale to set on the resulting DateTime instance
* @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance
* @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance
* @return {DateTime}
*/
static fromSeconds(seconds, options = {}) {
if (!isNumber(seconds)) {
throw new InvalidArgumentError("fromSeconds requires a numerical input");
} else {
return new DateTime({
ts: seconds * 1e3,
zone: normalizeZone(options.zone, Settings.defaultZone),
loc: Locale.fromObject(options)
});
}
}
/**
* Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.
* @param {Object} obj - the object to create the DateTime from
* @param {number} obj.year - a year, such as 1987
* @param {number} obj.month - a month, 1-12
* @param {number} obj.day - a day of the month, 1-31, depending on the month
* @param {number} obj.ordinal - day of the year, 1-365 or 366
* @param {number} obj.weekYear - an ISO week year
* @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year
* @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday
* @param {number} obj.localWeekYear - a week year, according to the locale
* @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale
* @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale
* @param {number} obj.hour - hour of the day, 0-23
* @param {number} obj.minute - minute of the hour, 0-59
* @param {number} obj.second - second of the minute, 0-59
* @param {number} obj.millisecond - millisecond of the second, 0-999
* @param {Object} opts - options for creating this DateTime
* @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()
* @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
* @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
* @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'
* @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }),
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })
* @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })
* @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'
* @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26'
* @return {DateTime}
*/
static fromObject(obj, opts = {}) {
obj = obj || {};
const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);
if (!zoneToUse.isValid) {
return DateTime.invalid(unsupportedZone(zoneToUse));
}
const loc = Locale.fromObject(opts);
const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);
const {
minDaysInFirstWeek,
startOfWeek
} = usesLocalWeekValues(normalized, loc);
const tsNow = Settings.now(), offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber;
if ((containsGregor || containsOrdinal) && definiteWeekDef) {
throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");
}
if (containsGregorMD && containsOrdinal) {
throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
}
const useWeekData = definiteWeekDef || normalized.weekday && !containsGregor;
let units, defaultValues, objNow = tsToObj(tsNow, offsetProvis);
if (useWeekData) {
units = orderedWeekUnits;
defaultValues = defaultWeekUnitValues;
objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);
} else if (containsOrdinal) {
units = orderedOrdinalUnits;
defaultValues = defaultOrdinalUnitValues;
objNow = gregorianToOrdinal(objNow);
} else {
units = orderedUnits;
defaultValues = defaultUnitValues;
}
let foundFirst = false;
for (const u2 of units) {
const v2 = normalized[u2];
if (!isUndefined(v2)) {
foundFirst = true;
} else if (foundFirst) {
normalized[u2] = defaultValues[u2];
} else {
normalized[u2] = objNow[u2];
}
}
const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
if (invalid) {
return DateTime.invalid(invalid);
}
const gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), inst = new DateTime({
ts: tsFinal,
zone: zoneToUse,
o: offsetFinal,
loc
});
if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {
return DateTime.invalid("mismatched weekday", `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`);
}
return inst;
}
/**
* Create a DateTime from an ISO 8601 string
* @param {string} text - the ISO string
* @param {Object} opts - options to affect the creation
* @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone
* @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one
* @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
* @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance
* @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance
* @example DateTime.fromISO('2016-05-25T09:08:34.123')
* @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')
* @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})
* @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})
* @example DateTime.fromISO('2016-W05-4')
* @return {DateTime}
*/
static fromISO(text, opts = {}) {
const [vals, parsedZone] = parseISODate(text);
return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text);
}
/**
* Create a DateTime from an RFC 2822 string
* @param {string} text - the RFC 2822 string
* @param {Object} opts - options to affect the creation
* @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.
* @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one
* @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
* @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
* @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')
* @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')
* @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')
* @return {DateTime}
*/
static fromRFC2822(text, opts = {}) {
const [vals, parsedZone] = parseRFC2822Date(text);
return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text);
}
/**
* Create a DateTime from an HTTP header date
* @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
* @param {string} text - the HTTP header date
* @param {Object} opts - options to affect the creation
* @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.
* @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.
* @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
* @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
* @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')
* @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')
* @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')
* @return {DateTime}
*/
static fromHTTP(text, opts = {}) {
const [vals, parsedZone] = parseHTTPDate(text);
return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts);
}
/**
* Create a DateTime from an input string and format string.
* Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens).
* @param {string} text - the string to parse
* @param {string} fmt - the format the string is expected to be in (see the link below for the formats)
* @param {Object} opts - options to affect the creation
* @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone
* @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one
* @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale
* @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
* @return {DateTime}
*/
static fromFormat(text, fmt, opts = {}) {
if (isUndefined(text) || isUndefined(fmt)) {
throw new InvalidArgumentError("fromFormat requires an input string and a format");
}
const {
locale: locale3 = null,
numberingSystem = null
} = opts, localeToUse = Locale.fromOpts({
locale: locale3,
numberingSystem,
defaultToEN: true
}), [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);
if (invalid) {
return DateTime.invalid(invalid);
} else {
return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);
}
}
/**
* @deprecated use fromFormat instead
*/
static fromString(text, fmt, opts = {}) {
return DateTime.fromFormat(text, fmt, opts);
}
/**
* Create a DateTime from a SQL date, time, or datetime
* Defaults to en-US if no locale has been specified, regardless of the system's locale
* @param {string} text - the string to parse
* @param {Object} opts - options to affect the creation
* @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone
* @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one
* @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale
* @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
* @example DateTime.fromSQL('2017-05-15')
* @example DateTime.fromSQL('2017-05-15 09:12:34')
* @example DateTime.fromSQL('2017-05-15 09:12:34.342')
* @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')
* @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')
* @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })
* @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })
* @example DateTime.fromSQL('09:12:34.342')
* @return {DateTime}
*/
static fromSQL(text, opts = {}) {
const [vals, parsedZone] = parseSQL(text);
return parseDataToDateTime(vals, parsedZone, opts, "SQL", text);
}
/**
* Create an invalid DateTime.
* @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent.
* @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
* @return {DateTime}
*/
static invalid(reason, explanation = null) {
if (!reason) {
throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");
}
const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
if (Settings.throwOnInvalid) {
throw new InvalidDateTimeError(invalid);
} else {
return new DateTime({
invalid
});
}
}
/**
* Check if an object is an instance of DateTime. Works across context boundaries
* @param {object} o
* @return {boolean}
*/
static isDateTime(o2) {
return o2 && o2.isLuxonDateTime || false;
}
/**
* Produce the format string for a set of options
* @param formatOpts
* @param localeOpts
* @returns {string}
*/
static parseFormatForOpts(formatOpts, localeOpts = {}) {
const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));
return !tokenList ? null : tokenList.map((t2) => t2 ? t2.val : null).join("");
}
/**
* Produce the the fully expanded format token for the locale
* Does NOT quote characters, so quoted tokens will not round trip correctly
* @param fmt
* @param localeOpts
* @returns {string}
*/
static expandFormat(fmt, localeOpts = {}) {
const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));
return expanded.map((t2) => t2.val).join("");
}
// INFO
/**
* Get the value of unit.
* @param {string} unit - a unit such as 'minute' or 'day'
* @example DateTime.local(2017, 7, 4).get('month'); //=> 7
* @example DateTime.local(2017, 7, 4).get('day'); //=> 4
* @return {number}
*/
get(unit) {
return this[unit];
}
/**
* Returns whether the DateTime is valid. Invalid DateTimes occur when:
* * The DateTime was created from invalid calendar information, such as the 13th month or February 30
* * The DateTime was created by an operation on another invalid date
* @type {boolean}
*/
get isValid() {
return this.invalid === null;
}
/**
* Returns an error code if this DateTime is invalid, or null if the DateTime is valid
* @type {string}
*/
get invalidReason() {
return this.invalid ? this.invalid.reason : null;
}
/**
* Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid
* @type {string}
*/
get invalidExplanation() {
return this.invalid ? this.invalid.explanation : null;
}
/**
* Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime
*
* @type {string}
*/
get locale() {
return this.isValid ? this.loc.locale : null;
}
/**
* Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime
*
* @type {string}
*/
get numberingSystem() {
return this.isValid ? this.loc.numberingSystem : null;
}
/**
* Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime
*
* @type {string}
*/
get outputCalendar() {
return this.isValid ? this.loc.outputCalendar : null;
}
/**
* Get the time zone associated with this DateTime.
* @type {Zone}
*/
get zone() {
return this._zone;
}
/**
* Get the name of the time zone.
* @type {string}
*/
get zoneName() {
return this.isValid ? this.zone.name : null;
}
/**
* Get the year
* @example DateTime.local(2017, 5, 25).year //=> 2017
* @type {number}
*/
get year() {
return this.isValid ? this.c.year : NaN;
}
/**
* Get the quarter
* @example DateTime.local(2017, 5, 25).quarter //=> 2
* @type {number}
*/
get quarter() {
return this.isValid ? Math.ceil(this.c.month / 3) : NaN;
}
/**
* Get the month (1-12).
* @example DateTime.local(2017, 5, 25).month //=> 5
* @type {number}
*/
get month() {
return this.isValid ? this.c.month : NaN;
}
/**
* Get the day of the month (1-30ish).
* @example DateTime.local(2017, 5, 25).day //=> 25
* @type {number}
*/
get day() {
return this.isValid ? this.c.day : NaN;
}
/**
* Get the hour of the day (0-23).
* @example DateTime.local(2017, 5, 25, 9).hour //=> 9
* @type {number}
*/
get hour() {
return this.isValid ? this.c.hour : NaN;
}
/**
* Get the minute of the hour (0-59).
* @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30
* @type {number}
*/
get minute() {
return this.isValid ? this.c.minute : NaN;
}
/**
* Get the second of the minute (0-59).
* @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52
* @type {number}
*/
get second() {
return this.isValid ? this.c.second : NaN;
}
/**
* Get the millisecond of the second (0-999).
* @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654
* @type {number}
*/
get millisecond() {
return this.isValid ? this.c.millisecond : NaN;
}
/**
* Get the week year
* @see https://en.wikipedia.org/wiki/ISO_week_date
* @example DateTime.local(2014, 12, 31).weekYear //=> 2015
* @type {number}
*/
get weekYear() {
return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;
}
/**
* Get the week number of the week year (1-52ish).
* @see https://en.wikipedia.org/wiki/ISO_week_date
* @example DateTime.local(2017, 5, 25).weekNumber //=> 21
* @type {number}
*/
get weekNumber() {
return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;
}
/**
* Get the day of the week.
* 1 is Monday and 7 is Sunday
* @see https://en.wikipedia.org/wiki/ISO_week_date
* @example DateTime.local(2014, 11, 31).weekday //=> 4
* @type {number}
*/
get weekday() {
return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
}
/**
* Returns true if this date is on a weekend according to the locale, false otherwise
* @returns {boolean}
*/
get isWeekend() {
return this.isValid && this.loc.getWeekendDays().includes(this.weekday);
}
/**
* Get the day of the week according to the locale.
* 1 is the first day of the week and 7 is the last day of the week.
* If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,
* @returns {number}
*/
get localWeekday() {
return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;
}
/**
* Get the week number of the week year according to the locale. Different locales assign week numbers differently,
* because the week can start on different days of the week (see localWeekday) and because a different number of days
* is required for a week to count as the first week of a year.
* @returns {number}
*/
get localWeekNumber() {
return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;
}
/**
* Get the week year according to the locale. Different locales assign week numbers (and therefor week years)
* differently, see localWeekNumber.
* @returns {number}
*/
get localWeekYear() {
return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;
}
/**
* Get the ordinal (meaning the day of the year)
* @example DateTime.local(2017, 5, 25).ordinal //=> 145
* @type {number|DateTime}
*/
get ordinal() {
return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;
}
/**
* Get the human readable short month name, such as 'Oct'.
* Defaults to the system's locale if no locale has been specified
* @example DateTime.local(2017, 10, 30).monthShort //=> Oct
* @type {string}
*/
get monthShort() {
return this.isValid ? Info.months("short", {
locObj: this.loc
})[this.month - 1] : null;
}
/**
* Get the human readable long month name, such as 'October'.
* Defaults to the system's locale if no locale has been specified
* @example DateTime.local(2017, 10, 30).monthLong //=> October
* @type {string}
*/
get monthLong() {
return this.isValid ? Info.months("long", {
locObj: this.loc
})[this.month - 1] : null;
}
/**
* Get the human readable short weekday, such as 'Mon'.
* Defaults to the system's locale if no locale has been specified
* @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon
* @type {string}
*/
get weekdayShort() {
return this.isValid ? Info.weekdays("short", {
locObj: this.loc
})[this.weekday - 1] : null;
}
/**
* Get the human readable long weekday, such as 'Monday'.
* Defaults to the system's locale if no locale has been specified
* @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday
* @type {string}
*/
get weekdayLong() {
return this.isValid ? Info.weekdays("long", {
locObj: this.loc
})[this.weekday - 1] : null;
}
/**
* Get the UTC offset of this DateTime in minutes
* @example DateTime.now().offset //=> -240
* @example DateTime.utc().offset //=> 0
* @type {number}
*/
get offset() {
return this.isValid ? +this.o : NaN;
}
/**
* Get the short human name for the zone's current offset, for example "EST" or "EDT".
* Defaults to the system's locale if no locale has been specified
* @type {string}
*/
get offsetNameShort() {
if (this.isValid) {
return this.zone.offsetName(this.ts, {
format: "short",
locale: this.locale
});
} else {
return null;
}
}
/**
* Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time".
* Defaults to the system's locale if no locale has been specified
* @type {string}
*/
get offsetNameLong() {
if (this.isValid) {
return this.zone.offsetName(this.ts, {
format: "long",
locale: this.locale
});
} else {
return null;
}
}
/**
* Get whether this zone's offset ever changes, as in a DST.
* @type {boolean}
*/
get isOffsetFixed() {
return this.isValid ? this.zone.isUniversal : null;
}
/**
* Get whether the DateTime is in a DST.
* @type {boolean}
*/
get isInDST() {
if (this.isOffsetFixed) {
return false;
} else {
return this.offset > this.set({
month: 1,
day: 1
}).offset || this.offset > this.set({
month: 5
}).offset;
}
}
/**
* Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC
* in this DateTime's zone. During DST changes local time can be ambiguous, for example
* `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`.
* This method will return both possible DateTimes if this DateTime's local time is ambiguous.
* @returns {DateTime[]}
*/
getPossibleOffsets() {
if (!this.isValid || this.isOffsetFixed) {
return [this];
}
const dayMs = 864e5;
const minuteMs = 6e4;
const localTS = objToLocalTS(this.c);
const oEarlier = this.zone.offset(localTS - dayMs);
const oLater = this.zone.offset(localTS + dayMs);
const o1 = this.zone.offset(localTS - oEarlier * minuteMs);
const o2 = this.zone.offset(localTS - oLater * minuteMs);
if (o1 === o2) {
return [this];
}
const ts1 = localTS - o1 * minuteMs;
const ts2 = localTS - o2 * minuteMs;
const c1 = tsToObj(ts1, o1);
const c2 = tsToObj(ts2, o2);
if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) {
return [clone2(this, {
ts: ts1
}), clone2(this, {
ts: ts2
})];
}
return [this];
}
/**
* Returns true if this DateTime is in a leap year, false otherwise
* @example DateTime.local(2016).isInLeapYear //=> true
* @example DateTime.local(2013).isInLeapYear //=> false
* @type {boolean}
*/
get isInLeapYear() {
return isLeapYear(this.year);
}
/**
* Returns the number of days in this DateTime's month
* @example DateTime.local(2016, 2).daysInMonth //=> 29
* @example DateTime.local(2016, 3).daysInMonth //=> 31
* @type {number}
*/
get daysInMonth() {
return daysInMonth(this.year, this.month);
}
/**
* Returns the number of days in this DateTime's year
* @example DateTime.local(2016).daysInYear //=> 366
* @example DateTime.local(2013).daysInYear //=> 365
* @type {number}
*/
get daysInYear() {
return this.isValid ? daysInYear(this.year) : NaN;
}
/**
* Returns the number of weeks in this DateTime's year
* @see https://en.wikipedia.org/wiki/ISO_week_date
* @example DateTime.local(2004).weeksInWeekYear //=> 53
* @example DateTime.local(2013).weeksInWeekYear //=> 52
* @type {number}
*/
get weeksInWeekYear() {
return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
}
/**
* Returns the number of weeks in this DateTime's local week year
* @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52
* @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53
* @type {number}
*/
get weeksInLocalWeekYear() {
return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN;
}
/**
* Returns the resolved Intl options for this DateTime.
* This is useful in understanding the behavior of formatting methods
* @param {Object} opts - the same options as toLocaleString
* @return {Object}
*/
resolvedLocaleOptions(opts = {}) {
const {
locale: locale3,
numberingSystem,
calendar
} = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this);
return {
locale: locale3,
numberingSystem,
outputCalendar: calendar
};
}
// TRANSFORM
/**
* "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime.
*
* Equivalent to {@link DateTime#setZone}('utc')
* @param {number} [offset=0] - optionally, an offset from UTC in minutes
* @param {Object} [opts={}] - options to pass to `setZone()`
* @return {DateTime}
*/
toUTC(offset3 = 0, opts = {}) {
return this.setZone(FixedOffsetZone.instance(offset3), opts);
}
/**
* "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.
*
* Equivalent to `setZone('local')`
* @return {DateTime}
*/
toLocal() {
return this.setZone(Settings.defaultZone);
}
/**
* "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.
*
* By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones.
* @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class.
* @param {Object} opts - options
* @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.
* @return {DateTime}
*/
setZone(zone, {
keepLocalTime = false,
keepCalendarTime = false
} = {}) {
zone = normalizeZone(zone, Settings.defaultZone);
if (zone.equals(this.zone)) {
return this;
} else if (!zone.isValid) {
return DateTime.invalid(unsupportedZone(zone));
} else {
let newTS = this.ts;
if (keepLocalTime || keepCalendarTime) {
const offsetGuess = zone.offset(this.ts);
const asObj = this.toObject();
[newTS] = objToTS(asObj, offsetGuess, zone);
}
return clone2(this, {
ts: newTS,
zone
});
}
}
/**
* "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.
* @param {Object} properties - the properties to set
* @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })
* @return {DateTime}
*/
reconfigure({
locale: locale3,
numberingSystem,
outputCalendar
} = {}) {
const loc = this.loc.clone({
locale: locale3,
numberingSystem,
outputCalendar
});
return clone2(this, {
loc
});
}
/**
* "Set" the locale. Returns a newly-constructed DateTime.
* Just a convenient alias for reconfigure({ locale })
* @example DateTime.local(2017, 5, 25).setLocale('en-GB')
* @return {DateTime}
*/
setLocale(locale3) {
return this.reconfigure({
locale: locale3
});
}
/**
* "Set" the values of specified units. Returns a newly-constructed DateTime.
* You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.
*
* This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.
* They cannot be mixed with ISO-week units like `weekday`.
* @param {Object} values - a mapping of units to numbers
* @example dt.set({ year: 2017 })
* @example dt.set({ hour: 8, minute: 30 })
* @example dt.set({ weekday: 5 })
* @example dt.set({ year: 2005, ordinal: 234 })
* @return {DateTime}
*/
set(values) {
if (!this.isValid)
return this;
const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);
const {
minDaysInFirstWeek,
startOfWeek
} = usesLocalWeekValues(normalized, this.loc);
const settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber;
if ((containsGregor || containsOrdinal) && definiteWeekDef) {
throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");
}
if (containsGregorMD && containsOrdinal) {
throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
}
let mixed;
if (settingWeekStuff) {
mixed = weekToGregorian({
...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek),
...normalized
}, minDaysInFirstWeek, startOfWeek);
} else if (!isUndefined(normalized.ordinal)) {
mixed = ordinalToGregorian({
...gregorianToOrdinal(this.c),
...normalized
});
} else {
mixed = {
...this.toObject(),
...normalized
};
if (isUndefined(normalized.day)) {
mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);
}
}
const [ts, o2] = objToTS(mixed, this.o, this.zone);
return clone2(this, {
ts,
o: o2
});
}
/**
* Add a period of time to this DateTime and return the resulting DateTime
*
* Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.
* @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
* @example DateTime.now().plus(123) //~> in 123 milliseconds
* @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes
* @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow
* @example DateTime.now().plus({ days: -1 }) //~> this time yesterday
* @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min
* @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min
* @return {DateTime}
*/
plus(duration) {
if (!this.isValid)
return this;
const dur = Duration.fromDurationLike(duration);
return clone2(this, adjustTime(this, dur));
}
/**
* Subtract a period of time to this DateTime and return the resulting DateTime
* See {@link DateTime#plus}
* @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
@return {DateTime}
*/
minus(duration) {
if (!this.isValid)
return this;
const dur = Duration.fromDurationLike(duration).negate();
return clone2(this, adjustTime(this, dur));
}
/**
* "Set" this DateTime to the beginning of a unit of time.
* @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
* @param {Object} opts - options
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
* @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'
* @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'
* @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays
* @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'
* @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'
* @return {DateTime}
*/
startOf(unit, {
useLocaleWeeks = false
} = {}) {
if (!this.isValid)
return this;
const o2 = {}, normalizedUnit = Duration.normalizeUnit(unit);
switch (normalizedUnit) {
case "years":
o2.month = 1;
case "quarters":
case "months":
o2.day = 1;
case "weeks":
case "days":
o2.hour = 0;
case "hours":
o2.minute = 0;
case "minutes":
o2.second = 0;
case "seconds":
o2.millisecond = 0;
break;
}
if (normalizedUnit === "weeks") {
if (useLocaleWeeks) {
const startOfWeek = this.loc.getStartOfWeek();
const {
weekday: weekday2
} = this;
if (weekday2 < startOfWeek) {
o2.weekNumber = this.weekNumber - 1;
}
o2.weekday = startOfWeek;
} else {
o2.weekday = 1;
}
}
if (normalizedUnit === "quarters") {
const q2 = Math.ceil(this.month / 3);
o2.month = (q2 - 1) * 3 + 1;
}
return this.set(o2);
}
/**
* "Set" this DateTime to the end (meaning the last millisecond) of a unit of time
* @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
* @param {Object} opts - options
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
* @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'
* @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'
* @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays
* @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'
* @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'
* @return {DateTime}
*/
endOf(unit, opts) {
return this.isValid ? this.plus({
[unit]: 1
}).startOf(unit, opts).minus(1) : this;
}
// OUTPUT
/**
* Returns a string representation of this DateTime formatted according to the specified format string.
* **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens).
* Defaults to en-US if no locale has been specified, regardless of the system's locale.
* @param {string} fmt - the format string
* @param {Object} opts - opts to override the configuration options on this DateTime
* @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22'
* @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'
* @example DateTime.now().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22'
* @example DateTime.now().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes'
* @return {string}
*/
toFormat(fmt, opts = {}) {
return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID;
}
/**
* Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.
* The exact behavior of this method is browser-specific, but in general it will return an appropriate representation
* of the DateTime in the assigned locale.
* Defaults to the system's locale if no locale has been specified
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
* @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options
* @param {Object} opts - opts to override the configuration options on this DateTime
* @example DateTime.now().toLocaleString(); //=> 4/20/2017
* @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'
* @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'
* @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022'
* @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'
* @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'
* @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'
* @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'
* @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32'
* @return {string}
*/
toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID;
}
/**
* Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.
* Defaults to the system's locale if no locale has been specified
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts
* @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.
* @example DateTime.now().toLocaleParts(); //=> [
* //=> { type: 'day', value: '25' },
* //=> { type: 'literal', value: '/' },
* //=> { type: 'month', value: '05' },
* //=> { type: 'literal', value: '/' },
* //=> { type: 'year', value: '1982' }
* //=> ]
*/
toLocaleParts(opts = {}) {
return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : [];
}
/**
* Returns an ISO 8601-compliant string representation of this DateTime
* @param {Object} opts - options
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
* @param {boolean} [opts.extendedZone=false] - add the time zone format extension
* @param {string} [opts.format='extended'] - choose between the basic and extended format
* @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
* @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
* @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
* @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
* @return {string}
*/
toISO({
format: format3 = "extended",
suppressSeconds = false,
suppressMilliseconds = false,
includeOffset = true,
extendedZone = false
} = {}) {
if (!this.isValid) {
return null;
}
const ext = format3 === "extended";
let c2 = toISODate(this, ext);
c2 += "T";
c2 += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
return c2;
}
/**
* Returns an ISO 8601-compliant string representation of this DateTime's date component
* @param {Object} opts - options
* @param {string} [opts.format='extended'] - choose between the basic and extended format
* @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'
* @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
* @return {string}
*/
toISODate({
format: format3 = "extended"
} = {}) {
if (!this.isValid) {
return null;
}
return toISODate(this, format3 === "extended");
}
/**
* Returns an ISO 8601-compliant string representation of this DateTime's week date
* @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'
* @return {string}
*/
toISOWeekDate() {
return toTechFormat(this, "kkkk-'W'WW-c");
}
/**
* Returns an ISO 8601-compliant string representation of this DateTime's time component
* @param {Object} opts - options
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
* @param {boolean} [opts.extendedZone=true] - add the time zone format extension
* @param {boolean} [opts.includePrefix=false] - include the `T` prefix
* @param {string} [opts.format='extended'] - choose between the basic and extended format
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'
* @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'
* @return {string}
*/
toISOTime({
suppressMilliseconds = false,
suppressSeconds = false,
includeOffset = true,
includePrefix = false,
extendedZone = false,
format: format3 = "extended"
} = {}) {
if (!this.isValid) {
return null;
}
let c2 = includePrefix ? "T" : "";
return c2 + toISOTime(this, format3 === "extended", suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
}
/**
* Returns an RFC 2822-compatible string representation of this DateTime
* @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'
* @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'
* @return {string}
*/
toRFC2822() {
return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
}
/**
* Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.
* Specifically, the string conforms to RFC 1123.
* @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
* @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'
* @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'
* @return {string}
*/
toHTTP() {
return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'");
}
/**
* Returns a string representation of this DateTime appropriate for use in SQL Date
* @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'
* @return {string}
*/
toSQLDate() {
if (!this.isValid) {
return null;
}
return toISODate(this, true);
}
/**
* Returns a string representation of this DateTime appropriate for use in SQL Time
* @param {Object} opts - options
* @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
* @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'
* @example DateTime.utc().toSQL() //=> '05:15:16.345'
* @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00'
* @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345'
* @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'
* @return {string}
*/
toSQLTime({
includeOffset = true,
includeZone = false,
includeOffsetSpace = true
} = {}) {
let fmt = "HH:mm:ss.SSS";
if (includeZone || includeOffset) {
if (includeOffsetSpace) {
fmt += " ";
}
if (includeZone) {
fmt += "z";
} else if (includeOffset) {
fmt += "ZZ";
}
}
return toTechFormat(this, fmt, true);
}
/**
* Returns a string representation of this DateTime appropriate for use in SQL DateTime
* @param {Object} opts - options
* @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
* @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'
* @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'
* @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'
* @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'
* @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'
* @return {string}
*/
toSQL(opts = {}) {
if (!this.isValid) {
return null;
}
return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;
}
/**
* Returns a string representation of this DateTime appropriate for debugging
* @return {string}
*/
toString() {
return this.isValid ? this.toISO() : INVALID;
}
/**
* Returns a string representation of this DateTime appropriate for the REPL.
* @return {string}
*/
[Symbol.for("nodejs.util.inspect.custom")]() {
if (this.isValid) {
return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;
} else {
return `DateTime { Invalid, reason: ${this.invalidReason} }`;
}
}
/**
* Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}
* @return {number}
*/
valueOf() {
return this.toMillis();
}
/**
* Returns the epoch milliseconds of this DateTime.
* @return {number}
*/
toMillis() {
return this.isValid ? this.ts : NaN;
}
/**
* Returns the epoch seconds of this DateTime.
* @return {number}
*/
toSeconds() {
return this.isValid ? this.ts / 1e3 : NaN;
}
/**
* Returns the epoch seconds (as a whole number) of this DateTime.
* @return {number}
*/
toUnixInteger() {
return this.isValid ? Math.floor(this.ts / 1e3) : NaN;
}
/**
* Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.
* @return {string}
*/
toJSON() {
return this.toISO();
}
/**
* Returns a BSON serializable equivalent to this DateTime.
* @return {Date}
*/
toBSON() {
return this.toJSDate();
}
/**
* Returns a JavaScript object with this DateTime's year, month, day, and so on.
* @param opts - options for generating the object
* @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output
* @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }
* @return {Object}
*/
toObject(opts = {}) {
if (!this.isValid)
return {};
const base = {
...this.c
};
if (opts.includeConfig) {
base.outputCalendar = this.outputCalendar;
base.numberingSystem = this.loc.numberingSystem;
base.locale = this.loc.locale;
}
return base;
}
/**
* Returns a JavaScript Date equivalent to this DateTime.
* @return {Date}
*/
toJSDate() {
return new Date(this.isValid ? this.ts : NaN);
}
// COMPARE
/**
* Return the difference between two DateTimes as a Duration.
* @param {DateTime} otherDateTime - the DateTime to compare this one to
* @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.
* @param {Object} opts - options that affect the creation of the Duration
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
* @example
* var i1 = DateTime.fromISO('1982-05-25T09:45'),
* i2 = DateTime.fromISO('1983-10-14T10:30');
* i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }
* i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }
* i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }
* i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }
* @return {Duration}
*/
diff(otherDateTime, unit = "milliseconds", opts = {}) {
if (!this.isValid || !otherDateTime.isValid) {
return Duration.invalid("created by diffing an invalid DateTime");
}
const durOpts = {
locale: this.locale,
numberingSystem: this.numberingSystem,
...opts
};
const units = maybeArray(unit).map(Duration.normalizeUnit), otherIsLater = otherDateTime.valueOf() > this.valueOf(), earlier = otherIsLater ? this : otherDateTime, later = otherIsLater ? otherDateTime : this, diffed = diff(earlier, later, units, durOpts);
return otherIsLater ? diffed.negate() : diffed;
}
/**
* Return the difference between this DateTime and right now.
* See {@link DateTime#diff}
* @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration
* @param {Object} opts - options that affect the creation of the Duration
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
* @return {Duration}
*/
diffNow(unit = "milliseconds", opts = {}) {
return this.diff(DateTime.now(), unit, opts);
}
/**
* Return an Interval spanning between this DateTime and another DateTime
* @param {DateTime} otherDateTime - the other end point of the Interval
* @return {Interval}
*/
until(otherDateTime) {
return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;
}
/**
* Return whether this DateTime is in the same unit of time as another DateTime.
* Higher-order units must also be identical for this function to return `true`.
* Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.
* @param {DateTime} otherDateTime - the other DateTime
* @param {string} unit - the unit of time to check sameness on
* @param {Object} opts - options
* @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used
* @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day
* @return {boolean}
*/
hasSame(otherDateTime, unit, opts) {
if (!this.isValid)
return false;
const inputMs = otherDateTime.valueOf();
const adjustedToZone = this.setZone(otherDateTime.zone, {
keepLocalTime: true
});
return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts);
}
/**
* Equality check
* Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid.
* To compare just the millisecond values, use `+dt1 === +dt2`.
* @param {DateTime} other - the other DateTime
* @return {boolean}
*/
equals(other) {
return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc);
}
/**
* Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your
* platform supports Intl.RelativeTimeFormat. Rounds down by default.
* @param {Object} options - options that affect the output
* @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
* @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow"
* @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds"
* @param {boolean} [options.round=true] - whether to round the numbers in the output.
* @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.
* @param {string} options.locale - override the locale of this DateTime
* @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this
* @example DateTime.now().plus({ days: 1 }).toRelative() //=> "in 1 day"
* @example DateTime.now().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día"
* @example DateTime.now().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures"
* @example DateTime.now().minus({ days: 2 }).toRelative() //=> "2 days ago"
* @example DateTime.now().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago"
* @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago"
*/
toRelative(options = {}) {
if (!this.isValid)
return null;
const base = options.base || DateTime.fromObject({}, {
zone: this.zone
}), padding = options.padding ? this < base ? -options.padding : options.padding : 0;
let units = ["years", "months", "days", "hours", "minutes", "seconds"];
let unit = options.unit;
if (Array.isArray(options.unit)) {
units = options.unit;
unit = void 0;
}
return diffRelative(base, this.plus(padding), {
...options,
numeric: "always",
units,
unit
});
}
/**
* Returns a string representation of this date relative to today, such as "yesterday" or "next month".
* Only internationalizes on platforms that supports Intl.RelativeTimeFormat.
* @param {Object} options - options that affect the output
* @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
* @param {string} options.locale - override the locale of this DateTime
* @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days"
* @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this
* @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow"
* @example DateTime.now().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana"
* @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain"
* @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago"
*/
toRelativeCalendar(options = {}) {
if (!this.isValid)
return null;
return diffRelative(options.base || DateTime.fromObject({}, {
zone: this.zone
}), this, {
...options,
numeric: "auto",
units: ["years", "months", "days"],
calendary: true
});
}
/**
* Return the min of several date times
* @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum
* @return {DateTime} the min DateTime, or undefined if called with no argument
*/
static min(...dateTimes) {
if (!dateTimes.every(DateTime.isDateTime)) {
throw new InvalidArgumentError("min requires all arguments be DateTimes");
}
return bestBy(dateTimes, (i2) => i2.valueOf(), Math.min);
}
/**
* Return the max of several date times
* @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum
* @return {DateTime} the max DateTime, or undefined if called with no argument
*/
static max(...dateTimes) {
if (!dateTimes.every(DateTime.isDateTime)) {
throw new InvalidArgumentError("max requires all arguments be DateTimes");
}
return bestBy(dateTimes, (i2) => i2.valueOf(), Math.max);
}
// MISC
/**
* Explain how a string would be parsed by fromFormat()
* @param {string} text - the string to parse
* @param {string} fmt - the format the string is expected to be in (see description)
* @param {Object} options - options taken by fromFormat()
* @return {Object}
*/
static fromFormatExplain(text, fmt, options = {}) {
const {
locale: locale3 = null,
numberingSystem = null
} = options, localeToUse = Locale.fromOpts({
locale: locale3,
numberingSystem,
defaultToEN: true
});
return explainFromTokens(localeToUse, text, fmt);
}
/**
* @deprecated use fromFormatExplain instead
*/
static fromStringExplain(text, fmt, options = {}) {
return DateTime.fromFormatExplain(text, fmt, options);
}
// FORMAT PRESETS
/**
* {@link DateTime#toLocaleString} format like 10/14/1983
* @type {Object}
*/
static get DATE_SHORT() {
return DATE_SHORT;
}
/**
* {@link DateTime#toLocaleString} format like 'Oct 14, 1983'
* @type {Object}
*/
static get DATE_MED() {
return DATE_MED;
}
/**
* {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983'
* @type {Object}
*/
static get DATE_MED_WITH_WEEKDAY() {
return DATE_MED_WITH_WEEKDAY;
}
/**
* {@link DateTime#toLocaleString} format like 'October 14, 1983'
* @type {Object}
*/
static get DATE_FULL() {
return DATE_FULL;
}
/**
* {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983'
* @type {Object}
*/
static get DATE_HUGE() {
return DATE_HUGE;
}
/**
* {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get TIME_SIMPLE() {
return TIME_SIMPLE;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get TIME_WITH_SECONDS() {
return TIME_WITH_SECONDS;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.
* @type {Object}
*/
static get TIME_WITH_SHORT_OFFSET() {
return TIME_WITH_SHORT_OFFSET;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.
* @type {Object}
*/
static get TIME_WITH_LONG_OFFSET() {
return TIME_WITH_LONG_OFFSET;
}
/**
* {@link DateTime#toLocaleString} format like '09:30', always 24-hour.
* @type {Object}
*/
static get TIME_24_SIMPLE() {
return TIME_24_SIMPLE;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour.
* @type {Object}
*/
static get TIME_24_WITH_SECONDS() {
return TIME_24_WITH_SECONDS;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour.
* @type {Object}
*/
static get TIME_24_WITH_SHORT_OFFSET() {
return TIME_24_WITH_SHORT_OFFSET;
}
/**
* {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.
* @type {Object}
*/
static get TIME_24_WITH_LONG_OFFSET() {
return TIME_24_WITH_LONG_OFFSET;
}
/**
* {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_SHORT() {
return DATETIME_SHORT;
}
/**
* {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_SHORT_WITH_SECONDS() {
return DATETIME_SHORT_WITH_SECONDS;
}
/**
* {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_MED() {
return DATETIME_MED;
}
/**
* {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_MED_WITH_SECONDS() {
return DATETIME_MED_WITH_SECONDS;
}
/**
* {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_MED_WITH_WEEKDAY() {
return DATETIME_MED_WITH_WEEKDAY;
}
/**
* {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_FULL() {
return DATETIME_FULL;
}
/**
* {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_FULL_WITH_SECONDS() {
return DATETIME_FULL_WITH_SECONDS;
}
/**
* {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_HUGE() {
return DATETIME_HUGE;
}
/**
* {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.
* @type {Object}
*/
static get DATETIME_HUGE_WITH_SECONDS() {
return DATETIME_HUGE_WITH_SECONDS;
}
}
function friendlyDateTime(dateTimeish) {
if (DateTime.isDateTime(dateTimeish)) {
return dateTimeish;
} else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {
return DateTime.fromJSDate(dateTimeish);
} else if (dateTimeish && typeof dateTimeish === "object") {
return DateTime.fromObject(dateTimeish);
} else {
throw new InvalidArgumentError(`Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`);
}
}
const VERSION = "3.4.4";
luxon$1.DateTime = DateTime;
luxon$1.Duration = Duration;
luxon$1.FixedOffsetZone = FixedOffsetZone;
luxon$1.IANAZone = IANAZone;
luxon$1.Info = Info;
luxon$1.Interval = Interval;
luxon$1.InvalidZone = InvalidZone;
luxon$1.Settings = Settings;
luxon$1.SystemZone = SystemZone;
luxon$1.VERSION = VERSION;
luxon$1.Zone = Zone;
var luxon = luxon$1;
CronDate$1.prototype.addYear = function() {
this._date = this._date.plus({ years: 1 });
};
CronDate$1.prototype.addMonth = function() {
this._date = this._date.plus({ months: 1 }).startOf("month");
};
CronDate$1.prototype.addDay = function() {
this._date = this._date.plus({ days: 1 }).startOf("day");
};
CronDate$1.prototype.addHour = function() {
var prev2 = this._date;
this._date = this._date.plus({ hours: 1 }).startOf("hour");
if (this._date <= prev2) {
this._date = this._date.plus({ hours: 1 });
}
};
CronDate$1.prototype.addMinute = function() {
var prev2 = this._date;
this._date = this._date.plus({ minutes: 1 }).startOf("minute");
if (this._date < prev2) {
this._date = this._date.plus({ hours: 1 });
}
};
CronDate$1.prototype.addSecond = function() {
var prev2 = this._date;
this._date = this._date.plus({ seconds: 1 }).startOf("second");
if (this._date < prev2) {
this._date = this._date.plus({ hours: 1 });
}
};
CronDate$1.prototype.subtractYear = function() {
this._date = this._date.minus({ years: 1 });
};
CronDate$1.prototype.subtractMonth = function() {
this._date = this._date.minus({ months: 1 }).endOf("month").startOf("second");
};
CronDate$1.prototype.subtractDay = function() {
this._date = this._date.minus({ days: 1 }).endOf("day").startOf("second");
};
CronDate$1.prototype.subtractHour = function() {
var prev2 = this._date;
this._date = this._date.minus({ hours: 1 }).endOf("hour").startOf("second");
if (this._date >= prev2) {
this._date = this._date.minus({ hours: 1 });
}
};
CronDate$1.prototype.subtractMinute = function() {
var prev2 = this._date;
this._date = this._date.minus({ minutes: 1 }).endOf("minute").startOf("second");
if (this._date > prev2) {
this._date = this._date.minus({ hours: 1 });
}
};
CronDate$1.prototype.subtractSecond = function() {
var prev2 = this._date;
this._date = this._date.minus({ seconds: 1 }).startOf("second");
if (this._date > prev2) {
this._date = this._date.minus({ hours: 1 });
}
};
CronDate$1.prototype.getDate = function() {
return this._date.day;
};
CronDate$1.prototype.getFullYear = function() {
return this._date.year;
};
CronDate$1.prototype.getDay = function() {
var weekday2 = this._date.weekday;
return weekday2 == 7 ? 0 : weekday2;
};
CronDate$1.prototype.getMonth = function() {
return this._date.month - 1;
};
CronDate$1.prototype.getHours = function() {
return this._date.hour;
};
CronDate$1.prototype.getMinutes = function() {
return this._date.minute;
};
CronDate$1.prototype.getSeconds = function() {
return this._date.second;
};
CronDate$1.prototype.getMilliseconds = function() {
return this._date.millisecond;
};
CronDate$1.prototype.getTime = function() {
return this._date.valueOf();
};
CronDate$1.prototype.getUTCDate = function() {
return this._getUTC().day;
};
CronDate$1.prototype.getUTCFullYear = function() {
return this._getUTC().year;
};
CronDate$1.prototype.getUTCDay = function() {
var weekday2 = this._getUTC().weekday;
return weekday2 == 7 ? 0 : weekday2;
};
CronDate$1.prototype.getUTCMonth = function() {
return this._getUTC().month - 1;
};
CronDate$1.prototype.getUTCHours = function() {
return this._getUTC().hour;
};
CronDate$1.prototype.getUTCMinutes = function() {
return this._getUTC().minute;
};
CronDate$1.prototype.getUTCSeconds = function() {
return this._getUTC().second;
};
CronDate$1.prototype.toISOString = function() {
return this._date.toUTC().toISO();
};
CronDate$1.prototype.toJSON = function() {
return this._date.toJSON();
};
CronDate$1.prototype.setDate = function(d2) {
this._date = this._date.set({ day: d2 });
};
CronDate$1.prototype.setFullYear = function(y2) {
this._date = this._date.set({ year: y2 });
};
CronDate$1.prototype.setDay = function(d2) {
this._date = this._date.set({ weekday: d2 });
};
CronDate$1.prototype.setMonth = function(m2) {
this._date = this._date.set({ month: m2 + 1 });
};
CronDate$1.prototype.setHours = function(h2) {
this._date = this._date.set({ hour: h2 });
};
CronDate$1.prototype.setMinutes = function(m2) {
this._date = this._date.set({ minute: m2 });
};
CronDate$1.prototype.setSeconds = function(s2) {
this._date = this._date.set({ second: s2 });
};
CronDate$1.prototype.setMilliseconds = function(s2) {
this._date = this._date.set({ millisecond: s2 });
};
CronDate$1.prototype._getUTC = function() {
return this._date.toUTC();
};
CronDate$1.prototype.toString = function() {
return this.toDate().toString();
};
CronDate$1.prototype.toDate = function() {
return this._date.toJSDate();
};
CronDate$1.prototype.isLastDayOfMonth = function() {
var newDate = this._date.plus({ days: 1 }).startOf("day");
return this._date.month !== newDate.month;
};
CronDate$1.prototype.isLastWeekdayOfMonth = function() {
var newDate = this._date.plus({ days: 7 }).startOf("day");
return this._date.month !== newDate.month;
};
function CronDate$1(timestamp, tz) {
var dateOpts = { zone: tz };
if (!timestamp) {
this._date = luxon.DateTime.local();
} else if (timestamp instanceof CronDate$1) {
this._date = timestamp._date;
} else if (timestamp instanceof Date) {
this._date = luxon.DateTime.fromJSDate(timestamp, dateOpts);
} else if (typeof timestamp === "number") {
this._date = luxon.DateTime.fromMillis(timestamp, dateOpts);
} else if (typeof timestamp === "string") {
this._date = luxon.DateTime.fromISO(timestamp, dateOpts);
this._date.isValid || (this._date = luxon.DateTime.fromRFC2822(timestamp, dateOpts));
this._date.isValid || (this._date = luxon.DateTime.fromSQL(timestamp, dateOpts));
this._date.isValid || (this._date = luxon.DateTime.fromFormat(timestamp, "EEE, d MMM yyyy HH:mm:ss", dateOpts));
}
if (!this._date || !this._date.isValid) {
throw new Error("CronDate: unhandled timestamp: " + JSON.stringify(timestamp));
}
if (tz && tz !== this._date.zoneName) {
this._date = this._date.setZone(tz);
}
}
var date = CronDate$1;
function buildRange(item) {
return {
start: item,
count: 1
};
}
function completeRangeWithItem(range, item) {
range.end = item;
range.step = item - range.start;
range.count = 2;
}
function finalizeCurrentRange(results, currentRange, currentItemRange) {
if (currentRange) {
if (currentRange.count === 2) {
results.push(buildRange(currentRange.start));
results.push(buildRange(currentRange.end));
} else {
results.push(currentRange);
}
}
if (currentItemRange) {
results.push(currentItemRange);
}
}
function compactField$1(arr) {
var results = [];
var currentRange = void 0;
for (var i2 = 0; i2 < arr.length; i2++) {
var currentItem = arr[i2];
if (typeof currentItem !== "number") {
finalizeCurrentRange(results, currentRange, buildRange(currentItem));
currentRange = void 0;
} else if (!currentRange) {
currentRange = buildRange(currentItem);
} else if (currentRange.count === 1) {
completeRangeWithItem(currentRange, currentItem);
} else {
if (currentRange.step === currentItem - currentRange.end) {
currentRange.count++;
currentRange.end = currentItem;
} else if (currentRange.count === 2) {
results.push(buildRange(currentRange.start));
currentRange = buildRange(currentRange.end);
completeRangeWithItem(currentRange, currentItem);
} else {
finalizeCurrentRange(results, currentRange);
currentRange = buildRange(currentItem);
}
}
}
finalizeCurrentRange(results, currentRange);
return results;
}
var field_compactor = compactField$1;
var compactField = field_compactor;
function stringifyField$1(arr, min, max) {
var ranges = compactField(arr);
if (ranges.length === 1) {
var singleRange = ranges[0];
var step = singleRange.step;
if (step === 1 && singleRange.start === min && singleRange.end === max) {
return "*";
}
if (step !== 1 && singleRange.start === min && singleRange.end === max - step + 1) {
return "*/" + step;
}
}
var result = [];
for (var i2 = 0, l2 = ranges.length; i2 < l2; ++i2) {
var range = ranges[i2];
if (range.count === 1) {
result.push(range.start);
continue;
}
var step = range.step;
if (range.step === 1) {
result.push(range.start + "-" + range.end);
continue;
}
var multiplier = range.start == 0 ? range.count - 1 : range.count;
if (range.step * multiplier > range.end) {
result = result.concat(
Array.from({ length: range.end - range.start + 1 }).map(function(_2, index2) {
var value2 = range.start + index2;
if ((value2 - range.start) % range.step === 0) {
return value2;
}
return null;
}).filter(function(value2) {
return value2 != null;
})
);
} else if (range.end === max - range.step + 1) {
result.push(range.start + "/" + range.step);
} else {
result.push(range.start + "-" + range.end + "/" + range.step);
}
}
return result.join(",");
}
var field_stringify = stringifyField$1;
var CronDate = date;
var stringifyField = field_stringify;
var LOOP_LIMIT = 1e4;
function CronExpression$1(fields, options) {
this._options = options;
this._utc = options.utc || false;
this._tz = this._utc ? "UTC" : options.tz;
this._currentDate = new CronDate(options.currentDate, this._tz);
this._startDate = options.startDate ? new CronDate(options.startDate, this._tz) : null;
this._endDate = options.endDate ? new CronDate(options.endDate, this._tz) : null;
this._isIterator = options.iterator || false;
this._hasIterated = false;
this._nthDayOfWeek = options.nthDayOfWeek || 0;
this.fields = CronExpression$1._freezeFields(fields);
}
CronExpression$1.map = ["second", "minute", "hour", "dayOfMonth", "month", "dayOfWeek"];
CronExpression$1.predefined = {
"@yearly": "0 0 1 1 *",
"@monthly": "0 0 1 * *",
"@weekly": "0 0 * * 0",
"@daily": "0 0 * * *",
"@hourly": "0 * * * *"
};
CronExpression$1.constraints = [
{ min: 0, max: 59, chars: [] },
// Second
{ min: 0, max: 59, chars: [] },
// Minute
{ min: 0, max: 23, chars: [] },
// Hour
{ min: 1, max: 31, chars: ["L"] },
// Day of month
{ min: 1, max: 12, chars: [] },
// Month
{ min: 0, max: 7, chars: ["L"] }
// Day of week
];
CronExpression$1.daysInMonth = [
31,
29,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
];
CronExpression$1.aliases = {
month: {
jan: 1,
feb: 2,
mar: 3,
apr: 4,
may: 5,
jun: 6,
jul: 7,
aug: 8,
sep: 9,
oct: 10,
nov: 11,
dec: 12
},
dayOfWeek: {
sun: 0,
mon: 1,
tue: 2,
wed: 3,
thu: 4,
fri: 5,
sat: 6
}
};
CronExpression$1.parseDefaults = ["0", "*", "*", "*", "*", "*"];
CronExpression$1.standardValidCharacters = /^[,*\d/-]+$/;
CronExpression$1.dayOfWeekValidCharacters = /^[?,*\dL#/-]+$/;
CronExpression$1.dayOfMonthValidCharacters = /^[?,*\dL/-]+$/;
CronExpression$1.validCharacters = {
second: CronExpression$1.standardValidCharacters,
minute: CronExpression$1.standardValidCharacters,
hour: CronExpression$1.standardValidCharacters,
dayOfMonth: CronExpression$1.dayOfMonthValidCharacters,
month: CronExpression$1.standardValidCharacters,
dayOfWeek: CronExpression$1.dayOfWeekValidCharacters
};
CronExpression$1._isValidConstraintChar = function _isValidConstraintChar(constraints, value2) {
if (typeof value2 !== "string") {
return false;
}
return constraints.chars.some(function(char) {
return value2.indexOf(char) > -1;
});
};
CronExpression$1._parseField = function _parseField(field, value2, constraints) {
switch (field) {
case "month":
case "dayOfWeek":
var aliases = CronExpression$1.aliases[field];
value2 = value2.replace(/[a-z]{3}/gi, function(match2) {
match2 = match2.toLowerCase();
if (typeof aliases[match2] !== "undefined") {
return aliases[match2];
} else {
throw new Error('Validation error, cannot resolve alias "' + match2 + '"');
}
});
break;
}
if (!CronExpression$1.validCharacters[field].test(value2)) {
throw new Error("Invalid characters, got value: " + value2);
}
if (value2.indexOf("*") !== -1) {
value2 = value2.replace(/\*/g, constraints.min + "-" + constraints.max);
} else if (value2.indexOf("?") !== -1) {
value2 = value2.replace(/\?/g, constraints.min + "-" + constraints.max);
}
function parseSequence(val) {
var stack = [];
function handleResult(result) {
if (result instanceof Array) {
for (var i3 = 0, c3 = result.length; i3 < c3; i3++) {
var value3 = result[i3];
if (CronExpression$1._isValidConstraintChar(constraints, value3)) {
stack.push(value3);
continue;
}
if (typeof value3 !== "number" || Number.isNaN(value3) || value3 < constraints.min || value3 > constraints.max) {
throw new Error(
"Constraint error, got value " + value3 + " expected range " + constraints.min + "-" + constraints.max
);
}
stack.push(value3);
}
} else {
if (CronExpression$1._isValidConstraintChar(constraints, result)) {
stack.push(result);
return;
}
var numResult = +result;
if (Number.isNaN(numResult) || numResult < constraints.min || numResult > constraints.max) {
throw new Error(
"Constraint error, got value " + result + " expected range " + constraints.min + "-" + constraints.max
);
}
if (field === "dayOfWeek") {
numResult = numResult % 7;
}
stack.push(numResult);
}
}
var atoms = val.split(",");
if (!atoms.every(function(atom) {
return atom.length > 0;
})) {
throw new Error("Invalid list value format");
}
if (atoms.length > 1) {
for (var i2 = 0, c2 = atoms.length; i2 < c2; i2++) {
handleResult(parseRepeat(atoms[i2]));
}
} else {
handleResult(parseRepeat(val));
}
stack.sort(CronExpression$1._sortCompareFn);
return stack;
}
function parseRepeat(val) {
var repeatInterval = 1;
var atoms = val.split("/");
if (atoms.length > 2) {
throw new Error("Invalid repeat: " + val);
}
if (atoms.length > 1) {
if (atoms[0] == +atoms[0]) {
atoms = [atoms[0] + "-" + constraints.max, atoms[1]];
}
return parseRange(atoms[0], atoms[atoms.length - 1]);
}
return parseRange(val, repeatInterval);
}
function parseRange(val, repeatInterval) {
var stack = [];
var atoms = val.split("-");
if (atoms.length > 1) {
if (atoms.length < 2) {
return +val;
}
if (!atoms[0].length) {
if (!atoms[1].length) {
throw new Error("Invalid range: " + val);
}
return +val;
}
var min = +atoms[0];
var max = +atoms[1];
if (Number.isNaN(min) || Number.isNaN(max) || min < constraints.min || max > constraints.max) {
throw new Error(
"Constraint error, got range " + min + "-" + max + " expected range " + constraints.min + "-" + constraints.max
);
} else if (min > max) {
throw new Error("Invalid range: " + val);
}
var repeatIndex = +repeatInterval;
if (Number.isNaN(repeatIndex) || repeatIndex <= 0) {
throw new Error("Constraint error, cannot repeat at every " + repeatIndex + " time.");
}
if (field === "dayOfWeek" && max % 7 === 0) {
stack.push(0);
}
for (var index2 = min, count = max; index2 <= count; index2++) {
var exists = stack.indexOf(index2) !== -1;
if (!exists && repeatIndex > 0 && repeatIndex % repeatInterval === 0) {
repeatIndex = 1;
stack.push(index2);
} else {
repeatIndex++;
}
}
return stack;
}
return Number.isNaN(+val) ? val : +val;
}
return parseSequence(value2);
};
CronExpression$1._sortCompareFn = function(a2, b2) {
var aIsNumber = typeof a2 === "number";
var bIsNumber = typeof b2 === "number";
if (aIsNumber && bIsNumber) {
return a2 - b2;
}
if (!aIsNumber && bIsNumber) {
return 1;
}
if (aIsNumber && !bIsNumber) {
return -1;
}
return a2.localeCompare(b2);
};
CronExpression$1._handleMaxDaysInMonth = function(mappedFields) {
if (mappedFields.month.length === 1) {
var daysInMonth2 = CronExpression$1.daysInMonth[mappedFields.month[0] - 1];
if (mappedFields.dayOfMonth[0] > daysInMonth2) {
throw new Error("Invalid explicit day of month definition");
}
return mappedFields.dayOfMonth.filter(function(dayOfMonth) {
return dayOfMonth === "L" ? true : dayOfMonth <= daysInMonth2;
}).sort(CronExpression$1._sortCompareFn);
}
};
CronExpression$1._freezeFields = function(fields) {
for (var i2 = 0, c2 = CronExpression$1.map.length; i2 < c2; ++i2) {
var field = CronExpression$1.map[i2];
var value2 = fields[field];
fields[field] = Object.freeze(value2);
}
return Object.freeze(fields);
};
CronExpression$1.prototype._applyTimezoneShift = function(currentDate, dateMathVerb, method) {
if (method === "Month" || method === "Day") {
var prevTime = currentDate.getTime();
currentDate[dateMathVerb + method]();
var currTime = currentDate.getTime();
if (prevTime === currTime) {
if (currentDate.getMinutes() === 0 && currentDate.getSeconds() === 0) {
currentDate.addHour();
} else if (currentDate.getMinutes() === 59 && currentDate.getSeconds() === 59) {
currentDate.subtractHour();
}
}
} else {
var previousHour = currentDate.getHours();
currentDate[dateMathVerb + method]();
var currentHour = currentDate.getHours();
var diff2 = currentHour - previousHour;
if (diff2 === 2) {
if (this.fields.hour.length !== 24) {
this._dstStart = currentHour;
}
} else if (diff2 === 0 && currentDate.getMinutes() === 0 && currentDate.getSeconds() === 0) {
if (this.fields.hour.length !== 24) {
this._dstEnd = currentHour;
}
}
}
};
CronExpression$1.prototype._findSchedule = function _findSchedule(reverse) {
function matchSchedule(value2, sequence) {
for (var i2 = 0, c2 = sequence.length; i2 < c2; i2++) {
if (sequence[i2] >= value2) {
return sequence[i2] === value2;
}
}
return sequence[0] === value2;
}
function isNthDayMatch(date2, nthDayOfWeek) {
if (nthDayOfWeek < 6) {
if (date2.getDate() < 8 && nthDayOfWeek === 1) {
return true;
}
var offset3 = date2.getDate() % 7 ? 1 : 0;
var adjustedDate = date2.getDate() - date2.getDate() % 7;
var occurrence = Math.floor(adjustedDate / 7) + offset3;
return occurrence === nthDayOfWeek;
}
return false;
}
function isLInExpressions(expressions) {
return expressions.length > 0 && expressions.some(function(expression2) {
return typeof expression2 === "string" && expression2.indexOf("L") >= 0;
});
}
reverse = reverse || false;
var dateMathVerb = reverse ? "subtract" : "add";
var currentDate = new CronDate(this._currentDate, this._tz);
var startDate = this._startDate;
var endDate = this._endDate;
var startTimestamp = currentDate.getTime();
var stepCount = 0;
function isLastWeekdayOfMonthMatch(expressions) {
return expressions.some(function(expression2) {
if (!isLInExpressions([expression2])) {
return false;
}
var weekday2 = Number.parseInt(expression2[0]) % 7;
if (Number.isNaN(weekday2)) {
throw new Error("Invalid last weekday of the month expression: " + expression2);
}
return currentDate.getDay() === weekday2 && currentDate.isLastWeekdayOfMonth();
});
}
while (stepCount < LOOP_LIMIT) {
stepCount++;
if (reverse) {
if (startDate && currentDate.getTime() - startDate.getTime() < 0) {
throw new Error("Out of the timespan range");
}
} else {
if (endDate && endDate.getTime() - currentDate.getTime() < 0) {
throw new Error("Out of the timespan range");
}
}
var dayOfMonthMatch = matchSchedule(currentDate.getDate(), this.fields.dayOfMonth);
if (isLInExpressions(this.fields.dayOfMonth)) {
dayOfMonthMatch = dayOfMonthMatch || currentDate.isLastDayOfMonth();
}
var dayOfWeekMatch = matchSchedule(currentDate.getDay(), this.fields.dayOfWeek);
if (isLInExpressions(this.fields.dayOfWeek)) {
dayOfWeekMatch = dayOfWeekMatch || isLastWeekdayOfMonthMatch(this.fields.dayOfWeek);
}
var isDayOfMonthWildcardMatch = this.fields.dayOfMonth.length >= CronExpression$1.daysInMonth[currentDate.getMonth()];
var isDayOfWeekWildcardMatch = this.fields.dayOfWeek.length === CronExpression$1.constraints[5].max - CronExpression$1.constraints[5].min + 1;
var currentHour = currentDate.getHours();
if (!dayOfMonthMatch && (!dayOfWeekMatch || isDayOfWeekWildcardMatch)) {
this._applyTimezoneShift(currentDate, dateMathVerb, "Day");
continue;
}
if (!isDayOfMonthWildcardMatch && isDayOfWeekWildcardMatch && !dayOfMonthMatch) {
this._applyTimezoneShift(currentDate, dateMathVerb, "Day");
continue;
}
if (isDayOfMonthWildcardMatch && !isDayOfWeekWildcardMatch && !dayOfWeekMatch) {
this._applyTimezoneShift(currentDate, dateMathVerb, "Day");
continue;
}
if (this._nthDayOfWeek > 0 && !isNthDayMatch(currentDate, this._nthDayOfWeek)) {
this._applyTimezoneShift(currentDate, dateMathVerb, "Day");
continue;
}
if (!matchSchedule(currentDate.getMonth() + 1, this.fields.month)) {
this._applyTimezoneShift(currentDate, dateMathVerb, "Month");
continue;
}
if (!matchSchedule(currentHour, this.fields.hour)) {
if (this._dstStart !== currentHour) {
this._dstStart = null;
this._applyTimezoneShift(currentDate, dateMathVerb, "Hour");
continue;
} else if (!matchSchedule(currentHour - 1, this.fields.hour)) {
currentDate[dateMathVerb + "Hour"]();
continue;
}
} else if (this._dstEnd === currentHour) {
if (!reverse) {
this._dstEnd = null;
this._applyTimezoneShift(currentDate, "add", "Hour");
continue;
}
}
if (!matchSchedule(currentDate.getMinutes(), this.fields.minute)) {
this._applyTimezoneShift(currentDate, dateMathVerb, "Minute");
continue;
}
if (!matchSchedule(currentDate.getSeconds(), this.fields.second)) {
this._applyTimezoneShift(currentDate, dateMathVerb, "Second");
continue;
}
if (startTimestamp === currentDate.getTime()) {
if (dateMathVerb === "add" || currentDate.getMilliseconds() === 0) {
this._applyTimezoneShift(currentDate, dateMathVerb, "Second");
} else {
currentDate.setMilliseconds(0);
}
continue;
}
break;
}
if (stepCount >= LOOP_LIMIT) {
throw new Error("Invalid expression, loop limit exceeded");
}
this._currentDate = new CronDate(currentDate, this._tz);
this._hasIterated = true;
return currentDate;
};
CronExpression$1.prototype.next = function next() {
var schedule = this._findSchedule();
if (this._isIterator) {
return {
value: schedule,
done: !this.hasNext()
};
}
return schedule;
};
CronExpression$1.prototype.prev = function prev() {
var schedule = this._findSchedule(true);
if (this._isIterator) {
return {
value: schedule,
done: !this.hasPrev()
};
}
return schedule;
};
CronExpression$1.prototype.hasNext = function() {
var current = this._currentDate;
var hasIterated = this._hasIterated;
try {
this._findSchedule();
return true;
} catch (err) {
return false;
} finally {
this._currentDate = current;
this._hasIterated = hasIterated;
}
};
CronExpression$1.prototype.hasPrev = function() {
var current = this._currentDate;
var hasIterated = this._hasIterated;
try {
this._findSchedule(true);
return true;
} catch (err) {
return false;
} finally {
this._currentDate = current;
this._hasIterated = hasIterated;
}
};
CronExpression$1.prototype.iterate = function iterate(steps, callback) {
var dates = [];
if (steps >= 0) {
for (var i2 = 0, c2 = steps; i2 < c2; i2++) {
try {
var item = this.next();
dates.push(item);
if (callback) {
callback(item, i2);
}
} catch (err) {
break;
}
}
} else {
for (var i2 = 0, c2 = steps; i2 > c2; i2--) {
try {
var item = this.prev();
dates.push(item);
if (callback) {
callback(item, i2);
}
} catch (err) {
break;
}
}
}
return dates;
};
CronExpression$1.prototype.reset = function reset(newDate) {
this._currentDate = new CronDate(newDate || this._options.currentDate);
};
CronExpression$1.prototype.stringify = function stringify(includeSeconds) {
var resultArr = [];
for (var i2 = includeSeconds ? 0 : 1, c2 = CronExpression$1.map.length; i2 < c2; ++i2) {
var field = CronExpression$1.map[i2];
var value2 = this.fields[field];
var constraint = CronExpression$1.constraints[i2];
if (field === "dayOfMonth" && this.fields.month.length === 1) {
constraint = { min: 1, max: CronExpression$1.daysInMonth[this.fields.month[0] - 1] };
} else if (field === "dayOfWeek") {
constraint = { min: 0, max: 6 };
value2 = value2[value2.length - 1] === 7 ? value2.slice(0, -1) : value2;
}
resultArr.push(stringifyField(value2, constraint.min, constraint.max));
}
return resultArr.join(" ");
};
CronExpression$1.parse = function parse3(expression2, options) {
var self2 = this;
if (typeof options === "function") {
options = {};
}
function parse4(expression3, options2) {
if (!options2) {
options2 = {};
}
if (typeof options2.currentDate === "undefined") {
options2.currentDate = new CronDate(void 0, self2._tz);
}
if (CronExpression$1.predefined[expression3]) {
expression3 = CronExpression$1.predefined[expression3];
}
var fields = [];
var atoms = (expression3 + "").trim().split(/\s+/);
if (atoms.length > 6) {
throw new Error("Invalid cron expression");
}
var start = CronExpression$1.map.length - atoms.length;
for (var i2 = 0, c2 = CronExpression$1.map.length; i2 < c2; ++i2) {
var field = CronExpression$1.map[i2];
var value2 = atoms[atoms.length > c2 ? i2 : i2 - start];
if (i2 < start || !value2) {
fields.push(
CronExpression$1._parseField(
field,
CronExpression$1.parseDefaults[i2],
CronExpression$1.constraints[i2]
)
);
} else {
var val = field === "dayOfWeek" ? parseNthDay(value2) : value2;
fields.push(
CronExpression$1._parseField(
field,
val,
CronExpression$1.constraints[i2]
)
);
}
}
var mappedFields = {};
for (var i2 = 0, c2 = CronExpression$1.map.length; i2 < c2; i2++) {
var key2 = CronExpression$1.map[i2];
mappedFields[key2] = fields[i2];
}
var dayOfMonth = CronExpression$1._handleMaxDaysInMonth(mappedFields);
mappedFields.dayOfMonth = dayOfMonth || mappedFields.dayOfMonth;
return new CronExpression$1(mappedFields, options2);
function parseNthDay(val2) {
var atoms2 = val2.split("#");
if (atoms2.length > 1) {
var nthValue = +atoms2[atoms2.length - 1];
if (/,/.test(val2)) {
throw new Error("Constraint error, invalid dayOfWeek `#` and `,` special characters are incompatible");
}
if (/\//.test(val2)) {
throw new Error("Constraint error, invalid dayOfWeek `#` and `/` special characters are incompatible");
}
if (/-/.test(val2)) {
throw new Error("Constraint error, invalid dayOfWeek `#` and `-` special characters are incompatible");
}
if (atoms2.length > 2 || Number.isNaN(nthValue) || (nthValue < 1 || nthValue > 5)) {
throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");
}
options2.nthDayOfWeek = nthValue;
return atoms2[0];
}
return val2;
}
}
return parse4(expression2, options);
};
CronExpression$1.fieldsToExpression = function fieldsToExpression(fields, options) {
function validateConstraints(field2, values2, constraints) {
if (!values2) {
throw new Error("Validation error, Field " + field2 + " is missing");
}
if (values2.length === 0) {
throw new Error("Validation error, Field " + field2 + " contains no values");
}
for (var i3 = 0, c3 = values2.length; i3 < c3; i3++) {
var value2 = values2[i3];
if (CronExpression$1._isValidConstraintChar(constraints, value2)) {
continue;
}
if (typeof value2 !== "number" || Number.isNaN(value2) || value2 < constraints.min || value2 > constraints.max) {
throw new Error(
"Constraint error, got value " + value2 + " expected range " + constraints.min + "-" + constraints.max
);
}
}
}
var mappedFields = {};
for (var i2 = 0, c2 = CronExpression$1.map.length; i2 < c2; ++i2) {
var field = CronExpression$1.map[i2];
var values = fields[field];
validateConstraints(
field,
values,
CronExpression$1.constraints[i2]
);
var copy = [];
var j2 = -1;
while (++j2 < values.length) {
copy[j2] = values[j2];
}
values = copy.sort(CronExpression$1._sortCompareFn).filter(function(item, pos, ary) {
return !pos || item !== ary[pos - 1];
});
if (values.length !== copy.length) {
throw new Error("Validation error, Field " + field + " contains duplicate values");
}
mappedFields[field] = values;
}
var dayOfMonth = CronExpression$1._handleMaxDaysInMonth(mappedFields);
mappedFields.dayOfMonth = dayOfMonth || mappedFields.dayOfMonth;
return new CronExpression$1(mappedFields, options || {});
};
var expression = CronExpression$1;
const __viteBrowserExternal = {};
const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: __viteBrowserExternal
}, Symbol.toStringTag, { value: "Module" }));
const require$$1 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
var CronExpression = expression;
function CronParser() {
}
CronParser._parseEntry = function _parseEntry(entry) {
var atoms = entry.split(" ");
if (atoms.length === 6) {
return {
interval: CronExpression.parse(entry)
};
} else if (atoms.length > 6) {
return {
interval: CronExpression.parse(
atoms.slice(0, 6).join(" ")
),
command: atoms.slice(6, atoms.length)
};
} else {
throw new Error("Invalid entry: " + entry);
}
};
CronParser.parseExpression = function parseExpression(expression2, options) {
return CronExpression.parse(expression2, options);
};
CronParser.fieldsToExpression = function fieldsToExpression2(fields, options) {
return CronExpression.fieldsToExpression(fields, options);
};
CronParser.parseString = function parseString(data2) {
var blocks = data2.split("\n");
var response = {
variables: {},
expressions: [],
errors: {}
};
for (var i2 = 0, c2 = blocks.length; i2 < c2; i2++) {
var block = blocks[i2];
var matches = null;
var entry = block.trim();
if (entry.length > 0) {
if (entry.match(/^#/)) {
continue;
} else if (matches = entry.match(/^(.*)=(.*)$/)) {
response.variables[matches[1]] = matches[2];
} else {
var result = null;
try {
result = CronParser._parseEntry("0 " + entry);
response.expressions.push(result.interval);
} catch (err) {
response.errors[entry] = err;
}
}
}
}
return response;
};
CronParser.parseFile = function parseFile(filePath, callback) {
require$$1.readFile(filePath, function(err, data2) {
if (err) {
callback(err);
return;
}
return callback(null, CronParser.parseString(data2.toString()));
});
};
var parser = CronParser;
const cronParser = /* @__PURE__ */ getDefaultExportFromCjs(parser);
const _hoisted_1$9 = { class: "cron-picker-panel-body" };
const _hoisted_2$5 = { class: "cron-tab-content" };
const _hoisted_3$2 = { class: "cron-picker-panel-item-title" };
const _hoisted_4$2 = { class: "cron-picker-panel-item-title" };
const _hoisted_5$2 = {
key: 0,
class: "footer-button"
};
const _sfc_main$c = /* @__PURE__ */ defineComponent({
__name: "index",
props: {
size: { default: "default" },
title: { default: $t("cronPicker.title") },
placement: { default: "bottomLeft" },
panelVisible: { type: Boolean },
disabled: { type: Boolean, default: false },
runtypeList: { default: () => [] },
runTypes: { default: () => [] },
runTimes: {},
format: { default: "" },
runType: {},
isHaveTab: { type: Boolean, default: false },
expression: { default: "" },
tabSelect: { default: "time" }
},
emits: ["setStatus", "handleGenCronExpr", "handleTabCronExpr", "update:panelVisible", "update:runType"],
setup(__props, { emit: __emit2 }) {
const props3 = __props;
const emit = __emit2;
const valueRunType = useVModel(props3, "runType", emit);
const handleGenCronExpr = () => {
visible.value = false;
if (!props3.isHaveTab) {
emit("handleGenCronExpr");
} else {
if (modeType.value === "tab") {
emit("handleTabCronExpr", tabRegValue.value);
} else {
emit("handleGenCronExpr");
}
}
};
const visible = ref(false);
const modeType = ref(props3.tabSelect);
const tabRegValue = ref(props3.expression);
const previewTime = ref(10);
const previews = ref([]);
watch(tabRegValue, (newVal) => {
previews.value = generatePreview(newVal);
});
const generatePreview = (val) => {
let array = [];
try {
const interval = cronParser.parseExpression(val);
for (let i2 = 0; i2 < previewTime.value; i2 += 1) {
const datetime2 = interval.next();
const year = zerofill(datetime2.getFullYear());
const month = zerofill(datetime2.getMonth() + 1);
const date2 = zerofill(datetime2.getDate());
const hour = zerofill(datetime2.getHours());
const minute = zerofill(datetime2.getMinutes());
const second = zerofill(datetime2.getSeconds());
array.push(`${year}-${month}-${date2} ${hour}:${minute}:${second}`);
}
} catch (error) {
array = ["此表达式暂时无法解析!"];
}
return array;
};
const emptyPre = () => {
previews.value = [];
};
const parse4 = (val) => {
previews.value = generatePreview(val);
};
watch(
() => props3.expression,
(newval) => {
tabRegValue.value = newval;
},
{ immediate: true }
);
return (_ctx, _cache) => {
const _component_a_radio_button = __unplugin_components_0$2;
const _component_a_radio_group = __unplugin_components_1$4;
const _component_a_space = __unplugin_components_2;
const _component_a_button = Button;
const _component_a_popover = __unplugin_components_6;
return openBlock(), createBlock(_component_a_popover, {
trigger: "click",
title: _ctx.title,
size: _ctx.size,
placement: _ctx.placement,
visible: visible.value,
"onUpdate:visible": _cache[4] || (_cache[4] = ($event) => visible.value = $event),
overlayClassName: !_ctx.isHaveTab ? "cron-picker-panel" : "cron-picker-panel cron-tab-panel"
}, {
content: withCtx(() => [
createElementVNode("div", _hoisted_1$9, [
createElementVNode("div", _hoisted_2$5, [
_ctx.isHaveTab ? (openBlock(), createBlock(_component_a_radio_group, {
key: 0,
class: "tab-radio",
value: modeType.value,
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => modeType.value = $event)
}, {
default: withCtx(() => [
createVNode(_component_a_radio_button, { value: "time" }, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.timePicker")), 1)
]),
_: 1
}),
createVNode(_component_a_radio_button, { value: "tab" }, {
default: withCtx(() => _cache[5] || (_cache[5] = [
createTextVNode("Crontab")
])),
_: 1
})
]),
_: 1
}, 8, ["value"])) : createCommentVNode("", true),
modeType.value === "time" || !_ctx.isHaveTab ? (openBlock(), createBlock(_component_a_space, {
key: 1,
size: 24,
direction: "vertical"
}, {
default: withCtx(() => [
createVNode(_component_a_space, {
size: 8,
direction: "vertical"
}, {
default: withCtx(() => [
createElementVNode("label", _hoisted_3$2, toDisplayString$1(unref($t)("cronPicker.frequency")), 1),
createVNode(_component_a_radio_group, {
class: "cron-picker-panel-radio-group",
value: unref(valueRunType),
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => isRef(valueRunType) ? valueRunType.value = $event : null),
"button-style": "solid"
}, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.runtypeList, (type, index2) => {
return openBlock(), createBlock(_component_a_radio_button, {
class: "cron-picker-panel-radio-button",
key: index2,
value: type.value
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(type.label), 1)
]),
_: 2
}, 1032, ["value"]);
}), 128))
]),
_: 1
}, 8, ["value"])
]),
_: 1
}),
createVNode(_component_a_space, {
size: 8,
direction: "vertical",
style: { width: "100%" }
}, {
default: withCtx(() => [
createElementVNode("label", _hoisted_4$2, toDisplayString$1(unref($t)("cronPicker.time")), 1),
createVNode(_sfc_main$g, {
disabled: _ctx.disabled,
runTypes: _ctx.runTypes,
runTimes: _ctx.runTimes,
format: _ctx.format,
runType: unref(valueRunType)
}, null, 8, ["disabled", "runTypes", "runTimes", "format", "runType"])
]),
_: 1
})
]),
_: 1
})) : createCommentVNode("", true),
modeType.value === "tab" && _ctx.isHaveTab ? (openBlock(), createBlock(PopTab, {
key: 2,
modelValue: tabRegValue.value,
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => tabRegValue.value = $event),
onParse: parse4
}, null, 8, ["modelValue"])) : createCommentVNode("", true),
_ctx.isHaveTab && modeType.value === "tab" ? (openBlock(), createBlock(_sfc_main$d, {
key: 3,
previews: previews.value,
onEmptyPre: emptyPre
}, null, 8, ["previews"])) : createCommentVNode("", true)
]),
_ctx.isHaveTab ? (openBlock(), createElementBlock("div", _hoisted_5$2, [
createVNode(_component_a_button, {
class: "tab-confirm",
type: "primary",
onClick: handleGenCronExpr
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.confirm")), 1)
]),
_: 1
}),
createVNode(_component_a_button, {
class: "tab-cancel",
onClick: _cache[3] || (_cache[3] = ($event) => visible.value = false)
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.cancel")), 1)
]),
_: 1
})
])) : createCommentVNode("", true),
!_ctx.isHaveTab ? (openBlock(), createBlock(_component_a_button, {
key: 1,
class: "cron-picker-panel-confirm-button",
block: "",
type: "primary",
onClick: handleGenCronExpr
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.confirm")), 1)
]),
_: 1
})) : createCommentVNode("", true)
])
]),
default: withCtx(() => [
renderSlot(_ctx.$slots, "default", {}, void 0, true)
]),
_: 3
}, 8, ["title", "size", "placement", "visible", "overlayClassName"]);
};
}
});
const index_vue_vue_type_style_index_0_scoped_48b8d6ea_lang = "";
const Panel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-48b8d6ea"]]);
const _hoisted_1$8 = { class: "dm-cron-picker" };
const _hoisted_2$4 = { key: 0 };
const _sfc_main$b = /* @__PURE__ */ defineComponent({
...{
name: "dm-cron-picker"
},
__name: "index",
props: {
size: { default: "default" },
trigger: { default: "click" },
title: { default: $t("cronPicker.title") },
placement: { default: "bottomLeft" },
format: { default: "" },
disabled: { type: Boolean, default: false },
value: { default: "" },
runTypes: { default: () => [] },
placeholder: { default: "" },
onlyShowText: { type: Boolean, default: false }
},
emits: ["input", "extra", "change", "update:value"],
setup(__props, { emit: __emit2 }) {
const props3 = __props;
const emit = __emit2;
const runCron = useVModel(props3, "value", emit);
const runType = ref(props3.runTypes.length > 0 ? props3.runTypes[0].value : "");
const runTimes = ref();
const unFirstInitType = ref(true);
const runtypeList = computed(() => {
return props3.runTypes.length > 0 ? props3.runTypes : CRON_TIMES_LIST;
});
const formatPickerTime2 = () => {
const format3 = DEFAULT_PICKER_FORMAT[isValidType.value ? runType.value : "default"];
const { formatter } = TYPE_VALUE_RESOLVER_MAP[runType.value] || TYPE_VALUE_RESOLVER_MAP["default"];
return formatter(runTimes.value, props3.format || format3);
};
const inputValue = computed(() => {
return formatPickerTime2();
});
const isValidType = computed(() => {
return PICKER_TYPE_LIST.includes(runType.value);
});
const setDefaultTime = (runTimesVal) => {
let columns = COLUMNS_MAP[runType.value] || COLUMNS_MAP["default"];
runTimes.value = runTimesVal || Object.fromEntries(
columns.map((item) => [item, ["week", "day", "month"].includes(item) ? 1 : 0])
);
};
const handleGenCronExpr = () => {
runCron.value = genCronExprByType(runType.value, runTimes.value);
};
const textLabel = computed(() => {
const matchCron = CRON_TIMES_LIST.find((i2) => i2.value === runType.value) || { label: "" };
const prefix = matchCron.label || "";
return prefix ? prefix + " " + inputValue.value : "";
});
onMounted(() => {
if (props3.value) {
unFirstInitType.value = false;
const runObj = genRunStrByCron(props3.value);
runType.value = runObj.runType;
runTimes.value = runObj.runTimes;
} else {
runType.value = "minute";
setDefaultTime();
}
});
watch(
() => runType.value,
() => {
if (unFirstInitType.value) {
setDefaultTime();
} else {
unFirstInitType.value = true;
}
},
{ immediate: true }
);
watch(
() => props3.value,
(val) => {
if (val) {
console.log("props.value", props3.value);
runCron.value = val || "";
const runObj = genRunStrByCron(props3.value);
runType.value = runObj.runType;
runTimes.value = runObj.runTimes;
} else {
runType.value = "";
setDefaultTime();
}
},
{ immediate: false }
);
watch(
() => runCron.value,
(val, oldVal) => {
const dateStr = `${$t("cronPicker.every")}${COLUMNS_HEADER_MAP[runType.value]} ${inputValue.value}`;
runCron.value = val;
emit("extra", { val, dateStr });
if (val !== oldVal) {
emit("change", val);
}
}
);
return (_ctx, _cache) => {
const _component_a_input = Input;
const _component_a_button = Button;
const _component_a_input_group = __unplugin_components_2$1;
return openBlock(), createBlock(unref(ConfigProvider$1), { prefixCls: "dm-ui" }, {
default: withCtx(() => [
createElementVNode("div", _hoisted_1$8, [
_ctx.onlyShowText ? (openBlock(), createElementBlock("div", _hoisted_2$4, toDisplayString$1(textLabel.value), 1)) : (openBlock(), createBlock(_component_a_input_group, {
key: 1,
compact: "",
style: { "display": "flex" }
}, {
default: withCtx(() => [
!_ctx.$slots.default ? (openBlock(), createBlock(_component_a_input, {
key: 0,
class: "cron-picker-input",
size: _ctx.size,
disabled: _ctx.disabled,
value: unref(runCron),
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => isRef(runCron) ? runCron.value = $event : null),
placeholder: _ctx.placeholder
}, null, 8, ["size", "disabled", "value", "placeholder"])) : createCommentVNode("", true),
!_ctx.disabled ? (openBlock(), createBlock(Panel, {
key: 1,
trigger: _ctx.trigger,
title: _ctx.title,
size: _ctx.size,
placement: _ctx.placement,
runType: runType.value,
"onUpdate:runType": _cache[1] || (_cache[1] = ($event) => runType.value = $event),
runTypes: _ctx.runTypes,
runtypeList: runtypeList.value,
disabled: _ctx.disabled,
runTimes: runTimes.value,
format: _ctx.format,
onHandleGenCronExpr: handleGenCronExpr
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default", {}, () => [
createVNode(_component_a_button, {
size: _ctx.size,
disabled: _ctx.disabled,
class: "cron-picker-panel-button"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.usePickerBtnText")), 1)
]),
_: 1
}, 8, ["size", "disabled"])
])
]),
_: 3
}, 8, ["trigger", "title", "size", "placement", "runType", "runTypes", "runtypeList", "disabled", "runTimes", "format"])) : createCommentVNode("", true)
]),
_: 3
}))
])
]),
_: 3
});
};
}
});
const style_less_vue_type_style_index_0_src_true_lang$1 = "";
_sfc_main$b.install = (app) => {
app.component(_sfc_main$b.name, _sfc_main$b);
return app;
};
var prism = { exports: {} };
(function(module2) {
var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
/**
* Prism: Lightweight, robust, elegant syntax highlighting
*
* @license MIT <https://opensource.org/licenses/MIT>
* @author Lea Verou <https://lea.verou.me>
* @namespace
* @public
*/
var Prism2 = function(_self2) {
var lang2 = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
var uniqueId = 0;
var plainTextGrammar = {};
var _2 = {
/**
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
* additional languages or plugins yourself.
*
* By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
*
* You obviously have to change this value before the automatic highlighting started. To do this, you can add an
* empty Prism object into the global scope before loading the Prism script like this:
*
* ```js
* window.Prism = window.Prism || {};
* Prism.manual = true;
* // add a new <script> to load Prism's script
* ```
*
* @default false
* @type {boolean}
* @memberof Prism
* @public
*/
manual: _self2.Prism && _self2.Prism.manual,
/**
* By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
* `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
* own worker, you don't want it to do this.
*
* By setting this value to `true`, Prism will not add its own listeners to the worker.
*
* You obviously have to change this value before Prism executes. To do this, you can add an
* empty Prism object into the global scope before loading the Prism script like this:
*
* ```js
* window.Prism = window.Prism || {};
* Prism.disableWorkerMessageHandler = true;
* // Load Prism's script
* ```
*
* @default false
* @type {boolean}
* @memberof Prism
* @public
*/
disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
/**
* A namespace for utility methods.
*
* All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
* change or disappear at any time.
*
* @namespace
* @memberof Prism
*/
util: {
encode: function encode(tokens) {
if (tokens instanceof Token) {
return new Token(tokens.type, encode(tokens.content), tokens.alias);
} else if (Array.isArray(tokens)) {
return tokens.map(encode);
} else {
return tokens.replace(/&/g, "&").replace(/</g, "<").replace(/\u00a0/g, " ");
}
},
/**
* Returns the name of the type of the given value.
*
* @param {any} o
* @returns {string}
* @example
* type(null) === 'Null'
* type(undefined) === 'Undefined'
* type(123) === 'Number'
* type('foo') === 'String'
* type(true) === 'Boolean'
* type([1, 2]) === 'Array'
* type({}) === 'Object'
* type(String) === 'Function'
* type(/abc+/) === 'RegExp'
*/
type: function(o2) {
return Object.prototype.toString.call(o2).slice(8, -1);
},
/**
* Returns a unique number for the given object. Later calls will still return the same number.
*
* @param {Object} obj
* @returns {number}
*/
objId: function(obj) {
if (!obj["__id"]) {
Object.defineProperty(obj, "__id", { value: ++uniqueId });
}
return obj["__id"];
},
/**
* Creates a deep clone of the given object.
*
* The main intended use of this function is to clone language definitions.
*
* @param {T} o
* @param {Record<number, any>} [visited]
* @returns {T}
* @template T
*/
clone: function deepClone(o2, visited) {
visited = visited || {};
var clone3;
var id;
switch (_2.util.type(o2)) {
case "Object":
id = _2.util.objId(o2);
if (visited[id]) {
return visited[id];
}
clone3 = /** @type {Record<string, any>} */
{};
visited[id] = clone3;
for (var key2 in o2) {
if (o2.hasOwnProperty(key2)) {
clone3[key2] = deepClone(o2[key2], visited);
}
}
return (
/** @type {any} */
clone3
);
case "Array":
id = _2.util.objId(o2);
if (visited[id]) {
return visited[id];
}
clone3 = [];
visited[id] = clone3;
/** @type {Array} */
/** @type {any} */
o2.forEach(function(v2, i2) {
clone3[i2] = deepClone(v2, visited);
});
return (
/** @type {any} */
clone3
);
default:
return o2;
}
},
/**
* Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
*
* If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
*
* @param {Element} element
* @returns {string}
*/
getLanguage: function(element) {
while (element) {
var m2 = lang2.exec(element.className);
if (m2) {
return m2[1].toLowerCase();
}
element = element.parentElement;
}
return "none";
},
/**
* Sets the Prism `language-xxxx` class of the given element.
*
* @param {Element} element
* @param {string} language
* @returns {void}
*/
setLanguage: function(element, language) {
element.className = element.className.replace(RegExp(lang2, "gi"), "");
element.classList.add("language-" + language);
},
/**
* Returns the script element that is currently executing.
*
* This does __not__ work for line script element.
*
* @returns {HTMLScriptElement | null}
*/
currentScript: function() {
if (typeof document === "undefined") {
return null;
}
if ("currentScript" in document && 1 < 2) {
return (
/** @type {any} */
document.currentScript
);
}
try {
throw new Error();
} catch (err) {
var src2 = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
if (src2) {
var scripts = document.getElementsByTagName("script");
for (var i2 in scripts) {
if (scripts[i2].src == src2) {
return scripts[i2];
}
}
}
return null;
}
},
/**
* Returns whether a given class is active for `element`.
*
* The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
* if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
* given class is just the given class with a `no-` prefix.
*
* Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
* closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
* ancestors have the given class or the negated version of it, then the default activation will be returned.
*
* In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
* version of it, the class is considered active.
*
* @param {Element} element
* @param {string} className
* @param {boolean} [defaultActivation=false]
* @returns {boolean}
*/
isActive: function(element, className, defaultActivation) {
var no = "no-" + className;
while (element) {
var classList = element.classList;
if (classList.contains(className)) {
return true;
}
if (classList.contains(no)) {
return false;
}
element = element.parentElement;
}
return !!defaultActivation;
}
},
/**
* This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
*
* @namespace
* @memberof Prism
* @public
*/
languages: {
/**
* The grammar for plain, unformatted text.
*/
plain: plainTextGrammar,
plaintext: plainTextGrammar,
text: plainTextGrammar,
txt: plainTextGrammar,
/**
* Creates a deep copy of the language with the given id and appends the given tokens.
*
* If a token in `redef` also appears in the copied language, then the existing token in the copied language
* will be overwritten at its original position.
*
* ## Best practices
*
* Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
* doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
* understand the language definition because, normally, the order of tokens matters in Prism grammars.
*
* Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
* Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
*
* @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
* @param {Grammar} redef The new tokens to append.
* @returns {Grammar} The new language created.
* @public
* @example
* Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
* // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
* // at its original position
* 'comment': { ... },
* // CSS doesn't have a 'color' token, so this token will be appended
* 'color': /\b(?:red|green|blue)\b/
* });
*/
extend: function(id, redef) {
var lang3 = _2.util.clone(_2.languages[id]);
for (var key2 in redef) {
lang3[key2] = redef[key2];
}
return lang3;
},
/**
* Inserts tokens _before_ another token in a language definition or any other grammar.
*
* ## Usage
*
* This helper method makes it easy to modify existing languages. For example, the CSS language definition
* not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
* in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
* appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
* this:
*
* ```js
* Prism.languages.markup.style = {
* // token
* };
* ```
*
* then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
* before existing tokens. For the CSS example above, you would use it like this:
*
* ```js
* Prism.languages.insertBefore('markup', 'cdata', {
* 'style': {
* // token
* }
* });
* ```
*
* ## Special cases
*
* If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
* will be ignored.
*
* This behavior can be used to insert tokens after `before`:
*
* ```js
* Prism.languages.insertBefore('markup', 'comment', {
* 'comment': Prism.languages.markup.comment,
* // tokens after 'comment'
* });
* ```
*
* ## Limitations
*
* The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
* properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
* differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
* deleting properties which is necessary to insert at arbitrary positions.
*
* To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
* Instead, it will create a new object and replace all references to the target object with the new one. This
* can be done without temporarily deleting properties, so the iteration order is well-defined.
*
* However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
* you hold the target object in a variable, then the value of the variable will not change.
*
* ```js
* var oldMarkup = Prism.languages.markup;
* var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
*
* assert(oldMarkup !== Prism.languages.markup);
* assert(newMarkup === Prism.languages.markup);
* ```
*
* @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
* object to be modified.
* @param {string} before The key to insert before.
* @param {Grammar} insert An object containing the key-value pairs to be inserted.
* @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
* object to be modified.
*
* Defaults to `Prism.languages`.
* @returns {Grammar} The new grammar object.
* @public
*/
insertBefore: function(inside, before, insert, root2) {
root2 = root2 || /** @type {any} */
_2.languages;
var grammar = root2[inside];
var ret = {};
for (var token2 in grammar) {
if (grammar.hasOwnProperty(token2)) {
if (token2 == before) {
for (var newToken in insert) {
if (insert.hasOwnProperty(newToken)) {
ret[newToken] = insert[newToken];
}
}
}
if (!insert.hasOwnProperty(token2)) {
ret[token2] = grammar[token2];
}
}
}
var old = root2[inside];
root2[inside] = ret;
_2.languages.DFS(_2.languages, function(key2, value2) {
if (value2 === old && key2 != inside) {
this[key2] = ret;
}
});
return ret;
},
// Traverse a language definition with Depth First Search
DFS: function DFS(o2, callback, type, visited) {
visited = visited || {};
var objId = _2.util.objId;
for (var i2 in o2) {
if (o2.hasOwnProperty(i2)) {
callback.call(o2, i2, o2[i2], type || i2);
var property = o2[i2];
var propertyType = _2.util.type(property);
if (propertyType === "Object" && !visited[objId(property)]) {
visited[objId(property)] = true;
DFS(property, callback, null, visited);
} else if (propertyType === "Array" && !visited[objId(property)]) {
visited[objId(property)] = true;
DFS(property, callback, i2, visited);
}
}
}
}
},
plugins: {},
/**
* This is the most high-level function in Prism’s API.
* It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
* each one of them.
*
* This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
*
* @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
* @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
* @memberof Prism
* @public
*/
highlightAll: function(async, callback) {
_2.highlightAllUnder(document, async, callback);
},
/**
* Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
* {@link Prism.highlightElement} on each one of them.
*
* The following hooks will be run:
* 1. `before-highlightall`
* 2. `before-all-elements-highlight`
* 3. All hooks of {@link Prism.highlightElement} for each element.
*
* @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
* @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
* @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
* @memberof Prism
* @public
*/
highlightAllUnder: function(container, async, callback) {
var env = {
callback,
container,
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
};
_2.hooks.run("before-highlightall", env);
env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
_2.hooks.run("before-all-elements-highlight", env);
for (var i2 = 0, element; element = env.elements[i2++]; ) {
_2.highlightElement(element, async === true, env.callback);
}
},
/**
* Highlights the code inside a single element.
*
* The following hooks will be run:
* 1. `before-sanity-check`
* 2. `before-highlight`
* 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
* 4. `before-insert`
* 5. `after-highlight`
* 6. `complete`
*
* Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
* the element's language.
*
* @param {Element} element The element containing the code.
* It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
* @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
* to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
* [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
*
* Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
* asynchronous highlighting to work. You can build your own bundle on the
* [Download page](https://prismjs.com/download.html).
* @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
* Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
* @memberof Prism
* @public
*/
highlightElement: function(element, async, callback) {
var language = _2.util.getLanguage(element);
var grammar = _2.languages[language];
_2.util.setLanguage(element, language);
var parent = element.parentElement;
if (parent && parent.nodeName.toLowerCase() === "pre") {
_2.util.setLanguage(parent, language);
}
var code2 = element.textContent;
var env = {
element,
language,
grammar,
code: code2
};
function insertHighlightedCode(highlightedCode) {
env.highlightedCode = highlightedCode;
_2.hooks.run("before-insert", env);
env.element.innerHTML = env.highlightedCode;
_2.hooks.run("after-highlight", env);
_2.hooks.run("complete", env);
callback && callback.call(env.element);
}
_2.hooks.run("before-sanity-check", env);
parent = env.element.parentElement;
if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
parent.setAttribute("tabindex", "0");
}
if (!env.code) {
_2.hooks.run("complete", env);
callback && callback.call(env.element);
return;
}
_2.hooks.run("before-highlight", env);
if (!env.grammar) {
insertHighlightedCode(_2.util.encode(env.code));
return;
}
if (async && _self2.Worker) {
var worker = new Worker(_2.filename);
worker.onmessage = function(evt) {
insertHighlightedCode(evt.data);
};
worker.postMessage(JSON.stringify({
language: env.language,
code: env.code,
immediateClose: true
}));
} else {
insertHighlightedCode(_2.highlight(env.code, env.grammar, env.language));
}
},
/**
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
* and the language definitions to use, and returns a string with the HTML produced.
*
* The following hooks will be run:
* 1. `before-tokenize`
* 2. `after-tokenize`
* 3. `wrap`: On each {@link Token}.
*
* @param {string} text A string with the code to be highlighted.
* @param {Grammar} grammar An object containing the tokens to use.
*
* Usually a language definition like `Prism.languages.markup`.
* @param {string} language The name of the language definition passed to `grammar`.
* @returns {string} The highlighted HTML.
* @memberof Prism
* @public
* @example
* Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
*/
highlight: function(text, grammar, language) {
var env = {
code: text,
grammar,
language
};
_2.hooks.run("before-tokenize", env);
if (!env.grammar) {
throw new Error('The language "' + env.language + '" has no grammar.');
}
env.tokens = _2.tokenize(env.code, env.grammar);
_2.hooks.run("after-tokenize", env);
return Token.stringify(_2.util.encode(env.tokens), env.language);
},
/**
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
* and the language definitions to use, and returns an array with the tokenized code.
*
* When the language definition includes nested tokens, the function is called recursively on each of these tokens.
*
* This method could be useful in other contexts as well, as a very crude parser.
*
* @param {string} text A string with the code to be highlighted.
* @param {Grammar} grammar An object containing the tokens to use.
*
* Usually a language definition like `Prism.languages.markup`.
* @returns {TokenStream} An array of strings and tokens, a token stream.
* @memberof Prism
* @public
* @example
* let code = `var foo = 0;`;
* let tokens = Prism.tokenize(code, Prism.languages.javascript);
* tokens.forEach(token => {
* if (token instanceof Prism.Token && token.type === 'number') {
* console.log(`Found numeric literal: ${token.content}`);
* }
* });
*/
tokenize: function(text, grammar) {
var rest = grammar.rest;
if (rest) {
for (var token2 in rest) {
grammar[token2] = rest[token2];
}
delete grammar.rest;
}
var tokenList = new LinkedList();
addAfter(tokenList, tokenList.head, text);
matchGrammar(text, tokenList, grammar, tokenList.head, 0);
return toArray2(tokenList);
},
/**
* @namespace
* @memberof Prism
* @public
*/
hooks: {
all: {},
/**
* Adds the given callback to the list of callbacks for the given hook.
*
* The callback will be invoked when the hook it is registered for is run.
* Hooks are usually directly run by a highlight function but you can also run hooks yourself.
*
* One callback function can be registered to multiple hooks and the same hook multiple times.
*
* @param {string} name The name of the hook.
* @param {HookCallback} callback The callback function which is given environment variables.
* @public
*/
add: function(name, callback) {
var hooks2 = _2.hooks.all;
hooks2[name] = hooks2[name] || [];
hooks2[name].push(callback);
},
/**
* Runs a hook invoking all registered callbacks with the given environment variables.
*
* Callbacks will be invoked synchronously and in the order in which they were registered.
*
* @param {string} name The name of the hook.
* @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
* @public
*/
run: function(name, env) {
var callbacks = _2.hooks.all[name];
if (!callbacks || !callbacks.length) {
return;
}
for (var i2 = 0, callback; callback = callbacks[i2++]; ) {
callback(env);
}
}
},
Token
};
_self2.Prism = _2;
function Token(type, content, alias, matchedStr) {
this.type = type;
this.content = content;
this.alias = alias;
this.length = (matchedStr || "").length | 0;
}
Token.stringify = function stringify2(o2, language) {
if (typeof o2 == "string") {
return o2;
}
if (Array.isArray(o2)) {
var s2 = "";
o2.forEach(function(e2) {
s2 += stringify2(e2, language);
});
return s2;
}
var env = {
type: o2.type,
content: stringify2(o2.content, language),
tag: "span",
classes: ["token", o2.type],
attributes: {},
language
};
var aliases = o2.alias;
if (aliases) {
if (Array.isArray(aliases)) {
Array.prototype.push.apply(env.classes, aliases);
} else {
env.classes.push(aliases);
}
}
_2.hooks.run("wrap", env);
var attributes2 = "";
for (var name in env.attributes) {
attributes2 += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, """) + '"';
}
return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes2 + ">" + env.content + "</" + env.tag + ">";
};
function matchPattern(pattern, pos, text, lookbehind) {
pattern.lastIndex = pos;
var match2 = pattern.exec(text);
if (match2 && lookbehind && match2[1]) {
var lookbehindLength = match2[1].length;
match2.index += lookbehindLength;
match2[0] = match2[0].slice(lookbehindLength);
}
return match2;
}
function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
for (var token2 in grammar) {
if (!grammar.hasOwnProperty(token2) || !grammar[token2]) {
continue;
}
var patterns = grammar[token2];
patterns = Array.isArray(patterns) ? patterns : [patterns];
for (var j2 = 0; j2 < patterns.length; ++j2) {
if (rematch && rematch.cause == token2 + "," + j2) {
return;
}
var patternObj = patterns[j2];
var inside = patternObj.inside;
var lookbehind = !!patternObj.lookbehind;
var greedy = !!patternObj.greedy;
var alias = patternObj.alias;
if (greedy && !patternObj.pattern.global) {
var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
}
var pattern = patternObj.pattern || patternObj;
for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
if (rematch && pos >= rematch.reach) {
break;
}
var str = currentNode.value;
if (tokenList.length > text.length) {
return;
}
if (str instanceof Token) {
continue;
}
var removeCount = 1;
var match2;
if (greedy) {
match2 = matchPattern(pattern, pos, text, lookbehind);
if (!match2 || match2.index >= text.length) {
break;
}
var from = match2.index;
var to = match2.index + match2[0].length;
var p = pos;
p += currentNode.value.length;
while (from >= p) {
currentNode = currentNode.next;
p += currentNode.value.length;
}
p -= currentNode.value.length;
pos = p;
if (currentNode.value instanceof Token) {
continue;
}
for (var k2 = currentNode; k2 !== tokenList.tail && (p < to || typeof k2.value === "string"); k2 = k2.next) {
removeCount++;
p += k2.value.length;
}
removeCount--;
str = text.slice(pos, p);
match2.index -= pos;
} else {
match2 = matchPattern(pattern, 0, str, lookbehind);
if (!match2) {
continue;
}
}
var from = match2.index;
var matchStr = match2[0];
var before = str.slice(0, from);
var after = str.slice(from + matchStr.length);
var reach = pos + str.length;
if (rematch && reach > rematch.reach) {
rematch.reach = reach;
}
var removeFrom = currentNode.prev;
if (before) {
removeFrom = addAfter(tokenList, removeFrom, before);
pos += before.length;
}
removeRange(tokenList, removeFrom, removeCount);
var wrapped = new Token(token2, inside ? _2.tokenize(matchStr, inside) : matchStr, alias, matchStr);
currentNode = addAfter(tokenList, removeFrom, wrapped);
if (after) {
addAfter(tokenList, currentNode, after);
}
if (removeCount > 1) {
var nestedRematch = {
cause: token2 + "," + j2,
reach
};
matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
if (rematch && nestedRematch.reach > rematch.reach) {
rematch.reach = nestedRematch.reach;
}
}
}
}
}
}
function LinkedList() {
var head = { value: null, prev: null, next: null };
var tail = { value: null, prev: head, next: null };
head.next = tail;
this.head = head;
this.tail = tail;
this.length = 0;
}
function addAfter(list, node, value2) {
var next2 = node.next;
var newNode = { value: value2, prev: node, next: next2 };
node.next = newNode;
next2.prev = newNode;
list.length++;
return newNode;
}
function removeRange(list, node, count) {
var next2 = node.next;
for (var i2 = 0; i2 < count && next2 !== list.tail; i2++) {
next2 = next2.next;
}
node.next = next2;
next2.prev = node;
list.length -= i2;
}
function toArray2(list) {
var array = [];
var node = list.head.next;
while (node !== list.tail) {
array.push(node.value);
node = node.next;
}
return array;
}
if (!_self2.document) {
if (!_self2.addEventListener) {
return _2;
}
if (!_2.disableWorkerMessageHandler) {
_self2.addEventListener("message", function(evt) {
var message2 = JSON.parse(evt.data);
var lang3 = message2.language;
var code2 = message2.code;
var immediateClose = message2.immediateClose;
_self2.postMessage(_2.highlight(code2, _2.languages[lang3], lang3));
if (immediateClose) {
_self2.close();
}
}, false);
}
return _2;
}
var script = _2.util.currentScript();
if (script) {
_2.filename = script.src;
if (script.hasAttribute("data-manual")) {
_2.manual = true;
}
}
function highlightAutomaticallyCallback() {
if (!_2.manual) {
_2.highlightAll();
}
}
if (!_2.manual) {
var readyState = document.readyState;
if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
} else {
if (window.requestAnimationFrame) {
window.requestAnimationFrame(highlightAutomaticallyCallback);
} else {
window.setTimeout(highlightAutomaticallyCallback, 16);
}
}
}
return _2;
}(_self);
if (module2.exports) {
module2.exports = Prism2;
}
if (typeof commonjsGlobal !== "undefined") {
commonjsGlobal.Prism = Prism2;
}
Prism2.languages.markup = {
"comment": {
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
greedy: true
},
"prolog": {
pattern: /<\?[\s\S]+?\?>/,
greedy: true
},
"doctype": {
// https://www.w3.org/TR/xml/#NT-doctypedecl
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
greedy: true,
inside: {
"internal-subset": {
pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
lookbehind: true,
greedy: true,
inside: null
// see below
},
"string": {
pattern: /"[^"]*"|'[^']*'/,
greedy: true
},
"punctuation": /^<!|>$|[[\]]/,
"doctype-tag": /^DOCTYPE/i,
"name": /[^\s<>'"]+/
}
},
"cdata": {
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
greedy: true
},
"tag": {
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
greedy: true,
inside: {
"tag": {
pattern: /^<\/?[^\s>\/]+/,
inside: {
"punctuation": /^<\/?/,
"namespace": /^[^\s>\/:]+:/
}
},
"special-attr": [],
"attr-value": {
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
inside: {
"punctuation": [
{
pattern: /^=/,
alias: "attr-equals"
},
{
pattern: /^(\s*)["']|["']$/,
lookbehind: true
}
]
}
},
"punctuation": /\/?>/,
"attr-name": {
pattern: /[^\s>\/]+/,
inside: {
"namespace": /^[^\s>\/:]+:/
}
}
}
},
"entity": [
{
pattern: /&[\da-z]{1,8};/i,
alias: "named-entity"
},
/&#x?[\da-f]{1,8};/i
]
};
Prism2.languages.markup["tag"].inside["attr-value"].inside["entity"] = Prism2.languages.markup["entity"];
Prism2.languages.markup["doctype"].inside["internal-subset"].inside = Prism2.languages.markup;
Prism2.hooks.add("wrap", function(env) {
if (env.type === "entity") {
env.attributes["title"] = env.content.replace(/&/, "&");
}
});
Object.defineProperty(Prism2.languages.markup.tag, "addInlined", {
/**
* Adds an inlined language to markup.
*
* An example of an inlined language is CSS with `<style>` tags.
*
* @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
* case insensitive.
* @param {string} lang The language key.
* @example
* addInlined('style', 'css');
*/
value: function addInlined(tagName, lang2) {
var includedCdataInside = {};
includedCdataInside["language-" + lang2] = {
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
lookbehind: true,
inside: Prism2.languages[lang2]
};
includedCdataInside["cdata"] = /^<!\[CDATA\[|\]\]>$/i;
var inside = {
"included-cdata": {
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
inside: includedCdataInside
}
};
inside["language-" + lang2] = {
pattern: /[\s\S]+/,
inside: Prism2.languages[lang2]
};
var def = {};
def[tagName] = {
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
return tagName;
}), "i"),
lookbehind: true,
greedy: true,
inside
};
Prism2.languages.insertBefore("markup", "cdata", def);
}
});
Object.defineProperty(Prism2.languages.markup.tag, "addAttribute", {
/**
* Adds an pattern to highlight languages embedded in HTML attributes.
*
* An example of an inlined language is CSS with `style` attributes.
*
* @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
* case insensitive.
* @param {string} lang The language key.
* @example
* addAttribute('style', 'css');
*/
value: function(attrName, lang2) {
Prism2.languages.markup.tag.inside["special-attr"].push({
pattern: RegExp(
/(^|["'\s])/.source + "(?:" + attrName + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
"i"
),
lookbehind: true,
inside: {
"attr-name": /^[^\s=]+/,
"attr-value": {
pattern: /=[\s\S]+/,
inside: {
"value": {
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
lookbehind: true,
alias: [lang2, "language-" + lang2],
inside: Prism2.languages[lang2]
},
"punctuation": [
{
pattern: /^=/,
alias: "attr-equals"
},
/"|'/
]
}
}
}
});
}
});
Prism2.languages.html = Prism2.languages.markup;
Prism2.languages.mathml = Prism2.languages.markup;
Prism2.languages.svg = Prism2.languages.markup;
Prism2.languages.xml = Prism2.languages.extend("markup", {});
Prism2.languages.ssml = Prism2.languages.xml;
Prism2.languages.atom = Prism2.languages.xml;
Prism2.languages.rss = Prism2.languages.xml;
(function(Prism3) {
var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
Prism3.languages.css = {
"comment": /\/\*[\s\S]*?\*\//,
"atrule": {
pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + string.source + ")*?" + /(?:;|(?=\s*\{))/.source),
inside: {
"rule": /^@[\w-]+/,
"selector-function-argument": {
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
lookbehind: true,
alias: "selector"
},
"keyword": {
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
lookbehind: true
}
// See rest below
}
},
"url": {
// https://drafts.csswg.org/css-values-3/#urls
pattern: RegExp("\\burl\\((?:" + string.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
greedy: true,
inside: {
"function": /^url/i,
"punctuation": /^\(|\)$/,
"string": {
pattern: RegExp("^" + string.source + "$"),
alias: "url"
}
}
},
"selector": {
pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + string.source + ")*(?=\\s*\\{)"),
lookbehind: true
},
"string": {
pattern: string,
greedy: true
},
"property": {
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
lookbehind: true
},
"important": /!important\b/i,
"function": {
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
lookbehind: true
},
"punctuation": /[(){};:,]/
};
Prism3.languages.css["atrule"].inside.rest = Prism3.languages.css;
var markup = Prism3.languages.markup;
if (markup) {
markup.tag.addInlined("style", "css");
markup.tag.addAttribute("style", "css");
}
})(Prism2);
Prism2.languages.clike = {
"comment": [
{
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
lookbehind: true,
greedy: true
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
"string": {
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
"class-name": {
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
lookbehind: true,
inside: {
"punctuation": /[.\\]/
}
},
"keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
"boolean": /\b(?:false|true)\b/,
"function": /\b\w+(?=\()/,
"number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
"operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
"punctuation": /[{}[\];(),.:]/
};
Prism2.languages.javascript = Prism2.languages.extend("clike", {
"class-name": [
Prism2.languages.clike["class-name"],
{
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
lookbehind: true
}
],
"keyword": [
{
pattern: /((?:^|\})\s*)catch\b/,
lookbehind: true
},
{
pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
lookbehind: true
}
],
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
"function": /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
"number": {
pattern: RegExp(
/(^|[^\w$])/.source + "(?:" + // constant
(/NaN|Infinity/.source + "|" + // binary integer
/0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
/0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
/\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
),
lookbehind: true
},
"operator": /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
});
Prism2.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
Prism2.languages.insertBefore("javascript", "keyword", {
"regex": {
pattern: RegExp(
// lookbehind
// eslint-disable-next-line regexp/no-dupe-characters-character-class
/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
// There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
// classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
// with the only syntax, so we have to define 2 different regex patterns.
/\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
),
lookbehind: true,
greedy: true,
inside: {
"regex-source": {
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
lookbehind: true,
alias: "language-regex",
inside: Prism2.languages.regex
},
"regex-delimiter": /^\/|\/$/,
"regex-flags": /^[a-z]+$/
}
},
// This must be declared before keyword because we use "function" inside the look-forward
"function-variable": {
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
alias: "function"
},
"parameter": [
{
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
lookbehind: true,
inside: Prism2.languages.javascript
},
{
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
lookbehind: true,
inside: Prism2.languages.javascript
},
{
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
lookbehind: true,
inside: Prism2.languages.javascript
},
{
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
lookbehind: true,
inside: Prism2.languages.javascript
}
],
"constant": /\b[A-Z](?:[A-Z_]|\dx?)*\b/
});
Prism2.languages.insertBefore("javascript", "string", {
"hashbang": {
pattern: /^#!.*/,
greedy: true,
alias: "comment"
},
"template-string": {
pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
greedy: true,
inside: {
"template-punctuation": {
pattern: /^`|`$/,
alias: "string"
},
"interpolation": {
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
lookbehind: true,
inside: {
"interpolation-punctuation": {
pattern: /^\$\{|\}$/,
alias: "punctuation"
},
rest: Prism2.languages.javascript
}
},
"string": /[\s\S]+/
}
},
"string-property": {
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
lookbehind: true,
greedy: true,
alias: "property"
}
});
Prism2.languages.insertBefore("javascript", "operator", {
"literal-property": {
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
lookbehind: true,
alias: "property"
}
});
if (Prism2.languages.markup) {
Prism2.languages.markup.tag.addInlined("script", "javascript");
Prism2.languages.markup.tag.addAttribute(
/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
"javascript"
);
}
Prism2.languages.js = Prism2.languages.javascript;
(function() {
if (typeof Prism2 === "undefined" || typeof document === "undefined") {
return;
}
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}
var LOADING_MESSAGE = "Loading…";
var FAILURE_MESSAGE = function(status, message2) {
return "✖ Error " + status + " while fetching file: " + message2;
};
var FAILURE_EMPTY_MESSAGE = "✖ Error: File does not exist or is empty";
var EXTENSIONS = {
"js": "javascript",
"py": "python",
"rb": "ruby",
"ps1": "powershell",
"psm1": "powershell",
"sh": "bash",
"bat": "batch",
"h": "c",
"tex": "latex"
};
var STATUS_ATTR = "data-src-status";
var STATUS_LOADING = "loading";
var STATUS_LOADED = "loaded";
var STATUS_FAILED = "failed";
var SELECTOR = "pre[data-src]:not([" + STATUS_ATTR + '="' + STATUS_LOADED + '"]):not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
function loadFile(src2, success, error) {
var xhr = new XMLHttpRequest();
xhr.open("GET", src2, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
success(xhr.responseText);
} else {
if (xhr.status >= 400) {
error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
} else {
error(FAILURE_EMPTY_MESSAGE);
}
}
}
};
xhr.send(null);
}
function parseRange(range) {
var m2 = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || "");
if (m2) {
var start = Number(m2[1]);
var comma = m2[2];
var end = m2[3];
if (!comma) {
return [start, start];
}
if (!end) {
return [start, void 0];
}
return [start, Number(end)];
}
return void 0;
}
Prism2.hooks.add("before-highlightall", function(env) {
env.selector += ", " + SELECTOR;
});
Prism2.hooks.add("before-sanity-check", function(env) {
var pre = (
/** @type {HTMLPreElement} */
env.element
);
if (pre.matches(SELECTOR)) {
env.code = "";
pre.setAttribute(STATUS_ATTR, STATUS_LOADING);
var code2 = pre.appendChild(document.createElement("CODE"));
code2.textContent = LOADING_MESSAGE;
var src2 = pre.getAttribute("data-src");
var language = env.language;
if (language === "none") {
var extension = (/\.(\w+)$/.exec(src2) || [, "none"])[1];
language = EXTENSIONS[extension] || extension;
}
Prism2.util.setLanguage(code2, language);
Prism2.util.setLanguage(pre, language);
var autoloader = Prism2.plugins.autoloader;
if (autoloader) {
autoloader.loadLanguages(language);
}
loadFile(
src2,
function(text) {
pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
var range = parseRange(pre.getAttribute("data-range"));
if (range) {
var lines = text.split(/\r\n?|\n/g);
var start = range[0];
var end = range[1] == null ? lines.length : range[1];
if (start < 0) {
start += lines.length;
}
start = Math.max(0, Math.min(start - 1, lines.length));
if (end < 0) {
end += lines.length;
}
end = Math.max(0, Math.min(end, lines.length));
text = lines.slice(start, end).join("\n");
if (!pre.hasAttribute("data-start")) {
pre.setAttribute("data-start", String(start + 1));
}
}
code2.textContent = text;
Prism2.highlightElement(code2);
},
function(error) {
pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
code2.textContent = error;
}
);
}
});
Prism2.plugins.fileHighlight = {
/**
* Executes the File Highlight plugin for all matching `pre` elements under the given container.
*
* Note: Elements which are already loaded or currently loading will not be touched by this method.
*
* @param {ParentNode} [container=document]
*/
highlight: function highlight(container) {
var elements = (container || document).querySelectorAll(SELECTOR);
for (var i2 = 0, element; element = elements[i2++]; ) {
Prism2.highlightElement(element);
}
}
};
var logged = false;
Prism2.fileHighlight = function() {
if (!logged) {
console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.");
logged = true;
}
Prism2.plugins.fileHighlight.highlight.apply(this, arguments);
};
})();
})(prism);
var prismExports = prism.exports;
const Prism = /* @__PURE__ */ getDefaultExportFromCjs(prismExports);
const prismTomorrow_min = "";
const _hoisted_1$7 = ["data-prismjs-copy", "data-prismjs-copy-success", "data-prismjs-copy-error", "data-language"];
const _hoisted_2$3 = ["innerHTML"];
const _sfc_main$a = /* @__PURE__ */ defineComponent({
...{
name: "dm-preview-code"
},
__name: "index",
props: {
code: { default: "" },
type: { default: "markup" },
isShowlineNumbers: { type: Boolean, default: false },
copyText: { default: "Copy" },
copySuccessText: { default: "Copied!" },
copyErrorText: { default: "User to press Ctrl+C" }
},
setup(__props) {
const props3 = __props;
const lineNumbers = computed(() => {
return props3.isShowlineNumbers ? "line-numbers" : "no-line-numbers";
});
const codeContent = computed(() => {
try {
return Prism.highlight(props3.code, Prism.languages[props3.type], props3.type);
} catch (error) {
console.log(error);
}
return "";
});
onMounted(() => {
Prism.highlightAll();
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("pre", {
lang: "zh-Hans-CN",
"data-previewers": "color time",
"data-prismjs-copy": props3.copyText,
"data-prismjs-copy-success": _ctx.copySuccessText,
"data-prismjs-copy-error": _ctx.copyErrorText,
class: normalizeClass(
"hx-scroll dm-preview-code normalize-whitespace " + lineNumbers.value + " language-" + props3.type
),
"data-language": props3.type
}, [
_cache[0] || (_cache[0] = createTextVNode(" ")),
createElementVNode("code", {
class: normalizeClass("language-" + props3.type),
innerHTML: codeContent.value
}, null, 10, _hoisted_2$3),
_cache[1] || (_cache[1] = createTextVNode("\n "))
], 10, _hoisted_1$7);
};
}
});
const index_vue_vue_type_style_index_0_lang$4 = "";
_sfc_main$a.install = (app) => {
app.component(_sfc_main$a.name, _sfc_main$a);
return app;
};
const _hoisted_1$6 = { class: "data-range-filter" };
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
__name: "date-range",
props: {
data: { default: () => ({}) }
},
emits: ["apply"],
setup(__props, { emit: __emit2 }) {
const props3 = __props;
const value2 = ref([]);
const openChange = () => {
value2.value = [];
};
const emit = __emit2;
const pickerOk = (dates) => {
let data2 = { field: props3.data.field, value: dates };
nextTick(() => {
emit("apply", data2);
});
};
return (_ctx, _cache) => {
const _component_a_range_picker = RangePicker;
return openBlock(), createElementBlock("div", _hoisted_1$6, [
createVNode(_component_a_range_picker, {
locale: unref(locale$1),
value: value2.value,
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => value2.value = $event),
placeholder: _ctx.data.placeholder,
"value-format": "YYYY-MM-DD HH:mm:ss",
onChange: pickerOk,
onOpenChange: openChange,
showTime: "",
bordered: false,
ranges: _ctx.data.ranges,
disabled: _ctx.data.disabled,
style: { "width": "100%" }
}, null, 8, ["locale", "value", "placeholder", "ranges", "disabled"])
]);
};
}
});
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
__name: "input",
props: {
data: { default: () => ({}) }
},
emits: ["apply"],
setup(__props, { expose: __expose, emit: __emit2 }) {
const props3 = __props;
const emit = __emit2;
const value2 = ref("");
const placeholder = computed(() => {
if (props3.data.placeholder) {
return props3.data.placeholder;
} else {
return `输入${props3.data.label}`;
}
});
const pressEnter = () => {
if (value2.value !== "") {
let data2 = { field: props3.data.field, value: value2.value };
nextTick(() => {
value2.value = "";
emit("apply", data2);
});
}
};
__expose({
pressEnter
});
return (_ctx, _cache) => {
const _component_a_input = Input;
return openBlock(), createBlock(_component_a_input, {
bordered: false,
value: value2.value,
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => value2.value = $event),
placeholder: placeholder.value,
onPressEnter: pressEnter
}, null, 8, ["value", "placeholder"]);
};
}
});
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
__name: "select",
props: {
data: { default: () => ({}) }
},
emits: ["apply"],
setup(__props, { emit: __emit2 }) {
const props3 = __props;
const emit = __emit2;
const value2 = ref("");
const placeholder = computed(() => {
if (props3.data.placeholder) {
return props3.data.placeholder;
} else {
return `输入${props3.data.label}`;
}
});
const change = (value22) => {
let data2 = { field: props3.data.field, value: value22 };
nextTick(() => {
value22.value = void 0;
emit("apply", data2);
});
};
return (_ctx, _cache) => {
const _component_a_select = __unplugin_components_0$4;
return openBlock(), createBlock(_component_a_select, {
value: value2.value,
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => value2.value = $event),
placeholder: placeholder.value,
options: _ctx.data.options,
onChange: change
}, null, 8, ["value", "placeholder", "options"]);
};
}
});
const _hoisted_1$5 = { class: "multiple-select-filter" };
const _hoisted_2$2 = { class: "filter-panel" };
const _hoisted_3$1 = {
key: 0,
class: "search"
};
const _hoisted_4$1 = { class: "list" };
const _hoisted_5$1 = { class: "content" };
const _hoisted_6$1 = { class: "label" };
const _hoisted_7$1 = {
key: 1,
class: "no-data"
};
const _hoisted_8$1 = { class: "footer" };
const _hoisted_9$1 = { class: "trigger-container" };
const _hoisted_10$1 = { class: "content" };
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
__name: "multiple-select",
props: {
data: { default: () => ({}) }
},
emits: ["apply"],
setup(__props, { emit: __emit2 }) {
const props3 = __props;
const emit = __emit2;
const visible = ref(false);
const selectedValues = ref([]);
const filterOptions = ref(props3.data.options);
const allowSearch = ref(true);
const isChecked = (value2) => {
let index2 = selectedValues.value.findIndex((v2) => v2 === value2);
return index2 > -1 ? true : false;
};
const placeholder = computed(() => {
if (props3.data.placeholder) {
return props3.data.placeholder;
} else {
return `输入${props3.data.label}`;
}
});
const visibleChange = (visible1) => {
if (!visible1) {
selectedValues.value = [];
}
visible.value = visible1;
};
const changeSelectedValues = (event, item) => {
let { checked, value: value2 } = event.target;
if (checked) {
selectedValues.value.push(item.value);
} else {
let index2 = selectedValues.value.findIndex((p) => p === value2);
if (index2 != -1) {
selectedValues.value.splice(index2, 1);
}
}
};
const clearSeleted = () => {
selectedValues.value = [];
};
const onSearch = (e2) => {
let filterOptions1 = props3.data.options.filter(
(p) => p.label.includes(e2.target.value)
);
filterOptions.value = filterOptions1;
};
const apply2 = () => {
visible.value = false;
let data2 = { field: props3.data.field, value: selectedValues.value };
emit("apply", data2);
clearSeleted();
};
watch(
() => props3.data.options,
(val) => {
filterOptions.value = val;
},
{ deep: true }
);
return (_ctx, _cache) => {
const _component_a_input = Input;
const _component_a_checkbox = Checkbox;
const _component_a_button = Button;
const _component_a_popover = __unplugin_components_6;
return openBlock(), createElementBlock("div", _hoisted_1$5, [
createVNode(_component_a_popover, {
placement: "bottomLeft",
"overlay-class-name": "multiple-select-popover",
"get-popup-container": (triggerNode) => triggerNode.parentNode,
align: { offset: [0, -5] },
trigger: "click",
onVisibleChange: visibleChange,
visible: visible.value,
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => visible.value = $event)
}, {
content: withCtx(() => [
createElementVNode("div", _hoisted_2$2, [
allowSearch.value ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
createVNode(unref(SearchOutlined$3)),
createVNode(_component_a_input, {
bordered: false,
placeholder: unref($t)("multipleFilter.search"),
allowClear: "",
onChange: onSearch
}, null, 8, ["placeholder"])
])) : createCommentVNode("", true),
createElementVNode("div", _hoisted_4$1, [
filterOptions.value.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(filterOptions.value, (item, index2) => {
return openBlock(), createBlock(_component_a_checkbox, {
key: index2,
value: item.value,
class: "item",
checked: isChecked(item.value),
onChange: (event) => changeSelectedValues(event, item)
}, {
default: withCtx(() => [
createElementVNode("div", _hoisted_5$1, [
renderSlot(_ctx.$slots, "label", {
record: item,
index: index2
}, () => [
createElementVNode("div", _hoisted_6$1, toDisplayString$1(item.label), 1)
])
])
]),
_: 2
}, 1032, ["value", "checked", "onChange"]);
}), 128)) : (openBlock(), createElementBlock("div", _hoisted_7$1, toDisplayString$1(unref($t)("multipleFilter.noMatch")), 1))
]),
createElementVNode("div", _hoisted_8$1, [
createVNode(_component_a_button, {
type: "link",
class: "clear-btn",
onClick: clearSeleted
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("multipleFilter.clear1")), 1)
]),
_: 1
}),
createVNode(_component_a_button, {
type: "primary",
class: "submit-btn",
onClick: apply2,
disabled: selectedValues.value.length <= 0
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("multipleFilter.apply")), 1)
]),
_: 1
}, 8, ["disabled"])
])
])
]),
default: withCtx(() => [
createElementVNode("div", _hoisted_9$1, [
createElementVNode("div", _hoisted_10$1, toDisplayString$1(placeholder.value), 1),
createVNode(unref(DownOutlined$3))
])
]),
_: 3
}, 8, ["get-popup-container", "visible"])
]);
};
}
});
const _hoisted_1$4 = { class: "dm-multiple-filter" };
const _hoisted_2$1 = { class: "search-header" };
const _hoisted_3 = {
key: 0,
style: { "display": "flex" }
};
const _hoisted_4 = { class: "search-container" };
const _hoisted_5 = { class: "search-value" };
const _hoisted_6 = { class: "extra-tools-wrap" };
const _hoisted_7 = {
key: 0,
class: "search-board-wrap"
};
const _hoisted_8 = { class: "tag-title" };
const _hoisted_9 = ["title"];
const _hoisted_10 = { class: "search-operation-btns" };
const _hoisted_11 = { class: "condition-temp-container" };
const _hoisted_12 = { class: "template-content" };
const _hoisted_13 = { class: "tips" };
const _hoisted_14 = { class: "save-condition" };
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
...{
name: "dm-multiple-filter"
},
__name: "index",
props: {
config: { default: () => [] },
moduleKey: { default: "moduleKey" }
},
emits: ["search"],
setup(__props, { emit: __emit2 }) {
var _a;
const props3 = __props;
const emit = __emit2;
const copyCloneConfig = ((_a = JSON.parse(JSON.stringify(props3.config))) == null ? void 0 : _a.filter((t2) => t2.value)) || [];
const visible = ref(false);
const fieldName = ref("");
const searchTags = ref(copyCloneConfig);
const tempName = ref("");
const tempList = ref([]);
const selectionMenuOptions = computed(() => {
return props3.config.map((v2) => ({
label: v2.label,
value: v2.field,
type: v2.type,
disabled: v2.disabled
}));
});
const currentSearchField = computed(() => {
return props3.config.find((v2) => v2.field === fieldName.value);
});
const componentName = computed(() => {
var _a2;
let componentMap = {
input: _sfc_main$8,
select: _sfc_main$7,
"multiple-select": _sfc_main$6,
"date-range": _sfc_main$9
};
return componentMap[(_a2 = currentSearchField.value) == null ? void 0 : _a2.type];
});
const applyTemplate = (temp) => {
searchTags.value = [...temp.params];
search();
};
const setQueryParams = (params) => {
params.forEach((item) => {
let config = props3.config.find((p) => p.field === item.field);
if (config) {
let { field, label, type } = config;
let tag = void 0;
switch (config.type) {
case "input":
if (typeof item.value === "string" && item.value.trim().length !== 0) {
tag = { field, label, type, value: item.value, tagText: item.value };
}
break;
case "select":
let option = config.options.find((p) => p.value === item.value);
if (option) {
tag = { field, label, type, value: option.value, tagText: option.label };
}
break;
case "multiple-select":
if (Array.isArray(item.value)) {
let options = config.options.filter((v2) => item.value.includes(v2.value));
if (options.length > 0) {
let value2 = options.map((v2) => v2.value);
let tagText = options.map((v2) => v2.label).toString();
tag = { field, label, type, value: value2, tagText };
}
}
break;
case "date-range":
if (validateRangeDateValue(item.value)) {
tag = {
field,
label,
type,
value: item.value,
tagText: item.value.join(" - "),
combinedFields: config.combinedFields
};
}
break;
}
if (tag) {
let index2 = searchTags.value.findIndex((v2) => v2.field === item.field);
if (index2 > -1) {
searchTags.value.splice(index2, 1, tag);
} else {
searchTags.value.push(tag);
}
}
}
});
};
const applyCondition = (data2) => {
setQueryParams([data2]);
search();
};
const removeCondition = (field) => {
let index2 = searchTags.value.findIndex((v2) => v2.field === field);
if (index2 != -1) {
searchTags.value.splice(index2, 1);
}
search();
};
const removeAllCondition = () => {
searchTags.value.splice(0, searchTags.value.length);
search();
};
const deleteTemplate = (temp) => {
deleteTemplate1(props3.moduleKey, temp.name);
tempList.value = getTemplatesByModuleKey(props3.moduleKey);
};
const saveAsConditionTemplate = () => {
addTemplate(props3.moduleKey, { name: tempName.value, params: searchTags.value });
tempName.value = "";
tempList.value = getTemplatesByModuleKey(props3.moduleKey);
visible.value = false;
};
const component1 = ref();
const search = () => {
if (componentName.value === _sfc_main$8) {
let component = component1.value;
if (component !== "") {
component.pressEnter();
let queryParams = formatQueryParams();
nextTick(() => {
emit("search", queryParams);
});
} else {
let queryParams = formatQueryParams();
nextTick(() => {
emit("search", queryParams);
});
}
} else {
let queryParams = formatQueryParams();
nextTick(() => {
emit("search", queryParams);
});
}
};
const formatQueryParams = () => {
let searchInfo = {};
searchTags.value.forEach((tag) => {
let { field, type, value: value2 } = tag;
switch (type) {
case "input":
case "select":
case "multiple-select":
searchInfo[field] = value2;
break;
case "date-range":
if (tag.combinedFields && tag.combinedFields.length === 2) {
searchInfo[tag.combinedFields[0]] = value2[0];
searchInfo[tag.combinedFields[1]] = value2[1];
} else {
searchInfo[field] = value2;
}
break;
}
});
return searchInfo;
};
watch(
() => props3.config,
() => {
tempList.value = getTemplatesByModuleKey(props3.moduleKey);
fieldName.value = props3.config.length > 0 ? props3.config[0].field : "";
},
{ deep: true, immediate: true }
);
onMounted(() => {
});
return (_ctx, _cache) => {
const _component_a_select = __unplugin_components_0$4;
const _component_a_button = Button;
const _component_a_menu_item = __unplugin_components_2$3;
const _component_a_menu = Menu;
const _component_a_dropdown = Dropdown$1;
const _component_a_input = Input;
const _component_a_popover = __unplugin_components_6;
return openBlock(), createBlock(unref(ConfigProvider$1), { prefixCls: "dm-ui" }, {
default: withCtx(() => [
createElementVNode("div", _hoisted_1$4, [
createElementVNode("div", _hoisted_2$1, [
_ctx.config.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3, [
createElementVNode("div", _hoisted_4, [
_ctx.config.length > 1 ? (openBlock(), createBlock(_component_a_select, {
key: 0,
class: "selection-menu",
value: fieldName.value,
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => fieldName.value = $event),
"dropdown-match-select-width": false,
options: selectionMenuOptions.value,
"get-popup-container": (triggerNode) => triggerNode.parentNode,
"dropdown-class-name": "dropdown-selection-menu",
size: "small"
}, null, 8, ["value", "options", "get-popup-container"])) : createCommentVNode("", true),
createElementVNode("div", _hoisted_5, [
(openBlock(), createBlock(resolveDynamicComponent(componentName.value), {
ref_key: "component1",
ref: component1,
data: currentSearchField.value,
onApply: applyCondition
}, null, 40, ["data"]))
]),
createVNode(unref(SearchOutlined$3), { onClick: search })
]),
tempList.value.length ? (openBlock(), createBlock(_component_a_dropdown, { key: 0 }, {
overlay: withCtx(() => [
createVNode(_component_a_menu, null, {
default: withCtx(() => [
(openBlock(true), createElementBlock(Fragment, null, renderList(tempList.value, (temp, index2) => {
return openBlock(), createBlock(_component_a_menu_item, {
key: index2,
onClick: ($event) => applyTemplate(temp),
title: temp.name
}, {
default: withCtx(() => [
createElementVNode("span", null, toDisplayString$1(temp.name), 1),
createVNode(unref(DeleteOutlined), {
class: "delIcon",
onClick: withModifiers(($event) => deleteTemplate(temp), ["stop"])
}, null, 8, ["onClick"])
]),
_: 2
}, 1032, ["onClick", "title"]);
}), 128))
]),
_: 1
})
]),
default: withCtx(() => [
createVNode(_component_a_button, { class: "select-search-temp" }, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("multipleFilter.filterTemplate")), 1)
]),
_: 1
})
]),
_: 1
})) : createCommentVNode("", true)
])) : createCommentVNode("", true),
createElementVNode("div", _hoisted_6, [
renderSlot(_ctx.$slots, "extra-tools")
])
]),
searchTags.value.length ? (openBlock(), createElementBlock("div", _hoisted_7, [
(openBlock(true), createElementBlock(Fragment, null, renderList(searchTags.value, (tag) => {
return openBlock(), createElementBlock("span", {
key: tag.field,
class: "search-tags"
}, [
createVNode(unref(CloseCircleOutlined$3), {
style: { "margin-right": "5px" },
onClick: ($event) => removeCondition(tag.field)
}, null, 8, ["onClick"]),
createElementVNode("span", _hoisted_8, toDisplayString$1(tag.label) + ":", 1),
createElementVNode("span", {
class: "tag-value",
title: tag.tagText
}, toDisplayString$1(tag.tagText), 9, _hoisted_9)
]);
}), 128)),
createElementVNode("div", _hoisted_10, [
createElementVNode("span", {
class: "clean-condition",
onClick: removeAllCondition
}, toDisplayString$1(unref($t)("multipleFilter.clear")), 1),
createVNode(_component_a_popover, {
visible: visible.value,
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => visible.value = $event),
trigger: "click",
"get-popup-container": (triggerNode) => triggerNode.parentNode,
placement: "bottom"
}, {
content: withCtx(() => [
createElementVNode("div", _hoisted_11, [
createElementVNode("div", _hoisted_12, [
createVNode(_component_a_input, {
value: tempName.value,
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => tempName.value = $event),
placeholder: unref($t)("multipleFilter.placeholder")
}, null, 8, ["value", "placeholder"]),
createVNode(_component_a_button, {
class: "save-template-btn",
disabled: tempName.value === "",
onClick: saveAsConditionTemplate
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("multipleFilter.save")), 1)
]),
_: 1
}, 8, ["disabled"])
]),
createElementVNode("p", _hoisted_13, toDisplayString$1(unref($t)("multipleFilter.tips")), 1)
])
]),
default: withCtx(() => [
createElementVNode("span", _hoisted_14, toDisplayString$1(unref($t)("multipleFilter.save")), 1)
]),
_: 1
}, 8, ["visible", "get-popup-container"])
])
])) : createCommentVNode("", true)
])
]),
_: 3
});
};
}
});
const style_less_vue_type_style_index_0_src_true_lang = "";
_sfc_main$5.install = (app) => {
app.component(_sfc_main$5.name, _sfc_main$5);
return app;
};
const Vue3DraggableResizable$2 = "";
var src = {};
var Vue3DraggableResizable$1 = {};
const require$$0 = /* @__PURE__ */ getAugmentedNamespace(vue);
var hooks = {};
var utils = {};
var hasRequiredUtils;
function requireUtils() {
if (hasRequiredUtils)
return utils;
hasRequiredUtils = 1;
var __assign = commonjsGlobal && commonjsGlobal.__assign || function() {
__assign = Object.assign || function(t2) {
for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
s2 = arguments[i2];
for (var p in s2)
if (Object.prototype.hasOwnProperty.call(s2, p))
t2[p] = s2[p];
}
return t2;
};
return __assign.apply(this, arguments);
};
utils.__esModule = true;
utils.getReferenceLineMap = utils.getId = utils.filterHandles = utils.removeEvent = utils.addEvent = utils.getElSize = utils.IDENTITY = void 0;
var Vue3DraggableResizable_1 = requireVue3DraggableResizable();
utils.IDENTITY = Symbol("Vue3DraggableResizable");
function getElSize(el) {
var style = window.getComputedStyle(el);
return {
width: parseFloat(style.getPropertyValue("width")),
height: parseFloat(style.getPropertyValue("height"))
};
}
utils.getElSize = getElSize;
function createEventListenerFunction(type) {
return function(el, events, handler2) {
if (!el) {
return;
}
if (typeof events === "string") {
events = [events];
}
events.forEach(function(e2) {
return el[type](e2, handler2, { passive: false });
});
};
}
utils.addEvent = createEventListenerFunction("addEventListener");
utils.removeEvent = createEventListenerFunction("removeEventListener");
function filterHandles(handles) {
if (handles && handles.length > 0) {
var result_1 = [];
handles.forEach(function(item) {
if (Vue3DraggableResizable_1.ALL_HANDLES.includes(item) && !result_1.includes(item)) {
result_1.push(item);
}
});
return result_1;
} else {
return [];
}
}
utils.filterHandles = filterHandles;
function getId() {
return String(Math.random()).substr(2) + String(Date.now());
}
utils.getId = getId;
function getReferenceLineMap(containerProvider, parentSize, id) {
var _a, _b;
if (containerProvider.disabled.value) {
return null;
}
var referenceLine = {
row: [],
col: []
};
var parentWidth = parentSize.parentWidth, parentHeight = parentSize.parentHeight;
(_a = referenceLine.row).push.apply(_a, containerProvider.adsorbRows);
(_b = referenceLine.col).push.apply(_b, containerProvider.adsorbCols);
if (containerProvider.adsorbParent.value) {
referenceLine.row.push(0, parentHeight.value, parentHeight.value / 2);
referenceLine.col.push(0, parentWidth.value, parentWidth.value / 2);
}
var widgetPositionStore = containerProvider.getPositionStore(id);
Object.values(widgetPositionStore).forEach(function(_a2) {
var x2 = _a2.x, y2 = _a2.y, w2 = _a2.w, h2 = _a2.h;
referenceLine.row.push(y2, y2 + h2, y2 + h2 / 2);
referenceLine.col.push(x2, x2 + w2, x2 + w2 / 2);
});
var referenceLineMap = {
row: referenceLine.row.reduce(function(pre, cur) {
var _a2;
return __assign(__assign({}, pre), (_a2 = {}, _a2[cur] = { min: cur - 5, max: cur + 5, value: cur }, _a2));
}, {}),
col: referenceLine.col.reduce(function(pre, cur) {
var _a2;
return __assign(__assign({}, pre), (_a2 = {}, _a2[cur] = { min: cur - 5, max: cur + 5, value: cur }, _a2));
}, {})
};
return referenceLineMap;
}
utils.getReferenceLineMap = getReferenceLineMap;
return utils;
}
var hasRequiredHooks;
function requireHooks() {
if (hasRequiredHooks)
return hooks;
hasRequiredHooks = 1;
var __assign = commonjsGlobal && commonjsGlobal.__assign || function() {
__assign = Object.assign || function(t2) {
for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
s2 = arguments[i2];
for (var p in s2)
if (Object.prototype.hasOwnProperty.call(s2, p))
t2[p] = s2[p];
}
return t2;
};
return __assign.apply(this, arguments);
};
hooks.__esModule = true;
hooks.watchProps = hooks.initResizeHandle = hooks.initDraggableContainer = hooks.initLimitSizeAndMethods = hooks.initParent = hooks.initState = hooks.useState = void 0;
var vue_1 = require$$0;
var utils_1 = requireUtils();
function useState2(initialState) {
var state = vue_1.ref(initialState);
var setState2 = function(value2) {
state.value = value2;
return value2;
};
return [state, setState2];
}
hooks.useState = useState2;
function initState(props3, emit) {
var _a = useState2(props3.initW), width = _a[0], setWidth = _a[1];
var _b = useState2(props3.initH), height = _b[0], setHeight = _b[1];
var _c = useState2(props3.x), left = _c[0], setLeft = _c[1];
var _d = useState2(props3.y), top = _d[0], setTop = _d[1];
var _e = useState2(props3.active), enable = _e[0], setEnable = _e[1];
var _f = useState2(false), dragging = _f[0], setDragging = _f[1];
var _g = useState2(false), resizing = _g[0], setResizing = _g[1];
var _h = useState2(""), resizingHandle = _h[0], setResizingHandle = _h[1];
var _j = useState2(Infinity), resizingMaxWidth = _j[0], setResizingMaxWidth = _j[1];
var _k = useState2(Infinity), resizingMaxHeight = _k[0], setResizingMaxHeight = _k[1];
var _l = useState2(props3.minW), resizingMinWidth = _l[0], setResizingMinWidth = _l[1];
var _m = useState2(props3.minH), resizingMinHeight = _m[0], setResizingMinHeight = _m[1];
var aspectRatio = vue_1.computed(function() {
return height.value / width.value;
});
vue_1.watch(width, function(newVal) {
emit("update:w", newVal);
}, { immediate: true });
vue_1.watch(height, function(newVal) {
emit("update:h", newVal);
}, { immediate: true });
vue_1.watch(top, function(newVal) {
emit("update:y", newVal);
});
vue_1.watch(left, function(newVal) {
emit("update:x", newVal);
});
vue_1.watch(enable, function(newVal, oldVal) {
emit("update:active", newVal);
if (!oldVal && newVal) {
emit("activated");
} else if (oldVal && !newVal) {
emit("deactivated");
}
});
vue_1.watch(function() {
return props3.active;
}, function(newVal) {
setEnable(newVal);
});
return {
id: utils_1.getId(),
width,
height,
top,
left,
enable,
dragging,
resizing,
resizingHandle,
resizingMaxHeight,
resizingMaxWidth,
resizingMinWidth,
resizingMinHeight,
aspectRatio,
setEnable,
setDragging,
setResizing,
setResizingHandle,
setResizingMaxHeight,
setResizingMaxWidth,
setResizingMinWidth,
setResizingMinHeight,
setWidth: function(val) {
return setWidth(Math.floor(val));
},
setHeight: function(val) {
return setHeight(Math.floor(val));
},
setTop: function(val) {
return setTop(Math.floor(val));
},
setLeft: function(val) {
return setLeft(Math.floor(val));
}
};
}
hooks.initState = initState;
function initParent(containerRef) {
var parentWidth = vue_1.ref(0);
var parentHeight = vue_1.ref(0);
vue_1.onMounted(function() {
if (containerRef.value && containerRef.value.parentElement) {
var _a = utils_1.getElSize(containerRef.value.parentElement), width = _a.width, height = _a.height;
parentWidth.value = width;
parentHeight.value = height;
}
});
return {
parentWidth,
parentHeight
};
}
hooks.initParent = initParent;
function initLimitSizeAndMethods(props3, parentSize, containerProps) {
var width = containerProps.width, height = containerProps.height, left = containerProps.left, top = containerProps.top, resizingMaxWidth = containerProps.resizingMaxWidth, resizingMaxHeight = containerProps.resizingMaxHeight, resizingMinWidth = containerProps.resizingMinWidth, resizingMinHeight = containerProps.resizingMinHeight;
var setWidth = containerProps.setWidth, setHeight = containerProps.setHeight, setTop = containerProps.setTop, setLeft = containerProps.setLeft;
var parentWidth = parentSize.parentWidth, parentHeight = parentSize.parentHeight;
var limitProps = {
minWidth: vue_1.computed(function() {
return resizingMinWidth.value;
}),
minHeight: vue_1.computed(function() {
return resizingMinHeight.value;
}),
maxWidth: vue_1.computed(function() {
var max = Infinity;
if (props3.parent) {
max = Math.min(parentWidth.value, resizingMaxWidth.value);
}
return max;
}),
maxHeight: vue_1.computed(function() {
var max = Infinity;
if (props3.parent) {
max = Math.min(parentHeight.value, resizingMaxHeight.value);
}
return max;
}),
minLeft: vue_1.computed(function() {
return props3.parent ? 0 : -Infinity;
}),
minTop: vue_1.computed(function() {
return props3.parent ? 0 : -Infinity;
}),
maxLeft: vue_1.computed(function() {
return props3.parent ? parentWidth.value - width.value : Infinity;
}),
maxTop: vue_1.computed(function() {
return props3.parent ? parentHeight.value - height.value : Infinity;
})
};
var limitMethods = {
setWidth: function(val) {
if (props3.disabledW) {
return width.value;
}
return setWidth(Math.min(limitProps.maxWidth.value, Math.max(limitProps.minWidth.value, val)));
},
setHeight: function(val) {
if (props3.disabledH) {
return height.value;
}
return setHeight(Math.min(limitProps.maxHeight.value, Math.max(limitProps.minHeight.value, val)));
},
setTop: function(val) {
if (props3.disabledY) {
return top.value;
}
return setTop(Math.min(limitProps.maxTop.value, Math.max(limitProps.minTop.value, val)));
},
setLeft: function(val) {
if (props3.disabledX) {
return left.value;
}
return setLeft(Math.min(limitProps.maxLeft.value, Math.max(limitProps.minLeft.value, val)));
}
};
return __assign(__assign({}, limitProps), limitMethods);
}
hooks.initLimitSizeAndMethods = initLimitSizeAndMethods;
var DOWN_HANDLES = ["mousedown", "touchstart"];
var UP_HANDLES = ["mouseup", "touchend"];
var MOVE_HANDLES = ["mousemove", "touchmove"];
function getPosition(e2) {
if ("touches" in e2) {
return [e2.touches[0].pageX, e2.touches[0].pageY];
} else {
return [e2.pageX, e2.pageY];
}
}
function initDraggableContainer(containerRef, containerProps, limitProps, draggable, emit, containerProvider, parentSize) {
var x2 = containerProps.left, y2 = containerProps.top, w2 = containerProps.width, h2 = containerProps.height, dragging = containerProps.dragging, id = containerProps.id;
var setDragging = containerProps.setDragging, setEnable = containerProps.setEnable, setResizing = containerProps.setResizing, setResizingHandle = containerProps.setResizingHandle;
var setTop = limitProps.setTop, setLeft = limitProps.setLeft;
var lstX = 0;
var lstY = 0;
var lstPageX = 0;
var lstPageY = 0;
var referenceLineMap = null;
var documentElement = document.documentElement;
var _unselect = function(e2) {
var _a;
var target = e2.target;
if (!((_a = containerRef.value) === null || _a === void 0 ? void 0 : _a.contains(target))) {
setEnable(false);
setDragging(false);
setResizing(false);
setResizingHandle("");
}
};
var handleUp = function() {
setDragging(false);
utils_1.removeEvent(documentElement, UP_HANDLES, handleUp);
utils_1.removeEvent(documentElement, MOVE_HANDLES, handleDrag);
referenceLineMap = null;
if (containerProvider) {
containerProvider.updatePosition(id, {
x: x2.value,
y: y2.value,
w: w2.value,
h: h2.value
});
containerProvider.setMatchedLine(null);
}
};
var handleDrag = function(e2) {
e2.preventDefault();
if (!(dragging.value && containerRef.value))
return;
var _a = getPosition(e2), pageX = _a[0], pageY = _a[1];
var deltaX = pageX - lstPageX;
var deltaY = pageY - lstPageY;
var newLeft = lstX + deltaX;
var newTop = lstY + deltaY;
if (referenceLineMap !== null) {
var widgetSelfLine = {
col: [newLeft, newLeft + w2.value / 2, newLeft + w2.value],
row: [newTop, newTop + h2.value / 2, newTop + h2.value]
};
var matchedLine = {
row: widgetSelfLine.row.map(function(i2, index2) {
var match2 = null;
Object.values(referenceLineMap.row).forEach(function(referItem) {
if (i2 >= referItem.min && i2 <= referItem.max) {
match2 = referItem.value;
}
});
if (match2 !== null) {
if (index2 === 0) {
newTop = match2;
} else if (index2 === 1) {
newTop = Math.floor(match2 - h2.value / 2);
} else if (index2 === 2) {
newTop = Math.floor(match2 - h2.value);
}
}
return match2;
}).filter(function(i2) {
return i2 !== null;
}),
col: widgetSelfLine.col.map(function(i2, index2) {
var match2 = null;
Object.values(referenceLineMap.col).forEach(function(referItem) {
if (i2 >= referItem.min && i2 <= referItem.max) {
match2 = referItem.value;
}
});
if (match2 !== null) {
if (index2 === 0) {
newLeft = match2;
} else if (index2 === 1) {
newLeft = Math.floor(match2 - w2.value / 2);
} else if (index2 === 2) {
newLeft = Math.floor(match2 - w2.value);
}
}
return match2;
}).filter(function(i2) {
return i2 !== null;
})
};
containerProvider.setMatchedLine(matchedLine);
}
emit("dragging", { x: setLeft(newLeft), y: setTop(newTop) });
};
var handleDown = function(e2) {
if (!draggable.value)
return;
setDragging(true);
lstX = x2.value;
lstY = y2.value;
lstPageX = getPosition(e2)[0];
lstPageY = getPosition(e2)[1];
utils_1.addEvent(documentElement, MOVE_HANDLES, handleDrag);
utils_1.addEvent(documentElement, UP_HANDLES, handleUp);
if (containerProvider && !containerProvider.disabled.value) {
referenceLineMap = utils_1.getReferenceLineMap(containerProvider, parentSize, id);
}
};
vue_1.watch(dragging, function(cur, pre) {
if (!pre && cur) {
emit("drag-start", { x: x2.value, y: y2.value });
setEnable(true);
setDragging(true);
} else {
emit("drag-end", { x: x2.value, y: y2.value });
setDragging(false);
}
});
vue_1.onMounted(function() {
var el = containerRef.value;
if (!el)
return;
el.style.left = x2 + "px";
el.style.top = y2 + "px";
utils_1.addEvent(documentElement, DOWN_HANDLES, _unselect);
utils_1.addEvent(el, DOWN_HANDLES, handleDown);
});
vue_1.onUnmounted(function() {
if (!containerRef.value)
return;
utils_1.removeEvent(documentElement, DOWN_HANDLES, _unselect);
utils_1.removeEvent(documentElement, UP_HANDLES, handleUp);
utils_1.removeEvent(documentElement, MOVE_HANDLES, handleDrag);
});
return { containerRef };
}
hooks.initDraggableContainer = initDraggableContainer;
function initResizeHandle(containerProps, limitProps, parentSize, props3, emit) {
var setWidth = limitProps.setWidth, setHeight = limitProps.setHeight, setLeft = limitProps.setLeft, setTop = limitProps.setTop;
var width = containerProps.width, height = containerProps.height, left = containerProps.left, top = containerProps.top, aspectRatio = containerProps.aspectRatio;
var setResizing = containerProps.setResizing, setResizingHandle = containerProps.setResizingHandle, setResizingMaxWidth = containerProps.setResizingMaxWidth, setResizingMaxHeight = containerProps.setResizingMaxHeight, setResizingMinWidth = containerProps.setResizingMinWidth, setResizingMinHeight = containerProps.setResizingMinHeight;
var parentWidth = parentSize.parentWidth, parentHeight = parentSize.parentHeight;
var lstW = 0;
var lstH = 0;
var lstX = 0;
var lstY = 0;
var lstPageX = 0;
var lstPageY = 0;
var tmpAspectRatio = 1;
var idx0 = "";
var idx1 = "";
var documentElement = document.documentElement;
var resizeHandleDrag = function(e2) {
e2.preventDefault();
var _a = getPosition(e2), _pageX = _a[0], _pageY = _a[1];
var deltaX = _pageX - lstPageX;
var deltaY = _pageY - lstPageY;
var _deltaX = deltaX;
var _deltaY = deltaY;
if (props3.lockAspectRatio) {
deltaX = Math.abs(deltaX);
deltaY = deltaX * tmpAspectRatio;
if (idx0 === "t") {
if (_deltaX < 0 || idx1 === "m" && _deltaY < 0) {
deltaX = -deltaX;
deltaY = -deltaY;
}
} else {
if (_deltaX < 0 || idx1 === "m" && _deltaY < 0) {
deltaX = -deltaX;
deltaY = -deltaY;
}
}
}
if (idx0 === "t") {
setHeight(lstH - deltaY);
setTop(lstY - (height.value - lstH));
} else if (idx0 === "b") {
setHeight(lstH + deltaY);
}
if (idx1 === "l") {
setWidth(lstW - deltaX);
setLeft(lstX - (width.value - lstW));
} else if (idx1 === "r") {
setWidth(lstW + deltaX);
}
emit("resizing", {
x: left.value,
y: top.value,
w: width.value,
h: height.value
});
};
var resizeHandleUp = function() {
emit("resize-end", {
x: left.value,
y: top.value,
w: width.value,
h: height.value
});
setResizingHandle("");
setResizing(false);
setResizingMaxWidth(Infinity);
setResizingMaxHeight(Infinity);
setResizingMinWidth(props3.minW);
setResizingMinHeight(props3.minH);
utils_1.removeEvent(documentElement, MOVE_HANDLES, resizeHandleDrag);
utils_1.removeEvent(documentElement, UP_HANDLES, resizeHandleUp);
};
var resizeHandleDown = function(e2, handleType) {
if (!props3.resizable)
return;
e2.stopPropagation();
setResizingHandle(handleType);
setResizing(true);
idx0 = handleType[0];
idx1 = handleType[1];
if (props3.lockAspectRatio) {
if (["tl", "tm", "ml", "bl"].includes(handleType)) {
idx0 = "t";
idx1 = "l";
} else {
idx0 = "b";
idx1 = "r";
}
}
var minHeight = props3.minH;
var minWidth = props3.minW;
if (props3.lockAspectRatio) {
if (minHeight / minWidth > aspectRatio.value) {
minWidth = minHeight / aspectRatio.value;
} else {
minHeight = minWidth * aspectRatio.value;
}
}
setResizingMinWidth(minWidth);
setResizingMinHeight(minHeight);
if (props3.parent) {
var maxHeight = idx0 === "t" ? top.value + height.value : parentHeight.value - top.value;
var maxWidth = idx1 === "l" ? left.value + width.value : parentWidth.value - left.value;
if (props3.lockAspectRatio) {
if (maxHeight / maxWidth < aspectRatio.value) {
maxWidth = maxHeight / aspectRatio.value;
} else {
maxHeight = maxWidth * aspectRatio.value;
}
}
setResizingMaxHeight(maxHeight);
setResizingMaxWidth(maxWidth);
}
lstW = width.value;
lstH = height.value;
lstX = left.value;
lstY = top.value;
var lstPagePosition = getPosition(e2);
lstPageX = lstPagePosition[0];
lstPageY = lstPagePosition[1];
tmpAspectRatio = aspectRatio.value;
emit("resize-start", {
x: left.value,
y: top.value,
w: width.value,
h: height.value
});
utils_1.addEvent(documentElement, MOVE_HANDLES, resizeHandleDrag);
utils_1.addEvent(documentElement, UP_HANDLES, resizeHandleUp);
};
vue_1.onUnmounted(function() {
utils_1.removeEvent(documentElement, UP_HANDLES, resizeHandleUp);
utils_1.removeEvent(documentElement, MOVE_HANDLES, resizeHandleDrag);
});
var handlesFiltered = vue_1.computed(function() {
return props3.resizable ? utils_1.filterHandles(props3.handles) : [];
});
return {
handlesFiltered,
resizeHandleDown
};
}
hooks.initResizeHandle = initResizeHandle;
function watchProps(props3, limits) {
var setWidth = limits.setWidth, setHeight = limits.setHeight, setLeft = limits.setLeft, setTop = limits.setTop;
vue_1.watch(function() {
return props3.w;
}, function(newVal) {
setWidth(newVal);
});
vue_1.watch(function() {
return props3.h;
}, function(newVal) {
setHeight(newVal);
});
vue_1.watch(function() {
return props3.x;
}, function(newVal) {
setLeft(newVal);
});
vue_1.watch(function() {
return props3.y;
}, function(newVal) {
setTop(newVal);
});
}
hooks.watchProps = watchProps;
return hooks;
}
const index$1 = "";
var hasRequiredVue3DraggableResizable;
function requireVue3DraggableResizable() {
if (hasRequiredVue3DraggableResizable)
return Vue3DraggableResizable$1;
hasRequiredVue3DraggableResizable = 1;
(function(exports2) {
var __assign = commonjsGlobal && commonjsGlobal.__assign || function() {
__assign = Object.assign || function(t2) {
for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
s2 = arguments[i2];
for (var p in s2)
if (Object.prototype.hasOwnProperty.call(s2, p))
t2[p] = s2[p];
}
return t2;
};
return __assign.apply(this, arguments);
};
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function() {
for (var s2 = 0, i2 = 0, il = arguments.length; i2 < il; i2++)
s2 += arguments[i2].length;
for (var r2 = Array(s2), k2 = 0, i2 = 0; i2 < il; i2++)
for (var a2 = arguments[i2], j2 = 0, jl = a2.length; j2 < jl; j2++, k2++)
r2[k2] = a2[j2];
return r2;
};
exports2.__esModule = true;
exports2.ALL_HANDLES = void 0;
var vue_1 = require$$0;
var hooks_1 = requireHooks();
var utils_1 = requireUtils();
exports2.ALL_HANDLES = [
"tl",
"tm",
"tr",
"ml",
"mr",
"bl",
"bm",
"br"
];
var VdrProps = {
initW: {
type: Number,
"default": null
},
initH: {
type: Number,
"default": null
},
w: {
type: Number,
"default": 0
},
h: {
type: Number,
"default": 0
},
x: {
type: Number,
"default": 0
},
y: {
type: Number,
"default": 0
},
draggable: {
type: Boolean,
"default": true
},
resizable: {
type: Boolean,
"default": true
},
disabledX: {
type: Boolean,
"default": false
},
disabledY: {
type: Boolean,
"default": false
},
disabledW: {
type: Boolean,
"default": false
},
disabledH: {
type: Boolean,
"default": false
},
minW: {
type: Number,
"default": 20
},
minH: {
type: Number,
"default": 20
},
active: {
type: Boolean,
"default": false
},
parent: {
type: Boolean,
"default": false
},
handles: {
type: Array,
"default": exports2.ALL_HANDLES,
validator: function(handles) {
return utils_1.filterHandles(handles).length === handles.length;
}
},
classNameDraggable: {
type: String,
"default": "draggable"
},
classNameResizable: {
type: String,
"default": "resizable"
},
classNameDragging: {
type: String,
"default": "dragging"
},
classNameResizing: {
type: String,
"default": "resizing"
},
classNameActive: {
type: String,
"default": "active"
},
classNameHandle: {
type: String,
"default": "handle"
},
lockAspectRatio: {
type: Boolean,
"default": false
}
};
var emits = [
"activated",
"deactivated",
"drag-start",
"resize-start",
"dragging",
"resizing",
"drag-end",
"resize-end",
"update:w",
"update:h",
"update:x",
"update:y",
"update:active"
];
var VueDraggableResizable = vue_1.defineComponent({
name: "Vue3DraggableResizable",
props: VdrProps,
emits,
setup: function(props3, _a) {
var emit = _a.emit;
var containerProps = hooks_1.initState(props3, emit);
var provideIdentity = vue_1.inject("identity", Symbol());
var containerProvider = null;
if (provideIdentity === utils_1.IDENTITY) {
containerProvider = {
updatePosition: vue_1.inject("updatePosition"),
getPositionStore: vue_1.inject("getPositionStore"),
disabled: vue_1.inject("disabled"),
adsorbParent: vue_1.inject("adsorbParent"),
adsorbCols: vue_1.inject("adsorbCols"),
adsorbRows: vue_1.inject("adsorbRows"),
setMatchedLine: vue_1.inject("setMatchedLine")
};
}
var containerRef = vue_1.ref();
var parentSize = hooks_1.initParent(containerRef);
var limitProps = hooks_1.initLimitSizeAndMethods(props3, parentSize, containerProps);
hooks_1.initDraggableContainer(containerRef, containerProps, limitProps, vue_1.toRef(props3, "draggable"), emit, containerProvider, parentSize);
var resizeHandle = hooks_1.initResizeHandle(containerProps, limitProps, parentSize, props3, emit);
hooks_1.watchProps(props3, limitProps);
return __assign(__assign(__assign(__assign({
containerRef,
containerProvider
}, containerProps), parentSize), limitProps), resizeHandle);
},
computed: {
style: function() {
return {
width: this.width + "px",
height: this.height + "px",
top: this.top + "px",
left: this.left + "px"
};
},
klass: function() {
var _a;
return _a = {}, _a[this.classNameActive] = this.enable, _a[this.classNameDragging] = this.dragging, _a[this.classNameResizing] = this.resizing, _a[this.classNameDraggable] = this.draggable, _a[this.classNameResizable] = this.resizable, _a;
}
},
mounted: function() {
if (!this.containerRef)
return;
this.containerRef.ondragstart = function() {
return false;
};
var _a = utils_1.getElSize(this.containerRef), width = _a.width, height = _a.height;
this.setWidth(this.initW === null ? this.w || width : this.initW);
this.setHeight(this.initH === null ? this.h || height : this.initH);
if (this.containerProvider) {
this.containerProvider.updatePosition(this.id, {
x: this.left,
y: this.top,
w: this.width,
h: this.height
});
}
},
render: function() {
var _this = this;
return vue_1.h("div", {
ref: "containerRef",
"class": ["vdr-container", this.klass],
style: this.style
}, __spreadArrays([
this.$slots["default"] && this.$slots["default"]()
], this.handlesFiltered.map(function(item) {
return vue_1.h("div", {
"class": [
"vdr-handle",
"vdr-handle-" + item,
_this.classNameHandle,
_this.classNameHandle + "-" + item
],
style: { display: _this.enable ? "block" : "none" },
onMousedown: function(e2) {
return _this.resizeHandleDown(e2, item);
},
onTouchstart: function(e2) {
return _this.resizeHandleDown(e2, item);
}
});
})));
}
});
exports2["default"] = VueDraggableResizable;
})(Vue3DraggableResizable$1);
return Vue3DraggableResizable$1;
}
var DraggableContainer = {};
(function(exports2) {
var __spreadArrays = commonjsGlobal && commonjsGlobal.__spreadArrays || function() {
for (var s2 = 0, i2 = 0, il = arguments.length; i2 < il; i2++)
s2 += arguments[i2].length;
for (var r2 = Array(s2), k2 = 0, i2 = 0; i2 < il; i2++)
for (var a2 = arguments[i2], j2 = 0, jl = a2.length; j2 < jl; j2++, k2++)
r2[k2] = a2[j2];
return r2;
};
exports2.__esModule = true;
var vue_1 = require$$0;
var utils_1 = requireUtils();
exports2["default"] = vue_1.defineComponent({
name: "DraggableContainer",
props: {
disabled: {
type: Boolean,
"default": false
},
adsorbParent: {
type: Boolean,
"default": true
},
adsorbCols: {
type: Array,
"default": null
},
adsorbRows: {
type: Array,
"default": null
},
referenceLineVisible: {
type: Boolean,
"default": true
},
referenceLineColor: {
type: String,
"default": "#f00"
}
},
setup: function(props3) {
var positionStore = vue_1.reactive({});
var updatePosition = function(id, position) {
positionStore[id] = position;
};
var getPositionStore = function(excludeId) {
var _positionStore = Object.assign({}, positionStore);
if (excludeId) {
delete _positionStore[excludeId];
}
return _positionStore;
};
var state = vue_1.reactive({
matchedLine: null
});
var matchedRows = vue_1.computed(function() {
return state.matchedLine && state.matchedLine.row || [];
});
var matchedCols = vue_1.computed(function() {
return state.matchedLine && state.matchedLine.col || [];
});
var setMatchedLine = function(matchedLine) {
state.matchedLine = matchedLine;
};
vue_1.provide("identity", utils_1.IDENTITY);
vue_1.provide("updatePosition", updatePosition);
vue_1.provide("getPositionStore", getPositionStore);
vue_1.provide("setMatchedLine", setMatchedLine);
vue_1.provide("disabled", vue_1.toRef(props3, "disabled"));
vue_1.provide("adsorbParent", vue_1.toRef(props3, "adsorbParent"));
vue_1.provide("adsorbCols", props3.adsorbCols || []);
vue_1.provide("adsorbRows", props3.adsorbRows || []);
return {
matchedRows,
matchedCols
};
},
methods: {
renderReferenceLine: function() {
var _this = this;
if (!this.referenceLineVisible) {
return [];
}
return __spreadArrays(this.matchedCols.map(function(item) {
return vue_1.h("div", {
style: {
width: "0",
height: "100%",
top: "0",
left: item + "px",
borderLeft: "1px dashed " + _this.referenceLineColor,
position: "absolute"
}
});
}), this.matchedRows.map(function(item) {
return vue_1.h("div", {
style: {
width: "100%",
height: "0",
left: "0",
top: item + "px",
borderTop: "1px dashed " + _this.referenceLineColor,
position: "absolute"
}
});
}));
}
},
render: function() {
return vue_1.h("div", {
style: { width: "100%", height: "100%", position: "relative" }
}, __spreadArrays([
this.$slots["default"] && this.$slots["default"]()
], this.renderReferenceLine()));
}
});
})(DraggableContainer);
(function(exports2) {
var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(o2, m2, k2, k22) {
if (k22 === void 0)
k22 = k2;
Object.defineProperty(o2, k22, { enumerable: true, get: function() {
return m2[k2];
} });
} : function(o2, m2, k2, k22) {
if (k22 === void 0)
k22 = k2;
o2[k22] = m2[k2];
});
exports2.__esModule = true;
var Vue3DraggableResizable_1 = requireVue3DraggableResizable();
var DraggableContainer_1 = DraggableContainer;
Vue3DraggableResizable_1["default"].install = function(app) {
app.component(Vue3DraggableResizable_1["default"].name, Vue3DraggableResizable_1["default"]);
app.component(DraggableContainer_1["default"].name, DraggableContainer_1["default"]);
return app;
};
var DraggableContainer_2 = DraggableContainer;
__createBinding(exports2, DraggableContainer_2, "default", "DraggableContainer");
exports2["default"] = Vue3DraggableResizable_1["default"];
})(src);
const Vue3DraggableResizable = /* @__PURE__ */ getDefaultExportFromCjs(src);
const useCollapse = () => {
const collapsed = ref(false);
const toggleCollapsed = () => {
collapsed.value = !collapsed.value;
};
return {
collapsed,
toggleCollapsed
};
};
const useCollapse$1 = useCollapse;
const useDraggable = (width) => {
const activeDraggable = ref(false);
const draggableStyle = reactive({
minWidth: width,
width
});
const resizingHandle = (e2, maxWidth) => {
if (e2.w >= maxWidth) {
Object.assign(draggableStyle, {
width: maxWidth
});
} else {
Object.assign(draggableStyle, {
width: e2.w
});
}
};
return {
activeDraggable,
draggableStyle,
resizingHandle
};
};
const useDraggable$1 = useDraggable;
const _hoisted_1$3 = { class: "dm-catalogue__content" };
const _hoisted_2 = {
key: 1,
class: "catalogue-container"
};
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
...{
name: "dm-catalogue"
},
__name: "index",
props: {
width: { default: 200 },
maxWidth: { default: 400 },
draggable: { type: Boolean, default: () => true },
collapseable: { type: Boolean, default: () => true },
draggHandleWidth: { default: 10 },
pos: { default: "right" },
style: {},
collapseStyle: { default: () => ({
top: "50px",
width: "20px",
height: "20px"
}) }
},
emits: ["changeCollapsed"],
setup(__props, { emit: __emit2 }) {
useCssVars((_ctx) => ({
"fb05e954": catelogueStyle.value.maxWidth,
"4ba033a0": handleWidth.value
}));
const props3 = __props;
const emit = __emit2;
const { collapsed, toggleCollapsed } = useCollapse$1();
const { activeDraggable, draggableStyle, resizingHandle } = useDraggable$1(props3.width);
const catelogueStyle = computed(() => ({
...props3.style || {},
width: collapsed.value ? "0" : draggableStyle.width + "px",
maxWidth: props3.maxWidth + "px"
}));
const handleWidth = computed(() => props3.draggHandleWidth + "px");
const handles = computed(() => {
const handlesList = [];
if (props3.pos === "left") {
handlesList.push("ml");
} else {
handlesList.push("mr");
}
return handlesList;
});
watch(
() => collapsed.value,
() => {
emit("changeCollapsed");
},
{ immediate: true }
);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(["dm-catalogue", { collapsed: unref(collapsed) }]),
style: normalizeStyle(catelogueStyle.value),
onMouseenter: _cache[4] || (_cache[4] = () => activeDraggable.value = true),
onMouseleave: _cache[5] || (_cache[5] = () => activeDraggable.value = false)
}, [
createElementVNode("div", _hoisted_1$3, [
props3.draggable ? withDirectives((openBlock(), createBlock(unref(Vue3DraggableResizable), {
key: 0,
active: unref(activeDraggable),
"onUpdate:active": _cache[0] || (_cache[0] = ($event) => isRef(activeDraggable) ? activeDraggable.value = $event : null),
w: unref(draggableStyle).width,
"onUpdate:w": _cache[1] || (_cache[1] = ($event) => unref(draggableStyle).width = $event),
minW: unref(draggableStyle).minWidth,
draggable: false,
disabledH: true,
resizable: true,
handles: handles.value,
onResizing: _cache[2] || (_cache[2] = (e2) => unref(resizingHandle)(e2, props3.maxWidth))
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["active", "w", "minW", "handles"])), [
[vShow, !unref(collapsed)]
]) : withDirectives((openBlock(), createElementBlock("div", _hoisted_2, [
renderSlot(_ctx.$slots, "default")
], 512)), [
[vShow, !unref(collapsed)]
]),
props3.collapseable ? (openBlock(), createElementBlock("div", {
key: 2,
class: normalizeClass(["dm-catalogue__toggle", _ctx.pos]),
style: normalizeStyle(props3.collapseStyle),
onClick: _cache[3] || (_cache[3] = //@ts-ignore
(...args) => unref(toggleCollapsed) && unref(toggleCollapsed)(...args))
}, [
renderSlot(_ctx.$slots, "icon", { collapsed: unref(collapsed) }, () => [
createVNode(unref(LeftOutlined), {
style: { fontSize: "12px" },
class: normalizeClass([unref(collapsed) ? "toggle-open-icon" : ""])
}, null, 8, ["class"])
])
], 6)) : createCommentVNode("", true)
])
], 38);
};
}
});
const index_vue_vue_type_style_index_0_lang$3 = "";
_sfc_main$4.install = function(app) {
app.component(_sfc_main$4.name, _sfc_main$4);
return app;
};
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
...{
name: "dm-modal"
},
__name: "index",
props: {
modelValue: { type: Boolean },
title: { default: "" },
footer: { type: Boolean, default: () => true },
okText: { default: "" },
cancelText: { default: "" },
spinning: { type: Boolean, default: () => false },
prefixCls: { default: "dm-ui" },
okButtonProps: { default: () => ({}) },
cancelButtonProps: { default: () => ({}) }
},
emits: ["update:modelValue", "confirm", "cancel"],
setup(__props, { emit: __emit2 }) {
const props3 = __props;
const emit = __emit2;
const modalVisible = useVModel(props3, "modelValue", emit);
const confirmHandler = () => {
emit("confirm");
};
const cancelHandler = (e2) => {
modalVisible.value = false;
emit("cancel", e2);
};
return (_ctx, _cache) => {
const _component_a_button = Button;
const _component_a_modal = Modal;
return openBlock(), createBlock(_component_a_modal, mergeProps(
{
visible: unref(modalVisible),
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => isRef(modalVisible) ? modalVisible.value = $event : null),
wrapClassName: "dm-modal",
prefixCls: `${props3.prefixCls}-modal`
},
!props3.footer ? {
..._ctx.$attrs,
footer: props3.footer
} : _ctx.$attrs,
{ onCancel: cancelHandler }
), createSlots({
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 2
}, [
_ctx.$slots.title || props3.title ? {
name: "title",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "title", {}, () => [
createTextVNode(toDisplayString$1(props3.title), 1)
])
]),
key: "0"
} : void 0,
props3.footer ? {
name: "footer",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "footer", {}, () => [
createVNode(_component_a_button, mergeProps(props3.okButtonProps, {
loading: props3.spinning,
type: "primary",
prefixCls: `${props3.prefixCls}-btn`,
onClick: confirmHandler
}), {
default: withCtx(() => [
createTextVNode(toDisplayString$1(props3.okText || unref($t)("datePicker.confirm")), 1)
]),
_: 1
}, 16, ["loading", "prefixCls"]),
createVNode(_component_a_button, mergeProps({
onClick: _cache[0] || (_cache[0] = ($event) => cancelHandler()),
prefixCls: `${props3.prefixCls}-btn`
}, props3.cancelButtonProps), {
default: withCtx(() => [
createTextVNode(toDisplayString$1(props3.cancelText || unref($t)("cronPicker.cancel")), 1)
]),
_: 1
}, 16, ["prefixCls"])
])
]),
key: "1"
} : void 0
]), 1040, ["visible", "prefixCls"]);
};
}
});
const index_vue_vue_type_style_index_0_lang$2 = "";
_sfc_main$3.install = function(app) {
app.component(_sfc_main$3.name, _sfc_main$3);
return app;
};
const _hoisted_1$2 = { class: "dm-drawer__container" };
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
...{
name: "dm-drawer"
},
__name: "index",
props: {
modelValue: { type: Boolean },
title: {},
footer: { type: Boolean, default: () => true },
okText: { default: "" },
cancelText: { default: "" },
spinning: { type: Boolean, default: false },
prefixCls: { default: "dm-ui" },
okButtonProps: { default: () => ({}) },
cancelButtonProps: { default: () => ({}) }
},
emits: ["update:modelValue", "confirm", "cancel"],
setup(__props, { emit: __emit2 }) {
const props3 = __props;
const emit = __emit2;
const slots = useSlots();
const drawerVisible = useVModel(props3, "modelValue", emit);
const showFooter = computed(() => slots.footer || props3.footer);
const confirmHandler = () => {
emit("confirm");
};
const cancelHandler = (e2) => {
drawerVisible.value = false;
emit("cancel", e2);
};
return (_ctx, _cache) => {
const _component_a_button = Button;
const _component_a_drawer = __unplugin_components_1$1;
return openBlock(), createBlock(_component_a_drawer, mergeProps({
maskClosable: !showFooter.value,
visible: unref(drawerVisible),
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => isRef(drawerVisible) ? drawerVisible.value = $event : null),
class: "dm-drawer",
destroyOnClose: "",
closable: !showFooter.value,
prefixCls: `${props3.prefixCls}-drawer`
}, _ctx.$attrs), createSlots({
closeIcon: withCtx(() => [
createVNode(unref(CloseCircleFilled$3), { style: { fontSize: "24px", color: "#939ABD" } })
]),
default: withCtx(() => [
createElementVNode("div", _hoisted_1$2, [
renderSlot(_ctx.$slots, "default")
])
]),
_: 2
}, [
_ctx.$slots.title || props3.title ? {
name: "title",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "title", {}, () => [
createTextVNode(toDisplayString$1(props3.title), 1)
])
]),
key: "0"
} : void 0,
_ctx.$slots.extra ? {
name: "extra",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "extra")
]),
key: "1"
} : void 0,
showFooter.value ? {
name: "footer",
fn: withCtx(() => [
renderSlot(_ctx.$slots, "footer", {}, () => [
createVNode(_component_a_button, mergeProps(props3.okButtonProps, {
loading: props3.spinning,
type: "primary",
prefixCls: `${props3.prefixCls}-btn`,
onClick: confirmHandler
}), {
default: withCtx(() => [
createTextVNode(toDisplayString$1(props3.okText || unref($t)("datePicker.confirm")), 1)
]),
_: 1
}, 16, ["loading", "prefixCls"]),
createVNode(_component_a_button, mergeProps(props3.cancelButtonProps, {
prefixCls: `${props3.prefixCls}-btn`,
onClick: cancelHandler
}), {
default: withCtx(() => [
createTextVNode(toDisplayString$1(props3.cancelText || unref($t)("cronPicker.cancel")), 1)
]),
_: 1
}, 16, ["prefixCls"])
])
]),
key: "2"
} : void 0
]), 1040, ["maskClosable", "visible", "closable", "prefixCls"]);
};
}
});
const index_vue_vue_type_style_index_0_lang$1 = "";
_sfc_main$2.install = function(app) {
app.component(_sfc_main$2.name, _sfc_main$2);
return app;
};
const _hoisted_1$1 = { class: "dm-cron-picker" };
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
...{
name: "dm-cron-tab"
},
__name: "index",
props: {
size: { default: "default" },
trigger: { default: "click" },
title: { default: $t("cronPicker.title") },
placement: { default: "bottomLeft" },
format: { default: "" },
disabled: { type: Boolean, default: false },
value: { default: "" },
runTypes: { default: () => [] },
tabSelect: { default: "time" }
},
emits: ["input", "extra", "change", "update:value"],
setup(__props, { emit: __emit2 }) {
const props3 = __props;
const emit = __emit2;
const runCron = useVModel(props3, "value", emit);
const runType = ref(props3.runTypes.length > 0 ? props3.runTypes[0].value : "");
const runTimes = ref();
const unFirstInitType = ref(true);
const tabSelect = ref(props3.tabSelect);
const runtypeList = computed(() => {
return props3.runTypes.length > 0 ? props3.runTypes : CRON_TIMES_LIST;
});
const formatPickerTime2 = () => {
const format3 = DEFAULT_PICKER_FORMAT[isValidType.value ? runType.value : "default"];
const { formatter } = TYPE_VALUE_RESOLVER_MAP[runType.value] || TYPE_VALUE_RESOLVER_MAP["default"];
return formatter(runTimes.value, props3.format || format3);
};
const inputValue = computed(() => {
return formatPickerTime2();
});
const isValidType = computed(() => {
return PICKER_TYPE_LIST.includes(runType.value);
});
const setDefaultTime = (runTimesVal) => {
let columns = COLUMNS_MAP[runType.value] || COLUMNS_MAP["default"];
runTimes.value = runTimesVal || Object.fromEntries(
columns.map((item) => [item, ["week", "day", "month"].includes(item) ? 1 : 0])
);
};
const handleGenCronExpr = () => {
runCron.value = genCronExprByType(runType.value, runTimes.value);
};
const handleTabCronExpr = (val) => {
runCron.value = val;
};
onMounted(() => {
if (props3.value) {
unFirstInitType.value = false;
const runObj = genRunStrByCron(props3.value);
runType.value = runObj.runType;
runTimes.value = runObj.runTimes;
} else {
runType.value = "minute";
setDefaultTime();
}
});
watch(
() => runType.value,
() => {
if (unFirstInitType.value) {
setDefaultTime();
} else {
unFirstInitType.value = true;
}
},
{ immediate: true }
);
watch(
() => props3.value,
(val) => {
if (val) {
console.log("props.value", props3.value);
runCron.value = val || "";
const runObj = genRunStrByCron(props3.value);
runType.value = runObj.runType;
runTimes.value = runObj.runTimes;
} else {
runType.value = "";
setDefaultTime();
}
},
{ immediate: false }
);
watch(
() => runCron.value,
(val, oldVal) => {
const dateStr = `每${COLUMNS_HEADER_MAP[runType.value]} ${inputValue.value}`;
runCron.value = val;
emit("extra", { val, dateStr });
if (val !== oldVal) {
emit("change", val);
}
}
);
return (_ctx, _cache) => {
const _component_a_input = Input;
const _component_a_button = Button;
const _component_a_input_group = __unplugin_components_2$1;
return openBlock(), createBlock(unref(ConfigProvider$1), { prefixCls: "dm-ui" }, {
default: withCtx(() => [
createElementVNode("div", _hoisted_1$1, [
createVNode(_component_a_input_group, {
compact: "",
style: { "display": "flex" }
}, {
default: withCtx(() => [
!_ctx.$slots.default ? (openBlock(), createBlock(_component_a_input, {
key: 0,
class: "cron-picker-input",
size: _ctx.size,
disabled: _ctx.disabled,
value: unref(runCron),
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => isRef(runCron) ? runCron.value = $event : null)
}, null, 8, ["size", "disabled", "value"])) : createCommentVNode("", true),
createVNode(Panel, {
trigger: _ctx.trigger,
title: _ctx.title,
size: _ctx.size,
placement: _ctx.placement,
runType: runType.value,
"onUpdate:runType": _cache[1] || (_cache[1] = ($event) => runType.value = $event),
runTypes: _ctx.runTypes,
runtypeList: runtypeList.value,
disabled: _ctx.disabled,
runTimes: runTimes.value,
tabSelect: tabSelect.value,
format: _ctx.format,
isHaveTab: true,
expression: unref(runCron),
onHandleGenCronExpr: handleGenCronExpr,
onHandleTabCronExpr: handleTabCronExpr
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default", {}, () => [
createVNode(_component_a_button, {
size: _ctx.size,
disabled: _ctx.disabled,
class: "cron-picker-panel-button"
}, {
default: withCtx(() => [
createTextVNode(toDisplayString$1(unref($t)("cronPicker.usePickerBtnText")), 1)
]),
_: 1
}, 8, ["size", "disabled"])
])
]),
_: 3
}, 8, ["trigger", "title", "size", "placement", "runType", "runTypes", "runtypeList", "disabled", "runTimes", "tabSelect", "format", "expression"])
]),
_: 3
})
])
]),
_: 3
});
};
}
});
_sfc_main$1.install = (app) => {
app.component(_sfc_main$1.name, _sfc_main$1);
return app;
};
const _hoisted_1 = { class: "label" };
const _sfc_main = /* @__PURE__ */ defineComponent({
...{
name: "dm-switch"
},
__name: "index",
props: {
modelValue: { type: Boolean, default: false },
disabled: { type: Boolean, default: false },
loading: { type: Boolean, default: false },
size: { default: "medium" },
checkedText: { default: "" },
unCheckedText: { default: "" },
colorOn: { default: "#7857fc" },
colorOff: { default: "#00000040" },
sliderColor: { default: "#fff" },
loadingParams: { default: () => ({
type: "solid",
style: "2px",
styleColor: "#ccc",
borderTopColor: "#4caf50"
}) }
},
emits: ["update:modelValue"],
setup(__props, { emit: __emit2 }) {
const props3 = __props;
const emits = __emit2;
const checkedValue = useVModel(props3, "modelValue", emits);
const sizeClass = computed(() => {
return `switch-${props3.size}`;
});
const currentStyle = computed(() => {
return {
backgroundColor: checkedValue.value ? props3.colorOn : props3.colorOff
};
});
const sliderStyle = computed(() => {
return {
backgroundColor: props3.sliderColor
};
});
const loadingStyle = computed(() => {
return {
border: `${props3.loadingParams.style} ${props3.loadingParams.type} ${props3.loadingParams.styleColor}`,
borderTopColor: `${props3.loadingParams.borderTopColor}`
};
});
const setCheckedValue = () => {
if (!props3.disabled && !props3.loading) {
checkedValue.value = !checkedValue.value;
}
};
return (_ctx, _cache) => {
return openBlock(), createElementBlock("button", {
class: normalizeClass([
"dm-switch",
sizeClass.value,
{ "switch-on": unref(checkedValue) },
{ "switch-off": !unref(checkedValue) },
{ "switch-disabled": _ctx.disabled }
]),
style: normalizeStyle(currentStyle.value),
onClick: setCheckedValue
}, [
createElementVNode("div", {
class: "slider",
style: normalizeStyle(sliderStyle.value)
}, null, 4),
createElementVNode("span", _hoisted_1, [
unref(checkedValue) && (_ctx.checkedText || _ctx.$slots.checkedText) ? renderSlot(_ctx.$slots, "checkedText", { key: 0 }, () => [
createTextVNode(toDisplayString$1(_ctx.checkedText), 1)
]) : createCommentVNode("", true),
!unref(checkedValue) && (_ctx.unCheckedText || _ctx.$slots.unCheckedText) ? renderSlot(_ctx.$slots, "unCheckedText", { key: 1 }, () => [
createTextVNode(toDisplayString$1(_ctx.unCheckedText), 1)
]) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "default")
]),
_ctx.loading ? (openBlock(), createElementBlock("div", {
key: 0,
class: "loading",
style: normalizeStyle(loadingStyle.value)
}, null, 4)) : createCommentVNode("", true)
], 6);
};
}
});
const index_vue_vue_type_style_index_0_lang = "";
_sfc_main.install = function(app) {
app.component(_sfc_main.name, _sfc_main);
return app;
};
const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
Button: Button$1,
Catalogue: _sfc_main$4,
CronPicker: _sfc_main$b,
CronTab: _sfc_main$1,
DatePicker: _sfc_main$i,
Drawer: _sfc_main$2,
Modal: _sfc_main$3,
MultipleFilter: _sfc_main$5,
PreviewCode: _sfc_main$a,
Switch: _sfc_main
}, Symbol.toStringTag, { value: "Module" }));
const defaultLoadingSvg = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBzdHlsZT0ibWFyZ2luOiBhdXRvOyBiYWNrZ3JvdW5kOiBub25lOyBkaXNwbGF5OiBibG9jazsgc2hhcGUtcmVuZGVyaW5nOiBhdXRvOyIgd2lkdGg9IjEwMHB4IiAgdmlld0JveD0iMCAwIDEwMCAzNiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPgo8Y2lyY2xlIGN4PSI4NCIgY3k9IjE4IiByPSIxMCIgZmlsbD0iI2M2YWVmZSI+CiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJyIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgZHVyPSIwLjY3NTY3NTY3NTY3NTY3NTdzIiBjYWxjTW9kZT0ic3BsaW5lIiBrZXlUaW1lcz0iMDsxIiB2YWx1ZXM9IjEwOzAiIGtleVNwbGluZXM9IjAgMC41IDAuNSAxIiBiZWdpbj0iMHMiPjwvYW5pbWF0ZT4KICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9ImZpbGwiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBkdXI9IjIuNzAyNzAyNzAyNzAyNzAyNnMiIGNhbGNNb2RlPSJkaXNjcmV0ZSIga2V5VGltZXM9IjA7MC4yNTswLjU7MC43NTsxIiB2YWx1ZXM9IiNjNmFlZmU7IzUwMzZkMDsjNzg1N2ZjOyM5NDc0ZmQ7I2M2YWVmZSIgYmVnaW49IjBzIj48L2FuaW1hdGU+CjwvY2lyY2xlPjxjaXJjbGUgY3g9IjE2IiBjeT0iMTgiIHI9IjEwIiBmaWxsPSIjYzZhZWZlIj4KICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJyIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgZHVyPSIyLjcwMjcwMjcwMjcwMjcwMjZzIiBjYWxjTW9kZT0ic3BsaW5lIiBrZXlUaW1lcz0iMDswLjI1OzAuNTswLjc1OzEiIHZhbHVlcz0iMDswOzEwOzEwOzEwIiBrZXlTcGxpbmVzPSIwIDAuNSAwLjUgMTswIDAuNSAwLjUgMTswIDAuNSAwLjUgMTswIDAuNSAwLjUgMSIgYmVnaW49IjBzIj48L2FuaW1hdGU+CiAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0iY3giIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBkdXI9IjIuNzAyNzAyNzAyNzAyNzAyNnMiIGNhbGNNb2RlPSJzcGxpbmUiIGtleVRpbWVzPSIwOzAuMjU7MC41OzAuNzU7MSIgdmFsdWVzPSIxNjsxNjsxNjs1MDs4NCIga2V5U3BsaW5lcz0iMCAwLjUgMC41IDE7MCAwLjUgMC41IDE7MCAwLjUgMC41IDE7MCAwLjUgMC41IDEiIGJlZ2luPSIwcyI+PC9hbmltYXRlPgo8L2NpcmNsZT48Y2lyY2xlIGN4PSI1MCIgY3k9IjE4IiByPSIxMCIgZmlsbD0iIzk0NzRmZCI+CiAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0iciIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIGR1cj0iMi43MDI3MDI3MDI3MDI3MDI2cyIgY2FsY01vZGU9InNwbGluZSIga2V5VGltZXM9IjA7MC4yNTswLjU7MC43NTsxIiB2YWx1ZXM9IjA7MDsxMDsxMDsxMCIga2V5U3BsaW5lcz0iMCAwLjUgMC41IDE7MCAwLjUgMC41IDE7MCAwLjUgMC41IDE7MCAwLjUgMC41IDEiIGJlZ2luPSItMC42NzU2NzU2NzU2NzU2NzU3cyI+PC9hbmltYXRlPgogIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9ImN4IiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgZHVyPSIyLjcwMjcwMjcwMjcwMjcwMjZzIiBjYWxjTW9kZT0ic3BsaW5lIiBrZXlUaW1lcz0iMDswLjI1OzAuNTswLjc1OzEiIHZhbHVlcz0iMTY7MTY7MTY7NTA7ODQiIGtleVNwbGluZXM9IjAgMC41IDAuNSAxOzAgMC41IDAuNSAxOzAgMC41IDAuNSAxOzAgMC41IDAuNSAxIiBiZWdpbj0iLTAuNjc1Njc1Njc1Njc1Njc1N3MiPjwvYW5pbWF0ZT4KPC9jaXJjbGU+PGNpcmNsZSBjeD0iODQiIGN5PSIxOCIgcj0iMTAiIGZpbGw9IiM3ODU3ZmMiPgogIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InIiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBkdXI9IjIuNzAyNzAyNzAyNzAyNzAyNnMiIGNhbGNNb2RlPSJzcGxpbmUiIGtleVRpbWVzPSIwOzAuMjU7MC41OzAuNzU7MSIgdmFsdWVzPSIwOzA7MTA7MTA7MTAiIGtleVNwbGluZXM9IjAgMC41IDAuNSAxOzAgMC41IDAuNSAxOzAgMC41IDAuNSAxOzAgMC41IDAuNSAxIiBiZWdpbj0iLTEuMzUxMzUxMzUxMzUxMzUxM3MiPjwvYW5pbWF0ZT4KICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJjeCIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIGR1cj0iMi43MDI3MDI3MDI3MDI3MDI2cyIgY2FsY01vZGU9InNwbGluZSIga2V5VGltZXM9IjA7MC4yNTswLjU7MC43NTsxIiB2YWx1ZXM9IjE2OzE2OzE2OzUwOzg0IiBrZXlTcGxpbmVzPSIwIDAuNSAwLjUgMTswIDAuNSAwLjUgMTswIDAuNSAwLjUgMTswIDAuNSAwLjUgMSIgYmVnaW49Ii0xLjM1MTM1MTM1MTM1MTM1MTNzIj48L2FuaW1hdGU+CjwvY2lyY2xlPjxjaXJjbGUgY3g9IjE2IiBjeT0iMTgiIHI9IjEwIiBmaWxsPSIjNTAzNmQwIj4KICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJyIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgZHVyPSIyLjcwMjcwMjcwMjcwMjcwMjZzIiBjYWxjTW9kZT0ic3BsaW5lIiBrZXlUaW1lcz0iMDswLjI1OzAuNTswLjc1OzEiIHZhbHVlcz0iMDswOzEwOzEwOzEwIiBrZXlTcGxpbmVzPSIwIDAuNSAwLjUgMTswIDAuNSAwLjUgMTswIDAuNSAwLjUgMTswIDAuNSAwLjUgMSIgYmVnaW49Ii0yLjAyNzAyNzAyNzAyNzAyN3MiPjwvYW5pbWF0ZT4KICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJjeCIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIGR1cj0iMi43MDI3MDI3MDI3MDI3MDI2cyIgY2FsY01vZGU9InNwbGluZSIga2V5VGltZXM9IjA7MC4yNTswLjU7MC43NTsxIiB2YWx1ZXM9IjE2OzE2OzE2OzUwOzg0IiBrZXlTcGxpbmVzPSIwIDAuNSAwLjUgMTswIDAuNSAwLjUgMTswIDAuNSAwLjUgMTswIDAuNSAwLjUgMSIgYmVnaW49Ii0yLjAyNzAyNzAyNzAyNzAyN3MiPjwvYW5pbWF0ZT4KPC9jaXJjbGU+CjwhLS0gW2xkaW9dIGdlbmVyYXRlZCBieSBodHRwczovL2xvYWRpbmcuaW8vIC0tPjwvc3ZnPg==";
const LoadingText = "";
const DmLoading = {
name: "loading",
mounted(el, binding) {
const value2 = binding.value;
if (value2) {
el.style.position = "relative";
const loadingWrapper = document.createElement("div");
loadingWrapper.className = "loading-wrapper";
const loading = document.createElement("div");
loading.className = "loading-spinner";
loadingWrapper.appendChild(loading);
let loadingText = el.getAttribute("element-loading-text");
const loadingSvg = el.getAttribute("element-loading-svg");
const loadingBackground = el.getAttribute("element-loading-background");
const loadingColor = el.getAttribute("element-loading-color");
const loadingSize = el.getAttribute("element-loading-size") || "large";
loadingText = loadingText === null || loadingText === void 0 ? LoadingText : loadingText;
if (loadingText) {
const textElement = document.createElement("div");
textElement.className = "loading-text";
textElement.textContent = loadingText;
loadingWrapper.appendChild(textElement);
}
if (loadingSvg) {
loading.innerHTML = loadingSvg;
} else {
const imgElement = document.createElement("img");
imgElement.className = `loading-svg ${loadingSize}`;
imgElement.src = defaultLoadingSvg;
loading.appendChild(imgElement);
}
if (loadingBackground) {
loadingWrapper.style.backgroundColor = loadingBackground;
}
if (loadingColor) {
loading.style.borderColor = loadingColor;
loading.style.borderTopColor = loadingColor;
}
el.appendChild(loadingWrapper);
el.dataset.loading = "true";
}
},
updated(el, binding) {
const value2 = binding.value;
const isLoading = el.dataset.loading === "true";
if (value2 && !isLoading) {
el.style.position = "relative";
const loadingWrapper = document.createElement("div");
loadingWrapper.className = "loading-wrapper";
const loading = document.createElement("div");
loading.className = "loading-spinner";
loadingWrapper.appendChild(loading);
let loadingText = el.getAttribute("element-loading-text");
const loadingSvg = el.getAttribute("element-loading-svg");
const loadingBackground = el.getAttribute("element-loading-background");
const loadingColor = el.getAttribute("element-loading-color");
const loadingSize = el.getAttribute("element-loading-size") || "large";
loadingText = loadingText === null || loadingText === void 0 ? LoadingText : loadingText;
if (loadingText) {
const textElement = document.createElement("div");
textElement.className = "loading-text";
textElement.textContent = loadingText;
loadingWrapper.appendChild(textElement);
}
if (loadingSvg) {
loading.innerHTML = loadingSvg;
} else {
const imgElement = document.createElement("img");
imgElement.className = `loading-svg ${loadingSize}`;
imgElement.src = defaultLoadingSvg;
loading.appendChild(imgElement);
}
if (loadingBackground) {
loadingWrapper.style.backgroundColor = loadingBackground;
}
if (loadingColor) {
loading.style.borderColor = loadingColor;
loading.style.borderTopColor = loadingColor;
}
el.appendChild(loadingWrapper);
el.dataset.loading = "true";
} else if (!value2 && isLoading) {
const loadingWrapper = el.querySelector(".loading-wrapper");
if (loadingWrapper) {
el.removeChild(loadingWrapper);
delete el.dataset.loading;
}
}
}
};
const styles = `
.loading-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction:column;
justify-content: center;
align-items: center;
z-index: 9999;
.loading-spinner {
.large {
width: 100px;
}
.middle {
width: 60px;
}
.small {
width: 40px;
}
}
}
/* 加载文案样式 */
.loading-text {
font-size: 12px; /* 文字大小 */
color: rgba(255, 255, 255, 0.45); /* 文字颜色 */
margin-top: 5px; /* 上边距 */
text-align: center; /* 文字居中 */
/* 添加其他样式属性以满足你的需求 */
}
`;
if (typeof window !== "undefined" && window.document) {
const styleTag = document.createElement("style");
styleTag.textContent = styles;
document.head.appendChild(styleTag);
}
const DmLoading$1 = DmLoading;
const directives = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
DmLoading: DmLoading$1
}, Symbol.toStringTag, { value: "Module" }));
const install3 = (app) => {
Object.keys(components).forEach((key2) => {
const component = components[key2];
if (component.install) {
app.use(component);
}
});
Object.keys(directives).forEach((key2) => {
const directive = directives[key2];
app.directive(directive.name, directive);
});
return app;
};
const index = {
install: install3
};
export {
Button$1 as Button,
_sfc_main$4 as Catalogue,
_sfc_main$b as CronPicker,
_sfc_main$1 as CronTab,
_sfc_main$i as DatePicker,
DmLoading$1 as DmLoading,
_sfc_main$2 as Drawer,
_sfc_main$3 as Modal,
_sfc_main$5 as MultipleFilter,
_sfc_main$a as PreviewCode,
_sfc_main as Switch,
index as default
};