@verbb/formie-core 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -1
- package/dist/accessibility.d.ts +5 -0
- package/dist/accessibility.d.ts.map +1 -0
- package/dist/browser-modules.d.ts +34 -0
- package/dist/browser-modules.d.ts.map +1 -0
- package/dist/condition-projections.d.ts +6 -0
- package/dist/condition-projections.d.ts.map +1 -0
- package/dist/condition-state.d.ts +13 -0
- package/dist/condition-state.d.ts.map +1 -0
- package/dist/conditions.d.ts +21 -7
- package/dist/conditions.d.ts.map +1 -1
- package/dist/contract.d.ts +4 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/date-parts-validation.d.ts +2 -2
- package/dist/date-parts-validation.d.ts.map +1 -1
- package/dist/event-names.d.ts +1 -1
- package/dist/event-names.d.ts.map +1 -1
- package/dist/events.d.ts +1 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/form-instance.d.ts +5 -5
- package/dist/form-instance.d.ts.map +1 -1
- package/dist/grants.d.ts +3 -0
- package/dist/grants.d.ts.map +1 -0
- package/dist/graphql.d.ts +9 -4
- package/dist/graphql.d.ts.map +1 -1
- package/dist/index.d.ts +22 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1870 -863
- package/dist/references.d.ts +43 -0
- package/dist/references.d.ts.map +1 -0
- package/dist/request-profile.d.ts +9 -0
- package/dist/request-profile.d.ts.map +1 -0
- package/dist/rest.d.ts +20 -4
- package/dist/rest.d.ts.map +1 -1
- package/dist/schema.d.ts +22 -22
- package/dist/schema.d.ts.map +1 -1
- package/dist/text.d.ts.map +1 -1
- package/dist/types.d.ts +125 -83
- package/dist/types.d.ts.map +1 -1
- package/dist/uploads.d.ts +5 -0
- package/dist/uploads.d.ts.map +1 -0
- package/dist/validation.d.ts +23 -0
- package/dist/validation.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5,64 +5,276 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
5
5
|
enumerable: !(s = n(i, d)) || s.enumerable
|
|
6
6
|
});
|
|
7
7
|
return e;
|
|
8
|
-
}, c = (n, r,
|
|
8
|
+
}, c = (n, r, o) => (o = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
|
|
9
9
|
value: n,
|
|
10
10
|
enumerable: !0
|
|
11
|
-
}) :
|
|
11
|
+
}) : o, n));
|
|
12
12
|
//#endregion
|
|
13
|
-
//#region src/
|
|
14
|
-
function l(e) {
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
13
|
+
//#region src/condition-projections.ts
|
|
14
|
+
function l(e, t, n) {
|
|
15
|
+
let r = t.scope;
|
|
16
|
+
if (r === "count") return { value: e.length };
|
|
17
|
+
if (r === "all") return { value: e };
|
|
18
|
+
if (r === "first") return { value: e[0] ?? null };
|
|
19
|
+
if (r === "last") return { value: e[e.length - 1] ?? null };
|
|
20
|
+
if (r === "current" || r === "index") {
|
|
21
|
+
let i = r === "current" ? n : /^[0-9]+$/.test(t.index ?? "") ? Number(t.index) : void 0;
|
|
22
|
+
return i !== void 0 && i >= 0 && i < e.length ? { value: e[i] } : { diagnostic: "invalidRowScope" };
|
|
23
|
+
}
|
|
24
|
+
if (r === "rows") {
|
|
25
|
+
let n = t.rows ?? "";
|
|
26
|
+
if (!/^(?:even|odd|every:[1-9]\d*|[1-9]\d*(?:\s*-\s*[1-9]\d*)?(?:\s*,\s*[1-9]\d*(?:\s*-\s*[1-9]\d*)?)*)$/.test(n)) return { diagnostic: "invalidRowScope" };
|
|
27
|
+
let r = e.filter((e, t) => n === "even" ? t % 2 == 1 : n === "odd" ? t % 2 == 0 : n.startsWith("every:") ? t % Number(n.slice(6)) === 0 : n.split(",").some((e) => {
|
|
28
|
+
let [n, r = n] = e.split("-").map(Number);
|
|
29
|
+
return t + 1 >= Math.min(n, r) && t + 1 <= Math.max(n, r);
|
|
30
|
+
}));
|
|
31
|
+
return { value: r.length === 1 ? r[0] : r };
|
|
32
|
+
}
|
|
33
|
+
return { diagnostic: "missingRowScope" };
|
|
34
34
|
}
|
|
35
|
+
var u = {
|
|
36
|
+
version: 1,
|
|
37
|
+
operators: {
|
|
38
|
+
"=": [
|
|
39
|
+
"text",
|
|
40
|
+
"number",
|
|
41
|
+
"boolean",
|
|
42
|
+
"date",
|
|
43
|
+
"time",
|
|
44
|
+
"datetime",
|
|
45
|
+
"collection"
|
|
46
|
+
],
|
|
47
|
+
"!=": [
|
|
48
|
+
"text",
|
|
49
|
+
"number",
|
|
50
|
+
"boolean",
|
|
51
|
+
"date",
|
|
52
|
+
"time",
|
|
53
|
+
"datetime",
|
|
54
|
+
"collection"
|
|
55
|
+
],
|
|
56
|
+
">": [
|
|
57
|
+
"text",
|
|
58
|
+
"number",
|
|
59
|
+
"date",
|
|
60
|
+
"time",
|
|
61
|
+
"datetime"
|
|
62
|
+
],
|
|
63
|
+
"<": [
|
|
64
|
+
"text",
|
|
65
|
+
"number",
|
|
66
|
+
"date",
|
|
67
|
+
"time",
|
|
68
|
+
"datetime"
|
|
69
|
+
],
|
|
70
|
+
contains: ["text", "collection"],
|
|
71
|
+
notContains: ["text", "collection"],
|
|
72
|
+
startsWith: ["text"],
|
|
73
|
+
endsWith: ["text"],
|
|
74
|
+
empty: [
|
|
75
|
+
"text",
|
|
76
|
+
"number",
|
|
77
|
+
"boolean",
|
|
78
|
+
"date",
|
|
79
|
+
"time",
|
|
80
|
+
"datetime",
|
|
81
|
+
"collection"
|
|
82
|
+
],
|
|
83
|
+
notEmpty: [
|
|
84
|
+
"text",
|
|
85
|
+
"number",
|
|
86
|
+
"boolean",
|
|
87
|
+
"date",
|
|
88
|
+
"time",
|
|
89
|
+
"datetime",
|
|
90
|
+
"collection"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
}, d = (e) => ({
|
|
94
|
+
value: null,
|
|
95
|
+
diagnostics: [{ code: e }]
|
|
96
|
+
}), f = (e) => typeof e == "number" && !Number.isFinite(e) ? null : e == null ? "" : [
|
|
97
|
+
"string",
|
|
98
|
+
"number",
|
|
99
|
+
"boolean"
|
|
100
|
+
].includes(typeof e) ? String(e) : null, p = (e) => e.replace(/^[ \t\r\n\v\f]+|[ \t\r\n\v\f]+$/g, "");
|
|
35
101
|
function m(e) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
102
|
+
if (!["number", "string"].includes(typeof e) || !/^[+-]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/.test(p(String(e)))) return null;
|
|
103
|
+
let t = Number(e);
|
|
104
|
+
return Number.isFinite(t) ? t : null;
|
|
105
|
+
}
|
|
106
|
+
function h(e, t) {
|
|
107
|
+
if (t === "text") return f(e);
|
|
108
|
+
if (t === "number") return m(e);
|
|
109
|
+
if (t === "boolean") {
|
|
110
|
+
if (typeof e == "boolean") return e;
|
|
111
|
+
let t = p(f(e) ?? "").toLowerCase();
|
|
112
|
+
return [
|
|
113
|
+
"true",
|
|
114
|
+
"1",
|
|
115
|
+
"yes",
|
|
116
|
+
"on"
|
|
117
|
+
].includes(t) ? !0 : ![
|
|
118
|
+
"false",
|
|
119
|
+
"0",
|
|
120
|
+
"no",
|
|
121
|
+
"off"
|
|
122
|
+
].includes(t) && null;
|
|
123
|
+
}
|
|
124
|
+
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
125
|
+
let n = e;
|
|
126
|
+
if ((t === "date" ? [
|
|
127
|
+
"year",
|
|
128
|
+
"month",
|
|
129
|
+
"day"
|
|
130
|
+
] : t === "time" ? ["hour", "minute"] : [
|
|
131
|
+
"year",
|
|
132
|
+
"month",
|
|
133
|
+
"day",
|
|
134
|
+
"hour",
|
|
135
|
+
"minute"
|
|
136
|
+
]).some((e) => !/^[0-9]+$/.test(String(n[e]))) || "_input" in n || n.second != null && !/^[0-9]+$/.test(String(n.second))) return null;
|
|
137
|
+
let r = Number(n.hour ?? 0);
|
|
138
|
+
if (n.ampm != null) {
|
|
139
|
+
if (!["AM", "PM"].includes(String(n.ampm)) || r < 1 || r > 12) return null;
|
|
140
|
+
r = r % 12 + (n.ampm === "PM" ? 12 : 0);
|
|
141
|
+
}
|
|
142
|
+
let i = `${String(n.year ?? 1970).padStart(4, "0")}-${String(n.month ?? 1).padStart(2, "0")}-${String(n.day ?? 1).padStart(2, "0")}`, a = `${String(r).padStart(2, "0")}:${String(n.minute ?? 0).padStart(2, "0")}:${String(n.second ?? 0).padStart(2, "0")}`;
|
|
143
|
+
if (t === "datetime") {
|
|
144
|
+
if (h(i, "date") === null || h(a, "time") === null) return null;
|
|
145
|
+
let e = String(n.timezone ?? "UTC");
|
|
146
|
+
if (/^(Z|[+-][0-9]{2}:[0-9]{2})$/.test(e)) return h(`${i}T${a}${e}`, "datetime");
|
|
147
|
+
try {
|
|
148
|
+
let t = Date.parse(`${i}T${a}Z`), n = new Intl.DateTimeFormat("en-GB", {
|
|
149
|
+
timeZone: e,
|
|
150
|
+
year: "numeric",
|
|
151
|
+
month: "2-digit",
|
|
152
|
+
day: "2-digit",
|
|
153
|
+
hour: "2-digit",
|
|
154
|
+
minute: "2-digit",
|
|
155
|
+
second: "2-digit",
|
|
156
|
+
hourCycle: "h23"
|
|
157
|
+
}), r = (e) => {
|
|
158
|
+
let t = Object.fromEntries(n.formatToParts(e).map((e) => [e.type, e.value]));
|
|
159
|
+
return Date.parse(`${t.year.padStart(4, "0")}-${t.month}-${t.day}T${t.hour}:${t.minute}:${t.second}Z`);
|
|
160
|
+
}, o = new Set([
|
|
161
|
+
-864e5,
|
|
162
|
+
0,
|
|
163
|
+
864e5
|
|
164
|
+
].map((e) => t - (r(t + e) - (t + e))).filter((e) => r(e) === t));
|
|
165
|
+
return o.size === 1 ? [...o][0] / 1e3 : null;
|
|
166
|
+
} catch {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
e = t === "date" ? i : a;
|
|
54
171
|
}
|
|
172
|
+
if (typeof e != "string") return null;
|
|
173
|
+
if (t === "time") {
|
|
174
|
+
let t = e.match(/^([0-9]{2}):([0-9]{2})(?::([0-9]{2}))?$/);
|
|
175
|
+
return t && Number(t[1]) < 24 && Number(t[2]) < 60 && Number(t[3] ?? 0) < 60 ? Number(t[1]) * 3600 + Number(t[2]) * 60 + Number(t[3] ?? 0) : null;
|
|
176
|
+
}
|
|
177
|
+
let n = e.match(t === "date" ? /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/ : /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[+-][0-9]{2}:[0-9]{2})$/);
|
|
178
|
+
if (!n || Number(n[1]) < 1) return null;
|
|
179
|
+
let r = Number(n[1]), i = [
|
|
180
|
+
31,
|
|
181
|
+
r % 4 == 0 && (r % 100 != 0 || r % 400 == 0) ? 29 : 28,
|
|
182
|
+
31,
|
|
183
|
+
30,
|
|
184
|
+
31,
|
|
185
|
+
30,
|
|
186
|
+
31,
|
|
187
|
+
31,
|
|
188
|
+
30,
|
|
189
|
+
31,
|
|
190
|
+
30,
|
|
191
|
+
31
|
|
192
|
+
];
|
|
193
|
+
if (Number(n[2]) < 1 || Number(n[2]) > 12 || Number(n[3]) < 1 || Number(n[3]) > i[Number(n[2]) - 1] || t === "datetime" && (Number(n[4]) > 23 || Number(n[5]) > 59 || Number(n[6]) > 59 || n[7] !== "Z" && (Number(n[7].slice(1, 3)) > 23 || Number(n[7].slice(4)) > 59))) return null;
|
|
194
|
+
let a = Date.parse(t === "date" ? `${e}T00:00:00Z` : e);
|
|
195
|
+
return Number.isFinite(a) ? a / 1e3 : null;
|
|
196
|
+
}
|
|
197
|
+
function g(e) {
|
|
198
|
+
return e && typeof e == "object" ? Object.values(e).flatMap(g) : [e];
|
|
55
199
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
200
|
+
function _(e, t, n, r = "text") {
|
|
201
|
+
if (!u.operators[e]?.includes(r)) return d("unsupportedOperator");
|
|
202
|
+
if (e === "empty" || e === "notEmpty") {
|
|
203
|
+
if (t && typeof t == "object" && !Array.isArray(t) && ![
|
|
204
|
+
"collection",
|
|
205
|
+
"date",
|
|
206
|
+
"time",
|
|
207
|
+
"datetime"
|
|
208
|
+
].includes(r)) return d("invalidValue");
|
|
209
|
+
let n = t == null || typeof t == "object" && !!t && Object.keys(t).length === 0 || typeof t == "string" && p(t) === "";
|
|
210
|
+
return {
|
|
211
|
+
value: e === "empty" ? n : !n,
|
|
212
|
+
diagnostics: []
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
if (r === "collection") {
|
|
216
|
+
if (t != null && typeof t != "object") return d("invalidValue");
|
|
217
|
+
let r = g(t ?? []), i = Array.isArray(n) ? n : [n];
|
|
218
|
+
if ([...r, ...i].some((e) => f(e) === null)) return d("invalidValue");
|
|
219
|
+
let a = r.some((e) => i.some((t) => f(e) === f(t)));
|
|
220
|
+
return {
|
|
221
|
+
value: ["!=", "notContains"].includes(e) ? !a : a,
|
|
222
|
+
diagnostics: []
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
let i = h(t, r), a = h(n, r);
|
|
226
|
+
if (i === null || a === null) return d("invalidValue");
|
|
227
|
+
let o = r === "text" ? ((e, t) => {
|
|
228
|
+
let n = Array.from(e, (e) => e.codePointAt(0)), r = Array.from(t, (e) => e.codePointAt(0));
|
|
229
|
+
for (let e = 0; e < Math.min(n.length, r.length); e++) if (n[e] !== r[e]) return n[e] - r[e];
|
|
230
|
+
return n.length - r.length;
|
|
231
|
+
})(String(i), String(a)) : i === a ? 0 : i > a ? 1 : -1;
|
|
58
232
|
return {
|
|
59
|
-
|
|
60
|
-
|
|
233
|
+
value: {
|
|
234
|
+
"=": i === a,
|
|
235
|
+
"!=": i !== a,
|
|
236
|
+
">": o > 0,
|
|
237
|
+
"<": o < 0,
|
|
238
|
+
contains: String(i).includes(String(a)),
|
|
239
|
+
notContains: !String(i).includes(String(a)),
|
|
240
|
+
startsWith: String(i).startsWith(String(a)),
|
|
241
|
+
endsWith: String(i).endsWith(String(a))
|
|
242
|
+
}[e],
|
|
243
|
+
diagnostics: []
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function v(e, t) {
|
|
247
|
+
let n = t.flatMap((e, t) => e.diagnostics.map((e) => ({
|
|
248
|
+
...e,
|
|
249
|
+
rule: t
|
|
250
|
+
})));
|
|
251
|
+
return ["all", "any"].includes(e) ? n.length || t.some((e) => e.value === null) ? {
|
|
252
|
+
value: null,
|
|
253
|
+
diagnostics: n
|
|
254
|
+
} : {
|
|
255
|
+
value: e === "all" ? t.every((e) => e.value === !0) : t.some((e) => e.value === !0),
|
|
256
|
+
diagnostics: []
|
|
257
|
+
} : d("invalidSchema");
|
|
258
|
+
}
|
|
259
|
+
function y(e, t, n = {}) {
|
|
260
|
+
if (e.browserSafe === !1) return d("serverOnlyReference");
|
|
261
|
+
let r = e.valueType ?? (t.length > 1 ? "collection" : "text");
|
|
262
|
+
return _(e.condition, r === "collection" ? t : t[0] ?? null, e.value, r);
|
|
263
|
+
}
|
|
264
|
+
function b(e, t) {
|
|
265
|
+
let n = v(e.conditionRule, t.map((e) => typeof e == "boolean" ? {
|
|
266
|
+
value: e,
|
|
267
|
+
diagnostics: []
|
|
268
|
+
} : e)), r = n.value === !0;
|
|
269
|
+
return {
|
|
270
|
+
finalResult: r,
|
|
271
|
+
shouldHide: ["show", "enable"].includes(e.showRule) ? !r : r,
|
|
272
|
+
evaluation: n
|
|
61
273
|
};
|
|
62
274
|
}
|
|
63
275
|
//#endregion
|
|
64
276
|
//#region src/schema.ts
|
|
65
|
-
var
|
|
277
|
+
var ee = /* @__PURE__ */ new Set([
|
|
66
278
|
"single-line-text",
|
|
67
279
|
"multi-line-text",
|
|
68
280
|
"number",
|
|
@@ -79,51 +291,54 @@ var _ = new Set([
|
|
|
79
291
|
"signature",
|
|
80
292
|
"file"
|
|
81
293
|
]);
|
|
82
|
-
function
|
|
294
|
+
function x(e) {
|
|
83
295
|
return e.pages.flatMap((e) => e.rows.flatMap((e) => e.fields));
|
|
84
296
|
}
|
|
85
|
-
function
|
|
86
|
-
return
|
|
297
|
+
function S(e, t) {
|
|
298
|
+
return x(e).find((e) => e.id === t);
|
|
87
299
|
}
|
|
88
|
-
function
|
|
89
|
-
return
|
|
300
|
+
function C(e, t) {
|
|
301
|
+
return x(e).find((e) => e.handle === t);
|
|
90
302
|
}
|
|
91
|
-
function
|
|
92
|
-
return Object.fromEntries(Object.entries(t).map(([t, n]) => [
|
|
303
|
+
function w(e, t) {
|
|
304
|
+
return Object.fromEntries(Object.entries(t).map(([t, n]) => [S(e, t)?.handle ?? t, n]));
|
|
93
305
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
306
|
+
function T(e) {
|
|
307
|
+
return ee.has(e);
|
|
96
308
|
}
|
|
97
|
-
function
|
|
98
|
-
if (!e.
|
|
99
|
-
return
|
|
309
|
+
function te(e) {
|
|
310
|
+
if (!e.client?.children) throw Error(`Field "${e.handle}" is missing client-rendered value metadata. Update Formie and its packages together.`);
|
|
311
|
+
return {
|
|
312
|
+
structure: e.client.children.model,
|
|
313
|
+
valueType: e.client.valueType
|
|
314
|
+
};
|
|
100
315
|
}
|
|
101
|
-
function
|
|
102
|
-
return
|
|
316
|
+
function ne(e) {
|
|
317
|
+
return te(e).structure;
|
|
103
318
|
}
|
|
104
|
-
function
|
|
105
|
-
return
|
|
319
|
+
function E(e) {
|
|
320
|
+
return ne(e) === "fixed-parent" && ae(e).length > 0;
|
|
106
321
|
}
|
|
107
|
-
function
|
|
108
|
-
return
|
|
322
|
+
function D(e) {
|
|
323
|
+
return ne(e) === "repeatable-parent";
|
|
109
324
|
}
|
|
110
|
-
function
|
|
325
|
+
function O(e) {
|
|
111
326
|
return e.type === "file" || e.input.fieldKind === "file";
|
|
112
327
|
}
|
|
113
|
-
function
|
|
328
|
+
function k(e) {
|
|
114
329
|
let t = e.input;
|
|
115
|
-
return
|
|
330
|
+
return O(e) || e.type === "checkboxes" || e.type === "dropdown" && t.multiple === !0;
|
|
116
331
|
}
|
|
117
|
-
function
|
|
332
|
+
function re(e) {
|
|
118
333
|
return e.type === "agree" || e.input.fieldKind === "boolean";
|
|
119
334
|
}
|
|
120
|
-
function
|
|
335
|
+
function ie(e) {
|
|
121
336
|
return e.type === "number";
|
|
122
337
|
}
|
|
123
|
-
function
|
|
338
|
+
function A(e) {
|
|
124
339
|
return e.type === "email";
|
|
125
340
|
}
|
|
126
|
-
function
|
|
341
|
+
function ae(e) {
|
|
127
342
|
let t = e.input;
|
|
128
343
|
return Array.isArray(t.parts) ? t.parts.filter((e) => !!e && typeof e == "object" && "handle" in e && "type" in e) : [];
|
|
129
344
|
}
|
|
@@ -144,19 +359,19 @@ function N(e) {
|
|
|
144
359
|
if (r) return r.value ?? "";
|
|
145
360
|
}
|
|
146
361
|
if (e.type === "agree") return t.defaultValue ?? !1;
|
|
147
|
-
if (
|
|
148
|
-
if (
|
|
362
|
+
if (E(e)) return t.defaultValue && typeof t.defaultValue == "object" ? t.defaultValue : {};
|
|
363
|
+
if (D(e)) {
|
|
149
364
|
let n = Number(t.minRows ?? 0) || 0;
|
|
150
|
-
return n <= 0 ? [] : Array.from({ length: n }, () =>
|
|
365
|
+
return n <= 0 ? [] : Array.from({ length: n }, () => oe(e));
|
|
151
366
|
}
|
|
152
|
-
return
|
|
367
|
+
return O(e) || k(e) ? [] : (e.type, t.defaultValue ?? "");
|
|
153
368
|
}
|
|
154
|
-
function
|
|
369
|
+
function oe(e) {
|
|
155
370
|
return Object.fromEntries(M(e).map((e) => [e.handle, N(e)]));
|
|
156
371
|
}
|
|
157
372
|
function P(e, t) {
|
|
158
|
-
if (e.type === "checkboxes" ||
|
|
159
|
-
if (
|
|
373
|
+
if (e.type === "checkboxes" || O(e) || k(e)) return Array.isArray(t) ? t.flatMap((t) => P(e, t)) : [];
|
|
374
|
+
if (D(e)) {
|
|
160
375
|
let n = Array.isArray(t) ? t : [], r = M(e);
|
|
161
376
|
return n.flatMap((e) => {
|
|
162
377
|
if (!e || typeof e != "object") return [];
|
|
@@ -164,90 +379,300 @@ function P(e, t) {
|
|
|
164
379
|
return r.flatMap((e) => P(e, t[e.handle]));
|
|
165
380
|
});
|
|
166
381
|
}
|
|
167
|
-
return
|
|
382
|
+
return E(e) && t && typeof t == "object" ? Object.values(t).flatMap((t) => P(e, t)) : t == null ? [] : typeof t == "boolean" ? t ? ["true"] : ["false"] : Array.isArray(t) ? t.flatMap((t) => P(e, t)) : [String(t)];
|
|
168
383
|
}
|
|
169
|
-
function
|
|
384
|
+
function se(e) {
|
|
170
385
|
return typeof Blob < "u" && e instanceof Blob;
|
|
171
386
|
}
|
|
172
|
-
async function
|
|
173
|
-
return new Promise((t, n) => {
|
|
174
|
-
let r = new FileReader();
|
|
175
|
-
r.onerror = () => {
|
|
176
|
-
n(r.error || /* @__PURE__ */ Error("Unable to read file."));
|
|
177
|
-
}, r.onload = () => {
|
|
178
|
-
t(typeof r.result == "string" ? r.result : "");
|
|
179
|
-
}, r.readAsDataURL(e);
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
async function ie(e) {
|
|
387
|
+
async function ce(e) {
|
|
183
388
|
let t = Array.isArray(e) ? e : [];
|
|
184
|
-
return (await Promise.all(t.map(async (e) =>
|
|
185
|
-
assetId: e
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
389
|
+
return (await Promise.all(t.map(async (e) => {
|
|
390
|
+
if (typeof e == "number") return { assetId: e };
|
|
391
|
+
if (e && typeof e == "object" && typeof e.uploadUid == "string" && typeof e.attachToken == "string") return {
|
|
392
|
+
uploadUid: e.uploadUid,
|
|
393
|
+
attachToken: e.attachToken
|
|
394
|
+
};
|
|
395
|
+
if (e && typeof e == "object" && "assetId" in e && typeof e.assetId == "number") return {
|
|
396
|
+
assetId: e.assetId,
|
|
397
|
+
filename: typeof e.filename == "string" ? e.filename : void 0
|
|
398
|
+
};
|
|
399
|
+
if (e && typeof e == "object" && "fileData" in e && typeof e.fileData == "string") return {
|
|
400
|
+
fileData: e.fileData,
|
|
401
|
+
filename: typeof e.filename == "string" ? e.filename : void 0
|
|
402
|
+
};
|
|
403
|
+
if (se(e)) throw Error("Files must be staged before serialization. Use a Formie REST or GraphQL transport.");
|
|
404
|
+
return null;
|
|
405
|
+
}))).filter((e) => e !== null);
|
|
406
|
+
}
|
|
407
|
+
async function le(e, t) {
|
|
196
408
|
let n = t && typeof t == "object" ? t : {}, r = { ...n };
|
|
197
409
|
return await Promise.all(e.map(async (e) => {
|
|
198
|
-
r[e.handle] = await
|
|
410
|
+
r[e.handle] = await de(e, n[e.handle]);
|
|
199
411
|
})), r;
|
|
200
412
|
}
|
|
201
|
-
async function
|
|
413
|
+
async function ue(e, t) {
|
|
202
414
|
let n = M(e);
|
|
203
|
-
return n.length === 0 || !Array.isArray(t) ? [] : Promise.all(t.map(async (e) =>
|
|
415
|
+
return n.length === 0 || !Array.isArray(t) ? [] : Promise.all(t.map(async (e) => le(n, e)));
|
|
204
416
|
}
|
|
205
|
-
async function
|
|
206
|
-
return
|
|
417
|
+
async function de(e, t) {
|
|
418
|
+
return O(e) ? ce(t) : D(e) ? ue(e, t) : E(e) ? le(ae(e), t) : t;
|
|
207
419
|
}
|
|
208
|
-
async function
|
|
420
|
+
async function fe(e, t) {
|
|
209
421
|
let n = await Promise.all(Object.entries(t).map(async ([t, n]) => {
|
|
210
|
-
let r =
|
|
211
|
-
return r ? [r.handle, await
|
|
422
|
+
let r = S(e, t);
|
|
423
|
+
return r ? [r.handle, await de(r, n)] : [t, n];
|
|
212
424
|
}));
|
|
213
425
|
return Object.fromEntries(n);
|
|
214
426
|
}
|
|
215
427
|
//#endregion
|
|
428
|
+
//#region src/condition-state.ts
|
|
429
|
+
var pe = (e) => [
|
|
430
|
+
"show",
|
|
431
|
+
"hide",
|
|
432
|
+
"enable",
|
|
433
|
+
"disable"
|
|
434
|
+
].includes(e ?? "") ? e : "show";
|
|
435
|
+
function me(e) {
|
|
436
|
+
let t = [], n = (e, r, i, a, o) => {
|
|
437
|
+
t.push({
|
|
438
|
+
field: e,
|
|
439
|
+
key: i,
|
|
440
|
+
path: a,
|
|
441
|
+
parent: o
|
|
442
|
+
}), D(e) ? (Array.isArray(r) ? r : []).forEach((t, r) => M(e).forEach((e) => n(e, t?.[e.handle], `${i}.${r}.${e.handle}`, [
|
|
443
|
+
...a,
|
|
444
|
+
String(r),
|
|
445
|
+
e.handle
|
|
446
|
+
], i))) : ae(e).forEach((e) => n(e, r?.[e.handle], `${i}.${e.handle}`, [...a, e.handle], i));
|
|
447
|
+
};
|
|
448
|
+
return x(e.definition).forEach((t) => n(t, e.values[t.id], t.id, [t.handle])), t;
|
|
449
|
+
}
|
|
450
|
+
function he(e, t) {
|
|
451
|
+
let [n, ...r] = t.key.split(".");
|
|
452
|
+
return r.reduce((e, t) => e && typeof e == "object" ? e[t] : null, e.values[n]);
|
|
453
|
+
}
|
|
454
|
+
function ge(e, t, n) {
|
|
455
|
+
let r = t.filter((t) => t.field.id === e.fieldId || t.field.handle === e.fieldId || t.path.filter((e) => !/^\d+$/.test(e)).join(".") === e.source?.handle);
|
|
456
|
+
return r.find((e) => e.parent && e.parent === n?.parent) ?? r.find((e) => !e.parent) ?? (r.length === 1 ? r[0] : void 0);
|
|
457
|
+
}
|
|
458
|
+
function F(e, t, n) {
|
|
459
|
+
if (!e) return {
|
|
460
|
+
value: !0,
|
|
461
|
+
diagnostics: []
|
|
462
|
+
};
|
|
463
|
+
if (e.version != null && e.version !== 1 || ![
|
|
464
|
+
"show",
|
|
465
|
+
"hide",
|
|
466
|
+
"enable",
|
|
467
|
+
"disable"
|
|
468
|
+
].includes(e.effect)) return {
|
|
469
|
+
value: null,
|
|
470
|
+
diagnostics: [{ code: "invalidSchema" }]
|
|
471
|
+
};
|
|
472
|
+
let r = me(t);
|
|
473
|
+
return v(e.mode, e.rules.map((e) => {
|
|
474
|
+
let i = ge(e, r, n);
|
|
475
|
+
if (e.browserSafe === !1 || !i) return {
|
|
476
|
+
value: null,
|
|
477
|
+
diagnostics: [{ code: e.browserSafe === !1 ? "serverOnlyReference" : "unresolvedReference" }]
|
|
478
|
+
};
|
|
479
|
+
if (e.source?.transformerId) return {
|
|
480
|
+
value: null,
|
|
481
|
+
diagnostics: [{ code: "serverOnlyReference" }]
|
|
482
|
+
};
|
|
483
|
+
let a = he(t, i), o = (e.source?.selector ?? "").split(/[.:]/).filter(Boolean), s = { ...e.source?.transformerParams ?? {} }, c = (e, t) => t.reduce((e, t) => e && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0, e);
|
|
484
|
+
if (D(i.field) && (o.length || s.scope)) {
|
|
485
|
+
/^[0-9]+$/.test(o[0] ?? "") && !s.scope && (s.scope = "index", s.index = o.shift());
|
|
486
|
+
let e = (Array.isArray(a) ? a : []).map((e) => c(e, o));
|
|
487
|
+
if (e.some((e) => e === void 0)) return {
|
|
488
|
+
value: null,
|
|
489
|
+
diagnostics: [{ code: "invalidSelector" }]
|
|
490
|
+
};
|
|
491
|
+
let t = n?.path[i.path.length], r = l(e, s, t != null && /^[0-9]+$/.test(t) ? Number(t) : void 0);
|
|
492
|
+
if (r.diagnostic) return {
|
|
493
|
+
value: null,
|
|
494
|
+
diagnostics: [{ code: r.diagnostic }]
|
|
495
|
+
};
|
|
496
|
+
a = s.scope === "rows" && !Array.isArray(r.value) ? [r.value] : r.value;
|
|
497
|
+
} else if (o.length) {
|
|
498
|
+
if (i.field.input.fieldKind === "options" && o.length === 1 && ["label", "value"].includes(o[0])) {
|
|
499
|
+
if (o[0] === "label") {
|
|
500
|
+
let e = i.field.input.options ?? [], t = (t) => e.find((e) => String(e.value) === String(t))?.label;
|
|
501
|
+
a = Array.isArray(a) ? a.map(t) : t(a);
|
|
502
|
+
}
|
|
503
|
+
} else ["date", "time"].includes(o[0]) && i.field.type === "date" || (a = c(a, o));
|
|
504
|
+
if (a === void 0) return {
|
|
505
|
+
value: null,
|
|
506
|
+
diagnostics: [{ code: "invalidSelector" }]
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
(a == null || a === "" || Array.isArray(a) && !a.length) && e.source?.defaultValue && (a = e.source.defaultValue);
|
|
510
|
+
let u = i.field.client?.valueType?.kind, d = e.valueType ?? (u === "boolean" ? "boolean" : Array.isArray(a) ? "collection" : "text");
|
|
511
|
+
return _(e.operator, a, e.value, d);
|
|
512
|
+
}));
|
|
513
|
+
}
|
|
514
|
+
function _e(e) {
|
|
515
|
+
let t = e.definition.pages.find((t) => t.id === e.currentPageId)?.actions.primary.condition;
|
|
516
|
+
if (!t) return !0;
|
|
517
|
+
let n = F(t, e);
|
|
518
|
+
return n.value !== null && n.value === (t.effect === "show" || t.effect === "enable");
|
|
519
|
+
}
|
|
520
|
+
function ve(e) {
|
|
521
|
+
let t = (e) => Array.isArray(e) ? e.map(t) : e && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, t(n)])) : e, n = {
|
|
522
|
+
...e,
|
|
523
|
+
values: t(e.values),
|
|
524
|
+
fieldStates: {},
|
|
525
|
+
pageStates: {}
|
|
526
|
+
}, r = me(n), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = (e) => {
|
|
527
|
+
if (a.has(e.key)) return;
|
|
528
|
+
if (i.has(e.key)) {
|
|
529
|
+
n.fieldStates[e.key] = {
|
|
530
|
+
hidden: !0,
|
|
531
|
+
disabled: !0
|
|
532
|
+
};
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
if (i.add(e.key), e.parent) {
|
|
536
|
+
let t = r.find((t) => t.key === e.parent);
|
|
537
|
+
t && o(t);
|
|
538
|
+
}
|
|
539
|
+
let t = n.definition.pages.find((t) => t.rows.some((t) => t.fields.some((t) => t.id === e.key.split(".")[0])));
|
|
540
|
+
for (let n of [...e.field.condition?.rules ?? [], ...t?.condition?.rules ?? []]) {
|
|
541
|
+
let t = ge(n, r, e);
|
|
542
|
+
t && (o(t), n.source?.selector || r.filter((e) => e.key.startsWith(`${t.key}.`)).forEach(o));
|
|
543
|
+
}
|
|
544
|
+
let s = F(e.field.condition, n, e), c = pe(e.field.condition?.effect), l = e.field.condition ? ["show", "enable"].includes(c) ? s.value !== !0 : s.value === !0 : !1, u = F(t?.condition, n), d = t?.condition ? ["show", "enable"].includes(pe(t.condition.effect)) ? u.value !== !0 : u.value === !0 : !1, f = e.parent ? n.fieldStates[e.parent]?.hidden === !0 : !1, p = n.fieldStates[e.key]?.hidden === !0 || e.field.meta?.hidden === !0 || f || d || ["show", "hide"].includes(c) && l, m = e.field.meta?.disabled === !0 || (e.parent ? n.fieldStates[e.parent]?.disabled === !0 : !1) || ["enable", "disable"].includes(c) && l;
|
|
545
|
+
if (n.fieldStates[e.key] = {
|
|
546
|
+
hidden: p,
|
|
547
|
+
disabled: m
|
|
548
|
+
}, (p || m) && (e.field.condition || f || d || m)) {
|
|
549
|
+
let [t, ...r] = e.key.split("."), i = n.values;
|
|
550
|
+
if (r.length) {
|
|
551
|
+
let e = i[t];
|
|
552
|
+
for (let t of r.slice(0, -1)) e = e && typeof e == "object" ? e[t] : null;
|
|
553
|
+
e && typeof e == "object" && (e[r[r.length - 1]] = null);
|
|
554
|
+
} else i[t] = D(e.field) ? [] : null;
|
|
555
|
+
}
|
|
556
|
+
i.delete(e.key), a.add(e.key);
|
|
557
|
+
};
|
|
558
|
+
r.forEach(o);
|
|
559
|
+
for (let e of n.definition.pages) {
|
|
560
|
+
let t = F(e.condition, n);
|
|
561
|
+
n.pageStates[e.id] = { hidden: e.condition ? ["show", "enable"].includes(pe(e.condition.effect)) ? t.value !== !0 : t.value === !0 : !1 };
|
|
562
|
+
}
|
|
563
|
+
return n.pageStates[n.currentPageId]?.hidden && (n.currentPageId = n.definition.pages.find((e) => !n.pageStates[e.id]?.hidden)?.id ?? n.currentPageId), n;
|
|
564
|
+
}
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region src/validation.ts
|
|
567
|
+
var ye = /* @__PURE__ */ new Map();
|
|
568
|
+
function be(e, t) {
|
|
569
|
+
return ye.set(e, t), () => {
|
|
570
|
+
ye.get(e) === t && ye.delete(e);
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
function xe(e) {
|
|
574
|
+
return e == null || e === !1 || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0;
|
|
575
|
+
}
|
|
576
|
+
function Se(e, t, n = {}) {
|
|
577
|
+
let r = n.empty ?? xe(e), i = n.label ?? "This field", a = (e, n) => t.messages?.[e] ?? t.message ?? n;
|
|
578
|
+
if (t.type === "required") return r ? a("required", `${i} cannot be blank.`) : null;
|
|
579
|
+
if (r) return null;
|
|
580
|
+
if (t.type === "email") return typeof e == "string" && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e) ? null : a("email", `${i} is not a valid email address.`);
|
|
581
|
+
if (t.type === "number") {
|
|
582
|
+
let n = m(e);
|
|
583
|
+
return n === null ? a("number", `${i} is not a valid number.`) : t.min != null && n < t.min ? a("numberMin", `${i} must be no less than ${t.min}.`) : t.max != null && n > t.max ? a("numberMax", `${i} must be no greater than ${t.max}.`) : null;
|
|
584
|
+
}
|
|
585
|
+
if (t.type === "url") {
|
|
586
|
+
try {
|
|
587
|
+
let t = new URL(String(e));
|
|
588
|
+
if (["http:", "https:"].includes(t.protocol)) return null;
|
|
589
|
+
} catch {}
|
|
590
|
+
return a("url", `${i} is not a valid URL.`);
|
|
591
|
+
}
|
|
592
|
+
if (t.type === "pattern") try {
|
|
593
|
+
let n = t.pattern instanceof RegExp ? t.pattern : typeof t.pattern == "string" ? RegExp(`^(?:${t.pattern})$`) : null;
|
|
594
|
+
return n ? (n.lastIndex = 0, n.test(String(e)) ? null : a("pattern", `${i} is not a valid format.`)) : null;
|
|
595
|
+
} catch {
|
|
596
|
+
return null;
|
|
597
|
+
}
|
|
598
|
+
if (t.type === "match") return n.comparison === void 0 || e === n.comparison ? null : a("match", `${i} must match ${n.comparisonLabel ?? "the other field"}.`);
|
|
599
|
+
if (t.type === "minmaxOptions" && Array.isArray(e)) {
|
|
600
|
+
if (t.min != null && e.length < t.min) return a("minOptions", `Please select at least ${t.min} options.`);
|
|
601
|
+
if (t.max != null && e.length > t.max) return a("maxOptions", `Please select no more than ${t.max} options.`);
|
|
602
|
+
}
|
|
603
|
+
return ye.get(t.type)?.(e, t, n) ?? null;
|
|
604
|
+
}
|
|
605
|
+
//#endregion
|
|
606
|
+
//#region src/browser-modules.ts
|
|
607
|
+
var Ce = 2;
|
|
608
|
+
function we(e) {
|
|
609
|
+
let t = e;
|
|
610
|
+
if (!t || t.contractVersion !== 2 || ![
|
|
611
|
+
"server-rendered",
|
|
612
|
+
"client-rendered",
|
|
613
|
+
"cp-edit"
|
|
614
|
+
].includes(t.surface) || !Array.isArray(t.entries)) throw Error("Unsupported browser module contractVersion. Update Formie and its browser packages together.");
|
|
615
|
+
let n = /* @__PURE__ */ new Set();
|
|
616
|
+
for (let e of t.entries) {
|
|
617
|
+
if (!e || typeof e.key != "string" || !e.key || n.has(e.key) || typeof e.moduleId != "string" || !/^[a-z][a-z0-9.-]*:[a-z][a-z0-9.-]*$/.test(e.moduleId) || "src" in e || !Array.isArray(e.targets) || e.targets.length === 0 || typeof e.required != "boolean" || !e.config || typeof e.config != "object" || Array.isArray(e.config) || ![
|
|
618
|
+
"field",
|
|
619
|
+
"captcha",
|
|
620
|
+
"payment",
|
|
621
|
+
"address",
|
|
622
|
+
"core"
|
|
623
|
+
].includes(e.kind)) throw Error("Invalid browser module entry. Check the registered module ID, occurrence key, kind and targets.");
|
|
624
|
+
for (let t of e.targets) {
|
|
625
|
+
let e = t && typeof t == "object" ? Object.keys(t).length : 0;
|
|
626
|
+
if (!(t && (t.type === "form" && e === 1 || t.type === "field" && e === 2 && typeof t.uid == "string" && t.uid !== "" || t.type === "page" && e === 2 && typeof t.id == "string" && t.id !== "" || t.type === "action" && e === 2 && typeof t.action == "string" && t.action !== "" || t.type === "selector" && e === 2 && typeof t.selector == "string" && t.selector !== ""))) throw Error("Invalid browser module target. Fields require a form-field instance UID.");
|
|
627
|
+
}
|
|
628
|
+
n.add(e.key);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region src/contract.ts
|
|
633
|
+
var Te = 1;
|
|
634
|
+
function Ee(e) {
|
|
635
|
+
let t = e;
|
|
636
|
+
if (!t || t.contractVersion !== 1) throw Error("Unsupported client-rendered contractVersion. Update Formie and the client-rendered packages together.");
|
|
637
|
+
if (!t.definition || !Array.isArray(t.definition.pages) || !t.session) throw Error("Invalid client-rendered bootstrap: definition, pages and session are required.");
|
|
638
|
+
we(t.definition.modules);
|
|
639
|
+
}
|
|
640
|
+
//#endregion
|
|
216
641
|
//#region src/date-parts-validation.ts
|
|
217
|
-
function
|
|
642
|
+
function I(e) {
|
|
218
643
|
return e == null ? "" : String(e).trim();
|
|
219
644
|
}
|
|
220
|
-
function
|
|
221
|
-
return
|
|
645
|
+
function L(e) {
|
|
646
|
+
return ae(e).filter((e) => e.meta?.hidden !== !0).map((e) => e.handle).filter((e) => [
|
|
222
647
|
"year",
|
|
223
648
|
"month",
|
|
224
649
|
"day"
|
|
225
650
|
].includes(e));
|
|
226
651
|
}
|
|
227
|
-
function
|
|
228
|
-
let n =
|
|
229
|
-
return n.length
|
|
652
|
+
function R(e, t) {
|
|
653
|
+
let n = L(t);
|
|
654
|
+
return n.length !== 0 && n.every((t) => I(e[t]) !== "");
|
|
230
655
|
}
|
|
231
|
-
function
|
|
656
|
+
function z(e, t, n) {
|
|
232
657
|
if (!Number.isInteger(e) || !Number.isInteger(t) || !Number.isInteger(n)) return !1;
|
|
233
658
|
let r = new Date(e, t - 1, n);
|
|
234
659
|
return r.getFullYear() === e && r.getMonth() === t - 1 && r.getDate() === n;
|
|
235
660
|
}
|
|
236
|
-
function
|
|
237
|
-
let t = Number.parseInt(
|
|
661
|
+
function De(e) {
|
|
662
|
+
let t = Number.parseInt(I(e.year), 10), n = Number.parseInt(I(e.month), 10), r = Number.parseInt(I(e.day), 10), i = I(e.hour) === "" ? 0 : Number.parseInt(I(e.hour), 10), a = I(e.minute) === "" ? 0 : Number.parseInt(I(e.minute), 10), o = I(e.second) === "" ? 0 : Number.parseInt(I(e.second), 10);
|
|
238
663
|
return new Date(t, n - 1, r, i, a, o);
|
|
239
664
|
}
|
|
240
|
-
function
|
|
665
|
+
function Oe(e, t, n, r) {
|
|
241
666
|
let i = e.validation.find((e) => e.type === "dateParts");
|
|
242
667
|
if (!i || e.input.dateEnabled === !1) return;
|
|
243
668
|
let a = t && typeof t == "object" ? t : {};
|
|
244
|
-
if (!
|
|
245
|
-
if (!
|
|
669
|
+
if (!R(a, e)) return;
|
|
670
|
+
if (!z(Number.parseInt(I(a.year), 10), Number.parseInt(I(a.month), 10), Number.parseInt(I(a.day), 10))) {
|
|
246
671
|
let e = `${n}.day`;
|
|
247
672
|
r[e] || (r[e] = ["Day is invalid."]);
|
|
248
673
|
return;
|
|
249
674
|
}
|
|
250
|
-
let o =
|
|
675
|
+
let o = De(a);
|
|
251
676
|
if (i.minDate) {
|
|
252
677
|
let e = new Date(i.minDate);
|
|
253
678
|
if (Number.isFinite(e.getTime()) && o < e) {
|
|
@@ -263,9 +688,7 @@ function ue(e, t, n, r) {
|
|
|
263
688
|
//#endregion
|
|
264
689
|
//#region src/events.ts
|
|
265
690
|
var B = class {
|
|
266
|
-
|
|
267
|
-
this.listeners = /* @__PURE__ */ new Map();
|
|
268
|
-
}
|
|
691
|
+
listeners = /* @__PURE__ */ new Map();
|
|
269
692
|
on(e, t) {
|
|
270
693
|
let n = this.listeners.get(e) ?? /* @__PURE__ */ new Set();
|
|
271
694
|
return n.add(t), this.listeners.set(e, n), () => {
|
|
@@ -295,8 +718,7 @@ function H(e) {
|
|
|
295
718
|
values: V(e.values),
|
|
296
719
|
errors: {
|
|
297
720
|
form: [...e.errors.form],
|
|
298
|
-
fields: Object.fromEntries(Object.entries(e.errors.fields).map(([e, t]) => [e, [...t]]))
|
|
299
|
-
pages: Object.fromEntries(Object.entries(e.errors.pages).map(([e, t]) => [e, [...t]]))
|
|
721
|
+
fields: Object.fromEntries(Object.entries(e.errors.fields).map(([e, t]) => [e, [...t]]))
|
|
300
722
|
},
|
|
301
723
|
fieldStates: Object.fromEntries(Object.entries(e.fieldStates).map(([e, t]) => [e, { ...t }])),
|
|
302
724
|
pageStates: Object.fromEntries(Object.entries(e.pageStates).map(([e, t]) => [e, { ...t }])),
|
|
@@ -304,8 +726,7 @@ function H(e) {
|
|
|
304
726
|
...e.lastSubmitResult,
|
|
305
727
|
errors: {
|
|
306
728
|
form: [...e.lastSubmitResult.errors.form],
|
|
307
|
-
fields: Object.fromEntries(Object.entries(e.lastSubmitResult.errors.fields).map(([e, t]) => [e, [...t]]))
|
|
308
|
-
pages: Object.fromEntries(Object.entries(e.lastSubmitResult.errors.pages).map(([e, t]) => [e, [...t]]))
|
|
729
|
+
fields: Object.fromEntries(Object.entries(e.lastSubmitResult.errors.fields).map(([e, t]) => [e, [...t]]))
|
|
309
730
|
},
|
|
310
731
|
messages: { ...e.lastSubmitResult.messages },
|
|
311
732
|
session: e.lastSubmitResult.session ? {
|
|
@@ -316,19 +737,19 @@ function H(e) {
|
|
|
316
737
|
} : null
|
|
317
738
|
};
|
|
318
739
|
}
|
|
319
|
-
function
|
|
320
|
-
return Object.fromEntries(
|
|
740
|
+
function U(e) {
|
|
741
|
+
return Object.fromEntries(x(e.definition).map((e) => [e.id, N(e)]));
|
|
321
742
|
}
|
|
322
|
-
function
|
|
323
|
-
return Object.fromEntries(
|
|
743
|
+
function ke(e) {
|
|
744
|
+
return Object.fromEntries(x(e).map((e) => [e.id, {
|
|
324
745
|
hidden: e.meta?.hidden === !0,
|
|
325
746
|
disabled: e.meta?.disabled === !0
|
|
326
747
|
}]));
|
|
327
748
|
}
|
|
328
|
-
function
|
|
749
|
+
function Ae(e) {
|
|
329
750
|
return Object.fromEntries(e.pages.map((e) => [e.id, { hidden: !1 }]));
|
|
330
751
|
}
|
|
331
|
-
function
|
|
752
|
+
function je(e, t) {
|
|
332
753
|
let n = e.definition.pages.find((e) => e.id === t);
|
|
333
754
|
if (!n) return [];
|
|
334
755
|
let r = [];
|
|
@@ -338,227 +759,109 @@ function W(e, t) {
|
|
|
338
759
|
});
|
|
339
760
|
}), r;
|
|
340
761
|
}
|
|
341
|
-
function
|
|
342
|
-
return
|
|
343
|
-
}
|
|
344
|
-
function K(e) {
|
|
345
|
-
let t = fe(e.definition);
|
|
346
|
-
return v(e.definition).forEach((n) => {
|
|
347
|
-
let r = n.condition;
|
|
348
|
-
if (!r || r.rules.length === 0) return;
|
|
349
|
-
let i = r.rules.map((n) => {
|
|
350
|
-
let r = G(e.definition, n), i = r ? t[r.id]?.hidden !== !0 : null;
|
|
351
|
-
return h({
|
|
352
|
-
condition: n.operator,
|
|
353
|
-
value: n.value
|
|
354
|
-
}, r ? P(r, e.values[r.id]) : [], { visibility: i });
|
|
355
|
-
});
|
|
356
|
-
if (r.effect === "show" || r.effect === "hide") {
|
|
357
|
-
let { shouldHide: e } = g({
|
|
358
|
-
conditionRule: r.mode,
|
|
359
|
-
showRule: r.effect === "show" ? "show" : "hide"
|
|
360
|
-
}, i);
|
|
361
|
-
t[n.id] = {
|
|
362
|
-
...t[n.id],
|
|
363
|
-
hidden: t[n.id].hidden || e
|
|
364
|
-
};
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
let a = r.mode === "any" ? i.includes(!0) : i.every((e) => e === !0);
|
|
368
|
-
t[n.id] = {
|
|
369
|
-
...t[n.id],
|
|
370
|
-
disabled: t[n.id].disabled || (r.effect === "disable" ? a : !a)
|
|
371
|
-
};
|
|
372
|
-
}), t;
|
|
373
|
-
}
|
|
374
|
-
function q(e) {
|
|
375
|
-
return N(e);
|
|
376
|
-
}
|
|
377
|
-
function pe(e, t, n) {
|
|
378
|
-
let r = e.values;
|
|
379
|
-
return v(e.definition).forEach((e) => {
|
|
380
|
-
let i = e.condition, a = t[e.id]?.hidden === !0, o = n[e.id]?.hidden === !0, s = i?.clearOnHide !== !1;
|
|
381
|
-
if (!o || a || !s) return;
|
|
382
|
-
let c = q(e);
|
|
383
|
-
r[e.id] !== c && (r = {
|
|
384
|
-
...r,
|
|
385
|
-
[e.id]: c
|
|
386
|
-
});
|
|
387
|
-
}), r;
|
|
388
|
-
}
|
|
389
|
-
function J(e, t) {
|
|
390
|
-
return Object.fromEntries(e.definition.pages.map((n) => {
|
|
391
|
-
let r = n.condition;
|
|
392
|
-
if (!r || r.rules.length === 0) return [n.id, { hidden: !1 }];
|
|
393
|
-
let i = r.rules.map((n) => {
|
|
394
|
-
let r = G(e.definition, n), i = r ? t[r.id]?.hidden !== !0 : null;
|
|
395
|
-
return h({
|
|
396
|
-
condition: n.operator,
|
|
397
|
-
value: n.value
|
|
398
|
-
}, r ? P(r, e.values[r.id]) : [], { visibility: i });
|
|
399
|
-
}), { shouldHide: a } = g({
|
|
400
|
-
conditionRule: r.mode,
|
|
401
|
-
showRule: r.effect === "show" ? "show" : "hide"
|
|
402
|
-
}, i);
|
|
403
|
-
return [n.id, { hidden: a }];
|
|
404
|
-
}));
|
|
405
|
-
}
|
|
406
|
-
function me(e, t, n) {
|
|
407
|
-
let r = e.pages[0]?.id || "", i = e.pages.find((e) => t[e.id]?.hidden !== !0)?.id || r;
|
|
408
|
-
return n ? t[n]?.hidden === !0 ? i : n : i;
|
|
409
|
-
}
|
|
410
|
-
function Y(e) {
|
|
411
|
-
let t = e;
|
|
412
|
-
for (let e = 0; e < 3; e += 1) {
|
|
413
|
-
let e = K(t), n = pe(t, t.fieldStates, e);
|
|
414
|
-
if (n !== t.values) {
|
|
415
|
-
t = {
|
|
416
|
-
...t,
|
|
417
|
-
values: n,
|
|
418
|
-
fieldStates: e
|
|
419
|
-
};
|
|
420
|
-
continue;
|
|
421
|
-
}
|
|
422
|
-
let r = J(t, e);
|
|
423
|
-
return {
|
|
424
|
-
...t,
|
|
425
|
-
fieldStates: e,
|
|
426
|
-
pageStates: r,
|
|
427
|
-
currentPageId: me(t.definition, r, t.currentPageId)
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
let n = K(t), r = J(t, n);
|
|
431
|
-
return {
|
|
432
|
-
...t,
|
|
433
|
-
fieldStates: n,
|
|
434
|
-
pageStates: r,
|
|
435
|
-
currentPageId: me(t.definition, r, t.currentPageId)
|
|
436
|
-
};
|
|
762
|
+
function W(e) {
|
|
763
|
+
return ve(e);
|
|
437
764
|
}
|
|
438
|
-
function
|
|
439
|
-
return e.type === "checkboxes" ? !Array.isArray(t) || t.length === 0 :
|
|
765
|
+
function Me(e, t) {
|
|
766
|
+
return e.type === "checkboxes" ? !Array.isArray(t) || t.length === 0 : re(e) ? t !== !0 : O(e) || D(e) || k(e) ? !Array.isArray(t) || t.length === 0 : E(e) && t && typeof t == "object" ? Object.values(t).every((e) => e == null || typeof e == "string" && e.trim() === "") : t == null || typeof t == "string" && t.trim() === "";
|
|
440
767
|
}
|
|
441
|
-
function
|
|
768
|
+
function G(e) {
|
|
442
769
|
return e.label?.trim() || e.handle;
|
|
443
770
|
}
|
|
444
|
-
function
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
i[r] = [`${X(e)} is not a valid number.`];
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
let a = e.validation.find((e) => e.type === "number"), s = Number(o.min ?? a?.min ?? NaN), c = Number(o.max ?? a?.max ?? NaN);
|
|
461
|
-
if (Number.isFinite(s) && n < s) {
|
|
462
|
-
i[r] = [`${X(e)} must be no less than ${s}.`];
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
if (Number.isFinite(c) && n > c) {
|
|
466
|
-
i[r] = [`${X(e)} must be no greater than ${c}.`];
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
if (a.has("url") && typeof t == "string" && t.trim() !== "") try {
|
|
471
|
-
new URL(t);
|
|
472
|
-
} catch {
|
|
473
|
-
i[r] = [`${X(e)} is not a valid URL.`];
|
|
474
|
-
return;
|
|
475
|
-
}
|
|
476
|
-
let s = e.validation.find((e) => e.type === "match");
|
|
477
|
-
if (s && typeof t == "string" && t.trim() !== "") {
|
|
478
|
-
let a = (s.fieldId ? y(n.definition, s.fieldId) : void 0) || (s.fieldHandle ? b(n.definition, s.fieldHandle) : void 0), o = a ? n.values[a.id] : void 0;
|
|
479
|
-
if (typeof o == "string" && o !== t) {
|
|
480
|
-
let t = a ? X(a) : e.handle;
|
|
481
|
-
i[r] = [`${X(e)} must match ${t}.`];
|
|
482
|
-
return;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
if (a.has("minmaxOptions") && Array.isArray(t)) {
|
|
486
|
-
let n = e.validation.find((e) => e.type === "minmaxOptions"), a = Number(o.min ?? n?.min ?? NaN), s = Number(o.max ?? n?.max ?? NaN);
|
|
487
|
-
if (Number.isFinite(a) && t.length < a) {
|
|
488
|
-
i[r] = [`Please select at least ${a} option${a === 1 ? "" : "s"}.`];
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
|
-
if (Number.isFinite(s) && t.length > s) {
|
|
492
|
-
i[r] = [`Please select no more than ${s} option${s === 1 ? "" : "s"}.`];
|
|
771
|
+
function K(e, t, n, r, i) {
|
|
772
|
+
if (n.fieldStates[r]?.hidden || n.fieldStates[r]?.disabled) return;
|
|
773
|
+
let a = e.validation.slice();
|
|
774
|
+
e.required && !a.some((e) => e.type === "required") && a.unshift({ type: "required" });
|
|
775
|
+
for (let o of a) {
|
|
776
|
+
let a = (o.fieldId ? S(n.definition, o.fieldId) : void 0) || (o.fieldHandle ? C(n.definition, o.fieldHandle) : void 0), s = Se(t, o, {
|
|
777
|
+
label: G(e),
|
|
778
|
+
empty: Me(e, t),
|
|
779
|
+
comparison: a ? n.values[a.id] : void 0,
|
|
780
|
+
comparisonLabel: a ? G(a) : void 0
|
|
781
|
+
});
|
|
782
|
+
if (s) {
|
|
783
|
+
i[r] = [s];
|
|
493
784
|
return;
|
|
494
785
|
}
|
|
495
786
|
}
|
|
496
|
-
if (
|
|
497
|
-
let a =
|
|
787
|
+
if (E(e)) {
|
|
788
|
+
let a = ae(e), o = t && typeof t == "object" ? t : {};
|
|
498
789
|
a.forEach((e) => {
|
|
499
|
-
e.meta?.hidden !== !0 &&
|
|
500
|
-
}),
|
|
790
|
+
e.meta?.hidden !== !0 && K(e, o[e.handle], n, `${r}.${e.handle}`, i);
|
|
791
|
+
}), Oe(e, o, r, i);
|
|
501
792
|
return;
|
|
502
793
|
}
|
|
503
|
-
if (
|
|
794
|
+
if (D(e)) {
|
|
504
795
|
let a = Array.isArray(t) ? t : [], o = M(e);
|
|
505
796
|
a.forEach((e, t) => {
|
|
506
797
|
let a = e && typeof e == "object" ? e : {};
|
|
507
798
|
o.forEach((e) => {
|
|
508
|
-
|
|
799
|
+
K(e, a[e.handle], n, `${r}.${t}.${e.handle}`, i);
|
|
509
800
|
});
|
|
510
801
|
});
|
|
511
802
|
}
|
|
512
803
|
}
|
|
513
|
-
function
|
|
804
|
+
function q(e) {
|
|
514
805
|
let t = {
|
|
515
806
|
form: [],
|
|
516
|
-
fields: {}
|
|
517
|
-
pages: {}
|
|
807
|
+
fields: {}
|
|
518
808
|
};
|
|
519
|
-
return
|
|
520
|
-
let r =
|
|
521
|
-
|
|
809
|
+
return je(e, e.currentPageId).forEach((n) => {
|
|
810
|
+
let r = S(e.definition, n);
|
|
811
|
+
r && e.fieldStates[n]?.hidden !== !0 && e.fieldStates[n]?.disabled !== !0 && K(r, e.values[n], e, n, t.fields);
|
|
522
812
|
}), Object.keys(t.fields).length > 0 && (t.form = [e.definition.settings.validation.formErrorMessage || "Please correct the highlighted fields."]), t;
|
|
523
813
|
}
|
|
524
|
-
function
|
|
525
|
-
|
|
814
|
+
function J({ envelope: e, transport: t }) {
|
|
815
|
+
Ee(e);
|
|
816
|
+
let n = new B(), r = /* @__PURE__ */ new Set(), i = U(e), a = 0, o = {
|
|
526
817
|
status: "ready",
|
|
527
818
|
definition: e.definition,
|
|
528
819
|
session: e.session,
|
|
529
820
|
values: i,
|
|
530
821
|
errors: {
|
|
531
822
|
form: [],
|
|
532
|
-
fields: {}
|
|
533
|
-
pages: {}
|
|
823
|
+
fields: {}
|
|
534
824
|
},
|
|
535
|
-
fieldStates:
|
|
536
|
-
pageStates:
|
|
825
|
+
fieldStates: ke(e.definition),
|
|
826
|
+
pageStates: Ae(e.definition),
|
|
537
827
|
currentPageId: e.session.currentPageId || e.definition.settings.initialPageId,
|
|
538
828
|
lastSubmitResult: null
|
|
539
829
|
};
|
|
540
|
-
|
|
541
|
-
let
|
|
542
|
-
|
|
830
|
+
o = W(o);
|
|
831
|
+
let s = () => {
|
|
832
|
+
if (o.status === "destroyed") return;
|
|
833
|
+
let e = H(o);
|
|
543
834
|
r.forEach((t) => {
|
|
544
835
|
t(e);
|
|
545
836
|
});
|
|
546
|
-
},
|
|
547
|
-
|
|
548
|
-
},
|
|
837
|
+
}, c = (e) => {
|
|
838
|
+
o.status !== "destroyed" && (o = e(o), s());
|
|
839
|
+
}, l = (e) => o.status === "destroyed" || e !== a, u = () => void 0, d = async () => ({}), f = {
|
|
840
|
+
setBrowserModuleGuard(e) {
|
|
841
|
+
u = e;
|
|
842
|
+
},
|
|
843
|
+
getBrowserRequestOptions() {
|
|
844
|
+
return {
|
|
845
|
+
profile: "same-origin-browser",
|
|
846
|
+
...t.browserRequestOptions
|
|
847
|
+
};
|
|
848
|
+
},
|
|
849
|
+
setBrowserModulePreparation(e) {
|
|
850
|
+
d = e;
|
|
851
|
+
},
|
|
549
852
|
id: e.session.id,
|
|
550
853
|
getState() {
|
|
551
|
-
return H(
|
|
854
|
+
return H(o);
|
|
552
855
|
},
|
|
553
856
|
subscribe(e) {
|
|
554
|
-
return r.add(e), e(H(
|
|
857
|
+
return r.add(e), e(H(o)), () => {
|
|
555
858
|
r.delete(e);
|
|
556
859
|
};
|
|
557
860
|
},
|
|
558
861
|
setValue(e, t) {
|
|
559
|
-
|
|
862
|
+
c((n) => {
|
|
560
863
|
let r = Object.fromEntries(Object.entries(n.errors.fields).filter(([t]) => t !== e && !t.startsWith(`${e}.`)));
|
|
561
|
-
return r[e] = [],
|
|
864
|
+
return r[e] = [], W({
|
|
562
865
|
...n,
|
|
563
866
|
values: {
|
|
564
867
|
...n.values,
|
|
@@ -572,7 +875,7 @@ function ve({ envelope: e, transport: t }) {
|
|
|
572
875
|
});
|
|
573
876
|
},
|
|
574
877
|
patchValues(e) {
|
|
575
|
-
|
|
878
|
+
c((t) => W({
|
|
576
879
|
...t,
|
|
577
880
|
values: {
|
|
578
881
|
...t.values,
|
|
@@ -581,75 +884,100 @@ function ve({ envelope: e, transport: t }) {
|
|
|
581
884
|
}));
|
|
582
885
|
},
|
|
583
886
|
async submit(e) {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
887
|
+
if (u(), o.status === "destroyed") return {
|
|
888
|
+
success: !1,
|
|
889
|
+
isFinalPage: !1,
|
|
890
|
+
errors: {
|
|
891
|
+
form: ["Form instance has been destroyed."],
|
|
892
|
+
fields: {}
|
|
893
|
+
},
|
|
894
|
+
messages: { error: "Form instance has been destroyed." },
|
|
895
|
+
session: o.session
|
|
896
|
+
};
|
|
897
|
+
if (o.status === "submitting") return {
|
|
898
|
+
success: !1,
|
|
899
|
+
isFinalPage: !1,
|
|
900
|
+
errors: {
|
|
901
|
+
form: ["A submission is already in progress."],
|
|
902
|
+
fields: {}
|
|
903
|
+
},
|
|
904
|
+
messages: { error: "A submission is already in progress." },
|
|
905
|
+
session: o.session
|
|
906
|
+
};
|
|
907
|
+
let r = o.definition.pages.find((e) => e.id === o.currentPageId), i = e || r?.actions.primary.type || "submit", s = i === "next" ? "submit" : i;
|
|
908
|
+
if (s !== "back" && s !== "save" && o.definition.settings.validation.onSubmit) {
|
|
909
|
+
let e = q(o);
|
|
587
910
|
if (e.form.length > 0 || Object.keys(e.fields).length > 0) {
|
|
588
911
|
let t = {
|
|
589
912
|
success: !1,
|
|
590
913
|
isFinalPage: !1,
|
|
591
914
|
errors: e,
|
|
592
915
|
messages: { error: e.form[0] || null },
|
|
593
|
-
session:
|
|
916
|
+
session: o.session
|
|
594
917
|
};
|
|
595
|
-
return
|
|
918
|
+
return c((n) => ({
|
|
596
919
|
...n,
|
|
597
920
|
errors: e,
|
|
598
921
|
lastSubmitResult: t
|
|
599
922
|
})), n.emit("formie:submit:result", t), t;
|
|
600
923
|
}
|
|
601
924
|
}
|
|
602
|
-
|
|
925
|
+
let f = ++a;
|
|
926
|
+
c((e) => ({
|
|
603
927
|
...e,
|
|
604
928
|
status: "submitting",
|
|
605
929
|
errors: {
|
|
606
930
|
form: [],
|
|
607
|
-
fields: {}
|
|
608
|
-
pages: {}
|
|
931
|
+
fields: {}
|
|
609
932
|
}
|
|
610
933
|
}));
|
|
611
934
|
try {
|
|
612
|
-
let e = await
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
935
|
+
let e = await d(s);
|
|
936
|
+
if (l(f)) throw Error("Submission was cancelled before sending.");
|
|
937
|
+
let r = await t.submit({
|
|
938
|
+
browserData: e,
|
|
939
|
+
definition: o.definition,
|
|
940
|
+
session: o.session,
|
|
941
|
+
values: o.values,
|
|
942
|
+
action: s
|
|
617
943
|
});
|
|
618
|
-
return
|
|
619
|
-
...
|
|
944
|
+
return l(f) ? r : (c((e) => W({
|
|
945
|
+
...e,
|
|
620
946
|
status: "ready",
|
|
621
|
-
session:
|
|
622
|
-
currentPageId:
|
|
623
|
-
errors:
|
|
624
|
-
lastSubmitResult:
|
|
625
|
-
})), n.emit("formie:submit:result",
|
|
626
|
-
currentPageId:
|
|
627
|
-
nextPageId:
|
|
628
|
-
}),
|
|
947
|
+
session: r.session ?? e.session,
|
|
948
|
+
currentPageId: r.session?.currentPageId || r.currentPageId || e.currentPageId,
|
|
949
|
+
errors: r.errors,
|
|
950
|
+
lastSubmitResult: r
|
|
951
|
+
})), n.emit("formie:submit:result", r), (r.currentPageId || r.nextPageId) && n.emit("formie:page:navigate", {
|
|
952
|
+
currentPageId: o.currentPageId,
|
|
953
|
+
nextPageId: r.nextPageId || r.currentPageId
|
|
954
|
+
}), r);
|
|
629
955
|
} catch (e) {
|
|
630
956
|
let t = e instanceof Error ? e.message : "Submission failed.", r = {
|
|
631
957
|
success: !1,
|
|
632
958
|
isFinalPage: !1,
|
|
633
959
|
errors: {
|
|
634
960
|
form: [t],
|
|
635
|
-
fields: {}
|
|
636
|
-
pages: {}
|
|
961
|
+
fields: {}
|
|
637
962
|
},
|
|
638
963
|
messages: { error: t },
|
|
639
|
-
session:
|
|
964
|
+
session: o.session
|
|
640
965
|
};
|
|
641
|
-
return
|
|
966
|
+
return l(f) || (c((e) => ({
|
|
642
967
|
...e,
|
|
643
968
|
status: "ready",
|
|
644
969
|
errors: r.errors,
|
|
645
970
|
lastSubmitResult: r
|
|
646
|
-
})), n.emit("formie:submit:result", r), r;
|
|
971
|
+
})), n.emit("formie:submit:result", r)), r;
|
|
647
972
|
}
|
|
648
973
|
},
|
|
649
974
|
async setPage(e) {
|
|
975
|
+
if (o.status === "destroyed" || o.status === "submitting") return;
|
|
976
|
+
let r = ++a;
|
|
650
977
|
if (!t.setPage) {
|
|
651
|
-
|
|
978
|
+
c((t) => W({
|
|
652
979
|
...t,
|
|
980
|
+
status: "ready",
|
|
653
981
|
currentPageId: e,
|
|
654
982
|
session: {
|
|
655
983
|
...t.session,
|
|
@@ -658,95 +986,109 @@ function ve({ envelope: e, transport: t }) {
|
|
|
658
986
|
}));
|
|
659
987
|
return;
|
|
660
988
|
}
|
|
661
|
-
|
|
989
|
+
c((e) => ({
|
|
662
990
|
...e,
|
|
663
991
|
status: "refreshing"
|
|
664
992
|
}));
|
|
665
993
|
try {
|
|
666
|
-
let
|
|
667
|
-
definition:
|
|
668
|
-
session:
|
|
669
|
-
values:
|
|
670
|
-
currentPageId:
|
|
994
|
+
let i = await t.setPage({
|
|
995
|
+
definition: o.definition,
|
|
996
|
+
session: o.session,
|
|
997
|
+
values: o.values,
|
|
998
|
+
currentPageId: o.currentPageId,
|
|
671
999
|
targetPageId: e
|
|
672
1000
|
});
|
|
673
|
-
|
|
1001
|
+
if (l(r)) return;
|
|
1002
|
+
if (!i.success || !i.session) {
|
|
1003
|
+
c((e) => ({
|
|
1004
|
+
...e,
|
|
1005
|
+
status: "ready",
|
|
1006
|
+
errors: i.errors,
|
|
1007
|
+
lastSubmitResult: i
|
|
1008
|
+
})), n.emit("formie:submit:result", i);
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
let a = i.session;
|
|
1012
|
+
c((e) => W({
|
|
674
1013
|
...e,
|
|
675
1014
|
status: "ready",
|
|
676
|
-
session:
|
|
677
|
-
currentPageId:
|
|
1015
|
+
session: a,
|
|
1016
|
+
currentPageId: a.currentPageId
|
|
678
1017
|
})), n.emit("formie:page:navigate", {
|
|
679
|
-
currentPageId:
|
|
1018
|
+
currentPageId: o.currentPageId,
|
|
680
1019
|
nextPageId: e
|
|
681
1020
|
});
|
|
682
1021
|
} catch (t) {
|
|
683
|
-
let
|
|
684
|
-
|
|
1022
|
+
let i = t instanceof Error ? t.message : "Unable to change page.";
|
|
1023
|
+
l(r) || (c((e) => ({
|
|
685
1024
|
...e,
|
|
686
1025
|
status: "ready"
|
|
687
1026
|
})), n.emit("formie:page:navigate:error", {
|
|
688
|
-
currentPageId:
|
|
1027
|
+
currentPageId: o.currentPageId,
|
|
689
1028
|
nextPageId: e,
|
|
690
|
-
error:
|
|
691
|
-
});
|
|
1029
|
+
error: i
|
|
1030
|
+
}));
|
|
692
1031
|
}
|
|
693
1032
|
},
|
|
694
1033
|
async refreshSession() {
|
|
695
|
-
|
|
1034
|
+
if (o.status === "destroyed" || o.status === "submitting") return;
|
|
1035
|
+
let e = ++a;
|
|
1036
|
+
c((e) => ({
|
|
696
1037
|
...e,
|
|
697
1038
|
status: "refreshing"
|
|
698
1039
|
}));
|
|
699
1040
|
try {
|
|
700
|
-
let
|
|
701
|
-
formHandle:
|
|
702
|
-
siteId:
|
|
703
|
-
session:
|
|
1041
|
+
let r = await t.refreshSession({
|
|
1042
|
+
formHandle: o.definition.handle,
|
|
1043
|
+
siteId: o.definition.siteId ?? void 0,
|
|
1044
|
+
session: o.session
|
|
704
1045
|
});
|
|
705
|
-
|
|
706
|
-
|
|
1046
|
+
if (l(e)) return;
|
|
1047
|
+
c((e) => W({
|
|
1048
|
+
...e,
|
|
707
1049
|
status: "ready",
|
|
708
|
-
session:
|
|
709
|
-
currentPageId:
|
|
710
|
-
})), n.emit("formie:session:refreshed",
|
|
711
|
-
} catch (
|
|
712
|
-
let
|
|
713
|
-
|
|
1050
|
+
session: r,
|
|
1051
|
+
currentPageId: r.currentPageId || e.currentPageId
|
|
1052
|
+
})), n.emit("formie:session:refreshed", r);
|
|
1053
|
+
} catch (t) {
|
|
1054
|
+
let r = t instanceof Error ? t.message : "Unable to refresh session.";
|
|
1055
|
+
l(e) || (c((e) => ({
|
|
714
1056
|
...e,
|
|
715
1057
|
status: "ready"
|
|
716
|
-
})), n.emit("formie:session:refresh:error", { error:
|
|
1058
|
+
})), n.emit("formie:session:refresh:error", { error: r }));
|
|
717
1059
|
}
|
|
718
1060
|
},
|
|
719
1061
|
reset() {
|
|
720
|
-
|
|
1062
|
+
o.status !== "destroyed" && (a += 1, c((t) => W({
|
|
721
1063
|
...t,
|
|
1064
|
+
status: "ready",
|
|
722
1065
|
session: e.session,
|
|
723
|
-
values:
|
|
1066
|
+
values: V(i),
|
|
724
1067
|
errors: {
|
|
725
1068
|
form: [],
|
|
726
|
-
fields: {}
|
|
727
|
-
pages: {}
|
|
1069
|
+
fields: {}
|
|
728
1070
|
},
|
|
729
1071
|
currentPageId: e.session.currentPageId || e.definition.settings.initialPageId,
|
|
730
1072
|
lastSubmitResult: null
|
|
731
|
-
})), n.emit("formie:state:reset", null);
|
|
1073
|
+
})), n.emit("formie:state:reset", null));
|
|
732
1074
|
},
|
|
733
1075
|
async destroy() {
|
|
734
|
-
|
|
735
|
-
...
|
|
1076
|
+
a += 1, o = {
|
|
1077
|
+
...o,
|
|
736
1078
|
status: "destroyed"
|
|
737
|
-
}
|
|
1079
|
+
}, r.clear();
|
|
738
1080
|
},
|
|
739
1081
|
on(e, t) {
|
|
740
1082
|
return n.on(e, t);
|
|
741
1083
|
}
|
|
742
1084
|
};
|
|
743
1085
|
return queueMicrotask(() => {
|
|
744
|
-
n.emit("formie:client:ready",
|
|
745
|
-
}),
|
|
1086
|
+
n.emit("formie:client:ready", f.getState());
|
|
1087
|
+
}), f;
|
|
746
1088
|
}
|
|
747
1089
|
//#endregion
|
|
748
1090
|
//#region src/event-names.ts
|
|
749
|
-
var
|
|
1091
|
+
var Y = [
|
|
750
1092
|
"formie:client:ready",
|
|
751
1093
|
"formie:submit:result",
|
|
752
1094
|
"formie:page:navigate",
|
|
@@ -754,7 +1096,7 @@ var ye = [
|
|
|
754
1096
|
"formie:session:refreshed",
|
|
755
1097
|
"formie:session:refresh:error",
|
|
756
1098
|
"formie:state:reset"
|
|
757
|
-
],
|
|
1099
|
+
], Ne = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
758
1100
|
(function(n, r) {
|
|
759
1101
|
typeof e == "object" && t !== void 0 ? r(e) : typeof define == "function" && define.amd ? define(["exports"], r) : r((n = typeof globalThis < "u" ? globalThis : n || self).ExpressionLanguage = {});
|
|
760
1102
|
})(e, function(e) {
|
|
@@ -818,7 +1160,7 @@ var ye = [
|
|
|
818
1160
|
}
|
|
819
1161
|
this.next();
|
|
820
1162
|
}), t(this, "isEOF", () => a.EOF_TYPE === this.current.type), t(this, "isEqualTo", (e) => {
|
|
821
|
-
if (e == null || !e instanceof i || e.tokens.length !== this.tokens.length) return !1;
|
|
1163
|
+
if (e == null || !(e instanceof i) || e.tokens.length !== this.tokens.length) return !1;
|
|
822
1164
|
let t = e.position;
|
|
823
1165
|
e.position = 0;
|
|
824
1166
|
let n = !0;
|
|
@@ -833,16 +1175,16 @@ var ye = [
|
|
|
833
1175
|
}), t(this, "diff", (e) => {
|
|
834
1176
|
let t = [];
|
|
835
1177
|
if (!this.isEqualTo(e)) {
|
|
836
|
-
let n = e.position;
|
|
1178
|
+
let n = 0, r = e.position;
|
|
837
1179
|
e.position = 0;
|
|
838
|
-
for (let
|
|
839
|
-
let
|
|
840
|
-
|
|
841
|
-
index:
|
|
842
|
-
diff:
|
|
843
|
-
}), e.position < e.tokens.length - 1 && e.next()
|
|
1180
|
+
for (let r of this.tokens) {
|
|
1181
|
+
let i = r.diff(e.current);
|
|
1182
|
+
i.length > 0 && t.push({
|
|
1183
|
+
index: n,
|
|
1184
|
+
diff: i
|
|
1185
|
+
}), e.position < e.tokens.length - 1 && e.next(), n++;
|
|
844
1186
|
}
|
|
845
|
-
e.position =
|
|
1187
|
+
e.position = r;
|
|
846
1188
|
}
|
|
847
1189
|
return t;
|
|
848
1190
|
}), this.expression = e, this.position = 0, this.tokens = n;
|
|
@@ -859,7 +1201,7 @@ var ye = [
|
|
|
859
1201
|
}
|
|
860
1202
|
class a {
|
|
861
1203
|
constructor(e, n, r) {
|
|
862
|
-
t(this, "test", (e, t = null) => this.type === e && (t === null || this.value === t)), t(this, "isEqualTo", (e) =>
|
|
1204
|
+
t(this, "test", (e, t = null) => this.type === e && (t === null || this.value === t)), t(this, "isEqualTo", (e) => e != null && e instanceof a && e.value == this.value && e.type === this.type && e.cursor === this.cursor), t(this, "diff", (e) => {
|
|
863
1205
|
let t = [];
|
|
864
1206
|
return this.isEqualTo(e) || (e.value !== this.value && t.push(`Value: ${e.value} != ${this.value}`), e.cursor !== this.cursor && t.push(`Cursor: ${e.cursor} != ${this.cursor}`), e.type !== this.type && t.push(`Type: ${e.type} != ${this.type}`)), t;
|
|
865
1207
|
}), this.value = n, this.type = e, this.cursor = r;
|
|
@@ -1000,32 +1342,33 @@ var ye = [
|
|
|
1000
1342
|
else r.push(".", c, l);
|
|
1001
1343
|
i += l.length + 2;
|
|
1002
1344
|
} else r.push(o);
|
|
1003
|
-
for (i = 0; i < e.length; i++) if (o = e.charAt(i), r.indexOf(o) !== -1)
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1345
|
+
for (i = 0; i < e.length; i++) if (o = e.charAt(i), r.indexOf(o) !== -1) {
|
|
1346
|
+
if (n += "\\", (h = o.charCodeAt(0)) < 32 || h > 126) switch (o) {
|
|
1347
|
+
case "\n":
|
|
1348
|
+
n += "n";
|
|
1349
|
+
break;
|
|
1350
|
+
case " ":
|
|
1351
|
+
n += "t";
|
|
1352
|
+
break;
|
|
1353
|
+
case "\r":
|
|
1354
|
+
n += "r";
|
|
1355
|
+
break;
|
|
1356
|
+
case "\x07":
|
|
1357
|
+
n += "a";
|
|
1358
|
+
break;
|
|
1359
|
+
case "\v":
|
|
1360
|
+
n += "v";
|
|
1361
|
+
break;
|
|
1362
|
+
case "\b":
|
|
1363
|
+
n += "b";
|
|
1364
|
+
break;
|
|
1365
|
+
case "\f":
|
|
1366
|
+
n += "f";
|
|
1367
|
+
break;
|
|
1368
|
+
default: for (_ = encodeURIComponent(o), (g = v.exec(_)) !== null && (n += y(parseInt(g[1], 16).toString(8), 3)); (g = v.exec(_)) !== null;) n += "\\" + y(parseInt(g[1], 16).toString(8), 3);
|
|
1369
|
+
}
|
|
1370
|
+
else n += o;
|
|
1371
|
+
} else n += o;
|
|
1029
1372
|
return n;
|
|
1030
1373
|
}
|
|
1031
1374
|
class _ {
|
|
@@ -1072,7 +1415,20 @@ var ye = [
|
|
|
1072
1415
|
right: r
|
|
1073
1416
|
}, { operator: e }), t(this, "compile", (e) => {
|
|
1074
1417
|
let t = this.attributes.operator;
|
|
1075
|
-
|
|
1418
|
+
if (t !== "matches") {
|
|
1419
|
+
if (t !== "contains") {
|
|
1420
|
+
if (t !== "starts with") {
|
|
1421
|
+
if (t !== "ends with") {
|
|
1422
|
+
if (t === "in" || t === "not in") {
|
|
1423
|
+
let n = t === "not in" ? "=== -1" : ">= 0";
|
|
1424
|
+
e.raw("(function(__l, __r){return __r.indexOf(__l) " + n + ";})(").compile(this.nodes.left).raw(", ").compile(this.nodes.right).raw(")");
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1427
|
+
t === ".." ? e.raw("(function(__s, __e){var __r=[];for(var __i=__s;__i<=__e;__i++){__r.push(__i);}return __r;})(").compile(this.nodes.left).raw(", ").compile(this.nodes.right).raw(")") : v.functions[t] === void 0 ? (v.operators[t] !== void 0 && (t = v.operators[t]), e.raw("(").compile(this.nodes.left).raw(" ").raw(t).raw(" ").compile(this.nodes.right).raw(")")) : e.raw(`${v.functions[t]}(`).compile(this.nodes.left).raw(", ").compile(this.nodes.right).raw(")");
|
|
1428
|
+
} else e.raw("(").compile(this.nodes.left).raw(".toString().toLowerCase().endsWith(").compile(this.nodes.right).raw(".toString().toLowerCase())");
|
|
1429
|
+
} else e.raw("(").compile(this.nodes.left).raw(".toString().toLowerCase().startsWith(").compile(this.nodes.right).raw(".toString().toLowerCase())");
|
|
1430
|
+
} else e.raw("(").compile(this.nodes.left).raw(".toString().toLowerCase().includes(").compile(this.nodes.right).raw(".toString().toLowerCase())");
|
|
1431
|
+
} else e.compile(this.nodes.right).raw(".test(").compile(this.nodes.left).raw(")");
|
|
1076
1432
|
}), t(this, "evaluate", (e, t) => {
|
|
1077
1433
|
let n = this.attributes.operator, r = this.nodes.left.evaluate(e, t);
|
|
1078
1434
|
if (v.functions[n] !== void 0) {
|
|
@@ -1199,7 +1555,7 @@ var ye = [
|
|
|
1199
1555
|
}), this.isIdentifier = n, this.isNullSafe = r, this.name = "ConstantNode";
|
|
1200
1556
|
}
|
|
1201
1557
|
}
|
|
1202
|
-
class
|
|
1558
|
+
class ee extends _ {
|
|
1203
1559
|
constructor(e, n, r) {
|
|
1204
1560
|
super({
|
|
1205
1561
|
expr1: e,
|
|
@@ -1218,7 +1574,7 @@ var ye = [
|
|
|
1218
1574
|
]), this.name = "ConditionalNode";
|
|
1219
1575
|
}
|
|
1220
1576
|
}
|
|
1221
|
-
class
|
|
1577
|
+
class x extends _ {
|
|
1222
1578
|
constructor(e, n) {
|
|
1223
1579
|
super({ fnArguments: n }, { name: e }), t(this, "compile", (e) => {
|
|
1224
1580
|
let t = [];
|
|
@@ -1323,8 +1679,8 @@ var ye = [
|
|
|
1323
1679
|
let n = this.nodes.node.evaluate(e, t);
|
|
1324
1680
|
if (n === null && (this.nodes.attribute.isNullSafe || this.attributes.is_null_coalesce)) return this.attributes.is_short_circuited = !0, null;
|
|
1325
1681
|
if (n === null && this.isShortCircuited()) return null;
|
|
1326
|
-
if (typeof n != "object") throw Error(`Unable to get property "${r}" on a non-object: ` + typeof n);
|
|
1327
1682
|
let r = this.nodes.attribute.attributes.value;
|
|
1683
|
+
if (typeof n != "object") throw Error(`Unable to get property "${r}" on a non-object: ` + typeof n);
|
|
1328
1684
|
return this.attributes.is_null_coalesce ? n[r] ?? null : n[r];
|
|
1329
1685
|
case T.METHOD_CALL:
|
|
1330
1686
|
let i = this.nodes.node.evaluate(e, t);
|
|
@@ -1372,7 +1728,7 @@ var ye = [
|
|
|
1372
1728
|
}
|
|
1373
1729
|
}
|
|
1374
1730
|
t(T, "PROPERTY_CALL", 1), t(T, "METHOD_CALL", 2), t(T, "ARRAY_CALL", 3);
|
|
1375
|
-
class
|
|
1731
|
+
class te extends _ {
|
|
1376
1732
|
constructor(e, n) {
|
|
1377
1733
|
super({
|
|
1378
1734
|
expr1: e,
|
|
@@ -1386,21 +1742,21 @@ var ye = [
|
|
|
1386
1742
|
this.nodes.expr2,
|
|
1387
1743
|
")"
|
|
1388
1744
|
]), t(this, "_addNullCoalesceAttributeToGetAttrNodes", (e) => {
|
|
1389
|
-
if (
|
|
1745
|
+
if (e instanceof T) {
|
|
1390
1746
|
e.attributes.is_null_coalesce = !0;
|
|
1391
1747
|
for (let t of Object.values(e.nodes)) this._addNullCoalesceAttributeToGetAttrNodes(t);
|
|
1392
1748
|
}
|
|
1393
1749
|
}), this.name = "NullCoalesceNode";
|
|
1394
1750
|
}
|
|
1395
1751
|
}
|
|
1396
|
-
class
|
|
1752
|
+
class ne extends _ {
|
|
1397
1753
|
constructor(e) {
|
|
1398
1754
|
super({}, { name: e }), t(this, "compile", (e) => {
|
|
1399
1755
|
e.raw(this.attributes.name + " ?? null");
|
|
1400
1756
|
}), t(this, "evaluate", (e, t) => null), t(this, "toArray", () => [this.attributes.name + " ?? null"]), this.name = "NullCoalescedNameNode";
|
|
1401
1757
|
}
|
|
1402
1758
|
}
|
|
1403
|
-
class
|
|
1759
|
+
class E {
|
|
1404
1760
|
constructor(e = {}) {
|
|
1405
1761
|
t(this, "functions", {}), t(this, "unaryOperators", {
|
|
1406
1762
|
not: { precedence: 50 },
|
|
@@ -1546,7 +1902,7 @@ var ye = [
|
|
|
1546
1902
|
t === null && (console.log("Deprecated: passing \"null\" as the second argument of lint is deprecated, pass IGNORE_UNKNOWN_VARIABLES instead as the third argument"), n |= 1, t = []), this.parse(e, t, n);
|
|
1547
1903
|
}), t(this, "parseExpression", (e = 0) => {
|
|
1548
1904
|
let t = this.getPrimary(), n = this.tokenStream.current;
|
|
1549
|
-
if (this.nestedExecutions++, this.nestedExecutions > 1e3) throw Error("
|
|
1905
|
+
if (this.nestedExecutions++, this.nestedExecutions > 1e3) throw Error("Too many executions on '" + n.toString() + "' of '" + this.tokenStream.toString() + "'");
|
|
1550
1906
|
for (; n.test(a.OPERATOR_TYPE) && this.binaryOperators[n.value] !== void 0 && this.binaryOperators[n.value] !== null && this.binaryOperators[n.value].precedence >= e;) {
|
|
1551
1907
|
let e = this.binaryOperators[n.value];
|
|
1552
1908
|
this.tokenStream.next();
|
|
@@ -1634,11 +1990,11 @@ var ye = [
|
|
|
1634
1990
|
for (; this.tokenStream.current.test(a.PUNCTUATION_TYPE, "??");) {
|
|
1635
1991
|
this.tokenStream.next();
|
|
1636
1992
|
let t = this.parseExpression();
|
|
1637
|
-
e = new
|
|
1993
|
+
e = new te(e, t);
|
|
1638
1994
|
}
|
|
1639
1995
|
for (; this.tokenStream.current.test(a.PUNCTUATION_TYPE, "?");) {
|
|
1640
1996
|
let t, n;
|
|
1641
|
-
this.tokenStream.next(), this.tokenStream.current.test(a.PUNCTUATION_TYPE, ":") ? (this.tokenStream.next(), t = e, n = this.parseExpression()) : (t = this.parseExpression(), this.tokenStream.current.test(a.PUNCTUATION_TYPE, ":") ? (this.tokenStream.next(), n = this.parseExpression()) : t instanceof b && typeof t.attributes?.value == "string" ? n = new b("") : t instanceof
|
|
1997
|
+
this.tokenStream.next(), this.tokenStream.current.test(a.PUNCTUATION_TYPE, ":") ? (this.tokenStream.next(), t = e, n = this.parseExpression()) : (t = this.parseExpression(), this.tokenStream.current.test(a.PUNCTUATION_TYPE, ":") ? (this.tokenStream.next(), n = this.parseExpression()) : t instanceof b && typeof t.attributes?.value == "string" ? n = new b("") : t instanceof ee ? (n = t.nodes.expr3, t = t.nodes.expr2) : (n = t, t = e)), e = new ee(e, t, n);
|
|
1642
1998
|
}
|
|
1643
1999
|
return e;
|
|
1644
2000
|
}
|
|
@@ -1655,13 +2011,13 @@ var ye = [
|
|
|
1655
2011
|
case "NULL": return new b(null);
|
|
1656
2012
|
default: if (this.tokenStream.current.value === "(") {
|
|
1657
2013
|
if (this.functions[e.value] === void 0 && !(2 & this.flags)) throw new r(`The function "${e.value}" does not exist`, e.cursor, this.tokenStream.expression, e.values, Object.keys(this.functions));
|
|
1658
|
-
t = new
|
|
2014
|
+
t = new x(e.value, this.parseArguments());
|
|
1659
2015
|
} else {
|
|
1660
2016
|
let n = null;
|
|
1661
2017
|
if (1 & this.flags) n = e.value;
|
|
1662
2018
|
else {
|
|
1663
2019
|
if (!this.hasVariable(e.value)) {
|
|
1664
|
-
if (this.tokenStream.current.test(a.PUNCTUATION_TYPE, "??")) return new
|
|
2020
|
+
if (this.tokenStream.current.test(a.PUNCTUATION_TYPE, "??")) return new ne(e.value);
|
|
1665
2021
|
throw new r(`Variable "${e.value}" is not valid`, e.cursor, this.tokenStream.expression, e.value, this.getNames());
|
|
1666
2022
|
}
|
|
1667
2023
|
n = e.value, this.objectMatches[n] !== void 0 && (n = this.getNames()[this.objectMatches[n]]);
|
|
@@ -1681,7 +2037,7 @@ var ye = [
|
|
|
1681
2037
|
return this.parsePostfixExpression(t);
|
|
1682
2038
|
}
|
|
1683
2039
|
}
|
|
1684
|
-
class
|
|
2040
|
+
class D {
|
|
1685
2041
|
constructor(e) {
|
|
1686
2042
|
t(this, "getFunction", (e) => this.functions[e]), t(this, "getSource", () => this.source), t(this, "reset", () => (this.source = "", this)), t(this, "compile", (e) => (e.compile(this), this)), t(this, "subcompile", (e) => {
|
|
1687
2043
|
let t = this.source;
|
|
@@ -1693,22 +2049,22 @@ var ye = [
|
|
|
1693
2049
|
else if (Number.isInteger(e) || +e === e && (!isFinite(e) || e % 1)) this.raw(e);
|
|
1694
2050
|
else if (e === null) this.raw("null");
|
|
1695
2051
|
else if (typeof e == "boolean") this.raw(e ? "true" : "false");
|
|
1696
|
-
else if (
|
|
1697
|
-
this.raw("{");
|
|
1698
|
-
let t = !0;
|
|
1699
|
-
for (let n of Object.keys(e)) t || this.raw(", "), t = !1, this.repr(n), this.raw(":"), this.repr(e[n]);
|
|
1700
|
-
this.raw("}");
|
|
1701
|
-
} else if (Array.isArray(e)) {
|
|
2052
|
+
else if (Array.isArray(e)) {
|
|
1702
2053
|
this.raw("[");
|
|
1703
2054
|
let t = !0;
|
|
1704
2055
|
for (let n of e) t || this.raw(", "), t = !1, this.repr(n);
|
|
1705
2056
|
this.raw("]");
|
|
2057
|
+
} else if (typeof e == "object") {
|
|
2058
|
+
this.raw("{");
|
|
2059
|
+
let t = !0;
|
|
2060
|
+
for (let n of Object.keys(e)) t || this.raw(", "), t = !1, this.repr(n), this.raw(":"), this.repr(e[n]);
|
|
2061
|
+
this.raw("}");
|
|
1706
2062
|
} else this.string(e);
|
|
1707
2063
|
return this;
|
|
1708
2064
|
}), this.source = "", this.functions = e;
|
|
1709
2065
|
}
|
|
1710
2066
|
}
|
|
1711
|
-
class
|
|
2067
|
+
class O {
|
|
1712
2068
|
constructor(e) {
|
|
1713
2069
|
this.expression = e;
|
|
1714
2070
|
}
|
|
@@ -1716,7 +2072,7 @@ var ye = [
|
|
|
1716
2072
|
return this.expression;
|
|
1717
2073
|
}
|
|
1718
2074
|
}
|
|
1719
|
-
class
|
|
2075
|
+
class k extends O {
|
|
1720
2076
|
constructor(e, n) {
|
|
1721
2077
|
super(e), t(this, "getNodes", () => this.nodes), this.nodes = n;
|
|
1722
2078
|
}
|
|
@@ -1726,11 +2082,11 @@ var ye = [
|
|
|
1726
2082
|
switch (e.name) {
|
|
1727
2083
|
case "ConstantNode": return new b(e.attributes?.value, !!e.isIdentifier, !!e.isNullSafe);
|
|
1728
2084
|
case "NameNode": return new S(e.attributes?.name);
|
|
1729
|
-
case "NullCoalescedNameNode": return new
|
|
2085
|
+
case "NullCoalescedNameNode": return new ne(e.attributes?.name);
|
|
1730
2086
|
case "UnaryNode": return new y(e.attributes?.operator, n(e.nodes?.node));
|
|
1731
2087
|
case "BinaryNode": return new v(e.attributes?.operator, n(e.nodes?.left), n(e.nodes?.right));
|
|
1732
|
-
case "ConditionalNode": return new
|
|
1733
|
-
case "NullCoalesceNode": return new
|
|
2088
|
+
case "ConditionalNode": return new ee(n(e.nodes?.expr1), n(e.nodes?.expr2), n(e.nodes?.expr3));
|
|
2089
|
+
case "NullCoalesceNode": return new te(n(e.nodes?.expr1), n(e.nodes?.expr2));
|
|
1734
2090
|
case "ArgumentsNode": {
|
|
1735
2091
|
let t = new w();
|
|
1736
2092
|
typeof e.type == "string" && (t.type = e.type), typeof e.index == "number" && (t.index = e.index), typeof e.keyIndex == "number" && (t.keyIndex = e.keyIndex), t.nodes = {};
|
|
@@ -1744,8 +2100,8 @@ var ye = [
|
|
|
1744
2100
|
return t;
|
|
1745
2101
|
}
|
|
1746
2102
|
case "FunctionNode": {
|
|
1747
|
-
let t = n(e.nodes?.
|
|
1748
|
-
return new
|
|
2103
|
+
let t = n(e.nodes?.fnArguments);
|
|
2104
|
+
return new x(e.attributes?.name, t);
|
|
1749
2105
|
}
|
|
1750
2106
|
case "GetAttrNode": {
|
|
1751
2107
|
let t = new T(n(e.nodes?.node), n(e.nodes?.attribute), n(e.nodes?.fnArguments), e.attributes?.type);
|
|
@@ -1770,8 +2126,7 @@ var ye = [
|
|
|
1770
2126
|
return t.attributes = e.attributes || {}, t;
|
|
1771
2127
|
}
|
|
1772
2128
|
}
|
|
1773
|
-
}, r = t.expression
|
|
1774
|
-
return new A(r, ((e) => {
|
|
2129
|
+
}, r = t.expression, i = ((e) => {
|
|
1775
2130
|
if (e == null) return e;
|
|
1776
2131
|
if (e.name) return n(e);
|
|
1777
2132
|
if (Array.isArray(e)) return e.map(n);
|
|
@@ -1781,14 +2136,15 @@ var ye = [
|
|
|
1781
2136
|
return t;
|
|
1782
2137
|
}
|
|
1783
2138
|
return e;
|
|
1784
|
-
})(t.nodes)
|
|
2139
|
+
})(t.nodes);
|
|
2140
|
+
return new k(r, i);
|
|
1785
2141
|
}
|
|
1786
2142
|
}
|
|
1787
|
-
var
|
|
1788
|
-
class
|
|
2143
|
+
var re;
|
|
2144
|
+
class ie {
|
|
1789
2145
|
constructor(e = 0) {
|
|
1790
2146
|
t(this, "createCacheItem", (e, t, n) => {
|
|
1791
|
-
let r = new
|
|
2147
|
+
let r = new A();
|
|
1792
2148
|
return r.key = e, r.value = t, r.isHit = n, r.defaultLifetime = this.defaultLifetime, r;
|
|
1793
2149
|
}), t(this, "get", (e, t, n = null, r = null) => {
|
|
1794
2150
|
let i = this.getItem(e);
|
|
@@ -1797,12 +2153,12 @@ var ye = [
|
|
|
1797
2153
|
let t = this.hasItem(e), n = null;
|
|
1798
2154
|
return t ? n = this.values[e] : this.values[e] = null, (0, this.createCacheItem)(e, n, t);
|
|
1799
2155
|
}), t(this, "getItems", (e) => {
|
|
1800
|
-
for (let t of e) typeof t == "string" || this.expiries[t] ||
|
|
2156
|
+
for (let t of e) typeof t == "string" || this.expiries[t] || A.validateKey(t);
|
|
1801
2157
|
return this.generateItems(e, (/* @__PURE__ */ new Date()).getTime() / 1e3, this.createCacheItem);
|
|
1802
2158
|
}), t(this, "deleteItems", (e) => {
|
|
1803
2159
|
for (let t of e) this.deleteItem(t);
|
|
1804
2160
|
return !0;
|
|
1805
|
-
}), t(this, "save", (e) =>
|
|
2161
|
+
}), t(this, "save", (e) => e instanceof A && (e.expiry !== null && e.expiry <= (/* @__PURE__ */ new Date()).getTime() / 1e3 ? (this.deleteItem(e.key), !0) : (e.expiry === null && 0 < e.defaultLifetime && (e.expiry = (/* @__PURE__ */ new Date()).getTime() / 1e3 + e.defaultLifetime), this.values[e.key] = e.value, this.expiries[e.key] = e.expiry || 2 ** 53 - 1, !0))), t(this, "saveDeferred", (e) => this.save(e)), t(this, "commit", () => !0), t(this, "delete", (e) => this.deleteItem(e)), t(this, "getValues", () => this.values), t(this, "hasItem", (e) => !!(typeof e == "string" && this.expiries[e] && this.expiries[e] > (/* @__PURE__ */ new Date()).getTime() / 1e3) || (A.validateKey(e), !!this.expiries[e] && !this.deleteItem(e))), t(this, "clear", () => (this.values = {}, this.expiries = {}, !0)), t(this, "deleteItem", (e) => (typeof e == "string" && this.expiries[e] || A.validateKey(e), delete this.values[e], delete this.expiries[e], !0)), t(this, "reset", () => {
|
|
1806
2162
|
this.clear();
|
|
1807
2163
|
}), t(this, "generateItems", (e, t, n) => {
|
|
1808
2164
|
let r = [];
|
|
@@ -1814,7 +2170,7 @@ var ye = [
|
|
|
1814
2170
|
}), this.defaultLifetime = e, this.values = {}, this.expiries = {};
|
|
1815
2171
|
}
|
|
1816
2172
|
}
|
|
1817
|
-
class
|
|
2173
|
+
class A {
|
|
1818
2174
|
constructor() {
|
|
1819
2175
|
t(this, "getKey", () => this.key), t(this, "get", () => this.value), t(this, "set", (e) => (this.value = e, this)), t(this, "expiresAt", (e) => {
|
|
1820
2176
|
if (e === null) this.expiry = this.defaultLifetime > 0 ? Date.now() / 1e3 + this.defaultLifetime : null;
|
|
@@ -1842,7 +2198,7 @@ var ye = [
|
|
|
1842
2198
|
}), t(this, "getMetadata", () => this.metadata), this.key = null, this.value = null, this.isHit = !1, this.expiry = null, this.defaultLifetime = null, this.metadata = {}, this.newMetadata = {}, this.innerItem = null, this.poolHash = null, this.isTaggable = !1;
|
|
1843
2199
|
}
|
|
1844
2200
|
}
|
|
1845
|
-
|
|
2201
|
+
re = A, t(A, "METADATA_EXPIRY_OFFSET", 1527506807), t(A, "RESERVED_CHARACTERS", [
|
|
1846
2202
|
"{",
|
|
1847
2203
|
"}",
|
|
1848
2204
|
"(",
|
|
@@ -1851,13 +2207,13 @@ var ye = [
|
|
|
1851
2207
|
"\\",
|
|
1852
2208
|
"@",
|
|
1853
2209
|
":"
|
|
1854
|
-
]), t(
|
|
2210
|
+
]), t(A, "validateKey", (e) => {
|
|
1855
2211
|
if (typeof e != "string") throw Error(`Cache key must be string, "${typeof e}" given.`);
|
|
1856
2212
|
if (e === "") throw Error("Cache key length must be greater than zero");
|
|
1857
|
-
for (let t of
|
|
2213
|
+
for (let t of re.RESERVED_CHARACTERS) if (e.indexOf(t) >= 0) throw Error(`Cache key "${e}" contains reserved character "${t}".`);
|
|
1858
2214
|
return e;
|
|
1859
2215
|
});
|
|
1860
|
-
class
|
|
2216
|
+
class ae extends Error {
|
|
1861
2217
|
constructor(e) {
|
|
1862
2218
|
super(e), this.name = "LogicException";
|
|
1863
2219
|
}
|
|
@@ -1865,7 +2221,7 @@ var ye = [
|
|
|
1865
2221
|
return `${this.name}: ${this.message}`;
|
|
1866
2222
|
}
|
|
1867
2223
|
}
|
|
1868
|
-
class
|
|
2224
|
+
class j {
|
|
1869
2225
|
constructor(e, n, r) {
|
|
1870
2226
|
t(this, "getName", () => this.name), t(this, "getCompiler", () => this.compiler), t(this, "getEvaluator", () => this.evaluator), this.name = e, this.compiler = n, this.evaluator = r;
|
|
1871
2227
|
}
|
|
@@ -1881,10 +2237,10 @@ var ye = [
|
|
|
1881
2237
|
return new this(t || r[r.length - 1], (...e) => `${n}(${e.join(", ")})`, (e, ...t) => i(...t));
|
|
1882
2238
|
}
|
|
1883
2239
|
}
|
|
1884
|
-
class
|
|
2240
|
+
class M {
|
|
1885
2241
|
constructor(e = null, n = []) {
|
|
1886
|
-
t(this, "compile", (e, t = []) => this.getCompiler().compile(this.parse(e, t).getNodes()).getSource()), t(this, "evaluate", (e, t = {}) => this.parse(e, Object.keys(t)).getNodes().evaluate(this.functions, t)), t(this, "parse", (e, t, n = 0) => {
|
|
1887
|
-
if (e instanceof
|
|
2242
|
+
t(this, "compile", (e, t = []) => this.getCompiler().compile(this.parse(e, t).getNodes()).getSource()), t(this, "evaluate", (e, t = {}) => this.parse(e, Object.keys(t)).getNodes().evaluate(this.functions, t)), t(this, "parse", (e, t = [], n = 0) => {
|
|
2243
|
+
if (e instanceof k) return e;
|
|
1888
2244
|
t.sort((e, t) => {
|
|
1889
2245
|
let n = e, r = t;
|
|
1890
2246
|
return typeof e == "object" && (n = Object.values(e)[0]), typeof t == "object" && (r = Object.values(t)[0]), n.localeCompare(r);
|
|
@@ -1895,13 +2251,17 @@ var ye = [
|
|
|
1895
2251
|
typeof e == "object" && (t = Object.keys(e)[0] + ":" + Object.values(e)[0]), r.push(t);
|
|
1896
2252
|
}
|
|
1897
2253
|
let i = this.cache.getItem(this.fixedEncodeURIComponent(e + "//" + r.join("|"))), a = i.get();
|
|
1898
|
-
|
|
2254
|
+
if (a === null) {
|
|
2255
|
+
let r = this.getParser().parse(this.getLexer().tokenize(e), t, n);
|
|
2256
|
+
a = new k(e, r), i.set(a), this.cache.save(i);
|
|
2257
|
+
}
|
|
2258
|
+
return a;
|
|
1899
2259
|
}), t(this, "lint", (e, t = null, n = 0) => {
|
|
1900
|
-
t === null && (console.log("Deprecated: passing \"null\" as the second argument of lint is deprecated, pass IGNORE_UNKNOWN_VARIABLES instead as the third argument"), n |= 1, t = []), e instanceof
|
|
2260
|
+
t === null && (console.log("Deprecated: passing \"null\" as the second argument of lint is deprecated, pass IGNORE_UNKNOWN_VARIABLES instead as the third argument"), n |= 1, t = []), e instanceof k || this.getParser().lint(this.getLexer().tokenize(e), t, n);
|
|
1901
2261
|
}), t(this, "fixedEncodeURIComponent", (e) => encodeURIComponent(e).replace(/[!'()*]/g, function(e) {
|
|
1902
2262
|
return "%" + e.charCodeAt(0).toString(16);
|
|
1903
2263
|
})), t(this, "register", (e, t, n) => {
|
|
1904
|
-
if (this.parser !== null) throw new
|
|
2264
|
+
if (this.parser !== null) throw new ae("Registering functions after calling evaluate(), compile(), or parse() is not supported.");
|
|
1905
2265
|
this.functions[e] = {
|
|
1906
2266
|
compiler: t,
|
|
1907
2267
|
evaluator: n
|
|
@@ -1910,19 +2270,19 @@ var ye = [
|
|
|
1910
2270
|
this.register(e.getName(), e.getCompiler(), e.getEvaluator());
|
|
1911
2271
|
}), t(this, "registerProvider", (e) => {
|
|
1912
2272
|
for (let t of e.getFunctions()) this.addFunction(t);
|
|
1913
|
-
}), t(this, "getLexer", () => (this.lexer === null && (this.lexer = { tokenize: o }), this.lexer)), t(this, "getParser", () => (this.parser === null && (this.parser = new
|
|
2273
|
+
}), t(this, "getLexer", () => (this.lexer === null && (this.lexer = { tokenize: o }), this.lexer)), t(this, "getParser", () => (this.parser === null && (this.parser = new E(this.functions)), this.parser)), t(this, "getCompiler", () => (this.compiler === null && (this.compiler = new D(this.functions)), this.compiler.reset())), this.functions = [], this.lexer = null, this.parser = null, this.compiler = null, this.cache = e || new ie(), this._registerBuiltinFunctions();
|
|
1914
2274
|
for (let e of n) this.registerProvider(e);
|
|
1915
2275
|
}
|
|
1916
2276
|
_registerBuiltinFunctions() {
|
|
1917
|
-
let e =
|
|
1918
|
-
this.addFunction(e), this.addFunction(t), this.addFunction(new
|
|
2277
|
+
let e = j.fromJavascript("Math.min", "min"), t = j.fromJavascript("Math.max", "max");
|
|
2278
|
+
this.addFunction(e), this.addFunction(t), this.addFunction(new j("constant", function(e) {
|
|
1919
2279
|
return `(function(__n){var __g=(typeof globalThis!=='undefined'?globalThis:(typeof window!=='undefined'?window:(typeof global!=='undefined'?global:{})));return __n.split('.').reduce(function(o,k){return o==null?undefined:o[k];}, __g)})(${e})`;
|
|
1920
2280
|
}, function(e, t) {
|
|
1921
2281
|
if (typeof t != "string" || !t) return;
|
|
1922
2282
|
let n = (r = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}, t.split(".").reduce((e, t) => e?.[t], r));
|
|
1923
2283
|
var r;
|
|
1924
2284
|
return n === void 0 && e && Object.prototype.hasOwnProperty.call(e, t) && (n = e[t]), n;
|
|
1925
|
-
})), this.addFunction(new
|
|
2285
|
+
})), this.addFunction(new j("enum", function(e) {
|
|
1926
2286
|
return `(function(__n){var __g=(typeof globalThis!=='undefined'?globalThis:(typeof window!=='undefined'?window:(typeof global!=='undefined'?global:{})));if(typeof __n!=='string'||!__n)return undefined;var s=String(__n);var keys=[],buf='';for(var i=0;i<s.length;i++){var c=s.charCodeAt(i);if(c===46||c===92){if(buf){keys.push(buf);buf='';}continue;}if(c===58){if(i+1<s.length&&s.charCodeAt(i+1)===58){if(buf){keys.push(buf);buf='';}i++;continue;}}buf+=s[i];}if(buf)keys.push(buf);return keys.reduce(function(o,k){return o==null?undefined:o[k];}, __g)})(${e})`;
|
|
1927
2287
|
}, function(e, t) {
|
|
1928
2288
|
if (typeof t != "string" || !t) return;
|
|
@@ -1932,30 +2292,32 @@ var ye = [
|
|
|
1932
2292
|
}));
|
|
1933
2293
|
}
|
|
1934
2294
|
}
|
|
1935
|
-
class
|
|
2295
|
+
class N {
|
|
1936
2296
|
getFunctions() {
|
|
1937
|
-
throw Error("getFunctions must be implemented by " + this.name);
|
|
2297
|
+
throw Error("getFunctions must be implemented by " + this.constructor.name);
|
|
1938
2298
|
}
|
|
1939
2299
|
}
|
|
1940
|
-
let
|
|
1941
|
-
|
|
2300
|
+
let oe = new j("isset", function(e) {
|
|
2301
|
+
if (/^(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')$/.test(e)) throw Error("isset() does not support compile() when called with a string-literal path (e.g. isset(\"foo.bar\")). Use an expression path instead (e.g. isset(foo.bar) or isset(foo?.bar)), or call evaluate() directly.");
|
|
2302
|
+
return `(function(){try{var __v=(${e});return __v!==null&&__v!==undefined;}catch(e){return false;}})()`;
|
|
1942
2303
|
}, function(e, t) {
|
|
1943
2304
|
if (typeof t != "string") return t != null;
|
|
1944
2305
|
if (!(t.split(/[.\[]/)[0] in e)) return !0;
|
|
1945
2306
|
let n = "", r = [], i = "", a = "";
|
|
1946
2307
|
for (let e = 0; e < t.length; e++) {
|
|
1947
2308
|
let o = t[e];
|
|
1948
|
-
if (o !== "]")
|
|
1949
|
-
if (
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
2309
|
+
if (o !== "]") {
|
|
2310
|
+
if (o !== "[") {
|
|
2311
|
+
if (i === "object" && (!/[A-z0-9_]/.test(o) || e === t.length - 1)) {
|
|
2312
|
+
let n = !1;
|
|
2313
|
+
if (e === t.length - 1 && (a += o, n = !0), i = "", r.push({
|
|
2314
|
+
type: "object",
|
|
2315
|
+
attribute: a
|
|
2316
|
+
}), a = "", n) continue;
|
|
2317
|
+
}
|
|
2318
|
+
o === "." ? (i = "object", a = "") : i ? a += o : n += o;
|
|
2319
|
+
} else i = "array", a = "";
|
|
2320
|
+
} else i = "", r.push({
|
|
1959
2321
|
type: "array",
|
|
1960
2322
|
index: a.replace(/"/g, "").replace(/'/g, "")
|
|
1961
2323
|
}), a = "";
|
|
@@ -1978,28 +2340,38 @@ var ye = [
|
|
|
1978
2340
|
return !1;
|
|
1979
2341
|
}
|
|
1980
2342
|
return e[n] !== void 0;
|
|
1981
|
-
})
|
|
1982
|
-
function
|
|
2343
|
+
});
|
|
2344
|
+
function P(...e) {
|
|
2345
|
+
let [t, n, r] = e, i = t, a = n;
|
|
2346
|
+
if (e.length < 2 || i === void 0 || a === void 0) return null;
|
|
2347
|
+
if (i === "" || !1 === i || i === null) return !1;
|
|
2348
|
+
if (typeof i == "function" || typeof i == "object" || typeof a == "function" || typeof a == "object") return { 0: "" };
|
|
2349
|
+
!0 === i && (i = "1");
|
|
2350
|
+
let o = i + "", s = (a + "").split(o);
|
|
2351
|
+
return r === void 0 ? s : (r === 0 && (r = 1), r > 0 ? r >= s.length ? s : s.slice(0, r - 1).concat([s.slice(r - 1).join(o)]) : -r >= s.length ? [] : (s.splice(s.length + r), s));
|
|
2352
|
+
}
|
|
2353
|
+
let se = (e) => Object.entries(e);
|
|
2354
|
+
function ce(e) {
|
|
1983
2355
|
return typeof e == "object" && !!e;
|
|
1984
2356
|
}
|
|
1985
|
-
function
|
|
1986
|
-
return
|
|
2357
|
+
function le(e) {
|
|
2358
|
+
return ce(e) && !function(e) {
|
|
1987
2359
|
return Array.isArray(e);
|
|
1988
2360
|
}(e);
|
|
1989
2361
|
}
|
|
1990
|
-
function
|
|
2362
|
+
function ue(e) {
|
|
1991
2363
|
return function(e) {
|
|
1992
|
-
return
|
|
2364
|
+
return ce(e);
|
|
1993
2365
|
}(e) ? e : {};
|
|
1994
2366
|
}
|
|
1995
|
-
let
|
|
1996
|
-
function
|
|
2367
|
+
let de = typeof window == "object" && window !== null ? window : typeof global == "object" && global !== null ? global : {};
|
|
2368
|
+
function fe() {
|
|
1997
2369
|
let e = (() => {
|
|
1998
|
-
let e =
|
|
1999
|
-
typeof e == "object" && e || (e = {},
|
|
2370
|
+
let e = de.$locutus;
|
|
2371
|
+
typeof e == "object" && e || (e = {}, de.$locutus = e);
|
|
2000
2372
|
let t = e.php;
|
|
2001
2373
|
return typeof t == "object" && t || (t = {}, e.php = t), t;
|
|
2002
|
-
})(), t = e.ini, n = e.locales, r = e.localeCategories, i = e.pointers, a =
|
|
2374
|
+
})(), t = e.ini, n = e.locales, r = e.localeCategories, i = e.pointers, a = le(t) ? t : {}, o = ((e) => le(e))(n) ? n : {}, s = ((e) => le(e))(r) ? r : {}, c = Array.isArray(i) ? i : [];
|
|
2003
2375
|
t !== a && (e.ini = a), n !== o && (e.locales = o), r !== s && (e.localeCategories = s), i !== c && (e.pointers = c);
|
|
2004
2376
|
let l = e.locale_default;
|
|
2005
2377
|
return {
|
|
@@ -2010,11 +2382,42 @@ var ye = [
|
|
|
2010
2382
|
locale_default: typeof l == "string" ? l : void 0
|
|
2011
2383
|
};
|
|
2012
2384
|
}
|
|
2013
|
-
function
|
|
2014
|
-
let t =
|
|
2385
|
+
function pe(e) {
|
|
2386
|
+
let t = fe().ini[e];
|
|
2015
2387
|
return t && t.local_value !== void 0 ? t.local_value === null ? "" : String(t.local_value) : "";
|
|
2016
2388
|
}
|
|
2017
|
-
function
|
|
2389
|
+
function me(e) {
|
|
2390
|
+
if (e === void 0) throw Error("strlen() expects exactly 1 argument, 0 given");
|
|
2391
|
+
let t = e + "";
|
|
2392
|
+
if ((pe("unicode.semantics") || "off") === "off") return t.length;
|
|
2393
|
+
let n = 0, r = 0, i = function(e, t) {
|
|
2394
|
+
let n = e.charCodeAt(t);
|
|
2395
|
+
if (n >= 55296 && n <= 56319) {
|
|
2396
|
+
if (e.length <= t + 1) throw Error("High surrogate without following low surrogate");
|
|
2397
|
+
let n = e.charCodeAt(t + 1);
|
|
2398
|
+
if (n < 56320 || n > 57343) throw Error("High surrogate without following low surrogate");
|
|
2399
|
+
return e.charAt(t) + e.charAt(t + 1);
|
|
2400
|
+
}
|
|
2401
|
+
if (n >= 56320 && n <= 57343) {
|
|
2402
|
+
if (t === 0) throw Error("Low surrogate without preceding high surrogate");
|
|
2403
|
+
let n = e.charCodeAt(t - 1);
|
|
2404
|
+
if (n < 55296 || n > 56319) throw Error("Low surrogate without preceding high surrogate");
|
|
2405
|
+
return !1;
|
|
2406
|
+
}
|
|
2407
|
+
return e.charAt(t);
|
|
2408
|
+
};
|
|
2409
|
+
for (n = 0, r = 0; n < t.length; n++) !1 !== i(t, n) && r++;
|
|
2410
|
+
return r;
|
|
2411
|
+
}
|
|
2412
|
+
function he(e) {
|
|
2413
|
+
if (e === void 0) throw Error("strtolower() expects exactly 1 argument, 0 given");
|
|
2414
|
+
return (e + "").toLowerCase();
|
|
2415
|
+
}
|
|
2416
|
+
function ge(e) {
|
|
2417
|
+
if (e === void 0) throw Error("strtoupper() expects exactly 1 argument, 0 given");
|
|
2418
|
+
return (e + "").toUpperCase();
|
|
2419
|
+
}
|
|
2420
|
+
function F(e, t, n) {
|
|
2018
2421
|
let r = function(e) {
|
|
2019
2422
|
if (typeof e == "boolean") return e ? "1" : "";
|
|
2020
2423
|
if (typeof e == "string") return e;
|
|
@@ -2022,17 +2425,25 @@ var ye = [
|
|
|
2022
2425
|
if (e === void 0) return "";
|
|
2023
2426
|
if (typeof e == "object") return Array.isArray(e) ? "Array" : e === null ? "" : "Object";
|
|
2024
2427
|
throw Error("Unsupported value type");
|
|
2025
|
-
}(e), i =
|
|
2428
|
+
}(e), i = pe("unicode.semantics") === "on" ? r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[\s\S]/g) || [] : null, a = i ? i.length : r.length, o = a;
|
|
2026
2429
|
return t < 0 && (t += o), n !== void 0 && (o = n < 0 ? n + o : n + t), !(t > a || t < 0 || t > o) && (i ? i.slice(t, o).join("") : r.slice(t, o));
|
|
2027
2430
|
}
|
|
2028
|
-
function
|
|
2431
|
+
function _e(e, t, n) {
|
|
2432
|
+
let r = 0;
|
|
2433
|
+
return r = (e += "").indexOf(t), r !== -1 && (n ? e.substr(0, r) : e.slice(r));
|
|
2434
|
+
}
|
|
2435
|
+
function ve(e, t, n) {
|
|
2436
|
+
let r = 0;
|
|
2437
|
+
return r = (e += "").toLowerCase().indexOf((t + "").toLowerCase()), r !== -1 && (n ? e.substr(0, r) : e.slice(r));
|
|
2438
|
+
}
|
|
2439
|
+
function ye(e, ...t) {
|
|
2029
2440
|
let n = {};
|
|
2030
2441
|
if (t.length < 1) return n;
|
|
2031
|
-
let r =
|
|
2032
|
-
e: for (let [e, i] of
|
|
2442
|
+
let r = ue(e);
|
|
2443
|
+
e: for (let [e, i] of se(r)) {
|
|
2033
2444
|
for (let e of t) {
|
|
2034
|
-
let t =
|
|
2035
|
-
for (let [, e] of
|
|
2445
|
+
let t = ue(e), n = !1;
|
|
2446
|
+
for (let [, e] of se(t)) if (e === i) {
|
|
2036
2447
|
n = !0;
|
|
2037
2448
|
break;
|
|
2038
2449
|
}
|
|
@@ -2042,12 +2453,12 @@ var ye = [
|
|
|
2042
2453
|
}
|
|
2043
2454
|
return n;
|
|
2044
2455
|
}
|
|
2045
|
-
let
|
|
2456
|
+
let be = (e) => {
|
|
2046
2457
|
if (!e || typeof e != "object") return !1;
|
|
2047
2458
|
let t = Object.getPrototypeOf(e);
|
|
2048
2459
|
return t === Array.prototype || t === Object.prototype;
|
|
2049
2460
|
};
|
|
2050
|
-
function
|
|
2461
|
+
function xe(e, t = 0) {
|
|
2051
2462
|
let n = 0;
|
|
2052
2463
|
if (e == null) return 0;
|
|
2053
2464
|
if (typeof e != "object") return 1;
|
|
@@ -2058,51 +2469,48 @@ var ye = [
|
|
|
2058
2469
|
for (let t of Object.keys(e)) {
|
|
2059
2470
|
n++;
|
|
2060
2471
|
let r = e[Number(t)];
|
|
2061
|
-
i &&
|
|
2472
|
+
i && be(r) && (n += xe(r, 1));
|
|
2062
2473
|
}
|
|
2063
2474
|
return n;
|
|
2064
2475
|
}
|
|
2065
|
-
for (let t
|
|
2066
|
-
n++;
|
|
2067
|
-
let r = e[t];
|
|
2068
|
-
i && ue(r) && (n += B(r, 1));
|
|
2069
|
-
}
|
|
2476
|
+
for (let t of Object.values(e)) n++, i && be(t) && (n += xe(t, 1));
|
|
2070
2477
|
return n;
|
|
2071
2478
|
}
|
|
2072
|
-
|
|
2073
|
-
|
|
2479
|
+
function Se(...e) {
|
|
2480
|
+
let t, n = "", r = "", i = "";
|
|
2481
|
+
if (e.length === 1) {
|
|
2482
|
+
let [n] = e;
|
|
2483
|
+
t = n;
|
|
2484
|
+
} else {
|
|
2485
|
+
let [n, r] = e;
|
|
2486
|
+
i = String(n ?? ""), t = r;
|
|
2487
|
+
}
|
|
2488
|
+
if (typeof t == "object" && t) {
|
|
2489
|
+
if (Array.isArray(t)) return t.join(i);
|
|
2490
|
+
for (let e in t) n += r + t[e], r = i;
|
|
2491
|
+
return n;
|
|
2492
|
+
}
|
|
2493
|
+
return String(t);
|
|
2494
|
+
}
|
|
2495
|
+
let Ce = new j("implode", function(e, t) {
|
|
2496
|
+
return `__runtime.implode(${e}, ${t})`;
|
|
2074
2497
|
}, function(e, t, n) {
|
|
2075
|
-
return
|
|
2076
|
-
|
|
2077
|
-
if (e.length === 1) {
|
|
2078
|
-
let [n] = e;
|
|
2079
|
-
t = n;
|
|
2080
|
-
} else {
|
|
2081
|
-
let [n, r] = e;
|
|
2082
|
-
i = String(n ?? ""), t = r;
|
|
2083
|
-
}
|
|
2084
|
-
if (typeof t == "object" && t) {
|
|
2085
|
-
if (Array.isArray(t)) return t.join(i);
|
|
2086
|
-
for (let e in t) n += r + t[e], r = i;
|
|
2087
|
-
return n;
|
|
2088
|
-
}
|
|
2089
|
-
return String(t);
|
|
2090
|
-
}(t, n);
|
|
2091
|
-
}), H = new P("count", function(e, t) {
|
|
2498
|
+
return Se(t, n);
|
|
2499
|
+
}), we = new j("count", function(e, t) {
|
|
2092
2500
|
let n = "";
|
|
2093
|
-
return t && (n = `, ${t}`), `count(${e}${n})`;
|
|
2501
|
+
return t && (n = `, ${t}`), `__runtime.count(${e}${n})`;
|
|
2094
2502
|
}, function(e, t, n) {
|
|
2095
|
-
return
|
|
2096
|
-
}),
|
|
2503
|
+
return xe(t, n);
|
|
2504
|
+
}), Te = new j("array_intersect", function(e, ...t) {
|
|
2097
2505
|
let n = "";
|
|
2098
|
-
return t.length > 0 && (n = ", " + t.join(", ")), `array_intersect(${e}${n})`;
|
|
2506
|
+
return t.length > 0 && (n = ", " + t.join(", ")), `__runtime.array_intersect(${e}${n})`;
|
|
2099
2507
|
}, function(e) {
|
|
2100
2508
|
let t = [], n = !0;
|
|
2101
2509
|
for (let e = 1; e < arguments.length; e++) t.push(arguments[e]), Array.isArray(arguments[e]) || (n = !1);
|
|
2102
|
-
let r =
|
|
2510
|
+
let r = ye.apply(null, t);
|
|
2103
2511
|
return n ? Object.values(r) : r;
|
|
2104
2512
|
});
|
|
2105
|
-
function
|
|
2513
|
+
function Ee(e, t) {
|
|
2106
2514
|
let n, r = /* @__PURE__ */ new Date(), i = [
|
|
2107
2515
|
"Sun",
|
|
2108
2516
|
"Mon",
|
|
@@ -2124,7 +2532,7 @@ var ye = [
|
|
|
2124
2532
|
"November",
|
|
2125
2533
|
"December"
|
|
2126
2534
|
], a = /\\?(.?)/gi, o = function(e, t) {
|
|
2127
|
-
return r = e, Object.
|
|
2535
|
+
return r = e, Object.hasOwn(n, r) ? String(n[e]()) : t;
|
|
2128
2536
|
var r;
|
|
2129
2537
|
}, s = function(e, t) {
|
|
2130
2538
|
let n = String(e);
|
|
@@ -2259,7 +2667,8 @@ var ye = [
|
|
|
2259
2667
|
}, c = e, r = (l = t) === void 0 ? /* @__PURE__ */ new Date() : l instanceof Date ? new Date(l) : /* @__PURE__ */ new Date(1e3 * Number(l)), c.replace(a, o);
|
|
2260
2668
|
var c, l;
|
|
2261
2669
|
}
|
|
2262
|
-
|
|
2670
|
+
let I = "[ \\t]+", L = "[ \\t]*", R = "(?:([ap])\\.?m\\.?([\\t ]|$))", z = "(2[0-4]|[01]?[0-9])", De = "([01][0-9]|2[0-4])", Oe = "(0?[1-9]|1[0-2])", B = "([0-5]?[0-9])", V = "([0-5][0-9])", H = "(60|[0-5]?[0-9])", U = "(60|[0-5][0-9])", ke = "(?:\\.([0-9]+))", Ae = "sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun|mon|tue|wed|thu|fri|sat|weekdays?", je = "next|last|previous|this", W = "(?:second|sec|minute|min|hour|day|fortnight|forthnight|month|year)s?|weeks|" + Ae, Me = "([0-9]{1,4})", G = "([0-9]{4})", K = "(1[0-2]|0?[0-9])", q = "(0[0-9]|1[0-2])", J = "(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)", Y = "(0[0-9]|[1-2][0-9]|3[01])", Ne = "january|february|march|april|may|june|july|august|september|october|november|december", Pe = "jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec", Fe = "(" + Ne + "|" + Pe + "|i[vx]|vi{0,3}|xi{0,2}|i{1,3})", Ie = "((?:GMT)?([+-])" + z + ":?" + B + "?)", Le = Fe + "[ .\\t-]*" + J + "[,.stndrh\\t ]*";
|
|
2671
|
+
function X(e, t) {
|
|
2263
2672
|
switch (t?.toLowerCase()) {
|
|
2264
2673
|
case "a":
|
|
2265
2674
|
e += e === 12 ? -12 : 0;
|
|
@@ -2268,11 +2677,11 @@ var ye = [
|
|
|
2268
2677
|
}
|
|
2269
2678
|
return e;
|
|
2270
2679
|
}
|
|
2271
|
-
function
|
|
2680
|
+
function Z(e) {
|
|
2272
2681
|
let t = +e;
|
|
2273
2682
|
return e.length < 4 && t < 100 && (t += t < 70 ? 2e3 : 1900), t;
|
|
2274
2683
|
}
|
|
2275
|
-
function
|
|
2684
|
+
function Q(e) {
|
|
2276
2685
|
return {
|
|
2277
2686
|
jan: 0,
|
|
2278
2687
|
january: 0,
|
|
@@ -2312,7 +2721,7 @@ var ye = [
|
|
|
2312
2721
|
xii: 11
|
|
2313
2722
|
}[e.toLowerCase()] ?? NaN;
|
|
2314
2723
|
}
|
|
2315
|
-
function
|
|
2724
|
+
function Re(e, t = 0) {
|
|
2316
2725
|
return {
|
|
2317
2726
|
mon: 1,
|
|
2318
2727
|
monday: 1,
|
|
@@ -2330,13 +2739,13 @@ var ye = [
|
|
|
2330
2739
|
sunday: 0
|
|
2331
2740
|
}[e.toLowerCase()] || t;
|
|
2332
2741
|
}
|
|
2333
|
-
function
|
|
2742
|
+
function ze(e, t = NaN) {
|
|
2334
2743
|
let n = e?.match(/(?:GMT)?([+-])(\d+)(:?)(\d{0,2})/i);
|
|
2335
2744
|
if (!n) return t;
|
|
2336
2745
|
let r = n[1] === "-" ? -1 : 1, i = +(n[2] ?? 0), a = +(n[4] ?? 0);
|
|
2337
2746
|
return n[4] || n[3] || (a = Math.floor(i % 100), i = Math.floor(i / 100)), r * (60 * i + a) * 60;
|
|
2338
2747
|
}
|
|
2339
|
-
let
|
|
2748
|
+
let Be = {
|
|
2340
2749
|
acdt: 37800,
|
|
2341
2750
|
acst: 34200,
|
|
2342
2751
|
addt: -7200,
|
|
@@ -2481,7 +2890,7 @@ var ye = [
|
|
|
2481
2890
|
x: -39600,
|
|
2482
2891
|
y: -43200,
|
|
2483
2892
|
z: 0
|
|
2484
|
-
},
|
|
2893
|
+
}, $ = {
|
|
2485
2894
|
yesterday: {
|
|
2486
2895
|
regex: /^yesterday/i,
|
|
2487
2896
|
name: "yesterday",
|
|
@@ -2525,22 +2934,22 @@ var ye = [
|
|
|
2525
2934
|
regex: /^(first|last) day of/i,
|
|
2526
2935
|
name: "firstdayof | lastdayof",
|
|
2527
2936
|
callback(e, t) {
|
|
2528
|
-
t.toLowerCase() === "first" ?
|
|
2937
|
+
this.firstOrLastDayOfMonth = t.toLowerCase() === "first" ? 1 : -1;
|
|
2529
2938
|
}
|
|
2530
2939
|
},
|
|
2531
2940
|
backOrFrontOf: {
|
|
2532
|
-
regex:
|
|
2941
|
+
regex: RegExp("^(back|front) of " + z + L + R + "?", "i"),
|
|
2533
2942
|
name: "backof | frontof",
|
|
2534
2943
|
callback(e, t, n, r) {
|
|
2535
2944
|
let i = +n, a = 15;
|
|
2536
|
-
return t.toLowerCase() === "back" || (--i, a = 45), i =
|
|
2945
|
+
return t.toLowerCase() === "back" || (--i, a = 45), i = X(i, r), this.resetTime() && this.time(i, a, 0, 0);
|
|
2537
2946
|
}
|
|
2538
2947
|
},
|
|
2539
2948
|
mssqltime: {
|
|
2540
|
-
regex:
|
|
2949
|
+
regex: RegExp("^" + Oe + ":" + V + ":" + U + "[:.]([0-9]+)" + R, "i"),
|
|
2541
2950
|
name: "mssqltime",
|
|
2542
2951
|
callback(e, t, n, r, i, a) {
|
|
2543
|
-
return this.time(
|
|
2952
|
+
return this.time(X(+t, a), +n, +r, +i.substr(0, 3));
|
|
2544
2953
|
}
|
|
2545
2954
|
},
|
|
2546
2955
|
oracledate: {
|
|
@@ -2565,175 +2974,175 @@ var ye = [
|
|
|
2565
2974
|
}
|
|
2566
2975
|
},
|
|
2567
2976
|
timeLong12: {
|
|
2568
|
-
regex:
|
|
2977
|
+
regex: RegExp("^" + Oe + "[:.]" + B + "[:.]" + U + L + R, "i"),
|
|
2569
2978
|
name: "timelong12",
|
|
2570
2979
|
callback(e, t, n, r, i) {
|
|
2571
|
-
return this.time(
|
|
2980
|
+
return this.time(X(+t, i), +n, +r, 0);
|
|
2572
2981
|
}
|
|
2573
2982
|
},
|
|
2574
2983
|
timeShort12: {
|
|
2575
|
-
regex:
|
|
2984
|
+
regex: RegExp("^" + Oe + "[:.]" + V + L + R, "i"),
|
|
2576
2985
|
name: "timeshort12",
|
|
2577
2986
|
callback(e, t, n, r) {
|
|
2578
|
-
return this.time(
|
|
2987
|
+
return this.time(X(+t, r), +n, 0, 0);
|
|
2579
2988
|
}
|
|
2580
2989
|
},
|
|
2581
2990
|
timeTiny12: {
|
|
2582
|
-
regex:
|
|
2991
|
+
regex: RegExp("^" + Oe + L + R, "i"),
|
|
2583
2992
|
name: "timetiny12",
|
|
2584
2993
|
callback(e, t, n) {
|
|
2585
|
-
return this.time(
|
|
2994
|
+
return this.time(X(+t, n), 0, 0, 0);
|
|
2586
2995
|
}
|
|
2587
2996
|
},
|
|
2588
2997
|
soap: {
|
|
2589
|
-
regex:
|
|
2998
|
+
regex: RegExp("^" + G + "-" + q + "-" + Y + "T" + De + ":" + V + ":" + U + ke + Ie + "?", "i"),
|
|
2590
2999
|
name: "soap",
|
|
2591
3000
|
callback(e, t, n, r, i, a, o, s, c) {
|
|
2592
|
-
return this.ymd(+t, n - 1, +r) && this.time(+i, +a, +o, +s.substr(0, 3)) && this.zone(
|
|
3001
|
+
return this.ymd(+t, n - 1, +r) && this.time(+i, +a, +o, +s.substr(0, 3)) && this.zone(ze(c));
|
|
2593
3002
|
}
|
|
2594
3003
|
},
|
|
2595
3004
|
wddx: {
|
|
2596
|
-
regex:
|
|
3005
|
+
regex: RegExp("^" + G + "-" + K + "-" + J + "T" + z + ":" + B + ":" + H),
|
|
2597
3006
|
name: "wddx",
|
|
2598
3007
|
callback(e, t, n, r, i, a, o) {
|
|
2599
3008
|
return this.ymd(+t, n - 1, +r) && this.time(+i, +a, +o, 0);
|
|
2600
3009
|
}
|
|
2601
3010
|
},
|
|
2602
3011
|
exif: {
|
|
2603
|
-
regex:
|
|
3012
|
+
regex: RegExp("^" + G + ":" + q + ":" + Y + " " + De + ":" + V + ":" + U, "i"),
|
|
2604
3013
|
name: "exif",
|
|
2605
3014
|
callback(e, t, n, r, i, a, o) {
|
|
2606
3015
|
return this.ymd(+t, n - 1, +r) && this.time(+i, +a, +o, 0);
|
|
2607
3016
|
}
|
|
2608
3017
|
},
|
|
2609
3018
|
xmlRpc: {
|
|
2610
|
-
regex:
|
|
3019
|
+
regex: RegExp("^" + G + q + Y + "T" + z + ":" + V + ":" + U),
|
|
2611
3020
|
name: "xmlrpc",
|
|
2612
3021
|
callback(e, t, n, r, i, a, o) {
|
|
2613
3022
|
return this.ymd(+t, n - 1, +r) && this.time(+i, +a, +o, 0);
|
|
2614
3023
|
}
|
|
2615
3024
|
},
|
|
2616
3025
|
xmlRpcNoColon: {
|
|
2617
|
-
regex:
|
|
3026
|
+
regex: RegExp("^" + G + q + Y + "[Tt]" + z + V + U),
|
|
2618
3027
|
name: "xmlrpcnocolon",
|
|
2619
3028
|
callback(e, t, n, r, i, a, o) {
|
|
2620
3029
|
return this.ymd(+t, n - 1, +r) && this.time(+i, +a, +o, 0);
|
|
2621
3030
|
}
|
|
2622
3031
|
},
|
|
2623
3032
|
clf: {
|
|
2624
|
-
regex:
|
|
3033
|
+
regex: RegExp("^" + J + "/(" + Pe + ")/" + G + ":" + De + ":" + V + ":" + U + I + Ie, "i"),
|
|
2625
3034
|
name: "clf",
|
|
2626
3035
|
callback(e, t, n, r, i, a, o, s) {
|
|
2627
|
-
return this.ymd(+r,
|
|
3036
|
+
return this.ymd(+r, Q(n), +t) && this.time(+i, +a, +o, 0) && this.zone(ze(s));
|
|
2628
3037
|
}
|
|
2629
3038
|
},
|
|
2630
3039
|
iso8601long: {
|
|
2631
|
-
regex:
|
|
3040
|
+
regex: RegExp("^t?" + z + "[:.]" + B + "[:.]" + H + ke, "i"),
|
|
2632
3041
|
name: "iso8601long",
|
|
2633
3042
|
callback(e, t, n, r, i) {
|
|
2634
3043
|
return this.time(+t, +n, +r, +i.substr(0, 3));
|
|
2635
3044
|
}
|
|
2636
3045
|
},
|
|
2637
3046
|
dateTextual: {
|
|
2638
|
-
regex:
|
|
3047
|
+
regex: RegExp("^" + Fe + "[ .\\t-]*" + J + "[,.stndrh\\t ]+" + Me, "i"),
|
|
2639
3048
|
name: "datetextual",
|
|
2640
3049
|
callback(e, t, n, r) {
|
|
2641
|
-
return this.ymd(
|
|
3050
|
+
return this.ymd(Z(r), Q(t), +n);
|
|
2642
3051
|
}
|
|
2643
3052
|
},
|
|
2644
3053
|
pointedDate4: {
|
|
2645
|
-
regex:
|
|
3054
|
+
regex: RegExp("^" + J + "[.\\t-]" + K + "[.-]" + G),
|
|
2646
3055
|
name: "pointeddate4",
|
|
2647
3056
|
callback(e, t, n, r) {
|
|
2648
3057
|
return this.ymd(+r, n - 1, +t);
|
|
2649
3058
|
}
|
|
2650
3059
|
},
|
|
2651
3060
|
pointedDate2: {
|
|
2652
|
-
regex:
|
|
3061
|
+
regex: RegExp("^" + J + "[.\\t]" + K + "\\.([0-9]{2})"),
|
|
2653
3062
|
name: "pointeddate2",
|
|
2654
3063
|
callback(e, t, n, r) {
|
|
2655
|
-
return this.ymd(
|
|
3064
|
+
return this.ymd(Z(r), n - 1, +t);
|
|
2656
3065
|
}
|
|
2657
3066
|
},
|
|
2658
3067
|
timeLong24: {
|
|
2659
|
-
regex:
|
|
3068
|
+
regex: RegExp("^t?" + z + "[:.]" + B + "[:.]" + H),
|
|
2660
3069
|
name: "timelong24",
|
|
2661
3070
|
callback(e, t, n, r) {
|
|
2662
3071
|
return this.time(+t, +n, +r, 0);
|
|
2663
3072
|
}
|
|
2664
3073
|
},
|
|
2665
3074
|
dateNoColon: {
|
|
2666
|
-
regex:
|
|
3075
|
+
regex: RegExp("^" + G + q + Y),
|
|
2667
3076
|
name: "datenocolon",
|
|
2668
3077
|
callback(e, t, n, r) {
|
|
2669
3078
|
return this.ymd(+t, n - 1, +r);
|
|
2670
3079
|
}
|
|
2671
3080
|
},
|
|
2672
3081
|
pgydotd: {
|
|
2673
|
-
regex:
|
|
3082
|
+
regex: RegExp("^" + G + "\\.?(00[1-9]|0[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6])"),
|
|
2674
3083
|
name: "pgydotd",
|
|
2675
3084
|
callback(e, t, n) {
|
|
2676
3085
|
return this.ymd(+t, 0, +n);
|
|
2677
3086
|
}
|
|
2678
3087
|
},
|
|
2679
3088
|
timeShort24: {
|
|
2680
|
-
regex:
|
|
3089
|
+
regex: RegExp("^t?" + z + "[:.]" + B, "i"),
|
|
2681
3090
|
name: "timeshort24",
|
|
2682
3091
|
callback(e, t, n) {
|
|
2683
3092
|
return this.time(+t, +n, 0, 0);
|
|
2684
3093
|
}
|
|
2685
3094
|
},
|
|
2686
3095
|
iso8601noColon: {
|
|
2687
|
-
regex:
|
|
3096
|
+
regex: RegExp("^t?" + De + V + U, "i"),
|
|
2688
3097
|
name: "iso8601nocolon",
|
|
2689
3098
|
callback(e, t, n, r) {
|
|
2690
3099
|
return this.time(+t, +n, +r, 0);
|
|
2691
3100
|
}
|
|
2692
3101
|
},
|
|
2693
3102
|
iso8601dateSlash: {
|
|
2694
|
-
regex:
|
|
3103
|
+
regex: RegExp("^" + G + "/" + q + "/" + Y + "/"),
|
|
2695
3104
|
name: "iso8601dateslash",
|
|
2696
3105
|
callback(e, t, n, r) {
|
|
2697
3106
|
return this.ymd(+t, n - 1, +r);
|
|
2698
3107
|
}
|
|
2699
3108
|
},
|
|
2700
3109
|
dateSlash: {
|
|
2701
|
-
regex:
|
|
3110
|
+
regex: RegExp("^" + G + "/" + K + "/" + J),
|
|
2702
3111
|
name: "dateslash",
|
|
2703
3112
|
callback(e, t, n, r) {
|
|
2704
3113
|
return this.ymd(+t, n - 1, +r);
|
|
2705
3114
|
}
|
|
2706
3115
|
},
|
|
2707
3116
|
american: {
|
|
2708
|
-
regex:
|
|
3117
|
+
regex: RegExp("^" + K + "/" + J + "/" + Me),
|
|
2709
3118
|
name: "american",
|
|
2710
3119
|
callback(e, t, n, r) {
|
|
2711
|
-
return this.ymd(
|
|
3120
|
+
return this.ymd(Z(r), t - 1, +n);
|
|
2712
3121
|
}
|
|
2713
3122
|
},
|
|
2714
3123
|
americanShort: {
|
|
2715
|
-
regex:
|
|
3124
|
+
regex: RegExp("^" + K + "/" + J),
|
|
2716
3125
|
name: "americanshort",
|
|
2717
3126
|
callback(e, t, n) {
|
|
2718
3127
|
return this.ymd(this.y, t - 1, +n);
|
|
2719
3128
|
}
|
|
2720
3129
|
},
|
|
2721
3130
|
gnuDateShortOrIso8601date2: {
|
|
2722
|
-
regex:
|
|
3131
|
+
regex: RegExp("^" + Me + "-" + K + "-" + J),
|
|
2723
3132
|
name: "gnudateshort | iso8601date2",
|
|
2724
3133
|
callback(e, t, n, r) {
|
|
2725
|
-
return this.ymd(
|
|
3134
|
+
return this.ymd(Z(t), n - 1, +r);
|
|
2726
3135
|
}
|
|
2727
3136
|
},
|
|
2728
3137
|
iso8601date4: {
|
|
2729
|
-
regex:
|
|
3138
|
+
regex: RegExp("^([+-]?[0-9]{4})-" + q + "-" + Y),
|
|
2730
3139
|
name: "iso8601date4",
|
|
2731
3140
|
callback(e, t, n, r) {
|
|
2732
3141
|
return this.ymd(+t, n - 1, +r);
|
|
2733
3142
|
}
|
|
2734
3143
|
},
|
|
2735
3144
|
gnuNoColon: {
|
|
2736
|
-
regex:
|
|
3145
|
+
regex: RegExp("^t?" + De + V, "i"),
|
|
2737
3146
|
name: "gnunocolon",
|
|
2738
3147
|
callback(e, t, n) {
|
|
2739
3148
|
switch (this.times) {
|
|
@@ -2744,63 +3153,63 @@ var ye = [
|
|
|
2744
3153
|
}
|
|
2745
3154
|
},
|
|
2746
3155
|
gnuDateShorter: {
|
|
2747
|
-
regex:
|
|
3156
|
+
regex: RegExp("^" + G + "-" + K),
|
|
2748
3157
|
name: "gnudateshorter",
|
|
2749
3158
|
callback(e, t, n) {
|
|
2750
3159
|
return this.ymd(+t, n - 1, 1);
|
|
2751
3160
|
}
|
|
2752
3161
|
},
|
|
2753
3162
|
pgTextReverse: {
|
|
2754
|
-
regex:
|
|
3163
|
+
regex: RegExp("^(\\d{3,4}|[4-9]\\d|3[2-9])-(" + Pe + ")-" + Y, "i"),
|
|
2755
3164
|
name: "pgtextreverse",
|
|
2756
3165
|
callback(e, t, n, r) {
|
|
2757
|
-
return this.ymd(
|
|
3166
|
+
return this.ymd(Z(t), Q(n), +r);
|
|
2758
3167
|
}
|
|
2759
3168
|
},
|
|
2760
3169
|
dateFull: {
|
|
2761
|
-
regex:
|
|
3170
|
+
regex: RegExp("^" + J + "[ \\t.-]*" + Fe + "[ \\t.-]*" + Me, "i"),
|
|
2762
3171
|
name: "datefull",
|
|
2763
3172
|
callback(e, t, n, r) {
|
|
2764
|
-
return this.ymd(
|
|
3173
|
+
return this.ymd(Z(r), Q(n), +t);
|
|
2765
3174
|
}
|
|
2766
3175
|
},
|
|
2767
3176
|
dateNoDay: {
|
|
2768
|
-
regex:
|
|
3177
|
+
regex: RegExp("^" + Fe + "[ .\\t-]*" + G, "i"),
|
|
2769
3178
|
name: "datenoday",
|
|
2770
3179
|
callback(e, t, n) {
|
|
2771
|
-
return this.ymd(+n,
|
|
3180
|
+
return this.ymd(+n, Q(t), 1);
|
|
2772
3181
|
}
|
|
2773
3182
|
},
|
|
2774
3183
|
dateNoDayRev: {
|
|
2775
|
-
regex:
|
|
3184
|
+
regex: RegExp("^" + G + "[ .\\t-]*" + Fe, "i"),
|
|
2776
3185
|
name: "datenodayrev",
|
|
2777
3186
|
callback(e, t, n) {
|
|
2778
|
-
return this.ymd(+t,
|
|
3187
|
+
return this.ymd(+t, Q(n), 1);
|
|
2779
3188
|
}
|
|
2780
3189
|
},
|
|
2781
3190
|
pgTextShort: {
|
|
2782
|
-
regex:
|
|
3191
|
+
regex: RegExp("^(" + Pe + ")-" + Y + "-" + Me, "i"),
|
|
2783
3192
|
name: "pgtextshort",
|
|
2784
3193
|
callback(e, t, n, r) {
|
|
2785
|
-
return this.ymd(
|
|
3194
|
+
return this.ymd(Z(r), Q(t), +n);
|
|
2786
3195
|
}
|
|
2787
3196
|
},
|
|
2788
3197
|
dateNoYear: {
|
|
2789
|
-
regex:
|
|
3198
|
+
regex: RegExp("^" + Le, "i"),
|
|
2790
3199
|
name: "datenoyear",
|
|
2791
3200
|
callback(e, t, n) {
|
|
2792
|
-
return this.ymd(this.y,
|
|
3201
|
+
return this.ymd(this.y, Q(t), +n);
|
|
2793
3202
|
}
|
|
2794
3203
|
},
|
|
2795
3204
|
dateNoYearRev: {
|
|
2796
|
-
regex:
|
|
3205
|
+
regex: RegExp("^" + J + "[ .\\t-]*" + Fe, "i"),
|
|
2797
3206
|
name: "datenoyearrev",
|
|
2798
3207
|
callback(e, t, n) {
|
|
2799
|
-
return this.ymd(this.y,
|
|
3208
|
+
return this.ymd(this.y, Q(n), +t);
|
|
2800
3209
|
}
|
|
2801
3210
|
},
|
|
2802
3211
|
isoWeekDay: {
|
|
2803
|
-
regex:
|
|
3212
|
+
regex: RegExp("^" + G + "-?W(0[1-9]|[1-4][0-9]|5[0-3])(?:-?([0-7]))?"),
|
|
2804
3213
|
name: "isoweekday | isoweek",
|
|
2805
3214
|
callback(e, t, n, r) {
|
|
2806
3215
|
let i = r ? +r : 1;
|
|
@@ -2810,7 +3219,7 @@ var ye = [
|
|
|
2810
3219
|
}
|
|
2811
3220
|
},
|
|
2812
3221
|
relativeText: {
|
|
2813
|
-
regex:
|
|
3222
|
+
regex: RegExp("^(first|second|third|fourth|fifth|sixth|seventh|eighth?|ninth|tenth|eleventh|twelfth|" + je + ")" + I + "(" + W + ")", "i"),
|
|
2814
3223
|
name: "relativetext",
|
|
2815
3224
|
callback(e, t, n) {
|
|
2816
3225
|
let { amount: r } = function(e) {
|
|
@@ -2890,53 +3299,53 @@ var ye = [
|
|
|
2890
3299
|
case "sat":
|
|
2891
3300
|
case "saturday":
|
|
2892
3301
|
case "sun":
|
|
2893
|
-
case "sunday": this.resetTime(), this.weekday =
|
|
3302
|
+
case "sunday": this.resetTime(), this.weekday = Re(n, 7), this.weekdayBehavior = 1, this.rd += 7 * (r > 0 ? r - 1 : r);
|
|
2894
3303
|
}
|
|
2895
3304
|
}
|
|
2896
3305
|
},
|
|
2897
3306
|
relative: {
|
|
2898
|
-
regex:
|
|
3307
|
+
regex: RegExp("^([+-]*)[ \\t]*(\\d+)[ \\t]*(" + W + "|week)", "i"),
|
|
2899
3308
|
name: "relative",
|
|
2900
3309
|
callback(e, t, n, r) {
|
|
2901
|
-
let i =
|
|
3310
|
+
let i = t.replace(/[^-]/g, "").length, a = +n * (-1) ** i;
|
|
2902
3311
|
switch (r.toLowerCase()) {
|
|
2903
3312
|
case "sec":
|
|
2904
3313
|
case "secs":
|
|
2905
3314
|
case "second":
|
|
2906
3315
|
case "seconds":
|
|
2907
|
-
this.rs +=
|
|
3316
|
+
this.rs += a;
|
|
2908
3317
|
break;
|
|
2909
3318
|
case "min":
|
|
2910
3319
|
case "mins":
|
|
2911
3320
|
case "minute":
|
|
2912
3321
|
case "minutes":
|
|
2913
|
-
this.ri +=
|
|
3322
|
+
this.ri += a;
|
|
2914
3323
|
break;
|
|
2915
3324
|
case "hour":
|
|
2916
3325
|
case "hours":
|
|
2917
|
-
this.rh +=
|
|
3326
|
+
this.rh += a;
|
|
2918
3327
|
break;
|
|
2919
3328
|
case "day":
|
|
2920
3329
|
case "days":
|
|
2921
|
-
this.rd +=
|
|
3330
|
+
this.rd += a;
|
|
2922
3331
|
break;
|
|
2923
3332
|
case "fortnight":
|
|
2924
3333
|
case "fortnights":
|
|
2925
3334
|
case "forthnight":
|
|
2926
3335
|
case "forthnights":
|
|
2927
|
-
this.rd += 14 *
|
|
3336
|
+
this.rd += 14 * a;
|
|
2928
3337
|
break;
|
|
2929
3338
|
case "week":
|
|
2930
3339
|
case "weeks":
|
|
2931
|
-
this.rd += 7 *
|
|
3340
|
+
this.rd += 7 * a;
|
|
2932
3341
|
break;
|
|
2933
3342
|
case "month":
|
|
2934
3343
|
case "months":
|
|
2935
|
-
this.rm +=
|
|
3344
|
+
this.rm += a;
|
|
2936
3345
|
break;
|
|
2937
3346
|
case "year":
|
|
2938
3347
|
case "years":
|
|
2939
|
-
this.ry +=
|
|
3348
|
+
this.ry += a;
|
|
2940
3349
|
break;
|
|
2941
3350
|
case "mon":
|
|
2942
3351
|
case "monday":
|
|
@@ -2951,19 +3360,19 @@ var ye = [
|
|
|
2951
3360
|
case "sat":
|
|
2952
3361
|
case "saturday":
|
|
2953
3362
|
case "sun":
|
|
2954
|
-
case "sunday": this.resetTime(), this.weekday =
|
|
3363
|
+
case "sunday": this.resetTime(), this.weekday = Re(r, 7), this.weekdayBehavior = 1, this.rd += 7 * (a > 0 ? a - 1 : a);
|
|
2955
3364
|
}
|
|
2956
3365
|
}
|
|
2957
3366
|
},
|
|
2958
3367
|
dayText: {
|
|
2959
|
-
regex:
|
|
3368
|
+
regex: RegExp("^(" + Ae + ")", "i"),
|
|
2960
3369
|
name: "daytext",
|
|
2961
3370
|
callback(e, t) {
|
|
2962
|
-
this.resetTime(), this.weekday =
|
|
3371
|
+
this.resetTime(), this.weekday = Re(t, 0), this.weekdayBehavior !== 2 && (this.weekdayBehavior = 1);
|
|
2963
3372
|
}
|
|
2964
3373
|
},
|
|
2965
3374
|
relativeTextWeek: {
|
|
2966
|
-
regex:
|
|
3375
|
+
regex: RegExp("^(" + je + ")" + I + "week", "i"),
|
|
2967
3376
|
name: "relativetextweek",
|
|
2968
3377
|
callback(e, t) {
|
|
2969
3378
|
switch (this.weekdayBehavior = 2, t.toLowerCase()) {
|
|
@@ -2980,24 +3389,24 @@ var ye = [
|
|
|
2980
3389
|
}
|
|
2981
3390
|
},
|
|
2982
3391
|
monthFullOrMonthAbbr: {
|
|
2983
|
-
regex:
|
|
3392
|
+
regex: RegExp("^(" + Ne + "|" + Pe + ")", "i"),
|
|
2984
3393
|
name: "monthfull | monthabbr",
|
|
2985
3394
|
callback(e, t) {
|
|
2986
|
-
return this.ymd(this.y,
|
|
3395
|
+
return this.ymd(this.y, Q(t), this.d);
|
|
2987
3396
|
}
|
|
2988
3397
|
},
|
|
2989
3398
|
tzCorrection: {
|
|
2990
|
-
regex:
|
|
3399
|
+
regex: RegExp("^" + Ie, "i"),
|
|
2991
3400
|
name: "tzcorrection",
|
|
2992
3401
|
callback(e) {
|
|
2993
|
-
return this.zone(
|
|
3402
|
+
return this.zone(ze(e));
|
|
2994
3403
|
}
|
|
2995
3404
|
},
|
|
2996
3405
|
tzAbbr: {
|
|
2997
3406
|
regex: /* @__PURE__ */ RegExp("^\\(?([a-zA-Z]{1,6})\\)?"),
|
|
2998
3407
|
name: "tzabbr",
|
|
2999
3408
|
callback(e, t) {
|
|
3000
|
-
let n =
|
|
3409
|
+
let n = Be[t.toLowerCase()];
|
|
3001
3410
|
return n != null && !Number.isNaN(n) && this.zone(n);
|
|
3002
3411
|
}
|
|
3003
3412
|
},
|
|
@@ -3009,7 +3418,7 @@ var ye = [
|
|
|
3009
3418
|
}
|
|
3010
3419
|
},
|
|
3011
3420
|
year4: {
|
|
3012
|
-
regex:
|
|
3421
|
+
regex: RegExp("^" + G),
|
|
3013
3422
|
name: "year4",
|
|
3014
3423
|
callback(e, t) {
|
|
3015
3424
|
return this.y = +t, !0;
|
|
@@ -3020,34 +3429,34 @@ var ye = [
|
|
|
3020
3429
|
name: "whitespace"
|
|
3021
3430
|
},
|
|
3022
3431
|
dateShortWithTimeLong: {
|
|
3023
|
-
regex:
|
|
3432
|
+
regex: RegExp("^" + Le + "t?" + z + "[:.]" + B + "[:.]" + H, "i"),
|
|
3024
3433
|
name: "dateshortwithtimelong",
|
|
3025
3434
|
callback(e, t, n, r, i, a) {
|
|
3026
|
-
return this.ymd(this.y,
|
|
3435
|
+
return this.ymd(this.y, Q(t), +n) && this.time(+r, +i, +a, 0);
|
|
3027
3436
|
}
|
|
3028
3437
|
},
|
|
3029
3438
|
dateShortWithTimeLong12: {
|
|
3030
|
-
regex:
|
|
3439
|
+
regex: RegExp("^" + Le + Oe + "[:.]" + B + "[:.]" + U + L + R, "i"),
|
|
3031
3440
|
name: "dateshortwithtimelong12",
|
|
3032
3441
|
callback(e, t, n, r, i, a, o) {
|
|
3033
|
-
return this.ymd(this.y,
|
|
3442
|
+
return this.ymd(this.y, Q(t), +n) && this.time(X(+r, o), +i, +a, 0);
|
|
3034
3443
|
}
|
|
3035
3444
|
},
|
|
3036
3445
|
dateShortWithTimeShort: {
|
|
3037
|
-
regex:
|
|
3446
|
+
regex: RegExp("^" + Le + "t?" + z + "[:.]" + B, "i"),
|
|
3038
3447
|
name: "dateshortwithtimeshort",
|
|
3039
3448
|
callback(e, t, n, r, i) {
|
|
3040
|
-
return this.ymd(this.y,
|
|
3449
|
+
return this.ymd(this.y, Q(t), +n) && this.time(+r, +i, 0, 0);
|
|
3041
3450
|
}
|
|
3042
3451
|
},
|
|
3043
3452
|
dateShortWithTimeShort12: {
|
|
3044
|
-
regex:
|
|
3453
|
+
regex: RegExp("^" + Le + Oe + "[:.]" + V + L + R, "i"),
|
|
3045
3454
|
name: "dateshortwithtimeshort12",
|
|
3046
3455
|
callback(e, t, n, r, i, a) {
|
|
3047
|
-
return this.ymd(this.y,
|
|
3456
|
+
return this.ymd(this.y, Q(t), +n) && this.time(X(+r, a), +i, 0, 0);
|
|
3048
3457
|
}
|
|
3049
3458
|
}
|
|
3050
|
-
},
|
|
3459
|
+
}, Ve = {
|
|
3051
3460
|
y: NaN,
|
|
3052
3461
|
m: NaN,
|
|
3053
3462
|
d: NaN,
|
|
@@ -3109,174 +3518,459 @@ var ye = [
|
|
|
3109
3518
|
return isNaN(this.z) || t.getTimezoneOffset() === this.z || (t.setUTCFullYear(t.getFullYear(), t.getMonth(), t.getDate()), t.setUTCHours(t.getHours(), t.getMinutes(), t.getSeconds() - this.z, t.getMilliseconds())), t;
|
|
3110
3519
|
}
|
|
3111
3520
|
};
|
|
3112
|
-
|
|
3521
|
+
function He(e, t) {
|
|
3522
|
+
let n = t ?? Math.floor(Date.now() / 1e3), r = [
|
|
3523
|
+
$.yesterday,
|
|
3524
|
+
$.now,
|
|
3525
|
+
$.noon,
|
|
3526
|
+
$.midnightOrToday,
|
|
3527
|
+
$.tomorrow,
|
|
3528
|
+
$.timestamp,
|
|
3529
|
+
$.firstOrLastDay,
|
|
3530
|
+
$.backOrFrontOf,
|
|
3531
|
+
$.timeTiny12,
|
|
3532
|
+
$.timeShort12,
|
|
3533
|
+
$.timeLong12,
|
|
3534
|
+
$.mssqltime,
|
|
3535
|
+
$.oracledate,
|
|
3536
|
+
$.timeShort24,
|
|
3537
|
+
$.timeLong24,
|
|
3538
|
+
$.iso8601long,
|
|
3539
|
+
$.gnuNoColon,
|
|
3540
|
+
$.iso8601noColon,
|
|
3541
|
+
$.americanShort,
|
|
3542
|
+
$.american,
|
|
3543
|
+
$.iso8601date4,
|
|
3544
|
+
$.iso8601dateSlash,
|
|
3545
|
+
$.dateSlash,
|
|
3546
|
+
$.gnuDateShortOrIso8601date2,
|
|
3547
|
+
$.gnuDateShorter,
|
|
3548
|
+
$.dateFull,
|
|
3549
|
+
$.pointedDate4,
|
|
3550
|
+
$.pointedDate2,
|
|
3551
|
+
$.dateNoDay,
|
|
3552
|
+
$.dateNoDayRev,
|
|
3553
|
+
$.dateTextual,
|
|
3554
|
+
$.dateNoYear,
|
|
3555
|
+
$.dateNoYearRev,
|
|
3556
|
+
$.dateNoColon,
|
|
3557
|
+
$.xmlRpc,
|
|
3558
|
+
$.xmlRpcNoColon,
|
|
3559
|
+
$.soap,
|
|
3560
|
+
$.wddx,
|
|
3561
|
+
$.exif,
|
|
3562
|
+
$.pgydotd,
|
|
3563
|
+
$.isoWeekDay,
|
|
3564
|
+
$.pgTextShort,
|
|
3565
|
+
$.pgTextReverse,
|
|
3566
|
+
$.clf,
|
|
3567
|
+
$.year4,
|
|
3568
|
+
$.ago,
|
|
3569
|
+
$.dayText,
|
|
3570
|
+
$.relativeTextWeek,
|
|
3571
|
+
$.relativeText,
|
|
3572
|
+
$.monthFullOrMonthAbbr,
|
|
3573
|
+
$.tzCorrection,
|
|
3574
|
+
$.tzAbbr,
|
|
3575
|
+
$.dateShortWithTimeShort12,
|
|
3576
|
+
$.dateShortWithTimeLong12,
|
|
3577
|
+
$.dateShortWithTimeShort,
|
|
3578
|
+
$.dateShortWithTimeLong,
|
|
3579
|
+
$.relative,
|
|
3580
|
+
$.whitespace
|
|
3581
|
+
], i = { ...Ve };
|
|
3582
|
+
for (; e.length;) {
|
|
3583
|
+
let t = null, n = null;
|
|
3584
|
+
for (let i of r) {
|
|
3585
|
+
let r = e.match(i.regex);
|
|
3586
|
+
r && (!t || r[0].length > t[0].length) && (t = r, n = i);
|
|
3587
|
+
}
|
|
3588
|
+
if (!n || !t || n.callback && !1 === n.callback.apply(i, t)) return !1;
|
|
3589
|
+
e = e.substr(t[0].length), n = null, t = null;
|
|
3590
|
+
}
|
|
3591
|
+
return Math.floor(i.toDate(/* @__PURE__ */ new Date(1e3 * n)).getTime() / 1e3);
|
|
3592
|
+
}
|
|
3593
|
+
function Ue(e) {
|
|
3594
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3595
|
+
}
|
|
3596
|
+
var We, Ge = { exports: {} }, Ke = Ue((We || (We = 1, function(e) {
|
|
3597
|
+
e.exports = function() {
|
|
3598
|
+
var e = 1e3, t = 6e4, n = 36e5, r = "millisecond", i = "second", a = "minute", o = "hour", s = "day", c = "week", l = "month", u = "quarter", d = "year", f = "date", p = "Invalid Date", m = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, h = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, g = {
|
|
3599
|
+
name: "en",
|
|
3600
|
+
weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
|
|
3601
|
+
months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
|
|
3602
|
+
ordinal: function(e) {
|
|
3603
|
+
var t = [
|
|
3604
|
+
"th",
|
|
3605
|
+
"st",
|
|
3606
|
+
"nd",
|
|
3607
|
+
"rd"
|
|
3608
|
+
], n = e % 100;
|
|
3609
|
+
return "[" + e + (t[(n - 20) % 10] || t[n] || t[0]) + "]";
|
|
3610
|
+
}
|
|
3611
|
+
}, _ = function(e, t, n) {
|
|
3612
|
+
var r = String(e);
|
|
3613
|
+
return !r || r.length >= t ? e : "" + Array(t + 1 - r.length).join(n) + e;
|
|
3614
|
+
}, v = {
|
|
3615
|
+
s: _,
|
|
3616
|
+
z: function(e) {
|
|
3617
|
+
var t = -e.utcOffset(), n = Math.abs(t), r = Math.floor(n / 60), i = n % 60;
|
|
3618
|
+
return (t <= 0 ? "+" : "-") + _(r, 2, "0") + ":" + _(i, 2, "0");
|
|
3619
|
+
},
|
|
3620
|
+
m: function e(t, n) {
|
|
3621
|
+
if (t.date() < n.date()) return -e(n, t);
|
|
3622
|
+
var r = 12 * (n.year() - t.year()) + (n.month() - t.month()), i = t.clone().add(r, l), a = n - i < 0, o = t.clone().add(r + (a ? -1 : 1), l);
|
|
3623
|
+
return +(-(r + (n - i) / (a ? i - o : o - i)) || 0);
|
|
3624
|
+
},
|
|
3625
|
+
a: function(e) {
|
|
3626
|
+
return e < 0 ? Math.ceil(e) || 0 : Math.floor(e);
|
|
3627
|
+
},
|
|
3628
|
+
p: function(e) {
|
|
3629
|
+
return {
|
|
3630
|
+
M: l,
|
|
3631
|
+
y: d,
|
|
3632
|
+
w: c,
|
|
3633
|
+
d: s,
|
|
3634
|
+
D: f,
|
|
3635
|
+
h: o,
|
|
3636
|
+
m: a,
|
|
3637
|
+
s: i,
|
|
3638
|
+
ms: r,
|
|
3639
|
+
Q: u
|
|
3640
|
+
}[e] || String(e || "").toLowerCase().replace(/s$/, "");
|
|
3641
|
+
},
|
|
3642
|
+
u: function(e) {
|
|
3643
|
+
return e === void 0;
|
|
3644
|
+
}
|
|
3645
|
+
}, y = "en", b = {};
|
|
3646
|
+
b[y] = g;
|
|
3647
|
+
var ee = "$isDayjsObject", x = function(e) {
|
|
3648
|
+
return e instanceof T || !(!e || !e[ee]);
|
|
3649
|
+
}, S = function e(t, n, r) {
|
|
3650
|
+
var i;
|
|
3651
|
+
if (!t) return y;
|
|
3652
|
+
if (typeof t == "string") {
|
|
3653
|
+
var a = t.toLowerCase();
|
|
3654
|
+
b[a] && (i = a), n && (b[a] = n, i = a);
|
|
3655
|
+
var o = t.split("-");
|
|
3656
|
+
if (!i && o.length > 1) return e(o[0]);
|
|
3657
|
+
} else {
|
|
3658
|
+
var s = t.name;
|
|
3659
|
+
b[s] = t, i = s;
|
|
3660
|
+
}
|
|
3661
|
+
return !r && i && (y = i), i || !r && y;
|
|
3662
|
+
}, C = function(e, t) {
|
|
3663
|
+
if (x(e)) return e.clone();
|
|
3664
|
+
var n = typeof t == "object" ? t : {};
|
|
3665
|
+
return n.date = e, n.args = arguments, new T(n);
|
|
3666
|
+
}, w = v;
|
|
3667
|
+
w.l = S, w.i = x, w.w = function(e, t) {
|
|
3668
|
+
return C(e, {
|
|
3669
|
+
locale: t.$L,
|
|
3670
|
+
utc: t.$u,
|
|
3671
|
+
x: t.$x,
|
|
3672
|
+
$offset: t.$offset
|
|
3673
|
+
});
|
|
3674
|
+
};
|
|
3675
|
+
var T = function() {
|
|
3676
|
+
function g(e) {
|
|
3677
|
+
this.$L = S(e.locale, null, !0), this.parse(e), this.$x = this.$x || e.x || {}, this[ee] = !0;
|
|
3678
|
+
}
|
|
3679
|
+
var _ = g.prototype;
|
|
3680
|
+
return _.parse = function(e) {
|
|
3681
|
+
this.$d = function(e) {
|
|
3682
|
+
var t = e.date, n = e.utc;
|
|
3683
|
+
if (t === null) return /* @__PURE__ */ new Date(NaN);
|
|
3684
|
+
if (w.u(t)) return /* @__PURE__ */ new Date();
|
|
3685
|
+
if (t instanceof Date) return new Date(t);
|
|
3686
|
+
if (typeof t == "string" && !/Z$/i.test(t)) {
|
|
3687
|
+
var r = t.match(m);
|
|
3688
|
+
if (r) {
|
|
3689
|
+
var i = r[2] - 1 || 0, a = (r[7] || "0").substring(0, 3);
|
|
3690
|
+
return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, a)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, a);
|
|
3691
|
+
}
|
|
3692
|
+
}
|
|
3693
|
+
return new Date(t);
|
|
3694
|
+
}(e), this.init();
|
|
3695
|
+
}, _.init = function() {
|
|
3696
|
+
var e = this.$d;
|
|
3697
|
+
this.$y = e.getFullYear(), this.$M = e.getMonth(), this.$D = e.getDate(), this.$W = e.getDay(), this.$H = e.getHours(), this.$m = e.getMinutes(), this.$s = e.getSeconds(), this.$ms = e.getMilliseconds();
|
|
3698
|
+
}, _.$utils = function() {
|
|
3699
|
+
return w;
|
|
3700
|
+
}, _.isValid = function() {
|
|
3701
|
+
return this.$d.toString() !== p;
|
|
3702
|
+
}, _.isSame = function(e, t) {
|
|
3703
|
+
var n = C(e);
|
|
3704
|
+
return this.startOf(t) <= n && n <= this.endOf(t);
|
|
3705
|
+
}, _.isAfter = function(e, t) {
|
|
3706
|
+
return C(e) < this.startOf(t);
|
|
3707
|
+
}, _.isBefore = function(e, t) {
|
|
3708
|
+
return this.endOf(t) < C(e);
|
|
3709
|
+
}, _.$g = function(e, t, n) {
|
|
3710
|
+
return w.u(e) ? this[t] : this.set(n, e);
|
|
3711
|
+
}, _.unix = function() {
|
|
3712
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
3713
|
+
}, _.valueOf = function() {
|
|
3714
|
+
return this.$d.getTime();
|
|
3715
|
+
}, _.startOf = function(e, t) {
|
|
3716
|
+
var n = this, r = !!w.u(t) || t, u = w.p(e), p = function(e, t) {
|
|
3717
|
+
var i = w.w(n.$u ? Date.UTC(n.$y, t, e) : new Date(n.$y, t, e), n);
|
|
3718
|
+
return r ? i : i.endOf(s);
|
|
3719
|
+
}, m = function(e, t) {
|
|
3720
|
+
return w.w(n.toDate()[e].apply(n.toDate("s"), (r ? [
|
|
3721
|
+
0,
|
|
3722
|
+
0,
|
|
3723
|
+
0,
|
|
3724
|
+
0
|
|
3725
|
+
] : [
|
|
3726
|
+
23,
|
|
3727
|
+
59,
|
|
3728
|
+
59,
|
|
3729
|
+
999
|
|
3730
|
+
]).slice(t)), n);
|
|
3731
|
+
}, h = this.$W, g = this.$M, _ = this.$D, v = "set" + (this.$u ? "UTC" : "");
|
|
3732
|
+
switch (u) {
|
|
3733
|
+
case d: return r ? p(1, 0) : p(31, 11);
|
|
3734
|
+
case l: return r ? p(1, g) : p(0, g + 1);
|
|
3735
|
+
case c:
|
|
3736
|
+
var y = this.$locale().weekStart || 0, b = (h < y ? h + 7 : h) - y;
|
|
3737
|
+
return p(r ? _ - b : _ + (6 - b), g);
|
|
3738
|
+
case s:
|
|
3739
|
+
case f: return m(v + "Hours", 0);
|
|
3740
|
+
case o: return m(v + "Minutes", 1);
|
|
3741
|
+
case a: return m(v + "Seconds", 2);
|
|
3742
|
+
case i: return m(v + "Milliseconds", 3);
|
|
3743
|
+
default: return this.clone();
|
|
3744
|
+
}
|
|
3745
|
+
}, _.endOf = function(e) {
|
|
3746
|
+
return this.startOf(e, !1);
|
|
3747
|
+
}, _.$set = function(e, t) {
|
|
3748
|
+
var n, c = w.p(e), u = "set" + (this.$u ? "UTC" : ""), p = (n = {}, n[s] = u + "Date", n[f] = u + "Date", n[l] = u + "Month", n[d] = u + "FullYear", n[o] = u + "Hours", n[a] = u + "Minutes", n[i] = u + "Seconds", n[r] = u + "Milliseconds", n)[c], m = c === s ? this.$D + (t - this.$W) : t;
|
|
3749
|
+
if (c === l || c === d) {
|
|
3750
|
+
var h = this.clone().set(f, 1);
|
|
3751
|
+
h.$d[p](m), h.init(), this.$d = h.set(f, Math.min(this.$D, h.daysInMonth())).$d;
|
|
3752
|
+
} else p && this.$d[p](m);
|
|
3753
|
+
return this.init(), this;
|
|
3754
|
+
}, _.set = function(e, t) {
|
|
3755
|
+
return this.clone().$set(e, t);
|
|
3756
|
+
}, _.get = function(e) {
|
|
3757
|
+
return this[w.p(e)]();
|
|
3758
|
+
}, _.add = function(r, u) {
|
|
3759
|
+
var f, p = this;
|
|
3760
|
+
r = Number(r);
|
|
3761
|
+
var m = w.p(u), h = function(e) {
|
|
3762
|
+
var t = C(p);
|
|
3763
|
+
return w.w(t.date(t.date() + Math.round(e * r)), p);
|
|
3764
|
+
};
|
|
3765
|
+
if (m === l) return this.set(l, this.$M + r);
|
|
3766
|
+
if (m === d) return this.set(d, this.$y + r);
|
|
3767
|
+
if (m === s) return h(1);
|
|
3768
|
+
if (m === c) return h(7);
|
|
3769
|
+
var g = (f = {}, f[a] = t, f[o] = n, f[i] = e, f)[m] || 1, _ = this.$d.getTime() + r * g;
|
|
3770
|
+
return w.w(_, this);
|
|
3771
|
+
}, _.subtract = function(e, t) {
|
|
3772
|
+
return this.add(-1 * e, t);
|
|
3773
|
+
}, _.format = function(e) {
|
|
3774
|
+
var t = this, n = this.$locale();
|
|
3775
|
+
if (!this.isValid()) return n.invalidDate || p;
|
|
3776
|
+
var r = e || "YYYY-MM-DDTHH:mm:ssZ", i = w.z(this), a = this.$H, o = this.$m, s = this.$M, c = n.weekdays, l = n.months, u = n.meridiem, d = function(e, n, i, a) {
|
|
3777
|
+
return e && (e[n] || e(t, r)) || i[n].slice(0, a);
|
|
3778
|
+
}, f = function(e) {
|
|
3779
|
+
return w.s(a % 12 || 12, e, "0");
|
|
3780
|
+
}, m = u || function(e, t, n) {
|
|
3781
|
+
var r = e < 12 ? "AM" : "PM";
|
|
3782
|
+
return n ? r.toLowerCase() : r;
|
|
3783
|
+
};
|
|
3784
|
+
return r.replace(h, function(e, r) {
|
|
3785
|
+
return r || function(e) {
|
|
3786
|
+
switch (e) {
|
|
3787
|
+
case "YY": return String(t.$y).slice(-2);
|
|
3788
|
+
case "YYYY": return w.s(t.$y, 4, "0");
|
|
3789
|
+
case "M": return s + 1;
|
|
3790
|
+
case "MM": return w.s(s + 1, 2, "0");
|
|
3791
|
+
case "MMM": return d(n.monthsShort, s, l, 3);
|
|
3792
|
+
case "MMMM": return d(l, s);
|
|
3793
|
+
case "D": return t.$D;
|
|
3794
|
+
case "DD": return w.s(t.$D, 2, "0");
|
|
3795
|
+
case "d": return String(t.$W);
|
|
3796
|
+
case "dd": return d(n.weekdaysMin, t.$W, c, 2);
|
|
3797
|
+
case "ddd": return d(n.weekdaysShort, t.$W, c, 3);
|
|
3798
|
+
case "dddd": return c[t.$W];
|
|
3799
|
+
case "H": return String(a);
|
|
3800
|
+
case "HH": return w.s(a, 2, "0");
|
|
3801
|
+
case "h": return f(1);
|
|
3802
|
+
case "hh": return f(2);
|
|
3803
|
+
case "a": return m(a, o, !0);
|
|
3804
|
+
case "A": return m(a, o, !1);
|
|
3805
|
+
case "m": return String(o);
|
|
3806
|
+
case "mm": return w.s(o, 2, "0");
|
|
3807
|
+
case "s": return String(t.$s);
|
|
3808
|
+
case "ss": return w.s(t.$s, 2, "0");
|
|
3809
|
+
case "SSS": return w.s(t.$ms, 3, "0");
|
|
3810
|
+
case "Z": return i;
|
|
3811
|
+
}
|
|
3812
|
+
return null;
|
|
3813
|
+
}(e) || i.replace(":", "");
|
|
3814
|
+
});
|
|
3815
|
+
}, _.utcOffset = function() {
|
|
3816
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
3817
|
+
}, _.diff = function(r, f, p) {
|
|
3818
|
+
var m, h = this, g = w.p(f), _ = C(r), v = (_.utcOffset() - this.utcOffset()) * t, y = this - _, b = function() {
|
|
3819
|
+
return w.m(h, _);
|
|
3820
|
+
};
|
|
3821
|
+
switch (g) {
|
|
3822
|
+
case d:
|
|
3823
|
+
m = b() / 12;
|
|
3824
|
+
break;
|
|
3825
|
+
case l:
|
|
3826
|
+
m = b();
|
|
3827
|
+
break;
|
|
3828
|
+
case u:
|
|
3829
|
+
m = b() / 3;
|
|
3830
|
+
break;
|
|
3831
|
+
case c:
|
|
3832
|
+
m = (y - v) / 6048e5;
|
|
3833
|
+
break;
|
|
3834
|
+
case s:
|
|
3835
|
+
m = (y - v) / 864e5;
|
|
3836
|
+
break;
|
|
3837
|
+
case o:
|
|
3838
|
+
m = y / n;
|
|
3839
|
+
break;
|
|
3840
|
+
case a:
|
|
3841
|
+
m = y / t;
|
|
3842
|
+
break;
|
|
3843
|
+
case i:
|
|
3844
|
+
m = y / e;
|
|
3845
|
+
break;
|
|
3846
|
+
default: m = y;
|
|
3847
|
+
}
|
|
3848
|
+
return p ? m : w.a(m);
|
|
3849
|
+
}, _.daysInMonth = function() {
|
|
3850
|
+
return this.endOf(l).$D;
|
|
3851
|
+
}, _.$locale = function() {
|
|
3852
|
+
return b[this.$L];
|
|
3853
|
+
}, _.locale = function(e, t) {
|
|
3854
|
+
if (!e) return this.$L;
|
|
3855
|
+
var n = this.clone(), r = S(e, t, !0);
|
|
3856
|
+
return r && (n.$L = r), n;
|
|
3857
|
+
}, _.clone = function() {
|
|
3858
|
+
return w.w(this.$d, this);
|
|
3859
|
+
}, _.toDate = function() {
|
|
3860
|
+
return new Date(this.valueOf());
|
|
3861
|
+
}, _.toJSON = function() {
|
|
3862
|
+
return this.isValid() ? this.toISOString() : null;
|
|
3863
|
+
}, _.toISOString = function() {
|
|
3864
|
+
return this.$d.toISOString();
|
|
3865
|
+
}, _.toString = function() {
|
|
3866
|
+
return this.$d.toUTCString();
|
|
3867
|
+
}, g;
|
|
3868
|
+
}(), te = T.prototype;
|
|
3869
|
+
return C.prototype = te, [
|
|
3870
|
+
["$ms", r],
|
|
3871
|
+
["$s", i],
|
|
3872
|
+
["$m", a],
|
|
3873
|
+
["$H", o],
|
|
3874
|
+
["$W", s],
|
|
3875
|
+
["$M", l],
|
|
3876
|
+
["$y", d],
|
|
3877
|
+
["$D", f]
|
|
3878
|
+
].forEach(function(e) {
|
|
3879
|
+
te[e[1]] = function(t) {
|
|
3880
|
+
return this.$g(t, e[0], e[1]);
|
|
3881
|
+
};
|
|
3882
|
+
}), C.extend = function(e, t) {
|
|
3883
|
+
return e.$i ||= (e(t, T, C), !0), C;
|
|
3884
|
+
}, C.locale = S, C.isDayjs = x, C.unix = function(e) {
|
|
3885
|
+
return C(1e3 * e);
|
|
3886
|
+
}, C.en = b[y], C.Ls = b, C.p = {}, C;
|
|
3887
|
+
}();
|
|
3888
|
+
}(Ge)), Ge.exports));
|
|
3889
|
+
let qe = (e) => typeof e == "string", Je = (e, t) => e.format(t), Ye = {
|
|
3890
|
+
isString: qe,
|
|
3891
|
+
strLen: (e) => qe(e) ? e.length : 0,
|
|
3892
|
+
isEmail: (e) => !!qe(e) && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),
|
|
3893
|
+
isPhone: (e) => !!qe(e) && (e.substring(0, 2) === "+1" && (e = e.substring(2)), /^\d{10}$/.test(e.replace(/\D/g, ""))),
|
|
3894
|
+
isNull: (e) => e === null,
|
|
3895
|
+
isCurrency: (e) => /(?=.*?\d)^\$?(([1-9]\d{0,2}(,\d{3})*)|\d+)?(\.\d{1,2})?$/.test(e),
|
|
3896
|
+
now: () => Ke(),
|
|
3897
|
+
dateFormat: Je,
|
|
3898
|
+
year: (e) => Je(e, "YYYY"),
|
|
3899
|
+
date: (e) => Je(e, "YYYY-MM-DD"),
|
|
3900
|
+
string: (e) => e == null || e.toString === void 0 ? "" : e.toString(),
|
|
3901
|
+
int: (e) => parseInt(e)
|
|
3902
|
+
}, Xe = {
|
|
3903
|
+
strtolower: he,
|
|
3904
|
+
strtoupper: ge,
|
|
3905
|
+
explode: P,
|
|
3906
|
+
strlen: me,
|
|
3907
|
+
strstr: _e,
|
|
3908
|
+
stristr: ve,
|
|
3909
|
+
substr: F,
|
|
3910
|
+
implode: Se,
|
|
3911
|
+
count: xe,
|
|
3912
|
+
array_intersect: (...e) => Te.getEvaluator()(null, ...e),
|
|
3913
|
+
date: Ee,
|
|
3914
|
+
strtotime: He
|
|
3915
|
+
};
|
|
3916
|
+
e.AbstractProvider = N, e.ArrayAdapter = ie, e.ArrayProvider = class extends N {
|
|
3113
3917
|
getFunctions() {
|
|
3114
3918
|
return [
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3919
|
+
Ce,
|
|
3920
|
+
we,
|
|
3921
|
+
Te
|
|
3118
3922
|
];
|
|
3119
3923
|
}
|
|
3120
|
-
}, e.BasicProvider = class extends
|
|
3924
|
+
}, e.BasicProvider = class extends N {
|
|
3121
3925
|
getFunctions() {
|
|
3122
|
-
return [
|
|
3926
|
+
return [oe];
|
|
3123
3927
|
}
|
|
3124
|
-
}, e.Compiler =
|
|
3928
|
+
}, e.CacheItem = A, e.CompileRuntime = Xe, e.Compiler = D, e.DateProvider = class extends N {
|
|
3125
3929
|
getFunctions() {
|
|
3126
|
-
return [new
|
|
3930
|
+
return [new j("date", function(e, t) {
|
|
3127
3931
|
let n = "";
|
|
3128
|
-
return t && (n = `, ${t}`), `date(${e}${n})`;
|
|
3932
|
+
return t && (n = `, ${t}`), `__runtime.date(${e}${n})`;
|
|
3129
3933
|
}, function(e, t, n) {
|
|
3130
|
-
return
|
|
3131
|
-
}), new
|
|
3934
|
+
return Ee(t, n);
|
|
3935
|
+
}), new j("strtotime", function(e, t) {
|
|
3132
3936
|
let n = "";
|
|
3133
|
-
return t && (n = `, ${t}`), `strtotime(${e}${n})`;
|
|
3937
|
+
return t && (n = `, ${t}`), `__runtime.strtotime(${e}${n})`;
|
|
3134
3938
|
}, function(e, t, n) {
|
|
3135
|
-
return
|
|
3136
|
-
let n = t ?? Math.floor(Date.now() / 1e3), r = [
|
|
3137
|
-
J.yesterday,
|
|
3138
|
-
J.now,
|
|
3139
|
-
J.noon,
|
|
3140
|
-
J.midnightOrToday,
|
|
3141
|
-
J.tomorrow,
|
|
3142
|
-
J.timestamp,
|
|
3143
|
-
J.firstOrLastDay,
|
|
3144
|
-
J.backOrFrontOf,
|
|
3145
|
-
J.timeTiny12,
|
|
3146
|
-
J.timeShort12,
|
|
3147
|
-
J.timeLong12,
|
|
3148
|
-
J.mssqltime,
|
|
3149
|
-
J.oracledate,
|
|
3150
|
-
J.timeShort24,
|
|
3151
|
-
J.timeLong24,
|
|
3152
|
-
J.iso8601long,
|
|
3153
|
-
J.gnuNoColon,
|
|
3154
|
-
J.iso8601noColon,
|
|
3155
|
-
J.americanShort,
|
|
3156
|
-
J.american,
|
|
3157
|
-
J.iso8601date4,
|
|
3158
|
-
J.iso8601dateSlash,
|
|
3159
|
-
J.dateSlash,
|
|
3160
|
-
J.gnuDateShortOrIso8601date2,
|
|
3161
|
-
J.gnuDateShorter,
|
|
3162
|
-
J.dateFull,
|
|
3163
|
-
J.pointedDate4,
|
|
3164
|
-
J.pointedDate2,
|
|
3165
|
-
J.dateNoDay,
|
|
3166
|
-
J.dateNoDayRev,
|
|
3167
|
-
J.dateTextual,
|
|
3168
|
-
J.dateNoYear,
|
|
3169
|
-
J.dateNoYearRev,
|
|
3170
|
-
J.dateNoColon,
|
|
3171
|
-
J.xmlRpc,
|
|
3172
|
-
J.xmlRpcNoColon,
|
|
3173
|
-
J.soap,
|
|
3174
|
-
J.wddx,
|
|
3175
|
-
J.exif,
|
|
3176
|
-
J.pgydotd,
|
|
3177
|
-
J.isoWeekDay,
|
|
3178
|
-
J.pgTextShort,
|
|
3179
|
-
J.pgTextReverse,
|
|
3180
|
-
J.clf,
|
|
3181
|
-
J.year4,
|
|
3182
|
-
J.ago,
|
|
3183
|
-
J.dayText,
|
|
3184
|
-
J.relativeTextWeek,
|
|
3185
|
-
J.relativeText,
|
|
3186
|
-
J.monthFullOrMonthAbbr,
|
|
3187
|
-
J.tzCorrection,
|
|
3188
|
-
J.tzAbbr,
|
|
3189
|
-
J.dateShortWithTimeShort12,
|
|
3190
|
-
J.dateShortWithTimeLong12,
|
|
3191
|
-
J.dateShortWithTimeShort,
|
|
3192
|
-
J.dateShortWithTimeLong,
|
|
3193
|
-
J.relative,
|
|
3194
|
-
J.whitespace
|
|
3195
|
-
], i = { ...me };
|
|
3196
|
-
for (; e.length;) {
|
|
3197
|
-
let t = null, n = null;
|
|
3198
|
-
for (let i of r) {
|
|
3199
|
-
let r = e.match(i.regex);
|
|
3200
|
-
r && (!t || r[0].length > t[0].length) && (t = r, n = i);
|
|
3201
|
-
}
|
|
3202
|
-
if (!n || !t || n.callback && !1 === n.callback.apply(i, t)) return !1;
|
|
3203
|
-
e = e.substr(t[0].length), n = null, t = null;
|
|
3204
|
-
}
|
|
3205
|
-
return Math.floor(i.toDate(/* @__PURE__ */ new Date(1e3 * n)).getTime() / 1e3);
|
|
3206
|
-
}(t, n);
|
|
3939
|
+
return He(t, n);
|
|
3207
3940
|
})];
|
|
3208
3941
|
}
|
|
3209
|
-
}, e.ExpressionFunction =
|
|
3942
|
+
}, e.Expression = O, e.ExpressionFunction = j, e.ExpressionLanguage = M, e.IGNORE_UNKNOWN_FUNCTIONS = 2, e.IGNORE_UNKNOWN_VARIABLES = 1, e.Node = _, e.OPERATOR_LEFT = 1, e.OPERATOR_RIGHT = 2, e.ParsedExpression = k, e.Parser = E, e.StringProvider = class extends N {
|
|
3210
3943
|
getFunctions() {
|
|
3211
3944
|
return [
|
|
3212
|
-
new
|
|
3213
|
-
|
|
3214
|
-
}(t)),
|
|
3215
|
-
new
|
|
3216
|
-
return (e
|
|
3217
|
-
}(t)),
|
|
3218
|
-
new P("explode", (e, t, n = "null") => `explode(${e}, ${t}, ${n})`, (e, t, n, r = null) => function(...e) {
|
|
3219
|
-
let [t, n, r] = e, i = t, a = n;
|
|
3220
|
-
if (e.length < 2 || i === void 0 || a === void 0) return null;
|
|
3221
|
-
if (i === "" || !1 === i || i === null) return !1;
|
|
3222
|
-
if (typeof i == "function" || typeof i == "object" || typeof a == "function" || typeof a == "object") return { 0: "" };
|
|
3223
|
-
!0 === i && (i = "1");
|
|
3224
|
-
let o = i + "", s = (a + "").split(o);
|
|
3225
|
-
return r === void 0 ? s : (r === 0 && (r = 1), r > 0 ? r >= s.length ? s : s.slice(0, r - 1).concat([s.slice(r - 1).join(o)]) : -r >= s.length ? [] : (s.splice(s.length + r), s));
|
|
3226
|
-
}(t, n, r)),
|
|
3227
|
-
new P("strlen", function(e) {
|
|
3228
|
-
return `strlen(${e});`;
|
|
3945
|
+
new j("strtolower", (e) => "__runtime.strtolower(" + e + ")", (e, t) => he(t)),
|
|
3946
|
+
new j("strtoupper", (e) => "__runtime.strtoupper(" + e + ")", (e, t) => ge(t)),
|
|
3947
|
+
new j("explode", (e, t, n = "null") => `__runtime.explode(${e}, ${t}, ${n})`, (e, t, n, r = null) => P(t, n, r)),
|
|
3948
|
+
new j("strlen", function(e) {
|
|
3949
|
+
return `__runtime.strlen(${e})`;
|
|
3229
3950
|
}, function(e, t) {
|
|
3230
|
-
return
|
|
3231
|
-
let t = e + "";
|
|
3232
|
-
if ((se("unicode.semantics") || "off") === "off") return t.length;
|
|
3233
|
-
let n = 0, r = 0, i = function(e, t) {
|
|
3234
|
-
let n = e.charCodeAt(t);
|
|
3235
|
-
if (n >= 55296 && n <= 56319) {
|
|
3236
|
-
if (e.length <= t + 1) throw Error("High surrogate without following low surrogate");
|
|
3237
|
-
let n = e.charCodeAt(t + 1);
|
|
3238
|
-
if (n < 56320 || n > 57343) throw Error("High surrogate without following low surrogate");
|
|
3239
|
-
return e.charAt(t) + e.charAt(t + 1);
|
|
3240
|
-
}
|
|
3241
|
-
if (n >= 56320 && n <= 57343) {
|
|
3242
|
-
if (t === 0) throw Error("Low surrogate without preceding high surrogate");
|
|
3243
|
-
let n = e.charCodeAt(t - 1);
|
|
3244
|
-
if (n < 55296 || n > 56319) throw Error("Low surrogate without preceding high surrogate");
|
|
3245
|
-
return !1;
|
|
3246
|
-
}
|
|
3247
|
-
return e.charAt(t);
|
|
3248
|
-
};
|
|
3249
|
-
for (n = 0, r = 0; n < t.length; n++) !1 !== i(t, n) && r++;
|
|
3250
|
-
return r;
|
|
3251
|
-
}(t);
|
|
3951
|
+
return me(t);
|
|
3252
3952
|
}),
|
|
3253
|
-
new
|
|
3953
|
+
new j("strstr", function(e, t, n) {
|
|
3254
3954
|
let r = "";
|
|
3255
|
-
return n && (r = `, ${n}`), `strstr(${e}, ${t}${r})
|
|
3955
|
+
return n && (r = `, ${n}`), `__runtime.strstr(${e}, ${t}${r})`;
|
|
3256
3956
|
}, function(e, t, n, r) {
|
|
3257
|
-
return
|
|
3258
|
-
let r = 0;
|
|
3259
|
-
return r = (e += "").indexOf(t), r !== -1 && (n ? e.substr(0, r) : e.slice(r));
|
|
3260
|
-
}(t, n, r);
|
|
3957
|
+
return _e(t, n, r);
|
|
3261
3958
|
}),
|
|
3262
|
-
new
|
|
3959
|
+
new j("stristr", function(e, t, n) {
|
|
3263
3960
|
let r = "";
|
|
3264
|
-
return n && (r = `, ${n}`), `stristr(${e}, ${t}${r})
|
|
3961
|
+
return n && (r = `, ${n}`), `__runtime.stristr(${e}, ${t}${r})`;
|
|
3265
3962
|
}, function(e, t, n, r) {
|
|
3266
|
-
return
|
|
3267
|
-
let r = 0;
|
|
3268
|
-
return r = (e += "").toLowerCase().indexOf((t + "").toLowerCase()), r !== -1 && (n ? e.substr(0, r) : e.slice(r));
|
|
3269
|
-
}(t, n, r);
|
|
3963
|
+
return ve(t, n, r);
|
|
3270
3964
|
}),
|
|
3271
|
-
new
|
|
3965
|
+
new j("substr", function(e, t, n) {
|
|
3272
3966
|
let r = "";
|
|
3273
|
-
return n && (r = `, ${n}`), `substr(${e}, ${t}${r})
|
|
3967
|
+
return n && (r = `, ${n}`), `__runtime.substr(${e}, ${t}${r})`;
|
|
3274
3968
|
}, function(e, t, n, r) {
|
|
3275
|
-
return
|
|
3969
|
+
return F(t, n, r);
|
|
3276
3970
|
})
|
|
3277
3971
|
];
|
|
3278
3972
|
}
|
|
3279
|
-
}, e.default =
|
|
3973
|
+
}, e.SyntaxError = r, e.Token = a, e.TokenStream = i, e.default = M, e.defaultCustomFunctions = Ye, e.tokenize = o, Object.defineProperty(e, "__esModule", { value: !0 });
|
|
3280
3974
|
}), function(e) {
|
|
3281
3975
|
var t = e.ExpressionLanguage;
|
|
3282
3976
|
if (t && typeof t.ExpressionLanguage == "function") {
|
|
@@ -3286,22 +3980,22 @@ var ye = [
|
|
|
3286
3980
|
}), e.ExpressionLanguage = n;
|
|
3287
3981
|
}
|
|
3288
3982
|
}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : e);
|
|
3289
|
-
})))(), 1),
|
|
3290
|
-
function
|
|
3291
|
-
let e =
|
|
3983
|
+
})))(), 1), Pe = null;
|
|
3984
|
+
function Fe() {
|
|
3985
|
+
let e = Ne, t = e.ExpressionLanguage || e.default || Ne;
|
|
3292
3986
|
if (typeof t != "function") throw TypeError("Unable to resolve expression-language constructor.");
|
|
3293
3987
|
return t;
|
|
3294
3988
|
}
|
|
3295
|
-
function
|
|
3296
|
-
return
|
|
3989
|
+
function Ie() {
|
|
3990
|
+
return Pe ??= new (Fe())(), Pe;
|
|
3297
3991
|
}
|
|
3298
|
-
function
|
|
3992
|
+
function Le(e) {
|
|
3299
3993
|
return (e.formula?.expression || e.formula?.formula || "").trim();
|
|
3300
3994
|
}
|
|
3301
|
-
function
|
|
3995
|
+
function X(e) {
|
|
3302
3996
|
return Object.entries(e.formula?.variables || {}).filter((e) => !!e[1]?.sourceKey);
|
|
3303
3997
|
}
|
|
3304
|
-
function
|
|
3998
|
+
function Z(e, t) {
|
|
3305
3999
|
return Object.entries(e).forEach(([t, n]) => {
|
|
3306
4000
|
if (Array.isArray(n)) {
|
|
3307
4001
|
let r = n.map((e) => typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)) ? Number(e) : e), i = r.filter((e) => typeof e == "number");
|
|
@@ -3311,81 +4005,174 @@ function Ee(e, t) {
|
|
|
3311
4005
|
typeof n == "string" && n.trim() !== "" && !Number.isNaN(Number(n)) && (e[t] = Number(n));
|
|
3312
4006
|
}), e;
|
|
3313
4007
|
}
|
|
3314
|
-
function
|
|
4008
|
+
function Q(e, t) {
|
|
3315
4009
|
if (t.formatting !== "number") return typeof e == "number" || typeof e == "string" ? e : "";
|
|
3316
4010
|
let n = e;
|
|
3317
4011
|
Array.isArray(n) && (n = n.reduce((e, t) => e + Number(t || 0), 0));
|
|
3318
4012
|
let r = typeof t.decimals == "number" ? t.decimals : 0, i = Number(n || 0).toFixed(r);
|
|
3319
4013
|
return `${t.prefix || ""}${i}${t.suffix || ""}`;
|
|
3320
4014
|
}
|
|
3321
|
-
function
|
|
4015
|
+
function Re(e, t) {
|
|
3322
4016
|
let n = e.type?.endsWith("\\Number");
|
|
3323
4017
|
return e.type?.endsWith("\\Checkboxes") ? Array.isArray(t) ? t.length ? t : "" : t ? [t] : "" : Array.isArray(t) ? t.length ? n ? t.map((e) => Number(e || 0)) : t : "" : n ? Number(t || 0) : t;
|
|
3324
4018
|
}
|
|
3325
|
-
function
|
|
3326
|
-
return
|
|
4019
|
+
function ze(e, t, n) {
|
|
4020
|
+
return Q(Ie().evaluate(e, t), n);
|
|
4021
|
+
}
|
|
4022
|
+
//#endregion
|
|
4023
|
+
//#region src/request-profile.ts
|
|
4024
|
+
var Be = /* @__PURE__ */ new Map();
|
|
4025
|
+
async function $(e, t, n = {}) {
|
|
4026
|
+
let r = n.profile ?? "same-origin-browser", i = Ve(e, n, t.headers), a = await fetch(e, {
|
|
4027
|
+
...t,
|
|
4028
|
+
headers: i,
|
|
4029
|
+
credentials: r === "cross-origin-public" ? "omit" : "same-origin"
|
|
4030
|
+
}), o = new URL(e, typeof location > "u" ? "http://localhost" : location.href).origin, s = a.headers.get("X-Formie-Session");
|
|
4031
|
+
return r === "cross-origin-public" && s && Be.set(o, s), a;
|
|
4032
|
+
}
|
|
4033
|
+
function Ve(e, t = {}, n) {
|
|
4034
|
+
let r = t.profile ?? "same-origin-browser";
|
|
4035
|
+
if (!["same-origin-browser", "cross-origin-public"].includes(r)) throw Error("Client-rendered forms require a public browser profile. Use administrative API mutations for trusted administration.");
|
|
4036
|
+
let i = new Headers(n);
|
|
4037
|
+
i.set("X-Formie-Profile", r);
|
|
4038
|
+
let a = new URL(e, typeof location > "u" ? "http://localhost" : location.href).origin;
|
|
4039
|
+
if (r === "cross-origin-public") {
|
|
4040
|
+
let e = t.publicSession ?? Be.get(a);
|
|
4041
|
+
e && i.set("X-Formie-Session", e);
|
|
4042
|
+
}
|
|
4043
|
+
return i;
|
|
4044
|
+
}
|
|
4045
|
+
//#endregion
|
|
4046
|
+
//#region src/uploads.ts
|
|
4047
|
+
var He = /* @__PURE__ */ new WeakMap();
|
|
4048
|
+
async function Ue(e, t, n, r) {
|
|
4049
|
+
let i = async (n, a) => {
|
|
4050
|
+
if (typeof Blob < "u" && n instanceof Blob) {
|
|
4051
|
+
let i = JSON.stringify([
|
|
4052
|
+
e.id,
|
|
4053
|
+
t.tokens.render,
|
|
4054
|
+
t.continuation?.draftContextToken,
|
|
4055
|
+
a
|
|
4056
|
+
]), o = He.get(n) ?? /* @__PURE__ */ new Map();
|
|
4057
|
+
if (He.set(n, o), o.has(i)) return o.get(i);
|
|
4058
|
+
let s = (async () => {
|
|
4059
|
+
let i = new FormData();
|
|
4060
|
+
i.set("file", n, n instanceof File ? n.name : "upload"), i.set("handle", e.handle), e.siteId && i.set("siteId", String(e.siteId)), i.set("fieldHandle", a.replace(/\.\d+$/, "")), i.set("renderId", t.tokens.render ?? ""), i.set("draftContext", String(t.continuation?.draftContext ?? "")), i.set("draftContextToken", String(t.continuation?.draftContextToken ?? "")), i.set("uploadCreateToken", t.tokens.uploadCreate ?? ""), t.continuation?.submissionId && i.set("submissionId", String(t.continuation.submissionId)), t.tokens.csrf && i.set(t.tokens.csrf.name, t.tokens.csrf.value);
|
|
4061
|
+
let o = e.submission.uploadEndpoint;
|
|
4062
|
+
if (!o) throw Error("The form bootstrap does not provide a staged upload endpoint.");
|
|
4063
|
+
let s = await $(o, {
|
|
4064
|
+
method: "POST",
|
|
4065
|
+
headers: { Accept: "application/json" },
|
|
4066
|
+
body: i
|
|
4067
|
+
}, r), c = await s.json();
|
|
4068
|
+
if (!s.ok || !c.success || !c.uploadUid || !c.attachToken) throw Error("The file could not be staged. Please select it again.");
|
|
4069
|
+
return {
|
|
4070
|
+
uploadUid: c.uploadUid,
|
|
4071
|
+
attachToken: c.attachToken
|
|
4072
|
+
};
|
|
4073
|
+
})();
|
|
4074
|
+
o.set(i, s);
|
|
4075
|
+
try {
|
|
4076
|
+
return await s;
|
|
4077
|
+
} catch (e) {
|
|
4078
|
+
throw o.delete(i), e;
|
|
4079
|
+
}
|
|
4080
|
+
}
|
|
4081
|
+
return Array.isArray(n) ? Promise.all(n.map((e, t) => i(e, `${a}.${t}`))) : n && typeof n == "object" ? Object.fromEntries(await Promise.all(Object.entries(n).map(async ([e, t]) => [e, await i(t, `${a}.${e}`)]))) : n;
|
|
4082
|
+
}, a = x(e);
|
|
4083
|
+
return Object.fromEntries(await Promise.all(Object.entries(n).map(async ([e, t]) => [e, await i(t, a.find((t) => t.id === e)?.handle ?? e)])));
|
|
4084
|
+
}
|
|
4085
|
+
//#endregion
|
|
4086
|
+
//#region src/grants.ts
|
|
4087
|
+
function We(e) {
|
|
4088
|
+
if (!e || typeof window > "u") return;
|
|
4089
|
+
let t = new URL(window.location.href), n = !1;
|
|
4090
|
+
for (let r of [
|
|
4091
|
+
"grantToken",
|
|
4092
|
+
"resumeToken",
|
|
4093
|
+
"submissionEditToken"
|
|
4094
|
+
]) t.searchParams.get(r) === e && (t.searchParams.delete(r), n = !0);
|
|
4095
|
+
n && window.history.replaceState(window.history.state, "", t);
|
|
3327
4096
|
}
|
|
3328
4097
|
//#endregion
|
|
3329
4098
|
//#region src/rest.ts
|
|
3330
|
-
function
|
|
4099
|
+
function Ge(e, t) {
|
|
3331
4100
|
if (t.startsWith("http://") || t.startsWith("https://")) return t;
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
4101
|
+
let n = t.startsWith("/") ? t : `/${t}`;
|
|
4102
|
+
if (e.startsWith("http://") || e.startsWith("https://")) {
|
|
4103
|
+
let t = new URL(e);
|
|
4104
|
+
return t.pathname = `${t.pathname.replace(/\/+$/, "")}${n}`, t.search = "", t.hash = "", t.toString();
|
|
4105
|
+
}
|
|
4106
|
+
let r = e.trim();
|
|
4107
|
+
return !r || r === "/" ? n : `${r.replace(/\/+$/, "")}${n}`;
|
|
3335
4108
|
}
|
|
3336
|
-
async function
|
|
3337
|
-
let
|
|
3338
|
-
if (!
|
|
3339
|
-
|
|
4109
|
+
async function Ke(e, t, n) {
|
|
4110
|
+
let r = await $(e, t, n), i = await r.json();
|
|
4111
|
+
if (!r.ok && !(typeof i.outcome == "string" && [
|
|
4112
|
+
403,
|
|
4113
|
+
409,
|
|
4114
|
+
422,
|
|
4115
|
+
429
|
|
4116
|
+
].includes(r.status))) throw Error(`Request failed with status ${r.status}.`);
|
|
4117
|
+
return i;
|
|
3340
4118
|
}
|
|
3341
|
-
function
|
|
4119
|
+
function qe(e, t) {
|
|
3342
4120
|
let n = t?.tokens?.csrf;
|
|
3343
|
-
|
|
4121
|
+
n?.name && n.value && (e[n.name] = n.value);
|
|
3344
4122
|
}
|
|
3345
|
-
async function
|
|
3346
|
-
let t =
|
|
4123
|
+
async function Je(e) {
|
|
4124
|
+
let t = Ge(e.endpoint, "/actions/formie/client/forms/load"), n = JSON.stringify({
|
|
3347
4125
|
handle: e.formHandle,
|
|
3348
|
-
siteId: e.siteId
|
|
3349
|
-
|
|
3350
|
-
|
|
4126
|
+
siteId: e.siteId,
|
|
4127
|
+
grantToken: e.grantToken,
|
|
4128
|
+
grantPurpose: e.grantPurpose,
|
|
4129
|
+
draftContext: e.draftContext,
|
|
4130
|
+
query: e.query
|
|
4131
|
+
}), r = await Ke(t, {
|
|
3351
4132
|
method: "POST",
|
|
3352
4133
|
credentials: e.credentials ?? "same-origin",
|
|
3353
4134
|
headers: { "Content-Type": "application/json" },
|
|
3354
4135
|
body: n
|
|
3355
|
-
});
|
|
4136
|
+
}, e);
|
|
4137
|
+
return Ee(r), We(e.grantToken), r;
|
|
3356
4138
|
}
|
|
3357
|
-
function
|
|
4139
|
+
function Ye(e) {
|
|
3358
4140
|
return {
|
|
3359
|
-
|
|
3360
|
-
|
|
4141
|
+
browserRequestOptions: {
|
|
4142
|
+
profile: e.profile ?? "same-origin-browser",
|
|
4143
|
+
publicSession: e.publicSession
|
|
4144
|
+
},
|
|
4145
|
+
async submit({ definition: t, session: n, values: r, action: i, browserData: a }) {
|
|
4146
|
+
let o = Ge(e.endpoint, "/actions/formie/client/submissions/submit"), s = await fe(t, await Ue(t, n, r, e)), c = {
|
|
3361
4147
|
handle: e.formHandle,
|
|
3362
4148
|
siteId: e.siteId,
|
|
3363
4149
|
action: i,
|
|
4150
|
+
browserData: a,
|
|
3364
4151
|
session: n,
|
|
3365
|
-
values:
|
|
4152
|
+
values: s
|
|
3366
4153
|
};
|
|
3367
|
-
return
|
|
4154
|
+
return qe(c, n), Ke(o, {
|
|
3368
4155
|
method: "POST",
|
|
3369
4156
|
credentials: e.credentials ?? "same-origin",
|
|
3370
4157
|
headers: { "Content-Type": "application/json" },
|
|
3371
|
-
body: JSON.stringify(
|
|
3372
|
-
});
|
|
4158
|
+
body: JSON.stringify(c)
|
|
4159
|
+
}, e);
|
|
3373
4160
|
},
|
|
3374
4161
|
async refreshSession({ session: t }) {
|
|
3375
|
-
let n =
|
|
4162
|
+
let n = Ge(e.endpoint, "/actions/formie/client/sessions/refresh"), r = {
|
|
3376
4163
|
handle: e.formHandle,
|
|
3377
4164
|
siteId: e.siteId,
|
|
3378
4165
|
session: t
|
|
3379
4166
|
};
|
|
3380
|
-
return
|
|
4167
|
+
return qe(r, t), Ke(n, {
|
|
3381
4168
|
method: "POST",
|
|
3382
4169
|
credentials: e.credentials ?? "same-origin",
|
|
3383
4170
|
headers: { "Content-Type": "application/json" },
|
|
3384
4171
|
body: JSON.stringify(r)
|
|
3385
|
-
});
|
|
4172
|
+
}, e);
|
|
3386
4173
|
},
|
|
3387
4174
|
async setPage({ definition: t, session: n, values: r, currentPageId: i, targetPageId: a }) {
|
|
3388
|
-
let o =
|
|
4175
|
+
let o = Ge(e.endpoint, "/actions/formie/client/forms/page"), s = await fe(t, await Ue(t, n, r, e)), c = {
|
|
3389
4176
|
handle: e.formHandle,
|
|
3390
4177
|
siteId: e.siteId,
|
|
3391
4178
|
currentPageId: i,
|
|
@@ -3393,20 +4180,25 @@ function Me(e) {
|
|
|
3393
4180
|
session: n,
|
|
3394
4181
|
values: s
|
|
3395
4182
|
};
|
|
3396
|
-
return
|
|
4183
|
+
return qe(c, n), Ke(o, {
|
|
3397
4184
|
method: "POST",
|
|
3398
4185
|
credentials: e.credentials ?? "same-origin",
|
|
3399
4186
|
headers: { "Content-Type": "application/json" },
|
|
3400
4187
|
body: JSON.stringify(c)
|
|
3401
|
-
});
|
|
4188
|
+
}, e);
|
|
3402
4189
|
}
|
|
3403
4190
|
};
|
|
3404
4191
|
}
|
|
3405
4192
|
//#endregion
|
|
3406
4193
|
//#region src/graphql.ts
|
|
3407
|
-
var
|
|
4194
|
+
var Xe = "\n id\n version\n currentPageId\n tokens\n continuation\n", Ze = `
|
|
3408
4195
|
success
|
|
4196
|
+
outcome
|
|
4197
|
+
version
|
|
3409
4198
|
submissionUid
|
|
4199
|
+
resumeToken
|
|
4200
|
+
resumeUrl
|
|
4201
|
+
resumeTokenExpiresAt
|
|
3410
4202
|
currentPageId
|
|
3411
4203
|
nextPageId
|
|
3412
4204
|
previousPageId
|
|
@@ -3414,24 +4206,21 @@ var $ = "\n id\n currentPageId\n tokens\n continuation\n", Ne = `
|
|
|
3414
4206
|
errors
|
|
3415
4207
|
messages
|
|
3416
4208
|
clientEvents
|
|
3417
|
-
|
|
3418
|
-
paymentMessage
|
|
3419
|
-
paymentRedirectUrl
|
|
3420
|
-
paymentAction
|
|
3421
|
-
paymentDecision
|
|
3422
|
-
keepSubmitLoading
|
|
4209
|
+
payment
|
|
3423
4210
|
session {
|
|
3424
|
-
${
|
|
4211
|
+
${Xe}
|
|
3425
4212
|
}
|
|
3426
4213
|
quizResult
|
|
4214
|
+
completion
|
|
4215
|
+
redirect
|
|
3427
4216
|
`;
|
|
3428
|
-
function
|
|
4217
|
+
function Qe(e) {
|
|
3429
4218
|
if (e.startsWith("http://") || e.startsWith("https://")) return e;
|
|
3430
4219
|
let t = e.trim();
|
|
3431
4220
|
return !t || t === "/" ? "/api" : t;
|
|
3432
4221
|
}
|
|
3433
|
-
async function
|
|
3434
|
-
let r = await
|
|
4222
|
+
async function $e(e, t, n) {
|
|
4223
|
+
let r = await $(Qe(e.endpoint), {
|
|
3435
4224
|
method: "POST",
|
|
3436
4225
|
credentials: e.credentials ?? "same-origin",
|
|
3437
4226
|
headers: {
|
|
@@ -3442,59 +4231,68 @@ async function Fe(e, t, n) {
|
|
|
3442
4231
|
query: t,
|
|
3443
4232
|
variables: n
|
|
3444
4233
|
})
|
|
3445
|
-
});
|
|
4234
|
+
}, e);
|
|
3446
4235
|
if (!r.ok) throw Error(`Request failed with status ${r.status}.`);
|
|
3447
4236
|
let i = await r.json();
|
|
3448
4237
|
if (i.errors?.length) throw Error(i.errors[0]?.message || "GraphQL returned an error.");
|
|
3449
4238
|
if (!i.data) throw Error("GraphQL returned no data.");
|
|
3450
4239
|
return i.data;
|
|
3451
4240
|
}
|
|
3452
|
-
async function
|
|
3453
|
-
let t = await
|
|
3454
|
-
query ClientForm($handle: String!, $siteId: Int) {
|
|
3455
|
-
formieClientForm(handle: $handle, siteId: $siteId) {
|
|
3456
|
-
|
|
4241
|
+
async function et(e) {
|
|
4242
|
+
let t = await $e(e, `
|
|
4243
|
+
query ClientForm($handle: String!, $siteId: Int, $grantToken: String, $grantPurpose: String, $draftContext: String, $query: Json) {
|
|
4244
|
+
formieClientForm(handle: $handle, siteId: $siteId, grantToken: $grantToken, grantPurpose: $grantPurpose, draftContext: $draftContext, query: $query) {
|
|
4245
|
+
contractVersion
|
|
3457
4246
|
definition
|
|
3458
4247
|
session {
|
|
3459
|
-
${
|
|
4248
|
+
${Xe}
|
|
3460
4249
|
}
|
|
3461
4250
|
}
|
|
3462
4251
|
}
|
|
3463
4252
|
`, {
|
|
3464
4253
|
handle: e.formHandle,
|
|
3465
|
-
siteId: e.siteId
|
|
4254
|
+
siteId: e.siteId,
|
|
4255
|
+
grantToken: e.grantToken,
|
|
4256
|
+
grantPurpose: e.grantPurpose,
|
|
4257
|
+
draftContext: e.draftContext,
|
|
4258
|
+
query: e.query
|
|
3466
4259
|
});
|
|
3467
4260
|
if (!t.formieClientForm) throw Error("No client form definition was returned.");
|
|
3468
|
-
return t.formieClientForm;
|
|
4261
|
+
return Ee(t.formieClientForm), We(e.grantToken), t.formieClientForm;
|
|
3469
4262
|
}
|
|
3470
|
-
function
|
|
4263
|
+
function tt(e) {
|
|
3471
4264
|
return {
|
|
3472
|
-
|
|
3473
|
-
|
|
4265
|
+
browserRequestOptions: {
|
|
4266
|
+
profile: e.profile ?? "same-origin-browser",
|
|
4267
|
+
publicSession: e.publicSession
|
|
4268
|
+
},
|
|
4269
|
+
async submit({ definition: t, session: n, values: r, action: i, browserData: a }) {
|
|
4270
|
+
let o = await fe(t, await Ue(t, n, r, e)), s = await $e(e, `
|
|
3474
4271
|
mutation SubmitFormieClientForm(
|
|
3475
4272
|
$input: FormieClientSubmitInput!
|
|
3476
4273
|
) {
|
|
3477
4274
|
submitFormieClientForm(input: $input) {
|
|
3478
|
-
${
|
|
4275
|
+
${Ze}
|
|
3479
4276
|
}
|
|
3480
4277
|
}
|
|
3481
4278
|
`, { input: {
|
|
3482
4279
|
handle: e.formHandle,
|
|
3483
4280
|
siteId: e.siteId,
|
|
3484
4281
|
action: i,
|
|
4282
|
+
browserData: a,
|
|
3485
4283
|
session: n,
|
|
3486
|
-
values:
|
|
4284
|
+
values: o
|
|
3487
4285
|
} });
|
|
3488
|
-
if (!
|
|
3489
|
-
return
|
|
4286
|
+
if (!s.submitFormieClientForm) throw Error("No client submit result was returned.");
|
|
4287
|
+
return s.submitFormieClientForm;
|
|
3490
4288
|
},
|
|
3491
4289
|
async refreshSession({ session: t }) {
|
|
3492
|
-
let n = await
|
|
4290
|
+
let n = await $e(e, `
|
|
3493
4291
|
mutation RefreshFormieClientSession(
|
|
3494
4292
|
$input: FormieClientSessionRefreshInput!
|
|
3495
4293
|
) {
|
|
3496
4294
|
refreshFormieClientSession(input: $input) {
|
|
3497
|
-
${
|
|
4295
|
+
${Xe}
|
|
3498
4296
|
}
|
|
3499
4297
|
}
|
|
3500
4298
|
`, { input: {
|
|
@@ -3506,12 +4304,12 @@ function Le(e) {
|
|
|
3506
4304
|
return n.refreshFormieClientSession;
|
|
3507
4305
|
},
|
|
3508
4306
|
async setPage({ definition: t, session: n, values: r, currentPageId: i, targetPageId: a }) {
|
|
3509
|
-
let o = await
|
|
4307
|
+
let o = await fe(t, await Ue(t, n, r, e)), s = await $e(e, `
|
|
3510
4308
|
mutation SetFormieClientPage(
|
|
3511
4309
|
$input: FormieClientSetPageInput!
|
|
3512
4310
|
) {
|
|
3513
4311
|
setFormieClientPage(input: $input) {
|
|
3514
|
-
${
|
|
4312
|
+
success outcome httpStatus errors messages currentPageId nextPageId version session { ${Xe} }
|
|
3515
4313
|
}
|
|
3516
4314
|
}
|
|
3517
4315
|
`, { input: {
|
|
@@ -3529,31 +4327,240 @@ function Le(e) {
|
|
|
3529
4327
|
}
|
|
3530
4328
|
//#endregion
|
|
3531
4329
|
//#region src/text.ts
|
|
3532
|
-
var
|
|
4330
|
+
var nt = (() => {
|
|
4331
|
+
if (typeof Intl > "u") return null;
|
|
3533
4332
|
let e = Intl.Segmenter;
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
4333
|
+
if (!e) return null;
|
|
4334
|
+
try {
|
|
4335
|
+
return new e(void 0, { granularity: "grapheme" });
|
|
4336
|
+
} catch {
|
|
4337
|
+
return null;
|
|
4338
|
+
}
|
|
4339
|
+
})(), rt = /[^\s\u0085]+/gu, it = (() => {
|
|
4340
|
+
try {
|
|
4341
|
+
return /* @__PURE__ */ RegExp("(?:\\p{Regional_Indicator}{2}|\\p{Extended_Pictographic}[\\p{Emoji_Modifier}\\p{M}\\u{E0020}-\\u{E007F}]*(?:\\u{200D}\\p{Extended_Pictographic}[\\p{Emoji_Modifier}\\p{M}\\u{E0020}-\\u{E007F}]*)*|[\\s\\S])\\p{M}*", "gu");
|
|
4342
|
+
} catch {
|
|
4343
|
+
return null;
|
|
4344
|
+
}
|
|
4345
|
+
})();
|
|
4346
|
+
function at(e) {
|
|
4347
|
+
return typeof DOMParser < "u" ? new DOMParser().parseFromString(e, "text/html").body.textContent || "" : e.replace(/<[^>]*>/g, "");
|
|
3538
4348
|
}
|
|
3539
|
-
function
|
|
3540
|
-
return
|
|
4349
|
+
function ot(e) {
|
|
4350
|
+
return at(e);
|
|
3541
4351
|
}
|
|
3542
|
-
function
|
|
3543
|
-
return
|
|
4352
|
+
function st(e) {
|
|
4353
|
+
return ot(e).replace(/[\s\u0085]+/g, " ").trim();
|
|
3544
4354
|
}
|
|
3545
|
-
function
|
|
3546
|
-
return
|
|
4355
|
+
function ct(e) {
|
|
4356
|
+
return nt ? Array.from(nt.segment(e)).length : it ? e.match(it)?.length || 0 : Array.from(e).length;
|
|
3547
4357
|
}
|
|
3548
|
-
function
|
|
3549
|
-
return e.match(
|
|
4358
|
+
function lt(e) {
|
|
4359
|
+
return e.match(rt)?.length || 0;
|
|
3550
4360
|
}
|
|
3551
|
-
function
|
|
3552
|
-
let t =
|
|
4361
|
+
function ut(e) {
|
|
4362
|
+
let t = ot(e), n = st(e);
|
|
3553
4363
|
return {
|
|
3554
|
-
graphemeCount:
|
|
3555
|
-
wordCount:
|
|
4364
|
+
graphemeCount: ct(t),
|
|
4365
|
+
wordCount: lt(n)
|
|
4366
|
+
};
|
|
4367
|
+
}
|
|
4368
|
+
//#endregion
|
|
4369
|
+
//#region src/accessibility.ts
|
|
4370
|
+
function dt(e) {
|
|
4371
|
+
return e.settings.validation.errorAriaLive || "polite";
|
|
4372
|
+
}
|
|
4373
|
+
function ft(e, t) {
|
|
4374
|
+
return `formie-${e.tokens.render || e.id}-${t}-errors`;
|
|
4375
|
+
}
|
|
4376
|
+
//#endregion
|
|
4377
|
+
//#region src/references.ts
|
|
4378
|
+
var pt = { username: "user:name" };
|
|
4379
|
+
Object.entries({
|
|
4380
|
+
form: ["name", "handle"],
|
|
4381
|
+
submission: [
|
|
4382
|
+
"id",
|
|
4383
|
+
"uid",
|
|
4384
|
+
"title",
|
|
4385
|
+
"url",
|
|
4386
|
+
"date",
|
|
4387
|
+
"site",
|
|
4388
|
+
"status"
|
|
4389
|
+
],
|
|
4390
|
+
site: [
|
|
4391
|
+
"id",
|
|
4392
|
+
"name",
|
|
4393
|
+
"handle",
|
|
4394
|
+
"url",
|
|
4395
|
+
"language"
|
|
4396
|
+
]
|
|
4397
|
+
}).forEach(([e, t]) => {
|
|
4398
|
+
t.forEach((t) => {
|
|
4399
|
+
pt[`${e}.${t}`] = `${e}:${t}`;
|
|
4400
|
+
});
|
|
4401
|
+
}), Object.entries({
|
|
4402
|
+
form: ["Name", "Handle"],
|
|
4403
|
+
submission: [
|
|
4404
|
+
"Title",
|
|
4405
|
+
"Url",
|
|
4406
|
+
"Id",
|
|
4407
|
+
"Uid",
|
|
4408
|
+
"Date",
|
|
4409
|
+
"Site",
|
|
4410
|
+
"Status"
|
|
4411
|
+
],
|
|
4412
|
+
system: [
|
|
4413
|
+
"Name",
|
|
4414
|
+
"Email",
|
|
4415
|
+
"ReplyTo"
|
|
4416
|
+
],
|
|
4417
|
+
site: [
|
|
4418
|
+
"Name",
|
|
4419
|
+
"Handle",
|
|
4420
|
+
"Url",
|
|
4421
|
+
"Id",
|
|
4422
|
+
"Language"
|
|
4423
|
+
],
|
|
4424
|
+
user: [
|
|
4425
|
+
"Ip",
|
|
4426
|
+
"Id",
|
|
4427
|
+
"Email",
|
|
4428
|
+
"FullName",
|
|
4429
|
+
"FirstName",
|
|
4430
|
+
"LastName"
|
|
4431
|
+
]
|
|
4432
|
+
}).forEach(([e, t]) => {
|
|
4433
|
+
t.forEach((t) => {
|
|
4434
|
+
pt[e + t] = `${e}:${t[0].toLowerCase()}${t.slice(1)}`;
|
|
4435
|
+
});
|
|
4436
|
+
}), Object.entries({
|
|
4437
|
+
dateUs: "m/d/Y",
|
|
4438
|
+
dateInt: "d/m/Y",
|
|
4439
|
+
time12: "h:i a",
|
|
4440
|
+
time24: "H:i"
|
|
4441
|
+
}).forEach(([e, t]) => {
|
|
4442
|
+
pt[e] = `timestamp;transform=format;preset=custom;pattern=${encodeURIComponent(t)}`;
|
|
4443
|
+
});
|
|
4444
|
+
function mt(e) {
|
|
4445
|
+
let t = {
|
|
4446
|
+
raw: e,
|
|
4447
|
+
target: "",
|
|
4448
|
+
identifier: "",
|
|
4449
|
+
selector: "",
|
|
4450
|
+
default: "",
|
|
4451
|
+
transformerId: "",
|
|
4452
|
+
transformerParams: {},
|
|
4453
|
+
version: 1,
|
|
4454
|
+
isValid: !1
|
|
4455
|
+
}, n = (e) => ({
|
|
4456
|
+
...t,
|
|
4457
|
+
diagnostic: e
|
|
4458
|
+
}), r = e.trim().match(/^\{([^{}]+)\}$/);
|
|
4459
|
+
if (!r) return n("invalidSyntax");
|
|
4460
|
+
let i = r[1].replace(/^field\./, "field:"), a = i.indexOf("|"), o = a < 0 ? "" : i.slice(a + 1);
|
|
4461
|
+
i = a < 0 ? i : i.slice(0, a);
|
|
4462
|
+
let s = i.indexOf(";"), c = s < 0 ? i : i.slice(0, s);
|
|
4463
|
+
i = (Object.prototype.hasOwnProperty.call(pt, c) ? pt[c] : c) + (s < 0 ? "" : i.slice(s));
|
|
4464
|
+
let [l, ...u] = i.split(";"), d = Object.create(null);
|
|
4465
|
+
try {
|
|
4466
|
+
for (let e of u) {
|
|
4467
|
+
let t = e.match(/^([a-zA-Z][a-zA-Z0-9_]*)=(.*)$/);
|
|
4468
|
+
if (!t || Object.prototype.hasOwnProperty.call(d, t[1])) return n("invalidMetadata");
|
|
4469
|
+
d[t[1]] = decodeURIComponent(t[2]);
|
|
4470
|
+
}
|
|
4471
|
+
if ((d.v ?? "1") !== "1") return n("unsupportedVersion");
|
|
4472
|
+
delete d.v;
|
|
4473
|
+
let e = l.indexOf(":"), r = e < 0 ? l : l.slice(0, e), i = e < 0 ? "" : l.slice(e + 1);
|
|
4474
|
+
if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(r)) return n("invalidSource");
|
|
4475
|
+
let a = "";
|
|
4476
|
+
if (r === "field" && i.includes(":")) {
|
|
4477
|
+
let e = i.indexOf(":");
|
|
4478
|
+
a = i.slice(e + 1), i = i.slice(0, e);
|
|
4479
|
+
}
|
|
4480
|
+
if (![
|
|
4481
|
+
"timestamp",
|
|
4482
|
+
"allFields",
|
|
4483
|
+
"allContentFields",
|
|
4484
|
+
"allVisibleFields"
|
|
4485
|
+
].includes(r) && !i || /[\s{}]/.test(i + a)) return n("invalidIdentifier");
|
|
4486
|
+
let s = d.transform ?? "";
|
|
4487
|
+
return delete d.transform, {
|
|
4488
|
+
...t,
|
|
4489
|
+
target: r,
|
|
4490
|
+
identifier: decodeURIComponent(i),
|
|
4491
|
+
selector: decodeURIComponent(a),
|
|
4492
|
+
default: decodeURIComponent(o),
|
|
4493
|
+
transformerId: s,
|
|
4494
|
+
transformerParams: d,
|
|
4495
|
+
isValid: !0
|
|
4496
|
+
};
|
|
4497
|
+
} catch {
|
|
4498
|
+
return n("invalidEncoding");
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
4501
|
+
function ht(e) {
|
|
4502
|
+
if (!e.isValid || e.version !== 1) throw Error("Cannot serialize an invalid reference expression.");
|
|
4503
|
+
let t = (e) => encodeURIComponent(e).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), n = (e) => t(e).replace(/%2F/g, "/"), r = e.target;
|
|
4504
|
+
e.identifier && (r += `:${n(e.identifier)}`), e.selector && (r += `:${n(e.selector).replace(/%3A/g, ":")}`), e.transformerId && (r += `;transform=${t(e.transformerId)}`);
|
|
4505
|
+
for (let [n, i] of Object.entries(e.transformerParams)) r += `;${n}=${t(i)}`;
|
|
4506
|
+
return e.default && (r += `|${t(e.default)}`), `{${r}}`;
|
|
4507
|
+
}
|
|
4508
|
+
function gt(e, t) {
|
|
4509
|
+
let n = mt(e);
|
|
4510
|
+
if (!n.isValid) return {
|
|
4511
|
+
expression: n,
|
|
4512
|
+
diagnostic: "invalidExpression"
|
|
4513
|
+
};
|
|
4514
|
+
let r = `${n.target}:${n.identifier}`, i = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
|
|
4515
|
+
if (!i(t.definitions, r)) return {
|
|
4516
|
+
expression: n,
|
|
4517
|
+
diagnostic: n.target === "field" ? "missingField" : "unknownSource"
|
|
4518
|
+
};
|
|
4519
|
+
let a = t.definitions[r];
|
|
4520
|
+
if (!a.availability.browser) return {
|
|
4521
|
+
expression: n,
|
|
4522
|
+
diagnostic: "forbiddenSource"
|
|
4523
|
+
};
|
|
4524
|
+
if (Object.keys(n.transformerParams).some((e) => [
|
|
4525
|
+
"scope",
|
|
4526
|
+
"index",
|
|
4527
|
+
"rows"
|
|
4528
|
+
].includes(e))) return {
|
|
4529
|
+
expression: n,
|
|
4530
|
+
diagnostic: "invalidRowScope"
|
|
4531
|
+
};
|
|
4532
|
+
if (n.selector && !a.selectors?.includes(n.selector)) return {
|
|
4533
|
+
expression: n,
|
|
4534
|
+
diagnostic: "invalidSelector"
|
|
4535
|
+
};
|
|
4536
|
+
let o = n.selector ? `${r}:${n.selector}` : r;
|
|
4537
|
+
if (!i(t.values, o)) return {
|
|
4538
|
+
expression: n,
|
|
4539
|
+
diagnostic: "missingField"
|
|
4540
|
+
};
|
|
4541
|
+
let s = t.values[o];
|
|
4542
|
+
if (n.transformerId) {
|
|
4543
|
+
let e = t.transforms?.[n.transformerId];
|
|
4544
|
+
if (!e) return {
|
|
4545
|
+
expression: n,
|
|
4546
|
+
diagnostic: "unknownTransform"
|
|
4547
|
+
};
|
|
4548
|
+
if (!e.browser) return {
|
|
4549
|
+
expression: n,
|
|
4550
|
+
diagnostic: "forbiddenSource"
|
|
4551
|
+
};
|
|
4552
|
+
if (a.transforms && !a.transforms.includes(n.transformerId) || !e.accepts(s) || Object.keys(n.transformerParams).some((t) => !e.parameters.includes(t)) || (s = e.resolve(s, n.transformerParams), !e.acceptsOutput(s))) return {
|
|
4553
|
+
expression: n,
|
|
4554
|
+
diagnostic: "invalidType"
|
|
4555
|
+
};
|
|
4556
|
+
} else if (Object.keys(n.transformerParams).length) return {
|
|
4557
|
+
expression: n,
|
|
4558
|
+
diagnostic: "invalidExpression"
|
|
4559
|
+
};
|
|
4560
|
+
return (s === "" || s == null || Array.isArray(s) && s.length === 0) && n.default && (s = n.default), {
|
|
4561
|
+
expression: n,
|
|
4562
|
+
value: s
|
|
3556
4563
|
};
|
|
3557
4564
|
}
|
|
3558
4565
|
//#endregion
|
|
3559
|
-
export {
|
|
4566
|
+
export { Ce as BROWSER_MODULE_CONTRACT_VERSION, Te as CLIENT_FORM_CONTRACT_VERSION, Y as CLIENT_FORM_EVENT_NAMES, x as allFields, we as assertBrowserModuleManifest, Ee as assertClientFormBootstrap, $ as browserRequest, Ve as browserRequestHeaders, xe as browserValueEmpty, Ge as buildActionUrl, _e as clientActionAllowed, Z as coerceCalculationVariables, v as combineConditions, ae as compositePartDefinitions, m as conditionNumber, ct as countGraphemes, J as createClientFormInstance, tt as createGraphqlClientTransport, oe as createRepeaterRowValue, Ye as createRestClientTransport, N as defaultValueForField, ze as evaluateCalculationExpression, F as evaluateClientCondition, _ as evaluateCondition, y as evaluateConditionDefinition, P as fieldValueAsStrings, te as fieldValueContract, ne as fieldValueStructure, b as finalizeConditionEvaluation, C as findFieldByHandle, S as findFieldById, Q as formatCalculationValue, Le as getCalculationFormula, X as getCalculationVariableEntries, dt as getClientErrorAriaLive, ft as getClientFieldErrorId, ut as getTextLimitMetrics, lt as getWordCount, re as isBooleanField, E as isCompositeField, A as isEmailField, O as isFileField, T as isKnownClientFieldType, k as isMultiValueField, ie as isNumericField, D as isRepeatableField, Je as loadClientFormBootstrap, et as loadGraphqlClientFormBootstrap, st as normalizeText, mt as parseReference, Re as readCalculationVariableValue, be as registerBrowserValidationRule, M as repeaterFieldDefinitions, j as repeaterRowDefinitions, gt as resolveReference, l as selectConditionRows, w as serializeFieldValues, ht as serializeReference, fe as serializeTransportFieldValues, Se as validateBrowserValue };
|