@vue-js-cron/prime
Version:
Cron editor for PrimeVue
1,175 lines (1,174 loc) • 44.1 kB
JavaScript
import { selectProps as ct, setupSelect as dt, setupCron as ut, cronCoreProps as ft } from "@vue-js-cron/core";
import ht from "primevue/button";
import { usePrimeVue as pt } from "primevue/config";
import mt from "primevue/listbox";
import { ConnectedOverlayScrollHandler as vt } from "@primevue/core/utils";
import yt from "primevue/focustrap";
import re from "primevue/overlayeventbus";
import gt from "primevue/portal";
import bt from "@primevue/core/basedirective";
import St from "primevue/ripple/style";
import kt from "@primevue/core/basecomponent";
import _t from "primevue/popover/style";
import { resolveComponent as V, resolveDirective as wt, openBlock as g, createBlock as Lt, withCtx as oe, createVNode as T, Transition as Ct, mergeProps as I, withDirectives as Ae, createElementBlock as k, renderSlot as we, createCommentVNode as ue, defineComponent as Ne, ref as Ot, vShow as Et, createTextVNode as x, toDisplayString as P, withModifiers as $t, Fragment as K, renderList as fe, normalizeClass as Rt } from "vue";
function ye(e) {
return e == null || e === "" || Array.isArray(e) && e.length === 0 || !(e instanceof Date) && typeof e == "object" && Object.keys(e).length === 0;
}
function xt(e) {
return !!(e && e.constructor && e.call && e.apply);
}
function m(e) {
return !ye(e);
}
function z(e, t = !0) {
return e instanceof Object && e.constructor === Object && (t || Object.keys(e).length !== 0);
}
function ie(e, ...t) {
return xt(e) ? e(...t) : e;
}
function A(e, t = !0) {
return typeof e == "string" && (t || e !== "");
}
function De(e, t = !0) {
return Array.isArray(e) && (t || e.length !== 0);
}
function Pt(e) {
return m(e) && !isNaN(e);
}
function O(e, t) {
if (t) {
const n = t.test(e);
return t.lastIndex = 0, n;
}
return !1;
}
function Le(e) {
return e && e.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " ").replace(/ ([{:}]) /g, "$1").replace(/([;,]) /g, "$1").replace(/ !/g, "!").replace(/: /g, ":");
}
function je(e) {
return A(e) ? e.replace(/(_)/g, "-").replace(/[A-Z]/g, (t, n) => n === 0 ? t : "-" + t.toLowerCase()).toLowerCase() : e;
}
function Ce(e) {
return A(e) ? e.replace(/[A-Z]/g, (t, n) => n === 0 ? t : "." + t.toLowerCase()).toLowerCase() : e;
}
function Tt() {
const e = /* @__PURE__ */ new Map();
return {
on(t, n) {
let s = e.get(t);
return s ? s.push(n) : s = [n], e.set(t, s), this;
},
off(t, n) {
let s = e.get(t);
return s && s.splice(s.indexOf(n) >>> 0, 1), this;
},
emit(t, n) {
let s = e.get(t);
s && s.slice().map((r) => {
r(n);
});
},
clear() {
e.clear();
}
};
}
var At = Object.defineProperty, Nt = Object.defineProperties, Dt = Object.getOwnPropertyDescriptors, le = Object.getOwnPropertySymbols, Ve = Object.prototype.hasOwnProperty, Ie = Object.prototype.propertyIsEnumerable, Oe = (e, t, n) => t in e ? At(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, L = (e, t) => {
for (var n in t || (t = {}))
Ve.call(t, n) && Oe(e, n, t[n]);
if (le)
for (var n of le(t))
Ie.call(t, n) && Oe(e, n, t[n]);
return e;
}, ae = (e, t) => Nt(e, Dt(t)), C = (e, t) => {
var n = {};
for (var s in e)
Ve.call(e, s) && t.indexOf(s) < 0 && (n[s] = e[s]);
if (e != null && le)
for (var s of le(e))
t.indexOf(s) < 0 && Ie.call(e, s) && (n[s] = e[s]);
return n;
}, jt = Tt(), $ = jt;
function Ee(e, t) {
De(e) ? e.push(...t || []) : z(e) && Object.assign(e, t);
}
function Vt(e) {
return z(e) && e.hasOwnProperty("value") && e.hasOwnProperty("type") ? e.value : e;
}
function It(e) {
return e.replaceAll(/ /g, "").replace(/[^\w]/g, "-");
}
function he(e = "", t = "") {
return It(`${A(e, !1) && A(t, !1) ? `${e}-` : e}${t}`);
}
function Ke(e = "", t = "") {
return `--${he(e, t)}`;
}
function ze(e, t = "", n = "", s = [], r) {
if (A(e)) {
const i = /{([^}]*)}/g, o = e.trim();
if (O(o, i)) {
const l = o.replaceAll(i, (d) => {
const u = d.replace(/{|}/g, "").split(".").filter((h) => !s.some((p) => O(h, p)));
return `var(${Ke(n, je(u.join("-")))}${m(r) ? `, ${r}` : ""})`;
}), a = /(\d+\s+[\+\-\*\/]\s+\d+)/g, c = /var\([^)]+\)/g;
return O(l.replace(c, "0"), a) ? `calc(${l})` : l;
}
return o;
} else if (Pt(e))
return e;
}
function Kt(e, t, n) {
A(t, !1) && e.push(`${t}:${n};`);
}
function R(e, t) {
return e ? `${e}{${t}}` : "";
}
var zt = (e) => {
var t;
const n = B.getTheme(), s = pe(n, e, void 0, "variable"), r = (t = s == null ? void 0 : s.match(/--[\w-]+/g)) == null ? void 0 : t[0], i = pe(n, e, void 0, "value");
return {
name: r,
variable: s,
value: i
};
}, $e = (...e) => pe(B.getTheme(), ...e), pe = (e = {}, t, n, s) => {
if (t) {
const { variable: r, options: i } = B.defaults || {}, { prefix: o, transform: l } = (e == null ? void 0 : e.options) || i || {}, c = O(t, /{([^}]*)}/g) ? t : `{${t}}`;
return s === "value" || ye(s) && l === "strict" ? B.getTokenValue(t) : ze(c, void 0, o, [r.excludedKeyRegex], n);
}
return "";
};
function Bt(e, t = {}) {
const n = B.defaults.variable, { prefix: s = n.prefix, selector: r = n.selector, excludedKeyRegex: i = n.excludedKeyRegex } = t, o = (c, d = "") => Object.entries(c).reduce(
(f, [u, h]) => {
const p = O(u, i) ? he(d) : he(d, je(u)), y = Vt(h);
if (z(y)) {
const { variables: v, tokens: b } = o(y, p);
Ee(f.tokens, b), Ee(f.variables, v);
} else
f.tokens.push((s ? p.replace(`${s}-`, "") : p).replaceAll("-", ".")), Kt(f.variables, Ke(p), ze(y, p, s, [i]));
return f;
},
{ variables: [], tokens: [] }
), { variables: l, tokens: a } = o(e, s);
return {
value: l,
tokens: a,
declarations: l.join(""),
css: R(r, l.join(""))
};
}
var w = {
regex: {
rules: {
class: {
pattern: /^\.([a-zA-Z][\w-]*)$/,
resolve(e) {
return { type: "class", selector: e, matched: this.pattern.test(e.trim()) };
}
},
attr: {
pattern: /^\[(.*)\]$/,
resolve(e) {
return { type: "attr", selector: `:root${e}`, matched: this.pattern.test(e.trim()) };
}
},
media: {
pattern: /^ (.*)$/,
resolve(e) {
return { type: "media", selector: `${e}{:root{[CSS]}}`, matched: this.pattern.test(e.trim()) };
}
},
system: {
pattern: /^system$/,
resolve(e) {
return { type: "system", selector: "@media (prefers-color-scheme: dark){:root{[CSS]}}", matched: this.pattern.test(e.trim()) };
}
},
custom: {
resolve(e) {
return { type: "custom", selector: e, matched: !0 };
}
}
},
resolve(e) {
const t = Object.keys(this.rules).filter((n) => n !== "custom").map((n) => this.rules[n]);
return [e].flat().map((n) => {
var s;
return (s = t.map((r) => r.resolve(n)).find((r) => r.matched)) != null ? s : this.rules.custom.resolve(n);
});
}
},
_toVariables(e, t) {
return Bt(e, { prefix: t == null ? void 0 : t.prefix });
},
getCommon({ name: e = "", theme: t = {}, params: n, set: s, defaults: r }) {
var i, o, l, a, c, d, f;
const { preset: u, options: h } = t;
let p, y, v, b, S, E, _;
if (m(u) && h.transform !== "strict") {
const { primitive: W, semantic: Z, extend: U } = u, N = Z || {}, { colorScheme: F } = N, M = C(N, ["colorScheme"]), X = U || {}, { colorScheme: Y } = X, D = C(X, ["colorScheme"]), j = F || {}, { dark: q } = j, G = C(j, ["dark"]), J = Y || {}, { dark: Q } = J, ee = C(J, ["dark"]), te = m(W) ? this._toVariables({ primitive: W }, h) : {}, ne = m(M) ? this._toVariables({ semantic: M }, h) : {}, se = m(G) ? this._toVariables({ light: G }, h) : {}, be = m(q) ? this._toVariables({ dark: q }, h) : {}, Se = m(D) ? this._toVariables({ semantic: D }, h) : {}, ke = m(ee) ? this._toVariables({ light: ee }, h) : {}, _e = m(Q) ? this._toVariables({ dark: Q }, h) : {}, [Ue, Fe] = [(i = te.declarations) != null ? i : "", te.tokens], [Me, Xe] = [(o = ne.declarations) != null ? o : "", ne.tokens || []], [Ye, qe] = [(l = se.declarations) != null ? l : "", se.tokens || []], [Ge, Je] = [(a = be.declarations) != null ? a : "", be.tokens || []], [Qe, et] = [(c = Se.declarations) != null ? c : "", Se.tokens || []], [tt, nt] = [(d = ke.declarations) != null ? d : "", ke.tokens || []], [st, rt] = [(f = _e.declarations) != null ? f : "", _e.tokens || []];
p = this.transformCSS(e, Ue, "light", "variable", h, s, r), y = Fe;
const it = this.transformCSS(e, `${Me}${Ye}`, "light", "variable", h, s, r), ot = this.transformCSS(e, `${Ge}`, "dark", "variable", h, s, r);
v = `${it}${ot}`, b = [.../* @__PURE__ */ new Set([...Xe, ...qe, ...Je])];
const lt = this.transformCSS(e, `${Qe}${tt}color-scheme:light`, "light", "variable", h, s, r), at = this.transformCSS(e, `${st}color-scheme:dark`, "dark", "variable", h, s, r);
S = `${lt}${at}`, E = [.../* @__PURE__ */ new Set([...et, ...nt, ...rt])], _ = ie(u.css, { dt: $e });
}
return {
primitive: {
css: p,
tokens: y
},
semantic: {
css: v,
tokens: b
},
global: {
css: S,
tokens: E
},
style: _
};
},
getPreset({ name: e = "", preset: t = {}, options: n, params: s, set: r, defaults: i, selector: o }) {
var l, a, c;
let d, f, u;
if (m(t) && n.transform !== "strict") {
const h = e.replace("-directive", ""), p = t, { colorScheme: y, extend: v, css: b } = p, S = C(p, ["colorScheme", "extend", "css"]), E = v || {}, { colorScheme: _ } = E, W = C(E, ["colorScheme"]), Z = y || {}, { dark: U } = Z, N = C(Z, ["dark"]), F = _ || {}, { dark: M } = F, X = C(F, ["dark"]), Y = m(S) ? this._toVariables({ [h]: L(L({}, S), W) }, n) : {}, D = m(N) ? this._toVariables({ [h]: L(L({}, N), X) }, n) : {}, j = m(U) ? this._toVariables({ [h]: L(L({}, U), M) }, n) : {}, [q, G] = [(l = Y.declarations) != null ? l : "", Y.tokens || []], [J, Q] = [(a = D.declarations) != null ? a : "", D.tokens || []], [ee, te] = [(c = j.declarations) != null ? c : "", j.tokens || []], ne = this.transformCSS(h, `${q}${J}`, "light", "variable", n, r, i, o), se = this.transformCSS(h, ee, "dark", "variable", n, r, i, o);
d = `${ne}${se}`, f = [.../* @__PURE__ */ new Set([...G, ...Q, ...te])], u = ie(b, { dt: $e });
}
return {
css: d,
tokens: f,
style: u
};
},
getPresetC({ name: e = "", theme: t = {}, params: n, set: s, defaults: r }) {
var i;
const { preset: o, options: l } = t, a = (i = o == null ? void 0 : o.components) == null ? void 0 : i[e];
return this.getPreset({ name: e, preset: a, options: l, params: n, set: s, defaults: r });
},
getPresetD({ name: e = "", theme: t = {}, params: n, set: s, defaults: r }) {
var i;
const o = e.replace("-directive", ""), { preset: l, options: a } = t, c = (i = l == null ? void 0 : l.directives) == null ? void 0 : i[o];
return this.getPreset({ name: o, preset: c, options: a, params: n, set: s, defaults: r });
},
applyDarkColorScheme(e) {
return !(e.darkModeSelector === "none" || e.darkModeSelector === !1);
},
getColorSchemeOption(e, t) {
var n;
return this.applyDarkColorScheme(e) ? this.regex.resolve(e.darkModeSelector === !0 ? t.options.darkModeSelector : (n = e.darkModeSelector) != null ? n : t.options.darkModeSelector) : [];
},
getLayerOrder(e, t = {}, n, s) {
const { cssLayer: r } = t;
return r ? ` ${ie(r.order || "primeui", n)}` : "";
},
getCommonStyleSheet({ name: e = "", theme: t = {}, params: n, props: s = {}, set: r, defaults: i }) {
const o = this.getCommon({ name: e, theme: t, params: n, set: r, defaults: i }), l = Object.entries(s).reduce((a, [c, d]) => a.push(`${c}="${d}"`) && a, []).join(" ");
return Object.entries(o || {}).reduce((a, [c, d]) => {
if (d != null && d.css) {
const f = Le(d == null ? void 0 : d.css), u = `${c}-variables`;
a.push(`<style type="text/css" data-primevue-style-id="${u}" ${l}>${f}</style>`);
}
return a;
}, []).join("");
},
getStyleSheet({ name: e = "", theme: t = {}, params: n, props: s = {}, set: r, defaults: i }) {
var o;
const l = { name: e, theme: t, params: n, set: r, defaults: i }, a = (o = e.includes("-directive") ? this.getPresetD(l) : this.getPresetC(l)) == null ? void 0 : o.css, c = Object.entries(s).reduce((d, [f, u]) => d.push(`${f}="${u}"`) && d, []).join(" ");
return a ? `<style type="text/css" data-primevue-style-id="${e}-variables" ${c}>${Le(a)}</style>` : "";
},
createTokens(e = {}, t, n = "", s = "", r = {}) {
return Object.entries(e).forEach(([i, o]) => {
const l = O(i, t.variable.excludedKeyRegex) ? n : n ? `${n}.${Ce(i)}` : Ce(i), a = s ? `${s}.${i}` : i;
z(o) ? this.createTokens(o, t, l, a, r) : (r[l] || (r[l] = {
paths: [],
computed(c, d = {}) {
var f, u;
return this.paths.length === 1 ? (f = this.paths[0]) == null ? void 0 : f.computed(this.paths[0].scheme, d.binding) : c && c !== "none" ? (u = this.paths.find((h) => h.scheme === c)) == null ? void 0 : u.computed(c, d.binding) : this.paths.map((h) => h.computed(h.scheme, d[h.scheme]));
}
}), r[l].paths.push({
path: a,
value: o,
scheme: a.includes("colorScheme.light") ? "light" : a.includes("colorScheme.dark") ? "dark" : "none",
computed(c, d = {}) {
const f = /{([^}]*)}/g;
let u = o;
if (d.name = this.path, d.binding || (d.binding = {}), O(o, f)) {
const p = o.trim().replaceAll(f, (b) => {
var S;
const E = b.replace(/{|}/g, ""), _ = (S = r[E]) == null ? void 0 : S.computed(c, d);
return De(_) && _.length === 2 ? `light-dark(${_[0].value},${_[1].value})` : _ == null ? void 0 : _.value;
}), y = /(\d+\w*\s+[\+\-\*\/]\s+\d+\w*)/g, v = /var\([^)]+\)/g;
u = O(p.replace(v, "0"), y) ? `calc(${p})` : p;
}
return ye(d.binding) && delete d.binding, {
colorScheme: c,
path: this.path,
paths: d,
value: u.includes("undefined") ? void 0 : u
};
}
}));
}), r;
},
getTokenValue(e, t, n) {
var s;
const i = ((a) => a.split(".").filter((d) => !O(d.toLowerCase(), n.variable.excludedKeyRegex)).join("."))(t), o = t.includes("colorScheme.light") ? "light" : t.includes("colorScheme.dark") ? "dark" : void 0, l = [(s = e[i]) == null ? void 0 : s.computed(o)].flat().filter((a) => a);
return l.length === 1 ? l[0].value : l.reduce((a = {}, c) => {
const d = c, { colorScheme: f } = d, u = C(d, ["colorScheme"]);
return a[f] = u, a;
}, void 0);
},
getSelectorRule(e, t, n, s) {
return n === "class" || n === "attr" ? R(m(t) ? `${e}${t},${e} ${t}` : e, s) : R(e, m(t) ? R(t, s) : s);
},
transformCSS(e, t, n, s, r = {}, i, o, l) {
if (m(t)) {
const { cssLayer: a } = r;
if (s !== "style") {
const c = this.getColorSchemeOption(r, o);
t = n === "dark" ? c.reduce((d, { type: f, selector: u }) => (m(u) && (d += u.includes("[CSS]") ? u.replace("[CSS]", t) : this.getSelectorRule(u, l, f, t)), d), "") : R(l ?? ":root", t);
}
if (a) {
const c = {
name: "primeui",
order: "primeui"
};
z(a) && (c.name = ie(a.name, { name: e, type: s })), m(c.name) && (t = R(` ${c.name}`, t), i == null || i.layerNames(c.name));
}
return t;
}
return "";
}
}, B = {
defaults: {
variable: {
prefix: "p",
selector: ":root",
excludedKeyRegex: /^(primitive|semantic|components|directives|variables|colorscheme|light|dark|common|root|states|extend|css)$/gi
},
options: {
prefix: "p",
darkModeSelector: "system",
cssLayer: !1
}
},
_theme: void 0,
_layerNames: /* @__PURE__ */ new Set(),
_loadedStyleNames: /* @__PURE__ */ new Set(),
_loadingStyles: /* @__PURE__ */ new Set(),
_tokens: {},
update(e = {}) {
const { theme: t } = e;
t && (this._theme = ae(L({}, t), {
options: L(L({}, this.defaults.options), t.options)
}), this._tokens = w.createTokens(this.preset, this.defaults), this.clearLoadedStyleNames());
},
get theme() {
return this._theme;
},
get preset() {
var e;
return ((e = this.theme) == null ? void 0 : e.preset) || {};
},
get options() {
var e;
return ((e = this.theme) == null ? void 0 : e.options) || {};
},
get tokens() {
return this._tokens;
},
getTheme() {
return this.theme;
},
setTheme(e) {
this.update({ theme: e }), $.emit("theme:change", e);
},
getPreset() {
return this.preset;
},
setPreset(e) {
this._theme = ae(L({}, this.theme), { preset: e }), this._tokens = w.createTokens(e, this.defaults), this.clearLoadedStyleNames(), $.emit("preset:change", e), $.emit("theme:change", this.theme);
},
getOptions() {
return this.options;
},
setOptions(e) {
this._theme = ae(L({}, this.theme), { options: e }), this.clearLoadedStyleNames(), $.emit("options:change", e), $.emit("theme:change", this.theme);
},
getLayerNames() {
return [...this._layerNames];
},
setLayerNames(e) {
this._layerNames.add(e);
},
getLoadedStyleNames() {
return this._loadedStyleNames;
},
isStyleNameLoaded(e) {
return this._loadedStyleNames.has(e);
},
setLoadedStyleName(e) {
this._loadedStyleNames.add(e);
},
deleteLoadedStyleName(e) {
this._loadedStyleNames.delete(e);
},
clearLoadedStyleNames() {
this._loadedStyleNames.clear();
},
getTokenValue(e) {
return w.getTokenValue(this.tokens, e, this.defaults);
},
getCommon(e = "", t) {
return w.getCommon({ name: e, theme: this.theme, params: t, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } });
},
getComponent(e = "", t) {
const n = { name: e, theme: this.theme, params: t, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } };
return w.getPresetC(n);
},
getDirective(e = "", t) {
const n = { name: e, theme: this.theme, params: t, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } };
return w.getPresetD(n);
},
getCustomPreset(e = "", t, n, s) {
const r = { name: e, preset: t, options: this.options, selector: n, params: s, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } };
return w.getPreset(r);
},
getLayerOrderCSS(e = "") {
return w.getLayerOrder(e, this.options, { names: this.getLayerNames() }, this.defaults);
},
transformCSS(e = "", t, n = "style", s) {
return w.transformCSS(e, t, s, n, this.options, { layerNames: this.setLayerNames.bind(this) }, this.defaults);
},
getCommonStyleSheet(e = "", t, n = {}) {
return w.getCommonStyleSheet({ name: e, theme: this.theme, params: t, props: n, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } });
},
getStyleSheet(e, t, n = {}) {
return w.getStyleSheet({ name: e, theme: this.theme, params: t, props: n, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } });
},
onStyleMounted(e) {
this._loadingStyles.add(e);
},
onStyleUpdated(e) {
this._loadingStyles.add(e);
},
onStyleLoaded(e, { name: t }) {
this._loadingStyles.size && (this._loadingStyles.delete(t), $.emit(`theme:${t}:load`, e), !this._loadingStyles.size && $.emit("theme:load"));
}
};
function Ht(e, t) {
return e ? e.classList ? e.classList.contains(t) : new RegExp("(^| )" + t + "( |$)", "gi").test(e.className) : !1;
}
function Be(e, t) {
if (e && t) {
const n = (s) => {
Ht(e, s) || (e.classList ? e.classList.add(s) : e.className += " " + s);
};
[t].flat().filter(Boolean).forEach((s) => s.split(" ").forEach(n));
}
}
function Re(e) {
for (const t of document == null ? void 0 : document.styleSheets)
try {
for (const n of t == null ? void 0 : t.cssRules)
for (const s of n == null ? void 0 : n.style)
if (e.test(s))
return { name: s, value: n.style.getPropertyValue(s).trim() };
} catch {
}
return null;
}
function ce(e, t) {
if (e && t) {
const n = (s) => {
e.classList ? e.classList.remove(s) : e.className = e.className.replace(new RegExp("(^|\\b)" + s.split(" ").join("|") + "(\\b|$)", "gi"), " ");
};
[t].flat().filter(Boolean).forEach((s) => s.split(" ").forEach(n));
}
}
function Wt(e) {
let t = { width: 0, height: 0 };
return e && (e.style.visibility = "hidden", e.style.display = "block", t.width = e.offsetWidth, t.height = e.offsetHeight, e.style.display = "none", e.style.visibility = "visible"), t;
}
function Zt() {
let e = window, t = document, n = t.documentElement, s = t.getElementsByTagName("body")[0], r = e.innerWidth || n.clientWidth || s.clientWidth, i = e.innerHeight || n.clientHeight || s.clientHeight;
return { width: r, height: i };
}
function Ut() {
let e = document.documentElement;
return (window.pageXOffset || e.scrollLeft) - (e.clientLeft || 0);
}
function Ft() {
let e = document.documentElement;
return (window.pageYOffset || e.scrollTop) - (e.clientTop || 0);
}
function Mt(e, t, n = !0) {
var s, r, i, o;
if (e) {
const l = e.offsetParent ? { width: e.offsetWidth, height: e.offsetHeight } : Wt(e), a = l.height, c = l.width, d = t.offsetHeight, f = t.offsetWidth, u = t.getBoundingClientRect(), h = Ft(), p = Ut(), y = Zt();
let v, b, S = "top";
u.top + d + a > y.height ? (v = u.top + h - a, S = "bottom", v < 0 && (v = h)) : v = d + u.top + h, u.left + c > y.width ? b = Math.max(0, u.left + p + f - c) : b = u.left + p, e.style.top = v + "px", e.style.left = b + "px", e.style.transformOrigin = S, n && (e.style.marginTop = S === "bottom" ? `calc(${(r = (s = Re(/-anchor-gutter$/)) == null ? void 0 : s.value) != null ? r : "2px"} * -1)` : (o = (i = Re(/-anchor-gutter$/)) == null ? void 0 : i.value) != null ? o : "");
}
}
function Xt(e, t) {
e && (typeof t == "string" ? e.style.cssText = t : Object.entries(t || {}).forEach(([n, s]) => e.style[n] = s));
}
function Yt(e, t) {
if (e instanceof HTMLElement) {
let n = e.offsetWidth;
if (t) {
let s = getComputedStyle(e);
n += parseFloat(s.marginLeft) + parseFloat(s.marginRight);
}
return n;
}
return 0;
}
function ge(e) {
return typeof HTMLElement == "object" ? e instanceof HTMLElement : e && typeof e == "object" && e !== null && e.nodeType === 1 && typeof e.nodeName == "string";
}
function He(e, t = {}) {
if (ge(e)) {
const n = (s, r) => {
var i, o;
const l = (i = e == null ? void 0 : e.$attrs) != null && i[s] ? [(o = e == null ? void 0 : e.$attrs) == null ? void 0 : o[s]] : [];
return [r].flat().reduce((a, c) => {
if (c != null) {
const d = typeof c;
if (d === "string" || d === "number")
a.push(c);
else if (d === "object") {
const f = Array.isArray(c) ? n(s, c) : Object.entries(c).map(([u, h]) => s === "style" && (h || h === 0) ? `${u.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()}:${h}` : h ? u : void 0);
a = f.length ? a.concat(f.filter((u) => !!u)) : a;
}
}
return a;
}, l);
};
Object.entries(t).forEach(([s, r]) => {
if (r != null) {
const i = s.match(/^on(.+)/);
i ? e.addEventListener(i[1].toLowerCase(), r) : s === "p-bind" ? He(e, r) : (r = s === "class" ? [...new Set(n("class", r))].join(" ").trim() : s === "style" ? n("style", r).join(";").trim() : r, (e.$attrs = e.$attrs || {}) && (e.$attrs[s] = r), e.setAttribute(s, r));
}
});
}
}
function qt(e, t = {}, ...n) {
if (e) {
const s = document.createElement(e);
return He(s, t), s.append(...n), s;
}
}
function Gt(e, t) {
e && document.activeElement !== e && e.focus(t);
}
function Jt(e, t) {
if (ge(e)) {
const n = e.getAttribute(t);
return isNaN(n) ? n === "true" || n === "false" ? n === "true" : n : +n;
}
}
function xe(e) {
if (e) {
let t = e.offsetHeight, n = getComputedStyle(e);
return t -= parseFloat(n.paddingTop) + parseFloat(n.paddingBottom) + parseFloat(n.borderTopWidth) + parseFloat(n.borderBottomWidth), t;
}
return 0;
}
function me(e) {
if (e) {
let t = e.getBoundingClientRect();
return {
top: t.top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0),
left: t.left + (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0)
};
}
return {
top: "auto",
left: "auto"
};
}
function Qt(e, t) {
if (e) {
let n = e.offsetHeight;
if (t) {
let s = getComputedStyle(e);
n += parseFloat(s.marginTop) + parseFloat(s.marginBottom);
}
return n;
}
return 0;
}
function Pe(e) {
if (e) {
let t = e.offsetWidth, n = getComputedStyle(e);
return t -= parseFloat(n.paddingLeft) + parseFloat(n.paddingRight) + parseFloat(n.borderLeftWidth) + parseFloat(n.borderRightWidth), t;
}
return 0;
}
function en() {
return !!(typeof window < "u" && window.document && window.document.createElement);
}
function tn() {
return "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
}
function nn(e, t = "", n) {
ge(e) && n !== null && n !== void 0 && e.setAttribute(t, n);
}
function sn() {
let e = [];
const t = (o, l, a = 999) => {
const c = r(o, l, a), d = c.value + (c.key === o ? 0 : a) + 1;
return e.push({ key: o, value: d }), d;
}, n = (o) => {
e = e.filter((l) => l.value !== o);
}, s = (o, l) => r(o, l).value, r = (o, l, a = 0) => [...e].reverse().find((c) => l ? !0 : c.key === o) || { key: o, value: a }, i = (o) => o && parseInt(o.style.zIndex, 10) || 0;
return {
get: i,
set: (o, l, a) => {
l && (l.style.zIndex = String(t(o, !0, a)));
},
clear: (o) => {
o && (n(i(o)), o.style.zIndex = "");
},
getCurrent: (o) => s(o, !0)
};
}
var de = sn(), rn = bt.extend({
style: St
});
function H(e) {
"@babel/helpers - typeof";
return H = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
return typeof t;
} : function(t) {
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
}, H(e);
}
function on(e) {
return dn(e) || cn(e) || an(e) || ln();
}
function ln() {
throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function an(e, t) {
if (e) {
if (typeof e == "string")
return ve(e, t);
var n = {}.toString.call(e).slice(8, -1);
return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? ve(e, t) : void 0;
}
}
function cn(e) {
if (typeof Symbol < "u" && e[Symbol.iterator] != null || e["@@iterator"] != null)
return Array.from(e);
}
function dn(e) {
if (Array.isArray(e))
return ve(e);
}
function ve(e, t) {
(t == null || t > e.length) && (t = e.length);
for (var n = 0, s = Array(t); n < t; n++)
s[n] = e[n];
return s;
}
function Te(e, t, n) {
return (t = un(t)) in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
}
function un(e) {
var t = fn(e, "string");
return H(t) == "symbol" ? t : t + "";
}
function fn(e, t) {
if (H(e) != "object" || !e)
return e;
var n = e[Symbol.toPrimitive];
if (n !== void 0) {
var s = n.call(e, t || "default");
if (H(s) != "object")
return s;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (t === "string" ? String : Number)(e);
}
var hn = rn.extend("ripple", {
watch: {
"config.ripple": function(t) {
t ? (this.createRipple(this.$host), this.bindEvents(this.$host), this.$host.setAttribute("data-pd-ripple", !0), this.$host.style.overflow = "hidden", this.$host.style.position = "relative") : (this.remove(this.$host), this.$host.removeAttribute("data-pd-ripple"));
}
},
unmounted: function(t) {
this.remove(t);
},
timeout: void 0,
methods: {
bindEvents: function(t) {
t.addEventListener("mousedown", this.onMouseDown.bind(this));
},
unbindEvents: function(t) {
t.removeEventListener("mousedown", this.onMouseDown.bind(this));
},
createRipple: function(t) {
var n = qt("span", Te(Te({
role: "presentation",
"aria-hidden": !0,
"data-p-ink": !0,
"data-p-ink-active": !1,
class: !this.isUnstyled() && this.cx("root"),
onAnimationEnd: this.onAnimationEnd.bind(this)
}, this.$attrSelector, ""), "p-bind", this.ptm("root")));
t.appendChild(n), this.$el = n;
},
remove: function(t) {
var n = this.getInk(t);
n && (this.$host.style.overflow = "", this.$host.style.position = "", this.unbindEvents(t), n.removeEventListener("animationend", this.onAnimationEnd), n.remove());
},
onMouseDown: function(t) {
var n = this, s = t.currentTarget, r = this.getInk(s);
if (!(!r || getComputedStyle(r, null).display === "none")) {
if (!this.isUnstyled() && ce(r, "p-ink-active"), r.setAttribute("data-p-ink-active", "false"), !xe(r) && !Pe(r)) {
var i = Math.max(Yt(s), Qt(s));
r.style.height = i + "px", r.style.width = i + "px";
}
var o = me(s), l = t.pageX - o.left + document.body.scrollTop - Pe(r) / 2, a = t.pageY - o.top + document.body.scrollLeft - xe(r) / 2;
r.style.top = a + "px", r.style.left = l + "px", !this.isUnstyled() && Be(r, "p-ink-active"), r.setAttribute("data-p-ink-active", "true"), this.timeout = setTimeout(function() {
r && (!n.isUnstyled() && ce(r, "p-ink-active"), r.setAttribute("data-p-ink-active", "false"));
}, 401);
}
},
onAnimationEnd: function(t) {
this.timeout && clearTimeout(this.timeout), !this.isUnstyled() && ce(t.currentTarget, "p-ink-active"), t.currentTarget.setAttribute("data-p-ink-active", "false");
},
getInk: function(t) {
return t && t.children ? on(t.children).find(function(n) {
return Jt(n, "data-pc-name") === "ripple";
}) : void 0;
}
}
}), pn = {
name: "BasePopover",
extends: kt,
props: {
dismissable: {
type: Boolean,
default: !0
},
appendTo: {
type: [String, Object],
default: "body"
},
baseZIndex: {
type: Number,
default: 0
},
autoZIndex: {
type: Boolean,
default: !0
},
breakpoints: {
type: Object,
default: null
},
closeOnEscape: {
type: Boolean,
default: !0
}
},
style: _t,
provide: function() {
return {
$pcPopover: this,
$parentInstance: this
};
}
}, We = {
name: "Popover",
extends: pn,
inheritAttrs: !1,
emits: ["show", "hide"],
data: function() {
return {
visible: !1
};
},
watch: {
dismissable: {
immediate: !0,
handler: function(t) {
t ? this.bindOutsideClickListener() : this.unbindOutsideClickListener();
}
}
},
selfClick: !1,
target: null,
eventTarget: null,
outsideClickListener: null,
scrollHandler: null,
resizeListener: null,
container: null,
styleElement: null,
overlayEventListener: null,
documentKeydownListener: null,
beforeUnmount: function() {
this.dismissable && this.unbindOutsideClickListener(), this.scrollHandler && (this.scrollHandler.destroy(), this.scrollHandler = null), this.destroyStyle(), this.unbindResizeListener(), this.target = null, this.container && this.autoZIndex && de.clear(this.container), this.overlayEventListener && (re.off("overlay-click", this.overlayEventListener), this.overlayEventListener = null), this.container = null;
},
mounted: function() {
this.breakpoints && this.createStyle();
},
methods: {
toggle: function(t, n) {
this.visible ? this.hide() : this.show(t, n);
},
show: function(t, n) {
this.visible = !0, this.eventTarget = t.currentTarget, this.target = n || t.currentTarget;
},
hide: function() {
this.visible = !1;
},
onContentClick: function() {
this.selfClick = !0;
},
onEnter: function(t) {
var n = this;
Xt(t, {
position: "absolute",
top: "0",
left: "0"
}), this.alignOverlay(), this.dismissable && this.bindOutsideClickListener(), this.bindScrollListener(), this.bindResizeListener(), this.autoZIndex && de.set("overlay", t, this.baseZIndex + this.$primevue.config.zIndex.overlay), this.overlayEventListener = function(s) {
n.container.contains(s.target) && (n.selfClick = !0);
}, this.focus(), re.on("overlay-click", this.overlayEventListener), this.$emit("show"), this.closeOnEscape && this.bindDocumentKeyDownListener();
},
onLeave: function() {
this.unbindOutsideClickListener(), this.unbindScrollListener(), this.unbindResizeListener(), this.unbindDocumentKeyDownListener(), re.off("overlay-click", this.overlayEventListener), this.overlayEventListener = null, this.$emit("hide");
},
onAfterLeave: function(t) {
this.autoZIndex && de.clear(t);
},
alignOverlay: function() {
Mt(this.container, this.target, !1);
var t = me(this.container), n = me(this.target), s = 0;
t.left < n.left && (s = n.left - t.left), this.container.style.setProperty(zt("popover.arrow.left").name, "".concat(s, "px")), t.top < n.top && (this.container.setAttribute("data-p-popover-flipped", "true"), !this.isUnstyled && Be(this.container, "p-popover-flipped"));
},
onContentKeydown: function(t) {
t.code === "Escape" && this.closeOnEscape && (this.hide(), Gt(this.target));
},
onButtonKeydown: function(t) {
switch (t.code) {
case "ArrowDown":
case "ArrowUp":
case "ArrowLeft":
case "ArrowRight":
t.preventDefault();
}
},
focus: function() {
var t = this.container.querySelector("[autofocus]");
t && t.focus();
},
onKeyDown: function(t) {
t.code === "Escape" && this.closeOnEscape && (this.visible = !1);
},
bindDocumentKeyDownListener: function() {
this.documentKeydownListener || (this.documentKeydownListener = this.onKeyDown.bind(this), window.document.addEventListener("keydown", this.documentKeydownListener));
},
unbindDocumentKeyDownListener: function() {
this.documentKeydownListener && (window.document.removeEventListener("keydown", this.documentKeydownListener), this.documentKeydownListener = null);
},
bindOutsideClickListener: function() {
var t = this;
!this.outsideClickListener && en() && (this.outsideClickListener = function(n) {
t.visible && !t.selfClick && !t.isTargetClicked(n) && (t.visible = !1), t.selfClick = !1;
}, document.addEventListener("click", this.outsideClickListener));
},
unbindOutsideClickListener: function() {
this.outsideClickListener && (document.removeEventListener("click", this.outsideClickListener), this.outsideClickListener = null, this.selfClick = !1);
},
bindScrollListener: function() {
var t = this;
this.scrollHandler || (this.scrollHandler = new vt(this.target, function() {
t.visible && (t.visible = !1);
})), this.scrollHandler.bindScrollListener();
},
unbindScrollListener: function() {
this.scrollHandler && this.scrollHandler.unbindScrollListener();
},
bindResizeListener: function() {
var t = this;
this.resizeListener || (this.resizeListener = function() {
t.visible && !tn() && (t.visible = !1);
}, window.addEventListener("resize", this.resizeListener));
},
unbindResizeListener: function() {
this.resizeListener && (window.removeEventListener("resize", this.resizeListener), this.resizeListener = null);
},
isTargetClicked: function(t) {
return this.eventTarget && (this.eventTarget === t.target || this.eventTarget.contains(t.target));
},
containerRef: function(t) {
this.container = t;
},
createStyle: function() {
if (!this.styleElement && !this.isUnstyled) {
var t;
this.styleElement = document.createElement("style"), this.styleElement.type = "text/css", nn(this.styleElement, "nonce", (t = this.$primevue) === null || t === void 0 || (t = t.config) === null || t === void 0 || (t = t.csp) === null || t === void 0 ? void 0 : t.nonce), document.head.appendChild(this.styleElement);
var n = "";
for (var s in this.breakpoints)
n += `
screen and (max-width: `.concat(s, `) {
.p-popover[`).concat(this.$attrSelector, `] {
width: `).concat(this.breakpoints[s], ` !important;
}
}
`);
this.styleElement.innerHTML = n;
}
},
destroyStyle: function() {
this.styleElement && (document.head.removeChild(this.styleElement), this.styleElement = null);
},
onOverlayClick: function(t) {
re.emit("overlay-click", {
originalEvent: t,
target: this.target
});
}
},
directives: {
focustrap: yt,
ripple: hn
},
components: {
Portal: gt
}
}, mn = ["aria-modal"];
function vn(e, t, n, s, r, i) {
var o = V("Portal"), l = wt("focustrap");
return g(), Lt(o, {
appendTo: e.appendTo
}, {
default: oe(function() {
return [T(Ct, I({
name: "p-popover",
onEnter: i.onEnter,
onLeave: i.onLeave,
onAfterLeave: i.onAfterLeave
}, e.ptm("transition")), {
default: oe(function() {
return [r.visible ? Ae((g(), k("div", I({
key: 0,
ref: i.containerRef,
role: "dialog",
"aria-modal": r.visible,
onClick: t[3] || (t[3] = function() {
return i.onOverlayClick && i.onOverlayClick.apply(i, arguments);
}),
class: e.cx("root")
}, e.ptmi("root")), [e.$slots.container ? we(e.$slots, "container", {
key: 0,
closeCallback: i.hide,
keydownCallback: function(c) {
return i.onButtonKeydown(c);
}
}) : (g(), k("div", I({
key: 1,
class: e.cx("content"),
onClick: t[0] || (t[0] = function() {
return i.onContentClick && i.onContentClick.apply(i, arguments);
}),
onMousedown: t[1] || (t[1] = function() {
return i.onContentClick && i.onContentClick.apply(i, arguments);
}),
onKeydown: t[2] || (t[2] = function() {
return i.onContentKeydown && i.onContentKeydown.apply(i, arguments);
})
}, e.ptm("content")), [we(e.$slots, "default")], 16))], 16, mn)), [[l]]) : ue("", !0)];
}),
_: 3
}, 16, ["onEnter", "onLeave", "onAfterLeave"])];
}),
_: 3
}, 8, ["appendTo"]);
}
We.render = vn;
const yn = Ne({
inheritAttrs: !1,
name: "CustomSelect",
components: {
PButton: ht,
PPopover: We,
Listbox: mt
},
props: {
...ct(),
buttonProps: {
type: Object,
default: () => {
}
},
popoverProps: {
type: Object,
default: () => {
}
},
hideOnClick: {
type: Boolean,
default: !0
}
},
emits: ["update:model-value"],
setup(e, t) {
var c, d;
const n = dt(e, () => e.modelValue, t), s = Ot(), i = ((d = (c = pt().config.theme) == null ? void 0 : c.options) == null ? void 0 : d.prefix) + "-", o = (f) => i + f, l = (f) => {
s.value.toggle(f);
};
return {
...n,
popover: s,
toggle: l,
cx: o,
select: (f, u) => {
u && (n.select(u), e.hideOnClick && l(f));
}
};
}
});
const Ze = (e, t) => {
const n = e.__vccOpts || e;
for (const [s, r] of t)
n[s] = r;
return n;
}, gn = { class: "vcron-p-select" }, bn = ["onClick"];
function Sn(e, t, n, s, r, i) {
const o = V("Listbox"), l = V("p-button"), a = V("p-popover");
return g(), k("span", gn, [
Ae(T(o, null, null, 512), [
[Et, !1]
]),
T(l, I({ disabled: e.disabled }, e.buttonProps, { onClick: e.toggle }), {
default: oe(() => [
x(P(e.selection ?? e.selectedStr), 1),
e.clearable && !e.isEmpty ? (g(), k("i", {
key: 0,
class: "pi pi-times",
onClick: [
t[0] || (t[0] = (c) => e.clear()),
t[1] || (t[1] = $t(() => {
}, ["stop"]))
]
})) : ue("", !0)
]),
_: 1
}, 16, ["disabled", "onClick"]),
T(a, I(e.popoverProps, { ref: "popover" }), {
default: oe(() => [
(g(!0), k(K, null, fe(e.itemRows, (c, d) => (g(), k("div", {
class: "vcron-p-row",
key: d
}, [
(g(!0), k(K, null, fe(c, (f, u) => (g(), k("div", {
class: Rt([[e.has(f) ? "vcron-p-col-selected" : ""], "vcron-p-col"]),
flex: 1,
key: u,
onClick: (h) => {
f && e.select(h, f);
}
}, [
f ? (g(), k(K, { key: 0 }, [
x(P(f.text), 1)
], 64)) : ue("", !0)
], 10, bn))), 128))
]))), 128))
]),
_: 1
}, 16)
]);
}
const kn = /* @__PURE__ */ Ze(yn, [["render", Sn]]), _n = () => ({
/**
* Properties of PrimeVue Button
*
* @remarks
* See {@link https://primevue.org/button/#api.button.props}
*/
buttonProps: {
type: Object,
default() {
return {};
}
},
/**
* Properties of PrimeVue Popover
*
* @remarks
* See {@link https://primevue.org/popover/#api.popover.props}
*/
popoverProps: {
type: Object,
default: () => {
}
},
...ft()
}), wn = Ne({
name: "CronPrime",
components: {
CustomSelect: kn
},
props: _n(),
emits: ["update:model-value", "update:period", "error"],
setup(e, t) {
return ut(e, t);
}
});
function Ln(e, t, n, s, r, i) {
const o = V("custom-select");
return g(), k("div", null, [
x(P(e.period.prefix.value) + " ", 1),
T(o, {
"model-value": e.period.selected.value.id,
"item-value": "id",
items: e.period.items,
"onUpdate:modelValue": t[0] || (t[0] = (l) => e.period.select(l)),
disabled: e.disabled,
"button-props": e.buttonProps,
"popover-props": e.popoverProps
}, null, 8, ["model-value", "items", "disabled", "button-props", "popover-props"]),
x(" " + P(e.period.suffix.value) + " ", 1),
(g(!0), k(K, null, fe(e.selected, (l) => (g(), k(K, {
key: l.id
}, [
x(P(l.prefix.value) + " ", 1),
T(o, {
"model-value": l.selected.value,
"onUpdate:modelValue": (a) => l.select(a),
items: l.items,
cols: e.cols[l.id] || 1,
selection: l.text.value,
multiple: "",
clearable: "",
disabled: e.disabled,
"button-props": e.buttonProps,
"popover-props": e.popoverProps,
hideOnClick: !1
}, null, 8, ["model-value", "onUpdate:modelValue", "items", "cols", "selection", "disabled", "button-props", "popover-props"]),
x(" " + P(l.suffix.value), 1)
], 64))), 128))
]);
}
const Cn = /* @__PURE__ */ Ze(wn, [["render", Ln]]), Kn = {
install: (e) => {
e.component("CronPrime", Cn);
}
};
export {
Cn as CronPrime,
Kn as CronPrimePlugin,
_n as cronPrimeProps,
Kn as default
};
//# sourceMappingURL=prime.js.map