@verbb/formie-browser 1.0.3 → 1.0.5

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.
Files changed (206) hide show
  1. package/CHANGELOG.md +65 -17
  2. package/dist/chunks/address-country-Rx6GQTND.js +68 -0
  3. package/dist/chunks/address-finder-yXU5yMjG.js +30 -0
  4. package/dist/chunks/address-state-BQ0xGV9n.js +344 -0
  5. package/dist/chunks/api-CmwLRq_n.js +780 -0
  6. package/dist/chunks/api-DMK8NSUI.js +407 -0
  7. package/dist/chunks/api-sPqGbOww.js +125 -0
  8. package/dist/chunks/async-nPFRNQ06.js +25 -0
  9. package/dist/chunks/bpoint-DSjqRv63.js +24 -0
  10. package/dist/chunks/calculations-CgVJcQ2P.js +299 -0
  11. package/dist/chunks/captcha-eu-CWJb64_j.js +31 -0
  12. package/dist/chunks/checkbox-radio-DQ0H67Tj.js +125 -0
  13. package/dist/chunks/chunk-3b4jIN3o.js +13 -0
  14. package/dist/chunks/combobox-D-2b42wn.js +1954 -0
  15. package/dist/chunks/conditions-CZ3FU5QO.js +412 -0
  16. package/dist/chunks/constants-DVcJAvc5.js +38 -0
  17. package/dist/chunks/country-from-ip-BwxKaBuJ.js +26 -0
  18. package/dist/chunks/custom-google-maps-BsaSirEZ.js +194 -0
  19. package/dist/chunks/custom-link-CJ1-FjEM.js +46 -0
  20. package/dist/chunks/custom-maps-DYW_pBid.js +161 -0
  21. package/dist/chunks/date-picker-5CA_-zGb.js +5311 -0
  22. package/dist/chunks/debug-BV0DvdHx.js +41 -0
  23. package/dist/chunks/dist-BF5GU3_9.js +2674 -0
  24. package/dist/chunks/event-names-BCI2FLD8.js +51 -0
  25. package/dist/chunks/eway-D3ctTbEk.js +70 -0
  26. package/dist/chunks/field-references.keys-58ZSTrCW.js +21 -0
  27. package/dist/chunks/field-references.resolver-CHwn0G0L.js +145 -0
  28. package/dist/chunks/file-upload-D49m8-DR.js +287 -0
  29. package/dist/chunks/friendly-captcha-v1-ByXzENYZ.js +31 -0
  30. package/dist/chunks/friendly-captcha-v2-BPdlmhQu.js +36 -0
  31. package/dist/chunks/friendly-challenge-8uPatWqk.js +832 -0
  32. package/dist/chunks/go-cardless-BwASSYSK.js +23 -0
  33. package/dist/chunks/google-address-OhKilPWE.js +161 -0
  34. package/dist/chunks/hcaptcha-CdCd9oEi.js +54 -0
  35. package/dist/chunks/hidden-D7_Ch-QN.js +26 -0
  36. package/dist/chunks/http-D-JExro7.js +27 -0
  37. package/dist/chunks/i18n-BY1ds1BL.js +121 -0
  38. package/dist/chunks/leaflet-src-j-lHNmhR.js +4585 -0
  39. package/dist/chunks/loqate-Cp2zvwpE.js +76 -0
  40. package/dist/chunks/mollie-COG-ko2D.js +23 -0
  41. package/dist/chunks/moneris-CMH8PlRc.js +117 -0
  42. package/dist/chunks/opayo-D2jsR5vh.js +113 -0
  43. package/dist/chunks/paddle-DxF88RfC.js +55 -0
  44. package/dist/chunks/paypal-b5pnwrA2.js +95 -0
  45. package/dist/chunks/payway-BJYu9DIR.js +55 -0
  46. package/dist/chunks/phone-country-D3ayr60L.js +2645 -0
  47. package/dist/chunks/place-kit-BGHklIZ-.js +48 -0
  48. package/dist/chunks/placekit-autocomplete.esm-DWVabQlq.js +1236 -0
  49. package/dist/chunks/recaptcha-enterprise-BSwi8IVX.js +65 -0
  50. package/dist/chunks/recaptcha-shared-B4zAescW.js +15 -0
  51. package/dist/chunks/recaptcha-v2-checkbox-CnDQmsKa.js +40 -0
  52. package/dist/chunks/recaptcha-v2-invisible-Cz5uIlp-.js +53 -0
  53. package/dist/chunks/recaptcha-v3-BtbbP111.js +27 -0
  54. package/dist/chunks/repeater-B5leVxZU.js +102 -0
  55. package/dist/chunks/rich-text-Cv8ADyk-.js +349 -0
  56. package/dist/chunks/scripts-6CYSUGKQ.js +24 -0
  57. package/dist/chunks/sdk-BhHAYgga.js +1397 -0
  58. package/dist/chunks/shared-Bx9s0i0P.js +100 -0
  59. package/dist/chunks/signature-CpgqHCEx.js +463 -0
  60. package/dist/chunks/snaptcha-vz1RnZ15.js +8 -0
  61. package/dist/chunks/square-BP8RWAKB.js +40 -0
  62. package/dist/chunks/stripe-MihN63uC.js +184 -0
  63. package/dist/chunks/styles-BfoIZwJp.js +19 -0
  64. package/dist/chunks/summary-D3AjxpYN.js +114 -0
  65. package/dist/chunks/table-C-lkQN6I.js +78 -0
  66. package/dist/chunks/text-limit-B09elPDB.js +125 -0
  67. package/dist/chunks/theme-classes-Tv7q7ToE.js +44 -0
  68. package/dist/chunks/turnstile-D_Pi1CKM.js +58 -0
  69. package/dist/chunks/utils-Vqp8i_RM.js +49401 -0
  70. package/dist/css/formie-theme.css +2 -0
  71. package/dist/css/theme/fields/_address-state.css +94 -0
  72. package/dist/css/theme/fields/_combobox.css +246 -0
  73. package/dist/css/theme/fields/_select.css +13 -0
  74. package/dist/index.js +2447 -39
  75. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  76. package/dist/js/core/field-error-container.d.ts +4 -0
  77. package/dist/js/core/field-error-container.d.ts.map +1 -0
  78. package/dist/js/core/submit-result-state.d.ts.map +1 -1
  79. package/dist/js/core/submit-result-ui.d.ts.map +1 -1
  80. package/dist/js/core/validation-focus.d.ts +4 -0
  81. package/dist/js/core/validation-focus.d.ts.map +1 -0
  82. package/dist/js/modules/address/api.d.ts +1 -0
  83. package/dist/js/modules/address/api.d.ts.map +1 -1
  84. package/dist/js/modules/address/constants.d.ts +22 -1
  85. package/dist/js/modules/address/constants.d.ts.map +1 -1
  86. package/dist/js/modules/address/host.d.ts +2 -2
  87. package/dist/js/modules/address/host.d.ts.map +1 -1
  88. package/dist/js/modules/address/loqate.d.ts.map +1 -1
  89. package/dist/js/modules/fields/address-country.d.ts +3 -0
  90. package/dist/js/modules/fields/address-country.d.ts.map +1 -0
  91. package/dist/js/modules/fields/address-state.d.ts +3 -0
  92. package/dist/js/modules/fields/address-state.d.ts.map +1 -0
  93. package/dist/js/modules/fields/calculations.d.ts.map +1 -1
  94. package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -1
  95. package/dist/js/modules/fields/combobox.d.ts +17 -0
  96. package/dist/js/modules/fields/combobox.d.ts.map +1 -0
  97. package/dist/js/modules/fields/custom-google-maps.d.ts +64 -0
  98. package/dist/js/modules/fields/custom-google-maps.d.ts.map +1 -0
  99. package/dist/js/modules/fields/custom-link.d.ts +3 -0
  100. package/dist/js/modules/fields/custom-link.d.ts.map +1 -0
  101. package/dist/js/modules/fields/custom-maps.d.ts +3 -0
  102. package/dist/js/modules/fields/custom-maps.d.ts.map +1 -0
  103. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  104. package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
  105. package/dist/js/modules/fields/index.d.ts.map +1 -1
  106. package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
  107. package/dist/js/modules/fields/text-limit.d.ts.map +1 -1
  108. package/dist/js/submit/pipeline.d.ts.map +1 -1
  109. package/dist/js/utils/country-from-ip.d.ts +7 -0
  110. package/dist/js/utils/country-from-ip.d.ts.map +1 -0
  111. package/dist/js/utils/field-references.d.ts +1 -0
  112. package/dist/js/utils/field-references.d.ts.map +1 -1
  113. package/dist/js/utils/field-references.row-scope.d.ts +11 -0
  114. package/dist/js/utils/field-references.row-scope.d.ts.map +1 -0
  115. package/dist/js/utils/i18n.d.ts.map +1 -1
  116. package/dist/js/validation/rules/email.d.ts.map +1 -1
  117. package/dist/js/validation/rules/number.d.ts.map +1 -1
  118. package/dist/js/validation/validator.d.ts.map +1 -1
  119. package/package.json +6 -3
  120. package/src/css/formie-theme.css +2 -0
  121. package/src/css/theme/fields/_address-state.css +94 -0
  122. package/src/css/theme/fields/_combobox.css +246 -0
  123. package/src/css/theme/fields/_select.css +13 -0
  124. package/src/js/core/create-formie-client.ts +27 -0
  125. package/src/js/core/field-error-container.ts +39 -0
  126. package/src/js/core/submit-result-state.ts +12 -2
  127. package/src/js/core/submit-result-ui.ts +7 -13
  128. package/src/js/core/validation-focus.ts +117 -0
  129. package/src/js/modules/address/api.ts +7 -0
  130. package/src/js/modules/address/constants.ts +82 -2
  131. package/src/js/modules/address/host.ts +16 -6
  132. package/src/js/modules/address/loqate.ts +3 -17
  133. package/src/js/modules/fields/address-country.ts +156 -0
  134. package/src/js/modules/fields/address-state.ts +946 -0
  135. package/src/js/modules/fields/calculations.ts +32 -0
  136. package/src/js/modules/fields/checkbox-radio.ts +21 -15
  137. package/src/js/modules/fields/combobox.ts +188 -0
  138. package/src/js/modules/fields/custom-google-maps.ts +416 -0
  139. package/src/js/modules/fields/custom-link.ts +95 -0
  140. package/src/js/modules/fields/custom-maps.ts +339 -0
  141. package/src/js/modules/fields/date-picker.ts +96 -3
  142. package/src/js/modules/fields/file-upload.ts +12 -9
  143. package/src/js/modules/fields/index.ts +6 -0
  144. package/src/js/modules/fields/phone-country.ts +6 -0
  145. package/src/js/modules/fields/text-limit.ts +87 -22
  146. package/src/js/submit/pipeline.ts +11 -1
  147. package/src/js/utils/country-from-ip.ts +54 -0
  148. package/src/js/utils/field-references.row-scope.ts +303 -0
  149. package/src/js/utils/field-references.ts +1 -0
  150. package/src/js/utils/i18n.ts +184 -5
  151. package/src/js/validation/rules/email.ts +3 -2
  152. package/src/js/validation/rules/match.ts +2 -2
  153. package/src/js/validation/rules/minmax.ts +4 -4
  154. package/src/js/validation/rules/number.ts +9 -5
  155. package/src/js/validation/rules/pattern.ts +4 -4
  156. package/src/js/validation/rules/required.ts +1 -1
  157. package/src/js/validation/rules/url.ts +1 -1
  158. package/src/js/validation/validator.ts +7 -7
  159. package/dist/chunks/address-finder-BjMuEiwF.js +0 -37
  160. package/dist/chunks/bpoint-KudsBCo2.js +0 -26
  161. package/dist/chunks/calculations-DlGSkQ3W.js +0 -147
  162. package/dist/chunks/captcha-eu-CterYFok.js +0 -34
  163. package/dist/chunks/checkbox-radio-CBvgk3hR.js +0 -136
  164. package/dist/chunks/conditions-DYy1-Hwt.js +0 -459
  165. package/dist/chunks/date-picker-BlD--zfe.js +0 -4994
  166. package/dist/chunks/eway-qwc-B5Us.js +0 -74
  167. package/dist/chunks/file-upload-CIgHrXfp.js +0 -316
  168. package/dist/chunks/friendly-captcha-v1-EDFac33c.js +0 -33
  169. package/dist/chunks/friendly-captcha-v2-BDpSvFGR.js +0 -38
  170. package/dist/chunks/go-cardless-DuDMVsnz.js +0 -24
  171. package/dist/chunks/google-address-Bmjp01pH.js +0 -181
  172. package/dist/chunks/hcaptcha-BTQ6An6g.js +0 -56
  173. package/dist/chunks/hidden-DbPdOxKb.js +0 -31
  174. package/dist/chunks/index-BEsfee-D.js +0 -1839
  175. package/dist/chunks/index-BP7Unm5Y.js +0 -863
  176. package/dist/chunks/index-BcqwpPNE.js +0 -4314
  177. package/dist/chunks/loqate-BdNGv93o.js +0 -55
  178. package/dist/chunks/mollie-DFOjTuGX.js +0 -24
  179. package/dist/chunks/moneris-BbFfl-EL.js +0 -101
  180. package/dist/chunks/opayo-CmgYa9ya.js +0 -122
  181. package/dist/chunks/paddle-BUi7w1_o.js +0 -60
  182. package/dist/chunks/paypal-A-ePfh6k.js +0 -100
  183. package/dist/chunks/payway-BqFCbhyo.js +0 -56
  184. package/dist/chunks/phone-country-DPMiqk4L.js +0 -3765
  185. package/dist/chunks/place-kit-CX7tamAg.js +0 -42
  186. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +0 -1299
  187. package/dist/chunks/recaptcha-enterprise-DxF6cW95.js +0 -71
  188. package/dist/chunks/recaptcha-shared-DhGcbiaq.js +0 -15
  189. package/dist/chunks/recaptcha-v2-checkbox-R9EfbZ4k.js +0 -41
  190. package/dist/chunks/recaptcha-v2-invisible-DV9hswAp.js +0 -59
  191. package/dist/chunks/recaptcha-v3-V0xc-Edh.js +0 -28
  192. package/dist/chunks/repeater-DKUT6TGI.js +0 -124
  193. package/dist/chunks/rich-text-SH7KiaKH.js +0 -304
  194. package/dist/chunks/scripts-D9N2d5rN.js +0 -36
  195. package/dist/chunks/sdk-3SicTWby.js +0 -1559
  196. package/dist/chunks/shared-BmntPmnW.js +0 -80
  197. package/dist/chunks/signature-BA3tQsGT.js +0 -550
  198. package/dist/chunks/snaptcha-DV7p6J9k.js +0 -8
  199. package/dist/chunks/square-Bs-ndqYK.js +0 -46
  200. package/dist/chunks/stripe-DkZAHxtn.js +0 -202
  201. package/dist/chunks/styles-C3aqgtek.js +0 -21
  202. package/dist/chunks/summary-Dq2i9TQk.js +0 -126
  203. package/dist/chunks/table-Cu4WfVcw.js +0 -95
  204. package/dist/chunks/text-limit-2ycmB-Ae.js +0 -135
  205. package/dist/chunks/turnstile-CId90tRr.js +0 -59
  206. package/dist/chunks/utils-BntI3W4S.js +0 -6149
