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