@gomusdev/web-components 1.54.1 → 1.55.0
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.
|
@@ -3504,20 +3504,20 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
3504
3504
|
}
|
|
3505
3505
|
var branches = new BranchManager(node);
|
|
3506
3506
|
var flags2 = elseif ? EFFECT_TRANSPARENT : 0;
|
|
3507
|
-
function update_branch(
|
|
3507
|
+
function update_branch(condition2, fn2) {
|
|
3508
3508
|
if (hydrating) {
|
|
3509
3509
|
const is_else = read_hydration_instruction(node) === HYDRATION_START_ELSE;
|
|
3510
|
-
if (
|
|
3510
|
+
if (condition2 === is_else) {
|
|
3511
3511
|
var anchor = skip_nodes();
|
|
3512
3512
|
set_hydrate_node(anchor);
|
|
3513
3513
|
branches.anchor = anchor;
|
|
3514
3514
|
set_hydrating(false);
|
|
3515
|
-
branches.ensure(
|
|
3515
|
+
branches.ensure(condition2, fn2);
|
|
3516
3516
|
set_hydrating(true);
|
|
3517
3517
|
return;
|
|
3518
3518
|
}
|
|
3519
3519
|
}
|
|
3520
|
-
branches.ensure(
|
|
3520
|
+
branches.ensure(condition2, fn2);
|
|
3521
3521
|
}
|
|
3522
3522
|
block(() => {
|
|
3523
3523
|
var has_branch = false;
|
|
@@ -5633,7 +5633,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
5633
5633
|
const dsc = (a2, b) => getter(b) - getter(a2);
|
|
5634
5634
|
return array2.slice().sort(desc === true ? dsc : asc);
|
|
5635
5635
|
};
|
|
5636
|
-
function min$
|
|
5636
|
+
function min$2(array2, getter) {
|
|
5637
5637
|
const get2 = ((v) => v);
|
|
5638
5638
|
return boil(array2, (a2, b) => get2(a2) < get2(b) ? a2 : b);
|
|
5639
5639
|
}
|
|
@@ -5928,8 +5928,8 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
5928
5928
|
constructor(issues) {
|
|
5929
5929
|
super();
|
|
5930
5930
|
this.issues = [];
|
|
5931
|
-
this.addIssue = (
|
|
5932
|
-
this.issues = [...this.issues,
|
|
5931
|
+
this.addIssue = (sub2) => {
|
|
5932
|
+
this.issues = [...this.issues, sub2];
|
|
5933
5933
|
};
|
|
5934
5934
|
this.addIssues = (subs = []) => {
|
|
5935
5935
|
this.issues = [...this.issues, ...subs];
|
|
@@ -5999,12 +5999,12 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
5999
5999
|
flatten(mapper = (issue2) => issue2.message) {
|
|
6000
6000
|
const fieldErrors = {};
|
|
6001
6001
|
const formErrors = [];
|
|
6002
|
-
for (const
|
|
6003
|
-
if (
|
|
6004
|
-
fieldErrors[
|
|
6005
|
-
fieldErrors[
|
|
6002
|
+
for (const sub2 of this.issues) {
|
|
6003
|
+
if (sub2.path.length > 0) {
|
|
6004
|
+
fieldErrors[sub2.path[0]] = fieldErrors[sub2.path[0]] || [];
|
|
6005
|
+
fieldErrors[sub2.path[0]].push(mapper(sub2));
|
|
6006
6006
|
} else {
|
|
6007
|
-
formErrors.push(mapper(
|
|
6007
|
+
formErrors.push(mapper(sub2));
|
|
6008
6008
|
}
|
|
6009
6009
|
}
|
|
6010
6010
|
return { formErrors, fieldErrors };
|
|
@@ -10398,9 +10398,9 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
10398
10398
|
if (round2) {
|
|
10399
10399
|
value += Math.sign(amount);
|
|
10400
10400
|
if (value < min2) value = max2;
|
|
10401
|
-
let
|
|
10402
|
-
if (amount > 0) value = Math.ceil(value /
|
|
10403
|
-
else value = Math.floor(value /
|
|
10401
|
+
let div2 = Math.abs(amount);
|
|
10402
|
+
if (amount > 0) value = Math.ceil(value / div2) * div2;
|
|
10403
|
+
else value = Math.floor(value / div2) * div2;
|
|
10404
10404
|
if (value > max2) value = min2;
|
|
10405
10405
|
} else {
|
|
10406
10406
|
value += amount;
|
|
@@ -10561,12 +10561,12 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
10561
10561
|
return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date2)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date2)}`;
|
|
10562
10562
|
}
|
|
10563
10563
|
function $fae977aafc393c5c$var$offsetToString(offset2) {
|
|
10564
|
-
let
|
|
10564
|
+
let sign2 = Math.sign(offset2) < 0 ? "-" : "+";
|
|
10565
10565
|
offset2 = Math.abs(offset2);
|
|
10566
10566
|
let offsetHours = Math.floor(offset2 / 36e5);
|
|
10567
10567
|
let offsetMinutes = Math.floor(offset2 % 36e5 / 6e4);
|
|
10568
10568
|
let offsetSeconds = Math.floor(offset2 % 36e5 % 6e4 / 1e3);
|
|
10569
|
-
let stringOffset = `${
|
|
10569
|
+
let stringOffset = `${sign2}${String(offsetHours).padStart(2, "0")}:${String(offsetMinutes).padStart(2, "0")}`;
|
|
10570
10570
|
if (offsetSeconds !== 0) stringOffset += `:${String(offsetSeconds).padStart(2, "0")}`;
|
|
10571
10571
|
return stringOffset;
|
|
10572
10572
|
}
|
|
@@ -11147,11 +11147,11 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
11147
11147
|
);
|
|
11148
11148
|
},
|
|
11149
11149
|
ticketCapacity(ticketId, timeslot) {
|
|
11150
|
-
const minCap = min$
|
|
11150
|
+
const minCap = min$2(this.filterBy({ timeslot, ticketId }).map((x) => x.capacity)) ?? 0;
|
|
11151
11151
|
return minCap + this.getPrecartItemQuantity(ticketId);
|
|
11152
11152
|
},
|
|
11153
11153
|
totalCapacity(ticketId, timeslot) {
|
|
11154
|
-
const totalCap = min$
|
|
11154
|
+
const totalCap = min$2(this.filterBy({ timeslot, ticketId }).map((x) => x.totalCapacity)) ?? 0;
|
|
11155
11155
|
return totalCap;
|
|
11156
11156
|
},
|
|
11157
11157
|
timeslotsOn(date2) {
|
|
@@ -11327,11 +11327,6 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
11327
11327
|
localStorage.setItem("go-cart", content);
|
|
11328
11328
|
});
|
|
11329
11329
|
});
|
|
11330
|
-
window.addEventListener("storage", (event2) => {
|
|
11331
|
-
if (event2.key !== "go-cart") return;
|
|
11332
|
-
lastWritten = localStorage.getItem("go-cart") ?? "";
|
|
11333
|
-
loadFromLocalStorage$1(cart);
|
|
11334
|
-
});
|
|
11335
11330
|
}
|
|
11336
11331
|
const inTheFuture = (time2) => {
|
|
11337
11332
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -12615,8 +12610,21 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
12615
12610
|
checkout(params) {
|
|
12616
12611
|
return this.apiPost(`/api/v4/orders`, { body: params, requiredFields: ["items", "total"] });
|
|
12617
12612
|
}
|
|
12613
|
+
// Single-slot memo: dedupes identical /api/v4/cart projections across multiple
|
|
12614
|
+
// <go-cart> instances and back-to-back effect runs so the endpoint's rate
|
|
12615
|
+
// limit is not hit by a page that mounts several cart views.
|
|
12616
|
+
#cartProjectionCache = null;
|
|
12618
12617
|
createCart(params) {
|
|
12619
|
-
|
|
12618
|
+
const key = JSON.stringify({ items: params.items ?? [], coupons: params.coupons ?? [] });
|
|
12619
|
+
if (this.#cartProjectionCache?.key === key) {
|
|
12620
|
+
return this.#cartProjectionCache.promise;
|
|
12621
|
+
}
|
|
12622
|
+
const promise = this.apiPost(`/api/v4/cart`, { body: params, requiredFields: ["items"] }).catch((err2) => {
|
|
12623
|
+
if (this.#cartProjectionCache?.key === key) this.#cartProjectionCache = null;
|
|
12624
|
+
throw err2;
|
|
12625
|
+
});
|
|
12626
|
+
this.#cartProjectionCache = { key, promise };
|
|
12627
|
+
return promise;
|
|
12620
12628
|
}
|
|
12621
12629
|
order(token) {
|
|
12622
12630
|
return this.fetchAndCache("/api/v4/orders/{id}", `order-${token}`, "order", { path: { id: token } });
|
|
@@ -13266,12 +13274,12 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
13266
13274
|
function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
13267
13275
|
const fieldErrors = {};
|
|
13268
13276
|
const formErrors = [];
|
|
13269
|
-
for (const
|
|
13270
|
-
if (
|
|
13271
|
-
fieldErrors[
|
|
13272
|
-
fieldErrors[
|
|
13277
|
+
for (const sub2 of error.issues) {
|
|
13278
|
+
if (sub2.path.length > 0) {
|
|
13279
|
+
fieldErrors[sub2.path[0]] = fieldErrors[sub2.path[0]] || [];
|
|
13280
|
+
fieldErrors[sub2.path[0]].push(mapper(sub2));
|
|
13273
13281
|
} else {
|
|
13274
|
-
formErrors.push(mapper(
|
|
13282
|
+
formErrors.push(mapper(sub2));
|
|
13275
13283
|
}
|
|
13276
13284
|
}
|
|
13277
13285
|
return { formErrors, fieldErrors };
|
|
@@ -16954,7 +16962,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16954
16962
|
push($$props, true);
|
|
16955
16963
|
let displayItem = prop($$props, "displayItem", 7), displayCart = prop($$props, "displayCart", 7), mainCart = prop($$props, "mainCart", 7), preview = prop($$props, "preview", 7);
|
|
16956
16964
|
let capacity = /* @__PURE__ */ state(void 0);
|
|
16957
|
-
const itemInMaincart = /* @__PURE__ */ user_derived(() => mainCart().items.find((item) => item.uuid === displayItem().display?.reference_uuid));
|
|
16965
|
+
const itemInMaincart = /* @__PURE__ */ user_derived(() => mainCart().items.find((item) => item.uuid === (displayItem().display?.reference_uuid ?? displayItem().uuid)));
|
|
16958
16966
|
const emptyCart = createCart();
|
|
16959
16967
|
user_effect(() => {
|
|
16960
16968
|
mainCart().items.map((i) => i.quantity);
|
|
@@ -17242,8 +17250,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17242
17250
|
get$2(cart).items.map((i) => i.uuid + ":" + i.quantity + ":" + i.time);
|
|
17243
17251
|
get$2(cart).coupons.join("|");
|
|
17244
17252
|
const currentRequest = ++requestId;
|
|
17245
|
-
if (get$2(cart).items.length === 0) {
|
|
17253
|
+
if (get$2(cart).items.length === 0 || get$2(cart).coupons.length === 0) {
|
|
17246
17254
|
set(displayCart, get$2(cart), true);
|
|
17255
|
+
set(appliedCoupons, /* @__PURE__ */ new Set(), true);
|
|
17247
17256
|
return;
|
|
17248
17257
|
}
|
|
17249
17258
|
void (async () => {
|
|
@@ -17611,15 +17620,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17611
17620
|
flushSync();
|
|
17612
17621
|
}
|
|
17613
17622
|
};
|
|
17614
|
-
var
|
|
17623
|
+
var div2 = root$9();
|
|
17615
17624
|
let classes;
|
|
17616
|
-
|
|
17617
|
-
|
|
17625
|
+
div2.__click = () => goDonation.selectCampaign(campaign());
|
|
17626
|
+
div2.__keydown = (e) => {
|
|
17618
17627
|
if (e.key === "Enter") {
|
|
17619
17628
|
goDonation.selectCampaign(campaign());
|
|
17620
17629
|
}
|
|
17621
17630
|
};
|
|
17622
|
-
var div_1 = child(
|
|
17631
|
+
var div_1 = child(div2);
|
|
17623
17632
|
var node = child(div_1);
|
|
17624
17633
|
{
|
|
17625
17634
|
var consequent = ($$anchor2) => {
|
|
@@ -17642,13 +17651,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17642
17651
|
var text_1 = child(p_1, true);
|
|
17643
17652
|
reset(p_1);
|
|
17644
17653
|
reset(div_2);
|
|
17645
|
-
reset(
|
|
17654
|
+
reset(div2);
|
|
17646
17655
|
template_effect(() => {
|
|
17647
|
-
classes = set_class(
|
|
17656
|
+
classes = set_class(div2, 1, "go-donation-campaign", null, classes, { selected: goDonation.campaign?.id === campaign()?.id });
|
|
17648
17657
|
set_text(text2, get$2(translations)["donations.headline"]);
|
|
17649
17658
|
set_text(text_1, get$2(translations)["donations.shop.info"]);
|
|
17650
17659
|
});
|
|
17651
|
-
append($$anchor,
|
|
17660
|
+
append($$anchor, div2);
|
|
17652
17661
|
return pop($$exports);
|
|
17653
17662
|
}
|
|
17654
17663
|
delegate(["click", "keydown"]);
|
|
@@ -17699,8 +17708,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17699
17708
|
form.reportValidity();
|
|
17700
17709
|
}
|
|
17701
17710
|
}
|
|
17702
|
-
var
|
|
17703
|
-
var h3 = child(
|
|
17711
|
+
var div2 = root$8();
|
|
17712
|
+
var h3 = child(div2);
|
|
17704
17713
|
var text2 = child(h3, true);
|
|
17705
17714
|
reset(h3);
|
|
17706
17715
|
var div_1 = sibling(h3, 2);
|
|
@@ -17751,9 +17760,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17751
17760
|
if (goDonation.campaign?.free_donations) $$render(consequent);
|
|
17752
17761
|
});
|
|
17753
17762
|
}
|
|
17754
|
-
reset(
|
|
17763
|
+
reset(div2);
|
|
17755
17764
|
template_effect(($0) => set_text(text2, $0), [() => shop.t("donations.selection.title")]);
|
|
17756
|
-
append($$anchor,
|
|
17765
|
+
append($$anchor, div2);
|
|
17757
17766
|
pop();
|
|
17758
17767
|
}
|
|
17759
17768
|
delegate(["click", "input"]);
|
|
@@ -17771,8 +17780,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17771
17780
|
var node = first_child(fragment);
|
|
17772
17781
|
{
|
|
17773
17782
|
var consequent_1 = ($$anchor2) => {
|
|
17774
|
-
var
|
|
17775
|
-
var node_1 = child(
|
|
17783
|
+
var div2 = root_1$e();
|
|
17784
|
+
var node_1 = child(div2);
|
|
17776
17785
|
each(node_1, 1, () => shop?.donations?.campaigns, (campaign) => campaign.id, ($$anchor3, campaign) => {
|
|
17777
17786
|
DonationCampaign($$anchor3, {
|
|
17778
17787
|
get campaign() {
|
|
@@ -17803,7 +17812,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17803
17812
|
var text_1 = child(button_1, true);
|
|
17804
17813
|
reset(button_1);
|
|
17805
17814
|
reset(div_1);
|
|
17806
|
-
reset(
|
|
17815
|
+
reset(div2);
|
|
17807
17816
|
template_effect(
|
|
17808
17817
|
($0, $1) => {
|
|
17809
17818
|
set_text(text2, $0);
|
|
@@ -17815,7 +17824,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17815
17824
|
() => shop.t("donations.actions.addToCart")
|
|
17816
17825
|
]
|
|
17817
17826
|
);
|
|
17818
|
-
append($$anchor2,
|
|
17827
|
+
append($$anchor2, div2);
|
|
17819
17828
|
};
|
|
17820
17829
|
if_block(node, ($$render) => {
|
|
17821
17830
|
if (shop.donations && shop.donations.campaigns) $$render(consequent_1);
|
|
@@ -18777,7 +18786,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18777
18786
|
function isShadowRoot$1(node) {
|
|
18778
18787
|
return isNode$1(node) && node.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in node;
|
|
18779
18788
|
}
|
|
18780
|
-
function contains(parent, child2) {
|
|
18789
|
+
function contains$1(parent, child2) {
|
|
18781
18790
|
if (!parent || !child2)
|
|
18782
18791
|
return false;
|
|
18783
18792
|
if (!isHTMLElement$2(parent) || !isHTMLElement$2(child2))
|
|
@@ -18898,17 +18907,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18898
18907
|
}
|
|
18899
18908
|
};
|
|
18900
18909
|
}
|
|
18901
|
-
function boolToStr(
|
|
18902
|
-
return
|
|
18910
|
+
function boolToStr(condition2) {
|
|
18911
|
+
return condition2 ? "true" : "false";
|
|
18903
18912
|
}
|
|
18904
|
-
function boolToStrTrueOrUndef(
|
|
18905
|
-
return
|
|
18913
|
+
function boolToStrTrueOrUndef(condition2) {
|
|
18914
|
+
return condition2 ? "true" : void 0;
|
|
18906
18915
|
}
|
|
18907
|
-
function boolToEmptyStrOrUndef(
|
|
18908
|
-
return
|
|
18916
|
+
function boolToEmptyStrOrUndef(condition2) {
|
|
18917
|
+
return condition2 ? "" : void 0;
|
|
18909
18918
|
}
|
|
18910
|
-
function getDataOpenClosed(
|
|
18911
|
-
return
|
|
18919
|
+
function getDataOpenClosed(condition2) {
|
|
18920
|
+
return condition2 ? "open" : "closed";
|
|
18912
18921
|
}
|
|
18913
18922
|
class BitsAttrs {
|
|
18914
18923
|
#variant;
|
|
@@ -20243,7 +20252,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20243
20252
|
const node = this.opts.ref.current;
|
|
20244
20253
|
const target = e.target;
|
|
20245
20254
|
if (!isHTMLElement$1(node) || !isHTMLElement$1(target) || !this.opts.enabled.current) return;
|
|
20246
|
-
if (!isHighestLayer(this) || !contains(node, target)) return;
|
|
20255
|
+
if (!isHighestLayer(this) || !contains$1(node, target)) return;
|
|
20247
20256
|
this.opts.onPointerDown.current(e);
|
|
20248
20257
|
if (e.defaultPrevented) return;
|
|
20249
20258
|
this.#unsubSelectionLock = preventTextSelectionOverflow(node, this.domContext.getDocument().body);
|
|
@@ -20559,12 +20568,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20559
20568
|
return log;
|
|
20560
20569
|
};
|
|
20561
20570
|
if (!isHTMLElement$1(el)) {
|
|
20562
|
-
const
|
|
20563
|
-
|
|
20564
|
-
|
|
20565
|
-
|
|
20566
|
-
|
|
20567
|
-
el =
|
|
20571
|
+
const div2 = doc.createElement("div");
|
|
20572
|
+
div2.style.cssText = srOnlyStylesString;
|
|
20573
|
+
div2.setAttribute("data-bits-announcer", "");
|
|
20574
|
+
div2.appendChild(createLog("assertive"));
|
|
20575
|
+
div2.appendChild(createLog("polite"));
|
|
20576
|
+
el = div2;
|
|
20568
20577
|
doc.body.insertBefore(el, doc.body.firstChild);
|
|
20569
20578
|
}
|
|
20570
20579
|
const getLog = (kind) => {
|
|
@@ -21194,13 +21203,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21194
21203
|
const valueString = formatter.selectedDate(value);
|
|
21195
21204
|
const el = doc.getElementById(id);
|
|
21196
21205
|
if (!el) {
|
|
21197
|
-
const
|
|
21198
|
-
|
|
21206
|
+
const div2 = doc.createElement("div");
|
|
21207
|
+
div2.style.cssText = styleToString({
|
|
21199
21208
|
display: "none"
|
|
21200
21209
|
});
|
|
21201
|
-
|
|
21202
|
-
|
|
21203
|
-
doc.body.appendChild(
|
|
21210
|
+
div2.id = id;
|
|
21211
|
+
div2.innerText = `Selected Date: ${valueString}`;
|
|
21212
|
+
doc.body.appendChild(div2);
|
|
21204
21213
|
} else {
|
|
21205
21214
|
el.innerText = `Selected Date: ${valueString}`;
|
|
21206
21215
|
}
|
|
@@ -21470,7 +21479,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21470
21479
|
}
|
|
21471
21480
|
function shiftCalendarFocus({
|
|
21472
21481
|
node,
|
|
21473
|
-
add,
|
|
21482
|
+
add: add2,
|
|
21474
21483
|
placeholder,
|
|
21475
21484
|
calendarNode,
|
|
21476
21485
|
isPrevButtonDisabled,
|
|
@@ -21481,7 +21490,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21481
21490
|
const candidateCells = getSelectableCells(calendarNode);
|
|
21482
21491
|
if (!candidateCells.length) return;
|
|
21483
21492
|
const index2 = candidateCells.indexOf(node);
|
|
21484
|
-
const nextIndex = index2 +
|
|
21493
|
+
const nextIndex = index2 + add2;
|
|
21485
21494
|
if (isValidIndex(nextIndex, candidateCells)) {
|
|
21486
21495
|
const nextCell = candidateCells[nextIndex];
|
|
21487
21496
|
setPlaceholderToNodeValue(nextCell, placeholder);
|
|
@@ -21538,9 +21547,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21538
21547
|
[ARROW_RIGHT]: 1
|
|
21539
21548
|
};
|
|
21540
21549
|
if (ARROW_KEYS.includes(event2.key)) {
|
|
21541
|
-
const
|
|
21542
|
-
if (
|
|
21543
|
-
shiftFocus(currentCell,
|
|
21550
|
+
const add2 = kbdFocusMap[event2.key];
|
|
21551
|
+
if (add2 !== void 0) {
|
|
21552
|
+
shiftFocus(currentCell, add2);
|
|
21544
21553
|
}
|
|
21545
21554
|
}
|
|
21546
21555
|
if (SELECT_KEYS.includes(event2.key)) {
|
|
@@ -21626,8 +21635,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21626
21635
|
}
|
|
21627
21636
|
function createAccessibleHeading({ calendarNode, label, accessibleHeadingId }) {
|
|
21628
21637
|
const doc = getDocument(calendarNode);
|
|
21629
|
-
const
|
|
21630
|
-
|
|
21638
|
+
const div2 = doc.createElement("div");
|
|
21639
|
+
div2.style.cssText = styleToString({
|
|
21631
21640
|
border: "0px",
|
|
21632
21641
|
clip: "rect(0px, 0px, 0px, 0px)",
|
|
21633
21642
|
clipPath: "inset(50%)",
|
|
@@ -21644,12 +21653,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
21644
21653
|
h2.id = accessibleHeadingId;
|
|
21645
21654
|
h2.role = "heading";
|
|
21646
21655
|
h2.ariaLevel = "2";
|
|
21647
|
-
calendarNode.insertBefore(
|
|
21648
|
-
|
|
21656
|
+
calendarNode.insertBefore(div2, calendarNode.firstChild);
|
|
21657
|
+
div2.appendChild(h2);
|
|
21649
21658
|
return () => {
|
|
21650
21659
|
const h22 = doc.getElementById(accessibleHeadingId);
|
|
21651
21660
|
if (!h22) return;
|
|
21652
|
-
|
|
21661
|
+
div2.parentElement?.removeChild(div2);
|
|
21653
21662
|
h22.remove();
|
|
21654
21663
|
};
|
|
21655
21664
|
}
|
|
@@ -22128,10 +22137,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22128
22137
|
}
|
|
22129
22138
|
return $14e0f24ef4ac5c92$export$ea39ec197993aef0(value, date2);
|
|
22130
22139
|
}
|
|
22131
|
-
shiftFocus(node,
|
|
22140
|
+
shiftFocus(node, add2) {
|
|
22132
22141
|
return shiftCalendarFocus({
|
|
22133
22142
|
node,
|
|
22134
|
-
add,
|
|
22143
|
+
add: add2,
|
|
22135
22144
|
placeholder: this.opts.placeholder,
|
|
22136
22145
|
calendarNode: this.opts.ref.current,
|
|
22137
22146
|
isPrevButtonDisabled: this.isPrevButtonDisabled,
|
|
@@ -23007,12 +23016,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23007
23016
|
append($$anchor2, fragment_1);
|
|
23008
23017
|
};
|
|
23009
23018
|
var alternate = ($$anchor2) => {
|
|
23010
|
-
var
|
|
23011
|
-
attribute_effect(
|
|
23012
|
-
var node_2 = child(
|
|
23019
|
+
var div2 = root_2$n();
|
|
23020
|
+
attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
|
|
23021
|
+
var node_2 = child(div2);
|
|
23013
23022
|
snippet(node_2, () => children() ?? noop$1, () => rootState.snippetProps);
|
|
23014
|
-
reset(
|
|
23015
|
-
append($$anchor2,
|
|
23023
|
+
reset(div2);
|
|
23024
|
+
append($$anchor2, div2);
|
|
23016
23025
|
};
|
|
23017
23026
|
if_block(node, ($$render) => {
|
|
23018
23027
|
if (child$1()) $$render(consequent);
|
|
@@ -23120,9 +23129,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23120
23129
|
append($$anchor2, fragment_1);
|
|
23121
23130
|
};
|
|
23122
23131
|
var alternate_1 = ($$anchor2) => {
|
|
23123
|
-
var
|
|
23124
|
-
attribute_effect(
|
|
23125
|
-
var node_2 = child(
|
|
23132
|
+
var div2 = root_2$m();
|
|
23133
|
+
attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
|
|
23134
|
+
var node_2 = child(div2);
|
|
23126
23135
|
{
|
|
23127
23136
|
var consequent_1 = ($$anchor3) => {
|
|
23128
23137
|
var fragment_2 = comment();
|
|
@@ -23140,8 +23149,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23140
23149
|
else $$render(alternate, false);
|
|
23141
23150
|
});
|
|
23142
23151
|
}
|
|
23143
|
-
reset(
|
|
23144
|
-
append($$anchor2,
|
|
23152
|
+
reset(div2);
|
|
23153
|
+
append($$anchor2, div2);
|
|
23145
23154
|
};
|
|
23146
23155
|
if_block(node, ($$render) => {
|
|
23147
23156
|
if (child$1()) $$render(consequent);
|
|
@@ -23773,9 +23782,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23773
23782
|
append($$anchor2, fragment_1);
|
|
23774
23783
|
};
|
|
23775
23784
|
var alternate_1 = ($$anchor2) => {
|
|
23776
|
-
var
|
|
23777
|
-
attribute_effect(
|
|
23778
|
-
var node_2 = child(
|
|
23785
|
+
var div2 = root_2$e();
|
|
23786
|
+
attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
|
|
23787
|
+
var node_2 = child(div2);
|
|
23779
23788
|
{
|
|
23780
23789
|
var consequent_1 = ($$anchor3) => {
|
|
23781
23790
|
var fragment_2 = comment();
|
|
@@ -23793,8 +23802,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23793
23802
|
else $$render(alternate, false);
|
|
23794
23803
|
});
|
|
23795
23804
|
}
|
|
23796
|
-
reset(
|
|
23797
|
-
append($$anchor2,
|
|
23805
|
+
reset(div2);
|
|
23806
|
+
append($$anchor2, div2);
|
|
23798
23807
|
};
|
|
23799
23808
|
if_block(node, ($$render) => {
|
|
23800
23809
|
if (child$1()) $$render(consequent);
|
|
@@ -24014,8 +24023,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24014
24023
|
}
|
|
24015
24024
|
create_custom_element(Hidden_input, { value: {} }, [], [], { mode: "open" });
|
|
24016
24025
|
const sides = ["top", "right", "bottom", "left"];
|
|
24017
|
-
const min = Math.min;
|
|
24018
|
-
const max = Math.max;
|
|
24026
|
+
const min$1 = Math.min;
|
|
24027
|
+
const max$1 = Math.max;
|
|
24019
24028
|
const round = Math.round;
|
|
24020
24029
|
const floor = Math.floor;
|
|
24021
24030
|
const createCoords = (v) => ({
|
|
@@ -24033,9 +24042,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24033
24042
|
end: "start"
|
|
24034
24043
|
};
|
|
24035
24044
|
function clamp(start, value, end) {
|
|
24036
|
-
return max(start, min(value, end));
|
|
24045
|
+
return max$1(start, min$1(value, end));
|
|
24037
24046
|
}
|
|
24038
|
-
function evaluate(value, param) {
|
|
24047
|
+
function evaluate$1(value, param) {
|
|
24039
24048
|
return typeof value === "function" ? value(param) : value;
|
|
24040
24049
|
}
|
|
24041
24050
|
function getSide$1(placement) {
|
|
@@ -24217,7 +24226,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24217
24226
|
elementContext = "floating",
|
|
24218
24227
|
altBoundary = false,
|
|
24219
24228
|
padding = 0
|
|
24220
|
-
} = evaluate(options, state2);
|
|
24229
|
+
} = evaluate$1(options, state2);
|
|
24221
24230
|
const paddingObject = getPaddingObject(padding);
|
|
24222
24231
|
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
24223
24232
|
const element = elements[altBoundary ? altContext : elementContext];
|
|
@@ -24357,7 +24366,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24357
24366
|
const {
|
|
24358
24367
|
element,
|
|
24359
24368
|
padding = 0
|
|
24360
|
-
} = evaluate(options, state2) || {};
|
|
24369
|
+
} = evaluate$1(options, state2) || {};
|
|
24361
24370
|
if (element == null) {
|
|
24362
24371
|
return {};
|
|
24363
24372
|
}
|
|
@@ -24382,14 +24391,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24382
24391
|
}
|
|
24383
24392
|
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
24384
24393
|
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
24385
|
-
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
24386
|
-
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
24387
|
-
const min$
|
|
24394
|
+
const minPadding = min$1(paddingObject[minProp], largestPossiblePadding);
|
|
24395
|
+
const maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding);
|
|
24396
|
+
const min$1$1 = minPadding;
|
|
24388
24397
|
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
24389
24398
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
24390
|
-
const offset2 = clamp(min$
|
|
24391
|
-
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$
|
|
24392
|
-
const alignmentOffset = shouldAddOffset ? center < min$
|
|
24399
|
+
const offset2 = clamp(min$1$1, center, max2);
|
|
24400
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
24401
|
+
const alignmentOffset = shouldAddOffset ? center < min$1$1 ? center - min$1$1 : center - max2 : 0;
|
|
24393
24402
|
return {
|
|
24394
24403
|
[axis]: coords[axis] + alignmentOffset,
|
|
24395
24404
|
data: {
|
|
@@ -24428,7 +24437,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24428
24437
|
fallbackAxisSideDirection = "none",
|
|
24429
24438
|
flipAlignment = true,
|
|
24430
24439
|
...detectOverflowOptions
|
|
24431
|
-
} = evaluate(options, state2);
|
|
24440
|
+
} = evaluate$1(options, state2);
|
|
24432
24441
|
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
24433
24442
|
return {};
|
|
24434
24443
|
}
|
|
@@ -24538,7 +24547,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24538
24547
|
const {
|
|
24539
24548
|
strategy = "referenceHidden",
|
|
24540
24549
|
...detectOverflowOptions
|
|
24541
|
-
} = evaluate(options, state2);
|
|
24550
|
+
} = evaluate$1(options, state2);
|
|
24542
24551
|
switch (strategy) {
|
|
24543
24552
|
case "referenceHidden": {
|
|
24544
24553
|
const overflow = await platform2.detectOverflow(state2, {
|
|
@@ -24586,7 +24595,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24586
24595
|
const isVertical = getSideAxis(placement) === "y";
|
|
24587
24596
|
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
24588
24597
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
24589
|
-
const rawValue = evaluate(options, state2);
|
|
24598
|
+
const rawValue = evaluate$1(options, state2);
|
|
24590
24599
|
let {
|
|
24591
24600
|
mainAxis,
|
|
24592
24601
|
crossAxis,
|
|
@@ -24671,7 +24680,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24671
24680
|
}
|
|
24672
24681
|
},
|
|
24673
24682
|
...detectOverflowOptions
|
|
24674
|
-
} = evaluate(options, state2);
|
|
24683
|
+
} = evaluate$1(options, state2);
|
|
24675
24684
|
const coords = {
|
|
24676
24685
|
x,
|
|
24677
24686
|
y
|
|
@@ -24732,7 +24741,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24732
24741
|
offset: offset2 = 0,
|
|
24733
24742
|
mainAxis: checkMainAxis = true,
|
|
24734
24743
|
crossAxis: checkCrossAxis = true
|
|
24735
|
-
} = evaluate(options, state2);
|
|
24744
|
+
} = evaluate$1(options, state2);
|
|
24736
24745
|
const coords = {
|
|
24737
24746
|
x,
|
|
24738
24747
|
y
|
|
@@ -24741,7 +24750,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24741
24750
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
24742
24751
|
let mainAxisCoord = coords[mainAxis];
|
|
24743
24752
|
let crossAxisCoord = coords[crossAxis];
|
|
24744
|
-
const rawOffset = evaluate(offset2, state2);
|
|
24753
|
+
const rawOffset = evaluate$1(offset2, state2);
|
|
24745
24754
|
const computedOffset = typeof rawOffset === "number" ? {
|
|
24746
24755
|
mainAxis: rawOffset,
|
|
24747
24756
|
crossAxis: 0
|
|
@@ -24798,7 +24807,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24798
24807
|
apply = () => {
|
|
24799
24808
|
},
|
|
24800
24809
|
...detectOverflowOptions
|
|
24801
|
-
} = evaluate(options, state2);
|
|
24810
|
+
} = evaluate$1(options, state2);
|
|
24802
24811
|
const overflow = await platform2.detectOverflow(state2, detectOverflowOptions);
|
|
24803
24812
|
const side = getSide$1(placement);
|
|
24804
24813
|
const alignment = getAlignment(placement);
|
|
@@ -24818,8 +24827,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24818
24827
|
}
|
|
24819
24828
|
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
24820
24829
|
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
24821
|
-
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
24822
|
-
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
24830
|
+
const overflowAvailableHeight = min$1(height - overflow[heightSide], maximumClippingHeight);
|
|
24831
|
+
const overflowAvailableWidth = min$1(width - overflow[widthSide], maximumClippingWidth);
|
|
24823
24832
|
const noShift = !state2.middlewareData.shift;
|
|
24824
24833
|
let availableHeight = overflowAvailableHeight;
|
|
24825
24834
|
let availableWidth = overflowAvailableWidth;
|
|
@@ -24830,14 +24839,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
24830
24839
|
availableHeight = maximumClippingHeight;
|
|
24831
24840
|
}
|
|
24832
24841
|
if (noShift && !alignment) {
|
|
24833
|
-
const xMin = max(overflow.left, 0);
|
|
24834
|
-
const xMax = max(overflow.right, 0);
|
|
24835
|
-
const yMin = max(overflow.top, 0);
|
|
24836
|
-
const yMax = max(overflow.bottom, 0);
|
|
24842
|
+
const xMin = max$1(overflow.left, 0);
|
|
24843
|
+
const xMax = max$1(overflow.right, 0);
|
|
24844
|
+
const yMin = max$1(overflow.top, 0);
|
|
24845
|
+
const yMax = max$1(overflow.bottom, 0);
|
|
24837
24846
|
if (isYAxis) {
|
|
24838
|
-
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
24847
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right));
|
|
24839
24848
|
} else {
|
|
24840
|
-
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
24849
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom));
|
|
24841
24850
|
}
|
|
24842
24851
|
}
|
|
24843
24852
|
await apply({
|
|
@@ -25187,12 +25196,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25187
25196
|
const html2 = getDocumentElement(element);
|
|
25188
25197
|
const scroll = getNodeScroll(element);
|
|
25189
25198
|
const body = element.ownerDocument.body;
|
|
25190
|
-
const width = max(html2.scrollWidth, html2.clientWidth, body.scrollWidth, body.clientWidth);
|
|
25191
|
-
const height = max(html2.scrollHeight, html2.clientHeight, body.scrollHeight, body.clientHeight);
|
|
25199
|
+
const width = max$1(html2.scrollWidth, html2.clientWidth, body.scrollWidth, body.clientWidth);
|
|
25200
|
+
const height = max$1(html2.scrollHeight, html2.clientHeight, body.scrollHeight, body.clientHeight);
|
|
25192
25201
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
25193
25202
|
const y = -scroll.scrollTop;
|
|
25194
25203
|
if (getComputedStyle$1(body).direction === "rtl") {
|
|
25195
|
-
x += max(html2.clientWidth, body.clientWidth) - width;
|
|
25204
|
+
x += max$1(html2.clientWidth, body.clientWidth) - width;
|
|
25196
25205
|
}
|
|
25197
25206
|
return {
|
|
25198
25207
|
width,
|
|
@@ -25320,10 +25329,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25320
25329
|
const firstClippingAncestor = clippingAncestors[0];
|
|
25321
25330
|
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
25322
25331
|
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
25323
|
-
accRect.top = max(rect.top, accRect.top);
|
|
25324
|
-
accRect.right = min(rect.right, accRect.right);
|
|
25325
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
25326
|
-
accRect.left = max(rect.left, accRect.left);
|
|
25332
|
+
accRect.top = max$1(rect.top, accRect.top);
|
|
25333
|
+
accRect.right = min$1(rect.right, accRect.right);
|
|
25334
|
+
accRect.bottom = min$1(rect.bottom, accRect.bottom);
|
|
25335
|
+
accRect.left = max$1(rect.left, accRect.left);
|
|
25327
25336
|
return accRect;
|
|
25328
25337
|
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
25329
25338
|
return {
|
|
@@ -25491,7 +25500,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25491
25500
|
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
25492
25501
|
const options = {
|
|
25493
25502
|
rootMargin,
|
|
25494
|
-
threshold: max(0, min(1, threshold)) || 1
|
|
25503
|
+
threshold: max$1(0, min$1(1, threshold)) || 1
|
|
25495
25504
|
};
|
|
25496
25505
|
let isFirstUpdate = true;
|
|
25497
25506
|
function handleObserve(entries) {
|
|
@@ -29294,12 +29303,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29294
29303
|
append($$anchor2, fragment_1);
|
|
29295
29304
|
};
|
|
29296
29305
|
var alternate = ($$anchor2) => {
|
|
29297
|
-
var
|
|
29298
|
-
attribute_effect(
|
|
29299
|
-
var node_2 = child(
|
|
29306
|
+
var div2 = root_2$a();
|
|
29307
|
+
attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
|
|
29308
|
+
var node_2 = child(div2);
|
|
29300
29309
|
snippet(node_2, () => children() ?? noop$1, () => ({ segments: inputState.root.segmentContents }));
|
|
29301
|
-
reset(
|
|
29302
|
-
append($$anchor2,
|
|
29310
|
+
reset(div2);
|
|
29311
|
+
append($$anchor2, div2);
|
|
29303
29312
|
};
|
|
29304
29313
|
if_block(node, ($$render) => {
|
|
29305
29314
|
if (child$1()) $$render(consequent);
|
|
@@ -29371,12 +29380,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
29371
29380
|
append($$anchor2, fragment_1);
|
|
29372
29381
|
};
|
|
29373
29382
|
var alternate = ($$anchor2) => {
|
|
29374
|
-
var
|
|
29375
|
-
attribute_effect(
|
|
29376
|
-
var node_2 = child(
|
|
29383
|
+
var div2 = root_2$9();
|
|
29384
|
+
attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
|
|
29385
|
+
var node_2 = child(div2);
|
|
29377
29386
|
snippet(node_2, () => children() ?? noop$1);
|
|
29378
|
-
reset(
|
|
29379
|
-
append($$anchor2,
|
|
29387
|
+
reset(div2);
|
|
29388
|
+
append($$anchor2, div2);
|
|
29380
29389
|
};
|
|
29381
29390
|
if_block(node, ($$render) => {
|
|
29382
29391
|
if (child$1()) $$render(consequent);
|
|
@@ -30574,12 +30583,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
30574
30583
|
append($$anchor2, fragment_1);
|
|
30575
30584
|
};
|
|
30576
30585
|
var alternate = ($$anchor2) => {
|
|
30577
|
-
var
|
|
30578
|
-
attribute_effect(
|
|
30579
|
-
var node_2 = child(
|
|
30586
|
+
var div2 = root_2$7();
|
|
30587
|
+
attribute_effect(div2, () => ({ ...get$2(mergedProps) }));
|
|
30588
|
+
var node_2 = child(div2);
|
|
30580
30589
|
snippet(node_2, () => children() ?? noop$1, () => calendarState.snippetProps);
|
|
30581
|
-
reset(
|
|
30582
|
-
append($$anchor2,
|
|
30590
|
+
reset(div2);
|
|
30591
|
+
append($$anchor2, div2);
|
|
30583
30592
|
};
|
|
30584
30593
|
if_block(node, ($$render) => {
|
|
30585
30594
|
if (child$1()) $$render(consequent);
|
|
@@ -30740,15 +30749,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
30740
30749
|
append($$anchor4, fragment_3);
|
|
30741
30750
|
};
|
|
30742
30751
|
var alternate = ($$anchor4) => {
|
|
30743
|
-
var
|
|
30744
|
-
attribute_effect(
|
|
30745
|
-
var div_1 = child(
|
|
30752
|
+
var div2 = root_4$5();
|
|
30753
|
+
attribute_effect(div2, () => ({ ...wrapperProps() }));
|
|
30754
|
+
var div_1 = child(div2);
|
|
30746
30755
|
attribute_effect(div_1, () => ({ ...get$2(finalProps) }));
|
|
30747
30756
|
var node_3 = child(div_1);
|
|
30748
30757
|
snippet(node_3, () => children() ?? noop$1);
|
|
30749
30758
|
reset(div_1);
|
|
30750
|
-
reset(
|
|
30751
|
-
append($$anchor4,
|
|
30759
|
+
reset(div2);
|
|
30760
|
+
append($$anchor4, div2);
|
|
30752
30761
|
};
|
|
30753
30762
|
if_block(node_1, ($$render) => {
|
|
30754
30763
|
if (child$1()) $$render(consequent);
|
|
@@ -32017,8 +32026,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
32017
32026
|
$$props.$$host.classList.toggle("go-feedback", true);
|
|
32018
32027
|
$$props.$$host.setAttribute("data-num-errors", get$2(numErrors).toString());
|
|
32019
32028
|
});
|
|
32020
|
-
var
|
|
32021
|
-
var p2 = child(
|
|
32029
|
+
var div2 = root$5();
|
|
32030
|
+
var p2 = child(div2);
|
|
32022
32031
|
var node = child(p2);
|
|
32023
32032
|
{
|
|
32024
32033
|
var consequent = ($$anchor2) => {
|
|
@@ -32066,18 +32075,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
32066
32075
|
if (get$2(details) && isArray(get$2(details).apiErrors) && get$2(details).apiErrors.length > 0) $$render(consequent_2);
|
|
32067
32076
|
});
|
|
32068
32077
|
}
|
|
32069
|
-
reset(
|
|
32070
|
-
append($$anchor,
|
|
32078
|
+
reset(div2);
|
|
32079
|
+
append($$anchor, div2);
|
|
32071
32080
|
pop();
|
|
32072
32081
|
}
|
|
32073
32082
|
customElements.define("go-errors-feedback", create_custom_element(ErrorsFeedback, {}, [], []));
|
|
32074
32083
|
var root$4 = /* @__PURE__ */ from_html(`<div class="go-form-feedback"><!></div>`);
|
|
32075
32084
|
function FormFeedback($$anchor, $$props) {
|
|
32076
|
-
var
|
|
32077
|
-
var node = child(
|
|
32085
|
+
var div2 = root$4();
|
|
32086
|
+
var node = child(div2);
|
|
32078
32087
|
slot(node, $$props, "default", {});
|
|
32079
|
-
reset(
|
|
32080
|
-
append($$anchor,
|
|
32088
|
+
reset(div2);
|
|
32089
|
+
append($$anchor, div2);
|
|
32081
32090
|
}
|
|
32082
32091
|
customElements.define("go-form-feedback", create_custom_element(FormFeedback, {}, ["default"], []));
|
|
32083
32092
|
function Submit($$anchor, $$props) {
|
|
@@ -32114,15 +32123,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
32114
32123
|
var node = first_child(fragment);
|
|
32115
32124
|
{
|
|
32116
32125
|
var consequent = ($$anchor2) => {
|
|
32117
|
-
var
|
|
32126
|
+
var div2 = root_1$7();
|
|
32118
32127
|
let classes;
|
|
32119
|
-
var text2 = child(
|
|
32120
|
-
reset(
|
|
32128
|
+
var text2 = child(div2, true);
|
|
32129
|
+
reset(div2);
|
|
32121
32130
|
template_effect(() => {
|
|
32122
|
-
classes = set_class(
|
|
32131
|
+
classes = set_class(div2, 1, "go-success-feedback go-feedback", null, classes, { "is-successful": get$2(details).successMessage });
|
|
32123
32132
|
set_text(text2, get$2(details)?.successMessage);
|
|
32124
32133
|
});
|
|
32125
|
-
append($$anchor2,
|
|
32134
|
+
append($$anchor2, div2);
|
|
32126
32135
|
};
|
|
32127
32136
|
if_block(node, ($$render) => {
|
|
32128
32137
|
if (get$2(details)?.successMessage) $$render(consequent);
|
|
@@ -32132,10 +32141,1684 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
32132
32141
|
pop();
|
|
32133
32142
|
}
|
|
32134
32143
|
customElements.define("go-success-feedback", create_custom_element(SuccessFeedback, {}, [], []));
|
|
32144
|
+
var INUMBER = "INUMBER";
|
|
32145
|
+
var IOP1 = "IOP1";
|
|
32146
|
+
var IOP2 = "IOP2";
|
|
32147
|
+
var IOP3 = "IOP3";
|
|
32148
|
+
var IVAR = "IVAR";
|
|
32149
|
+
var IVARNAME = "IVARNAME";
|
|
32150
|
+
var IFUNCALL = "IFUNCALL";
|
|
32151
|
+
var IFUNDEF = "IFUNDEF";
|
|
32152
|
+
var IEXPR = "IEXPR";
|
|
32153
|
+
var IEXPREVAL = "IEXPREVAL";
|
|
32154
|
+
var IMEMBER = "IMEMBER";
|
|
32155
|
+
var IENDSTATEMENT = "IENDSTATEMENT";
|
|
32156
|
+
var IARRAY = "IARRAY";
|
|
32157
|
+
function Instruction(type, value) {
|
|
32158
|
+
this.type = type;
|
|
32159
|
+
this.value = value !== void 0 && value !== null ? value : 0;
|
|
32160
|
+
}
|
|
32161
|
+
Instruction.prototype.toString = function() {
|
|
32162
|
+
switch (this.type) {
|
|
32163
|
+
case INUMBER:
|
|
32164
|
+
case IOP1:
|
|
32165
|
+
case IOP2:
|
|
32166
|
+
case IOP3:
|
|
32167
|
+
case IVAR:
|
|
32168
|
+
case IVARNAME:
|
|
32169
|
+
case IENDSTATEMENT:
|
|
32170
|
+
return this.value;
|
|
32171
|
+
case IFUNCALL:
|
|
32172
|
+
return "CALL " + this.value;
|
|
32173
|
+
case IFUNDEF:
|
|
32174
|
+
return "DEF " + this.value;
|
|
32175
|
+
case IARRAY:
|
|
32176
|
+
return "ARRAY " + this.value;
|
|
32177
|
+
case IMEMBER:
|
|
32178
|
+
return "." + this.value;
|
|
32179
|
+
default:
|
|
32180
|
+
return "Invalid Instruction";
|
|
32181
|
+
}
|
|
32182
|
+
};
|
|
32183
|
+
function unaryInstruction(value) {
|
|
32184
|
+
return new Instruction(IOP1, value);
|
|
32185
|
+
}
|
|
32186
|
+
function binaryInstruction(value) {
|
|
32187
|
+
return new Instruction(IOP2, value);
|
|
32188
|
+
}
|
|
32189
|
+
function ternaryInstruction(value) {
|
|
32190
|
+
return new Instruction(IOP3, value);
|
|
32191
|
+
}
|
|
32192
|
+
function simplify(tokens, unaryOps, binaryOps, ternaryOps, values) {
|
|
32193
|
+
var nstack = [];
|
|
32194
|
+
var newexpression = [];
|
|
32195
|
+
var n1, n2, n3;
|
|
32196
|
+
var f;
|
|
32197
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
32198
|
+
var item = tokens[i];
|
|
32199
|
+
var type = item.type;
|
|
32200
|
+
if (type === INUMBER || type === IVARNAME) {
|
|
32201
|
+
if (Array.isArray(item.value)) {
|
|
32202
|
+
nstack.push.apply(nstack, simplify(item.value.map(function(x) {
|
|
32203
|
+
return new Instruction(INUMBER, x);
|
|
32204
|
+
}).concat(new Instruction(IARRAY, item.value.length)), unaryOps, binaryOps, ternaryOps, values));
|
|
32205
|
+
} else {
|
|
32206
|
+
nstack.push(item);
|
|
32207
|
+
}
|
|
32208
|
+
} else if (type === IVAR && values.hasOwnProperty(item.value)) {
|
|
32209
|
+
item = new Instruction(INUMBER, values[item.value]);
|
|
32210
|
+
nstack.push(item);
|
|
32211
|
+
} else if (type === IOP2 && nstack.length > 1) {
|
|
32212
|
+
n2 = nstack.pop();
|
|
32213
|
+
n1 = nstack.pop();
|
|
32214
|
+
f = binaryOps[item.value];
|
|
32215
|
+
item = new Instruction(INUMBER, f(n1.value, n2.value));
|
|
32216
|
+
nstack.push(item);
|
|
32217
|
+
} else if (type === IOP3 && nstack.length > 2) {
|
|
32218
|
+
n3 = nstack.pop();
|
|
32219
|
+
n2 = nstack.pop();
|
|
32220
|
+
n1 = nstack.pop();
|
|
32221
|
+
if (item.value === "?") {
|
|
32222
|
+
nstack.push(n1.value ? n2.value : n3.value);
|
|
32223
|
+
} else {
|
|
32224
|
+
f = ternaryOps[item.value];
|
|
32225
|
+
item = new Instruction(INUMBER, f(n1.value, n2.value, n3.value));
|
|
32226
|
+
nstack.push(item);
|
|
32227
|
+
}
|
|
32228
|
+
} else if (type === IOP1 && nstack.length > 0) {
|
|
32229
|
+
n1 = nstack.pop();
|
|
32230
|
+
f = unaryOps[item.value];
|
|
32231
|
+
item = new Instruction(INUMBER, f(n1.value));
|
|
32232
|
+
nstack.push(item);
|
|
32233
|
+
} else if (type === IEXPR) {
|
|
32234
|
+
while (nstack.length > 0) {
|
|
32235
|
+
newexpression.push(nstack.shift());
|
|
32236
|
+
}
|
|
32237
|
+
newexpression.push(new Instruction(IEXPR, simplify(item.value, unaryOps, binaryOps, ternaryOps, values)));
|
|
32238
|
+
} else if (type === IMEMBER && nstack.length > 0) {
|
|
32239
|
+
n1 = nstack.pop();
|
|
32240
|
+
nstack.push(new Instruction(INUMBER, n1.value[item.value]));
|
|
32241
|
+
} else {
|
|
32242
|
+
while (nstack.length > 0) {
|
|
32243
|
+
newexpression.push(nstack.shift());
|
|
32244
|
+
}
|
|
32245
|
+
newexpression.push(item);
|
|
32246
|
+
}
|
|
32247
|
+
}
|
|
32248
|
+
while (nstack.length > 0) {
|
|
32249
|
+
newexpression.push(nstack.shift());
|
|
32250
|
+
}
|
|
32251
|
+
return newexpression;
|
|
32252
|
+
}
|
|
32253
|
+
function substitute(tokens, variable, expr) {
|
|
32254
|
+
var newexpression = [];
|
|
32255
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
32256
|
+
var item = tokens[i];
|
|
32257
|
+
var type = item.type;
|
|
32258
|
+
if (type === IVAR && item.value === variable) {
|
|
32259
|
+
for (var j = 0; j < expr.tokens.length; j++) {
|
|
32260
|
+
var expritem = expr.tokens[j];
|
|
32261
|
+
var replitem;
|
|
32262
|
+
if (expritem.type === IOP1) {
|
|
32263
|
+
replitem = unaryInstruction(expritem.value);
|
|
32264
|
+
} else if (expritem.type === IOP2) {
|
|
32265
|
+
replitem = binaryInstruction(expritem.value);
|
|
32266
|
+
} else if (expritem.type === IOP3) {
|
|
32267
|
+
replitem = ternaryInstruction(expritem.value);
|
|
32268
|
+
} else {
|
|
32269
|
+
replitem = new Instruction(expritem.type, expritem.value);
|
|
32270
|
+
}
|
|
32271
|
+
newexpression.push(replitem);
|
|
32272
|
+
}
|
|
32273
|
+
} else if (type === IEXPR) {
|
|
32274
|
+
newexpression.push(new Instruction(IEXPR, substitute(item.value, variable, expr)));
|
|
32275
|
+
} else {
|
|
32276
|
+
newexpression.push(item);
|
|
32277
|
+
}
|
|
32278
|
+
}
|
|
32279
|
+
return newexpression;
|
|
32280
|
+
}
|
|
32281
|
+
function evaluate(tokens, expr, values) {
|
|
32282
|
+
var nstack = [];
|
|
32283
|
+
var n1, n2, n3;
|
|
32284
|
+
var f, args, argCount;
|
|
32285
|
+
if (isExpressionEvaluator(tokens)) {
|
|
32286
|
+
return resolveExpression(tokens, values);
|
|
32287
|
+
}
|
|
32288
|
+
var numTokens = tokens.length;
|
|
32289
|
+
for (var i = 0; i < numTokens; i++) {
|
|
32290
|
+
var item = tokens[i];
|
|
32291
|
+
var type = item.type;
|
|
32292
|
+
if (type === INUMBER || type === IVARNAME) {
|
|
32293
|
+
nstack.push(item.value);
|
|
32294
|
+
} else if (type === IOP2) {
|
|
32295
|
+
n2 = nstack.pop();
|
|
32296
|
+
n1 = nstack.pop();
|
|
32297
|
+
if (item.value === "and") {
|
|
32298
|
+
nstack.push(n1 ? !!evaluate(n2, expr, values) : false);
|
|
32299
|
+
} else if (item.value === "or") {
|
|
32300
|
+
nstack.push(n1 ? true : !!evaluate(n2, expr, values));
|
|
32301
|
+
} else if (item.value === "=") {
|
|
32302
|
+
f = expr.binaryOps[item.value];
|
|
32303
|
+
nstack.push(f(n1, evaluate(n2, expr, values), values));
|
|
32304
|
+
} else {
|
|
32305
|
+
f = expr.binaryOps[item.value];
|
|
32306
|
+
nstack.push(f(resolveExpression(n1, values), resolveExpression(n2, values)));
|
|
32307
|
+
}
|
|
32308
|
+
} else if (type === IOP3) {
|
|
32309
|
+
n3 = nstack.pop();
|
|
32310
|
+
n2 = nstack.pop();
|
|
32311
|
+
n1 = nstack.pop();
|
|
32312
|
+
if (item.value === "?") {
|
|
32313
|
+
nstack.push(evaluate(n1 ? n2 : n3, expr, values));
|
|
32314
|
+
} else {
|
|
32315
|
+
f = expr.ternaryOps[item.value];
|
|
32316
|
+
nstack.push(f(resolveExpression(n1, values), resolveExpression(n2, values), resolveExpression(n3, values)));
|
|
32317
|
+
}
|
|
32318
|
+
} else if (type === IVAR) {
|
|
32319
|
+
if (item.value in expr.functions) {
|
|
32320
|
+
nstack.push(expr.functions[item.value]);
|
|
32321
|
+
} else if (item.value in expr.unaryOps && expr.parser.isOperatorEnabled(item.value)) {
|
|
32322
|
+
nstack.push(expr.unaryOps[item.value]);
|
|
32323
|
+
} else {
|
|
32324
|
+
var v = values[item.value];
|
|
32325
|
+
if (v !== void 0) {
|
|
32326
|
+
nstack.push(v);
|
|
32327
|
+
} else {
|
|
32328
|
+
throw new Error("undefined variable: " + item.value);
|
|
32329
|
+
}
|
|
32330
|
+
}
|
|
32331
|
+
} else if (type === IOP1) {
|
|
32332
|
+
n1 = nstack.pop();
|
|
32333
|
+
f = expr.unaryOps[item.value];
|
|
32334
|
+
nstack.push(f(resolveExpression(n1, values)));
|
|
32335
|
+
} else if (type === IFUNCALL) {
|
|
32336
|
+
argCount = item.value;
|
|
32337
|
+
args = [];
|
|
32338
|
+
while (argCount-- > 0) {
|
|
32339
|
+
args.unshift(resolveExpression(nstack.pop(), values));
|
|
32340
|
+
}
|
|
32341
|
+
f = nstack.pop();
|
|
32342
|
+
if (f.apply && f.call) {
|
|
32343
|
+
nstack.push(f.apply(void 0, args));
|
|
32344
|
+
} else {
|
|
32345
|
+
throw new Error(f + " is not a function");
|
|
32346
|
+
}
|
|
32347
|
+
} else if (type === IFUNDEF) {
|
|
32348
|
+
nstack.push((function() {
|
|
32349
|
+
var n22 = nstack.pop();
|
|
32350
|
+
var args2 = [];
|
|
32351
|
+
var argCount2 = item.value;
|
|
32352
|
+
while (argCount2-- > 0) {
|
|
32353
|
+
args2.unshift(nstack.pop());
|
|
32354
|
+
}
|
|
32355
|
+
var n12 = nstack.pop();
|
|
32356
|
+
var f2 = function() {
|
|
32357
|
+
var scope = Object.assign({}, values);
|
|
32358
|
+
for (var i2 = 0, len = args2.length; i2 < len; i2++) {
|
|
32359
|
+
scope[args2[i2]] = arguments[i2];
|
|
32360
|
+
}
|
|
32361
|
+
return evaluate(n22, expr, scope);
|
|
32362
|
+
};
|
|
32363
|
+
Object.defineProperty(f2, "name", {
|
|
32364
|
+
value: n12,
|
|
32365
|
+
writable: false
|
|
32366
|
+
});
|
|
32367
|
+
values[n12] = f2;
|
|
32368
|
+
return f2;
|
|
32369
|
+
})());
|
|
32370
|
+
} else if (type === IEXPR) {
|
|
32371
|
+
nstack.push(createExpressionEvaluator(item, expr));
|
|
32372
|
+
} else if (type === IEXPREVAL) {
|
|
32373
|
+
nstack.push(item);
|
|
32374
|
+
} else if (type === IMEMBER) {
|
|
32375
|
+
n1 = nstack.pop();
|
|
32376
|
+
nstack.push(n1[item.value]);
|
|
32377
|
+
} else if (type === IENDSTATEMENT) {
|
|
32378
|
+
nstack.pop();
|
|
32379
|
+
} else if (type === IARRAY) {
|
|
32380
|
+
argCount = item.value;
|
|
32381
|
+
args = [];
|
|
32382
|
+
while (argCount-- > 0) {
|
|
32383
|
+
args.unshift(nstack.pop());
|
|
32384
|
+
}
|
|
32385
|
+
nstack.push(args);
|
|
32386
|
+
} else {
|
|
32387
|
+
throw new Error("invalid Expression");
|
|
32388
|
+
}
|
|
32389
|
+
}
|
|
32390
|
+
if (nstack.length > 1) {
|
|
32391
|
+
throw new Error("invalid Expression (parity)");
|
|
32392
|
+
}
|
|
32393
|
+
return nstack[0] === 0 ? 0 : resolveExpression(nstack[0], values);
|
|
32394
|
+
}
|
|
32395
|
+
function createExpressionEvaluator(token, expr, values) {
|
|
32396
|
+
if (isExpressionEvaluator(token)) return token;
|
|
32397
|
+
return {
|
|
32398
|
+
type: IEXPREVAL,
|
|
32399
|
+
value: function(scope) {
|
|
32400
|
+
return evaluate(token.value, expr, scope);
|
|
32401
|
+
}
|
|
32402
|
+
};
|
|
32403
|
+
}
|
|
32404
|
+
function isExpressionEvaluator(n) {
|
|
32405
|
+
return n && n.type === IEXPREVAL;
|
|
32406
|
+
}
|
|
32407
|
+
function resolveExpression(n, values) {
|
|
32408
|
+
return isExpressionEvaluator(n) ? n.value(values) : n;
|
|
32409
|
+
}
|
|
32410
|
+
function expressionToString(tokens, toJS) {
|
|
32411
|
+
var nstack = [];
|
|
32412
|
+
var n1, n2, n3;
|
|
32413
|
+
var f, args, argCount;
|
|
32414
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
32415
|
+
var item = tokens[i];
|
|
32416
|
+
var type = item.type;
|
|
32417
|
+
if (type === INUMBER) {
|
|
32418
|
+
if (typeof item.value === "number" && item.value < 0) {
|
|
32419
|
+
nstack.push("(" + item.value + ")");
|
|
32420
|
+
} else if (Array.isArray(item.value)) {
|
|
32421
|
+
nstack.push("[" + item.value.map(escapeValue).join(", ") + "]");
|
|
32422
|
+
} else {
|
|
32423
|
+
nstack.push(escapeValue(item.value));
|
|
32424
|
+
}
|
|
32425
|
+
} else if (type === IOP2) {
|
|
32426
|
+
n2 = nstack.pop();
|
|
32427
|
+
n1 = nstack.pop();
|
|
32428
|
+
f = item.value;
|
|
32429
|
+
if (toJS) {
|
|
32430
|
+
if (f === "^") {
|
|
32431
|
+
nstack.push("Math.pow(" + n1 + ", " + n2 + ")");
|
|
32432
|
+
} else if (f === "and") {
|
|
32433
|
+
nstack.push("(!!" + n1 + " && !!" + n2 + ")");
|
|
32434
|
+
} else if (f === "or") {
|
|
32435
|
+
nstack.push("(!!" + n1 + " || !!" + n2 + ")");
|
|
32436
|
+
} else if (f === "||") {
|
|
32437
|
+
nstack.push("(function(a,b){ return Array.isArray(a) && Array.isArray(b) ? a.concat(b) : String(a) + String(b); }((" + n1 + "),(" + n2 + ")))");
|
|
32438
|
+
} else if (f === "==") {
|
|
32439
|
+
nstack.push("(" + n1 + " === " + n2 + ")");
|
|
32440
|
+
} else if (f === "!=") {
|
|
32441
|
+
nstack.push("(" + n1 + " !== " + n2 + ")");
|
|
32442
|
+
} else if (f === "[") {
|
|
32443
|
+
nstack.push(n1 + "[(" + n2 + ") | 0]");
|
|
32444
|
+
} else {
|
|
32445
|
+
nstack.push("(" + n1 + " " + f + " " + n2 + ")");
|
|
32446
|
+
}
|
|
32447
|
+
} else {
|
|
32448
|
+
if (f === "[") {
|
|
32449
|
+
nstack.push(n1 + "[" + n2 + "]");
|
|
32450
|
+
} else {
|
|
32451
|
+
nstack.push("(" + n1 + " " + f + " " + n2 + ")");
|
|
32452
|
+
}
|
|
32453
|
+
}
|
|
32454
|
+
} else if (type === IOP3) {
|
|
32455
|
+
n3 = nstack.pop();
|
|
32456
|
+
n2 = nstack.pop();
|
|
32457
|
+
n1 = nstack.pop();
|
|
32458
|
+
f = item.value;
|
|
32459
|
+
if (f === "?") {
|
|
32460
|
+
nstack.push("(" + n1 + " ? " + n2 + " : " + n3 + ")");
|
|
32461
|
+
} else {
|
|
32462
|
+
throw new Error("invalid Expression");
|
|
32463
|
+
}
|
|
32464
|
+
} else if (type === IVAR || type === IVARNAME) {
|
|
32465
|
+
nstack.push(item.value);
|
|
32466
|
+
} else if (type === IOP1) {
|
|
32467
|
+
n1 = nstack.pop();
|
|
32468
|
+
f = item.value;
|
|
32469
|
+
if (f === "-" || f === "+") {
|
|
32470
|
+
nstack.push("(" + f + n1 + ")");
|
|
32471
|
+
} else if (toJS) {
|
|
32472
|
+
if (f === "not") {
|
|
32473
|
+
nstack.push("(!" + n1 + ")");
|
|
32474
|
+
} else if (f === "!") {
|
|
32475
|
+
nstack.push("fac(" + n1 + ")");
|
|
32476
|
+
} else {
|
|
32477
|
+
nstack.push(f + "(" + n1 + ")");
|
|
32478
|
+
}
|
|
32479
|
+
} else if (f === "!") {
|
|
32480
|
+
nstack.push("(" + n1 + "!)");
|
|
32481
|
+
} else {
|
|
32482
|
+
nstack.push("(" + f + " " + n1 + ")");
|
|
32483
|
+
}
|
|
32484
|
+
} else if (type === IFUNCALL) {
|
|
32485
|
+
argCount = item.value;
|
|
32486
|
+
args = [];
|
|
32487
|
+
while (argCount-- > 0) {
|
|
32488
|
+
args.unshift(nstack.pop());
|
|
32489
|
+
}
|
|
32490
|
+
f = nstack.pop();
|
|
32491
|
+
nstack.push(f + "(" + args.join(", ") + ")");
|
|
32492
|
+
} else if (type === IFUNDEF) {
|
|
32493
|
+
n2 = nstack.pop();
|
|
32494
|
+
argCount = item.value;
|
|
32495
|
+
args = [];
|
|
32496
|
+
while (argCount-- > 0) {
|
|
32497
|
+
args.unshift(nstack.pop());
|
|
32498
|
+
}
|
|
32499
|
+
n1 = nstack.pop();
|
|
32500
|
+
if (toJS) {
|
|
32501
|
+
nstack.push("(" + n1 + " = function(" + args.join(", ") + ") { return " + n2 + " })");
|
|
32502
|
+
} else {
|
|
32503
|
+
nstack.push("(" + n1 + "(" + args.join(", ") + ") = " + n2 + ")");
|
|
32504
|
+
}
|
|
32505
|
+
} else if (type === IMEMBER) {
|
|
32506
|
+
n1 = nstack.pop();
|
|
32507
|
+
nstack.push(n1 + "." + item.value);
|
|
32508
|
+
} else if (type === IARRAY) {
|
|
32509
|
+
argCount = item.value;
|
|
32510
|
+
args = [];
|
|
32511
|
+
while (argCount-- > 0) {
|
|
32512
|
+
args.unshift(nstack.pop());
|
|
32513
|
+
}
|
|
32514
|
+
nstack.push("[" + args.join(", ") + "]");
|
|
32515
|
+
} else if (type === IEXPR) {
|
|
32516
|
+
nstack.push("(" + expressionToString(item.value, toJS) + ")");
|
|
32517
|
+
} else if (type === IENDSTATEMENT) ;
|
|
32518
|
+
else {
|
|
32519
|
+
throw new Error("invalid Expression");
|
|
32520
|
+
}
|
|
32521
|
+
}
|
|
32522
|
+
if (nstack.length > 1) {
|
|
32523
|
+
if (toJS) {
|
|
32524
|
+
nstack = [nstack.join(",")];
|
|
32525
|
+
} else {
|
|
32526
|
+
nstack = [nstack.join(";")];
|
|
32527
|
+
}
|
|
32528
|
+
}
|
|
32529
|
+
return String(nstack[0]);
|
|
32530
|
+
}
|
|
32531
|
+
function escapeValue(v) {
|
|
32532
|
+
if (typeof v === "string") {
|
|
32533
|
+
return JSON.stringify(v).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
32534
|
+
}
|
|
32535
|
+
return v;
|
|
32536
|
+
}
|
|
32537
|
+
function contains(array2, obj) {
|
|
32538
|
+
for (var i = 0; i < array2.length; i++) {
|
|
32539
|
+
if (array2[i] === obj) {
|
|
32540
|
+
return true;
|
|
32541
|
+
}
|
|
32542
|
+
}
|
|
32543
|
+
return false;
|
|
32544
|
+
}
|
|
32545
|
+
function getSymbols(tokens, symbols, options) {
|
|
32546
|
+
options = options || {};
|
|
32547
|
+
var withMembers = !!options.withMembers;
|
|
32548
|
+
var prevVar = null;
|
|
32549
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
32550
|
+
var item = tokens[i];
|
|
32551
|
+
if (item.type === IVAR || item.type === IVARNAME) {
|
|
32552
|
+
if (!withMembers && !contains(symbols, item.value)) {
|
|
32553
|
+
symbols.push(item.value);
|
|
32554
|
+
} else if (prevVar !== null) {
|
|
32555
|
+
if (!contains(symbols, prevVar)) {
|
|
32556
|
+
symbols.push(prevVar);
|
|
32557
|
+
}
|
|
32558
|
+
prevVar = item.value;
|
|
32559
|
+
} else {
|
|
32560
|
+
prevVar = item.value;
|
|
32561
|
+
}
|
|
32562
|
+
} else if (item.type === IMEMBER && withMembers && prevVar !== null) {
|
|
32563
|
+
prevVar += "." + item.value;
|
|
32564
|
+
} else if (item.type === IEXPR) {
|
|
32565
|
+
getSymbols(item.value, symbols, options);
|
|
32566
|
+
} else if (prevVar !== null) {
|
|
32567
|
+
if (!contains(symbols, prevVar)) {
|
|
32568
|
+
symbols.push(prevVar);
|
|
32569
|
+
}
|
|
32570
|
+
prevVar = null;
|
|
32571
|
+
}
|
|
32572
|
+
}
|
|
32573
|
+
if (prevVar !== null && !contains(symbols, prevVar)) {
|
|
32574
|
+
symbols.push(prevVar);
|
|
32575
|
+
}
|
|
32576
|
+
}
|
|
32577
|
+
function Expression(tokens, parser2) {
|
|
32578
|
+
this.tokens = tokens;
|
|
32579
|
+
this.parser = parser2;
|
|
32580
|
+
this.unaryOps = parser2.unaryOps;
|
|
32581
|
+
this.binaryOps = parser2.binaryOps;
|
|
32582
|
+
this.ternaryOps = parser2.ternaryOps;
|
|
32583
|
+
this.functions = parser2.functions;
|
|
32584
|
+
}
|
|
32585
|
+
Expression.prototype.simplify = function(values) {
|
|
32586
|
+
values = values || {};
|
|
32587
|
+
return new Expression(simplify(this.tokens, this.unaryOps, this.binaryOps, this.ternaryOps, values), this.parser);
|
|
32588
|
+
};
|
|
32589
|
+
Expression.prototype.substitute = function(variable, expr) {
|
|
32590
|
+
if (!(expr instanceof Expression)) {
|
|
32591
|
+
expr = this.parser.parse(String(expr));
|
|
32592
|
+
}
|
|
32593
|
+
return new Expression(substitute(this.tokens, variable, expr), this.parser);
|
|
32594
|
+
};
|
|
32595
|
+
Expression.prototype.evaluate = function(values) {
|
|
32596
|
+
values = values || {};
|
|
32597
|
+
return evaluate(this.tokens, this, values);
|
|
32598
|
+
};
|
|
32599
|
+
Expression.prototype.toString = function() {
|
|
32600
|
+
return expressionToString(this.tokens, false);
|
|
32601
|
+
};
|
|
32602
|
+
Expression.prototype.symbols = function(options) {
|
|
32603
|
+
options = options || {};
|
|
32604
|
+
var vars = [];
|
|
32605
|
+
getSymbols(this.tokens, vars, options);
|
|
32606
|
+
return vars;
|
|
32607
|
+
};
|
|
32608
|
+
Expression.prototype.variables = function(options) {
|
|
32609
|
+
options = options || {};
|
|
32610
|
+
var vars = [];
|
|
32611
|
+
getSymbols(this.tokens, vars, options);
|
|
32612
|
+
var functions = this.functions;
|
|
32613
|
+
return vars.filter(function(name) {
|
|
32614
|
+
return !(name in functions);
|
|
32615
|
+
});
|
|
32616
|
+
};
|
|
32617
|
+
Expression.prototype.toJSFunction = function(param, variables) {
|
|
32618
|
+
var expr = this;
|
|
32619
|
+
var f = new Function(param, "with(this.functions) with (this.ternaryOps) with (this.binaryOps) with (this.unaryOps) { return " + expressionToString(this.simplify(variables).tokens, true) + "; }");
|
|
32620
|
+
return function() {
|
|
32621
|
+
return f.apply(expr, arguments);
|
|
32622
|
+
};
|
|
32623
|
+
};
|
|
32624
|
+
var TEOF = "TEOF";
|
|
32625
|
+
var TOP = "TOP";
|
|
32626
|
+
var TNUMBER = "TNUMBER";
|
|
32627
|
+
var TSTRING = "TSTRING";
|
|
32628
|
+
var TPAREN = "TPAREN";
|
|
32629
|
+
var TBRACKET = "TBRACKET";
|
|
32630
|
+
var TCOMMA = "TCOMMA";
|
|
32631
|
+
var TNAME = "TNAME";
|
|
32632
|
+
var TSEMICOLON = "TSEMICOLON";
|
|
32633
|
+
function Token(type, value, index2) {
|
|
32634
|
+
this.type = type;
|
|
32635
|
+
this.value = value;
|
|
32636
|
+
this.index = index2;
|
|
32637
|
+
}
|
|
32638
|
+
Token.prototype.toString = function() {
|
|
32639
|
+
return this.type + ": " + this.value;
|
|
32640
|
+
};
|
|
32641
|
+
function TokenStream(parser2, expression) {
|
|
32642
|
+
this.pos = 0;
|
|
32643
|
+
this.current = null;
|
|
32644
|
+
this.unaryOps = parser2.unaryOps;
|
|
32645
|
+
this.binaryOps = parser2.binaryOps;
|
|
32646
|
+
this.ternaryOps = parser2.ternaryOps;
|
|
32647
|
+
this.consts = parser2.consts;
|
|
32648
|
+
this.expression = expression;
|
|
32649
|
+
this.savedPosition = 0;
|
|
32650
|
+
this.savedCurrent = null;
|
|
32651
|
+
this.options = parser2.options;
|
|
32652
|
+
this.parser = parser2;
|
|
32653
|
+
}
|
|
32654
|
+
TokenStream.prototype.newToken = function(type, value, pos) {
|
|
32655
|
+
return new Token(type, value, pos != null ? pos : this.pos);
|
|
32656
|
+
};
|
|
32657
|
+
TokenStream.prototype.save = function() {
|
|
32658
|
+
this.savedPosition = this.pos;
|
|
32659
|
+
this.savedCurrent = this.current;
|
|
32660
|
+
};
|
|
32661
|
+
TokenStream.prototype.restore = function() {
|
|
32662
|
+
this.pos = this.savedPosition;
|
|
32663
|
+
this.current = this.savedCurrent;
|
|
32664
|
+
};
|
|
32665
|
+
TokenStream.prototype.next = function() {
|
|
32666
|
+
if (this.pos >= this.expression.length) {
|
|
32667
|
+
return this.newToken(TEOF, "EOF");
|
|
32668
|
+
}
|
|
32669
|
+
if (this.isWhitespace() || this.isComment()) {
|
|
32670
|
+
return this.next();
|
|
32671
|
+
} else if (this.isRadixInteger() || this.isNumber() || this.isOperator() || this.isString() || this.isParen() || this.isBracket() || this.isComma() || this.isSemicolon() || this.isNamedOp() || this.isConst() || this.isName()) {
|
|
32672
|
+
return this.current;
|
|
32673
|
+
} else {
|
|
32674
|
+
this.parseError('Unknown character "' + this.expression.charAt(this.pos) + '"');
|
|
32675
|
+
}
|
|
32676
|
+
};
|
|
32677
|
+
TokenStream.prototype.isString = function() {
|
|
32678
|
+
var r2 = false;
|
|
32679
|
+
var startPos = this.pos;
|
|
32680
|
+
var quote = this.expression.charAt(startPos);
|
|
32681
|
+
if (quote === "'" || quote === '"') {
|
|
32682
|
+
var index2 = this.expression.indexOf(quote, startPos + 1);
|
|
32683
|
+
while (index2 >= 0 && this.pos < this.expression.length) {
|
|
32684
|
+
this.pos = index2 + 1;
|
|
32685
|
+
if (this.expression.charAt(index2 - 1) !== "\\") {
|
|
32686
|
+
var rawString = this.expression.substring(startPos + 1, index2);
|
|
32687
|
+
this.current = this.newToken(TSTRING, this.unescape(rawString), startPos);
|
|
32688
|
+
r2 = true;
|
|
32689
|
+
break;
|
|
32690
|
+
}
|
|
32691
|
+
index2 = this.expression.indexOf(quote, index2 + 1);
|
|
32692
|
+
}
|
|
32693
|
+
}
|
|
32694
|
+
return r2;
|
|
32695
|
+
};
|
|
32696
|
+
TokenStream.prototype.isParen = function() {
|
|
32697
|
+
var c = this.expression.charAt(this.pos);
|
|
32698
|
+
if (c === "(" || c === ")") {
|
|
32699
|
+
this.current = this.newToken(TPAREN, c);
|
|
32700
|
+
this.pos++;
|
|
32701
|
+
return true;
|
|
32702
|
+
}
|
|
32703
|
+
return false;
|
|
32704
|
+
};
|
|
32705
|
+
TokenStream.prototype.isBracket = function() {
|
|
32706
|
+
var c = this.expression.charAt(this.pos);
|
|
32707
|
+
if ((c === "[" || c === "]") && this.isOperatorEnabled("[")) {
|
|
32708
|
+
this.current = this.newToken(TBRACKET, c);
|
|
32709
|
+
this.pos++;
|
|
32710
|
+
return true;
|
|
32711
|
+
}
|
|
32712
|
+
return false;
|
|
32713
|
+
};
|
|
32714
|
+
TokenStream.prototype.isComma = function() {
|
|
32715
|
+
var c = this.expression.charAt(this.pos);
|
|
32716
|
+
if (c === ",") {
|
|
32717
|
+
this.current = this.newToken(TCOMMA, ",");
|
|
32718
|
+
this.pos++;
|
|
32719
|
+
return true;
|
|
32720
|
+
}
|
|
32721
|
+
return false;
|
|
32722
|
+
};
|
|
32723
|
+
TokenStream.prototype.isSemicolon = function() {
|
|
32724
|
+
var c = this.expression.charAt(this.pos);
|
|
32725
|
+
if (c === ";") {
|
|
32726
|
+
this.current = this.newToken(TSEMICOLON, ";");
|
|
32727
|
+
this.pos++;
|
|
32728
|
+
return true;
|
|
32729
|
+
}
|
|
32730
|
+
return false;
|
|
32731
|
+
};
|
|
32732
|
+
TokenStream.prototype.isConst = function() {
|
|
32733
|
+
var startPos = this.pos;
|
|
32734
|
+
var i = startPos;
|
|
32735
|
+
for (; i < this.expression.length; i++) {
|
|
32736
|
+
var c = this.expression.charAt(i);
|
|
32737
|
+
if (c.toUpperCase() === c.toLowerCase()) {
|
|
32738
|
+
if (i === this.pos || c !== "_" && c !== "." && (c < "0" || c > "9")) {
|
|
32739
|
+
break;
|
|
32740
|
+
}
|
|
32741
|
+
}
|
|
32742
|
+
}
|
|
32743
|
+
if (i > startPos) {
|
|
32744
|
+
var str = this.expression.substring(startPos, i);
|
|
32745
|
+
if (str in this.consts) {
|
|
32746
|
+
this.current = this.newToken(TNUMBER, this.consts[str]);
|
|
32747
|
+
this.pos += str.length;
|
|
32748
|
+
return true;
|
|
32749
|
+
}
|
|
32750
|
+
}
|
|
32751
|
+
return false;
|
|
32752
|
+
};
|
|
32753
|
+
TokenStream.prototype.isNamedOp = function() {
|
|
32754
|
+
var startPos = this.pos;
|
|
32755
|
+
var i = startPos;
|
|
32756
|
+
for (; i < this.expression.length; i++) {
|
|
32757
|
+
var c = this.expression.charAt(i);
|
|
32758
|
+
if (c.toUpperCase() === c.toLowerCase()) {
|
|
32759
|
+
if (i === this.pos || c !== "_" && (c < "0" || c > "9")) {
|
|
32760
|
+
break;
|
|
32761
|
+
}
|
|
32762
|
+
}
|
|
32763
|
+
}
|
|
32764
|
+
if (i > startPos) {
|
|
32765
|
+
var str = this.expression.substring(startPos, i);
|
|
32766
|
+
if (this.isOperatorEnabled(str) && (str in this.binaryOps || str in this.unaryOps || str in this.ternaryOps)) {
|
|
32767
|
+
this.current = this.newToken(TOP, str);
|
|
32768
|
+
this.pos += str.length;
|
|
32769
|
+
return true;
|
|
32770
|
+
}
|
|
32771
|
+
}
|
|
32772
|
+
return false;
|
|
32773
|
+
};
|
|
32774
|
+
TokenStream.prototype.isName = function() {
|
|
32775
|
+
var startPos = this.pos;
|
|
32776
|
+
var i = startPos;
|
|
32777
|
+
var hasLetter = false;
|
|
32778
|
+
for (; i < this.expression.length; i++) {
|
|
32779
|
+
var c = this.expression.charAt(i);
|
|
32780
|
+
if (c.toUpperCase() === c.toLowerCase()) {
|
|
32781
|
+
if (i === this.pos && (c === "$" || c === "_")) {
|
|
32782
|
+
if (c === "_") {
|
|
32783
|
+
hasLetter = true;
|
|
32784
|
+
}
|
|
32785
|
+
continue;
|
|
32786
|
+
} else if (i === this.pos || !hasLetter || c !== "_" && (c < "0" || c > "9")) {
|
|
32787
|
+
break;
|
|
32788
|
+
}
|
|
32789
|
+
} else {
|
|
32790
|
+
hasLetter = true;
|
|
32791
|
+
}
|
|
32792
|
+
}
|
|
32793
|
+
if (hasLetter) {
|
|
32794
|
+
var str = this.expression.substring(startPos, i);
|
|
32795
|
+
this.current = this.newToken(TNAME, str);
|
|
32796
|
+
this.pos += str.length;
|
|
32797
|
+
return true;
|
|
32798
|
+
}
|
|
32799
|
+
return false;
|
|
32800
|
+
};
|
|
32801
|
+
TokenStream.prototype.isWhitespace = function() {
|
|
32802
|
+
var r2 = false;
|
|
32803
|
+
var c = this.expression.charAt(this.pos);
|
|
32804
|
+
while (c === " " || c === " " || c === "\n" || c === "\r") {
|
|
32805
|
+
r2 = true;
|
|
32806
|
+
this.pos++;
|
|
32807
|
+
if (this.pos >= this.expression.length) {
|
|
32808
|
+
break;
|
|
32809
|
+
}
|
|
32810
|
+
c = this.expression.charAt(this.pos);
|
|
32811
|
+
}
|
|
32812
|
+
return r2;
|
|
32813
|
+
};
|
|
32814
|
+
var codePointPattern = /^[0-9a-f]{4}$/i;
|
|
32815
|
+
TokenStream.prototype.unescape = function(v) {
|
|
32816
|
+
var index2 = v.indexOf("\\");
|
|
32817
|
+
if (index2 < 0) {
|
|
32818
|
+
return v;
|
|
32819
|
+
}
|
|
32820
|
+
var buffer = v.substring(0, index2);
|
|
32821
|
+
while (index2 >= 0) {
|
|
32822
|
+
var c = v.charAt(++index2);
|
|
32823
|
+
switch (c) {
|
|
32824
|
+
case "'":
|
|
32825
|
+
buffer += "'";
|
|
32826
|
+
break;
|
|
32827
|
+
case '"':
|
|
32828
|
+
buffer += '"';
|
|
32829
|
+
break;
|
|
32830
|
+
case "\\":
|
|
32831
|
+
buffer += "\\";
|
|
32832
|
+
break;
|
|
32833
|
+
case "/":
|
|
32834
|
+
buffer += "/";
|
|
32835
|
+
break;
|
|
32836
|
+
case "b":
|
|
32837
|
+
buffer += "\b";
|
|
32838
|
+
break;
|
|
32839
|
+
case "f":
|
|
32840
|
+
buffer += "\f";
|
|
32841
|
+
break;
|
|
32842
|
+
case "n":
|
|
32843
|
+
buffer += "\n";
|
|
32844
|
+
break;
|
|
32845
|
+
case "r":
|
|
32846
|
+
buffer += "\r";
|
|
32847
|
+
break;
|
|
32848
|
+
case "t":
|
|
32849
|
+
buffer += " ";
|
|
32850
|
+
break;
|
|
32851
|
+
case "u":
|
|
32852
|
+
var codePoint = v.substring(index2 + 1, index2 + 5);
|
|
32853
|
+
if (!codePointPattern.test(codePoint)) {
|
|
32854
|
+
this.parseError("Illegal escape sequence: \\u" + codePoint);
|
|
32855
|
+
}
|
|
32856
|
+
buffer += String.fromCharCode(parseInt(codePoint, 16));
|
|
32857
|
+
index2 += 4;
|
|
32858
|
+
break;
|
|
32859
|
+
default:
|
|
32860
|
+
throw this.parseError('Illegal escape sequence: "\\' + c + '"');
|
|
32861
|
+
}
|
|
32862
|
+
++index2;
|
|
32863
|
+
var backslash = v.indexOf("\\", index2);
|
|
32864
|
+
buffer += v.substring(index2, backslash < 0 ? v.length : backslash);
|
|
32865
|
+
index2 = backslash;
|
|
32866
|
+
}
|
|
32867
|
+
return buffer;
|
|
32868
|
+
};
|
|
32869
|
+
TokenStream.prototype.isComment = function() {
|
|
32870
|
+
var c = this.expression.charAt(this.pos);
|
|
32871
|
+
if (c === "/" && this.expression.charAt(this.pos + 1) === "*") {
|
|
32872
|
+
this.pos = this.expression.indexOf("*/", this.pos) + 2;
|
|
32873
|
+
if (this.pos === 1) {
|
|
32874
|
+
this.pos = this.expression.length;
|
|
32875
|
+
}
|
|
32876
|
+
return true;
|
|
32877
|
+
}
|
|
32878
|
+
return false;
|
|
32879
|
+
};
|
|
32880
|
+
TokenStream.prototype.isRadixInteger = function() {
|
|
32881
|
+
var pos = this.pos;
|
|
32882
|
+
if (pos >= this.expression.length - 2 || this.expression.charAt(pos) !== "0") {
|
|
32883
|
+
return false;
|
|
32884
|
+
}
|
|
32885
|
+
++pos;
|
|
32886
|
+
var radix;
|
|
32887
|
+
var validDigit;
|
|
32888
|
+
if (this.expression.charAt(pos) === "x") {
|
|
32889
|
+
radix = 16;
|
|
32890
|
+
validDigit = /^[0-9a-f]$/i;
|
|
32891
|
+
++pos;
|
|
32892
|
+
} else if (this.expression.charAt(pos) === "b") {
|
|
32893
|
+
radix = 2;
|
|
32894
|
+
validDigit = /^[01]$/i;
|
|
32895
|
+
++pos;
|
|
32896
|
+
} else {
|
|
32897
|
+
return false;
|
|
32898
|
+
}
|
|
32899
|
+
var valid = false;
|
|
32900
|
+
var startPos = pos;
|
|
32901
|
+
while (pos < this.expression.length) {
|
|
32902
|
+
var c = this.expression.charAt(pos);
|
|
32903
|
+
if (validDigit.test(c)) {
|
|
32904
|
+
pos++;
|
|
32905
|
+
valid = true;
|
|
32906
|
+
} else {
|
|
32907
|
+
break;
|
|
32908
|
+
}
|
|
32909
|
+
}
|
|
32910
|
+
if (valid) {
|
|
32911
|
+
this.current = this.newToken(TNUMBER, parseInt(this.expression.substring(startPos, pos), radix));
|
|
32912
|
+
this.pos = pos;
|
|
32913
|
+
}
|
|
32914
|
+
return valid;
|
|
32915
|
+
};
|
|
32916
|
+
TokenStream.prototype.isNumber = function() {
|
|
32917
|
+
var valid = false;
|
|
32918
|
+
var pos = this.pos;
|
|
32919
|
+
var startPos = pos;
|
|
32920
|
+
var resetPos = pos;
|
|
32921
|
+
var foundDot = false;
|
|
32922
|
+
var foundDigits = false;
|
|
32923
|
+
var c;
|
|
32924
|
+
while (pos < this.expression.length) {
|
|
32925
|
+
c = this.expression.charAt(pos);
|
|
32926
|
+
if (c >= "0" && c <= "9" || !foundDot && c === ".") {
|
|
32927
|
+
if (c === ".") {
|
|
32928
|
+
foundDot = true;
|
|
32929
|
+
} else {
|
|
32930
|
+
foundDigits = true;
|
|
32931
|
+
}
|
|
32932
|
+
pos++;
|
|
32933
|
+
valid = foundDigits;
|
|
32934
|
+
} else {
|
|
32935
|
+
break;
|
|
32936
|
+
}
|
|
32937
|
+
}
|
|
32938
|
+
if (valid) {
|
|
32939
|
+
resetPos = pos;
|
|
32940
|
+
}
|
|
32941
|
+
if (c === "e" || c === "E") {
|
|
32942
|
+
pos++;
|
|
32943
|
+
var acceptSign = true;
|
|
32944
|
+
var validExponent = false;
|
|
32945
|
+
while (pos < this.expression.length) {
|
|
32946
|
+
c = this.expression.charAt(pos);
|
|
32947
|
+
if (acceptSign && (c === "+" || c === "-")) {
|
|
32948
|
+
acceptSign = false;
|
|
32949
|
+
} else if (c >= "0" && c <= "9") {
|
|
32950
|
+
validExponent = true;
|
|
32951
|
+
acceptSign = false;
|
|
32952
|
+
} else {
|
|
32953
|
+
break;
|
|
32954
|
+
}
|
|
32955
|
+
pos++;
|
|
32956
|
+
}
|
|
32957
|
+
if (!validExponent) {
|
|
32958
|
+
pos = resetPos;
|
|
32959
|
+
}
|
|
32960
|
+
}
|
|
32961
|
+
if (valid) {
|
|
32962
|
+
this.current = this.newToken(TNUMBER, parseFloat(this.expression.substring(startPos, pos)));
|
|
32963
|
+
this.pos = pos;
|
|
32964
|
+
} else {
|
|
32965
|
+
this.pos = resetPos;
|
|
32966
|
+
}
|
|
32967
|
+
return valid;
|
|
32968
|
+
};
|
|
32969
|
+
TokenStream.prototype.isOperator = function() {
|
|
32970
|
+
var startPos = this.pos;
|
|
32971
|
+
var c = this.expression.charAt(this.pos);
|
|
32972
|
+
if (c === "+" || c === "-" || c === "*" || c === "/" || c === "%" || c === "^" || c === "?" || c === ":" || c === ".") {
|
|
32973
|
+
this.current = this.newToken(TOP, c);
|
|
32974
|
+
} else if (c === "∙" || c === "•") {
|
|
32975
|
+
this.current = this.newToken(TOP, "*");
|
|
32976
|
+
} else if (c === ">") {
|
|
32977
|
+
if (this.expression.charAt(this.pos + 1) === "=") {
|
|
32978
|
+
this.current = this.newToken(TOP, ">=");
|
|
32979
|
+
this.pos++;
|
|
32980
|
+
} else {
|
|
32981
|
+
this.current = this.newToken(TOP, ">");
|
|
32982
|
+
}
|
|
32983
|
+
} else if (c === "<") {
|
|
32984
|
+
if (this.expression.charAt(this.pos + 1) === "=") {
|
|
32985
|
+
this.current = this.newToken(TOP, "<=");
|
|
32986
|
+
this.pos++;
|
|
32987
|
+
} else {
|
|
32988
|
+
this.current = this.newToken(TOP, "<");
|
|
32989
|
+
}
|
|
32990
|
+
} else if (c === "|") {
|
|
32991
|
+
if (this.expression.charAt(this.pos + 1) === "|") {
|
|
32992
|
+
this.current = this.newToken(TOP, "||");
|
|
32993
|
+
this.pos++;
|
|
32994
|
+
} else {
|
|
32995
|
+
return false;
|
|
32996
|
+
}
|
|
32997
|
+
} else if (c === "=") {
|
|
32998
|
+
if (this.expression.charAt(this.pos + 1) === "=") {
|
|
32999
|
+
this.current = this.newToken(TOP, "==");
|
|
33000
|
+
this.pos++;
|
|
33001
|
+
} else {
|
|
33002
|
+
this.current = this.newToken(TOP, c);
|
|
33003
|
+
}
|
|
33004
|
+
} else if (c === "!") {
|
|
33005
|
+
if (this.expression.charAt(this.pos + 1) === "=") {
|
|
33006
|
+
this.current = this.newToken(TOP, "!=");
|
|
33007
|
+
this.pos++;
|
|
33008
|
+
} else {
|
|
33009
|
+
this.current = this.newToken(TOP, c);
|
|
33010
|
+
}
|
|
33011
|
+
} else {
|
|
33012
|
+
return false;
|
|
33013
|
+
}
|
|
33014
|
+
this.pos++;
|
|
33015
|
+
if (this.isOperatorEnabled(this.current.value)) {
|
|
33016
|
+
return true;
|
|
33017
|
+
} else {
|
|
33018
|
+
this.pos = startPos;
|
|
33019
|
+
return false;
|
|
33020
|
+
}
|
|
33021
|
+
};
|
|
33022
|
+
TokenStream.prototype.isOperatorEnabled = function(op) {
|
|
33023
|
+
return this.parser.isOperatorEnabled(op);
|
|
33024
|
+
};
|
|
33025
|
+
TokenStream.prototype.getCoordinates = function() {
|
|
33026
|
+
var line = 0;
|
|
33027
|
+
var column;
|
|
33028
|
+
var newline = -1;
|
|
33029
|
+
do {
|
|
33030
|
+
line++;
|
|
33031
|
+
column = this.pos - newline;
|
|
33032
|
+
newline = this.expression.indexOf("\n", newline + 1);
|
|
33033
|
+
} while (newline >= 0 && newline < this.pos);
|
|
33034
|
+
return {
|
|
33035
|
+
line,
|
|
33036
|
+
column
|
|
33037
|
+
};
|
|
33038
|
+
};
|
|
33039
|
+
TokenStream.prototype.parseError = function(msg) {
|
|
33040
|
+
var coords = this.getCoordinates();
|
|
33041
|
+
throw new Error("parse error [" + coords.line + ":" + coords.column + "]: " + msg);
|
|
33042
|
+
};
|
|
33043
|
+
function ParserState(parser2, tokenStream, options) {
|
|
33044
|
+
this.parser = parser2;
|
|
33045
|
+
this.tokens = tokenStream;
|
|
33046
|
+
this.current = null;
|
|
33047
|
+
this.nextToken = null;
|
|
33048
|
+
this.next();
|
|
33049
|
+
this.savedCurrent = null;
|
|
33050
|
+
this.savedNextToken = null;
|
|
33051
|
+
this.allowMemberAccess = options.allowMemberAccess !== false;
|
|
33052
|
+
}
|
|
33053
|
+
ParserState.prototype.next = function() {
|
|
33054
|
+
this.current = this.nextToken;
|
|
33055
|
+
return this.nextToken = this.tokens.next();
|
|
33056
|
+
};
|
|
33057
|
+
ParserState.prototype.tokenMatches = function(token, value) {
|
|
33058
|
+
if (typeof value === "undefined") {
|
|
33059
|
+
return true;
|
|
33060
|
+
} else if (Array.isArray(value)) {
|
|
33061
|
+
return contains(value, token.value);
|
|
33062
|
+
} else if (typeof value === "function") {
|
|
33063
|
+
return value(token);
|
|
33064
|
+
} else {
|
|
33065
|
+
return token.value === value;
|
|
33066
|
+
}
|
|
33067
|
+
};
|
|
33068
|
+
ParserState.prototype.save = function() {
|
|
33069
|
+
this.savedCurrent = this.current;
|
|
33070
|
+
this.savedNextToken = this.nextToken;
|
|
33071
|
+
this.tokens.save();
|
|
33072
|
+
};
|
|
33073
|
+
ParserState.prototype.restore = function() {
|
|
33074
|
+
this.tokens.restore();
|
|
33075
|
+
this.current = this.savedCurrent;
|
|
33076
|
+
this.nextToken = this.savedNextToken;
|
|
33077
|
+
};
|
|
33078
|
+
ParserState.prototype.accept = function(type, value) {
|
|
33079
|
+
if (this.nextToken.type === type && this.tokenMatches(this.nextToken, value)) {
|
|
33080
|
+
this.next();
|
|
33081
|
+
return true;
|
|
33082
|
+
}
|
|
33083
|
+
return false;
|
|
33084
|
+
};
|
|
33085
|
+
ParserState.prototype.expect = function(type, value) {
|
|
33086
|
+
if (!this.accept(type, value)) {
|
|
33087
|
+
var coords = this.tokens.getCoordinates();
|
|
33088
|
+
throw new Error("parse error [" + coords.line + ":" + coords.column + "]: Expected " + (value || type));
|
|
33089
|
+
}
|
|
33090
|
+
};
|
|
33091
|
+
ParserState.prototype.parseAtom = function(instr) {
|
|
33092
|
+
var unaryOps = this.tokens.unaryOps;
|
|
33093
|
+
function isPrefixOperator(token) {
|
|
33094
|
+
return token.value in unaryOps;
|
|
33095
|
+
}
|
|
33096
|
+
if (this.accept(TNAME) || this.accept(TOP, isPrefixOperator)) {
|
|
33097
|
+
instr.push(new Instruction(IVAR, this.current.value));
|
|
33098
|
+
} else if (this.accept(TNUMBER)) {
|
|
33099
|
+
instr.push(new Instruction(INUMBER, this.current.value));
|
|
33100
|
+
} else if (this.accept(TSTRING)) {
|
|
33101
|
+
instr.push(new Instruction(INUMBER, this.current.value));
|
|
33102
|
+
} else if (this.accept(TPAREN, "(")) {
|
|
33103
|
+
this.parseExpression(instr);
|
|
33104
|
+
this.expect(TPAREN, ")");
|
|
33105
|
+
} else if (this.accept(TBRACKET, "[")) {
|
|
33106
|
+
if (this.accept(TBRACKET, "]")) {
|
|
33107
|
+
instr.push(new Instruction(IARRAY, 0));
|
|
33108
|
+
} else {
|
|
33109
|
+
var argCount = this.parseArrayList(instr);
|
|
33110
|
+
instr.push(new Instruction(IARRAY, argCount));
|
|
33111
|
+
}
|
|
33112
|
+
} else {
|
|
33113
|
+
throw new Error("unexpected " + this.nextToken);
|
|
33114
|
+
}
|
|
33115
|
+
};
|
|
33116
|
+
ParserState.prototype.parseExpression = function(instr) {
|
|
33117
|
+
var exprInstr = [];
|
|
33118
|
+
if (this.parseUntilEndStatement(instr, exprInstr)) {
|
|
33119
|
+
return;
|
|
33120
|
+
}
|
|
33121
|
+
this.parseVariableAssignmentExpression(exprInstr);
|
|
33122
|
+
if (this.parseUntilEndStatement(instr, exprInstr)) {
|
|
33123
|
+
return;
|
|
33124
|
+
}
|
|
33125
|
+
this.pushExpression(instr, exprInstr);
|
|
33126
|
+
};
|
|
33127
|
+
ParserState.prototype.pushExpression = function(instr, exprInstr) {
|
|
33128
|
+
for (var i = 0, len = exprInstr.length; i < len; i++) {
|
|
33129
|
+
instr.push(exprInstr[i]);
|
|
33130
|
+
}
|
|
33131
|
+
};
|
|
33132
|
+
ParserState.prototype.parseUntilEndStatement = function(instr, exprInstr) {
|
|
33133
|
+
if (!this.accept(TSEMICOLON)) return false;
|
|
33134
|
+
if (this.nextToken && this.nextToken.type !== TEOF && !(this.nextToken.type === TPAREN && this.nextToken.value === ")")) {
|
|
33135
|
+
exprInstr.push(new Instruction(IENDSTATEMENT));
|
|
33136
|
+
}
|
|
33137
|
+
if (this.nextToken.type !== TEOF) {
|
|
33138
|
+
this.parseExpression(exprInstr);
|
|
33139
|
+
}
|
|
33140
|
+
instr.push(new Instruction(IEXPR, exprInstr));
|
|
33141
|
+
return true;
|
|
33142
|
+
};
|
|
33143
|
+
ParserState.prototype.parseArrayList = function(instr) {
|
|
33144
|
+
var argCount = 0;
|
|
33145
|
+
while (!this.accept(TBRACKET, "]")) {
|
|
33146
|
+
this.parseExpression(instr);
|
|
33147
|
+
++argCount;
|
|
33148
|
+
while (this.accept(TCOMMA)) {
|
|
33149
|
+
this.parseExpression(instr);
|
|
33150
|
+
++argCount;
|
|
33151
|
+
}
|
|
33152
|
+
}
|
|
33153
|
+
return argCount;
|
|
33154
|
+
};
|
|
33155
|
+
ParserState.prototype.parseVariableAssignmentExpression = function(instr) {
|
|
33156
|
+
this.parseConditionalExpression(instr);
|
|
33157
|
+
while (this.accept(TOP, "=")) {
|
|
33158
|
+
var varName = instr.pop();
|
|
33159
|
+
var varValue = [];
|
|
33160
|
+
var lastInstrIndex = instr.length - 1;
|
|
33161
|
+
if (varName.type === IFUNCALL) {
|
|
33162
|
+
if (!this.tokens.isOperatorEnabled("()=")) {
|
|
33163
|
+
throw new Error("function definition is not permitted");
|
|
33164
|
+
}
|
|
33165
|
+
for (var i = 0, len = varName.value + 1; i < len; i++) {
|
|
33166
|
+
var index2 = lastInstrIndex - i;
|
|
33167
|
+
if (instr[index2].type === IVAR) {
|
|
33168
|
+
instr[index2] = new Instruction(IVARNAME, instr[index2].value);
|
|
33169
|
+
}
|
|
33170
|
+
}
|
|
33171
|
+
this.parseVariableAssignmentExpression(varValue);
|
|
33172
|
+
instr.push(new Instruction(IEXPR, varValue));
|
|
33173
|
+
instr.push(new Instruction(IFUNDEF, varName.value));
|
|
33174
|
+
continue;
|
|
33175
|
+
}
|
|
33176
|
+
if (varName.type !== IVAR && varName.type !== IMEMBER) {
|
|
33177
|
+
throw new Error("expected variable for assignment");
|
|
33178
|
+
}
|
|
33179
|
+
this.parseVariableAssignmentExpression(varValue);
|
|
33180
|
+
instr.push(new Instruction(IVARNAME, varName.value));
|
|
33181
|
+
instr.push(new Instruction(IEXPR, varValue));
|
|
33182
|
+
instr.push(binaryInstruction("="));
|
|
33183
|
+
}
|
|
33184
|
+
};
|
|
33185
|
+
ParserState.prototype.parseConditionalExpression = function(instr) {
|
|
33186
|
+
this.parseOrExpression(instr);
|
|
33187
|
+
while (this.accept(TOP, "?")) {
|
|
33188
|
+
var trueBranch = [];
|
|
33189
|
+
var falseBranch = [];
|
|
33190
|
+
this.parseConditionalExpression(trueBranch);
|
|
33191
|
+
this.expect(TOP, ":");
|
|
33192
|
+
this.parseConditionalExpression(falseBranch);
|
|
33193
|
+
instr.push(new Instruction(IEXPR, trueBranch));
|
|
33194
|
+
instr.push(new Instruction(IEXPR, falseBranch));
|
|
33195
|
+
instr.push(ternaryInstruction("?"));
|
|
33196
|
+
}
|
|
33197
|
+
};
|
|
33198
|
+
ParserState.prototype.parseOrExpression = function(instr) {
|
|
33199
|
+
this.parseAndExpression(instr);
|
|
33200
|
+
while (this.accept(TOP, "or")) {
|
|
33201
|
+
var falseBranch = [];
|
|
33202
|
+
this.parseAndExpression(falseBranch);
|
|
33203
|
+
instr.push(new Instruction(IEXPR, falseBranch));
|
|
33204
|
+
instr.push(binaryInstruction("or"));
|
|
33205
|
+
}
|
|
33206
|
+
};
|
|
33207
|
+
ParserState.prototype.parseAndExpression = function(instr) {
|
|
33208
|
+
this.parseComparison(instr);
|
|
33209
|
+
while (this.accept(TOP, "and")) {
|
|
33210
|
+
var trueBranch = [];
|
|
33211
|
+
this.parseComparison(trueBranch);
|
|
33212
|
+
instr.push(new Instruction(IEXPR, trueBranch));
|
|
33213
|
+
instr.push(binaryInstruction("and"));
|
|
33214
|
+
}
|
|
33215
|
+
};
|
|
33216
|
+
var COMPARISON_OPERATORS = ["==", "!=", "<", "<=", ">=", ">", "in"];
|
|
33217
|
+
ParserState.prototype.parseComparison = function(instr) {
|
|
33218
|
+
this.parseAddSub(instr);
|
|
33219
|
+
while (this.accept(TOP, COMPARISON_OPERATORS)) {
|
|
33220
|
+
var op = this.current;
|
|
33221
|
+
this.parseAddSub(instr);
|
|
33222
|
+
instr.push(binaryInstruction(op.value));
|
|
33223
|
+
}
|
|
33224
|
+
};
|
|
33225
|
+
var ADD_SUB_OPERATORS = ["+", "-", "||"];
|
|
33226
|
+
ParserState.prototype.parseAddSub = function(instr) {
|
|
33227
|
+
this.parseTerm(instr);
|
|
33228
|
+
while (this.accept(TOP, ADD_SUB_OPERATORS)) {
|
|
33229
|
+
var op = this.current;
|
|
33230
|
+
this.parseTerm(instr);
|
|
33231
|
+
instr.push(binaryInstruction(op.value));
|
|
33232
|
+
}
|
|
33233
|
+
};
|
|
33234
|
+
var TERM_OPERATORS = ["*", "/", "%"];
|
|
33235
|
+
ParserState.prototype.parseTerm = function(instr) {
|
|
33236
|
+
this.parseFactor(instr);
|
|
33237
|
+
while (this.accept(TOP, TERM_OPERATORS)) {
|
|
33238
|
+
var op = this.current;
|
|
33239
|
+
this.parseFactor(instr);
|
|
33240
|
+
instr.push(binaryInstruction(op.value));
|
|
33241
|
+
}
|
|
33242
|
+
};
|
|
33243
|
+
ParserState.prototype.parseFactor = function(instr) {
|
|
33244
|
+
var unaryOps = this.tokens.unaryOps;
|
|
33245
|
+
function isPrefixOperator(token) {
|
|
33246
|
+
return token.value in unaryOps;
|
|
33247
|
+
}
|
|
33248
|
+
this.save();
|
|
33249
|
+
if (this.accept(TOP, isPrefixOperator)) {
|
|
33250
|
+
if (this.current.value !== "-" && this.current.value !== "+") {
|
|
33251
|
+
if (this.nextToken.type === TPAREN && this.nextToken.value === "(") {
|
|
33252
|
+
this.restore();
|
|
33253
|
+
this.parseExponential(instr);
|
|
33254
|
+
return;
|
|
33255
|
+
} else if (this.nextToken.type === TSEMICOLON || this.nextToken.type === TCOMMA || this.nextToken.type === TEOF || this.nextToken.type === TPAREN && this.nextToken.value === ")") {
|
|
33256
|
+
this.restore();
|
|
33257
|
+
this.parseAtom(instr);
|
|
33258
|
+
return;
|
|
33259
|
+
}
|
|
33260
|
+
}
|
|
33261
|
+
var op = this.current;
|
|
33262
|
+
this.parseFactor(instr);
|
|
33263
|
+
instr.push(unaryInstruction(op.value));
|
|
33264
|
+
} else {
|
|
33265
|
+
this.parseExponential(instr);
|
|
33266
|
+
}
|
|
33267
|
+
};
|
|
33268
|
+
ParserState.prototype.parseExponential = function(instr) {
|
|
33269
|
+
this.parsePostfixExpression(instr);
|
|
33270
|
+
while (this.accept(TOP, "^")) {
|
|
33271
|
+
this.parseFactor(instr);
|
|
33272
|
+
instr.push(binaryInstruction("^"));
|
|
33273
|
+
}
|
|
33274
|
+
};
|
|
33275
|
+
ParserState.prototype.parsePostfixExpression = function(instr) {
|
|
33276
|
+
this.parseFunctionCall(instr);
|
|
33277
|
+
while (this.accept(TOP, "!")) {
|
|
33278
|
+
instr.push(unaryInstruction("!"));
|
|
33279
|
+
}
|
|
33280
|
+
};
|
|
33281
|
+
ParserState.prototype.parseFunctionCall = function(instr) {
|
|
33282
|
+
var unaryOps = this.tokens.unaryOps;
|
|
33283
|
+
function isPrefixOperator(token) {
|
|
33284
|
+
return token.value in unaryOps;
|
|
33285
|
+
}
|
|
33286
|
+
if (this.accept(TOP, isPrefixOperator)) {
|
|
33287
|
+
var op = this.current;
|
|
33288
|
+
this.parseAtom(instr);
|
|
33289
|
+
instr.push(unaryInstruction(op.value));
|
|
33290
|
+
} else {
|
|
33291
|
+
this.parseMemberExpression(instr);
|
|
33292
|
+
while (this.accept(TPAREN, "(")) {
|
|
33293
|
+
if (this.accept(TPAREN, ")")) {
|
|
33294
|
+
instr.push(new Instruction(IFUNCALL, 0));
|
|
33295
|
+
} else {
|
|
33296
|
+
var argCount = this.parseArgumentList(instr);
|
|
33297
|
+
instr.push(new Instruction(IFUNCALL, argCount));
|
|
33298
|
+
}
|
|
33299
|
+
}
|
|
33300
|
+
}
|
|
33301
|
+
};
|
|
33302
|
+
ParserState.prototype.parseArgumentList = function(instr) {
|
|
33303
|
+
var argCount = 0;
|
|
33304
|
+
while (!this.accept(TPAREN, ")")) {
|
|
33305
|
+
this.parseExpression(instr);
|
|
33306
|
+
++argCount;
|
|
33307
|
+
while (this.accept(TCOMMA)) {
|
|
33308
|
+
this.parseExpression(instr);
|
|
33309
|
+
++argCount;
|
|
33310
|
+
}
|
|
33311
|
+
}
|
|
33312
|
+
return argCount;
|
|
33313
|
+
};
|
|
33314
|
+
ParserState.prototype.parseMemberExpression = function(instr) {
|
|
33315
|
+
this.parseAtom(instr);
|
|
33316
|
+
while (this.accept(TOP, ".") || this.accept(TBRACKET, "[")) {
|
|
33317
|
+
var op = this.current;
|
|
33318
|
+
if (op.value === ".") {
|
|
33319
|
+
if (!this.allowMemberAccess) {
|
|
33320
|
+
throw new Error('unexpected ".", member access is not permitted');
|
|
33321
|
+
}
|
|
33322
|
+
this.expect(TNAME);
|
|
33323
|
+
instr.push(new Instruction(IMEMBER, this.current.value));
|
|
33324
|
+
} else if (op.value === "[") {
|
|
33325
|
+
if (!this.tokens.isOperatorEnabled("[")) {
|
|
33326
|
+
throw new Error('unexpected "[]", arrays are disabled');
|
|
33327
|
+
}
|
|
33328
|
+
this.parseExpression(instr);
|
|
33329
|
+
this.expect(TBRACKET, "]");
|
|
33330
|
+
instr.push(binaryInstruction("["));
|
|
33331
|
+
} else {
|
|
33332
|
+
throw new Error("unexpected symbol: " + op.value);
|
|
33333
|
+
}
|
|
33334
|
+
}
|
|
33335
|
+
};
|
|
33336
|
+
function add(a2, b) {
|
|
33337
|
+
return Number(a2) + Number(b);
|
|
33338
|
+
}
|
|
33339
|
+
function sub(a2, b) {
|
|
33340
|
+
return a2 - b;
|
|
33341
|
+
}
|
|
33342
|
+
function mul(a2, b) {
|
|
33343
|
+
return a2 * b;
|
|
33344
|
+
}
|
|
33345
|
+
function div(a2, b) {
|
|
33346
|
+
return a2 / b;
|
|
33347
|
+
}
|
|
33348
|
+
function mod(a2, b) {
|
|
33349
|
+
return a2 % b;
|
|
33350
|
+
}
|
|
33351
|
+
function concat(a2, b) {
|
|
33352
|
+
if (Array.isArray(a2) && Array.isArray(b)) {
|
|
33353
|
+
return a2.concat(b);
|
|
33354
|
+
}
|
|
33355
|
+
return "" + a2 + b;
|
|
33356
|
+
}
|
|
33357
|
+
function equal(a2, b) {
|
|
33358
|
+
return a2 === b;
|
|
33359
|
+
}
|
|
33360
|
+
function notEqual(a2, b) {
|
|
33361
|
+
return a2 !== b;
|
|
33362
|
+
}
|
|
33363
|
+
function greaterThan(a2, b) {
|
|
33364
|
+
return a2 > b;
|
|
33365
|
+
}
|
|
33366
|
+
function lessThan(a2, b) {
|
|
33367
|
+
return a2 < b;
|
|
33368
|
+
}
|
|
33369
|
+
function greaterThanEqual(a2, b) {
|
|
33370
|
+
return a2 >= b;
|
|
33371
|
+
}
|
|
33372
|
+
function lessThanEqual(a2, b) {
|
|
33373
|
+
return a2 <= b;
|
|
33374
|
+
}
|
|
33375
|
+
function andOperator(a2, b) {
|
|
33376
|
+
return Boolean(a2 && b);
|
|
33377
|
+
}
|
|
33378
|
+
function orOperator(a2, b) {
|
|
33379
|
+
return Boolean(a2 || b);
|
|
33380
|
+
}
|
|
33381
|
+
function inOperator(a2, b) {
|
|
33382
|
+
return contains(b, a2);
|
|
33383
|
+
}
|
|
33384
|
+
function sinh(a2) {
|
|
33385
|
+
return (Math.exp(a2) - Math.exp(-a2)) / 2;
|
|
33386
|
+
}
|
|
33387
|
+
function cosh(a2) {
|
|
33388
|
+
return (Math.exp(a2) + Math.exp(-a2)) / 2;
|
|
33389
|
+
}
|
|
33390
|
+
function tanh(a2) {
|
|
33391
|
+
if (a2 === Infinity) return 1;
|
|
33392
|
+
if (a2 === -Infinity) return -1;
|
|
33393
|
+
return (Math.exp(a2) - Math.exp(-a2)) / (Math.exp(a2) + Math.exp(-a2));
|
|
33394
|
+
}
|
|
33395
|
+
function asinh(a2) {
|
|
33396
|
+
if (a2 === -Infinity) return a2;
|
|
33397
|
+
return Math.log(a2 + Math.sqrt(a2 * a2 + 1));
|
|
33398
|
+
}
|
|
33399
|
+
function acosh(a2) {
|
|
33400
|
+
return Math.log(a2 + Math.sqrt(a2 * a2 - 1));
|
|
33401
|
+
}
|
|
33402
|
+
function atanh(a2) {
|
|
33403
|
+
return Math.log((1 + a2) / (1 - a2)) / 2;
|
|
33404
|
+
}
|
|
33405
|
+
function log10(a2) {
|
|
33406
|
+
return Math.log(a2) * Math.LOG10E;
|
|
33407
|
+
}
|
|
33408
|
+
function neg(a2) {
|
|
33409
|
+
return -a2;
|
|
33410
|
+
}
|
|
33411
|
+
function not(a2) {
|
|
33412
|
+
return !a2;
|
|
33413
|
+
}
|
|
33414
|
+
function trunc(a2) {
|
|
33415
|
+
return a2 < 0 ? Math.ceil(a2) : Math.floor(a2);
|
|
33416
|
+
}
|
|
33417
|
+
function random(a2) {
|
|
33418
|
+
return Math.random() * (a2 || 1);
|
|
33419
|
+
}
|
|
33420
|
+
function factorial(a2) {
|
|
33421
|
+
return gamma(a2 + 1);
|
|
33422
|
+
}
|
|
33423
|
+
function isInteger(value) {
|
|
33424
|
+
return isFinite(value) && value === Math.round(value);
|
|
33425
|
+
}
|
|
33426
|
+
var GAMMA_G = 4.7421875;
|
|
33427
|
+
var GAMMA_P = [
|
|
33428
|
+
0.9999999999999971,
|
|
33429
|
+
57.15623566586292,
|
|
33430
|
+
-59.59796035547549,
|
|
33431
|
+
14.136097974741746,
|
|
33432
|
+
-0.4919138160976202,
|
|
33433
|
+
3399464998481189e-20,
|
|
33434
|
+
4652362892704858e-20,
|
|
33435
|
+
-9837447530487956e-20,
|
|
33436
|
+
1580887032249125e-19,
|
|
33437
|
+
-21026444172410488e-20,
|
|
33438
|
+
21743961811521265e-20,
|
|
33439
|
+
-1643181065367639e-19,
|
|
33440
|
+
8441822398385275e-20,
|
|
33441
|
+
-26190838401581408e-21,
|
|
33442
|
+
36899182659531625e-22
|
|
33443
|
+
];
|
|
33444
|
+
function gamma(n) {
|
|
33445
|
+
var t, x;
|
|
33446
|
+
if (isInteger(n)) {
|
|
33447
|
+
if (n <= 0) {
|
|
33448
|
+
return isFinite(n) ? Infinity : NaN;
|
|
33449
|
+
}
|
|
33450
|
+
if (n > 171) {
|
|
33451
|
+
return Infinity;
|
|
33452
|
+
}
|
|
33453
|
+
var value = n - 2;
|
|
33454
|
+
var res = n - 1;
|
|
33455
|
+
while (value > 1) {
|
|
33456
|
+
res *= value;
|
|
33457
|
+
value--;
|
|
33458
|
+
}
|
|
33459
|
+
if (res === 0) {
|
|
33460
|
+
res = 1;
|
|
33461
|
+
}
|
|
33462
|
+
return res;
|
|
33463
|
+
}
|
|
33464
|
+
if (n < 0.5) {
|
|
33465
|
+
return Math.PI / (Math.sin(Math.PI * n) * gamma(1 - n));
|
|
33466
|
+
}
|
|
33467
|
+
if (n >= 171.35) {
|
|
33468
|
+
return Infinity;
|
|
33469
|
+
}
|
|
33470
|
+
if (n > 85) {
|
|
33471
|
+
var twoN = n * n;
|
|
33472
|
+
var threeN = twoN * n;
|
|
33473
|
+
var fourN = threeN * n;
|
|
33474
|
+
var fiveN = fourN * n;
|
|
33475
|
+
return Math.sqrt(2 * Math.PI / n) * Math.pow(n / Math.E, n) * (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + 5246819 / (75246796800 * fiveN * n));
|
|
33476
|
+
}
|
|
33477
|
+
--n;
|
|
33478
|
+
x = GAMMA_P[0];
|
|
33479
|
+
for (var i = 1; i < GAMMA_P.length; ++i) {
|
|
33480
|
+
x += GAMMA_P[i] / (n + i);
|
|
33481
|
+
}
|
|
33482
|
+
t = n + GAMMA_G + 0.5;
|
|
33483
|
+
return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x;
|
|
33484
|
+
}
|
|
33485
|
+
function stringOrArrayLength(s) {
|
|
33486
|
+
if (Array.isArray(s)) {
|
|
33487
|
+
return s.length;
|
|
33488
|
+
}
|
|
33489
|
+
return String(s).length;
|
|
33490
|
+
}
|
|
33491
|
+
function hypot() {
|
|
33492
|
+
var sum2 = 0;
|
|
33493
|
+
var larg = 0;
|
|
33494
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
33495
|
+
var arg = Math.abs(arguments[i]);
|
|
33496
|
+
var div2;
|
|
33497
|
+
if (larg < arg) {
|
|
33498
|
+
div2 = larg / arg;
|
|
33499
|
+
sum2 = sum2 * div2 * div2 + 1;
|
|
33500
|
+
larg = arg;
|
|
33501
|
+
} else if (arg > 0) {
|
|
33502
|
+
div2 = arg / larg;
|
|
33503
|
+
sum2 += div2 * div2;
|
|
33504
|
+
} else {
|
|
33505
|
+
sum2 += arg;
|
|
33506
|
+
}
|
|
33507
|
+
}
|
|
33508
|
+
return larg === Infinity ? Infinity : larg * Math.sqrt(sum2);
|
|
33509
|
+
}
|
|
33510
|
+
function condition(cond, yep, nope) {
|
|
33511
|
+
return cond ? yep : nope;
|
|
33512
|
+
}
|
|
33513
|
+
function roundTo(value, exp) {
|
|
33514
|
+
if (typeof exp === "undefined" || +exp === 0) {
|
|
33515
|
+
return Math.round(value);
|
|
33516
|
+
}
|
|
33517
|
+
value = +value;
|
|
33518
|
+
exp = -+exp;
|
|
33519
|
+
if (isNaN(value) || !(typeof exp === "number" && exp % 1 === 0)) {
|
|
33520
|
+
return NaN;
|
|
33521
|
+
}
|
|
33522
|
+
value = value.toString().split("e");
|
|
33523
|
+
value = Math.round(+(value[0] + "e" + (value[1] ? +value[1] - exp : -exp)));
|
|
33524
|
+
value = value.toString().split("e");
|
|
33525
|
+
return +(value[0] + "e" + (value[1] ? +value[1] + exp : exp));
|
|
33526
|
+
}
|
|
33527
|
+
function setVar(name, value, variables) {
|
|
33528
|
+
if (variables) variables[name] = value;
|
|
33529
|
+
return value;
|
|
33530
|
+
}
|
|
33531
|
+
function arrayIndex(array2, index2) {
|
|
33532
|
+
return array2[index2 | 0];
|
|
33533
|
+
}
|
|
33534
|
+
function max(array2) {
|
|
33535
|
+
if (arguments.length === 1 && Array.isArray(array2)) {
|
|
33536
|
+
return Math.max.apply(Math, array2);
|
|
33537
|
+
} else {
|
|
33538
|
+
return Math.max.apply(Math, arguments);
|
|
33539
|
+
}
|
|
33540
|
+
}
|
|
33541
|
+
function min(array2) {
|
|
33542
|
+
if (arguments.length === 1 && Array.isArray(array2)) {
|
|
33543
|
+
return Math.min.apply(Math, array2);
|
|
33544
|
+
} else {
|
|
33545
|
+
return Math.min.apply(Math, arguments);
|
|
33546
|
+
}
|
|
33547
|
+
}
|
|
33548
|
+
function arrayMap(f, a2) {
|
|
33549
|
+
if (typeof f !== "function") {
|
|
33550
|
+
throw new Error("First argument to map is not a function");
|
|
33551
|
+
}
|
|
33552
|
+
if (!Array.isArray(a2)) {
|
|
33553
|
+
throw new Error("Second argument to map is not an array");
|
|
33554
|
+
}
|
|
33555
|
+
return a2.map(function(x, i) {
|
|
33556
|
+
return f(x, i);
|
|
33557
|
+
});
|
|
33558
|
+
}
|
|
33559
|
+
function arrayFold(f, init2, a2) {
|
|
33560
|
+
if (typeof f !== "function") {
|
|
33561
|
+
throw new Error("First argument to fold is not a function");
|
|
33562
|
+
}
|
|
33563
|
+
if (!Array.isArray(a2)) {
|
|
33564
|
+
throw new Error("Second argument to fold is not an array");
|
|
33565
|
+
}
|
|
33566
|
+
return a2.reduce(function(acc, x, i) {
|
|
33567
|
+
return f(acc, x, i);
|
|
33568
|
+
}, init2);
|
|
33569
|
+
}
|
|
33570
|
+
function arrayFilter(f, a2) {
|
|
33571
|
+
if (typeof f !== "function") {
|
|
33572
|
+
throw new Error("First argument to filter is not a function");
|
|
33573
|
+
}
|
|
33574
|
+
if (!Array.isArray(a2)) {
|
|
33575
|
+
throw new Error("Second argument to filter is not an array");
|
|
33576
|
+
}
|
|
33577
|
+
return a2.filter(function(x, i) {
|
|
33578
|
+
return f(x, i);
|
|
33579
|
+
});
|
|
33580
|
+
}
|
|
33581
|
+
function stringOrArrayIndexOf(target, s) {
|
|
33582
|
+
if (!(Array.isArray(s) || typeof s === "string")) {
|
|
33583
|
+
throw new Error("Second argument to indexOf is not a string or array");
|
|
33584
|
+
}
|
|
33585
|
+
return s.indexOf(target);
|
|
33586
|
+
}
|
|
33587
|
+
function arrayJoin(sep, a2) {
|
|
33588
|
+
if (!Array.isArray(a2)) {
|
|
33589
|
+
throw new Error("Second argument to join is not an array");
|
|
33590
|
+
}
|
|
33591
|
+
return a2.join(sep);
|
|
33592
|
+
}
|
|
33593
|
+
function sign(x) {
|
|
33594
|
+
return (x > 0) - (x < 0) || +x;
|
|
33595
|
+
}
|
|
33596
|
+
var ONE_THIRD = 1 / 3;
|
|
33597
|
+
function cbrt(x) {
|
|
33598
|
+
return x < 0 ? -Math.pow(-x, ONE_THIRD) : Math.pow(x, ONE_THIRD);
|
|
33599
|
+
}
|
|
33600
|
+
function expm1(x) {
|
|
33601
|
+
return Math.exp(x) - 1;
|
|
33602
|
+
}
|
|
33603
|
+
function log1p(x) {
|
|
33604
|
+
return Math.log(1 + x);
|
|
33605
|
+
}
|
|
33606
|
+
function log2(x) {
|
|
33607
|
+
return Math.log(x) / Math.LN2;
|
|
33608
|
+
}
|
|
33609
|
+
function Parser(options) {
|
|
33610
|
+
this.options = options || {};
|
|
33611
|
+
this.unaryOps = {
|
|
33612
|
+
sin: Math.sin,
|
|
33613
|
+
cos: Math.cos,
|
|
33614
|
+
tan: Math.tan,
|
|
33615
|
+
asin: Math.asin,
|
|
33616
|
+
acos: Math.acos,
|
|
33617
|
+
atan: Math.atan,
|
|
33618
|
+
sinh: Math.sinh || sinh,
|
|
33619
|
+
cosh: Math.cosh || cosh,
|
|
33620
|
+
tanh: Math.tanh || tanh,
|
|
33621
|
+
asinh: Math.asinh || asinh,
|
|
33622
|
+
acosh: Math.acosh || acosh,
|
|
33623
|
+
atanh: Math.atanh || atanh,
|
|
33624
|
+
sqrt: Math.sqrt,
|
|
33625
|
+
cbrt: Math.cbrt || cbrt,
|
|
33626
|
+
log: Math.log,
|
|
33627
|
+
log2: Math.log2 || log2,
|
|
33628
|
+
ln: Math.log,
|
|
33629
|
+
lg: Math.log10 || log10,
|
|
33630
|
+
log10: Math.log10 || log10,
|
|
33631
|
+
expm1: Math.expm1 || expm1,
|
|
33632
|
+
log1p: Math.log1p || log1p,
|
|
33633
|
+
abs: Math.abs,
|
|
33634
|
+
ceil: Math.ceil,
|
|
33635
|
+
floor: Math.floor,
|
|
33636
|
+
round: Math.round,
|
|
33637
|
+
trunc: Math.trunc || trunc,
|
|
33638
|
+
"-": neg,
|
|
33639
|
+
"+": Number,
|
|
33640
|
+
exp: Math.exp,
|
|
33641
|
+
not,
|
|
33642
|
+
length: stringOrArrayLength,
|
|
33643
|
+
"!": factorial,
|
|
33644
|
+
sign: Math.sign || sign
|
|
33645
|
+
};
|
|
33646
|
+
this.binaryOps = {
|
|
33647
|
+
"+": add,
|
|
33648
|
+
"-": sub,
|
|
33649
|
+
"*": mul,
|
|
33650
|
+
"/": div,
|
|
33651
|
+
"%": mod,
|
|
33652
|
+
"^": Math.pow,
|
|
33653
|
+
"||": concat,
|
|
33654
|
+
"==": equal,
|
|
33655
|
+
"!=": notEqual,
|
|
33656
|
+
">": greaterThan,
|
|
33657
|
+
"<": lessThan,
|
|
33658
|
+
">=": greaterThanEqual,
|
|
33659
|
+
"<=": lessThanEqual,
|
|
33660
|
+
and: andOperator,
|
|
33661
|
+
or: orOperator,
|
|
33662
|
+
"in": inOperator,
|
|
33663
|
+
"=": setVar,
|
|
33664
|
+
"[": arrayIndex
|
|
33665
|
+
};
|
|
33666
|
+
this.ternaryOps = {
|
|
33667
|
+
"?": condition
|
|
33668
|
+
};
|
|
33669
|
+
this.functions = {
|
|
33670
|
+
random,
|
|
33671
|
+
fac: factorial,
|
|
33672
|
+
min,
|
|
33673
|
+
max,
|
|
33674
|
+
hypot: Math.hypot || hypot,
|
|
33675
|
+
pyt: Math.hypot || hypot,
|
|
33676
|
+
// backward compat
|
|
33677
|
+
pow: Math.pow,
|
|
33678
|
+
atan2: Math.atan2,
|
|
33679
|
+
"if": condition,
|
|
33680
|
+
gamma,
|
|
33681
|
+
roundTo,
|
|
33682
|
+
map: arrayMap,
|
|
33683
|
+
fold: arrayFold,
|
|
33684
|
+
filter: arrayFilter,
|
|
33685
|
+
indexOf: stringOrArrayIndexOf,
|
|
33686
|
+
join: arrayJoin
|
|
33687
|
+
};
|
|
33688
|
+
this.consts = {
|
|
33689
|
+
E: Math.E,
|
|
33690
|
+
PI: Math.PI,
|
|
33691
|
+
"true": true,
|
|
33692
|
+
"false": false
|
|
33693
|
+
};
|
|
33694
|
+
}
|
|
33695
|
+
Parser.prototype.parse = function(expr) {
|
|
33696
|
+
var instr = [];
|
|
33697
|
+
var parserState = new ParserState(
|
|
33698
|
+
this,
|
|
33699
|
+
new TokenStream(this, expr),
|
|
33700
|
+
{ allowMemberAccess: this.options.allowMemberAccess }
|
|
33701
|
+
);
|
|
33702
|
+
parserState.parseExpression(instr);
|
|
33703
|
+
parserState.expect(TEOF, "EOF");
|
|
33704
|
+
return new Expression(instr, this);
|
|
33705
|
+
};
|
|
33706
|
+
Parser.prototype.evaluate = function(expr, variables) {
|
|
33707
|
+
return this.parse(expr).evaluate(variables);
|
|
33708
|
+
};
|
|
33709
|
+
var sharedParser = new Parser();
|
|
33710
|
+
Parser.parse = function(expr) {
|
|
33711
|
+
return sharedParser.parse(expr);
|
|
33712
|
+
};
|
|
33713
|
+
Parser.evaluate = function(expr, variables) {
|
|
33714
|
+
return sharedParser.parse(expr).evaluate(variables);
|
|
33715
|
+
};
|
|
33716
|
+
var optionNameMap = {
|
|
33717
|
+
"+": "add",
|
|
33718
|
+
"-": "subtract",
|
|
33719
|
+
"*": "multiply",
|
|
33720
|
+
"/": "divide",
|
|
33721
|
+
"%": "remainder",
|
|
33722
|
+
"^": "power",
|
|
33723
|
+
"!": "factorial",
|
|
33724
|
+
"<": "comparison",
|
|
33725
|
+
">": "comparison",
|
|
33726
|
+
"<=": "comparison",
|
|
33727
|
+
">=": "comparison",
|
|
33728
|
+
"==": "comparison",
|
|
33729
|
+
"!=": "comparison",
|
|
33730
|
+
"||": "concatenate",
|
|
33731
|
+
"and": "logical",
|
|
33732
|
+
"or": "logical",
|
|
33733
|
+
"not": "logical",
|
|
33734
|
+
"?": "conditional",
|
|
33735
|
+
":": "conditional",
|
|
33736
|
+
"=": "assignment",
|
|
33737
|
+
"[": "array",
|
|
33738
|
+
"()=": "fndef"
|
|
33739
|
+
};
|
|
33740
|
+
function getOptionName(op) {
|
|
33741
|
+
return optionNameMap.hasOwnProperty(op) ? optionNameMap[op] : op;
|
|
33742
|
+
}
|
|
33743
|
+
Parser.prototype.isOperatorEnabled = function(op) {
|
|
33744
|
+
var optionName = getOptionName(op);
|
|
33745
|
+
var operators = this.options.operators || {};
|
|
33746
|
+
return !(optionName in operators) || !!operators[optionName];
|
|
33747
|
+
};
|
|
33748
|
+
const OPTIONAL_CHAIN_PATH_REGEX = /\b[$A-Za-z_][$\w]*(?:(?:\?\.)|\.)[$A-Za-z_][$\w]*(?:(?:\?\.)[$A-Za-z_][$\w]*|(?:\.)[$A-Za-z_][$\w]*)*/g;
|
|
33749
|
+
const LENGTH_ACCESS_REGEX = /\b([$A-Za-z_][$\w]*(?:\.[$A-Za-z_][$\w]*)*)\.length\b/g;
|
|
33750
|
+
const OPTIONAL_LENGTH_ACCESS_REGEX = /(__optional\("[^"]+"\))\.length\b/g;
|
|
33751
|
+
const parser = new Parser({
|
|
33752
|
+
allowMemberAccess: true,
|
|
33753
|
+
operators: {
|
|
33754
|
+
assignment: false,
|
|
33755
|
+
fndef: false
|
|
33756
|
+
}
|
|
33757
|
+
});
|
|
33758
|
+
const expressionCache = /* @__PURE__ */ new Map();
|
|
33759
|
+
function normalizeExpression(expression) {
|
|
33760
|
+
return expression.replace(OPTIONAL_CHAIN_PATH_REGEX, (chain) => {
|
|
33761
|
+
if (!chain.includes("?.")) {
|
|
33762
|
+
return chain;
|
|
33763
|
+
}
|
|
33764
|
+
const serializedPath = chain.replace(/\?\./g, ".");
|
|
33765
|
+
return `__optional("${serializedPath}")`;
|
|
33766
|
+
}).replace(LENGTH_ACCESS_REGEX, (_, basePath) => `__length(${basePath})`).replace(OPTIONAL_LENGTH_ACCESS_REGEX, (_, optionalPath) => `__length(${optionalPath})`).replaceAll("!==", "!=").replaceAll("===", "==").replaceAll("&&", " and ").replaceAll("||", " or ").replace(/!\s*(?!=)/g, "not ");
|
|
33767
|
+
}
|
|
33768
|
+
function parseExpression(expression) {
|
|
33769
|
+
const cached = expressionCache.get(expression);
|
|
33770
|
+
if (cached) {
|
|
33771
|
+
return cached;
|
|
33772
|
+
}
|
|
33773
|
+
const parsed = parser.parse(normalizeExpression(expression));
|
|
33774
|
+
expressionCache.set(expression, parsed);
|
|
33775
|
+
return parsed;
|
|
33776
|
+
}
|
|
32135
33777
|
function evaluateExpression(expression, data) {
|
|
33778
|
+
if (expression === void 0 || expression === null) {
|
|
33779
|
+
return expression;
|
|
33780
|
+
}
|
|
33781
|
+
if (typeof expression !== "string") {
|
|
33782
|
+
return expression;
|
|
33783
|
+
}
|
|
33784
|
+
const scope = {
|
|
33785
|
+
data,
|
|
33786
|
+
undefined: void 0,
|
|
33787
|
+
null: null
|
|
33788
|
+
};
|
|
33789
|
+
scope.__optional = (path) => {
|
|
33790
|
+
return path.split(".").reduce((current, key) => {
|
|
33791
|
+
if (current === null || current === void 0) {
|
|
33792
|
+
return void 0;
|
|
33793
|
+
}
|
|
33794
|
+
return current[key];
|
|
33795
|
+
}, scope);
|
|
33796
|
+
};
|
|
33797
|
+
scope.__length = (value) => {
|
|
33798
|
+
if (value === null || value === void 0) {
|
|
33799
|
+
return void 0;
|
|
33800
|
+
}
|
|
33801
|
+
if (typeof value === "string" || Array.isArray(value)) {
|
|
33802
|
+
return value.length;
|
|
33803
|
+
}
|
|
33804
|
+
if (typeof value === "object" && "length" in value) {
|
|
33805
|
+
const length = value.length;
|
|
33806
|
+
return typeof length === "number" ? length : void 0;
|
|
33807
|
+
}
|
|
33808
|
+
return void 0;
|
|
33809
|
+
};
|
|
32136
33810
|
try {
|
|
32137
|
-
const
|
|
32138
|
-
|
|
33811
|
+
const parsedExpression = parseExpression(expression);
|
|
33812
|
+
for (const symbol of parsedExpression.symbols()) {
|
|
33813
|
+
if (scope[symbol] !== void 0) {
|
|
33814
|
+
continue;
|
|
33815
|
+
}
|
|
33816
|
+
const value = globalThis[symbol];
|
|
33817
|
+
if (typeof value === "function") {
|
|
33818
|
+
scope[symbol] = value;
|
|
33819
|
+
}
|
|
33820
|
+
}
|
|
33821
|
+
return parsedExpression.evaluate(scope);
|
|
32139
33822
|
} catch (error) {
|
|
32140
33823
|
console.error(`Error while evaluating when (${expression}) in go-if: ${error.message}`);
|
|
32141
33824
|
}
|
|
@@ -33123,10 +34806,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
33123
34806
|
{
|
|
33124
34807
|
var consequent = ($$anchor2) => {
|
|
33125
34808
|
var fragment_1 = root_1$4();
|
|
33126
|
-
var
|
|
33127
|
-
var text2 = child(
|
|
33128
|
-
reset(
|
|
33129
|
-
var div_1 = sibling(
|
|
34809
|
+
var div2 = first_child(fragment_1);
|
|
34810
|
+
var text2 = child(div2);
|
|
34811
|
+
reset(div2);
|
|
34812
|
+
var div_1 = sibling(div2, 2);
|
|
33130
34813
|
var text_1 = child(div_1, true);
|
|
33131
34814
|
reset(div_1);
|
|
33132
34815
|
template_effect(() => {
|
|
@@ -34240,8 +35923,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
34240
35923
|
flushSync();
|
|
34241
35924
|
}
|
|
34242
35925
|
};
|
|
34243
|
-
var
|
|
34244
|
-
var node = child(
|
|
35926
|
+
var div2 = root_1();
|
|
35927
|
+
var node = child(div2);
|
|
34245
35928
|
{
|
|
34246
35929
|
const children = ($$anchor2, $$arg0) => {
|
|
34247
35930
|
let months = () => $$arg0?.().months;
|
|
@@ -34445,9 +36128,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
34445
36128
|
});
|
|
34446
36129
|
});
|
|
34447
36130
|
}
|
|
34448
|
-
reset(
|
|
34449
|
-
bind_this(
|
|
34450
|
-
append($$anchor,
|
|
36131
|
+
reset(div2);
|
|
36132
|
+
bind_this(div2, ($$value) => set(root2, $$value), () => get$2(root2));
|
|
36133
|
+
append($$anchor, div2);
|
|
34451
36134
|
return pop($$exports);
|
|
34452
36135
|
}
|
|
34453
36136
|
create_custom_element(CalendarUI, { calendarClass: {} }, [], ["details"], { mode: "open" });
|