@@ -1,1839 +0,0 @@
1
- function bt(c, p) {
2
- for (var y = 0; y < p.length; y++) {
3
- const u = p[y];
4
- if (typeof u != "string" && !Array.isArray(u)) {
5
- for (const w in u)
6
- if (w !== "default" && !(w in c)) {
7
- const x = Object.getOwnPropertyDescriptor(u, w);
8
- x && Object.defineProperty(c, w, x.get ? x : {
9
- enumerable: !0,
10
- get: () => u[w]
11
- });
12
- }
13
- }
14
- }
15
- return Object.freeze(Object.defineProperty(c, Symbol.toStringTag, { value: "Module" }));
16
- }
17
- function xt(c) {
18
- return Array.isArray(c) ? c.map((p) => String(p ?? "")) : [String(c ?? "")];
19
- }
20
- function We(c, p) {
21
- return c.some((y) => p.includes(y));
22
- }
23
- function He(c, p) {
24
- return c.some((y) => p.some((u) => u === y || u.includes(y)));
25
- }
26
- function Be(c, p, y) {
27
- return p.some((u) => c.some((w) => y(w, u)));
28
- }
29
- function Ge(c, p, y) {
30
- return p.some((u) => {
31
- const w = Number.parseFloat(u);
32
- return Number.isFinite(w) ? c.some((x) => {
33
- const T = Number.parseFloat(x);
34
- return Number.isFinite(T) ? y(T, w) : !1;
35
- }) : !1;
36
- });
37
- }
38
- function Ve(c) {
39
- return c.length === 0 || c.every((p) => p.trim() === "");
40
- }
41
- function Rt(c, p, y = {}) {
42
- const u = String(c.condition || ""), w = xt(c.value), x = y.visibility ?? null;
43
- switch (u) {
44
- case "=":
45
- return We(w, p);
46
- case "!=":
47
- return !We(w, p);
48
- case ">":
49
- return Ge(p, w, (T, h) => T > h);
50
- case "<":
51
- return Ge(p, w, (T, h) => T < h);
52
- case "contains":
53
- return He(w, p);
54
- case "notContains":
55
- return !He(w, p);
56
- case "startsWith":
57
- return Be(p, w, (T, h) => T.startsWith(h));
58
- case "endsWith":
59
- return Be(p, w, (T, h) => T.endsWith(h));
60
- case "empty":
61
- return Ve(p);
62
- case "notEmpty":
63
- return !Ve(p);
64
- case "visible":
65
- return x === !0;
66
- case "hidden":
67
- return x === !1;
68
- default:
69
- return !1;
70
- }
71
- }
72
- function jt(c, p) {
73
- const y = c.conditionRule === "any" ? p.includes(!0) : p.every((w) => w === !0), u = y && c.showRule !== "show" || !y && c.showRule === "show";
74
- return {
75
- finalResult: y,
76
- shouldHide: u
77
- };
78
- }
79
- var L = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
80
- function vt(c) {
81
- return c && c.__esModule && Object.prototype.hasOwnProperty.call(c, "default") ? c.default : c;
82
- }
83
- var ne = { exports: {} }, Ke = ne.exports, Je;
84
- function Nt() {
85
- return Je || (Je = 1, (function(c, p) {
86
- (function(y, u) {
87
- u(p);
88
- })(Ke, function(y) {
89
- function u(n, t, e) {
90
- return (t = (function(s) {
91
- var r = (function(i, a) {
92
- if (typeof i != "object" || !i) return i;
93
- var o = i[Symbol.toPrimitive];
94
- if (o !== void 0) {
95
- var l = o.call(i, a);
96
- if (typeof l != "object") return l;
97
- throw new TypeError("@@toPrimitive must return a primitive value.");
98
- }
99
- return (a === "string" ? String : Number)(i);
100
- })(s, "string");
101
- return typeof r == "symbol" ? r : r + "";
102
- })(t)) in n ? Object.defineProperty(n, t, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : n[t] = e, n;
103
- }
104
- const w = function(n, t) {
105
- if (n.length === 0) return t.length;
106
- if (t.length === 0) return n.length;
107
- let e, s, r = [];
108
- for (e = 0; e <= t.length; e++) r[e] = [e];
109
- for (s = 0; s <= n.length; s++) r[0] === void 0 && (r[0] = []), r[0][s] = s;
110
- for (e = 1; e <= t.length; e++) for (s = 1; s <= n.length; s++) t.charAt(e - 1) === n.charAt(s - 1) ? r[e][s] = r[e - 1][s - 1] : r[e][s] = Math.min(r[e - 1][s - 1] + 1, Math.min(r[e][s - 1] + 1, r[e - 1][s] + 1));
111
- return r[t.length] === void 0 && (r[t.length] = []), r[t.length][n.length];
112
- };
113
- class x extends Error {
114
- constructor(t, e, s, r, i) {
115
- super(t), this.name = "SyntaxError", this.cursor = e, this.expression = s, this.subject = r, this.proposals = i;
116
- }
117
- toString() {
118
- let t = `${this.name}: ${this.message} around position ${this.cursor}`;
119
- if (this.expression && (t += ` for expression \`${this.expression}\``), t += ".", this.subject && this.proposals) {
120
- let e = Number.MAX_SAFE_INTEGER, s = null;
121
- for (let r of this.proposals) {
122
- let i = w(this.subject, r);
123
- i < e && (s = r, e = i);
124
- }
125
- s !== null && e < 3 && (t += ` Did you mean "${s}"?`);
126
- }
127
- return t;
128
- }
129
- }
130
- class T {
131
- constructor(t, e) {
132
- u(this, "next", () => {
133
- if (this.position += 1, this.tokens[this.position] === void 0) throw new x("Unexpected end of expression", this.last.cursor, this.expression);
134
- }), u(this, "expect", (s, r, i) => {
135
- let a = this.current;
136
- if (!a.test(s, r)) {
137
- let o = "";
138
- i && (o = i + ". ");
139
- let l = "";
140
- throw r && (l = ` with value "${r}"`), o += `Unexpected token "${a.type}" of value "${a.value}" ("${s}" expected${l})`, new x(o, a.cursor, this.expression);
141
- }
142
- this.next();
143
- }), u(this, "isEOF", () => h.EOF_TYPE === this.current.type), u(this, "isEqualTo", (s) => {
144
- if (s == null || !s instanceof T || s.tokens.length !== this.tokens.length) return !1;
145
- let r = s.position;
146
- s.position = 0;
147
- let i = !0;
148
- for (let a of this.tokens) {
149
- if (!s.current.isEqualTo(a)) {
150
- i = !1;
151
- break;
152
- }
153
- s.position < s.tokens.length - 1 && s.next();
154
- }
155
- return s.position = r, i;
156
- }), u(this, "diff", (s) => {
157
- let r = [];
158
- if (!this.isEqualTo(s)) {
159
- let i = 0, a = s.position;
160
- s.position = 0;
161
- for (let o of this.tokens) {
162
- let l = o.diff(s.current);
163
- l.length > 0 && r.push({ index: i, diff: l }), s.position < s.tokens.length - 1 && s.next();
164
- }
165
- s.position = a;
166
- }
167
- return r;
168
- }), this.expression = t, this.position = 0, this.tokens = e;
169
- }
170
- get current() {
171
- return this.tokens[this.position];
172
- }
173
- get last() {
174
- return this.tokens[this.position - 1];
175
- }
176
- toString() {
177
- return this.tokens.join(`
178
- `);
179
- }
180
- }
181
- class h {
182
- constructor(t, e, s) {
183
- u(this, "test", (r, i = null) => this.type === r && (i === null || this.value === i)), u(this, "isEqualTo", (r) => !(r == null || !r instanceof h) && r.value == this.value && r.type === this.type && r.cursor === this.cursor), u(this, "diff", (r) => {
184
- let i = [];
185
- return this.isEqualTo(r) || (r.value !== this.value && i.push(`Value: ${r.value} != ${this.value}`), r.cursor !== this.cursor && i.push(`Cursor: ${r.cursor} != ${this.cursor}`), r.type !== this.type && i.push(`Type: ${r.type} != ${this.type}`)), i;
186
- }), this.value = e, this.type = t, this.cursor = s;
187
- }
188
- toString() {
189
- return `${this.cursor} [${this.type}] ${this.value}`;
190
- }
191
- }
192
- function pe(n) {
193
- let t = 0, e = [], s = [], r = (n = n.replace(/\r|\n|\t|\v|\f/g, " ")).length;
194
- for (; t < r; ) {
195
- if (n[t] === " ") {
196
- ++t;
197
- continue;
198
- }
199
- if (n.substr(t, 2) === "/*") {
200
- const a = n.indexOf("*/", t + 2);
201
- if (a === -1) {
202
- t = r;
203
- break;
204
- }
205
- t = a + 2;
206
- continue;
207
- }
208
- let i = tt(n.substr(t));
209
- if (i !== null) {
210
- const a = i.length, o = i.replace(/_/g, "");
211
- i = o.indexOf(".") === -1 && o.indexOf("e") === -1 && o.indexOf("E") === -1 ? parseInt(o, 10) : parseFloat(o), e.push(new h(h.NUMBER_TYPE, i, t + 1)), t += a;
212
- } else if ("([{".indexOf(n[t]) >= 0) s.push([n[t], t]), e.push(new h(h.PUNCTUATION_TYPE, n[t], t + 1)), ++t;
213
- else if (")]}".indexOf(n[t]) >= 0) {
214
- if (s.length === 0) throw new x(`Unexpected "${n[t]}"`, t, n);
215
- let [a, o] = s.pop(), l = a.replace("(", ")").replace("{", "}").replace("[", "]");
216
- if (n[t] !== l) throw new x(`Unclosed "${a}"`, o, n);
217
- e.push(new h(h.PUNCTUATION_TYPE, n[t], t + 1)), ++t;
218
- } else {
219
- let a = rt(n.substr(t));
220
- if (a !== null) e.push(new h(h.STRING_TYPE, a.captured, t + 1)), t += a.length;
221
- else if (n.substr(t, 2) === "\\\\") e.push(new h(h.PUNCTUATION_TYPE, "\\", t + 1)), t += 2;
222
- else {
223
- const o = e.length > 0 ? e[e.length - 1] : null;
224
- if (o && o.type === h.PUNCTUATION_TYPE && (o.value === "." || o.value === "?.")) {
225
- let l = ye(n.substr(t));
226
- if (l) e.push(new h(h.NAME_TYPE, l, t + 1)), t += l.length;
227
- else {
228
- let d = ge(n.substr(t));
229
- if (d) e.push(new h(h.OPERATOR_TYPE, d, t + 1)), t += d.length;
230
- else if (n.substr(t, 2) === "?." || n.substr(t, 2) === "??") e.push(new h(h.PUNCTUATION_TYPE, n.substr(t, 2), t + 1)), t += 2;
231
- else {
232
- if (!(".,?:".indexOf(n[t]) >= 0)) throw new x(`Unexpected character "${n[t]}"`, t, n);
233
- e.push(new h(h.PUNCTUATION_TYPE, n[t], t + 1)), ++t;
234
- }
235
- }
236
- } else {
237
- let l = ge(n.substr(t));
238
- if (l) e.push(new h(h.OPERATOR_TYPE, l, t + 1)), t += l.length;
239
- else if (n.substr(t, 2) === "?." || n.substr(t, 2) === "??") e.push(new h(h.PUNCTUATION_TYPE, n.substr(t, 2), t + 1)), t += 2;
240
- else if (".,?:".indexOf(n[t]) >= 0) e.push(new h(h.PUNCTUATION_TYPE, n[t], t + 1)), ++t;
241
- else {
242
- let d = ye(n.substr(t));
243
- if (!d) throw new x(`Unexpected character "${n[t]}"`, t, n);
244
- e.push(new h(h.NAME_TYPE, d, t + 1)), t += d.length;
245
- }
246
- }
247
- }
248
- }
249
- }
250
- if (e.push(new h(h.EOF_TYPE, null, t + 1)), s.length > 0) {
251
- let [i, a] = s.pop();
252
- throw new x(`Unclosed "${i}"`, a, n);
253
- }
254
- return new T(n, e);
255
- }
256
- function tt(n) {
257
- let t = null, e = n.match(/^(?:((?:\d(?:_?\d)*)\.(?:\d(?:_?\d)*)|\.(?:\d(?:_?\d)*)|(?:\d(?:_?\d)*))(?:[eE][+-]?\d(?:_?\d)*)?)/);
258
- return e && e.length > 0 && (t = e[0]), t;
259
- }
260
- u(h, "EOF_TYPE", "end of expression"), u(h, "NAME_TYPE", "name"), u(h, "NUMBER_TYPE", "number"), u(h, "STRING_TYPE", "string"), u(h, "OPERATOR_TYPE", "operator"), u(h, "PUNCTUATION_TYPE", "punctuation");
261
- const st = /^"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/s;
262
- function me(n, t) {
263
- return t === '"' ? n = n.replace(/\\\"/g, '"') : t === "'" && (n = n.replace(/\\'/g, "'")), n = n.replace(/\\\\/g, "\\");
264
- }
265
- function rt(n) {
266
- let t = null;
267
- if (["'", '"'].indexOf(n.substr(0, 1)) === -1) return t;
268
- let e = st.exec(n);
269
- return e !== null && e.length > 0 && (t = e[1] !== void 0 ? { captured: me(e[1], '"') } : { captured: me(e[2], "'") }, t.length = e[0].length), t;
270
- }
271
- const nt = ["&&", "and", "||", "or", "+", "-", "**", "*", "/", "%", "&", "|", "^", ">>", "<<", "===", "!==", "!=", "==", "<=", ">=", "<", ">", "contains", "matches", "starts with", "ends with", "not in", "in", "not", "!", "xor", "~", ".."], it = ["and", "or", "matches", "contains", "starts with", "ends with", "not in", "in", "not", "xor"];
272
- function ge(n) {
273
- let t = null;
274
- for (let e of nt) if (n.substr(0, e.length) === e) {
275
- it.indexOf(e) >= 0 ? n.substr(0, e.length + 1) === e + " " && (t = e) : t = e;
276
- break;
277
- }
278
- return t;
279
- }
280
- function ye(n) {
281
- let t = null, e = n.match(/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/);
282
- return e && e.length > 0 && (t = e[0]), t;
283
- }
284
- function at(n) {
285
- return /boolean|number|string/.test(typeof n);
286
- }
287
- function we(n, t) {
288
- var e = "", s = [], r = 0, i = 0, a = "", o = "", l = "", d = "", f = "", g = 0, b = 0, $ = 0, D = 0, De = 0, se = [], fe = "", Me = /%([\dA-Fa-f]+)/g, Fe = function(re, ze) {
289
- return (re += "").length < ze ? new Array(++ze - re.length).join("0") + re : re;
290
- };
291
- for (r = 0; r < t.length; r++) if (a = t.charAt(r), o = t.charAt(r + 1), a === "\\" && o && /\d/.test(o)) {
292
- if (D = r + ($ = (l = t.slice(r + 1).match(/^\d+/)[0]).length) + 1, t.charAt(D) + t.charAt(D + 1) === "..") {
293
- if (g = l.charCodeAt(0), /\\\d/.test(t.charAt(D + 2) + t.charAt(D + 3))) d = t.slice(D + 3).match(/^\d+/)[0], r += 1;
294
- else {
295
- if (!t.charAt(D + 2)) throw new Error("Range with no end point");
296
- d = t.charAt(D + 2);
297
- }
298
- if ((b = d.charCodeAt(0)) > g) for (i = g; i <= b; i++) s.push(String.fromCharCode(i));
299
- else s.push(".", l, d);
300
- r += d.length + 2;
301
- } else f = String.fromCharCode(parseInt(l, 8)), s.push(f);
302
- r += $;
303
- } else if (o + t.charAt(r + 2) === "..") {
304
- if (g = (l = a).charCodeAt(0), /\\\d/.test(t.charAt(r + 3) + t.charAt(r + 4))) d = t.slice(r + 4).match(/^\d+/)[0], r += 1;
305
- else {
306
- if (!t.charAt(r + 3)) throw new Error("Range with no end point");
307
- d = t.charAt(r + 3);
308
- }
309
- if ((b = d.charCodeAt(0)) > g) for (i = g; i <= b; i++) s.push(String.fromCharCode(i));
310
- else s.push(".", l, d);
311
- r += d.length + 2;
312
- } else s.push(a);
313
- for (r = 0; r < n.length; r++) if (a = n.charAt(r), s.indexOf(a) !== -1) if (e += "\\", (De = a.charCodeAt(0)) < 32 || De > 126) switch (a) {
314
- case `
315
- `:
316
- e += "n";
317
- break;
318
- case " ":
319
- e += "t";
320
- break;
321
- case "\r":
322
- e += "r";
323
- break;
324
- case "\x07":
325
- e += "a";
326
- break;
327
- case "\v":
328
- e += "v";
329
- break;
330
- case "\b":
331
- e += "b";
332
- break;
333
- case "\f":
334
- e += "f";
335
- break;
336
- default:
337
- for (fe = encodeURIComponent(a), (se = Me.exec(fe)) !== null && (e += Fe(parseInt(se[1], 16).toString(8), 3)); (se = Me.exec(fe)) !== null; ) e += "\\" + Fe(parseInt(se[1], 16).toString(8), 3);
338
- }
339
- else e += a;
340
- else e += a;
341
- return e;
342
- }
343
- class A {
344
- constructor(t = {}, e = {}) {
345
- u(this, "compile", (s) => {
346
- for (let r of Object.values(this.nodes)) r.compile(s);
347
- }), u(this, "evaluate", (s, r) => {
348
- let i = [];
349
- for (let a of Object.values(this.nodes)) i.push(a.evaluate(s, r));
350
- return i;
351
- }), u(this, "toArray", () => {
352
- throw new Error(`Dumping a "${this.name}" instance is not supported yet.`);
353
- }), u(this, "dump", () => {
354
- let s = "";
355
- for (let r of this.toArray()) s += at(r) ? r : r.dump();
356
- return s;
357
- }), u(this, "dumpString", (s) => `"${we(s, '\0 "\\')}"`), u(this, "isHash", (s) => {
358
- let r = 0;
359
- for (let i of Object.keys(s)) if (i = parseInt(i), i !== r++) return !0;
360
- return !1;
361
- }), this.name = "Node", this.nodes = t, this.attributes = e;
362
- }
363
- toString() {
364
- let t = [];
365
- for (let s of Object.keys(this.attributes)) {
366
- let r = "null";
367
- this.attributes[s] && (r = this.attributes[s].toString()), t.push(`${s}: '${r}'`);
368
- }
369
- let e = [this.name + "(" + t.join(", ")];
370
- if (this.nodes.length > 0) {
371
- for (let s of Object.values(this.nodes)) {
372
- let r = s.toString().split(`
373
- `);
374
- for (let i of r) e.push(" " + i);
375
- }
376
- e.push(")");
377
- } else e[0] += ")";
378
- return e.join(`
379
- `);
380
- }
381
- }
382
- class S extends A {
383
- constructor(t, e, s) {
384
- super({ left: e, right: s }, { operator: t }), u(this, "compile", (r) => {
385
- let i = this.attributes.operator;
386
- i !== "matches" ? i !== "contains" ? i !== "starts with" ? i !== "ends with" ? S.functions[i] === void 0 ? (S.operators[i] !== void 0 && (i = S.operators[i]), r.raw("(").compile(this.nodes.left).raw(" ").raw(i).raw(" ").compile(this.nodes.right).raw(")")) : r.raw(`${S.functions[i]}(`).compile(this.nodes.left).raw(", ").compile(this.nodes.right).raw(")") : r.raw("(").compile(this.nodes.left).raw(".toString().toLowerCase().endsWith(").compile(this.nodes.right).raw(".toString().toLowerCase())") : r.raw("(").compile(this.nodes.left).raw(".toString().toLowerCase().startsWith(").compile(this.nodes.right).raw(".toString().toLowerCase())") : r.raw("(").compile(this.nodes.left).raw(".toString().toLowerCase().includes(").compile(this.nodes.right).raw(".toString().toLowerCase())") : r.compile(this.nodes.right).raw(".test(").compile(this.nodes.left).raw(")");
387
- }), u(this, "evaluate", (r, i) => {
388
- let a = this.attributes.operator, o = this.nodes.left.evaluate(r, i);
389
- if (S.functions[a] !== void 0) {
390
- let d = this.nodes.right.evaluate(r, i);
391
- switch (a) {
392
- case "not in":
393
- return d.indexOf(o) === -1;
394
- case "in":
395
- return d.indexOf(o) >= 0;
396
- case "..":
397
- return (function(f, g) {
398
- let b = [];
399
- for (let $ = f; $ <= g; $++) b.push($);
400
- return b;
401
- })(o, d);
402
- case "**":
403
- return Math.pow(o, d);
404
- }
405
- }
406
- let l = null;
407
- switch (a) {
408
- case "or":
409
- case "||":
410
- return o || (l = this.nodes.right.evaluate(r, i)), o || l;
411
- case "and":
412
- case "&&":
413
- return o && (l = this.nodes.right.evaluate(r, i)), o && l;
414
- case "xor":
415
- return l = this.nodes.right.evaluate(r, i), l && !o || o && !l;
416
- case "<<":
417
- return l = this.nodes.right.evaluate(r, i), o << l;
418
- case ">>":
419
- return l = this.nodes.right.evaluate(r, i), o >> l;
420
- }
421
- switch (l = this.nodes.right.evaluate(r, i), a) {
422
- case "|":
423
- return o | l;
424
- case "^":
425
- return o ^ l;
426
- case "&":
427
- return o & l;
428
- case "==":
429
- return o == l;
430
- case "===":
431
- return o === l;
432
- case "!=":
433
- return o != l;
434
- case "!==":
435
- return o !== l;
436
- case "<":
437
- return o < l;
438
- case ">":
439
- return o > l;
440
- case ">=":
441
- return o >= l;
442
- case "<=":
443
- return o <= l;
444
- case "not in":
445
- return l.indexOf(o) === -1;
446
- case "in":
447
- return l.indexOf(o) >= 0;
448
- case "+":
449
- return o + l;
450
- case "-":
451
- return o - l;
452
- case "~":
453
- return o.toString() + l.toString();
454
- case "*":
455
- return o * l;
456
- case "/":
457
- return o / l;
458
- case "%":
459
- return o % l;
460
- case "matches":
461
- if (o == null) return !1;
462
- let d = l.match(S.regex_expression);
463
- return new RegExp(d[1], d[2]).test(o);
464
- case "contains":
465
- return o.toString().toLowerCase().includes(l.toString().toLowerCase());
466
- case "starts with":
467
- return o.toString().toLowerCase().startsWith(l.toString().toLowerCase());
468
- case "ends with":
469
- return o.toString().toLowerCase().endsWith(l.toString().toLowerCase());
470
- }
471
- }), u(this, "toArray", () => ["(", this.nodes.left, " " + this.attributes.operator + " ", this.nodes.right, ")"]), this.name = "BinaryNode";
472
- }
473
- }
474
- u(S, "regex_expression", /\/(.+)\/(.*)/), u(S, "operators", { "~": ".", and: "&&", or: "||", xor: "xor", "<<": "<<", ">>": ">>" }), u(S, "functions", { "**": "Math.pow", "..": "range", in: "includes", "not in": "!includes" });
475
- class V extends A {
476
- constructor(t, e) {
477
- super({ node: e }, { operator: t }), u(this, "compile", (s) => {
478
- s.raw("(").raw(V.operators[this.attributes.operator]).compile(this.nodes.node).raw(")");
479
- }), u(this, "evaluate", (s, r) => {
480
- let i = this.nodes.node.evaluate(s, r);
481
- switch (this.attributes.operator) {
482
- case "not":
483
- case "!":
484
- return !i;
485
- case "-":
486
- return -i;
487
- case "~":
488
- return ~i;
489
- }
490
- return i;
491
- }), u(this, "toArray", () => ["(", this.attributes.operator + " ", this.nodes.node, ")"]), this.name = "UnaryNode";
492
- }
493
- }
494
- u(V, "operators", { "!": "!", not: "!", "+": "+", "-": "-", "~": "~" });
495
- class k extends A {
496
- constructor(t, e = !1, s = !1) {
497
- super({}, { value: t }), u(this, "compile", (r) => {
498
- r.repr(this.attributes.value, this.isIdentifier);
499
- }), u(this, "evaluate", (r, i) => this.attributes.value), u(this, "toArray", () => {
500
- let r = [], i = this.attributes.value;
501
- if (this.isIdentifier) r.push(i);
502
- else if (i === !0) r.push("true");
503
- else if (i === !1) r.push("false");
504
- else if (i === null) r.push("null");
505
- else if (typeof i == "number") r.push(i);
506
- else if (typeof i == "string") r.push(this.dumpString(i));
507
- else if (Array.isArray(i)) {
508
- for (let a of i) r.push(","), r.push(new k(a));
509
- r[0] = "[", r.push("]");
510
- } else if (this.isHash(i)) {
511
- for (let a of Object.keys(i)) r.push(", "), r.push(new k(a)), r.push(": "), r.push(new k(i[a]));
512
- r[0] = "{", r.push("}");
513
- }
514
- return r;
515
- }), this.isIdentifier = e, this.isNullSafe = s, this.name = "ConstantNode";
516
- }
517
- }
518
- class ie extends A {
519
- constructor(t, e, s) {
520
- super({ expr1: t, expr2: e, expr3: s }), u(this, "compile", (r) => {
521
- r.raw("((").compile(this.nodes.expr1).raw(") ? (").compile(this.nodes.expr2).raw(") : (").compile(this.nodes.expr3).raw("))");
522
- }), u(this, "evaluate", (r, i) => this.nodes.expr1.evaluate(r, i) ? this.nodes.expr2.evaluate(r, i) : this.nodes.expr3.evaluate(r, i)), u(this, "toArray", () => ["(", this.nodes.expr1, " ? ", this.nodes.expr2, " : ", this.nodes.expr3, ")"]), this.name = "ConditionalNode";
523
- }
524
- }
525
- class be extends A {
526
- constructor(t, e) {
527
- super({ fnArguments: e }, { name: t }), u(this, "compile", (s) => {
528
- let r = [];
529
- for (let a of Object.values(this.nodes.fnArguments.nodes)) r.push(s.subcompile(a));
530
- let i = s.getFunction(this.attributes.name);
531
- s.raw(i.compiler.apply(null, r));
532
- }), u(this, "evaluate", (s, r) => {
533
- let i = [r];
534
- for (let a of Object.values(this.nodes.fnArguments.nodes)) i.push(a.evaluate(s, r));
535
- return s[this.attributes.name].evaluator.apply(null, i);
536
- }), u(this, "toArray", () => {
537
- let s = [];
538
- s.push(this.attributes.name);
539
- for (let r of Object.values(this.nodes.fnArguments.nodes)) s.push(", "), s.push(r);
540
- return s[1] = "(", s.push(")"), s;
541
- }), this.name = "FunctionNode";
542
- }
543
- }
544
- class xe extends A {
545
- constructor(t) {
546
- super({}, { name: t }), u(this, "compile", (e) => {
547
- e.raw(this.attributes.name);
548
- }), u(this, "evaluate", (e, s) => s[this.attributes.name]), u(this, "toArray", () => [this.attributes.name]), this.name = "NameNode";
549
- }
550
- }
551
- class ee extends A {
552
- constructor() {
553
- super(), u(this, "addElement", (t, e = null) => {
554
- e === null ? e = new k(++this.index) : this.type === "Array" && (this.type = "Object"), this.nodes[(++this.keyIndex).toString()] = e, this.nodes[(++this.keyIndex).toString()] = t;
555
- }), u(this, "compile", (t) => {
556
- this.type === "Object" ? t.raw("{") : t.raw("["), this.compileArguments(t, this.type !== "Array"), this.type === "Object" ? t.raw("}") : t.raw("]");
557
- }), u(this, "evaluate", (t, e) => {
558
- let s;
559
- if (this.type === "Array") {
560
- s = [];
561
- for (let r of this.getKeyValuePairs()) s.push(r.value.evaluate(t, e));
562
- } else {
563
- s = {};
564
- for (let r of this.getKeyValuePairs()) s[r.key.evaluate(t, e)] = r.value.evaluate(t, e);
565
- }
566
- return s;
567
- }), u(this, "toArray", () => {
568
- let t = {};
569
- for (let s of this.getKeyValuePairs()) t[s.key.attributes.value] = s.value;
570
- let e = [];
571
- if (this.isHash(t)) {
572
- for (let s of Object.keys(t)) e.push(", "), e.push(new k(s)), e.push(": "), e.push(t[s]);
573
- e[0] = "{", e.push("}");
574
- } else {
575
- for (let s of Object.values(t)) e.push(", "), e.push(s);
576
- e[0] = "[", e.push("]");
577
- }
578
- return e;
579
- }), u(this, "getKeyValuePairs", () => {
580
- let t, e, s, r = [], i = Object.values(this.nodes);
581
- for (t = 0, e = i.length; t < e; t += 2) s = i.slice(t, t + 2), r.push({ key: s[0], value: s[1] });
582
- return r;
583
- }), u(this, "compileArguments", (t, e = !0) => {
584
- let s = !0;
585
- for (let r of this.getKeyValuePairs()) s || t.raw(", "), s = !1, e && t.compile(r.key).raw(": "), t.compile(r.value);
586
- }), this.name = "ArrayNode", this.type = "Array", this.index = -1, this.keyIndex = -1;
587
- }
588
- }
589
- class ae extends ee {
590
- constructor() {
591
- super(), u(this, "compile", (t) => {
592
- this.compileArguments(t, !1);
593
- }), u(this, "toArray", () => {
594
- let t = [];
595
- for (let e of this.getKeyValuePairs()) t.push(e.value), t.push(", ");
596
- return t.pop(), t;
597
- }), this.name = "ArgumentsNode";
598
- }
599
- }
600
- class v extends A {
601
- constructor(t, e, s, r) {
602
- super({ node: t, attribute: e, fnArguments: s }, { type: r, is_null_coalesce: !1, is_short_circuited: !1 }), u(this, "compile", (i) => {
603
- const a = this.nodes.attribute instanceof k && this.nodes.attribute.isNullSafe;
604
- switch (this.attributes.type) {
605
- case v.PROPERTY_CALL:
606
- i.compile(this.nodes.node).raw(a ? "?." : ".").raw(this.nodes.attribute.attributes.value);
607
- break;
608
- case v.METHOD_CALL:
609
- i.compile(this.nodes.node).raw(a ? "?." : ".").raw(this.nodes.attribute.attributes.value).raw("(").compile(this.nodes.fnArguments).raw(")");
610
- break;
611
- case v.ARRAY_CALL:
612
- i.compile(this.nodes.node).raw("[").compile(this.nodes.attribute).raw("]");
613
- }
614
- }), u(this, "evaluate", (i, a) => {
615
- switch (this.attributes.type) {
616
- case v.PROPERTY_CALL:
617
- let o = this.nodes.node.evaluate(i, a);
618
- if (o === null && (this.nodes.attribute.isNullSafe || this.attributes.is_null_coalesce)) return this.attributes.is_short_circuited = !0, null;
619
- if (o === null && this.isShortCircuited()) return null;
620
- if (typeof o != "object") throw new Error(`Unable to get property "${l}" on a non-object: ` + typeof o);
621
- let l = this.nodes.attribute.attributes.value;
622
- return this.attributes.is_null_coalesce ? o[l] ?? null : o[l];
623
- case v.METHOD_CALL:
624
- let d = this.nodes.node.evaluate(i, a);
625
- if (d === null && this.nodes.attribute.isNullSafe) return this.attributes.is_short_circuited = !0, null;
626
- if (d === null && this.isShortCircuited()) return null;
627
- let f = this.nodes.attribute.attributes.value;
628
- if (typeof d != "object") throw new Error(`Unable to call method "${f}" on a non-object: ` + typeof d);
629
- if (d[f] === void 0) throw new Error(`Method "${f}" is undefined on object.`);
630
- if (typeof d[f] != "function") throw new Error(`Method "${f}" is not a function on object.`);
631
- let g = this.nodes.fnArguments.evaluate(i, a);
632
- return d[f].apply(null, g);
633
- case v.ARRAY_CALL:
634
- let b = this.nodes.node.evaluate(i, a);
635
- if (b === null && this.isShortCircuited()) return null;
636
- if (!(Array.isArray(b) || typeof b == "object" || b === null && this.attributes.is_null_coalesce)) throw new Error("Unable to get an item on a non-array: " + typeof b);
637
- return this.attributes.is_null_coalesce ? b ? b[this.nodes.attribute.evaluate(i, a)] ?? null : null : b[this.nodes.attribute.evaluate(i, a)];
638
- }
639
- }), u(this, "toArray", () => {
640
- const i = this.nodes.attribute instanceof k && this.nodes.attribute.isNullSafe;
641
- switch (this.attributes.type) {
642
- case v.PROPERTY_CALL:
643
- return [this.nodes.node, i ? "?." : ".", this.nodes.attribute];
644
- case v.METHOD_CALL:
645
- return [this.nodes.node, i ? "?." : ".", this.nodes.attribute, "(", this.nodes.fnArguments, ")"];
646
- case v.ARRAY_CALL:
647
- return [this.nodes.node, "[", this.nodes.attribute, "]"];
648
- }
649
- }), this.name = "GetAttrNode";
650
- }
651
- isShortCircuited() {
652
- return this.attributes.is_short_circuited || this.nodes.node instanceof v && this.nodes.node.isShortCircuited();
653
- }
654
- }
655
- u(v, "PROPERTY_CALL", 1), u(v, "METHOD_CALL", 2), u(v, "ARRAY_CALL", 3);
656
- class ve extends A {
657
- constructor(t, e) {
658
- super({ expr1: t, expr2: e }), u(this, "compile", (s) => {
659
- s.raw("((").compile(this.nodes.expr1).raw(") ?? (").compile(this.nodes.expr2).raw("))");
660
- }), u(this, "evaluate", (s, r) => (this.nodes.expr1 instanceof v && this._addNullCoalesceAttributeToGetAttrNodes(this.nodes.expr1), this.nodes.expr1.evaluate(s, r) ?? this.nodes.expr2.evaluate(s, r))), u(this, "toArray", () => ["(", this.nodes.expr1, ") ?? (", this.nodes.expr2, ")"]), u(this, "_addNullCoalesceAttributeToGetAttrNodes", (s) => {
661
- if (!(!s instanceof v)) {
662
- s.attributes.is_null_coalesce = !0;
663
- for (let r of Object.values(s.nodes)) this._addNullCoalesceAttributeToGetAttrNodes(r);
664
- }
665
- }), this.name = "NullCoalesceNode";
666
- }
667
- }
668
- class Ne extends A {
669
- constructor(t) {
670
- super({}, { name: t }), u(this, "compile", (e) => {
671
- e.raw(this.attributes.name + " ?? null");
672
- }), u(this, "evaluate", (e, s) => null), u(this, "toArray", () => [this.attributes.name + " ?? null"]), this.name = "NullCoalescedNameNode";
673
- }
674
- }
675
- class ke {
676
- constructor(t = {}) {
677
- u(this, "functions", {}), u(this, "unaryOperators", { not: { precedence: 50 }, "!": { precedence: 50 }, "-": { precedence: 500 }, "+": { precedence: 500 }, "~": { precedence: 500 } }), u(this, "binaryOperators", { or: { precedence: 10, associativity: 1 }, "||": { precedence: 10, associativity: 1 }, xor: { precedence: 12, associativity: 1 }, and: { precedence: 15, associativity: 1 }, "&&": { precedence: 15, associativity: 1 }, "|": { precedence: 16, associativity: 1 }, "^": { precedence: 17, associativity: 1 }, "&": { precedence: 18, associativity: 1 }, "==": { precedence: 20, associativity: 1 }, "===": { precedence: 20, associativity: 1 }, "!=": { precedence: 20, associativity: 1 }, "!==": { precedence: 20, associativity: 1 }, "<": { precedence: 20, associativity: 1 }, ">": { precedence: 20, associativity: 1 }, ">=": { precedence: 20, associativity: 1 }, "<=": { precedence: 20, associativity: 1 }, "not in": { precedence: 20, associativity: 1 }, in: { precedence: 20, associativity: 1 }, matches: { precedence: 20, associativity: 1 }, contains: { precedence: 20, associativity: 1 }, "starts with": { precedence: 20, associativity: 1 }, "ends with": { precedence: 20, associativity: 1 }, "..": { precedence: 25, associativity: 1 }, "<<": { precedence: 25, associativity: 1 }, ">>": { precedence: 25, associativity: 1 }, "+": { precedence: 30, associativity: 1 }, "-": { precedence: 30, associativity: 1 }, "~": { precedence: 40, associativity: 1 }, "*": { precedence: 60, associativity: 1 }, "/": { precedence: 60, associativity: 1 }, "%": { precedence: 60, associativity: 1 }, "**": { precedence: 200, associativity: 2 } }), u(this, "parse", (e, s = [], r = 0) => {
678
- this.tokenStream = e, this.names = s, this.objectMatches = {}, this.cachedNames = null, this.nestedExecutions = 0, this.flags = r;
679
- let i = this.parseExpression();
680
- if (!this.tokenStream.isEOF()) throw new x(`Unexpected token "${this.tokenStream.current.type}" of value "${this.tokenStream.current.value}"`, this.tokenStream.current.cursor, this.tokenStream.expression);
681
- return i;
682
- }), u(this, "lint", (e, s = [], r = 0) => {
683
- s === null && (console.log('Deprecated: passing "null" as the second argument of lint is deprecated, pass IGNORE_UNKNOWN_VARIABLES instead as the third argument'), r |= 1, s = []), this.parse(e, s, r);
684
- }), u(this, "parseExpression", (e = 0) => {
685
- let s = this.getPrimary(), r = this.tokenStream.current;
686
- if (this.nestedExecutions++, this.nestedExecutions > 1e3) throw new Error("Way to many executions on '" + r.toString() + "' of '" + this.tokenStream.toString() + "'");
687
- for (; r.test(h.OPERATOR_TYPE) && this.binaryOperators[r.value] !== void 0 && this.binaryOperators[r.value] !== null && this.binaryOperators[r.value].precedence >= e; ) {
688
- let i = this.binaryOperators[r.value];
689
- this.tokenStream.next();
690
- let a = this.parseExpression(i.associativity === 1 ? i.precedence + 1 : i.precedence);
691
- s = new S(r.value, s, a), r = this.tokenStream.current;
692
- }
693
- return e === 0 ? this.parseConditionalExpression(s) : s;
694
- }), u(this, "getPrimary", () => {
695
- let e = this.tokenStream.current;
696
- if (e.test(h.OPERATOR_TYPE) && this.unaryOperators[e.value] !== void 0 && this.unaryOperators[e.value] !== null) {
697
- let s = this.unaryOperators[e.value];
698
- this.tokenStream.next();
699
- let r = this.parseExpression(s.precedence);
700
- return this.parsePostfixExpression(new V(e.value, r));
701
- }
702
- if (e.test(h.PUNCTUATION_TYPE, "(")) {
703
- this.tokenStream.next();
704
- let s = this.parseExpression();
705
- return this.tokenStream.expect(h.PUNCTUATION_TYPE, ")", "An opened parenthesis is not properly closed"), this.parsePostfixExpression(s);
706
- }
707
- return this.parsePrimaryExpression();
708
- }), u(this, "hasVariable", (e) => this.getNames().indexOf(e) >= 0), u(this, "getNames", () => {
709
- if (this.cachedNames !== null) return this.cachedNames;
710
- if (this.names && this.names.length > 0) {
711
- let e = [], s = 0;
712
- this.objectMatches = {};
713
- for (let r of this.names) typeof r == "object" ? (this.objectMatches[Object.values(r)[0]] = s, e.push(Object.keys(r)[0]), e.push(Object.values(r)[0])) : e.push(r), s++;
714
- return this.cachedNames = e, e;
715
- }
716
- return [];
717
- }), u(this, "parseArrayExpression", () => {
718
- this.tokenStream.expect(h.PUNCTUATION_TYPE, "[", "An array element was expected");
719
- let e = new ee(), s = !0;
720
- for (; !this.tokenStream.current.test(h.PUNCTUATION_TYPE, "]") && (s || (this.tokenStream.expect(h.PUNCTUATION_TYPE, ",", "An array element must be followed by a comma"), !this.tokenStream.current.test(h.PUNCTUATION_TYPE, "]"))); ) s = !1, e.addElement(this.parseExpression());
721
- return this.tokenStream.expect(h.PUNCTUATION_TYPE, "]", "An opened array is not properly closed"), e;
722
- }), u(this, "parseHashExpression", () => {
723
- this.tokenStream.expect(h.PUNCTUATION_TYPE, "{", "A hash element was expected");
724
- let e = new ee(), s = !0;
725
- for (; !this.tokenStream.current.test(h.PUNCTUATION_TYPE, "}") && (s || (this.tokenStream.expect(h.PUNCTUATION_TYPE, ",", "A hash value must be followed by a comma"), !this.tokenStream.current.test(h.PUNCTUATION_TYPE, "}"))); ) {
726
- s = !1;
727
- let r = null;
728
- if (this.tokenStream.current.test(h.STRING_TYPE) || this.tokenStream.current.test(h.NAME_TYPE) || this.tokenStream.current.test(h.NUMBER_TYPE)) r = new k(this.tokenStream.current.value), this.tokenStream.next();
729
- else {
730
- if (!this.tokenStream.current.test(h.PUNCTUATION_TYPE, "(")) {
731
- let a = this.tokenStream.current;
732
- throw new x(`A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "${a.type}" of value "${a.value}"`, a.cursor, this.tokenStream.expression);
733
- }
734
- r = this.parseExpression();
735
- }
736
- this.tokenStream.expect(h.PUNCTUATION_TYPE, ":", "A hash key must be followed by a colon (:)");
737
- let i = this.parseExpression();
738
- e.addElement(i, r);
739
- }
740
- return this.tokenStream.expect(h.PUNCTUATION_TYPE, "}", "An opened hash is not properly closed"), e;
741
- }), u(this, "parsePostfixExpression", (e) => {
742
- let s = this.tokenStream.current;
743
- for (; h.PUNCTUATION_TYPE === s.type; ) {
744
- if (s.value === "." || s.value === "?.") {
745
- const r = s.value === "?.";
746
- if (this.tokenStream.next(), s = this.tokenStream.current, this.tokenStream.next(), h.NAME_TYPE !== s.type && (h.OPERATOR_TYPE !== s.type || !/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/.test(s.value))) throw new x("Expected name", s.cursor, this.tokenStream.expression);
747
- let i = new k(s.value, !0, r), a = new ae(), o = null;
748
- if (this.tokenStream.current.test(h.PUNCTUATION_TYPE, "(")) {
749
- o = v.METHOD_CALL;
750
- for (let l of Object.values(this.parseArguments().nodes)) a.addElement(l);
751
- } else o = v.PROPERTY_CALL;
752
- e = new v(e, i, a, o);
753
- } else {
754
- if (s.value !== "[") break;
755
- {
756
- this.tokenStream.next();
757
- let r = this.parseExpression();
758
- this.tokenStream.expect(h.PUNCTUATION_TYPE, "]"), e = new v(e, r, new ae(), v.ARRAY_CALL);
759
- }
760
- }
761
- s = this.tokenStream.current;
762
- }
763
- return e;
764
- }), u(this, "parseArguments", () => {
765
- let e = [];
766
- for (this.tokenStream.expect(h.PUNCTUATION_TYPE, "(", "A list of arguments must begin with an opening parenthesis"); !this.tokenStream.current.test(h.PUNCTUATION_TYPE, ")"); ) e.length !== 0 && this.tokenStream.expect(h.PUNCTUATION_TYPE, ",", "Arguments must be separated by a comma"), e.push(this.parseExpression());
767
- return this.tokenStream.expect(h.PUNCTUATION_TYPE, ")", "A list of arguments must be closed by a parenthesis"), new A(e);
768
- }), this.functions = t, this.tokenStream = null, this.names = null, this.objectMatches = {}, this.cachedNames = null, this.nestedExecutions = 0, this.flags = 0;
769
- }
770
- parseConditionalExpression(t) {
771
- for (; this.tokenStream.current.test(h.PUNCTUATION_TYPE, "??"); ) {
772
- this.tokenStream.next();
773
- let e = this.parseExpression();
774
- t = new ve(t, e);
775
- }
776
- for (; this.tokenStream.current.test(h.PUNCTUATION_TYPE, "?"); ) {
777
- let e, s;
778
- this.tokenStream.next(), this.tokenStream.current.test(h.PUNCTUATION_TYPE, ":") ? (this.tokenStream.next(), e = t, s = this.parseExpression()) : (e = this.parseExpression(), this.tokenStream.current.test(h.PUNCTUATION_TYPE, ":") ? (this.tokenStream.next(), s = this.parseExpression()) : e instanceof k && typeof e.attributes?.value == "string" ? s = new k("") : e instanceof ie ? (s = e.nodes.expr3, e = e.nodes.expr2) : (s = e, e = t)), t = new ie(t, e, s);
779
- }
780
- return t;
781
- }
782
- parsePrimaryExpression() {
783
- let t = this.tokenStream.current, e = null;
784
- switch (t.type) {
785
- case h.NAME_TYPE:
786
- switch (this.tokenStream.next(), t.value) {
787
- case "true":
788
- case "TRUE":
789
- return new k(!0);
790
- case "false":
791
- case "FALSE":
792
- return new k(!1);
793
- case "null":
794
- case "NULL":
795
- return new k(null);
796
- default:
797
- if (this.tokenStream.current.value === "(") {
798
- if (this.functions[t.value] === void 0 && !(2 & this.flags)) throw new x(`The function "${t.value}" does not exist`, t.cursor, this.tokenStream.expression, t.values, Object.keys(this.functions));
799
- e = new be(t.value, this.parseArguments());
800
- } else {
801
- let s = null;
802
- if (1 & this.flags) s = t.value;
803
- else {
804
- if (!this.hasVariable(t.value)) {
805
- if (this.tokenStream.current.test(h.PUNCTUATION_TYPE, "??")) return new Ne(t.value);
806
- throw new x(`Variable "${t.value}" is not valid`, t.cursor, this.tokenStream.expression, t.value, this.getNames());
807
- }
808
- s = t.value, this.objectMatches[s] !== void 0 && (s = this.getNames()[this.objectMatches[s]]);
809
- }
810
- e = new xe(s);
811
- }
812
- }
813
- break;
814
- case h.NUMBER_TYPE:
815
- case h.STRING_TYPE:
816
- return this.tokenStream.next(), new k(t.value);
817
- default:
818
- if (t.test(h.PUNCTUATION_TYPE, "[")) e = this.parseArrayExpression();
819
- else {
820
- if (!t.test(h.PUNCTUATION_TYPE, "{")) throw new x(`Unexpected token "${t.type}" of value "${t.value}"`, t.cursor, this.tokenStream.expression);
821
- e = this.parseHashExpression();
822
- }
823
- }
824
- return this.parsePostfixExpression(e);
825
- }
826
- }
827
- class Te {
828
- constructor(t) {
829
- u(this, "getFunction", (e) => this.functions[e]), u(this, "getSource", () => this.source), u(this, "reset", () => (this.source = "", this)), u(this, "compile", (e) => (e.compile(this), this)), u(this, "subcompile", (e) => {
830
- let s = this.source;
831
- this.source = "", e.compile(this);
832
- let r = this.source;
833
- return this.source = s, r;
834
- }), u(this, "raw", (e) => (this.source += e, this)), u(this, "string", (e) => (this.source += '"' + we(e, '\0 "$\\') + '"', this)), u(this, "repr", (e, s = !1) => {
835
- if (s) this.raw(e);
836
- else if (Number.isInteger(e) || +e === e && (!isFinite(e) || e % 1)) this.raw(e);
837
- else if (e === null) this.raw("null");
838
- else if (typeof e == "boolean") this.raw(e ? "true" : "false");
839
- else if (typeof e == "object") {
840
- this.raw("{");
841
- let r = !0;
842
- for (let i of Object.keys(e)) r || this.raw(", "), r = !1, this.repr(i), this.raw(":"), this.repr(e[i]);
843
- this.raw("}");
844
- } else if (Array.isArray(e)) {
845
- this.raw("[");
846
- let r = !0;
847
- for (let i of e) r || this.raw(", "), r = !1, this.repr(i);
848
- this.raw("]");
849
- } else this.string(e);
850
- return this;
851
- }), this.source = "", this.functions = t;
852
- }
853
- }
854
- class ot {
855
- constructor(t) {
856
- this.expression = t;
857
- }
858
- toString() {
859
- return this.expression;
860
- }
861
- }
862
- class K extends ot {
863
- constructor(t, e) {
864
- super(t), u(this, "getNodes", () => this.nodes), this.nodes = e;
865
- }
866
- static fromJSON(t) {
867
- const e = typeof t == "string" ? JSON.parse(t) : t, s = (a) => {
868
- if (a == null || a instanceof A || typeof a != "object" || !a.name) return a;
869
- switch (a.name) {
870
- case "ConstantNode":
871
- return new k(a.attributes?.value, !!a.isIdentifier, !!a.isNullSafe);
872
- case "NameNode":
873
- return new xe(a.attributes?.name);
874
- case "NullCoalescedNameNode":
875
- return new Ne(a.attributes?.name);
876
- case "UnaryNode":
877
- return new V(a.attributes?.operator, s(a.nodes?.node));
878
- case "BinaryNode":
879
- return new S(a.attributes?.operator, s(a.nodes?.left), s(a.nodes?.right));
880
- case "ConditionalNode":
881
- return new ie(s(a.nodes?.expr1), s(a.nodes?.expr2), s(a.nodes?.expr3));
882
- case "NullCoalesceNode":
883
- return new ve(s(a.nodes?.expr1), s(a.nodes?.expr2));
884
- case "ArgumentsNode": {
885
- const o = new ae();
886
- typeof a.type == "string" && (o.type = a.type), typeof a.index == "number" && (o.index = a.index), typeof a.keyIndex == "number" && (o.keyIndex = a.keyIndex), o.nodes = {};
887
- for (const l of Object.keys(a.nodes || {})) o.nodes[l] = s(a.nodes[l]);
888
- return o;
889
- }
890
- case "ArrayNode": {
891
- const o = new ee();
892
- typeof a.type == "string" && (o.type = a.type), typeof a.index == "number" && (o.index = a.index), typeof a.keyIndex == "number" && (o.keyIndex = a.keyIndex), o.nodes = {};
893
- for (const l of Object.keys(a.nodes || {})) o.nodes[l] = s(a.nodes[l]);
894
- return o;
895
- }
896
- case "FunctionNode": {
897
- const o = s(a.nodes?.arguments);
898
- return new be(a.attributes?.name, o);
899
- }
900
- case "GetAttrNode": {
901
- const o = new v(s(a.nodes?.node), s(a.nodes?.attribute), s(a.nodes?.fnArguments), a.attributes?.type);
902
- return a.attributes && typeof a.attributes.is_null_coalesce == "boolean" && (o.attributes.is_null_coalesce = a.attributes.is_null_coalesce), a.attributes && typeof a.attributes.is_short_circuited == "boolean" && (o.attributes.is_short_circuited = a.attributes.is_short_circuited), o;
903
- }
904
- case "Node": {
905
- const o = new A();
906
- if (Array.isArray(a.nodes)) o.nodes = a.nodes.map(s);
907
- else {
908
- o.nodes = {};
909
- for (const l of Object.keys(a.nodes || {})) o.nodes[l] = s(a.nodes[l]);
910
- }
911
- return o.attributes = a.attributes || {}, o;
912
- }
913
- default: {
914
- const o = new A();
915
- if (o.name = a.name, Array.isArray(a.nodes)) o.nodes = a.nodes.map(s);
916
- else {
917
- o.nodes = {};
918
- for (const l of Object.keys(a.nodes || {})) o.nodes[l] = s(a.nodes[l]);
919
- }
920
- return o.attributes = a.attributes || {}, o;
921
- }
922
- }
923
- }, r = e.expression, i = ((a) => {
924
- if (a == null) return a;
925
- if (a.name) return s(a);
926
- if (Array.isArray(a)) return a.map(s);
927
- if (typeof a == "object") {
928
- const o = {};
929
- for (const l of Object.keys(a)) o[l] = s(a[l]);
930
- return o;
931
- }
932
- return a;
933
- })(e.nodes);
934
- return new K(r, i);
935
- }
936
- }
937
- var Ee;
938
- class Ae {
939
- constructor(t = 0) {
940
- u(this, "createCacheItem", (e, s, r) => {
941
- let i = new R();
942
- return i.key = e, i.value = s, i.isHit = r, i.defaultLifetime = this.defaultLifetime, i;
943
- }), u(this, "get", (e, s, r = null, i = null) => {
944
- let a = this.getItem(e);
945
- return a.isHit || this.save(a.set(s(a, !0))), a.get();
946
- }), u(this, "getItem", (e) => {
947
- let s = this.hasItem(e), r = null;
948
- return s ? r = this.values[e] : this.values[e] = null, (0, this.createCacheItem)(e, r, s);
949
- }), u(this, "getItems", (e) => {
950
- for (let s of e) typeof s == "string" || this.expiries[s] || R.validateKey(s);
951
- return this.generateItems(e, (/* @__PURE__ */ new Date()).getTime() / 1e3, this.createCacheItem);
952
- }), u(this, "deleteItems", (e) => {
953
- for (let s of e) this.deleteItem(s);
954
- return !0;
955
- }), u(this, "save", (e) => !(!e instanceof R) && (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 || Number.MAX_SAFE_INTEGER, !0))), u(this, "saveDeferred", (e) => this.save(e)), u(this, "commit", () => !0), u(this, "delete", (e) => this.deleteItem(e)), u(this, "getValues", () => this.values), u(this, "hasItem", (e) => !!(typeof e == "string" && this.expiries[e] && this.expiries[e] > (/* @__PURE__ */ new Date()).getTime() / 1e3) || (R.validateKey(e), !!this.expiries[e] && !this.deleteItem(e))), u(this, "clear", () => (this.values = {}, this.expiries = {}, !0)), u(this, "deleteItem", (e) => (typeof e == "string" && this.expiries[e] || R.validateKey(e), delete this.values[e], delete this.expiries[e], !0)), u(this, "reset", () => {
956
- this.clear();
957
- }), u(this, "generateItems", (e, s, r) => {
958
- let i = [];
959
- for (let a of e) {
960
- let o = null, l = !!this.expiries[a];
961
- l || !(this.expiries[a] > s) && this.deleteItem(a) ? o = this.values[a] : this.values[a] = null, i[a] = r(a, o, l);
962
- }
963
- return i;
964
- }), this.defaultLifetime = t, this.values = {}, this.expiries = {};
965
- }
966
- }
967
- class R {
968
- constructor() {
969
- u(this, "getKey", () => this.key), u(this, "get", () => this.value), u(this, "set", (t) => (this.value = t, this)), u(this, "expiresAt", (t) => {
970
- if (t === null) this.expiry = this.defaultLifetime > 0 ? Date.now() / 1e3 + this.defaultLifetime : null;
971
- else {
972
- if (!(t instanceof Date)) throw new Error(`Expiration date must be instance of Date or be null, "${t.name}" given`);
973
- this.expiry = t.getTime() / 1e3;
974
- }
975
- return this;
976
- }), u(this, "expiresAfter", (t) => {
977
- if (t === null) this.expiry = this.defaultLifetime > 0 ? Date.now() / 1e3 + this.defaultLifetime : null;
978
- else {
979
- if (!Number.isInteger(t)) throw new Error(`Expiration date must be an integer or be null, "${t.name}" given`);
980
- this.expiry = (/* @__PURE__ */ new Date()).getTime() / 1e3 + t;
981
- }
982
- return this;
983
- }), u(this, "tag", (t) => {
984
- if (!this.isTaggable) throw new Error(`Cache item "${this.key}" comes from a non tag-aware pool: you cannot tag it.`);
985
- Array.isArray(t) || (t = [t]);
986
- for (let e of t) {
987
- if (typeof e != "string") throw new Error(`Cache tag must by a string, "${typeof e}" given.`);
988
- if (this.newMetadata.tags[e] && e === "") throw new Error("Cache tag length must be greater than zero");
989
- this.newMetadata.tags[e] = e;
990
- }
991
- return this;
992
- }), u(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;
993
- }
994
- }
995
- Ee = R, u(R, "METADATA_EXPIRY_OFFSET", 1527506807), u(R, "RESERVED_CHARACTERS", ["{", "}", "(", ")", "/", "\\", "@", ":"]), u(R, "validateKey", (n) => {
996
- if (typeof n != "string") throw new Error(`Cache key must be string, "${typeof n}" given.`);
997
- if (n === "") throw new Error("Cache key length must be greater than zero");
998
- for (let t of Ee.RESERVED_CHARACTERS) if (n.indexOf(t) >= 0) throw new Error(`Cache key "${n}" contains reserved character "${t}".`);
999
- return n;
1000
- });
1001
- class ut extends Error {
1002
- constructor(t) {
1003
- super(t), this.name = "LogicException";
1004
- }
1005
- toString() {
1006
- return `${this.name}: ${this.message}`;
1007
- }
1008
- }
1009
- class N {
1010
- constructor(t, e, s) {
1011
- u(this, "getName", () => this.name), u(this, "getCompiler", () => this.compiler), u(this, "getEvaluator", () => this.evaluator), this.name = t, this.compiler = e, this.evaluator = s;
1012
- }
1013
- static fromJavascript(t, e = null) {
1014
- if (typeof t != "string" || t.length === 0) throw new TypeError("A JavaScript function name (string) must be provided.");
1015
- const s = t.replace(/^\/+/, ""), r = s.split(".");
1016
- let i = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof L < "u" ? L : {};
1017
- for (const a of r) {
1018
- if (i == null) break;
1019
- i = i[a];
1020
- }
1021
- if (typeof i != "function") throw new Error(`JavaScript function "${s}" does not exist.`);
1022
- if (!e && r.length > 1) throw new Error(`An expression function name must be defined when JavaScript function "${s}" is namespaced.`);
1023
- return new this(e || r[r.length - 1], (...a) => `${s}(${a.join(", ")})`, (a, ...o) => i(...o));
1024
- }
1025
- }
1026
- class Oe {
1027
- constructor(t = null, e = []) {
1028
- u(this, "compile", (s, r = []) => this.getCompiler().compile(this.parse(s, r).getNodes()).getSource()), u(this, "evaluate", (s, r = {}) => this.parse(s, Object.keys(r)).getNodes().evaluate(this.functions, r)), u(this, "parse", (s, r, i = 0) => {
1029
- if (s instanceof K) return s;
1030
- r.sort((d, f) => {
1031
- let g = d, b = f;
1032
- return typeof d == "object" && (g = Object.values(d)[0]), typeof f == "object" && (b = Object.values(f)[0]), g.localeCompare(b);
1033
- });
1034
- let a = [];
1035
- for (let d of r) {
1036
- let f = d;
1037
- typeof d == "object" && (f = Object.keys(d)[0] + ":" + Object.values(d)[0]), a.push(f);
1038
- }
1039
- let o = this.cache.getItem(this.fixedEncodeURIComponent(s + "//" + a.join("|"))), l = o.get();
1040
- if (l === null) {
1041
- let d = this.getParser().parse(this.getLexer().tokenize(s), r, i);
1042
- l = new K(s, d), o.set(l), this.cache.save(o);
1043
- }
1044
- return l;
1045
- }), u(this, "lint", (s, r = null, i = 0) => {
1046
- r === null && (console.log('Deprecated: passing "null" as the second argument of lint is deprecated, pass IGNORE_UNKNOWN_VARIABLES instead as the third argument'), i |= 1, r = []), s instanceof K || this.getParser().lint(this.getLexer().tokenize(s), r, i);
1047
- }), u(this, "fixedEncodeURIComponent", (s) => encodeURIComponent(s).replace(/[!'()*]/g, function(r) {
1048
- return "%" + r.charCodeAt(0).toString(16);
1049
- })), u(this, "register", (s, r, i) => {
1050
- if (this.parser !== null) throw new ut("Registering functions after calling evaluate(), compile(), or parse() is not supported.");
1051
- this.functions[s] = { compiler: r, evaluator: i };
1052
- }), u(this, "addFunction", (s) => {
1053
- this.register(s.getName(), s.getCompiler(), s.getEvaluator());
1054
- }), u(this, "registerProvider", (s) => {
1055
- for (let r of s.getFunctions()) this.addFunction(r);
1056
- }), u(this, "getLexer", () => (this.lexer === null && (this.lexer = { tokenize: pe }), this.lexer)), u(this, "getParser", () => (this.parser === null && (this.parser = new ke(this.functions)), this.parser)), u(this, "getCompiler", () => (this.compiler === null && (this.compiler = new Te(this.functions)), this.compiler.reset())), this.functions = [], this.lexer = null, this.parser = null, this.compiler = null, this.cache = t || new Ae(), this._registerBuiltinFunctions();
1057
- for (let s of e) this.registerProvider(s);
1058
- }
1059
- _registerBuiltinFunctions() {
1060
- const t = N.fromJavascript("Math.min", "min"), e = N.fromJavascript("Math.max", "max");
1061
- this.addFunction(t), this.addFunction(e), this.addFunction(new N("constant", function(s) {
1062
- 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)})(${s})`;
1063
- }, function(s, r) {
1064
- if (typeof r != "string" || !r) return;
1065
- let i = (a = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof L < "u" ? L : {}, r.split(".").reduce((o, l) => o?.[l], a));
1066
- var a;
1067
- return i === void 0 && s && Object.prototype.hasOwnProperty.call(s, r) && (i = s[r]), i;
1068
- })), this.addFunction(new N("enum", function(s) {
1069
- 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)})(${s})`;
1070
- }, function(s, r) {
1071
- if (typeof r != "string" || !r) return;
1072
- const i = String(r).replace(/\\/g, ".").replace(/::/g, ".");
1073
- var a;
1074
- return i ? (a = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof L < "u" ? L : {}, i.split(".").reduce((o, l) => o?.[l], a)) : void 0;
1075
- }));
1076
- }
1077
- }
1078
- class J {
1079
- getFunctions() {
1080
- throw new Error("getFunctions must be implemented by " + this.name);
1081
- }
1082
- }
1083
- const lt = new N("isset", function(n) {
1084
- return `isset(${n})`;
1085
- }, function(n, t) {
1086
- if (typeof t != "string") return t != null;
1087
- if (!(t.split(/[.\[]/)[0] in n)) return !0;
1088
- let e = "", s = [], r = "", i = "";
1089
- for (let a = 0; a < t.length; a++) {
1090
- let o = t[a];
1091
- if (o !== "]") if (o !== "[") {
1092
- if (r === "object" && (!/[A-z0-9_]/.test(o) || a === t.length - 1)) {
1093
- let l = !1;
1094
- if (a === t.length - 1 && (i += o, l = !0), r = "", s.push({ type: "object", attribute: i }), i = "", l) continue;
1095
- }
1096
- o !== "." ? r ? i += o : e += o : (r = "object", i = "");
1097
- } else r = "array", i = "";
1098
- else r = "", s.push({ type: "array", index: i.replace(/"/g, "").replace(/'/g, "") }), i = "";
1099
- }
1100
- if (s.length > 0) {
1101
- if (n[e] !== void 0) {
1102
- let a = n[e];
1103
- for (let o of s) {
1104
- if (o.type === "array") {
1105
- if (a[o.index] === void 0) return !1;
1106
- a = a[o.index];
1107
- }
1108
- if (o.type === "object") {
1109
- if (a[o.attribute] === void 0) return !1;
1110
- a = a[o.attribute];
1111
- }
1112
- }
1113
- return !0;
1114
- }
1115
- return !1;
1116
- }
1117
- return n[e] !== void 0;
1118
- }), Se = (n) => Object.entries(n);
1119
- function Ce(n) {
1120
- return typeof n == "object" && n !== null;
1121
- }
1122
- function oe(n) {
1123
- return Ce(n) && !(function(t) {
1124
- return Array.isArray(t);
1125
- })(n);
1126
- }
1127
- function _e(n) {
1128
- return (function(t) {
1129
- return Ce(t);
1130
- })(n) ? n : {};
1131
- }
1132
- const Pe = typeof window == "object" && window !== null ? window : typeof L == "object" && L !== null ? L : {};
1133
- function ht() {
1134
- const n = (() => {
1135
- let f = Pe.$locutus;
1136
- typeof f == "object" && f !== null || (f = {}, Pe.$locutus = f);
1137
- let g = f.php;
1138
- return typeof g == "object" && g !== null || (g = {}, f.php = g), g;
1139
- })(), t = n.ini, e = n.locales, s = n.localeCategories, r = n.pointers, i = oe(t) ? t : {}, a = ((f) => oe(f))(e) ? e : {}, o = ((f) => oe(f))(s) ? s : {}, l = Array.isArray(r) ? r : [];
1140
- t !== i && (n.ini = i), e !== a && (n.locales = a), s !== o && (n.localeCategories = o), r !== l && (n.pointers = l);
1141
- const d = n.locale_default;
1142
- return { ini: i, locales: a, localeCategories: o, pointers: l, locale_default: typeof d == "string" ? d : void 0 };
1143
- }
1144
- function Re(n) {
1145
- const t = ht().ini[n];
1146
- return t && t.local_value !== void 0 ? t.local_value === null ? "" : String(t.local_value) : "";
1147
- }
1148
- function ct(n, t, e) {
1149
- const s = (function(o) {
1150
- if (typeof o == "boolean") return o ? "1" : "";
1151
- if (typeof o == "string") return o;
1152
- if (typeof o == "number") return isNaN(o) ? "NAN" : isFinite(o) ? o + "" : (o < 0 ? "-" : "") + "INF";
1153
- if (o === void 0) return "";
1154
- if (typeof o == "object") return Array.isArray(o) ? "Array" : o !== null ? "Object" : "";
1155
- throw new Error("Unsupported value type");
1156
- })(n), r = Re("unicode.semantics") === "on" ? s.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[\s\S]/g) || [] : null, i = r ? r.length : s.length;
1157
- let a = i;
1158
- return t < 0 && (t += a), e !== void 0 && (a = e < 0 ? e + a : e + t), !(t > i || t < 0 || t > a) && (r ? r.slice(t, a).join("") : s.slice(t, a));
1159
- }
1160
- function dt(n, ...t) {
1161
- const e = {};
1162
- if (t.length < 1) return e;
1163
- const s = _e(n);
1164
- e: for (const [r, i] of Se(s)) {
1165
- for (const a of t) {
1166
- const o = _e(a);
1167
- let l = !1;
1168
- for (const [, d] of Se(o)) if (d === i) {
1169
- l = !0;
1170
- break;
1171
- }
1172
- if (!l) continue e;
1173
- }
1174
- e[r] = i;
1175
- }
1176
- return e;
1177
- }
1178
- const je = (n) => {
1179
- if (!n || typeof n != "object") return !1;
1180
- const t = Object.getPrototypeOf(n);
1181
- return t === Array.prototype || t === Object.prototype;
1182
- };
1183
- function ue(n, t = 0) {
1184
- let e = 0;
1185
- if (n == null) return 0;
1186
- if (typeof n != "object") return 1;
1187
- const s = Object.getPrototypeOf(n);
1188
- if (s !== Array.prototype && s !== Object.prototype) return 1;
1189
- const r = t === "COUNT_RECURSIVE" || t === 1;
1190
- if (Array.isArray(n)) {
1191
- for (const i of Object.keys(n)) {
1192
- e++;
1193
- const a = n[Number(i)];
1194
- r && je(a) && (e += ue(a, 1));
1195
- }
1196
- return e;
1197
- }
1198
- for (const i in n) if (Object.prototype.hasOwnProperty.call(n, i)) {
1199
- e++;
1200
- const a = n[i];
1201
- r && je(a) && (e += ue(a, 1));
1202
- }
1203
- return e;
1204
- }
1205
- const ft = new N("implode", function(n, t) {
1206
- return `implode(${n}, ${t})`;
1207
- }, function(n, t, e) {
1208
- return (function(...s) {
1209
- let r, i = "", a = "", o = "";
1210
- if (s.length === 1) {
1211
- const [l] = s;
1212
- r = l;
1213
- } else {
1214
- const [l, d] = s;
1215
- o = String(l ?? ""), r = d;
1216
- }
1217
- if (typeof r == "object" && r !== null) {
1218
- if (Array.isArray(r)) return r.join(o);
1219
- for (const l in r) i += a + r[l], a = o;
1220
- return i;
1221
- }
1222
- return String(r);
1223
- })(t, e);
1224
- }), pt = new N("count", function(n, t) {
1225
- let e = "";
1226
- return t && (e = `, ${t}`), `count(${n}${e})`;
1227
- }, function(n, t, e) {
1228
- return ue(t, e);
1229
- }), mt = new N("array_intersect", function(n, ...t) {
1230
- let e = "";
1231
- return t.length > 0 && (e = ", " + t.join(", ")), `array_intersect(${n}${e})`;
1232
- }, function(n) {
1233
- let t = [], e = !0;
1234
- for (let r = 1; r < arguments.length; r++) t.push(arguments[r]), Array.isArray(arguments[r]) || (e = !1);
1235
- let s = dt.apply(null, t);
1236
- return e ? Object.values(s) : s;
1237
- });
1238
- function gt(n, t) {
1239
- let e, s = /* @__PURE__ */ new Date();
1240
- const r = ["Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], i = /\\?(.?)/gi, a = function(f, g) {
1241
- return b = f, Object.prototype.hasOwnProperty.call(e, b) ? String(e[f]()) : g;
1242
- var b;
1243
- }, o = function(f, g) {
1244
- let b = String(f);
1245
- for (; b.length < g; ) b = "0" + b;
1246
- return b;
1247
- };
1248
- return e = { d: function() {
1249
- return o(e.j(), 2);
1250
- }, D: function() {
1251
- return String(e.l()).slice(0, 3);
1252
- }, j: function() {
1253
- return s.getDate();
1254
- }, l: function() {
1255
- return (r[Number(e.w())] ?? "") + "day";
1256
- }, N: function() {
1257
- return Number(e.w()) || 7;
1258
- }, S: function() {
1259
- const f = Number(e.j());
1260
- let g = f % 10;
1261
- return g <= 3 && Number.parseInt(String(f % 100 / 10), 10) === 1 && (g = 0), ["st", "nd", "rd"][g - 1] || "th";
1262
- }, w: function() {
1263
- return s.getDay();
1264
- }, z: function() {
1265
- const f = new Date(Number(e.Y()), Number(e.n()) - 1, Number(e.j())), g = new Date(Number(e.Y()), 0, 1);
1266
- return Math.round((f.getTime() - g.getTime()) / 864e5);
1267
- }, W: function() {
1268
- const f = new Date(Number(e.Y()), Number(e.n()) - 1, Number(e.j()) - Number(e.N()) + 3), g = new Date(f.getFullYear(), 0, 4);
1269
- return o(1 + Math.round((f.getTime() - g.getTime()) / 864e5 / 7), 2);
1270
- }, F: function() {
1271
- return r[6 + Number(e.n())] ?? "";
1272
- }, m: function() {
1273
- return o(e.n(), 2);
1274
- }, M: function() {
1275
- return String(e.F()).slice(0, 3);
1276
- }, n: function() {
1277
- return s.getMonth() + 1;
1278
- }, t: function() {
1279
- return new Date(Number(e.Y()), Number(e.n()), 0).getDate();
1280
- }, L: function() {
1281
- const f = Number(e.Y());
1282
- return f % 4 == 0 && f % 100 != 0 || f % 400 == 0 ? 1 : 0;
1283
- }, o: function() {
1284
- const f = Number(e.n()), g = Number(e.W());
1285
- return Number(e.Y()) + (f === 12 && g < 9 ? 1 : f === 1 && g > 9 ? -1 : 0);
1286
- }, Y: function() {
1287
- return s.getFullYear();
1288
- }, y: function() {
1289
- return String(e.Y()).slice(-2);
1290
- }, a: function() {
1291
- return s.getHours() > 11 ? "pm" : "am";
1292
- }, A: function() {
1293
- return String(e.a()).toUpperCase();
1294
- }, B: function() {
1295
- const f = 3600 * s.getUTCHours(), g = 60 * s.getUTCMinutes(), b = s.getUTCSeconds();
1296
- return o(Math.floor((f + g + b + 3600) / 86.4) % 1e3, 3);
1297
- }, g: function() {
1298
- return Number(e.G()) % 12 || 12;
1299
- }, G: function() {
1300
- return s.getHours();
1301
- }, h: function() {
1302
- return o(e.g(), 2);
1303
- }, H: function() {
1304
- return o(e.G(), 2);
1305
- }, i: function() {
1306
- return o(s.getMinutes(), 2);
1307
- }, s: function() {
1308
- return o(s.getSeconds(), 2);
1309
- }, u: function() {
1310
- return o(1e3 * s.getMilliseconds(), 6);
1311
- }, e: function() {
1312
- throw new Error("Not supported (see source code of date() for timezone on how to add support)");
1313
- }, I: function() {
1314
- const f = new Date(Number(e.Y()), 0), g = Date.UTC(Number(e.Y()), 0), b = new Date(Number(e.Y()), 6), $ = Date.UTC(Number(e.Y()), 6);
1315
- return f.getTime() - g !== b.getTime() - $ ? 1 : 0;
1316
- }, O: function() {
1317
- const f = s.getTimezoneOffset(), g = Math.abs(f);
1318
- return (f > 0 ? "-" : "+") + o(100 * Math.floor(g / 60) + g % 60, 4);
1319
- }, P: function() {
1320
- const f = String(e.O());
1321
- return f.slice(0, 3) + ":" + f.slice(3, 5);
1322
- }, T: function() {
1323
- return "UTC";
1324
- }, Z: function() {
1325
- return 60 * -s.getTimezoneOffset();
1326
- }, c: function() {
1327
- return "Y-m-d\\TH:i:sP".replace(i, a);
1328
- }, r: function() {
1329
- return "D, d M Y H:i:s O".replace(i, a);
1330
- }, U: function() {
1331
- return s.getTime() / 1e3 | 0;
1332
- } }, l = n, s = (d = t) === void 0 ? /* @__PURE__ */ new Date() : d instanceof Date ? new Date(d) : new Date(1e3 * Number(d)), l.replace(i, a);
1333
- var l, d;
1334
- }
1335
- const le = "[ \\t]+", M = "[ \\t]*", F = "(?:([ap])\\.?m\\.?([\\t ]|$))", _ = "(2[0-4]|[01]?[0-9])", q = "([01][0-9]|2[0-4])", B = "(0?[1-9]|1[0-2])", j = "([0-5]?[0-9])", P = "([0-5][0-9])", te = "(60|[0-5]?[0-9])", U = "(60|[0-5][0-9])", Ue = "(?:\\.([0-9]+))", Ie = "sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun|mon|tue|wed|thu|fri|sat|weekdays?", Le = "next|last|previous|this", Ye = "(?:second|sec|minute|min|hour|day|fortnight|forthnight|month|year)s?|weeks|" + Ie, Z = "([0-9]{1,4})", E = "([0-9]{4})", Y = "(1[0-2]|0?[0-9])", z = "(0[0-9]|1[0-2])", C = "(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)", I = "(0[0-9]|[1-2][0-9]|3[01])", $e = "january|february|march|april|may|june|july|august|september|october|november|december", X = "jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec", G = "(" + $e + "|" + X + "|i[vx]|vi{0,3}|xi{0,2}|i{1,3})", he = "((?:GMT)?([+-])" + _ + ":?" + j + "?)", Q = G + "[ .\\t-]*" + C + "[,.stndrh\\t ]*";
1336
- function W(n, t) {
1337
- switch (t?.toLowerCase()) {
1338
- case "a":
1339
- n += n === 12 ? -12 : 0;
1340
- break;
1341
- case "p":
1342
- n += n !== 12 ? 12 : 0;
1343
- }
1344
- return n;
1345
- }
1346
- function H(n) {
1347
- let t = +n;
1348
- return n.length < 4 && t < 100 && (t += t < 70 ? 2e3 : 1900), t;
1349
- }
1350
- function O(n) {
1351
- return { jan: 0, january: 0, i: 0, feb: 1, february: 1, ii: 1, mar: 2, march: 2, iii: 2, apr: 3, april: 3, iv: 3, may: 4, v: 4, jun: 5, june: 5, vi: 5, jul: 6, july: 6, vii: 6, aug: 7, august: 7, viii: 7, sep: 8, sept: 8, september: 8, ix: 8, oct: 9, october: 9, x: 9, nov: 10, november: 10, xi: 10, dec: 11, december: 11, xii: 11 }[n.toLowerCase()] ?? Number.NaN;
1352
- }
1353
- function ce(n, t = 0) {
1354
- return { mon: 1, monday: 1, tue: 2, tuesday: 2, wed: 3, wednesday: 3, thu: 4, thursday: 4, fri: 5, friday: 5, sat: 6, saturday: 6, sun: 0, sunday: 0 }[n.toLowerCase()] || t;
1355
- }
1356
- function de(n, t = Number.NaN) {
1357
- const e = n?.match(/(?:GMT)?([+-])(\d+)(:?)(\d{0,2})/i);
1358
- if (!e) return t;
1359
- const s = e[1] === "-" ? -1 : 1;
1360
- let r = +(e[2] ?? 0), i = +(e[4] ?? 0);
1361
- return e[4] || e[3] || (i = Math.floor(r % 100), r = Math.floor(r / 100)), s * (60 * r + i) * 60;
1362
- }
1363
- const yt = { acdt: 37800, acst: 34200, addt: -7200, adt: -10800, aedt: 39600, aest: 36e3, ahdt: -32400, ahst: -36e3, akdt: -28800, akst: -32400, amt: -13840, apt: -10800, ast: -14400, awdt: 32400, awst: 28800, awt: -10800, bdst: 7200, bdt: -36e3, bmt: -14309, bst: 3600, cast: 34200, cat: 7200, cddt: -14400, cdt: -18e3, cemt: 10800, cest: 7200, cet: 3600, cmt: -15408, cpt: -18e3, cst: -21600, cwt: -18e3, chst: 36e3, dmt: -1521, eat: 10800, eddt: -10800, edt: -14400, eest: 10800, eet: 7200, emt: -26248, ept: -14400, est: -18e3, ewt: -14400, ffmt: -14660, fmt: -4056, gdt: 39600, gmt: 0, gst: 36e3, hdt: -34200, hkst: 32400, hkt: 28800, hmt: -19776, hpt: -34200, hst: -36e3, hwt: -34200, iddt: 14400, idt: 10800, imt: 25025, ist: 7200, jdt: 36e3, jmt: 8440, jst: 32400, kdt: 36e3, kmt: 5736, kst: 30600, lst: 9394, mddt: -18e3, mdst: 16279, mdt: -21600, mest: 7200, met: 3600, mmt: 9017, mpt: -21600, msd: 14400, msk: 10800, mst: -25200, mwt: -21600, nddt: -5400, ndt: -9052, npt: -9e3, nst: -12600, nwt: -9e3, nzdt: 46800, nzmt: 41400, nzst: 43200, pddt: -21600, pdt: -25200, pkst: 21600, pkt: 18e3, plmt: 25590, pmt: -13236, ppmt: -17340, ppt: -25200, pst: -28800, pwt: -25200, qmt: -18840, rmt: 5794, sast: 7200, sdmt: -16800, sjmt: -20173, smt: -13884, sst: -39600, tbmt: 10751, tmt: 12344, uct: 0, utc: 0, wast: 7200, wat: 3600, wemt: 7200, west: 3600, wet: 0, wib: 25200, wita: 28800, wit: 32400, wmt: 5040, yddt: -25200, ydt: -28800, ypt: -28800, yst: -32400, ywt: -28800, a: 3600, b: 7200, c: 10800, d: 14400, e: 18e3, f: 21600, g: 25200, h: 28800, i: 32400, k: 36e3, l: 39600, m: 43200, n: -3600, o: -7200, p: -10800, q: -14400, r: -18e3, s: -21600, t: -25200, u: -28800, v: -32400, w: -36e3, x: -39600, y: -43200, z: 0 }, m = { yesterday: { regex: /^yesterday/i, name: "yesterday", callback() {
1364
- return this.rd -= 1, this.resetTime();
1365
- } }, now: { regex: /^now/i, name: "now" }, noon: { regex: /^noon/i, name: "noon", callback() {
1366
- return this.resetTime() && this.time(12, 0, 0, 0);
1367
- } }, midnightOrToday: { regex: /^(midnight|today)/i, name: "midnight | today", callback() {
1368
- return this.resetTime();
1369
- } }, tomorrow: { regex: /^tomorrow/i, name: "tomorrow", callback() {
1370
- return this.rd += 1, this.resetTime();
1371
- } }, timestamp: { regex: /^@(-?\d+)/i, name: "timestamp", callback(n, t) {
1372
- return this.rs += +t, this.y = 1970, this.m = 0, this.d = 1, this.dates = 0, this.resetTime() && this.zone(0);
1373
- } }, firstOrLastDay: { regex: /^(first|last) day of/i, name: "firstdayof | lastdayof", callback(n, t) {
1374
- t.toLowerCase() === "first" ? this.firstOrLastDayOfMonth = 1 : this.firstOrLastDayOfMonth = -1;
1375
- } }, backOrFrontOf: { regex: new RegExp("^(back|front) of " + _ + M + F + "?", "i"), name: "backof | frontof", callback(n, t, e, s) {
1376
- let r = +e, i = 15;
1377
- return t.toLowerCase() === "back" || (r -= 1, i = 45), r = W(r, s), this.resetTime() && this.time(r, i, 0, 0);
1378
- } }, mssqltime: { regex: new RegExp("^" + B + ":" + P + ":" + U + "[:.]([0-9]+)" + F, "i"), name: "mssqltime", callback(n, t, e, s, r, i) {
1379
- return this.time(W(+t, i), +e, +s, +r.substr(0, 3));
1380
- } }, oracledate: { regex: /^(\d{2})-([A-Z]{3})-(\d{2})$/i, name: "d-M-y", callback(n, t, e, s) {
1381
- const r = { JAN: 0, FEB: 1, MAR: 2, APR: 3, MAY: 4, JUN: 5, JUL: 6, AUG: 7, SEP: 8, OCT: 9, NOV: 10, DEC: 11 }[e.toUpperCase()] ?? Number.NaN;
1382
- return this.ymd(2e3 + parseInt(s, 10), r, parseInt(t, 10));
1383
- } }, timeLong12: { regex: new RegExp("^" + B + "[:.]" + j + "[:.]" + U + M + F, "i"), name: "timelong12", callback(n, t, e, s, r) {
1384
- return this.time(W(+t, r), +e, +s, 0);
1385
- } }, timeShort12: { regex: new RegExp("^" + B + "[:.]" + P + M + F, "i"), name: "timeshort12", callback(n, t, e, s) {
1386
- return this.time(W(+t, s), +e, 0, 0);
1387
- } }, timeTiny12: { regex: new RegExp("^" + B + M + F, "i"), name: "timetiny12", callback(n, t, e) {
1388
- return this.time(W(+t, e), 0, 0, 0);
1389
- } }, soap: { regex: new RegExp("^" + E + "-" + z + "-" + I + "T" + q + ":" + P + ":" + U + Ue + he + "?", "i"), name: "soap", callback(n, t, e, s, r, i, a, o, l) {
1390
- return this.ymd(+t, +e - 1, +s) && this.time(+r, +i, +a, +o.substr(0, 3)) && this.zone(de(l));
1391
- } }, wddx: { regex: new RegExp("^" + E + "-" + Y + "-" + C + "T" + _ + ":" + j + ":" + te), name: "wddx", callback(n, t, e, s, r, i, a) {
1392
- return this.ymd(+t, +e - 1, +s) && this.time(+r, +i, +a, 0);
1393
- } }, exif: { regex: new RegExp("^" + E + ":" + z + ":" + I + " " + q + ":" + P + ":" + U, "i"), name: "exif", callback(n, t, e, s, r, i, a) {
1394
- return this.ymd(+t, +e - 1, +s) && this.time(+r, +i, +a, 0);
1395
- } }, xmlRpc: { regex: new RegExp("^" + E + z + I + "T" + _ + ":" + P + ":" + U), name: "xmlrpc", callback(n, t, e, s, r, i, a) {
1396
- return this.ymd(+t, +e - 1, +s) && this.time(+r, +i, +a, 0);
1397
- } }, xmlRpcNoColon: { regex: new RegExp("^" + E + z + I + "[Tt]" + _ + P + U), name: "xmlrpcnocolon", callback(n, t, e, s, r, i, a) {
1398
- return this.ymd(+t, +e - 1, +s) && this.time(+r, +i, +a, 0);
1399
- } }, clf: { regex: new RegExp("^" + C + "/(" + X + ")/" + E + ":" + q + ":" + P + ":" + U + le + he, "i"), name: "clf", callback(n, t, e, s, r, i, a, o) {
1400
- return this.ymd(+s, O(e), +t) && this.time(+r, +i, +a, 0) && this.zone(de(o));
1401
- } }, iso8601long: { regex: new RegExp("^t?" + _ + "[:.]" + j + "[:.]" + te + Ue, "i"), name: "iso8601long", callback(n, t, e, s, r) {
1402
- return this.time(+t, +e, +s, +r.substr(0, 3));
1403
- } }, dateTextual: { regex: new RegExp("^" + G + "[ .\\t-]*" + C + "[,.stndrh\\t ]+" + Z, "i"), name: "datetextual", callback(n, t, e, s) {
1404
- return this.ymd(H(s), O(t), +e);
1405
- } }, pointedDate4: { regex: new RegExp("^" + C + "[.\\t-]" + Y + "[.-]" + E), name: "pointeddate4", callback(n, t, e, s) {
1406
- return this.ymd(+s, +e - 1, +t);
1407
- } }, pointedDate2: { regex: new RegExp("^" + C + "[.\\t]" + Y + "\\.([0-9]{2})"), name: "pointeddate2", callback(n, t, e, s) {
1408
- return this.ymd(H(s), +e - 1, +t);
1409
- } }, timeLong24: { regex: new RegExp("^t?" + _ + "[:.]" + j + "[:.]" + te), name: "timelong24", callback(n, t, e, s) {
1410
- return this.time(+t, +e, +s, 0);
1411
- } }, dateNoColon: { regex: new RegExp("^" + E + z + I), name: "datenocolon", callback(n, t, e, s) {
1412
- return this.ymd(+t, +e - 1, +s);
1413
- } }, pgydotd: { regex: new RegExp("^" + E + "\\.?(00[1-9]|0[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6])"), name: "pgydotd", callback(n, t, e) {
1414
- return this.ymd(+t, 0, +e);
1415
- } }, timeShort24: { regex: new RegExp("^t?" + _ + "[:.]" + j, "i"), name: "timeshort24", callback(n, t, e) {
1416
- return this.time(+t, +e, 0, 0);
1417
- } }, iso8601noColon: { regex: new RegExp("^t?" + q + P + U, "i"), name: "iso8601nocolon", callback(n, t, e, s) {
1418
- return this.time(+t, +e, +s, 0);
1419
- } }, iso8601dateSlash: { regex: new RegExp("^" + E + "/" + z + "/" + I + "/"), name: "iso8601dateslash", callback(n, t, e, s) {
1420
- return this.ymd(+t, +e - 1, +s);
1421
- } }, dateSlash: { regex: new RegExp("^" + E + "/" + Y + "/" + C), name: "dateslash", callback(n, t, e, s) {
1422
- return this.ymd(+t, +e - 1, +s);
1423
- } }, american: { regex: new RegExp("^" + Y + "/" + C + "/" + Z), name: "american", callback(n, t, e, s) {
1424
- return this.ymd(H(s), +t - 1, +e);
1425
- } }, americanShort: { regex: new RegExp("^" + Y + "/" + C), name: "americanshort", callback(n, t, e) {
1426
- return this.ymd(this.y, +t - 1, +e);
1427
- } }, gnuDateShortOrIso8601date2: { regex: new RegExp("^" + Z + "-" + Y + "-" + C), name: "gnudateshort | iso8601date2", callback(n, t, e, s) {
1428
- return this.ymd(H(t), +e - 1, +s);
1429
- } }, iso8601date4: { regex: new RegExp("^([+-]?[0-9]{4})-" + z + "-" + I), name: "iso8601date4", callback(n, t, e, s) {
1430
- return this.ymd(+t, +e - 1, +s);
1431
- } }, gnuNoColon: { regex: new RegExp("^t?" + q + P, "i"), name: "gnunocolon", callback(n, t, e) {
1432
- switch (this.times) {
1433
- case 0:
1434
- return this.time(+t, +e, 0, this.f);
1435
- case 1:
1436
- return this.y = 100 * +t + +e, this.times++, !0;
1437
- default:
1438
- return !1;
1439
- }
1440
- } }, gnuDateShorter: { regex: new RegExp("^" + E + "-" + Y), name: "gnudateshorter", callback(n, t, e) {
1441
- return this.ymd(+t, +e - 1, 1);
1442
- } }, pgTextReverse: { regex: new RegExp("^(\\d{3,4}|[4-9]\\d|3[2-9])-(" + X + ")-" + I, "i"), name: "pgtextreverse", callback(n, t, e, s) {
1443
- return this.ymd(H(t), O(e), +s);
1444
- } }, dateFull: { regex: new RegExp("^" + C + "[ \\t.-]*" + G + "[ \\t.-]*" + Z, "i"), name: "datefull", callback(n, t, e, s) {
1445
- return this.ymd(H(s), O(e), +t);
1446
- } }, dateNoDay: { regex: new RegExp("^" + G + "[ .\\t-]*" + E, "i"), name: "datenoday", callback(n, t, e) {
1447
- return this.ymd(+e, O(t), 1);
1448
- } }, dateNoDayRev: { regex: new RegExp("^" + E + "[ .\\t-]*" + G, "i"), name: "datenodayrev", callback(n, t, e) {
1449
- return this.ymd(+t, O(e), 1);
1450
- } }, pgTextShort: { regex: new RegExp("^(" + X + ")-" + I + "-" + Z, "i"), name: "pgtextshort", callback(n, t, e, s) {
1451
- return this.ymd(H(s), O(t), +e);
1452
- } }, dateNoYear: { regex: new RegExp("^" + Q, "i"), name: "datenoyear", callback(n, t, e) {
1453
- return this.ymd(this.y, O(t), +e);
1454
- } }, dateNoYearRev: { regex: new RegExp("^" + C + "[ .\\t-]*" + G, "i"), name: "datenoyearrev", callback(n, t, e) {
1455
- return this.ymd(this.y, O(e), +t);
1456
- } }, isoWeekDay: { regex: new RegExp("^" + E + "-?W(0[1-9]|[1-4][0-9]|5[0-3])(?:-?([0-7]))?"), name: "isoweekday | isoweek", callback(n, t, e, s) {
1457
- const r = s ? +s : 1;
1458
- if (!this.ymd(+t, 0, 1)) return !1;
1459
- let i = new Date(this.y, this.m, this.d).getDay();
1460
- return i = 0 - (i > 4 ? i - 7 : i), this.rd += i + 7 * (+e - 1) + r, !0;
1461
- } }, relativeText: { regex: new RegExp("^(first|second|third|fourth|fifth|sixth|seventh|eighth?|ninth|tenth|eleventh|twelfth|" + Le + ")" + le + "(" + Ye + ")", "i"), name: "relativetext", callback(n, t, e) {
1462
- const { amount: s } = (function(r) {
1463
- const i = r.toLowerCase();
1464
- return { amount: { last: -1, previous: -1, this: 0, first: 1, next: 1, second: 2, third: 3, fourth: 4, fifth: 5, sixth: 6, seventh: 7, eight: 8, eighth: 8, ninth: 9, tenth: 10, eleventh: 11, twelfth: 12 }[i] ?? 0, behavior: { this: 1 }[i] || 0 };
1465
- })(t);
1466
- switch (e.toLowerCase()) {
1467
- case "sec":
1468
- case "secs":
1469
- case "second":
1470
- case "seconds":
1471
- this.rs += s;
1472
- break;
1473
- case "min":
1474
- case "mins":
1475
- case "minute":
1476
- case "minutes":
1477
- this.ri += s;
1478
- break;
1479
- case "hour":
1480
- case "hours":
1481
- this.rh += s;
1482
- break;
1483
- case "day":
1484
- case "days":
1485
- this.rd += s;
1486
- break;
1487
- case "fortnight":
1488
- case "fortnights":
1489
- case "forthnight":
1490
- case "forthnights":
1491
- this.rd += 14 * s;
1492
- break;
1493
- case "week":
1494
- case "weeks":
1495
- this.rd += 7 * s;
1496
- break;
1497
- case "month":
1498
- case "months":
1499
- this.rm += s;
1500
- break;
1501
- case "year":
1502
- case "years":
1503
- this.ry += s;
1504
- break;
1505
- case "mon":
1506
- case "monday":
1507
- case "tue":
1508
- case "tuesday":
1509
- case "wed":
1510
- case "wednesday":
1511
- case "thu":
1512
- case "thursday":
1513
- case "fri":
1514
- case "friday":
1515
- case "sat":
1516
- case "saturday":
1517
- case "sun":
1518
- case "sunday":
1519
- this.resetTime(), this.weekday = ce(e, 7), this.weekdayBehavior = 1, this.rd += 7 * (s > 0 ? s - 1 : s);
1520
- }
1521
- } }, relative: { regex: new RegExp("^([+-]*)[ \\t]*(\\d+)" + M + "(" + Ye + "|week)", "i"), name: "relative", callback(n, t, e, s) {
1522
- const r = t.replace(/[^-]/g, "").length, i = +e * Math.pow(-1, r);
1523
- switch (s.toLowerCase()) {
1524
- case "sec":
1525
- case "secs":
1526
- case "second":
1527
- case "seconds":
1528
- this.rs += i;
1529
- break;
1530
- case "min":
1531
- case "mins":
1532
- case "minute":
1533
- case "minutes":
1534
- this.ri += i;
1535
- break;
1536
- case "hour":
1537
- case "hours":
1538
- this.rh += i;
1539
- break;
1540
- case "day":
1541
- case "days":
1542
- this.rd += i;
1543
- break;
1544
- case "fortnight":
1545
- case "fortnights":
1546
- case "forthnight":
1547
- case "forthnights":
1548
- this.rd += 14 * i;
1549
- break;
1550
- case "week":
1551
- case "weeks":
1552
- this.rd += 7 * i;
1553
- break;
1554
- case "month":
1555
- case "months":
1556
- this.rm += i;
1557
- break;
1558
- case "year":
1559
- case "years":
1560
- this.ry += i;
1561
- break;
1562
- case "mon":
1563
- case "monday":
1564
- case "tue":
1565
- case "tuesday":
1566
- case "wed":
1567
- case "wednesday":
1568
- case "thu":
1569
- case "thursday":
1570
- case "fri":
1571
- case "friday":
1572
- case "sat":
1573
- case "saturday":
1574
- case "sun":
1575
- case "sunday":
1576
- this.resetTime(), this.weekday = ce(s, 7), this.weekdayBehavior = 1, this.rd += 7 * (i > 0 ? i - 1 : i);
1577
- }
1578
- } }, dayText: { regex: new RegExp("^(" + Ie + ")", "i"), name: "daytext", callback(n, t) {
1579
- this.resetTime(), this.weekday = ce(t, 0), this.weekdayBehavior !== 2 && (this.weekdayBehavior = 1);
1580
- } }, relativeTextWeek: { regex: new RegExp("^(" + Le + ")" + le + "week", "i"), name: "relativetextweek", callback(n, t) {
1581
- switch (this.weekdayBehavior = 2, t.toLowerCase()) {
1582
- case "this":
1583
- this.rd += 0;
1584
- break;
1585
- case "next":
1586
- this.rd += 7;
1587
- break;
1588
- case "last":
1589
- case "previous":
1590
- this.rd -= 7;
1591
- }
1592
- isNaN(this.weekday) && (this.weekday = 1);
1593
- } }, monthFullOrMonthAbbr: { regex: new RegExp("^(" + $e + "|" + X + ")", "i"), name: "monthfull | monthabbr", callback(n, t) {
1594
- return this.ymd(this.y, O(t), this.d);
1595
- } }, tzCorrection: { regex: new RegExp("^" + he, "i"), name: "tzcorrection", callback(n) {
1596
- return this.zone(de(n));
1597
- } }, tzAbbr: { regex: new RegExp("^\\(?([a-zA-Z]{1,6})\\)?"), name: "tzabbr", callback(n, t) {
1598
- const e = yt[t.toLowerCase()];
1599
- return e != null && !Number.isNaN(e) && this.zone(e);
1600
- } }, ago: { regex: /^ago/i, name: "ago", callback() {
1601
- this.ry = -this.ry, this.rm = -this.rm, this.rd = -this.rd, this.rh = -this.rh, this.ri = -this.ri, this.rs = -this.rs, this.rf = -this.rf;
1602
- } }, year4: { regex: new RegExp("^" + E), name: "year4", callback(n, t) {
1603
- return this.y = +t, !0;
1604
- } }, whitespace: { regex: /^[ .,\t]+/, name: "whitespace" }, dateShortWithTimeLong: { regex: new RegExp("^" + Q + "t?" + _ + "[:.]" + j + "[:.]" + te, "i"), name: "dateshortwithtimelong", callback(n, t, e, s, r, i) {
1605
- return this.ymd(this.y, O(t), +e) && this.time(+s, +r, +i, 0);
1606
- } }, dateShortWithTimeLong12: { regex: new RegExp("^" + Q + B + "[:.]" + j + "[:.]" + U + M + F, "i"), name: "dateshortwithtimelong12", callback(n, t, e, s, r, i, a) {
1607
- return this.ymd(this.y, O(t), +e) && this.time(W(+s, a), +r, +i, 0);
1608
- } }, dateShortWithTimeShort: { regex: new RegExp("^" + Q + "t?" + _ + "[:.]" + j, "i"), name: "dateshortwithtimeshort", callback(n, t, e, s, r) {
1609
- return this.ymd(this.y, O(t), +e) && this.time(+s, +r, 0, 0);
1610
- } }, dateShortWithTimeShort12: { regex: new RegExp("^" + Q + B + "[:.]" + P + M + F, "i"), name: "dateshortwithtimeshort12", callback(n, t, e, s, r, i) {
1611
- return this.ymd(this.y, O(t), +e) && this.time(W(+s, i), +r, 0, 0);
1612
- } } }, wt = { y: NaN, m: NaN, d: NaN, h: NaN, i: NaN, s: NaN, f: NaN, ry: 0, rm: 0, rd: 0, rh: 0, ri: 0, rs: 0, rf: 0, weekday: NaN, weekdayBehavior: 0, firstOrLastDayOfMonth: 0, z: NaN, dates: 0, times: 0, zones: 0, ymd(n, t, e) {
1613
- return !(this.dates > 0) && (this.dates++, this.y = n, this.m = t, this.d = e, !0);
1614
- }, time(n, t, e, s) {
1615
- return !(this.times > 0) && (this.times++, this.h = n, this.i = t, this.s = e, this.f = s, !0);
1616
- }, resetTime() {
1617
- return this.h = 0, this.i = 0, this.s = 0, this.f = 0, this.times = 0, !0;
1618
- }, zone(n) {
1619
- return this.zones <= 1 && (this.zones++, this.z = n, !0);
1620
- }, toDate(n) {
1621
- switch (this.dates && !this.times && (this.h = this.i = this.s = this.f = 0), isNaN(this.y) && (this.y = n.getFullYear()), isNaN(this.m) && (this.m = n.getMonth()), isNaN(this.d) && (this.d = n.getDate()), isNaN(this.h) && (this.h = n.getHours()), isNaN(this.i) && (this.i = n.getMinutes()), isNaN(this.s) && (this.s = n.getSeconds()), isNaN(this.f) && (this.f = n.getMilliseconds()), this.firstOrLastDayOfMonth) {
1622
- case 1:
1623
- this.d = 1;
1624
- break;
1625
- case -1:
1626
- this.d = 0, this.m += 1;
1627
- }
1628
- if (!isNaN(this.weekday)) {
1629
- const e = new Date(n.getTime());
1630
- e.setFullYear(this.y, this.m, this.d), e.setHours(this.h, this.i, this.s, this.f);
1631
- const s = e.getDay();
1632
- if (this.weekdayBehavior === 2) s === 0 && this.weekday !== 0 && (this.weekday = -6), this.weekday === 0 && s !== 0 && (this.weekday = 7), this.d -= s, this.d += this.weekday;
1633
- else {
1634
- let r = this.weekday - s;
1635
- (this.rd < 0 && r < 0 || this.rd >= 0 && r <= -this.weekdayBehavior) && (r += 7), this.weekday >= 0 ? this.d += r : this.d -= 7 - (Math.abs(this.weekday) - s), this.weekday = NaN;
1636
- }
1637
- }
1638
- this.y += this.ry, this.m += this.rm, this.d += this.rd, this.h += this.rh, this.i += this.ri, this.s += this.rs, this.f += this.rf, this.ry = this.rm = this.rd = 0, this.rh = this.ri = this.rs = this.rf = 0;
1639
- const t = new Date(n.getTime());
1640
- switch (t.setFullYear(this.y, this.m, this.d), t.setHours(this.h, this.i, this.s, this.f), this.firstOrLastDayOfMonth) {
1641
- case 1:
1642
- t.setDate(1);
1643
- break;
1644
- case -1:
1645
- t.setMonth(t.getMonth() + 1, 0);
1646
- }
1647
- 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;
1648
- } };
1649
- y.AbstractProvider = J, y.ArrayAdapter = Ae, y.ArrayProvider = class extends J {
1650
- getFunctions() {
1651
- return [ft, pt, mt];
1652
- }
1653
- }, y.BasicProvider = class extends J {
1654
- getFunctions() {
1655
- return [lt];
1656
- }
1657
- }, y.Compiler = Te, y.DateProvider = class extends J {
1658
- getFunctions() {
1659
- return [new N("date", function(n, t) {
1660
- let e = "";
1661
- return t && (e = `, ${t}`), `date(${n}${e})`;
1662
- }, function(n, t, e) {
1663
- return gt(t, e);
1664
- }), new N("strtotime", function(n, t) {
1665
- let e = "";
1666
- return t && (e = `, ${t}`), `strtotime(${n}${e})`;
1667
- }, function(n, t, e) {
1668
- return (function(s, r) {
1669
- const i = r ?? Math.floor(Date.now() / 1e3), a = [m.yesterday, m.now, m.noon, m.midnightOrToday, m.tomorrow, m.timestamp, m.firstOrLastDay, m.backOrFrontOf, m.timeTiny12, m.timeShort12, m.timeLong12, m.mssqltime, m.oracledate, m.timeShort24, m.timeLong24, m.iso8601long, m.gnuNoColon, m.iso8601noColon, m.americanShort, m.american, m.iso8601date4, m.iso8601dateSlash, m.dateSlash, m.gnuDateShortOrIso8601date2, m.gnuDateShorter, m.dateFull, m.pointedDate4, m.pointedDate2, m.dateNoDay, m.dateNoDayRev, m.dateTextual, m.dateNoYear, m.dateNoYearRev, m.dateNoColon, m.xmlRpc, m.xmlRpcNoColon, m.soap, m.wddx, m.exif, m.pgydotd, m.isoWeekDay, m.pgTextShort, m.pgTextReverse, m.clf, m.year4, m.ago, m.dayText, m.relativeTextWeek, m.relativeText, m.monthFullOrMonthAbbr, m.tzCorrection, m.tzAbbr, m.dateShortWithTimeShort12, m.dateShortWithTimeLong12, m.dateShortWithTimeShort, m.dateShortWithTimeLong, m.relative, m.whitespace], o = { ...wt };
1670
- for (; s.length; ) {
1671
- let l = null, d = null;
1672
- for (const f of a) {
1673
- const g = s.match(f.regex);
1674
- g && (!l || g[0].length > l[0].length) && (l = g, d = f);
1675
- }
1676
- if (!d || !l || d.callback && d.callback.apply(o, l) === !1) return !1;
1677
- s = s.substr(l[0].length), d = null, l = null;
1678
- }
1679
- return Math.floor(o.toDate(new Date(1e3 * i)).getTime() / 1e3);
1680
- })(t, e);
1681
- })];
1682
- }
1683
- }, y.ExpressionFunction = N, y.ExpressionLanguage = Oe, y.IGNORE_UNKNOWN_FUNCTIONS = 2, y.IGNORE_UNKNOWN_VARIABLES = 1, y.Parser = ke, y.StringProvider = class extends J {
1684
- getFunctions() {
1685
- return [new N("strtolower", (n) => "strtolower(" + n + ")", (n, t) => (function(e) {
1686
- return (e + "").toLowerCase();
1687
- })(t)), new N("strtoupper", (n) => "strtoupper(" + n + ")", (n, t) => (function(e) {
1688
- return (e + "").toUpperCase();
1689
- })(t)), new N("explode", (n, t, e = "null") => `explode(${n}, ${t}, ${e})`, (n, t, e, s = null) => (function(...r) {
1690
- let [i, a, o] = r, l = i;
1691
- const d = a;
1692
- if (r.length < 2 || l === void 0 || d === void 0) return null;
1693
- if (l === "" || l === !1 || l === null) return !1;
1694
- if (typeof l == "function" || typeof l == "object" || typeof d == "function" || typeof d == "object") return { 0: "" };
1695
- l === !0 && (l = "1");
1696
- const f = l + "", g = (d + "").split(f);
1697
- return o === void 0 ? g : (o === 0 && (o = 1), o > 0 ? o >= g.length ? g : g.slice(0, o - 1).concat([g.slice(o - 1).join(f)]) : -o >= g.length ? [] : (g.splice(g.length + o), g));
1698
- })(t, e, s)), new N("strlen", function(n) {
1699
- return `strlen(${n});`;
1700
- }, function(n, t) {
1701
- return (function(e) {
1702
- const s = e + "";
1703
- if ((Re("unicode.semantics") || "off") === "off") return s.length;
1704
- let r = 0, i = 0;
1705
- const a = function(o, l) {
1706
- const d = o.charCodeAt(l);
1707
- if (d >= 55296 && d <= 56319) {
1708
- if (o.length <= l + 1) throw new Error("High surrogate without following low surrogate");
1709
- const f = o.charCodeAt(l + 1);
1710
- if (f < 56320 || f > 57343) throw new Error("High surrogate without following low surrogate");
1711
- return o.charAt(l) + o.charAt(l + 1);
1712
- }
1713
- if (d >= 56320 && d <= 57343) {
1714
- if (l === 0) throw new Error("Low surrogate without preceding high surrogate");
1715
- const f = o.charCodeAt(l - 1);
1716
- if (f < 55296 || f > 56319) throw new Error("Low surrogate without preceding high surrogate");
1717
- return !1;
1718
- }
1719
- return o.charAt(l);
1720
- };
1721
- for (r = 0, i = 0; r < s.length; r++) a(s, r) !== !1 && i++;
1722
- return i;
1723
- })(t);
1724
- }), new N("strstr", function(n, t, e) {
1725
- let s = "";
1726
- return e && (s = `, ${e}`), `strstr(${n}, ${t}${s});`;
1727
- }, function(n, t, e, s) {
1728
- return (function(r, i, a) {
1729
- let o = 0;
1730
- return o = (r += "").indexOf(i), o !== -1 && (a ? r.substr(0, o) : r.slice(o));
1731
- })(t, e, s);
1732
- }), new N("stristr", function(n, t, e) {
1733
- let s = "";
1734
- return e && (s = `, ${e}`), `stristr(${n}, ${t}${s});`;
1735
- }, function(n, t, e, s) {
1736
- return (function(r, i, a) {
1737
- let o = 0;
1738
- return o = (r += "").toLowerCase().indexOf((i + "").toLowerCase()), o !== -1 && (a ? r.substr(0, o) : r.slice(o));
1739
- })(t, e, s);
1740
- }), new N("substr", function(n, t, e) {
1741
- let s = "";
1742
- return e && (s = `, ${e}`), `substr(${n}, ${t}${s});`;
1743
- }, function(n, t, e, s) {
1744
- return ct(t, e, s);
1745
- })];
1746
- }
1747
- }, y.default = Oe, y.tokenize = pe, Object.defineProperty(y, "__esModule", { value: !0 });
1748
- }), (function(y) {
1749
- var u = y.ExpressionLanguage;
1750
- if (u && typeof u.ExpressionLanguage == "function") {
1751
- var w = u.ExpressionLanguage;
1752
- Object.keys(u).forEach(function(x) {
1753
- x in w || (w[x] = u[x]);
1754
- }), y.ExpressionLanguage = w;
1755
- }
1756
- })(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : Ke);
1757
- })(ne, ne.exports)), ne.exports;
1758
- }
1759
- var Qe = Nt();
1760
- const kt = /* @__PURE__ */ vt(Qe), qe = /* @__PURE__ */ bt({
1761
- __proto__: null,
1762
- default: kt
1763
- }, [Qe]);
1764
- let Ze = null;
1765
- function Tt() {
1766
- const c = qe, p = c.ExpressionLanguage || c.default || qe;
1767
- if (typeof p != "function")
1768
- throw new TypeError("Unable to resolve expression-language constructor.");
1769
- return p;
1770
- }
1771
- function Et() {
1772
- return Ze ??= new (Tt())(), Ze;
1773
- }
1774
- function Ut(c) {
1775
- return (c.formula?.expression || c.formula?.formula || "").trim();
1776
- }
1777
- function It(c) {
1778
- return Object.entries(c.formula?.variables || {}).filter((p) => !!p[1]?.sourceKey);
1779
- }
1780
- function Lt(c, p) {
1781
- return Object.entries(c).forEach(([y, u]) => {
1782
- if (Array.isArray(u)) {
1783
- c[y] = u.map((w) => typeof w == "string" && w.trim() !== "" && !Number.isNaN(Number(w)) ? Number(w) : w);
1784
- return;
1785
- }
1786
- typeof u == "string" && u.trim() !== "" && !Number.isNaN(Number(u)) && (c[y] = Number(u));
1787
- }), c;
1788
- }
1789
- function At(c, p) {
1790
- if (p.formatting !== "number")
1791
- return typeof c == "number" || typeof c == "string" ? c : "";
1792
- let y = c;
1793
- Array.isArray(y) && (y = y.reduce((x, T) => x + Number(T || 0), 0));
1794
- const u = typeof p.decimals == "number" ? p.decimals : 0, w = Number(y || 0).toFixed(u);
1795
- return `${p.prefix || ""}${w}${p.suffix || ""}`;
1796
- }
1797
- function Yt(c, p) {
1798
- const y = c.type?.endsWith("\\Number");
1799
- return c.type?.endsWith("\\Checkboxes") ? Array.isArray(p) ? p.length ? p : "" : p ? [p] : "" : Array.isArray(p) ? p.length ? y ? p.map((u) => Number(u || 0)) : p : "" : y ? Number(p || 0) : p;
1800
- }
1801
- function $t(c, p, y) {
1802
- return At(Et().evaluate(c, p), y);
1803
- }
1804
- const Xe = (() => {
1805
- const c = Intl.Segmenter;
1806
- return c ? new c(void 0, { granularity: "grapheme" }) : null;
1807
- })(), Ot = /[\p{L}\p{N}\p{M}]+(?:['’._-][\p{L}\p{N}\p{M}]+)*/gu;
1808
- function St(c) {
1809
- return typeof DOMParser < "u" ? new DOMParser().parseFromString(c, "text/html").body.textContent || "" : c.replace(/<[^>]*>/g, " ");
1810
- }
1811
- function et(c) {
1812
- return St(c);
1813
- }
1814
- function Ct(c) {
1815
- return et(c).replace(/[\s\t\n\r]+/g, " ").trim();
1816
- }
1817
- function _t(c) {
1818
- return Xe ? Array.from(Xe.segment(c)).length : Array.from(c).length;
1819
- }
1820
- function Pt(c) {
1821
- return c.match(Ot)?.length || 0;
1822
- }
1823
- function Dt(c) {
1824
- const p = et(c), y = Ct(c);
1825
- return {
1826
- graphemeCount: _t(p),
1827
- wordCount: Pt(y)
1828
- };
1829
- }
1830
- export {
1831
- $t as $,
1832
- jt as A,
1833
- Lt as F,
1834
- Rt as S,
1835
- Yt as U,
1836
- It as _,
1837
- Ut as j,
1838
- Dt as z
1839
- };