UNPKG

@vue-js-cron/core

Version:
1,939 lines 59.6 kB
var ue = Object.defineProperty; var oe = (a, e, t) => e in a ? ue(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t; var d = (a, e, t) => (oe(a, typeof e != "symbol" ? e + "" : e, t), t); import { ref as k, watch as g, defineComponent as ne, computed as re } from "vue"; var W = /* @__PURE__ */ ((a) => (a.Any = "any", a.Value = "value", a.Range = "range", a.Step = "step", a.StepFrom = "stepFrom", a.RangeStep = "rangeStep", a.Combined = "combined", a.NoSpecific = "noSpecific", a))(W || {}), $ = /* @__PURE__ */ ((a) => (a.Prefix = "prefix", a.Suffix = "suffix", a.Text = "text", a))($ || {}); class le { constructor(e, t) { d(this, "field"); d(this, "itemMap"); d(this, "ctx"); this.field = e, this.ctx = t, this.itemMap = this.field.items.reduce( (n, r) => (n[r.value] = r, n), {} ); } get id() { return this.field.id; } get items() { return this.field.items; } get onChange() { return this.field.onChange; } get segmentFactories() { return this.field.segmentFactories; } get min() { return this.items[0].value; } get max() { return this.items[this.items.length - 1].value; } getItem(e) { return this.itemMap[e]; } } function fe(a, e, t = 1) { const n = []; for (let r = a; r <= e; r += t) n.push(r); return n; } class xe { constructor(e, t, n = 1) { d(this, "start"); d(this, "end"); d(this, "step"); return this.start = e, this.end = t, this.step = n, new Proxy(this, { get: function(r, i) { const s = typeof i == "string" ? parseInt(i) : i; return typeof s == "number" && s >= 0 && s <= r.length ? r.start + r.step * s : Reflect.get(r, i); } }); } get length() { return (this.end - this.start) / this.step + 1; } [Symbol.iterator]() { let e = -1; return { next: () => ({ value: this[++e], done: this[e + 1] === void 0 }) }; } } function V(a, e, t = (r) => r + "", n = (r) => r + "") { const r = []; for (const i of new xe(a, e)) r.push({ text: t(i), alt: n(i), value: i }); return r; } function pe(a, e = "crontab") { const t = (r, i = !1) => new Date(2021, r - 1, 1).toLocaleDateString(a, { month: i ? "short" : "long" }), n = (r, i = !1) => new Date(2021, 0, 3 + r).toLocaleDateString(a, { weekday: i ? "short" : "long" }); return { secondItems: V(0, 59, (r) => G(r, 2)), minuteItems: V(0, 59, (r) => G(r, 2)), hourItems: V(0, 23, (r) => G(r, 2)), dayItems: V(1, 31), monthItems: V(1, 12, t, (r) => t(r, !0)), dayOfWeekItems: e === "quartz" ? V( 1, 7, (r) => n(r - 1), (r) => n(r - 1, !0) ) : V(0, 6, n, (r) => n(r, !0)) }; } function G(a, e) { const t = a + ""; return t.length < e ? new Array(e - t.length).fill("0").join("") + a : t; } function B(a) { return a && typeof a == "object" && !Array.isArray(a); } function Y(a, ...e) { if (!B(a) || e.length === 0) return; const t = e.shift(); if (B(t)) for (const [n, r] of Object.entries(t)) B(r) ? (B(a[n]) || (a[n] = {}), Y(a[n], t[n])) : a[n] = t[n]; return e.length > 0 && Y(a, ...e), a; } function ae(a, ...e) { if (e.length === 0) return a; for (const t of e[0]) if (t in a) { const n = ae(a[t], ...e.slice(1)); if (n !== void 0) return n; } } function ce(a) { for (let e = 1; e < a.length; e++) if (a[e - 1] + 1 !== a[e]) return !1; return !0; } function de() { throw new Error("not implemented"); } function he(a, e, t = !0) { const n = []; for (let r = 0; r < a.length; r += e) { const i = a.slice(r, r + e); for (; t && i.length < e; ) i.push(null); n.push(i); } return n; } class Q { constructor(e) { d(this, "field"); d(this, "type", W.NoSpecific); this.field = e; } toCron() { return "?"; } toArray() { return []; } get items() { return {}; } static fromString(e, t) { return e !== "?" ? null : new Q(t); } } class M { constructor(e) { d(this, "field"); d(this, "type", W.Any); this.field = e; } toCron() { return "*"; } toArray() { return []; } get items() { return {}; } static fromString(e, t) { return e !== "*" ? null : new M(t); } static fromArray(e, t) { const { items: n } = t; if (e.length === 0) return new M(t); if (e.length !== n.length) return null; for (const r of n) if (!e.includes(r.value)) return null; return ce(n.map((r) => r.value)) ? new M(t) : null; } } const H = class H { constructor(e, t, n) { d(this, "field"); d(this, "type", W.Range); d(this, "start"); d(this, "end"); this.field = e, this.start = t, this.end = n; } toCron() { return `${this.start}-${this.end}`; } toArray() { const e = this.start, t = this.end; return fe(e, t); } get items() { return { start: this.field.itemMap[this.start], end: this.field.itemMap[this.end] }; } static fromString(e, t) { if (!H.re.test(e)) return null; const { min: n, max: r } = t, i = e.split("-"), s = parseInt(i[0]), u = parseInt(i[1]); return s > u || s < n || u > r ? null : new H(t, s, u); } }; d(H, "re", /^\d+-\d+$/); let E = H; function Z(a, e, t) { const n = []; for (let r = e; r <= t; r += a) n.push(r); return n; } function me(a, e) { if (a === "*") return [e.min, e.max]; const t = a.split("-").map((n) => parseInt(n)); return t.length === 1 && e.ctx.format !== "crontab" ? [t[0], e.max] : [t[0], t[1]]; } const R = class R { constructor(e, t, n, r) { d(this, "field"); d(this, "step"); d(this, "start"); d(this, "end"); this.field = e, this.step = t, this.start = n ?? e.min, this.end = r ?? e.max; } get type() { const { min: e, max: t } = this.field; return this.field.ctx.format !== "crontab" && this.start !== e && t - this.end < this.step ? W.StepFrom : this.start !== e || t - this.end >= this.step ? W.RangeStep : W.Step; } toCron() { return this.type === W.StepFrom ? `${this.start}/${this.step}` : this.type === W.RangeStep ? `${this.start}-${this.end}/${this.step}` : `*/${this.step}`; } toArray() { return Z(this.step, this.start, this.end); } get items() { return { step: this.field.itemMap[this.step], start: this.field.itemMap[this.start], end: this.field.itemMap[this.end] }; } static fromString(e, t) { if (!R.re.test(e)) return null; const [n, r] = e.split("/"), i = parseInt(r); if (i > t.items.length) return null; const [s, u] = me(n, t); return Z(i, s, u).length == 0 ? null : new R(t, i, s, u); } static fromArray(e, t) { if (e.length < 3) return null; const n = e[1] - e[0]; if (n <= 1) return null; for (let r = 2; r < e.length; r++) if (e[r] - e[r - 1] != n) return null; return new R(t, n, e[0], e[e.length - 1]); } }; d(R, "re", /^(\*|\d+(-\d+)?)\/\d+$/); let P = R; class U { constructor(e, t) { d(this, "field"); d(this, "type", W.Value); d(this, "value"); this.field = e, this.value = t; } toCron() { return `${this.value}`; } toArray() { return [this.value]; } get items() { return { value: this.field.itemMap[this.value] }; } static fromString(e, t) { const { min: n, max: r } = t, i = parseInt(e); return String(i) === e && i >= n && i <= r ? new U(t, i) : null; } static fromArray(e, t) { const { min: n, max: r } = t; if (e.length != 1) return null; const i = e[0]; return i < n || i > r ? null : i; } } const j = class j { constructor(e, t = []) { d(this, "field"); d(this, "segments"); this.field = e, this.segments = t; } get type() { return this.segments.length == 1 ? this.segments[0].type : W.Range; } addSegment(e) { this.segments.push(e); } toCron() { return this.segments.map((e) => e.toCron()).join(","); } toArray() { const e = /* @__PURE__ */ new Set(); for (const t of this.segments) t.toArray().forEach((n) => e.add(n)); return Array.from(e); } get items() { return de(); } static fromString(e, t) { const n = t.segmentFactories ?? j.segmentFactories; let r = []; for (const i of e.split(",")) { if (i === "*") { r = [new M(t)]; break; } let s = null; for (const u of n) if (s = u(i, t), s !== null) break; if (s === null) return null; r.push(s); } return new j(t, r); } static fromArray(e, t) { const { min: n, max: r } = t, i = e[0], s = e[e.length - 1]; if (i < n || s > r) return null; const u = []; let o = 0; for (let x = 0; x < e.length; x++) (e[x + 1] === void 0 || e[x + 1] - e[x] > 1) && (x === o ? u.push(new U(t, e[o])) : u.push(new E(t, e[o], e[x])), o = x + 1); return new j(t, u); } }; d(j, "segmentFactories", [ M.fromString, P.fromString, E.fromString, U.fromString ]); let N = j; function _(a, e) { return N.fromString(a, e); } function ve(a, e) { for (const t of [ M.fromArray, P.fromArray, N.fromArray ]) { const n = t(a, e); if (n != null) return n; } return null; } /*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js */ var ye = Object.prototype.toString, D = Array.isArray || function(e) { return ye.call(e) === "[object Array]"; }; function X(a) { return typeof a == "function"; } function ge(a) { return D(a) ? "array" : typeof a; } function K(a) { return a.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); } function ee(a, e) { return a != null && typeof a == "object" && e in a; } function Se(a, e) { return a != null && typeof a != "object" && a.hasOwnProperty && a.hasOwnProperty(e); } var we = RegExp.prototype.test; function ke(a, e) { return we.call(a, e); } var Ce = /\S/; function qe(a) { return !ke(Ce, a); } var Oe = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;", "/": "&#x2F;", "`": "&#x60;", "=": "&#x3D;" }; function be(a) { return String(a).replace(/[&<>"'`=\/]/g, function(t) { return Oe[t]; }); } var We = /\s*/, Ae = /\s+/, te = /\s*=/, Te = /\s*\}/, Me = /#|\^|\/|>|\{|&|=|!/; function Ie(a, e) { if (!a) return []; var t = !1, n = [], r = [], i = [], s = !1, u = !1, o = "", x = 0; function h() { if (s && !u) for (; i.length; ) delete r[i.pop()]; else i = []; s = !1, u = !1; } var p, y, T; function A(O) { if (typeof O == "string" && (O = O.split(Ae, 2)), !D(O) || O.length !== 2) throw new Error("Invalid tags: " + O); p = new RegExp(K(O[0]) + "\\s*"), y = new RegExp("\\s*" + K(O[1])), T = new RegExp("\\s*" + K("}" + O[1])); } A(e || b.tags); for (var l = new L(a), m, f, v, q, I, c; !l.eos(); ) { if (m = l.pos, v = l.scanUntil(p), v) for (var S = 0, w = v.length; S < w; ++S) q = v.charAt(S), qe(q) ? (i.push(r.length), o += q) : (u = !0, t = !0, o += " "), r.push(["text", q, m, m + 1]), m += 1, q === ` ` && (h(), o = "", x = 0, t = !1); if (!l.scan(p)) break; if (s = !0, f = l.scan(Me) || "name", l.scan(We), f === "=" ? (v = l.scanUntil(te), l.scan(te), l.scanUntil(y)) : f === "{" ? (v = l.scanUntil(T), l.scan(Te), l.scanUntil(y), f = "&") : v = l.scanUntil(y), !l.scan(y)) throw new Error("Unclosed tag at " + l.pos); if (f == ">" ? I = [f, v, m, l.pos, o, x, t] : I = [f, v, m, l.pos], x++, r.push(I), f === "#" || f === "^") n.push(I); else if (f === "/") { if (c = n.pop(), !c) throw new Error('Unopened section "' + v + '" at ' + m); if (c[1] !== v) throw new Error('Unclosed section "' + c[1] + '" at ' + m); } else f === "name" || f === "{" || f === "&" ? u = !0 : f === "=" && A(v); } if (h(), c = n.pop(), c) throw new Error('Unclosed section "' + c[1] + '" at ' + l.pos); return $e(Ve(r)); } function Ve(a) { for (var e = [], t, n, r = 0, i = a.length; r < i; ++r) t = a[r], t && (t[0] === "text" && n && n[0] === "text" ? (n[1] += t[1], n[3] = t[3]) : (e.push(t), n = t)); return e; } function $e(a) { for (var e = [], t = e, n = [], r, i, s = 0, u = a.length; s < u; ++s) switch (r = a[s], r[0]) { case "#": case "^": t.push(r), n.push(r), t = r[4] = []; break; case "/": i = n.pop(), i[5] = r[2], t = n.length > 0 ? n[n.length - 1][4] : e; break; default: t.push(r); } return e; } function L(a) { this.string = a, this.tail = a, this.pos = 0; } L.prototype.eos = function() { return this.tail === ""; }; L.prototype.scan = function(e) { var t = this.tail.match(e); if (!t || t.index !== 0) return ""; var n = t[0]; return this.tail = this.tail.substring(n.length), this.pos += n.length, n; }; L.prototype.scanUntil = function(e) { var t = this.tail.search(e), n; switch (t) { case -1: n = this.tail, this.tail = ""; break; case 0: n = ""; break; default: n = this.tail.substring(0, t), this.tail = this.tail.substring(t); } return this.pos += n.length, n; }; function F(a, e) { this.view = a, this.cache = { ".": this.view }, this.parent = e; } F.prototype.push = function(e) { return new F(e, this); }; F.prototype.lookup = function(e) { var t = this.cache, n; if (t.hasOwnProperty(e)) n = t[e]; else { for (var r = this, i, s, u, o = !1; r; ) { if (e.indexOf(".") > 0) for (i = r.view, s = e.split("."), u = 0; i != null && u < s.length; ) u === s.length - 1 && (o = ee(i, s[u]) || Se(i, s[u])), i = i[s[u++]]; else i = r.view[e], o = ee(r.view, e); if (o) { n = i; break; } r = r.parent; } t[e] = n; } return X(n) && (n = n.call(this.view)), n; }; function C() { this.templateCache = { _cache: {}, set: function(e, t) { this._cache[e] = t; }, get: function(e) { return this._cache[e]; }, clear: function() { this._cache = {}; } }; } C.prototype.clearCache = function() { typeof this.templateCache < "u" && this.templateCache.clear(); }; C.prototype.parse = function(e, t) { var n = this.templateCache, r = e + ":" + (t || b.tags).join(":"), i = typeof n < "u", s = i ? n.get(r) : void 0; return s == null && (s = Ie(e, t), i && n.set(r, s)), s; }; C.prototype.render = function(e, t, n, r) { var i = this.getConfigTags(r), s = this.parse(e, i), u = t instanceof F ? t : new F(t, void 0); return this.renderTokens(s, u, n, e, r); }; C.prototype.renderTokens = function(e, t, n, r, i) { for (var s = "", u, o, x, h = 0, p = e.length; h < p; ++h) x = void 0, u = e[h], o = u[0], o === "#" ? x = this.renderSection(u, t, n, r, i) : o === "^" ? x = this.renderInverted(u, t, n, r, i) : o === ">" ? x = this.renderPartial(u, t, n, i) : o === "&" ? x = this.unescapedValue(u, t) : o === "name" ? x = this.escapedValue(u, t, i) : o === "text" && (x = this.rawValue(u)), x !== void 0 && (s += x); return s; }; C.prototype.renderSection = function(e, t, n, r, i) { var s = this, u = "", o = t.lookup(e[1]); function x(y) { return s.render(y, t, n, i); } if (o) { if (D(o)) for (var h = 0, p = o.length; h < p; ++h) u += this.renderTokens(e[4], t.push(o[h]), n, r, i); else if (typeof o == "object" || typeof o == "string" || typeof o == "number") u += this.renderTokens(e[4], t.push(o), n, r, i); else if (X(o)) { if (typeof r != "string") throw new Error("Cannot use higher-order sections without the original template"); o = o.call(t.view, r.slice(e[3], e[5]), x), o != null && (u += o); } else u += this.renderTokens(e[4], t, n, r, i); return u; } }; C.prototype.renderInverted = function(e, t, n, r, i) { var s = t.lookup(e[1]); if (!s || D(s) && s.length === 0) return this.renderTokens(e[4], t, n, r, i); }; C.prototype.indentPartial = function(e, t, n) { for (var r = t.replace(/[^ \t]/g, ""), i = e.split(` `), s = 0; s < i.length; s++) i[s].length && (s > 0 || !n) && (i[s] = r + i[s]); return i.join(` `); }; C.prototype.renderPartial = function(e, t, n, r) { if (n) { var i = this.getConfigTags(r), s = X(n) ? n(e[1]) : n[e[1]]; if (s != null) { var u = e[6], o = e[5], x = e[4], h = s; o == 0 && x && (h = this.indentPartial(s, x, u)); var p = this.parse(h, i); return this.renderTokens(p, t, n, h, r); } } }; C.prototype.unescapedValue = function(e, t) { var n = t.lookup(e[1]); if (n != null) return n; }; C.prototype.escapedValue = function(e, t, n) { var r = this.getConfigEscape(n) || b.escape, i = t.lookup(e[1]); if (i != null) return typeof i == "number" && r === b.escape ? String(i) : r(i); }; C.prototype.rawValue = function(e) { return e[1]; }; C.prototype.getConfigTags = function(e) { return D(e) ? e : e && typeof e == "object" ? e.tags : void 0; }; C.prototype.getConfigEscape = function(e) { if (e && typeof e == "object" && !D(e)) return e.escape; }; var b = { name: "mustache.js", version: "4.2.0", tags: ["{{", "}}"], clearCache: void 0, escape: void 0, parse: void 0, render: void 0, Scanner: void 0, Context: void 0, Writer: void 0, /** * Allows a user to override the default caching strategy, by providing an * object with set, get and clear methods. This can also be used to disable * the cache by setting it to the literal `undefined`. */ set templateCache(a) { z.templateCache = a; }, /** * Gets the default or overridden caching object from the default writer. */ get templateCache() { return z.templateCache; } }, z = new C(); b.clearCache = function() { return z.clearCache(); }; b.parse = function(e, t) { return z.parse(e, t); }; b.render = function(e, t, n, r) { if (typeof e != "string") throw new TypeError('Invalid template! Template should be a "string" but "' + ge(e) + '" was given as the first argument for mustache#render(template, view, partials)'); return z.render(e, t, n, r); }; b.escape = be; b.Scanner = L; b.Context = F; b.Writer = C; const Re = { "*": { prefix: "每", suffix: "", text: "未知", "*": { any: { text: "每 {{field.id}}" }, value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "每 {{step.value}}" } }, month: { "*": { prefix: "的" }, any: { text: "每月" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, day: { "*": { prefix: "的" }, any: { text: "每日" }, value: { text: "{{value.alt}}号" }, range: { text: "{{start.alt}}号-{{end.alt}}号" }, noSpecific: { text: "无特定日期" } }, dayOfWeek: { "*": { prefix: "的" }, any: { text: "一周的每一天" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, noSpecific: { text: "无特定星期几" } }, hour: { "*": { prefix: "的" }, any: { text: "每小时" } }, minute: { "*": { prefix: ":" }, any: { text: "每分钟" } }, second: { "*": { prefix: ":" }, any: { text: "每秒" } } }, minute: { text: "分" }, hour: { text: "小时", minute: { "*": { prefix: ":", suffix: "分钟" }, any: { text: "每" } } }, day: { text: "天" }, week: { text: "周", dayOfWeek: { "*": { prefix: "的" }, any: { text: "每天" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } } }, month: { text: "月", dayOfWeek: { "*": { prefix: "和" } }, day: { "*": { prefix: "的" } } }, year: { text: "年", dayOfWeek: { "*": { prefix: "和" } } }, //quartz format "q-second": { text: "秒" }, "q-minute": { text: "分钟", second: { "*": { prefix: ":", suffix: "秒" }, any: { text: "每" } } }, "q-hour": { text: "小时", minute: { "*": { prefix: ":" } } } }, je = { "*": { prefix: "Hver", suffix: "", text: "Ukendt", "*": { value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "hver {{step.value}}" } }, month: { "*": { prefix: "i" }, any: { text: "hver måned" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, day: { "*": { prefix: "og" }, any: { text: "hver dag i måneden" }, value: { text: "{{value.alt}}." }, range: { text: "{{start.alt}}.-{{end.alt}}." }, noSpecific: { text: "ingen specifik dag" } }, dayOfWeek: { "*": { prefix: "på" }, any: { text: "hver dag i ugen" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, noSpecific: { text: "ingen specifik dag i ugen" } }, hour: { "*": { prefix: "klokken" }, any: { text: "hver time" } }, minute: { "*": { prefix: ":" }, any: { text: "hvert minut" } }, second: { "*": { prefix: ":" }, any: { text: "hvert sekund" } } }, second: { prefix: "Hvert" }, minute: { prefix: "Hvert", text: "Minut" }, hour: { text: "Time", minute: { "*": { prefix: "ved", suffix: "minutter" }, any: { text: "alle" } } }, day: { text: "Dag" }, week: { text: "Uge" }, month: { text: "Måned", dayOfWeek: { "*": { prefix: "og" } } }, year: { prefix: "Hvert", text: "År", dayOfWeek: { "*": { prefix: "og" } } }, // quartz format "q-second": { text: "Sekund" }, "q-minute": { text: "Minut", second: { "*": { suffix: "sekund(er)" }, any: { text: "hvert" } } }, "q-hour": { text: "Time", minute: { "*": { prefix: "på" } } } }, Ee = { "*": { prefix: "Jede", suffix: "", text: "Unknown", "*": { value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "alle {{step.value}}" } }, month: { "*": { prefix: "im" }, any: { prefix: "in", text: "jedem Monat" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, day: { "*": { prefix: "den" }, any: { prefix: "an", text: "jedem Tag" }, step: { prefix: "", text: "alle {{step.value}} Tage" }, noSpecific: { prefix: "an", text: "keinem bestimmten Tag" } }, dayOfWeek: { "*": { prefix: "am" }, any: { prefix: "an", text: "jedem Wochentag" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, noSpecific: { prefix: "und", text: "keinem bestimmten Wochentag" } }, hour: { "*": { prefix: "um" }, any: { prefix: "zu", text: "jeder Stunde" }, step: { prefix: "", text: "alle {{step.value}} Stunden" } }, minute: { "*": { prefix: ":" }, any: { text: "jede Minute" }, step: { prefix: "", text: "alle {{step.value}} Minuten" } }, second: { "*": { prefix: ":" }, any: { text: "jede Sekunde" }, step: { prefix: "", text: "alle {{step.value}} Sekunden" } } }, minute: { text: "Minute" }, hour: { text: "Stunde", minute: { "*": { prefix: "zu", suffix: "Minute(n)" }, any: { text: "jeder" } } }, day: { prefix: "Jeden", text: "Tag" }, week: { text: "Woche" }, month: { prefix: "Jedes", text: "Monat" }, year: { prefix: "Jedes", text: "Jahr" }, //quartz format "q-second": { text: "Sekunde" }, "q-minute": { text: "Minute", second: { "*": { prefix: "und" } } }, "q-hour": { text: "Stunde", minute: { "*": { prefix: "und" } }, second: { "*": { prefix: "und" } } } }, Pe = { "*": { prefix: "Every", suffix: "", text: "Unknown", "*": { value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "every {{step.value}}" }, rangeStep: { text: "{{start.text}}-{{end.text}}/{{step.value}}" }, stepFrom: { text: "{{start.text}}/{{step.value}}" } }, month: { "*": { prefix: "in" }, any: { text: "every month" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, rangeStep: { text: "{{start.alt}}-{{end.alt}}/{{step.value}}" }, stepFrom: { text: "{{start.alt}}/{{step.value}}" } }, day: { "*": { prefix: "on" }, any: { text: "every day" }, noSpecific: { text: "no specific day" } }, dayOfWeek: { "*": { prefix: "on" }, any: { text: "every day of the week" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, rangeStep: { text: "{{start.alt}}-{{end.alt}}/{{step.value}}" }, stepFrom: { text: "{{start.alt}}/{{step.value}}" }, noSpecific: { text: "no specific day of the week" } }, hour: { "*": { prefix: "at" }, any: { text: "every hour" } }, minute: { "*": { prefix: ":" }, any: { text: "every minute" } }, second: { "*": { prefix: ":" }, any: { text: "every second" } } }, minute: { text: "Minute" }, hour: { text: "Hour", minute: { "*": { prefix: "at", suffix: "minute(s)" }, any: { text: "every" } } }, day: { text: "Day" }, week: { text: "Week" }, month: { text: "Month", dayOfWeek: { "*": { prefix: "and" } } }, year: { text: "Year", dayOfWeek: { "*": { prefix: "and" } } }, //quartz format "q-second": { text: "Second" }, "q-minute": { text: "Minute", second: { "*": { prefix: "at", suffix: "second(s)" }, any: { text: "every" } } }, "q-hour": { text: "Hour", minute: { "*": { prefix: "at" } } } }, Ue = { "*": { prefix: "todos los", suffix: "", text: "Desconocido", "*": { any: { text: "todos los {{ field.id }}" }, value: { text: "{{ value.text }}" }, range: { text: "{{ start.text }}-{{ end.text }}" }, step: { text: "todos/as {{ step.value }}" } }, month: { "*": { prefix: "en" }, any: { text: "todos los meses" }, value: { text: "{{ value.alt }}" }, range: { text: "{{ start.alt }}-{{ end.alt }}" } }, day: { "*": { prefix: "en" }, any: { text: "todos los días" }, value: { text: "los días {{ value.alt }}" } }, dayOfWeek: { "*": { prefix: "de" }, any: { text: "todos los días de la semana" }, value: { text: "los {{ value.alt }}" }, range: { text: "{{ start.alt }}-{{ end.alt }}" } }, hour: { "*": { prefix: "a" }, any: { text: "todas las horas" }, value: { text: "las {{ value.text }}" } }, minute: { "*": { prefix: ":" }, any: { text: "todos los minutos" } } }, minute: { prefix: "todos los", text: "minutos" }, hour: { prefix: "todas las", text: "horas", minute: { "*": { prefix: "a los", suffix: "minutos" }, any: { text: "todos", prefix: "a", suffix: "los minutos" } } }, day: { text: "Días" }, week: { text: "Semanas" }, month: { text: "Meses", dayOfWeek: { "*": { prefix: "y" } } }, year: { text: "años", dayOfWeek: { "*": { prefix: "y" } } } }, Fe = { "*": { prefix: "Toutes", suffix: "", text: "Inconnu", "*": { value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "tous les {{step.value}}" } }, month: { "*": { prefix: "en" }, any: { prefix: "en", text: "tous les mois" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, day: { "*": { prefix: "le" }, any: { prefix: "à", text: "tous les jours" }, step: { prefix: "", text: "tous les {{step.value}} jours" }, noSpecific: { prefix: "à", text: "aucun jour particulier" } }, dayOfWeek: { "*": { prefix: "le" }, any: { prefix: "à", text: "tous les jours de la semaine" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, noSpecific: { prefix: "et", text: "aucun jour de la semaine particulier" } }, hour: { "*": { prefix: "à" }, any: { prefix: "à", text: "toutes les heures" }, step: { prefix: "", text: "toutes les {{step.value}} heures" } }, minute: { "*": { prefix: ":" }, any: { text: "toutes les minutes" }, step: { prefix: "", text: "toutes les {{step.value}} minutes" } }, second: { "*": { prefix: ":" }, any: { text: "toutes les secondes" }, step: { prefix: "", text: "toutes les {{step.value}} secondes" } } }, minute: { text: "Minute" }, hour: { text: "Heure", minute: { "*": { prefix: "à", suffix: "minute(s)" }, any: { text: "toutes" } } }, day: { prefix: "Tous", text: "Jour" }, week: { text: "Semaine" }, month: { prefix: "Tous", text: "Mois" }, year: { prefix: "Tous", text: "Année" }, //quartz format "q-second": { text: "Seconde" }, "q-minute": { text: "Minute", second: { "*": { prefix: "et" } } }, "q-hour": { text: "Heure", minute: { "*": { prefix: "et" } }, second: { "*": { prefix: "et" } } } }, De = { "*": { prefix: "בכל", suffix: "", text: "לא ידוע", "*": { value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "כל {{step.value}}" } }, month: { "*": { prefix: "ב" }, any: { text: "כל חודש" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, day: { "*": { prefix: "ב" }, any: { text: "כל יום" }, value: { text: "יום {{value.alt}} לחודש" }, noSpecific: { text: "ללא יום מוגדר" } }, dayOfWeek: { "*": { prefix: "ב" }, any: { text: "כל יום מימות השבוע" }, value: { text: "ימי {{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, noSpecific: { text: "ללא יום בשבוע מוגדר" } }, hour: { "*": { prefix: "ב" }, any: { text: "כל שעה" }, value: { text: "שעה {{value.text}}" } }, minute: { "*": { prefix: ":" }, any: { text: "כל דקה" } }, second: { "*": { prefix: ":" }, any: { text: "כל שניה" } } }, minute: { text: "דקה" }, hour: { text: "שעה", minute: { "*": { prefix: "ב", suffix: "דקות" }, any: { text: "כל" } } }, day: { text: "יום" }, week: { text: "שבוע" }, month: { text: "חודש", dayOfWeek: { "*": { prefix: "ו" } } }, year: { text: "שנה", dayOfWeek: { "*": { prefix: "ו" } } }, //quartz format "q-second": { text: "שניה" }, "q-minute": { text: "דקה", second: { "*": { prefix: "ב", suffix: "שניות" }, any: { text: "כל" } } }, "q-hour": { text: "שעה", minute: { "*": { prefix: "ב" } } } }, He = { "*": { prefix: "हर", suffix: "", text: "अज्ञात", "*": { value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "{{step.value}} हर" } }, month: { "*": { prefix: "में" }, any: { prefix: "के", text: "हर महीने" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, day: { "*": { prefix: "के" }, any: { prefix: "पर", text: "हर दिन" }, step: { prefix: "", text: "{{step.value}} दिन हर" }, noSpecific: { prefix: "पर", text: "कोई विशेष दिन नहीं" } }, dayOfWeek: { "*": { prefix: "पर" }, any: { prefix: "पर", text: "हर सप्ताह" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, noSpecific: { prefix: "और", text: "कोई विशेष सप्ताह नहीं" } }, hour: { "*": { prefix: "को" }, any: { prefix: "पर", text: "हर घंटे" }, step: { prefix: "", text: "{{step.value}} घंटे हर" } }, minute: { "*": { prefix: ":" }, any: { text: "हर मिनट" }, step: { prefix: "", text: "{{step.value}} मिनट हर" } }, second: { "*": { prefix: ":" }, any: { text: "हर सेकंड" }, step: { prefix: "", text: "{{step.value}} सेकंड हर" } } }, minute: { text: "मिनट" }, hour: { text: "घंटा", minute: { "*": { prefix: "पर", suffix: "मिनट" }, any: { text: "हर" } } }, day: { prefix: "हर", text: "दिन" }, week: { text: "सप्ताह" }, month: { prefix: "हर", text: "महीना" }, year: { prefix: "हर", text: "साल" }, //quartz format "q-second": { text: "सेकंड" }, "q-minute": { text: "मिनट", second: { "*": { prefix: "और" } } }, "q-hour": { text: "घंटा", minute: { "*": { prefix: "और" } }, second: { "*": { prefix: "और" } } } }, Ne = { "*": { prefix: "Tutti", suffix: "", text: "Sconosciuto", "*": { value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "ogni {{step.value}}" } }, month: { "*": { prefix: "in" }, any: { prefix: "in", text: "ogni mese" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, day: { "*": { prefix: "il" }, any: { prefix: "il", text: "ogni giorno" }, step: { prefix: "", text: "ogni {{step.value}} giorni" }, noSpecific: { prefix: "il", text: "nessun giorno specifico" } }, dayOfWeek: { "*": { prefix: "il" }, any: { prefix: "il", text: "ogni giorno della settimana" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, noSpecific: { prefix: "e", text: "nessun giorno della settimana specifico" } }, hour: { "*": { prefix: "alle" }, any: { prefix: "alle", text: "ogni ora" }, step: { prefix: "", text: "ogni {{step.value}} ore" } }, minute: { "*": { prefix: ":" }, any: { text: "ogni minuto" }, step: { prefix: "", text: "ogni {{step.value}} minuti" } }, second: { "*": { prefix: ":" }, any: { text: "ogni secondo" }, step: { prefix: "", text: "ogni {{step.value}} secondi" } } }, minute: { text: "Minuto" }, hour: { text: "Ora", minute: { "*": { prefix: "al", suffix: "minuto/i" }, any: { text: "tutti" } } }, day: { prefix: "Tutti", text: "Giorno" }, week: { text: "Settimana" }, month: { prefix: "Tutti", text: "Mese" }, year: { prefix: "Tutti", text: "Anno" }, //quartz format "q-second": { text: "Secondo" }, "q-minute": { text: "Minuto", second: { "*": { prefix: "e" } } }, "q-hour": { text: "Ora", minute: { "*": { prefix: "e" } }, second: { "*": { prefix: "e" } } } }, ze = { "*": { prefix: "毎", suffix: "", text: "不明", "*": { value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "{{step.value}}ごとに" } }, month: { "*": { prefix: "に" }, any: { prefix: "の", text: "毎月" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, day: { "*": { prefix: "の" }, any: { prefix: "に", text: "毎日" }, step: { prefix: "", text: "{{step.value}}日ごとに" }, noSpecific: { prefix: "に", text: "特定の日はなし" } }, dayOfWeek: { "*": { prefix: "の" }, any: { prefix: "に", text: "毎週" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, noSpecific: { prefix: "と", text: "特定の曜日はなし" } }, hour: { "*": { prefix: "の" }, any: { prefix: "に", text: "毎時" }, step: { prefix: "", text: "{{step.value}}時間ごとに" } }, minute: { "*": { prefix: ":" }, any: { text: "毎分" }, step: { prefix: "", text: "{{step.value}}分ごとに" } }, second: { "*": { prefix: ":" }, any: { text: "毎秒" }, step: { prefix: "", text: "{{step.value}}秒ごとに" } } }, minute: { text: "分" }, hour: { text: "時", minute: { "*": { prefix: "に", suffix: "分" }, any: { text: "毎" } } }, day: { prefix: "毎", text: "日" }, week: { text: "週" }, month: { prefix: "毎", text: "月" }, year: { prefix: "毎", text: "年" }, //quartz format "q-second": { text: "秒" }, "q-minute": { text: "分", second: { "*": { prefix: "と" } } }, "q-hour": { text: "時", minute: { "*": { prefix: "と" } }, second: { "*": { prefix: "と" } } } }, Le = { "*": { prefix: "매", suffix: "", text: "알 수 없음", "*": { value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "{{step.value}}마다" } }, month: { "*": { prefix: "에" }, any: { prefix: "의", text: "매월" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, day: { "*": { prefix: "의" }, any: { prefix: "에", text: "매일" }, step: { prefix: "", text: "{{step.value}}일마다" }, noSpecific: { prefix: "에", text: "특정한 날 없음" } }, dayOfWeek: { "*": { prefix: "의" }, any: { prefix: "에", text: "매주" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, noSpecific: { prefix: "과", text: "특정한 요일 없음" } }, hour: { "*": { prefix: "의" }, any: { prefix: "에", text: "매시" }, step: { prefix: "", text: "{{step.value}}시간마다" } }, minute: { "*": { prefix: ":" }, any: { text: "매분" }, step: { prefix: "", text: "{{step.value}}분마다" } }, second: { "*": { prefix: ":" }, any: { text: "매초" }, step: { prefix: "", text: "{{step.value}}초마다" } } }, minute: { text: "분" }, hour: { text: "시", minute: { "*": { prefix: "에", suffix: "분" }, any: { text: "매" } } }, day: { prefix: "매", text: "일" }, week: { text: "주" }, month: { prefix: "매", text: "월" }, year: { prefix: "매", text: "년" }, //quartz format "q-second": { text: "초" }, "q-minute": { text: "분", second: { "*": { prefix: "와" } } }, "q-hour": { text: "시", minute: { "*": { prefix: "와" } }, second: { "*": { prefix: "와" } } } }, Be = { "*": { prefix: "Todo(a)", suffix: "", text: "Desconhecido", "*": { any: { text: "todo {{field.id}}" }, value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "todo {{step.value}}" } }, month: { "*": { prefix: "de" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, any: { text: "todo mês" } }, day: { "*": { prefix: "no(s) dia(s)" }, any: { text: "todos" } }, dayOfWeek: { "*": { prefix: "de" }, any: { text: "todos dias da semana" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, hour: { "*": { prefix: "às" }, any: { text: "cada hora" } }, minute: { "*": { prefix: ":" }, any: { text: "cada minuto" } } }, minute: { text: "Minuto" }, hour: { text: "Hora", minute: { "*": { prefix: "e", suffix: "minuto(s)" }, any: { text: "cada" } } }, day: { text: "Dia" }, week: { text: "Semana" }, month: { text: "Mês", dayOfWeek: { "*": { prefix: "e de" } } }, year: { text: "Ano", dayOfWeek: { "*": { prefix: "e de" } } } }, Je = { "*": { prefix: "Каждый", suffix: "", text: "Неизвестно", "*": { value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "каждый {{step.value}}" } }, month: { "*": { prefix: "в" }, any: { prefix: "в", text: "каждом месяце" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, day: { "*": { prefix: "в" }, any: { prefix: "в", text: "каждый день" }, step: { prefix: "", text: "каждые {{step.value}} дня" }, noSpecific: { prefix: "в", text: "нет определенного дня" } }, dayOfWeek: { "*": { prefix: "по" }, any: { prefix: "по", text: "каждому дню недели" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, noSpecific: { prefix: "и", text: "нет определенного дня недели" } }, hour: { "*": { prefix: "в" }, any: { prefix: "в", text: "каждый час" }, step: { prefix: "", text: "каждые {{step.value}} часа" } }, minute: { "*": { prefix: ":" }, any: { text: "каждую минуту" }, step: { prefix: "", text: "каждые {{step.value}} минуты" } }, second: { "*": { prefix: ":" }, any: { text: "каждую секунду" }, step: { prefix: "", text: "каждые {{step.value}} секунды" } } }, minute: { text: "Минута" }, hour: { text: "Час", minute: { "*": { prefix: "в", suffix: "минут(а/ы)" }, any: { text: "каждый" } } }, day: { prefix: "Каждый", text: "День" }, week: { text: "Неделя" }, month: { prefix: "Каждый", text: "Месяц" }, year: { prefix: "Каждый", text: "Год" }, //quartz format "q-second": { text: "Секунда" }, "q-minute": { text: "Минута", second: { "*": { prefix: "и" } } }, "q-hour": { text: "Час", minute: { "*": { prefix: "и" } }, second: { "*": { prefix: "и" } } } }, Qe = { "*": { prefix: "Кожний", suffix: "", text: "Невідомо", "*": { value: { text: "{{value.text}}" }, range: { text: "{{start.text}}-{{end.text}}" }, step: { text: "кожний {{step.value}}" } }, month: { "*": { prefix: "в" }, any: { prefix: "в", text: "кожному місяці" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" } }, day: { "*": { prefix: "в" }, any: { prefix: "в", text: "кожний день" }, step: { prefix: "", text: "кожні {{step.value}} дні" }, noSpecific: { prefix: "в", text: "немає визначеного дня" } }, dayOfWeek: { "*": { prefix: "по" }, any: { prefix: "по", text: "кожному дню тижня" }, value: { text: "{{value.alt}}" }, range: { text: "{{start.alt}}-{{end.alt}}" }, noSpecific: { prefix: "і", text: "немає визначеного дня" } }, hour: { "*": { prefix: "в" }, any: { prefix: "в", text: "кожну годину" }, step: { prefix: "", text: "кожні {{step.value}} годин(и)" } }, minute: { "*": { prefix: ":" }, any: { text: "кожну хвилину" }, step: { prefix: "", text: "кожні {{step.value}} хвилин(и)" } }, second: { "*": { prefix: ":" }, any: { text: "кожну секунду" }, step: { prefix: "", text: "кожні {{step.value}} секунд(и)" } } }, minute: { text: "Хвилини" }, hour: { text: "Година", minute: { "*": { prefix: "в", suffix: "хвилин(а)" }, any: { text: "кожні" } } }, day: { prefix: "Кожний", text: "День" }, week: { text: "Тиждень" }, month: { prefix: "Кожний", text: "Місяц" }, year: { prefix: "Кожний", text: "Рік" }, //quartz format "q-second": { text: "Секунда" }, "q-minute": { text: "Хвилина", second: { "*": { prefix: "и" } } }, "q-hour": { text: "Година", minute: { "*": { prefix: "і" } }, second: { "*": { prefix: "і" } } } }, J = { empty: {}, en: Pe, de: Ee, pt: Be, es: Ue, da: je, zh: Re, he: De, ru: Je, fr: Fe, hi: He, ja: ze, ko: Le, it: Ne, uk: Qe }; class Ge { constructor(e) { d(this, "dict"); this.dict = e; } /** * Gets a localization template by traversing the dictionary using provided keys. * @param keys - Array of keys to traverse through the localization dictionary * @returns The found template string or empty string if not found */ getTemplate(...e) { const t = e.map((n) => [n, "*"]); return ae(this.dict, ...t) || ""; } /** * Renders a localization template with the provided parameters using Mustache. * @param periodId - The period identifier (e.g. 'year', 'month') * @param fieldId - The field identifier (e.g. 'hour', 'minute') * @param fieldPattern - The pattern type of the field * @param position - The text position * @param params - Parameters to be interpolated into the template * @returns The rendered localization string */ render(e, t, n, r, i) { const s = this.getTemplate(e, t, n, r); return b.render(s, i || {}); } } function Ke(a, e) { const [t] = a.split("-"), n = J[a.toLowerCase()] || J[t.toLowerCase()] || J.en, r = Y({}, J.en, n, e || {}); return new Ge(r); } function Ye(a) { const { period: e, field: t, initialCron: n = "*", l10n: r } = a, i = k(n), s = k(""), u = k([]), o = k(""), x = k(""), h = k(""), p = (l) => { const m = l instanceof N ? l.segments : [l]; o.value = m.map((f) => r.render(e.value.id, t.id, f.type, $.Text, { field: t, ...f.items })).join(","), x.value = r.getTemplate(e.value.id, t.id, l.type, $.Prefix), h.value = r.getTemplate(e.value.id, t.id, l.type, $.Suffix); }, y = (l) => { const m = _(l, t); m != null ? (u.value = m.toArray(), p(m)) : s.value = `${l} is not a valid cron segment (${t.id})`; }, T = (l) => { if (i.value == "?" && l.length == 0) return; const m = ve(l, t); m != null ? (i.value = m.toCron(), p(m)) : s.value = `failed to convert ${l} to cron (${t.id})`; }; y(n); const A = (l) => { const m = Array.from(l).sort((f, v) => f > v ? 1 : -1); u.value = m; }; return g(i, (l) => { y(l); }), g(u, (l) => { T(l); }), g(e, () => { const l = _(i.value, t); l != null && p(l); }), { id: t.id, items: t.items, cron: i, selected: u, error: s, select: A, text: o, prefix: x, suffix: h }; } function ie(a) { return a.map((e) => e.default ?? "*").join(" "); } function Xe(a) { return a !== void 0; } class Ze { constructor() { d(this, "locale", "en"); d(this, "format", "crontab"); } initialValue(e) { return ie(e); } fields(e, t) { const n = e == "quartz" || e == "spring", r = pe(t, e), i = (s) => (u, { segmentMap: o }) => { if (u.cron.value == "?") return; const x = o.get(s); x && (x.cron.value = "?"); }; return [ ...n ? [{ id: "second", items: r.secondItems }] : [], { id: "minute", items: r.minuteItems }, { id: "hour", items: r.hourItems }, { id: "day", items: r.dayItems, onChange: n ? i("dayOfWeek") : void 0, segmentFactories: n ? [ M.fromString, Q.fromString, P.fromString, E.fromString, U.fromString ] : void 0 }, { id: "month", items: r.monthItems }, { id: "dayOfWeek", default: e === "quartz" ? "?" : void 0, items: r.dayOfWeekItems, onChange: n ? i("day") : void 0, segmentFactories: n ? [ M.fromString, Q.fromString, P.fromString, E.fromString, U.fromString ] : void 0 } ]; } periods(e) { const t = e == "quartz" || e == "spring", n = t ? [{ id: "q-second", value: [] }] : [], r = t ? ["second"] : [], i = t ? "q-" : ""; return [ ...n, { id: i + "minute", value: [...r] }, { id: i + "hour", value: ["minute", ...r] }, { id: "day", value: ["hour", "minute", ...r] }, { id: "week", value: ["dayOfWeek", "hour", "minute", ...r] }, { id: "month", value: ["day", "dayOfWeek", "hour", "minute", ...r] }, { id: "year", value: ["month", "day", "dayOfWeek", "hour", "minute", ...r] } ]; } } function _e(a, e, t) { const n = e.split(" "); if (n.length !== t.length) return; const r = t.filter((i, s) => !["*", "?"].includes(n[s])).map((i) => i.id); return a.find((i) => { const s = new Set(i.value); return r.every((u) => s.has(u)); }); } function et(a) { const e = new Ze(), t = a.locale ?? e.locale, n = a.format ?? e.format, { customLocale: r, fields: i = e.fields(n, t) } = a, s = a.initialValue ?? e.initialValue(i), u = Ke(t, r), o = (a.periods ?? e.periods(n)).map((c) => ({ ...c, text: c.text ?? u.getTemplate(c.id, $.Text) })), x = (a.initialPeriod ? o.find((c) => c.id == a.initialPeriod) : void 0) ?? _e([...o].reverse(), s, i) ?? o[o.length - 1], h = k(s), p = k(""), y = k(x), T = k(""), A = k(""), l = i.map((c) => Ye({ field: new le(c, { format: n }), l10n: u, period: y })), m = new Map(l.map((c) => [c.id, c])), f = re(() => y.value.value.map((c) => { const S = m.get(c); if (Xe(S)) return S; throw Error("${fieldId} not found"); })), v = (c) => { if (!c) { h.value = ie(i); retur