reactive-md 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +13 -0
- package/CHANGELOG.md +13 -0
- package/README-ch.md +6 -6
- package/README-en.md +6 -6
- package/README.md +6 -6
- package/SECURITY-ch.md +3 -3
- package/SECURITY.md +3 -3
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/cli/build.mjs +1 -0
- package/cli/init.mjs +1 -1
- package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-sthUP0ct.js} +10 -10
- package/dist-library/LocalDocumentViewCore-GiWV3bey.js +9829 -0
- package/dist-library/LocalReactiveDocumentCore-ZjQSGyHE.js +275 -0
- package/dist-library/{authoring-Co_TiE-P.js → authoring-Dsune4Hy.js} +40 -20
- package/dist-library/{compile-LhpTKqCR.js → compile-wUv8KEge.js} +1 -1
- package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-As_m-MNm.js} +2449 -1742
- package/dist-library/{compiler-DfGbQhyD.js → compiler-eOfcinZs.js} +19 -19
- package/dist-library/{component-state-BBJ08vML.js → component-state-C52ZFJGl.js} +1 -1
- package/dist-library/{config-BUo-8O5C.js → config-BadfhjdP.js} +1 -1
- package/dist-library/{config-validation-C5kJYk-J.js → config-validation-F47AcE6o.js} +49 -1
- package/dist-library/{controls-BWiLLtBO.js → controls-CcT6n7k_.js} +2433 -2409
- package/dist-library/{coordinate-BSl6enWV.js → coordinate-CWS9p5q_.js} +108 -107
- package/dist-library/{data-table-DfvytZKQ.js → data-table-Bgccxd7h.js} +68 -65
- package/dist-library/{display-lw3BT1TA.js → display-B-VhqVND.js} +1 -1
- package/dist-library/{export-C7IDW9ul.js → export-BqVmTXm8.js} +145 -87
- package/dist-library/{gallery-B8kSt1oI.js → gallery-CY6mTx8i.js} +151 -147
- package/dist-library/html-CNT4KD-2.js +757 -0
- package/dist-library/{incremental-D_6vwAAE.js → incremental-Dv0FSp_U.js} +404 -142
- package/dist-library/layout-C0YlEPGr.js +562 -0
- package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-KxvtKgJb.js} +2 -2
- package/dist-library/options-1aDLK7JY.js +121 -0
- package/dist-library/{package-core-D0POW4Gd.js → package-core-WFK1RhAZ.js} +3 -3
- package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-Yuf3A_VI.js} +3270 -3778
- package/dist-library/react-D5iGiUdL.js +7 -0
- package/dist-library/reactive-md-authoring.js +16 -18
- package/dist-library/reactive-md-build.js +51 -51
- package/dist-library/reactive-md-compiler-standard.js +10 -9
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-export.js +4 -4
- package/dist-library/reactive-md-minimal-react-preset.js +3 -3
- package/dist-library/reactive-md-pdf.js +127 -3
- package/dist-library/reactive-md-plugin-chart.js +2 -2
- package/dist-library/reactive-md-plugin-data.js +4 -4
- package/dist-library/reactive-md-plugin-diagram.js +3 -3
- package/dist-library/reactive-md-plugin-forms.js +2 -2
- package/dist-library/reactive-md-plugin-gallery.js +2 -2
- package/dist-library/reactive-md-plugin-navigation.js +2 -2
- package/dist-library/reactive-md-plugin-network.js +117 -115
- package/dist-library/reactive-md-plugin-plot.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-server.js +6 -6
- package/dist-library/reactive-md-react-unstyled.js +10 -11
- package/dist-library/reactive-md-react.js +10 -11
- package/dist-library/reactive-md-sdk.js +3 -3
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +4 -4
- package/dist-library/reactive-md.js +280 -193
- package/dist-library/{registry-05JiqmEp.js → registry-B9NGct4d.js} +1 -1
- package/dist-library/{resources-IeJomeUT.js → resources-D2GDQS0p.js} +1 -1
- package/dist-library/{runtime-CuOyRe9f.js → runtime-kcA7bG7G.js} +341 -341
- package/dist-library/{schema-C-AeByPp.js → schema-BufhKUSM.js} +5 -5
- package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-BoJT1SIt.js} +490 -150
- package/dist-library/{session-core-BGka5D1J.js → session-core-nmJHuR9c.js} +170 -156
- package/dist-library/{shareable-jkGi2g6y.js → shareable-DpbE-59H.js} +207 -242
- package/dist-library/types/authoring/catalog.d.ts +1 -2
- package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
- package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
- package/dist-library/types/local/compilation/compiler.d.ts +3 -3
- package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
- package/dist-library/types/local/compilation/streaming.d.ts +27 -0
- package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
- package/dist-library/types/local/configuration/options-core.d.ts +1 -2
- package/dist-library/types/local/configuration/options.d.ts +1 -0
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html.d.ts +39 -3
- package/dist-library/types/local/index.d.ts +1 -1
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
- package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
- package/dist-library/types/local/parsing/parser.d.ts +2 -2
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/transport/worker.d.ts +27 -4
- package/dist-library/types/local/types.d.ts +52 -16
- package/dist-library/types/react/component-api.d.ts +10 -1
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/sdk-core.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +5 -4
- package/dist-library/types/standalone/prepare.d.ts +1 -1
- package/dist-library/types/standalone/session-core.d.ts +3 -2
- package/dist-library/{types-BFC5rzC4.js → types-BeNtPqdY.js} +1 -1
- package/dist-library/{validation-BlDL2uD9.js → validation-BEBA_HvS.js} +88 -72
- package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-CyV1FXzs.js} +6 -5
- package/dist-library/{visuals-BkYRmYGO.js → visuals-BZbZYA7w.js} +24181 -24180
- package/dist-standalone/reactive-md-standalone.js +124 -117
- package/docs/README-ch.md +2 -1
- package/docs/README.md +2 -1
- package/docs/compatibility/compatibility-ch.md +6 -6
- package/docs/compatibility/compatibility-en.md +6 -6
- package/docs/compatibility/source-versioning-ch.md +1 -1
- package/docs/compatibility/source-versioning-en.md +1 -1
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-development-reference-ch.md +2 -2
- package/docs/development/component-development-reference-en.md +2 -2
- package/docs/development/component-protocol-ch.md +2 -2
- package/docs/development/component-protocol-en.md +2 -2
- package/docs/development/extension-tutorial-ch.md +3 -3
- package/docs/development/extension-tutorial-en.md +3 -3
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/compiler-ch.md +3 -1
- package/docs/integration/compiler-en.md +3 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +2 -2
- package/docs/integration/extension-sdk-en.md +2 -2
- package/docs/integration/local-integration-ch.md +130 -8
- package/docs/integration/local-integration-en.md +130 -8
- package/docs/integration/shareable-export-ch.md +4 -2
- package/docs/integration/shareable-export-en.md +4 -2
- package/docs/reference/html-compatibility-ch.md +20 -67
- package/docs/reference/html-compatibility-en.md +19 -64
- package/docs/reference/public-api-ch.md +10 -7
- package/docs/reference/public-api-en.md +10 -7
- package/docs/releases/release-0.9.1-ch.md +29 -0
- package/docs/releases/release-0.9.1-en.md +29 -0
- package/examples/component-package/README-ch.md +1 -1
- package/examples/component-package/README.md +1 -1
- package/examples/game-2048-package/README-ch.md +1 -1
- package/examples/game-2048-package/README.md +1 -1
- package/examples/integration/README-ch.md +21 -2
- package/examples/integration/README.md +21 -2
- package/examples/integration/extension-sdk/README-ch.md +1 -1
- package/examples/integration/extension-sdk/README.md +1 -1
- package/examples/integration/streaming/index.html +48 -0
- package/examples/integration/streaming/main.js +175 -0
- package/examples/integration/streaming/package.json +13 -0
- package/examples/integration/streaming/worker.js +3 -0
- package/examples/minimal-extension/README-ch.md +3 -3
- package/examples/minimal-extension/README.md +3 -3
- package/examples/tetris-package/README-ch.md +1 -1
- package/examples/tetris-package/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
- package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
- package/dist-library/component-utils-BvHL8VGt.js +0 -298
- package/dist-library/layout-C22VjZh0.js +0 -542
- package/dist-library/options-CdSKOi7p.js +0 -116
- package/dist-library/react-LY5qsVeP.js +0 -7
|
@@ -1,119 +1,119 @@
|
|
|
1
1
|
import { dt as e } from "./preset-core-CKc5YXSM.js";
|
|
2
|
-
import { B as t, H as n, P as r, j as i } from "./config-validation-
|
|
3
|
-
import { a, c as o, r as s, s as c, t as l } from "./compile-
|
|
4
|
-
import {
|
|
5
|
-
import { i as
|
|
6
|
-
import { t as
|
|
7
|
-
import { A as
|
|
8
|
-
import { n as
|
|
2
|
+
import { B as t, H as n, P as r, j as i } from "./config-validation-F47AcE6o.js";
|
|
3
|
+
import { a, c as o, r as s, s as c, t as l } from "./compile-wUv8KEge.js";
|
|
4
|
+
import { C as u, S as d, a as f, c as p, h as m, i as h, l as g, n as _, o as v, p as y, r as b, t as x, u as S } from "./validation-BEBA_HvS.js";
|
|
5
|
+
import { i as C } from "./registry-core-Bbad9Bm2.js";
|
|
6
|
+
import { t as w } from "./registry-B9NGct4d.js";
|
|
7
|
+
import { A as ee, C as te, b as T } from "./component-state-BoLCGee4.js";
|
|
8
|
+
import { n as E } from "./runtime-B2fxeveq.js";
|
|
9
9
|
// src/local/runtime/runtime-values.ts
|
|
10
|
-
function
|
|
10
|
+
function D(e, t) {
|
|
11
11
|
return e.attrs?.[t];
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
let n =
|
|
13
|
+
function O(e, t) {
|
|
14
|
+
let n = D(e, t);
|
|
15
15
|
if (n === "true") return !0;
|
|
16
16
|
if (n === "false") return !1;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
let n =
|
|
18
|
+
function k(e, t) {
|
|
19
|
+
let n = D(e, t);
|
|
20
20
|
if (n === void 0) return;
|
|
21
21
|
let r = Number(n);
|
|
22
22
|
return Number.isFinite(r) ? r : void 0;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function A(e) {
|
|
25
25
|
return t(e);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function j(e, t) {
|
|
28
28
|
return {
|
|
29
29
|
ok: !1,
|
|
30
30
|
detail: r(e, t)
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function j(e, t) {
|
|
34
|
-
if (t !== void 0) return E(e, t);
|
|
35
|
-
}
|
|
36
33
|
function M(e, t) {
|
|
37
|
-
if (t !== void 0) return
|
|
34
|
+
if (t !== void 0) return D(e, t);
|
|
38
35
|
}
|
|
39
|
-
function N(
|
|
36
|
+
function N(e, t) {
|
|
37
|
+
if (t !== void 0) return k(e, t);
|
|
38
|
+
}
|
|
39
|
+
function P(t, n, r, i = {}) {
|
|
40
40
|
for (let a of r) if (a.kind === "date") {
|
|
41
|
-
if (!
|
|
42
|
-
let e = i.required ?? (a.required !== void 0 &&
|
|
43
|
-
if (n === "" && e) return
|
|
44
|
-
let r = i.min ??
|
|
45
|
-
if (n !== "" && r && n < r) return
|
|
46
|
-
if (n !== "" && o && n > o) return
|
|
41
|
+
if (!C(n)) return j("local.runtime.value.date-invalid");
|
|
42
|
+
let e = i.required ?? (a.required !== void 0 && O(t, a.required) === !0);
|
|
43
|
+
if (n === "" && e) return j("local.runtime.value.date-required");
|
|
44
|
+
let r = i.min ?? M(t, a.min), o = i.max ?? M(t, a.max);
|
|
45
|
+
if (n !== "" && r && n < r) return j("local.runtime.value.date-earlier", { min: r });
|
|
46
|
+
if (n !== "" && o && n > o) return j("local.runtime.value.date-later", { max: o });
|
|
47
47
|
} else if (a.kind === "required") {
|
|
48
|
-
let e = i.required ??
|
|
49
|
-
if (n === "" && e) return
|
|
48
|
+
let e = i.required ?? O(t, a.required) === !0;
|
|
49
|
+
if (n === "" && e) return j("local.runtime.value.field-required");
|
|
50
50
|
} else if (a.kind === "length") {
|
|
51
|
-
let e =
|
|
52
|
-
if (r !== void 0 && r > 0 && n !== "" && e < r) return
|
|
53
|
-
if (i !== void 0 && e > i) return
|
|
54
|
-
} else if (a.kind === "email" && (
|
|
55
|
-
if (n.length > 254) return
|
|
56
|
-
if (!e(n)) return
|
|
51
|
+
let e = A(n), r = N(t, a.min), i = N(t, a.max);
|
|
52
|
+
if (r !== void 0 && r > 0 && n !== "" && e < r) return j("local.runtime.value.min-length", { min: r });
|
|
53
|
+
if (i !== void 0 && e > i) return j("local.runtime.value.max-length", { max: i });
|
|
54
|
+
} else if (a.kind === "email" && (M(t, a.type) ?? "text") === a.value && n !== "") {
|
|
55
|
+
if (n.length > 254) return j("local.runtime.value.email-length", { limit: 254 });
|
|
56
|
+
if (!e(n)) return j("local.runtime.value.email-invalid");
|
|
57
57
|
}
|
|
58
58
|
return {
|
|
59
59
|
ok: !0,
|
|
60
60
|
value: n
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
var
|
|
64
|
-
function
|
|
65
|
-
if (!e.name) return
|
|
66
|
-
let t =
|
|
67
|
-
if (t !== void 0) return t ??
|
|
68
|
-
let n =
|
|
69
|
-
return
|
|
63
|
+
var F = /* @__PURE__ */ new Map();
|
|
64
|
+
function I(e) {
|
|
65
|
+
if (!e.name) return L;
|
|
66
|
+
let t = F.get(e.name);
|
|
67
|
+
if (t !== void 0) return t ?? L;
|
|
68
|
+
let n = w(e.name), r = n ? m(n) : L;
|
|
69
|
+
return F.set(e.name, n ? r : null), r;
|
|
70
70
|
}
|
|
71
|
-
var
|
|
72
|
-
function
|
|
71
|
+
var L = Object.freeze([]);
|
|
72
|
+
function R(e, t, n, r, a, s = !1) {
|
|
73
73
|
switch (e.type) {
|
|
74
74
|
case "number": {
|
|
75
|
-
if (typeof n != "number" || !Number.isFinite(n)) return
|
|
75
|
+
if (typeof n != "number" || !Number.isFinite(n)) return j("local.runtime.value.finite-number", { name: e.name });
|
|
76
76
|
let i = e.step ?? 1, a = e.min ?? 0;
|
|
77
77
|
for (let i of t) {
|
|
78
78
|
let t = r(i, "min");
|
|
79
|
-
if (t.present && !t.ok) return
|
|
79
|
+
if (t.present && !t.ok) return j("local.runtime.value.constraint", {
|
|
80
80
|
name: e.name,
|
|
81
81
|
attribute: "min"
|
|
82
82
|
});
|
|
83
83
|
if (t.present && t.ok) {
|
|
84
|
-
if (typeof t.value != "number" || !Number.isFinite(t.value)) return
|
|
84
|
+
if (typeof t.value != "number" || !Number.isFinite(t.value)) return j("local.runtime.value.constraint", {
|
|
85
85
|
name: e.name,
|
|
86
86
|
attribute: "min"
|
|
87
87
|
});
|
|
88
|
-
if (a = t.value, n < t.value) return
|
|
88
|
+
if (a = t.value, n < t.value) return j("local.runtime.value.min", {
|
|
89
89
|
name: e.name,
|
|
90
90
|
min: t.value
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
let o = r(i, "max");
|
|
94
|
-
if (o.present && !o.ok) return
|
|
94
|
+
if (o.present && !o.ok) return j("local.runtime.value.constraint", {
|
|
95
95
|
name: e.name,
|
|
96
96
|
attribute: "max"
|
|
97
97
|
});
|
|
98
98
|
if (o.present && o.ok) {
|
|
99
|
-
if (typeof o.value != "number" || !Number.isFinite(o.value)) return
|
|
99
|
+
if (typeof o.value != "number" || !Number.isFinite(o.value)) return j("local.runtime.value.constraint", {
|
|
100
100
|
name: e.name,
|
|
101
101
|
attribute: "max"
|
|
102
102
|
});
|
|
103
|
-
if (n > o.value) return
|
|
103
|
+
if (n > o.value) return j("local.runtime.value.max", {
|
|
104
104
|
name: e.name,
|
|
105
105
|
max: o.value
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
-
if (t.present && t.ok && o.present && o.ok && typeof t.value == "number" && typeof o.value == "number" && t.value > o.value) return
|
|
108
|
+
if (t.present && t.ok && o.present && o.ok && typeof t.value == "number" && typeof o.value == "number" && t.value > o.value) return j("local.runtime.value.constraint-range", { name: e.name });
|
|
109
109
|
}
|
|
110
|
-
return e.min !== void 0 && n < e.min ?
|
|
110
|
+
return e.min !== void 0 && n < e.min ? j("local.runtime.value.min", {
|
|
111
111
|
name: e.name,
|
|
112
112
|
min: e.min
|
|
113
|
-
}) : e.max !== void 0 && n > e.max ?
|
|
113
|
+
}) : e.max !== void 0 && n > e.max ? j("local.runtime.value.max", {
|
|
114
114
|
name: e.name,
|
|
115
115
|
max: e.max
|
|
116
|
-
}) : i > 0 && !
|
|
116
|
+
}) : i > 0 && !V(n, a, i) ? j("local.runtime.value.step", {
|
|
117
117
|
name: e.name,
|
|
118
118
|
step: i,
|
|
119
119
|
base: a
|
|
@@ -125,18 +125,18 @@ function L(e, t, n, r, a, s = !1) {
|
|
|
125
125
|
case "boolean": return typeof n == "boolean" ? {
|
|
126
126
|
ok: !0,
|
|
127
127
|
value: n
|
|
128
|
-
} :
|
|
128
|
+
} : j("local.runtime.value.boolean", { name: e.name });
|
|
129
129
|
case "string": {
|
|
130
|
-
if (typeof n != "string") return
|
|
130
|
+
if (typeof n != "string") return j("local.runtime.value.string", { name: e.name });
|
|
131
131
|
let c = o(n);
|
|
132
|
-
if (c) return
|
|
132
|
+
if (c) return j("local.runtime.value.budget", {
|
|
133
133
|
name: e.name,
|
|
134
134
|
detail: i(c),
|
|
135
135
|
detailKey: c.key,
|
|
136
136
|
...c.params
|
|
137
137
|
});
|
|
138
138
|
for (let i of t) {
|
|
139
|
-
let t = a?.get(i.id) ?? (s ?
|
|
139
|
+
let t = a?.get(i.id) ?? (s ? I(i) : L);
|
|
140
140
|
if (!t.length) continue;
|
|
141
141
|
let o = {};
|
|
142
142
|
for (let n of t) {
|
|
@@ -145,20 +145,20 @@ function L(e, t, n, r, a, s = !1) {
|
|
|
145
145
|
if (n[t] === void 0) continue;
|
|
146
146
|
let a = r(i, t);
|
|
147
147
|
if (a.present) {
|
|
148
|
-
if (!a.ok || typeof a.value != "string" || !
|
|
148
|
+
if (!a.ok || typeof a.value != "string" || !C(a.value)) return j("local.runtime.value.constraint-date", {
|
|
149
149
|
name: e.name,
|
|
150
150
|
attribute: t
|
|
151
151
|
});
|
|
152
152
|
o[t] = a.value;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
let t = o.min ??
|
|
156
|
-
if (t && a &&
|
|
155
|
+
let t = o.min ?? M(i, n.min), a = o.max ?? M(i, n.max);
|
|
156
|
+
if (t && a && C(t) && C(a) && t > a) return j("local.runtime.value.constraint-range", { name: e.name });
|
|
157
157
|
}
|
|
158
158
|
if ((n.kind === "date" || n.kind === "required" ? n.required : void 0) !== void 0) {
|
|
159
159
|
let t = r(i, "required");
|
|
160
160
|
if (t.present) {
|
|
161
|
-
if (!t.ok || typeof t.value != "boolean") return
|
|
161
|
+
if (!t.ok || typeof t.value != "boolean") return j("local.runtime.value.constraint", {
|
|
162
162
|
name: e.name,
|
|
163
163
|
attribute: "required"
|
|
164
164
|
});
|
|
@@ -166,10 +166,10 @@ function L(e, t, n, r, a, s = !1) {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
let c =
|
|
169
|
+
let c = P(i, n, t, o);
|
|
170
170
|
if (!c.ok) return c;
|
|
171
171
|
}
|
|
172
|
-
return e.options?.length && !e.options.includes(n) ?
|
|
172
|
+
return e.options?.length && !e.options.includes(n) ? j("local.runtime.value.option", {
|
|
173
173
|
value: n,
|
|
174
174
|
options: e.options.join(", ")
|
|
175
175
|
}) : {
|
|
@@ -178,16 +178,16 @@ function L(e, t, n, r, a, s = !1) {
|
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
180
|
case "array": {
|
|
181
|
-
if (!Array.isArray(n)) return
|
|
181
|
+
if (!Array.isArray(n)) return j("local.runtime.value.array", { name: e.name });
|
|
182
182
|
let t = o(n);
|
|
183
|
-
if (t) return
|
|
183
|
+
if (t) return j("local.runtime.value.budget", {
|
|
184
184
|
name: e.name,
|
|
185
185
|
detail: i(t),
|
|
186
186
|
detailKey: t.key,
|
|
187
187
|
...t.params
|
|
188
188
|
});
|
|
189
|
-
for (let t of n) if (typeof t != "string") return
|
|
190
|
-
if (e.family === "collection") return e.maxItems !== void 0 && n.length > e.maxItems ?
|
|
189
|
+
for (let t of n) if (typeof t != "string") return j("local.runtime.value.array-members", { name: e.name });
|
|
190
|
+
if (e.family === "collection") return e.maxItems !== void 0 && n.length > e.maxItems ? j("local.runtime.value.max-items", {
|
|
191
191
|
name: e.name,
|
|
192
192
|
max: e.maxItems
|
|
193
193
|
}) : {
|
|
@@ -196,11 +196,11 @@ function L(e, t, n, r, a, s = !1) {
|
|
|
196
196
|
};
|
|
197
197
|
let r = /* @__PURE__ */ new Set();
|
|
198
198
|
for (let t of n) {
|
|
199
|
-
if (e.options && !e.options.includes(t)) return
|
|
199
|
+
if (e.options && !e.options.includes(t)) return j("local.runtime.value.checklist-option", { value: t });
|
|
200
200
|
r.add(t);
|
|
201
201
|
}
|
|
202
202
|
let a = e.options ? e.options.filter((e) => r.has(e)) : [...r];
|
|
203
|
-
return e.maxItems !== void 0 && a.length > e.maxItems ?
|
|
203
|
+
return e.maxItems !== void 0 && a.length > e.maxItems ? j("local.runtime.value.max-items", {
|
|
204
204
|
name: e.name,
|
|
205
205
|
max: e.maxItems
|
|
206
206
|
}) : {
|
|
@@ -209,16 +209,16 @@ function L(e, t, n, r, a, s = !1) {
|
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
211
|
case "number-array": {
|
|
212
|
-
if (!Array.isArray(n)) return
|
|
212
|
+
if (!Array.isArray(n)) return j("local.runtime.value.number-array", { name: e.name });
|
|
213
213
|
let t = o(n);
|
|
214
|
-
if (t) return
|
|
214
|
+
if (t) return j("local.runtime.value.budget", {
|
|
215
215
|
name: e.name,
|
|
216
216
|
detail: i(t),
|
|
217
217
|
detailKey: t.key,
|
|
218
218
|
...t.params
|
|
219
219
|
});
|
|
220
|
-
for (let t of n) if (typeof t != "number" || !Number.isFinite(t)) return
|
|
221
|
-
return e.maxItems !== void 0 && n.length > e.maxItems ?
|
|
220
|
+
for (let t of n) if (typeof t != "number" || !Number.isFinite(t)) return j("local.runtime.value.number-array-members", { name: e.name });
|
|
221
|
+
return e.maxItems !== void 0 && n.length > e.maxItems ? j("local.runtime.value.max-items", {
|
|
222
222
|
name: e.name,
|
|
223
223
|
max: e.maxItems
|
|
224
224
|
}) : {
|
|
@@ -229,14 +229,14 @@ function L(e, t, n, r, a, s = !1) {
|
|
|
229
229
|
case "null": return n === null ? {
|
|
230
230
|
ok: !0,
|
|
231
231
|
value: n
|
|
232
|
-
} :
|
|
232
|
+
} : j("local.runtime.value.null", { name: e.name });
|
|
233
233
|
}
|
|
234
|
-
return
|
|
234
|
+
return j("local.runtime.value.unsupported-type", { name: e.name });
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function ne(e) {
|
|
237
237
|
return e instanceof a ? e : new a("expression-eval", e instanceof Error ? e.message : String(e), 0);
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function re(e, t) {
|
|
240
240
|
switch (e) {
|
|
241
241
|
case "string": {
|
|
242
242
|
if (typeof t != "string") return {
|
|
@@ -328,15 +328,15 @@ function ie(e, t) {
|
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
var
|
|
332
|
-
function
|
|
331
|
+
var z = 1e-9;
|
|
332
|
+
function B(e) {
|
|
333
333
|
return Array.isArray(e) ? e.slice() : e;
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function V(e, t, n) {
|
|
336
336
|
let r = (e - t) / n;
|
|
337
|
-
return Math.abs(r - Math.round(r)) <=
|
|
337
|
+
return Math.abs(r - Math.round(r)) <= z * Math.max(1, Math.abs(r));
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function H(e, t, n, r) {
|
|
340
340
|
let a = Math.max(0, Math.min(e.source.length, t.range.start)), o = e.source.slice(0, a).split("\n");
|
|
341
341
|
return {
|
|
342
342
|
code: n,
|
|
@@ -352,7 +352,7 @@ function V(e, t, n, r) {
|
|
|
352
352
|
...r.params ? { params: r.params } : {}
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function U(e, t, n) {
|
|
356
356
|
return {
|
|
357
357
|
code: e,
|
|
358
358
|
message: t,
|
|
@@ -370,7 +370,7 @@ function H(e, t, n) {
|
|
|
370
370
|
};
|
|
371
371
|
}
|
|
372
372
|
// src/local/runtime/runtime-document.ts
|
|
373
|
-
function
|
|
373
|
+
function W(e, t) {
|
|
374
374
|
let n = e.document.bindings[t];
|
|
375
375
|
if (!n) return;
|
|
376
376
|
let { nodeIds: r, owner: i, ...a } = n, o = (e.controls.get(t) ?? []).map((t) => {
|
|
@@ -391,7 +391,7 @@ function U(e, t) {
|
|
|
391
391
|
controls: o
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function ie(e, t) {
|
|
395
395
|
let n = t.get(e);
|
|
396
396
|
if (n) return {
|
|
397
397
|
expression: n,
|
|
@@ -410,18 +410,18 @@ function ae(e, t) {
|
|
|
410
410
|
} catch (e) {
|
|
411
411
|
return {
|
|
412
412
|
expression: null,
|
|
413
|
-
error:
|
|
413
|
+
error: ne(e)
|
|
414
414
|
};
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function ae(e, t) {
|
|
418
418
|
let r = /* @__PURE__ */ new Map();
|
|
419
419
|
for (let t of n(e.nodes)) r.set(t.id, t);
|
|
420
420
|
let s = {}, l = /* @__PURE__ */ new Map();
|
|
421
421
|
for (let [t, n] of Object.entries(e.bindings)) {
|
|
422
422
|
let e = o(n.initial);
|
|
423
423
|
if (e) throw new a("expression-budget", `Parameter "${t}": ${i(e)}`, 0);
|
|
424
|
-
s[t] =
|
|
424
|
+
s[t] = B(n.initial);
|
|
425
425
|
let c = [];
|
|
426
426
|
for (let e of n.nodeIds) {
|
|
427
427
|
let t = r.get(e);
|
|
@@ -429,11 +429,11 @@ function oe(e, t) {
|
|
|
429
429
|
}
|
|
430
430
|
l.set(t, c);
|
|
431
431
|
}
|
|
432
|
-
let
|
|
433
|
-
for (let [t, n] of Object.entries(e.bindingSlots ?? {}))
|
|
434
|
-
let
|
|
435
|
-
if (
|
|
436
|
-
let t =
|
|
432
|
+
let u = /* @__PURE__ */ new Map();
|
|
433
|
+
for (let [t, n] of Object.entries(e.bindingSlots ?? {})) u.set(t, { ...n });
|
|
434
|
+
let d = y(e), p = new Map(Object.entries(d?.valueRules ?? {})), m = d === void 0, h = /* @__PURE__ */ new Map();
|
|
435
|
+
if (d) for (let e of d.slotRelations) {
|
|
436
|
+
let t = u.get(e.nodeId), n = t?.[e.lower], r = t?.[e.upper];
|
|
437
437
|
if (!n || !r) continue;
|
|
438
438
|
let i = h.get(e.nodeId) ?? [];
|
|
439
439
|
i.push({
|
|
@@ -441,60 +441,60 @@ function oe(e, t) {
|
|
|
441
441
|
upper: r
|
|
442
442
|
}), h.set(e.nodeId, i);
|
|
443
443
|
}
|
|
444
|
-
else for (let [e, t] of
|
|
444
|
+
else for (let [e, t] of u) t.start && t.end && h.set(e, [{
|
|
445
445
|
lower: t.start,
|
|
446
446
|
upper: t.end
|
|
447
447
|
}]);
|
|
448
448
|
let g = /* @__PURE__ */ new Map();
|
|
449
449
|
for (let [t, n] of Object.entries(e.bindings)) for (let e of n.nodeIds) {
|
|
450
|
-
if (
|
|
450
|
+
if (u.has(e)) continue;
|
|
451
451
|
let n = g.get(e);
|
|
452
452
|
(n === void 0 || n.startsWith("@") && !t.startsWith("@")) && g.set(e, t);
|
|
453
453
|
}
|
|
454
|
-
let
|
|
455
|
-
for (let [e, t] of
|
|
454
|
+
let _ = Object.freeze(Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort()), b = /* @__PURE__ */ new Map();
|
|
455
|
+
for (let [e, t] of u) for (let n of Object.values(t)) {
|
|
456
456
|
if (n.startsWith("@")) continue;
|
|
457
|
-
let t =
|
|
458
|
-
t.add(e),
|
|
457
|
+
let t = b.get(n) ?? /* @__PURE__ */ new Set();
|
|
458
|
+
t.add(e), b.set(n, t);
|
|
459
459
|
}
|
|
460
|
-
let x = e.computations ?? {},
|
|
460
|
+
let x = e.computations ?? {}, C = Object.keys(x), w = /* @__PURE__ */ new Map();
|
|
461
461
|
for (let [e, n] of Object.entries(x)) {
|
|
462
|
-
let r =
|
|
463
|
-
r.expression &&
|
|
462
|
+
let r = ie(n.source, t);
|
|
463
|
+
r.expression && w.set(e, r.expression);
|
|
464
464
|
}
|
|
465
|
-
let { order:
|
|
466
|
-
for (let e of
|
|
465
|
+
let { order: ee, cyclic: te } = S(x), T = {}, E = /* @__PURE__ */ new Map();
|
|
466
|
+
for (let e of ee) {
|
|
467
467
|
let t = x[e];
|
|
468
468
|
if (!t || t.kind !== "const") continue;
|
|
469
469
|
if (Object.hasOwn(t, "value")) {
|
|
470
470
|
let n = t.value, r = c(n);
|
|
471
471
|
if (r) {
|
|
472
|
-
|
|
472
|
+
E.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
|
|
473
473
|
continue;
|
|
474
474
|
}
|
|
475
|
-
|
|
475
|
+
T[e] = B(n);
|
|
476
476
|
continue;
|
|
477
477
|
}
|
|
478
|
-
let n =
|
|
479
|
-
if (!n)
|
|
478
|
+
let n = w.get(e);
|
|
479
|
+
if (!n) E.set(e, new a("expression-eval", `Constant "${e}" cannot be evaluated.`, 0));
|
|
480
480
|
else try {
|
|
481
|
-
let t = n.evaluate({ ...
|
|
481
|
+
let t = n.evaluate({ ...T }), r = c(t);
|
|
482
482
|
if (r) {
|
|
483
|
-
|
|
483
|
+
E.set(e, new a("expression-budget", `Constant "${e}": ${r}`, 0));
|
|
484
484
|
continue;
|
|
485
485
|
}
|
|
486
|
-
|
|
486
|
+
T[e] = B(t);
|
|
487
487
|
} catch (t) {
|
|
488
|
-
|
|
488
|
+
E.set(e, ne(t));
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
let
|
|
492
|
-
for (let e of
|
|
493
|
-
let
|
|
491
|
+
let D = /* @__PURE__ */ new Map();
|
|
492
|
+
for (let e of te) D.set(e, new a("expression-cycle", `Computation "${e}" is part of a dependency cycle.`, 0));
|
|
493
|
+
let O = [];
|
|
494
494
|
if (Array.isArray(e.validations)) for (let n of e.validations) {
|
|
495
|
-
if (!
|
|
496
|
-
let e =
|
|
497
|
-
|
|
495
|
+
if (!f(n)) continue;
|
|
496
|
+
let e = ie(n.expression, t);
|
|
497
|
+
O.push({
|
|
498
498
|
rule: n,
|
|
499
499
|
expression: e.expression,
|
|
500
500
|
error: e.error
|
|
@@ -504,66 +504,66 @@ function oe(e, t) {
|
|
|
504
504
|
document: e,
|
|
505
505
|
nodeIndex: r,
|
|
506
506
|
controls: l,
|
|
507
|
-
slotKeys:
|
|
508
|
-
publicNames:
|
|
509
|
-
publicSlotOwners:
|
|
507
|
+
slotKeys: u,
|
|
508
|
+
publicNames: _,
|
|
509
|
+
publicSlotOwners: b,
|
|
510
510
|
initial: s,
|
|
511
511
|
valueRules: p,
|
|
512
512
|
legacyValueRules: m,
|
|
513
513
|
slotRelations: h,
|
|
514
514
|
bindingByNode: g,
|
|
515
515
|
computationMetadata: x,
|
|
516
|
-
computationNames:
|
|
517
|
-
computationOrder:
|
|
518
|
-
cyclicComputations:
|
|
519
|
-
computationExpressions:
|
|
520
|
-
constValues:
|
|
521
|
-
constErrors:
|
|
522
|
-
cycleErrors:
|
|
523
|
-
validationRules:
|
|
524
|
-
validationLineStarts:
|
|
516
|
+
computationNames: C,
|
|
517
|
+
computationOrder: ee,
|
|
518
|
+
cyclicComputations: te,
|
|
519
|
+
computationExpressions: w,
|
|
520
|
+
constValues: T,
|
|
521
|
+
constErrors: E,
|
|
522
|
+
cycleErrors: D,
|
|
523
|
+
validationRules: O,
|
|
524
|
+
validationLineStarts: v(typeof e.source == "string" ? e.source : "")
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function oe(e) {
|
|
528
528
|
return !e || e.syntax !== "local" ? "createLocalRuntime requires a local interaction document." : e.syntaxVersion !== void 0 && e.syntaxVersion !== "local-draft-3" || e.versionDeclaration && e.versionDeclaration.version !== "local-draft-3" ? `createLocalRuntime requires ${d}; migrate the source before constructing a runtime.` : null;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function G(e, t) {
|
|
531
531
|
return (e.controls.get(t.name) ?? [])[0] ?? (t.owner ? e.nodeIndex.get(t.owner) : void 0) ?? (t.nodeIds[0] ? e.nodeIndex.get(t.nodeIds[0]) : void 0);
|
|
532
532
|
}
|
|
533
|
-
function
|
|
534
|
-
let r =
|
|
535
|
-
return r ?
|
|
533
|
+
function se(e, t, n) {
|
|
534
|
+
let r = G(e, t);
|
|
535
|
+
return r ? H(e.document, r, "local.runtime.value", n) : U("local.runtime.value", i(n));
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function K(e, t, n) {
|
|
538
538
|
let r = e.slotRelations.get(t);
|
|
539
539
|
return r?.length ? r.some(({ lower: e, upper: t }) => {
|
|
540
540
|
let r = n[e], i = n[t];
|
|
541
541
|
return typeof r == "number" && typeof i == "number" && r > i;
|
|
542
542
|
}) : !1;
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function ce(e, t) {
|
|
545
545
|
let n = e.nodeIndex.get(t);
|
|
546
|
-
return n ?
|
|
546
|
+
return n ? H(e.document, n, "local.runtime.value", r("local.runtime.value.range-order")) : U("local.runtime.value", i(r("local.runtime.value.range-order")));
|
|
547
547
|
}
|
|
548
548
|
// src/local/runtime/retention.ts
|
|
549
|
-
function
|
|
549
|
+
function q(e) {
|
|
550
550
|
let t = /* @__PURE__ */ new Map();
|
|
551
551
|
for (let r of n(e.nodes)) t.set(r.id, r);
|
|
552
552
|
return t;
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function le(e, t, n) {
|
|
555
555
|
let r = e.bindingSlots?.[t.id];
|
|
556
556
|
return r !== void 0 && Object.values(r).includes(n);
|
|
557
557
|
}
|
|
558
|
-
function
|
|
559
|
-
let r = t.name ?
|
|
558
|
+
function J(e, t, n) {
|
|
559
|
+
let r = t.name ? w(t.name) : void 0;
|
|
560
560
|
if (r?.bindings) {
|
|
561
561
|
let i = e.bindingSlots?.[t.id];
|
|
562
562
|
for (let [e, a] of Object.entries(r.bindings)) if (t.attrs?.[a.bind] === n || e !== "value" && i?.[e] === n) return a.retain === !1 ? void 0 : a.initial;
|
|
563
|
-
} else if (t.attrs?.bind === n ||
|
|
563
|
+
} else if (t.attrs?.bind === n || le(e, t, n)) return "initial";
|
|
564
564
|
}
|
|
565
|
-
function
|
|
566
|
-
let t =
|
|
565
|
+
function Y(e) {
|
|
566
|
+
let t = q(e), n = y(e), r = new Set(n?.retentionExclusions ?? []), i = /* @__PURE__ */ new Map();
|
|
567
567
|
for (let [a, o] of Object.entries(e.bindings)) {
|
|
568
568
|
let s = o.nodeIds.flatMap((e) => {
|
|
569
569
|
let n = t.get(e);
|
|
@@ -572,7 +572,7 @@ function J(e) {
|
|
|
572
572
|
if (!s.length || a.startsWith("@") || r.has(a)) continue;
|
|
573
573
|
let c;
|
|
574
574
|
if (n === void 0) {
|
|
575
|
-
let t = s.map((t) =>
|
|
575
|
+
let t = s.map((t) => J(e, t, a));
|
|
576
576
|
if (t.some((e) => e === void 0)) continue;
|
|
577
577
|
c = t;
|
|
578
578
|
} else {
|
|
@@ -587,34 +587,34 @@ function J(e) {
|
|
|
587
587
|
}
|
|
588
588
|
return i;
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function X(e, t) {
|
|
591
591
|
return Object.freeze({
|
|
592
592
|
name: e,
|
|
593
593
|
reason: t
|
|
594
594
|
});
|
|
595
595
|
}
|
|
596
|
-
function
|
|
597
|
-
let t =
|
|
596
|
+
function Z(e) {
|
|
597
|
+
let t = Y(e.previous), n = Y(e.next), r = {}, i = [], a = [];
|
|
598
598
|
for (let o of Object.keys(e.state).sort()) {
|
|
599
599
|
if (o.startsWith("@")) {
|
|
600
|
-
a.push(
|
|
600
|
+
a.push(X(o, "internal"));
|
|
601
601
|
continue;
|
|
602
602
|
}
|
|
603
603
|
if (!Object.hasOwn(e.previous.bindings, o) || !Object.hasOwn(e.next.bindings, o)) {
|
|
604
|
-
a.push(
|
|
604
|
+
a.push(X(o, "unknown"));
|
|
605
605
|
continue;
|
|
606
606
|
}
|
|
607
607
|
let s = t.get(o), c = n.get(o);
|
|
608
608
|
if (!s || !c) {
|
|
609
|
-
a.push(
|
|
609
|
+
a.push(X(o, "unretainable"));
|
|
610
610
|
continue;
|
|
611
611
|
}
|
|
612
612
|
if (s.type !== c.type) {
|
|
613
|
-
a.push(
|
|
613
|
+
a.push(X(o, "type"));
|
|
614
614
|
continue;
|
|
615
615
|
}
|
|
616
616
|
if (s.initialDefinition !== c.initialDefinition) {
|
|
617
|
-
a.push(
|
|
617
|
+
a.push(X(o, "initial"));
|
|
618
618
|
continue;
|
|
619
619
|
}
|
|
620
620
|
let l = e.state[o];
|
|
@@ -626,7 +626,7 @@ function X(e) {
|
|
|
626
626
|
dropped: Object.freeze(a)
|
|
627
627
|
});
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function ue(e, t, n) {
|
|
630
630
|
return Object.freeze({
|
|
631
631
|
retained: Object.freeze([...e]),
|
|
632
632
|
dropped: Object.freeze(t.map((e) => Object.freeze({ ...e }))),
|
|
@@ -635,7 +635,7 @@ function Z(e, t, n) {
|
|
|
635
635
|
}
|
|
636
636
|
function Q(e, t) {
|
|
637
637
|
let n = Object.keys(t.values).sort();
|
|
638
|
-
if (!e.setParameters(t.values).length) return
|
|
638
|
+
if (!e.setParameters(t.values).length) return ue(n, t.dropped, []);
|
|
639
639
|
let r = [], i = n, a = [];
|
|
640
640
|
for (; i.length;) {
|
|
641
641
|
let n = [];
|
|
@@ -648,32 +648,32 @@ function Q(e, t) {
|
|
|
648
648
|
i = n;
|
|
649
649
|
}
|
|
650
650
|
r.sort();
|
|
651
|
-
let o = [...t.dropped, ...i.map((e) =>
|
|
652
|
-
return o.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)),
|
|
651
|
+
let o = [...t.dropped, ...i.map((e) => X(e, "invalid"))];
|
|
652
|
+
return o.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)), ue(r, o, a);
|
|
653
653
|
}
|
|
654
654
|
// src/local/runtime/runtime-migration.ts
|
|
655
655
|
function de(e, t, n, r, i) {
|
|
656
|
-
let a =
|
|
656
|
+
let a = Z({
|
|
657
657
|
previous: e.document,
|
|
658
658
|
state: t,
|
|
659
659
|
next: n
|
|
660
660
|
}), o = {};
|
|
661
|
-
for (let [e, t] of Object.entries(n.bindings)) o[e] =
|
|
661
|
+
for (let [e, t] of Object.entries(n.bindings)) o[e] = B(t.initial);
|
|
662
662
|
let s = /* @__PURE__ */ new Map();
|
|
663
663
|
for (let e of a.dropped) s.set(e.name, Object.freeze({ ...e }));
|
|
664
664
|
let c = [], l = {}, u = [], d = /* @__PURE__ */ new Set(), f, p = (n) => {
|
|
665
665
|
let o = e.document.bindings[n], s = e.controls.get(n) ?? [];
|
|
666
|
-
return !o || !s.some((t) => e.document.dynamicConstraints?.[t.id]) || (f ??= i({}, e, t),
|
|
666
|
+
return !o || !s.some((t) => e.document.dynamicConstraints?.[t.id]) || (f ??= i({}, e, t), R(o, s, a.values[n], f, e.valueRules, e.legacyValueRules).ok) ? !1 : W(e, n) === W(r, n);
|
|
667
667
|
};
|
|
668
668
|
for (let e of a.retained) {
|
|
669
669
|
let t = n.bindings[e];
|
|
670
670
|
if (!t) continue;
|
|
671
671
|
if (p(e)) {
|
|
672
|
-
d.add(e), l[e] =
|
|
672
|
+
d.add(e), l[e] = B(a.values[e]), u.push(e);
|
|
673
673
|
continue;
|
|
674
674
|
}
|
|
675
|
-
let f =
|
|
676
|
-
f.ok ? (l[e] =
|
|
675
|
+
let f = R(t, r.controls.get(e) ?? [], a.values[e], i(a.values, r, o), r.valueRules, r.legacyValueRules);
|
|
676
|
+
f.ok ? (l[e] = B(f.value), u.push(e)) : (c.push(se(r, t, f.detail)), s.set(e, Object.freeze({
|
|
677
677
|
name: e,
|
|
678
678
|
reason: "invalid"
|
|
679
679
|
})));
|
|
@@ -684,7 +684,7 @@ function de(e, t, n, r, i) {
|
|
|
684
684
|
}, h = /* @__PURE__ */ new Set();
|
|
685
685
|
for (let e of u) for (let t of r.publicSlotOwners.get(e) ?? []) h.add(t);
|
|
686
686
|
let g = !1;
|
|
687
|
-
for (let e of [...h].sort()) if (
|
|
687
|
+
for (let e of [...h].sort()) if (K(r, e, m)) {
|
|
688
688
|
g = !0;
|
|
689
689
|
break;
|
|
690
690
|
}
|
|
@@ -696,25 +696,25 @@ function de(e, t, n, r, i) {
|
|
|
696
696
|
let t = o[e];
|
|
697
697
|
o[e] = l[e];
|
|
698
698
|
let n = !1;
|
|
699
|
-
for (let t of [...r.publicSlotOwners.get(e) ?? []].sort())
|
|
699
|
+
for (let t of [...r.publicSlotOwners.get(e) ?? []].sort()) K(r, t, o) && (c.push(ce(r, t)), n = !0);
|
|
700
700
|
n ? (o[e] = t, s.set(e, Object.freeze({
|
|
701
701
|
name: e,
|
|
702
702
|
reason: "invalid"
|
|
703
703
|
}))) : _.push(e);
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
-
for (let [e, t] of r.slotRelations) if (
|
|
706
|
+
for (let [e, t] of r.slotRelations) if (K(r, e, o)) {
|
|
707
707
|
for (let e of t) for (let t of [e.lower, e.upper]) {
|
|
708
708
|
let e = n.bindings[t];
|
|
709
709
|
if (!e) continue;
|
|
710
|
-
o[t] =
|
|
710
|
+
o[t] = B(e.initial);
|
|
711
711
|
let r = _.indexOf(t);
|
|
712
712
|
r >= 0 && _.splice(r, 1), s.set(t, Object.freeze({
|
|
713
713
|
name: t,
|
|
714
714
|
reason: "invalid"
|
|
715
715
|
}));
|
|
716
716
|
}
|
|
717
|
-
if (c.push(
|
|
717
|
+
if (c.push(ce(r, e)), K(r, e, o)) return {
|
|
718
718
|
values: {},
|
|
719
719
|
retained: [],
|
|
720
720
|
dropped: [],
|
|
@@ -726,20 +726,20 @@ function de(e, t, n, r, i) {
|
|
|
726
726
|
let e = i({}, r, o), t = [];
|
|
727
727
|
for (let i of _) {
|
|
728
728
|
if (d.has(i)) continue;
|
|
729
|
-
let a = n.bindings[i], s =
|
|
730
|
-
s.ok || (c.push(
|
|
729
|
+
let a = n.bindings[i], s = R(a, r.controls.get(i) ?? [], o[i], e, r.valueRules, r.legacyValueRules);
|
|
730
|
+
s.ok || (c.push(se(r, a, s.detail)), t.push(i));
|
|
731
731
|
}
|
|
732
|
-
for (let e of t) o[e] =
|
|
732
|
+
for (let e of t) o[e] = B(n.bindings[e].initial), _.splice(_.indexOf(e), 1), s.set(e, Object.freeze({
|
|
733
733
|
name: e,
|
|
734
734
|
reason: "invalid"
|
|
735
735
|
}));
|
|
736
736
|
v = t.length > 0;
|
|
737
737
|
}
|
|
738
|
-
let
|
|
738
|
+
let y = [...s.values()].sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name));
|
|
739
739
|
return _.sort(), {
|
|
740
740
|
values: o,
|
|
741
741
|
retained: _,
|
|
742
|
-
dropped:
|
|
742
|
+
dropped: y,
|
|
743
743
|
diagnostics: c
|
|
744
744
|
};
|
|
745
745
|
}
|
|
@@ -780,50 +780,50 @@ function ve(e, t, n) {
|
|
|
780
780
|
return he.get(e)?.bindNetworkExternals(t, n) ?? (() => {});
|
|
781
781
|
}
|
|
782
782
|
function ye(e, t) {
|
|
783
|
-
let c =
|
|
783
|
+
let c = oe(e);
|
|
784
784
|
if (c) throw Error(c);
|
|
785
|
-
let
|
|
785
|
+
let d = t?.services === void 0, f = ee(t?.network), m = /* @__PURE__ */ new Map(), v = te(e.source), y = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), C = ae(e, S), w = () => C, D = () => {
|
|
786
786
|
let e = /* @__PURE__ */ new Set();
|
|
787
|
-
for (let r of n(
|
|
787
|
+
for (let r of n(C.document.nodes)) r.name !== void 0 && e.add(T({
|
|
788
788
|
documentId: t?.documentId,
|
|
789
|
-
sourceDigest:
|
|
789
|
+
sourceDigest: v,
|
|
790
790
|
nodeId: r.id,
|
|
791
791
|
stateKey: r.attrs?.["state-key"]
|
|
792
792
|
}));
|
|
793
793
|
return e;
|
|
794
|
-
},
|
|
794
|
+
}, O = t?.services ?? E({
|
|
795
795
|
documentId: t?.documentId,
|
|
796
|
-
sourceDigest:
|
|
796
|
+
sourceDigest: v,
|
|
797
797
|
randomSeed: t?.randomSeed,
|
|
798
798
|
componentState: t?.componentState,
|
|
799
799
|
...t?.componentStateStorage === void 0 ? {} : { componentStateStorage: t.componentStateStorage },
|
|
800
800
|
...t?.componentStateWriteDelayMs === void 0 ? {} : { componentStateWriteDelayMs: t.componentStateWriteDelayMs },
|
|
801
801
|
...t?.configKey === void 0 ? {} : { configKey: t.configKey },
|
|
802
802
|
...t?.legacyConfigKeys === void 0 ? {} : { legacyConfigKeys: t.legacyConfigKeys },
|
|
803
|
-
...
|
|
804
|
-
}),
|
|
803
|
+
...d ? { knownStateKeys: D } : {}
|
|
804
|
+
}), k = {}, A = /* @__PURE__ */ new Map();
|
|
805
805
|
for (let [n, r] of Object.entries(e.externals ?? {})) {
|
|
806
806
|
let e = t?.externalValues?.[n];
|
|
807
807
|
if (e === void 0) continue;
|
|
808
|
-
let i =
|
|
809
|
-
i.ok && (
|
|
808
|
+
let i = re(r.type, e);
|
|
809
|
+
i.ok && (k[n] = i.value);
|
|
810
810
|
}
|
|
811
|
-
let
|
|
811
|
+
let j = (e, t) => {
|
|
812
812
|
let n = {};
|
|
813
813
|
for (let [r, i] of Object.entries(e.document.externals ?? {})) {
|
|
814
814
|
if (!Object.hasOwn(t, r)) continue;
|
|
815
|
-
let e =
|
|
815
|
+
let e = re(i.type, t[r]);
|
|
816
816
|
e.ok && (n[r] = e.value);
|
|
817
817
|
}
|
|
818
818
|
return n;
|
|
819
|
-
},
|
|
820
|
-
let t =
|
|
821
|
-
for (let n of
|
|
819
|
+
}, M = (e) => {
|
|
820
|
+
let t = j(e, k);
|
|
821
|
+
for (let n of A.keys()) Object.assign(t, j(e, n));
|
|
822
822
|
return t;
|
|
823
|
-
},
|
|
823
|
+
}, N = (e, t, n, r = w()) => {
|
|
824
824
|
let i = r.document.dynamicConstraints?.[e.id]?.[t];
|
|
825
825
|
if (!i) return { present: !1 };
|
|
826
|
-
let a =
|
|
826
|
+
let a = ie(i.source, S);
|
|
827
827
|
if (!a.expression) return {
|
|
828
828
|
present: !0,
|
|
829
829
|
ok: !1
|
|
@@ -844,21 +844,21 @@ function ye(e, t) {
|
|
|
844
844
|
ok: !1
|
|
845
845
|
};
|
|
846
846
|
}
|
|
847
|
-
},
|
|
847
|
+
}, P = C.initial, F = 0, I = {}, L = {}, ne = {
|
|
848
848
|
revision: 0,
|
|
849
849
|
state: me({})
|
|
850
|
-
},
|
|
851
|
-
if (
|
|
850
|
+
}, z = !1, V = null, W = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Map(), q = () => {
|
|
851
|
+
if (z) throw Error("The local interaction runtime has been disposed.");
|
|
852
852
|
};
|
|
853
|
-
function
|
|
854
|
-
if (!t.startsWith("@") && Object.hasOwn(e.document.bindings, t)) return Object.hasOwn(
|
|
853
|
+
function le(e, t) {
|
|
854
|
+
if (!t.startsWith("@") && Object.hasOwn(e.document.bindings, t)) return Object.hasOwn(P, t) ? P[t] : void 0;
|
|
855
855
|
}
|
|
856
|
-
let
|
|
857
|
-
let n =
|
|
856
|
+
let J = (e, t) => {
|
|
857
|
+
let n = M(e), r = /* @__PURE__ */ new Map();
|
|
858
858
|
for (let t of Object.keys(e.document.externals ?? {})) Object.hasOwn(n, t) || r.set(t, new a("external-missing", "External data \"" + t + "\" is not available.", 0));
|
|
859
859
|
let i = {}, o = /* @__PURE__ */ new Map();
|
|
860
860
|
if (e.computationNames.length > 0) {
|
|
861
|
-
let a =
|
|
861
|
+
let a = g(e.computationMetadata, e.computationOrder, e.computationExpressions, {
|
|
862
862
|
...t,
|
|
863
863
|
...n
|
|
864
864
|
}, e.constValues, r);
|
|
@@ -885,187 +885,187 @@ function ye(e, t) {
|
|
|
885
885
|
environment: s,
|
|
886
886
|
snapshotState: c
|
|
887
887
|
};
|
|
888
|
-
},
|
|
889
|
-
let e =
|
|
890
|
-
|
|
891
|
-
},
|
|
888
|
+
}, Y = () => {
|
|
889
|
+
let e = J(w(), P);
|
|
890
|
+
I = e.environment, L = e.snapshotState;
|
|
891
|
+
}, X = (e, t = w(), n = P) => {
|
|
892
892
|
let r;
|
|
893
|
-
return (i, a) => t.document.dynamicConstraints?.[i.id]?.[a] ? (r ??=
|
|
893
|
+
return (i, a) => t.document.dynamicConstraints?.[i.id]?.[a] ? (r ??= J(t, {
|
|
894
894
|
...n,
|
|
895
895
|
...e
|
|
896
|
-
}).environment,
|
|
897
|
-
}, X = () => {
|
|
898
|
-
re = {
|
|
899
|
-
revision: P,
|
|
900
|
-
state: me(I)
|
|
901
|
-
};
|
|
896
|
+
}).environment, N(i, a, r, t)) : { present: !1 };
|
|
902
897
|
}, Z = () => {
|
|
903
|
-
|
|
898
|
+
ne = {
|
|
899
|
+
revision: F,
|
|
900
|
+
state: me(L)
|
|
901
|
+
};
|
|
902
|
+
}, ue = () => {
|
|
903
|
+
for (let e of W) e();
|
|
904
904
|
}, Q = (e) => {
|
|
905
|
-
|
|
905
|
+
P = e, F += 1, Y(), Z(), ue();
|
|
906
906
|
}, ge = () => {
|
|
907
|
-
|
|
908
|
-
}, _e = (e, t =
|
|
909
|
-
if (
|
|
907
|
+
F += 1, Y(), Z(), ue();
|
|
908
|
+
}, _e = (e, t = k) => {
|
|
909
|
+
if (q(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setExternalValues requires an object of external values.");
|
|
910
910
|
let n = [], a = {}, o = Object.keys(e).sort();
|
|
911
911
|
for (let t of o) {
|
|
912
912
|
if (t === "__proto__") {
|
|
913
|
-
n.push(
|
|
913
|
+
n.push(U("local.runtime.external", "External names cannot be \"__proto__\"."));
|
|
914
914
|
continue;
|
|
915
915
|
}
|
|
916
|
-
let o =
|
|
916
|
+
let o = w().document.externals ?? {}, s = Object.hasOwn(o, t) ? o[t] : void 0;
|
|
917
917
|
if (!s) {
|
|
918
918
|
let e = r("local.runtime.external", { name: t });
|
|
919
|
-
n.push(
|
|
919
|
+
n.push(U("local.runtime.external", i(e), e));
|
|
920
920
|
continue;
|
|
921
921
|
}
|
|
922
|
-
let c =
|
|
922
|
+
let c = re(s.type, e[t]);
|
|
923
923
|
if (c.ok) a[t] = c.value;
|
|
924
924
|
else {
|
|
925
925
|
let e = r(c.key, {
|
|
926
926
|
name: t,
|
|
927
927
|
...c.params ?? {}
|
|
928
928
|
});
|
|
929
|
-
n.push(
|
|
929
|
+
n.push(U("local.runtime.external", i(e), e));
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
return n.length ? n : (o.some((e) => !pe(t[e], a[e])) && (Object.assign(t, a), ge()), []);
|
|
933
933
|
}, ve = (e, t) => {
|
|
934
|
-
if (
|
|
934
|
+
if (z) return () => {};
|
|
935
935
|
let n = {}, r = e.bindExternalValues((e) => {
|
|
936
|
-
if (
|
|
936
|
+
if (z || !A.has(n)) return;
|
|
937
937
|
let r = _e(e, n);
|
|
938
938
|
r.length && t?.(r);
|
|
939
939
|
});
|
|
940
|
-
return r ? (
|
|
941
|
-
|
|
940
|
+
return r ? (A.set(n, r), () => {
|
|
941
|
+
A.delete(n) && (r(), !z && Object.keys(n).length && ge());
|
|
942
942
|
}) : () => {};
|
|
943
943
|
}, ye = (e) => {
|
|
944
|
-
|
|
945
|
-
let t =
|
|
944
|
+
q();
|
|
945
|
+
let t = w(), n = [], r = {}, i = Object.keys(e).sort(), a = X(e);
|
|
946
946
|
for (let o of i) {
|
|
947
947
|
if (o === "__proto__") {
|
|
948
|
-
n.push(
|
|
948
|
+
n.push(U("local.runtime.parameter", "Parameter names cannot be \"__proto__\"."));
|
|
949
949
|
continue;
|
|
950
950
|
}
|
|
951
951
|
if (o.startsWith("@")) {
|
|
952
|
-
n.push(
|
|
952
|
+
n.push(U("local.runtime.parameter", `Internal parameter "${o}" cannot be written by name.`));
|
|
953
953
|
continue;
|
|
954
954
|
}
|
|
955
955
|
if (!Object.hasOwn(t.document.bindings, o)) {
|
|
956
|
-
n.push(
|
|
956
|
+
n.push(U("local.runtime.parameter", `Unknown parameter "${o}".`));
|
|
957
957
|
continue;
|
|
958
958
|
}
|
|
959
|
-
let i = t.document.bindings[o], s =
|
|
960
|
-
s.ok ? r[o] =
|
|
959
|
+
let i = t.document.bindings[o], s = R(i, t.controls.get(o) ?? [], e[o], a, t.valueRules, t.legacyValueRules);
|
|
960
|
+
s.ok ? r[o] = B(s.value) : n.push(se(t, i, s.detail));
|
|
961
961
|
}
|
|
962
962
|
if (n.length) return n;
|
|
963
|
-
if (!i.some((e) => !pe(
|
|
963
|
+
if (!i.some((e) => !pe(P[e], r[e]))) return [];
|
|
964
964
|
let o = {
|
|
965
|
-
...
|
|
965
|
+
...P,
|
|
966
966
|
...r
|
|
967
967
|
}, s = /* @__PURE__ */ new Set();
|
|
968
968
|
for (let e of i) for (let n of t.publicSlotOwners.get(e) ?? []) s.add(n);
|
|
969
|
-
for (let e of [...s].sort())
|
|
969
|
+
for (let e of [...s].sort()) K(t, e, o) && n.push(ce(t, e));
|
|
970
970
|
return n.length ? n : (Q(o), []);
|
|
971
971
|
}, be = (e) => {
|
|
972
|
-
let t =
|
|
972
|
+
let t = y.get(e);
|
|
973
973
|
if (!t) {
|
|
974
|
-
if (t = l(e),
|
|
975
|
-
let e =
|
|
976
|
-
e !== void 0 &&
|
|
974
|
+
if (t = l(e), y.size >= 200) {
|
|
975
|
+
let e = y.keys().next().value;
|
|
976
|
+
e !== void 0 && y.delete(e);
|
|
977
977
|
}
|
|
978
|
-
|
|
978
|
+
y.set(e, t);
|
|
979
979
|
}
|
|
980
980
|
return t;
|
|
981
981
|
}, xe = () => {
|
|
982
|
-
let e =
|
|
982
|
+
let e = w(), t = [], n = typeof e.document.source == "string" ? e.document.source : "";
|
|
983
983
|
for (let r of e.validationRules) {
|
|
984
984
|
if (r.error) {
|
|
985
|
-
t.push(
|
|
985
|
+
t.push(p(n, e.validationLineStarts, r.rule.range, x, h(`Validation expression is invalid: ${r.error.message}`)));
|
|
986
986
|
continue;
|
|
987
987
|
}
|
|
988
988
|
if (!r.expression) continue;
|
|
989
989
|
let i;
|
|
990
990
|
try {
|
|
991
|
-
i = r.expression.evaluate(
|
|
991
|
+
i = r.expression.evaluate(I);
|
|
992
992
|
} catch (i) {
|
|
993
|
-
t.push(
|
|
993
|
+
t.push(p(n, e.validationLineStarts, r.rule.range, x, h(`Validation expression failed: ${i instanceof Error ? i.message : String(i)}`)));
|
|
994
994
|
continue;
|
|
995
995
|
}
|
|
996
|
-
typeof i == "boolean" ? i || t.push(
|
|
996
|
+
typeof i == "boolean" ? i || t.push(p(n, e.validationLineStarts, r.rule.range, _, Se(r.rule.message))) : t.push(p(n, e.validationLineStarts, r.rule.range, x, "Validation expression must evaluate to a boolean."));
|
|
997
997
|
}
|
|
998
998
|
return t;
|
|
999
999
|
}, Se = (e) => {
|
|
1000
1000
|
let t;
|
|
1001
1001
|
try {
|
|
1002
|
-
t = s(e,
|
|
1002
|
+
t = s(e, I);
|
|
1003
1003
|
} catch {
|
|
1004
|
-
t =
|
|
1004
|
+
t = b;
|
|
1005
1005
|
}
|
|
1006
|
-
return
|
|
1006
|
+
return h(t);
|
|
1007
1007
|
}, Ce = (e, t) => {
|
|
1008
|
-
if (
|
|
1008
|
+
if (q(), e === C.document) return $({
|
|
1009
1009
|
ok: !0,
|
|
1010
1010
|
changed: !1,
|
|
1011
|
-
revision:
|
|
1011
|
+
revision: F,
|
|
1012
1012
|
retained: [],
|
|
1013
1013
|
dropped: [],
|
|
1014
1014
|
diagnostics: []
|
|
1015
1015
|
});
|
|
1016
|
-
if (
|
|
1016
|
+
if (oe(e)) return $({
|
|
1017
1017
|
ok: !1,
|
|
1018
1018
|
changed: !1,
|
|
1019
|
-
revision:
|
|
1019
|
+
revision: F,
|
|
1020
1020
|
retained: [],
|
|
1021
1021
|
dropped: [],
|
|
1022
1022
|
diagnostics: []
|
|
1023
1023
|
});
|
|
1024
1024
|
let n;
|
|
1025
1025
|
try {
|
|
1026
|
-
n =
|
|
1026
|
+
n = ae(e, S);
|
|
1027
1027
|
} catch {
|
|
1028
1028
|
return $({
|
|
1029
1029
|
ok: !1,
|
|
1030
1030
|
changed: !1,
|
|
1031
|
-
revision:
|
|
1031
|
+
revision: F,
|
|
1032
1032
|
retained: [],
|
|
1033
1033
|
dropped: [],
|
|
1034
1034
|
diagnostics: []
|
|
1035
1035
|
});
|
|
1036
1036
|
}
|
|
1037
|
-
let r = de(
|
|
1037
|
+
let r = de(C, P, e, n, X);
|
|
1038
1038
|
if (Object.keys(r.values).length === 0 && Object.keys(e.bindings).length > 0) return $({
|
|
1039
1039
|
ok: !1,
|
|
1040
1040
|
changed: !1,
|
|
1041
|
-
revision:
|
|
1041
|
+
revision: F,
|
|
1042
1042
|
retained: [],
|
|
1043
1043
|
dropped: [],
|
|
1044
1044
|
diagnostics: []
|
|
1045
1045
|
});
|
|
1046
1046
|
let i;
|
|
1047
1047
|
try {
|
|
1048
|
-
i =
|
|
1048
|
+
i = J(n, r.values);
|
|
1049
1049
|
} catch {
|
|
1050
1050
|
return $({
|
|
1051
1051
|
ok: !1,
|
|
1052
1052
|
changed: !1,
|
|
1053
|
-
revision:
|
|
1053
|
+
revision: F,
|
|
1054
1054
|
retained: [],
|
|
1055
1055
|
dropped: [],
|
|
1056
1056
|
diagnostics: []
|
|
1057
1057
|
});
|
|
1058
1058
|
}
|
|
1059
|
-
for (let e of [
|
|
1060
|
-
let t =
|
|
1059
|
+
for (let e of [k, ...A.keys()]) {
|
|
1060
|
+
let t = j(n, e);
|
|
1061
1061
|
for (let t of Object.keys(e)) delete e[t];
|
|
1062
1062
|
Object.assign(e, t);
|
|
1063
1063
|
}
|
|
1064
|
-
if (
|
|
1064
|
+
if (C = n, P = r.values, I = i.environment, L = i.snapshotState, V = null, F += 1, Z(), t) for (let e of W) e();
|
|
1065
1065
|
return $({
|
|
1066
1066
|
ok: !0,
|
|
1067
1067
|
changed: !0,
|
|
1068
|
-
revision:
|
|
1068
|
+
revision: F,
|
|
1069
1069
|
retained: r.retained,
|
|
1070
1070
|
dropped: r.dropped,
|
|
1071
1071
|
diagnostics: r.diagnostics
|
|
@@ -1075,96 +1075,96 @@ function ye(e, t) {
|
|
|
1075
1075
|
for (let r of n([e])) t.add(r.id);
|
|
1076
1076
|
return t;
|
|
1077
1077
|
}, Te = {
|
|
1078
|
-
network:
|
|
1078
|
+
network: f.network,
|
|
1079
1079
|
get document() {
|
|
1080
|
-
return
|
|
1080
|
+
return C.document;
|
|
1081
1081
|
},
|
|
1082
|
-
services:
|
|
1082
|
+
services: O,
|
|
1083
1083
|
snapshot() {
|
|
1084
|
-
return
|
|
1084
|
+
return q(), ne;
|
|
1085
1085
|
},
|
|
1086
1086
|
get(e, t) {
|
|
1087
|
-
|
|
1088
|
-
let n =
|
|
1087
|
+
q();
|
|
1088
|
+
let n = w(), r = n.nodeIndex.get(e.id);
|
|
1089
1089
|
if (!r) return null;
|
|
1090
|
-
let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ??
|
|
1091
|
-
return i && Object.hasOwn(
|
|
1090
|
+
let i = t === void 0 ? n.slotKeys.get(r.id)?.value ?? n.bindingByNode.get(r.id) ?? u(r) : n.slotKeys.get(r.id)?.[t];
|
|
1091
|
+
return i && Object.hasOwn(P, i) ? B(P[i]) : null;
|
|
1092
1092
|
},
|
|
1093
1093
|
set(e, t, n) {
|
|
1094
|
-
|
|
1095
|
-
let i =
|
|
1096
|
-
if (!a) return [
|
|
1094
|
+
q();
|
|
1095
|
+
let i = w(), a = i.nodeIndex.get(e.id);
|
|
1096
|
+
if (!a) return [H(i.document, e, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
|
|
1097
1097
|
let o = i.slotKeys.get(a.id), s;
|
|
1098
1098
|
if (n === void 0) {
|
|
1099
|
-
if (o && !o.value) return [
|
|
1100
|
-
s = o?.value ?? i.bindingByNode.get(a.id) ??
|
|
1101
|
-
} else if (s = o?.[n], !s) return [
|
|
1099
|
+
if (o && !o.value) return [H(i.document, a, "local.runtime.binding", r("local.runtime.binding.needs-slot"))];
|
|
1100
|
+
s = o?.value ?? i.bindingByNode.get(a.id) ?? u(a);
|
|
1101
|
+
} else if (s = o?.[n], !s) return [H(i.document, a, "local.runtime.binding", r("local.runtime.binding.unknown-slot", { slot: n }))];
|
|
1102
1102
|
let c = Object.hasOwn(i.document.bindings, s) ? i.document.bindings[s] : void 0;
|
|
1103
|
-
if (!c) return [
|
|
1104
|
-
let l =
|
|
1105
|
-
if (!l.ok) return [
|
|
1106
|
-
let
|
|
1107
|
-
if (pe(
|
|
1108
|
-
let
|
|
1109
|
-
...
|
|
1110
|
-
[s]:
|
|
1103
|
+
if (!c) return [H(i.document, a, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
|
|
1104
|
+
let l = R(c, i.controls.get(s) ?? [], t, X({ [s]: t }), i.valueRules, i.legacyValueRules);
|
|
1105
|
+
if (!l.ok) return [H(i.document, a, "local.runtime.value", l.detail)];
|
|
1106
|
+
let d = B(l.value);
|
|
1107
|
+
if (pe(P[s], d)) return [];
|
|
1108
|
+
let f = {
|
|
1109
|
+
...P,
|
|
1110
|
+
[s]: d
|
|
1111
1111
|
};
|
|
1112
|
-
return
|
|
1112
|
+
return K(i, a.id, f) ? [H(i.document, a, "local.runtime.value", r("local.runtime.value.range-order"))] : (Q(f), []);
|
|
1113
1113
|
},
|
|
1114
1114
|
setMany(e, t) {
|
|
1115
|
-
|
|
1116
|
-
let n =
|
|
1117
|
-
if (!i) return [
|
|
1115
|
+
q();
|
|
1116
|
+
let n = w(), i = n.nodeIndex.get(e.id);
|
|
1117
|
+
if (!i) return [H(n.document, e, "local.runtime.binding", r("local.runtime.binding.no-writable"))];
|
|
1118
1118
|
let a = n.slotKeys.get(i.id);
|
|
1119
|
-
if (!a) return [
|
|
1119
|
+
if (!a) return [H(n.document, i, "local.runtime.binding", r("local.runtime.binding.no-multi-slot"))];
|
|
1120
1120
|
let o = Object.entries(t);
|
|
1121
1121
|
if (!o.length) return [];
|
|
1122
|
-
let s = { ...
|
|
1123
|
-
...
|
|
1122
|
+
let s = { ...P }, c = J(n, {
|
|
1123
|
+
...P,
|
|
1124
1124
|
...Object.fromEntries(o.map(([e, t]) => [a[e], t]))
|
|
1125
1125
|
}).environment;
|
|
1126
1126
|
for (let [e, t] of o) {
|
|
1127
1127
|
let o = a[e];
|
|
1128
|
-
if (!o || !Object.hasOwn(n.document.bindings, o)) return [
|
|
1129
|
-
let l =
|
|
1130
|
-
if (!l.ok) return [
|
|
1131
|
-
s[o] =
|
|
1128
|
+
if (!o || !Object.hasOwn(n.document.bindings, o)) return [H(n.document, i, "local.runtime.binding", r("local.runtime.binding.unknown-slot", { slot: e }))];
|
|
1129
|
+
let l = R(n.document.bindings[o], n.controls.get(o) ?? [], t, (e, t) => N(e, t, c), n.valueRules, n.legacyValueRules);
|
|
1130
|
+
if (!l.ok) return [H(n.document, i, "local.runtime.value", l.detail)];
|
|
1131
|
+
s[o] = B(l.value);
|
|
1132
1132
|
}
|
|
1133
|
-
return
|
|
1133
|
+
return K(n, i.id, s) ? [H(n.document, i, "local.runtime.value", r("local.runtime.value.range-order"))] : (o.every(([e, t]) => pe(P[a[e]], t)) || Q(s), []);
|
|
1134
1134
|
},
|
|
1135
1135
|
parameterNames() {
|
|
1136
|
-
return
|
|
1136
|
+
return q(), w().publicNames;
|
|
1137
1137
|
},
|
|
1138
1138
|
getParameter(e) {
|
|
1139
|
-
|
|
1140
|
-
let t =
|
|
1141
|
-
return t === void 0 ? void 0 :
|
|
1139
|
+
q();
|
|
1140
|
+
let t = le(w(), e);
|
|
1141
|
+
return t === void 0 ? void 0 : B(t);
|
|
1142
1142
|
},
|
|
1143
1143
|
getParameters() {
|
|
1144
|
-
|
|
1145
|
-
let e =
|
|
1144
|
+
q();
|
|
1145
|
+
let e = w(), t = {};
|
|
1146
1146
|
for (let n of e.publicNames) {
|
|
1147
|
-
let e =
|
|
1147
|
+
let e = P[n];
|
|
1148
1148
|
t[n] = Array.isArray(e) ? Object.freeze([...e]) : e;
|
|
1149
1149
|
}
|
|
1150
1150
|
return Object.freeze(t);
|
|
1151
1151
|
},
|
|
1152
1152
|
readSubmissionFields(e) {
|
|
1153
|
-
|
|
1154
|
-
let t =
|
|
1153
|
+
q();
|
|
1154
|
+
let t = w(), n = /* @__PURE__ */ new Map(), r = (e, n) => N(e, n, I, t);
|
|
1155
1155
|
if (e.length === 0) return {
|
|
1156
1156
|
ok: !1,
|
|
1157
1157
|
field: "",
|
|
1158
1158
|
reason: "unavailable"
|
|
1159
1159
|
};
|
|
1160
1160
|
for (let i of e) {
|
|
1161
|
-
let e =
|
|
1161
|
+
let e = le(t, i);
|
|
1162
1162
|
if (e === void 0 || n.has(i)) return {
|
|
1163
1163
|
ok: !1,
|
|
1164
1164
|
field: i,
|
|
1165
1165
|
reason: "unavailable"
|
|
1166
1166
|
};
|
|
1167
|
-
let a =
|
|
1167
|
+
let a = R(t.document.bindings[i], t.controls.get(i) ?? [], e, r, t.valueRules, t.legacyValueRules);
|
|
1168
1168
|
if (!a.ok) {
|
|
1169
1169
|
let e = a.detail.key;
|
|
1170
1170
|
return {
|
|
@@ -1177,9 +1177,9 @@ function ye(e, t) {
|
|
|
1177
1177
|
}
|
|
1178
1178
|
let i = Object.create(null);
|
|
1179
1179
|
for (let [e, r] of n) {
|
|
1180
|
-
for (let [n, i] of
|
|
1180
|
+
for (let [n, i] of m.get(e) ?? []) {
|
|
1181
1181
|
if (!t.controls.get(e)?.some((e) => e.id === i)) continue;
|
|
1182
|
-
let a = n(
|
|
1182
|
+
let a = n(B(r));
|
|
1183
1183
|
if (a) return {
|
|
1184
1184
|
ok: !1,
|
|
1185
1185
|
field: e,
|
|
@@ -1194,80 +1194,80 @@ function ye(e, t) {
|
|
|
1194
1194
|
};
|
|
1195
1195
|
},
|
|
1196
1196
|
registerSubmissionField(e, t) {
|
|
1197
|
-
if (
|
|
1198
|
-
let n =
|
|
1197
|
+
if (z) return () => {};
|
|
1198
|
+
let n = w(), r = n.slotKeys.get(e.id)?.value ?? n.bindingByNode.get(e.id);
|
|
1199
1199
|
if (!r || r.startsWith("@")) return () => {};
|
|
1200
|
-
let i =
|
|
1201
|
-
return i ||
|
|
1202
|
-
i.delete(t), i.size === 0 &&
|
|
1200
|
+
let i = m.get(r);
|
|
1201
|
+
return i || m.set(r, i = /* @__PURE__ */ new Map()), i.set(t, e.id), () => {
|
|
1202
|
+
i.delete(t), i.size === 0 && m.get(r) === i && m.delete(r);
|
|
1203
1203
|
};
|
|
1204
1204
|
},
|
|
1205
1205
|
setParameter(e, t) {
|
|
1206
|
-
|
|
1206
|
+
q();
|
|
1207
1207
|
let n = Object.create(null);
|
|
1208
1208
|
return n[e] = t, ye(n);
|
|
1209
1209
|
},
|
|
1210
1210
|
setParameters(e) {
|
|
1211
|
-
if (
|
|
1211
|
+
if (q(), typeof e != "object" || !e || Array.isArray(e)) throw TypeError("setParameters requires an object of parameter values.");
|
|
1212
1212
|
return ye(e);
|
|
1213
1213
|
},
|
|
1214
1214
|
getExternal(e) {
|
|
1215
|
-
if (
|
|
1215
|
+
if (q(), Object.hasOwn(w().document.externals ?? {}, e) && Object.hasOwn(L, e)) return B(L[e]);
|
|
1216
1216
|
},
|
|
1217
1217
|
getExternalValues() {
|
|
1218
|
-
|
|
1218
|
+
q();
|
|
1219
1219
|
let e = {};
|
|
1220
|
-
for (let [t, n] of Object.entries(
|
|
1220
|
+
for (let [t, n] of Object.entries(M(w()))) e[t] = Array.isArray(n) ? Object.freeze([...n]) : n;
|
|
1221
1221
|
return Object.freeze(e);
|
|
1222
1222
|
},
|
|
1223
1223
|
setExternalValues(e) {
|
|
1224
1224
|
return _e(e);
|
|
1225
1225
|
},
|
|
1226
1226
|
evaluate(e) {
|
|
1227
|
-
|
|
1228
|
-
let t = be(e).evaluate(
|
|
1227
|
+
q();
|
|
1228
|
+
let t = be(e).evaluate(I);
|
|
1229
1229
|
return Array.isArray(t) ? t.slice() : t;
|
|
1230
1230
|
},
|
|
1231
1231
|
validate() {
|
|
1232
|
-
if (
|
|
1232
|
+
if (q(), V && V.revision === F) return V.diagnostics.map(fe);
|
|
1233
1233
|
let e = xe();
|
|
1234
|
-
return
|
|
1235
|
-
revision:
|
|
1234
|
+
return V = {
|
|
1235
|
+
revision: F,
|
|
1236
1236
|
diagnostics: e
|
|
1237
1237
|
}, e.map(fe);
|
|
1238
1238
|
},
|
|
1239
1239
|
text(e) {
|
|
1240
|
-
return
|
|
1240
|
+
return q(), s(e, I);
|
|
1241
1241
|
},
|
|
1242
1242
|
reset(e) {
|
|
1243
|
-
|
|
1244
|
-
let t =
|
|
1243
|
+
q();
|
|
1244
|
+
let t = w(), n = t.nodeIndex.get(e.id);
|
|
1245
1245
|
if (!n) return;
|
|
1246
|
-
let r = we(n), s = { ...
|
|
1246
|
+
let r = we(n), s = { ...P };
|
|
1247
1247
|
for (let [e, n] of Object.entries(t.document.bindings)) {
|
|
1248
1248
|
if (!(t.controls.get(e) ?? []).some((e) => r.has(e.id))) continue;
|
|
1249
1249
|
let c = o(n.initial);
|
|
1250
1250
|
if (c) throw new a("expression-budget", `Parameter "${e}": ${i(c)}`, 0);
|
|
1251
|
-
s[e] =
|
|
1251
|
+
s[e] = B(n.initial);
|
|
1252
1252
|
}
|
|
1253
|
-
for (let e of r)
|
|
1253
|
+
for (let e of r) G.set(e, (G.get(e) ?? 0) + 1);
|
|
1254
1254
|
Q(s);
|
|
1255
1255
|
},
|
|
1256
1256
|
resetToken(e) {
|
|
1257
|
-
|
|
1258
|
-
let t =
|
|
1259
|
-
return t ?
|
|
1257
|
+
q();
|
|
1258
|
+
let t = w().nodeIndex.get(e.id);
|
|
1259
|
+
return t ? G.get(t.id) ?? 0 : 0;
|
|
1260
1260
|
},
|
|
1261
1261
|
subscribe(e) {
|
|
1262
|
-
return
|
|
1263
|
-
|
|
1262
|
+
return q(), W.add(e), () => {
|
|
1263
|
+
W.delete(e);
|
|
1264
1264
|
};
|
|
1265
1265
|
},
|
|
1266
1266
|
dispose() {
|
|
1267
|
-
if (!
|
|
1268
|
-
|
|
1269
|
-
for (let e of
|
|
1270
|
-
|
|
1267
|
+
if (!z) {
|
|
1268
|
+
z = !0, f.dispose();
|
|
1269
|
+
for (let e of A.values()) e();
|
|
1270
|
+
A.clear(), m.clear(), O.state.flush(), d && O.scheduler.dispose(), W.clear(), y.clear(), S.clear(), C.computationExpressions.clear(), C.constErrors.clear(), C.cycleErrors.clear(), C.validationRules.length = 0, G.clear();
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
1273
1273
|
};
|
|
@@ -1275,8 +1275,8 @@ function ye(e, t) {
|
|
|
1275
1275
|
update: Ce,
|
|
1276
1276
|
bindNetworkExternals: ve,
|
|
1277
1277
|
notify() {
|
|
1278
|
-
if (!
|
|
1278
|
+
if (!z) for (let e of W) e();
|
|
1279
1279
|
}
|
|
1280
|
-
}),
|
|
1280
|
+
}), Y(), Z(), ve(f), Te;
|
|
1281
1281
|
}
|
|
1282
|
-
export { Q as a, ge as i, ye as n,
|
|
1282
|
+
export { Q as a, ge as i, ye as n, Z as o, _e as r, ve as t };
|