mathjson-tree-builder 0.1.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.
@@ -0,0 +1,3720 @@
1
+ //#region node_modules/@lit/reactive-element/css-tag.js
2
+ var e = globalThis, t = e.ShadowRoot && (e.ShadyCSS === void 0 || e.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, n = Symbol(), r = /* @__PURE__ */ new WeakMap(), i = class {
3
+ constructor(e, t, r) {
4
+ if (this._$cssResult$ = !0, r !== n) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
5
+ this.cssText = e, this.t = t;
6
+ }
7
+ get styleSheet() {
8
+ let e = this.o, n = this.t;
9
+ if (t && e === void 0) {
10
+ let t = n !== void 0 && n.length === 1;
11
+ t && (e = r.get(n)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), t && r.set(n, e));
12
+ }
13
+ return e;
14
+ }
15
+ toString() {
16
+ return this.cssText;
17
+ }
18
+ }, a = (e) => new i(typeof e == "string" ? e : e + "", void 0, n), o = (e, ...t) => new i(e.length === 1 ? e[0] : t.reduce((t, n, r) => t + ((e) => {
19
+ if (!0 === e._$cssResult$) return e.cssText;
20
+ if (typeof e == "number") return e;
21
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + e + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
22
+ })(n) + e[r + 1], e[0]), e, n), s = (n, r) => {
23
+ if (t) n.adoptedStyleSheets = r.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
24
+ else for (let t of r) {
25
+ let r = document.createElement("style"), i = e.litNonce;
26
+ i !== void 0 && r.setAttribute("nonce", i), r.textContent = t.cssText, n.appendChild(r);
27
+ }
28
+ }, c = t ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => {
29
+ let t = "";
30
+ for (let n of e.cssRules) t += n.cssText;
31
+ return a(t);
32
+ })(e) : e, { is: l, defineProperty: u, getOwnPropertyDescriptor: d, getOwnPropertyNames: f, getOwnPropertySymbols: ee, getPrototypeOf: te } = Object, p = globalThis, ne = p.trustedTypes, re = ne ? ne.emptyScript : "", ie = p.reactiveElementPolyfillSupport, m = (e, t) => e, h = {
33
+ toAttribute(e, t) {
34
+ switch (t) {
35
+ case Boolean:
36
+ e = e ? re : null;
37
+ break;
38
+ case Object:
39
+ case Array: e = e == null ? e : JSON.stringify(e);
40
+ }
41
+ return e;
42
+ },
43
+ fromAttribute(e, t) {
44
+ let n = e;
45
+ switch (t) {
46
+ case Boolean:
47
+ n = e !== null;
48
+ break;
49
+ case Number:
50
+ n = e === null ? null : Number(e);
51
+ break;
52
+ case Object:
53
+ case Array: try {
54
+ n = JSON.parse(e);
55
+ } catch {
56
+ n = null;
57
+ }
58
+ }
59
+ return n;
60
+ }
61
+ }, g = (e, t) => !l(e, t), ae = {
62
+ attribute: !0,
63
+ type: String,
64
+ converter: h,
65
+ reflect: !1,
66
+ useDefault: !1,
67
+ hasChanged: g
68
+ };
69
+ Symbol.metadata ??= Symbol("metadata"), p.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
70
+ var _ = class extends HTMLElement {
71
+ static addInitializer(e) {
72
+ this._$Ei(), (this.l ??= []).push(e);
73
+ }
74
+ static get observedAttributes() {
75
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
76
+ }
77
+ static createProperty(e, t = ae) {
78
+ if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
79
+ let n = Symbol(), r = this.getPropertyDescriptor(e, n, t);
80
+ r !== void 0 && u(this.prototype, e, r);
81
+ }
82
+ }
83
+ static getPropertyDescriptor(e, t, n) {
84
+ let { get: r, set: i } = d(this.prototype, e) ?? {
85
+ get() {
86
+ return this[t];
87
+ },
88
+ set(e) {
89
+ this[t] = e;
90
+ }
91
+ };
92
+ return {
93
+ get: r,
94
+ set(t) {
95
+ let a = r?.call(this);
96
+ i?.call(this, t), this.requestUpdate(e, a, n);
97
+ },
98
+ configurable: !0,
99
+ enumerable: !0
100
+ };
101
+ }
102
+ static getPropertyOptions(e) {
103
+ return this.elementProperties.get(e) ?? ae;
104
+ }
105
+ static _$Ei() {
106
+ if (this.hasOwnProperty(m("elementProperties"))) return;
107
+ let e = te(this);
108
+ e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
109
+ }
110
+ static finalize() {
111
+ if (this.hasOwnProperty(m("finalized"))) return;
112
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(m("properties"))) {
113
+ let e = this.properties, t = [...f(e), ...ee(e)];
114
+ for (let n of t) this.createProperty(n, e[n]);
115
+ }
116
+ let e = this[Symbol.metadata];
117
+ if (e !== null) {
118
+ let t = litPropertyMetadata.get(e);
119
+ if (t !== void 0) for (let [e, n] of t) this.elementProperties.set(e, n);
120
+ }
121
+ this._$Eh = /* @__PURE__ */ new Map();
122
+ for (let [e, t] of this.elementProperties) {
123
+ let n = this._$Eu(e, t);
124
+ n !== void 0 && this._$Eh.set(n, e);
125
+ }
126
+ this.elementStyles = this.finalizeStyles(this.styles);
127
+ }
128
+ static finalizeStyles(e) {
129
+ let t = [];
130
+ if (Array.isArray(e)) {
131
+ let n = new Set(e.flat(1 / 0).reverse());
132
+ for (let e of n) t.unshift(c(e));
133
+ } else e !== void 0 && t.push(c(e));
134
+ return t;
135
+ }
136
+ static _$Eu(e, t) {
137
+ let n = t.attribute;
138
+ return !1 === n ? void 0 : typeof n == "string" ? n : typeof e == "string" ? e.toLowerCase() : void 0;
139
+ }
140
+ constructor() {
141
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
142
+ }
143
+ _$Ev() {
144
+ this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this));
145
+ }
146
+ addController(e) {
147
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
148
+ }
149
+ removeController(e) {
150
+ this._$EO?.delete(e);
151
+ }
152
+ _$E_() {
153
+ let e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
154
+ for (let n of t.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]);
155
+ e.size > 0 && (this._$Ep = e);
156
+ }
157
+ createRenderRoot() {
158
+ let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
159
+ return s(e, this.constructor.elementStyles), e;
160
+ }
161
+ connectedCallback() {
162
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
163
+ }
164
+ enableUpdating(e) {}
165
+ disconnectedCallback() {
166
+ this._$EO?.forEach((e) => e.hostDisconnected?.());
167
+ }
168
+ attributeChangedCallback(e, t, n) {
169
+ this._$AK(e, n);
170
+ }
171
+ _$ET(e, t) {
172
+ let n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n);
173
+ if (r !== void 0 && !0 === n.reflect) {
174
+ let i = (n.converter?.toAttribute === void 0 ? h : n.converter).toAttribute(t, n.type);
175
+ this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null;
176
+ }
177
+ }
178
+ _$AK(e, t) {
179
+ let n = this.constructor, r = n._$Eh.get(e);
180
+ if (r !== void 0 && this._$Em !== r) {
181
+ let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ? h : e.converter;
182
+ this._$Em = r;
183
+ let a = i.fromAttribute(t, e.type);
184
+ this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null;
185
+ }
186
+ }
187
+ requestUpdate(e, t, n, r = !1, i) {
188
+ if (e !== void 0) {
189
+ let a = this.constructor;
190
+ if (!1 === r && (i = this[e]), n ??= a.getPropertyOptions(e), !((n.hasChanged ?? g)(i, t) || n.useDefault && n.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(a._$Eu(e, n)))) return;
191
+ this.C(e, t, n);
192
+ }
193
+ !1 === this.isUpdatePending && (this._$ES = this._$EP());
194
+ }
195
+ C(e, t, { useDefault: n, reflect: r, wrapped: i }, a) {
196
+ n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, a ?? t ?? this[e]), !0 !== i || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (t = void 0), this._$AL.set(e, t)), !0 === r && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
197
+ }
198
+ async _$EP() {
199
+ this.isUpdatePending = !0;
200
+ try {
201
+ await this._$ES;
202
+ } catch (e) {
203
+ Promise.reject(e);
204
+ }
205
+ let e = this.scheduleUpdate();
206
+ return e != null && await e, !this.isUpdatePending;
207
+ }
208
+ scheduleUpdate() {
209
+ return this.performUpdate();
210
+ }
211
+ performUpdate() {
212
+ if (!this.isUpdatePending) return;
213
+ if (!this.hasUpdated) {
214
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
215
+ for (let [e, t] of this._$Ep) this[e] = t;
216
+ this._$Ep = void 0;
217
+ }
218
+ let e = this.constructor.elementProperties;
219
+ if (e.size > 0) for (let [t, n] of e) {
220
+ let { wrapped: e } = n, r = this[t];
221
+ !0 !== e || this._$AL.has(t) || r === void 0 || this.C(t, void 0, n, r);
222
+ }
223
+ }
224
+ let e = !1, t = this._$AL;
225
+ try {
226
+ e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach((e) => e.hostUpdate?.()), this.update(t)) : this._$EM();
227
+ } catch (t) {
228
+ throw e = !1, this._$EM(), t;
229
+ }
230
+ e && this._$AE(t);
231
+ }
232
+ willUpdate(e) {}
233
+ _$AE(e) {
234
+ this._$EO?.forEach((e) => e.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
235
+ }
236
+ _$EM() {
237
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
238
+ }
239
+ get updateComplete() {
240
+ return this.getUpdateComplete();
241
+ }
242
+ getUpdateComplete() {
243
+ return this._$ES;
244
+ }
245
+ shouldUpdate(e) {
246
+ return !0;
247
+ }
248
+ update(e) {
249
+ this._$Eq &&= this._$Eq.forEach((e) => this._$ET(e, this[e])), this._$EM();
250
+ }
251
+ updated(e) {}
252
+ firstUpdated(e) {}
253
+ };
254
+ _.elementStyles = [], _.shadowRootOptions = { mode: "open" }, _[m("elementProperties")] = /* @__PURE__ */ new Map(), _[m("finalized")] = /* @__PURE__ */ new Map(), ie?.({ ReactiveElement: _ }), (p.reactiveElementVersions ??= []).push("2.1.2");
255
+ //#endregion
256
+ //#region node_modules/lit-html/lit-html.js
257
+ var v = globalThis, oe = (e) => e, y = v.trustedTypes, se = y ? y.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, ce = "$lit$", b = `lit$${Math.random().toFixed(9).slice(2)}$`, le = "?" + b, ue = `<${le}>`, x = document, S = () => x.createComment(""), C = (e) => e === null || typeof e != "object" && typeof e != "function", w = Array.isArray, de = (e) => w(e) || typeof e?.[Symbol.iterator] == "function", T = "[ \n\f\r]", E = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, fe = /-->/g, pe = />/g, D = RegExp(`>|${T}(?:([^\\s"'>=/]+)(${T}*=${T}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), me = /'/g, he = /"/g, ge = /^(?:script|style|textarea|title)$/i, O = ((e) => (t, ...n) => ({
258
+ _$litType$: e,
259
+ strings: t,
260
+ values: n
261
+ }))(1), k = Symbol.for("lit-noChange"), A = Symbol.for("lit-nothing"), _e = /* @__PURE__ */ new WeakMap(), j = x.createTreeWalker(x, 129);
262
+ function ve(e, t) {
263
+ if (!w(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
264
+ return se === void 0 ? t : se.createHTML(t);
265
+ }
266
+ var ye = (e, t) => {
267
+ let n = e.length - 1, r = [], i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = E;
268
+ for (let t = 0; t < n; t++) {
269
+ let n = e[t], s, c, l = -1, u = 0;
270
+ for (; u < n.length && (o.lastIndex = u, c = o.exec(n), c !== null);) u = o.lastIndex, o === E ? c[1] === "!--" ? o = fe : c[1] === void 0 ? c[2] === void 0 ? c[3] !== void 0 && (o = D) : (ge.test(c[2]) && (i = RegExp("</" + c[2], "g")), o = D) : o = pe : o === D ? c[0] === ">" ? (o = i ?? E, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, s = c[1], o = c[3] === void 0 ? D : c[3] === "\"" ? he : me) : o === he || o === me ? o = D : o === fe || o === pe ? o = E : (o = D, i = void 0);
271
+ let d = o === D && e[t + 1].startsWith("/>") ? " " : "";
272
+ a += o === E ? n + ue : l >= 0 ? (r.push(s), n.slice(0, l) + ce + n.slice(l) + b + d) : n + b + (l === -2 ? t : d);
273
+ }
274
+ return [ve(e, a + (e[n] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
275
+ }, M = class e {
276
+ constructor({ strings: t, _$litType$: n }, r) {
277
+ let i;
278
+ this.parts = [];
279
+ let a = 0, o = 0, s = t.length - 1, c = this.parts, [l, u] = ye(t, n);
280
+ if (this.el = e.createElement(l, r), j.currentNode = this.el.content, n === 2 || n === 3) {
281
+ let e = this.el.content.firstChild;
282
+ e.replaceWith(...e.childNodes);
283
+ }
284
+ for (; (i = j.nextNode()) !== null && c.length < s;) {
285
+ if (i.nodeType === 1) {
286
+ if (i.hasAttributes()) for (let e of i.getAttributeNames()) if (e.endsWith(ce)) {
287
+ let t = u[o++], n = i.getAttribute(e).split(b), r = /([.?@])?(.*)/.exec(t);
288
+ c.push({
289
+ type: 1,
290
+ index: a,
291
+ name: r[2],
292
+ strings: n,
293
+ ctor: r[1] === "." ? xe : r[1] === "?" ? Se : r[1] === "@" ? Ce : F
294
+ }), i.removeAttribute(e);
295
+ } else e.startsWith(b) && (c.push({
296
+ type: 6,
297
+ index: a
298
+ }), i.removeAttribute(e));
299
+ if (ge.test(i.tagName)) {
300
+ let e = i.textContent.split(b), t = e.length - 1;
301
+ if (t > 0) {
302
+ i.textContent = y ? y.emptyScript : "";
303
+ for (let n = 0; n < t; n++) i.append(e[n], S()), j.nextNode(), c.push({
304
+ type: 2,
305
+ index: ++a
306
+ });
307
+ i.append(e[t], S());
308
+ }
309
+ }
310
+ } else if (i.nodeType === 8) {
311
+ if (i.data === le) c.push({
312
+ type: 2,
313
+ index: a
314
+ });
315
+ else {
316
+ let e = -1;
317
+ for (; (e = i.data.indexOf(b, e + 1)) !== -1;) c.push({
318
+ type: 7,
319
+ index: a
320
+ }), e += b.length - 1;
321
+ }
322
+ }
323
+ a++;
324
+ }
325
+ }
326
+ static createElement(e, t) {
327
+ let n = x.createElement("template");
328
+ return n.innerHTML = e, n;
329
+ }
330
+ };
331
+ function N(e, t, n = e, r) {
332
+ if (t === k) return t;
333
+ let i = r === void 0 ? n._$Cl : n._$Co?.[r], a = C(t) ? void 0 : t._$litDirective$;
334
+ return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(e), i._$AT(e, n, r)), r === void 0 ? n._$Cl = i : (n._$Co ??= [])[r] = i), i !== void 0 && (t = N(e, i._$AS(e, t.values), i, r)), t;
335
+ }
336
+ var be = class {
337
+ constructor(e, t) {
338
+ this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
339
+ }
340
+ get parentNode() {
341
+ return this._$AM.parentNode;
342
+ }
343
+ get _$AU() {
344
+ return this._$AM._$AU;
345
+ }
346
+ u(e) {
347
+ let { el: { content: t }, parts: n } = this._$AD, r = (e?.creationScope ?? x).importNode(t, !0);
348
+ j.currentNode = r;
349
+ let i = j.nextNode(), a = 0, o = 0, s = n[0];
350
+ for (; s !== void 0;) {
351
+ if (a === s.index) {
352
+ let t;
353
+ s.type === 2 ? t = new P(i, i.nextSibling, this, e) : s.type === 1 ? t = new s.ctor(i, s.name, s.strings, this, e) : s.type === 6 && (t = new we(i, this, e)), this._$AV.push(t), s = n[++o];
354
+ }
355
+ a !== s?.index && (i = j.nextNode(), a++);
356
+ }
357
+ return j.currentNode = x, r;
358
+ }
359
+ p(e) {
360
+ let t = 0;
361
+ for (let n of this._$AV) n !== void 0 && (n.strings === void 0 ? n._$AI(e[t]) : (n._$AI(e, n, t), t += n.strings.length - 2)), t++;
362
+ }
363
+ }, P = class e {
364
+ get _$AU() {
365
+ return this._$AM?._$AU ?? this._$Cv;
366
+ }
367
+ constructor(e, t, n, r) {
368
+ this.type = 2, this._$AH = A, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = n, this.options = r, this._$Cv = r?.isConnected ?? !0;
369
+ }
370
+ get parentNode() {
371
+ let e = this._$AA.parentNode, t = this._$AM;
372
+ return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
373
+ }
374
+ get startNode() {
375
+ return this._$AA;
376
+ }
377
+ get endNode() {
378
+ return this._$AB;
379
+ }
380
+ _$AI(e, t = this) {
381
+ e = N(this, e, t), C(e) ? e === A || e == null || e === "" ? (this._$AH !== A && this._$AR(), this._$AH = A) : e !== this._$AH && e !== k && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? de(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e);
382
+ }
383
+ O(e) {
384
+ return this._$AA.parentNode.insertBefore(e, this._$AB);
385
+ }
386
+ T(e) {
387
+ this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
388
+ }
389
+ _(e) {
390
+ this._$AH !== A && C(this._$AH) ? this._$AA.nextSibling.data = e : this.T(x.createTextNode(e)), this._$AH = e;
391
+ }
392
+ $(e) {
393
+ let { values: t, _$litType$: n } = e, r = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = M.createElement(ve(n.h, n.h[0]), this.options)), n);
394
+ if (this._$AH?._$AD === r) this._$AH.p(t);
395
+ else {
396
+ let e = new be(r, this), n = e.u(this.options);
397
+ e.p(t), this.T(n), this._$AH = e;
398
+ }
399
+ }
400
+ _$AC(e) {
401
+ let t = _e.get(e.strings);
402
+ return t === void 0 && _e.set(e.strings, t = new M(e)), t;
403
+ }
404
+ k(t) {
405
+ w(this._$AH) || (this._$AH = [], this._$AR());
406
+ let n = this._$AH, r, i = 0;
407
+ for (let a of t) i === n.length ? n.push(r = new e(this.O(S()), this.O(S()), this, this.options)) : r = n[i], r._$AI(a), i++;
408
+ i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i);
409
+ }
410
+ _$AR(e = this._$AA.nextSibling, t) {
411
+ for (this._$AP?.(!1, !0, t); e !== this._$AB;) {
412
+ let t = oe(e).nextSibling;
413
+ oe(e).remove(), e = t;
414
+ }
415
+ }
416
+ setConnected(e) {
417
+ this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
418
+ }
419
+ }, F = class {
420
+ get tagName() {
421
+ return this.element.tagName;
422
+ }
423
+ get _$AU() {
424
+ return this._$AM._$AU;
425
+ }
426
+ constructor(e, t, n, r, i) {
427
+ this.type = 1, this._$AH = A, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = i, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(/* @__PURE__ */ new String()), this.strings = n) : this._$AH = A;
428
+ }
429
+ _$AI(e, t = this, n, r) {
430
+ let i = this.strings, a = !1;
431
+ if (i === void 0) e = N(this, e, t, 0), a = !C(e) || e !== this._$AH && e !== k, a && (this._$AH = e);
432
+ else {
433
+ let r = e, o, s;
434
+ for (e = i[0], o = 0; o < i.length - 1; o++) s = N(this, r[n + o], t, o), s === k && (s = this._$AH[o]), a ||= !C(s) || s !== this._$AH[o], s === A ? e = A : e !== A && (e += (s ?? "") + i[o + 1]), this._$AH[o] = s;
435
+ }
436
+ a && !r && this.j(e);
437
+ }
438
+ j(e) {
439
+ e === A ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
440
+ }
441
+ }, xe = class extends F {
442
+ constructor() {
443
+ super(...arguments), this.type = 3;
444
+ }
445
+ j(e) {
446
+ this.element[this.name] = e === A ? void 0 : e;
447
+ }
448
+ }, Se = class extends F {
449
+ constructor() {
450
+ super(...arguments), this.type = 4;
451
+ }
452
+ j(e) {
453
+ this.element.toggleAttribute(this.name, !!e && e !== A);
454
+ }
455
+ }, Ce = class extends F {
456
+ constructor(e, t, n, r, i) {
457
+ super(e, t, n, r, i), this.type = 5;
458
+ }
459
+ _$AI(e, t = this) {
460
+ if ((e = N(this, e, t, 0) ?? A) === k) return;
461
+ let n = this._$AH, r = e === A && n !== A || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, i = e !== A && (n === A || r);
462
+ r && this.element.removeEventListener(this.name, this, n), i && this.element.addEventListener(this.name, this, e), this._$AH = e;
463
+ }
464
+ handleEvent(e) {
465
+ typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
466
+ }
467
+ }, we = class {
468
+ constructor(e, t, n) {
469
+ this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = n;
470
+ }
471
+ get _$AU() {
472
+ return this._$AM._$AU;
473
+ }
474
+ _$AI(e) {
475
+ N(this, e);
476
+ }
477
+ }, Te = v.litHtmlPolyfillSupport;
478
+ Te?.(M, P), (v.litHtmlVersions ??= []).push("3.3.3");
479
+ var Ee = (e, t, n) => {
480
+ let r = n?.renderBefore ?? t, i = r._$litPart$;
481
+ if (i === void 0) {
482
+ let e = n?.renderBefore ?? null;
483
+ r._$litPart$ = i = new P(t.insertBefore(S(), e), e, void 0, n ?? {});
484
+ }
485
+ return i._$AI(e), i;
486
+ }, I = globalThis, L = class extends _ {
487
+ constructor() {
488
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
489
+ }
490
+ createRenderRoot() {
491
+ let e = super.createRenderRoot();
492
+ return this.renderOptions.renderBefore ??= e.firstChild, e;
493
+ }
494
+ update(e) {
495
+ let t = this.render();
496
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Ee(t, this.renderRoot, this.renderOptions);
497
+ }
498
+ connectedCallback() {
499
+ super.connectedCallback(), this._$Do?.setConnected(!0);
500
+ }
501
+ disconnectedCallback() {
502
+ super.disconnectedCallback(), this._$Do?.setConnected(!1);
503
+ }
504
+ render() {
505
+ return k;
506
+ }
507
+ };
508
+ L._$litElement$ = !0, L.finalized = !0, I.litElementHydrateSupport?.({ LitElement: L });
509
+ var De = I.litElementPolyfillSupport;
510
+ De?.({ LitElement: L }), (I.litElementVersions ??= []).push("4.2.2");
511
+ //#endregion
512
+ //#region node_modules/@lit/reactive-element/decorators/property.js
513
+ var Oe = {
514
+ attribute: !0,
515
+ type: String,
516
+ converter: h,
517
+ reflect: !1,
518
+ hasChanged: g
519
+ }, ke = (e = Oe, t, n) => {
520
+ let { kind: r, metadata: i } = n, a = globalThis.litPropertyMetadata.get(i);
521
+ if (a === void 0 && globalThis.litPropertyMetadata.set(i, a = /* @__PURE__ */ new Map()), r === "setter" && ((e = Object.create(e)).wrapped = !0), a.set(n.name, e), r === "accessor") {
522
+ let { name: r } = n;
523
+ return {
524
+ set(n) {
525
+ let i = t.get.call(this);
526
+ t.set.call(this, n), this.requestUpdate(r, i, e, !0, n);
527
+ },
528
+ init(t) {
529
+ return t !== void 0 && this.C(r, void 0, e, t), t;
530
+ }
531
+ };
532
+ }
533
+ if (r === "setter") {
534
+ let { name: r } = n;
535
+ return function(n) {
536
+ let i = this[r];
537
+ t.call(this, n), this.requestUpdate(r, i, e, !0, n);
538
+ };
539
+ }
540
+ throw Error("Unsupported decorator location: " + r);
541
+ };
542
+ function R(e) {
543
+ return (t, n) => typeof n == "object" ? ke(e, t, n) : ((e, t, n) => {
544
+ let r = t.hasOwnProperty(n);
545
+ return t.constructor.createProperty(n, e), r ? Object.getOwnPropertyDescriptor(t, n) : void 0;
546
+ })(e, t, n);
547
+ }
548
+ //#endregion
549
+ //#region node_modules/@lit/reactive-element/decorators/state.js
550
+ function z(e) {
551
+ return R({
552
+ ...e,
553
+ state: !0,
554
+ attribute: !1
555
+ });
556
+ }
557
+ //#endregion
558
+ //#region src/types.ts
559
+ function B(e) {
560
+ return Array.isArray(e) && typeof e[0] == "string";
561
+ }
562
+ function V(e) {
563
+ return typeof e == "number" || typeof e == "boolean" || typeof e == "string" || Array.isArray(e) && e.every(V);
564
+ }
565
+ //#endregion
566
+ //#region src/data-model/path.ts
567
+ function H(e, t) {
568
+ let n = e;
569
+ for (let e of t) {
570
+ if (!Array.isArray(n)) throw Error(`getAtPath: cannot descend into a non-array node at index ${e}`);
571
+ let t = n[e];
572
+ if (t === void 0) throw Error(`getAtPath: no element at index ${e}`);
573
+ n = t;
574
+ }
575
+ return n;
576
+ }
577
+ function U(e, t, n) {
578
+ if (t.length === 0) return n;
579
+ let r = t[0], i = t.slice(1);
580
+ if (!Array.isArray(e)) throw Error(`setAtPath: cannot descend into a non-array node at index ${r}`);
581
+ let a = e.slice();
582
+ return a[r] = U(a[r] ?? 0, i, n), a;
583
+ }
584
+ function W(e, t) {
585
+ return [...e, t];
586
+ }
587
+ function Ae(e, t) {
588
+ if (t <= 0) throw Error("withArgRemoved: argIndex must be >= 1");
589
+ return e.filter((e, n) => n !== t);
590
+ }
591
+ function je(e, t, n, r = []) {
592
+ return U(e, t, [
593
+ n,
594
+ H(e, t),
595
+ ...r
596
+ ]);
597
+ }
598
+ function Me(e, t, n, r = !1) {
599
+ let i = H(e, t);
600
+ if (!B(i)) throw Error("swapOperator: node at path is not a compound expression");
601
+ let a = i.slice(1);
602
+ return r && a.length >= 2 && ([a[0], a[1]] = [a[1], a[0]]), U(e, t, [n, ...a]);
603
+ }
604
+ //#endregion
605
+ //#region src/data-model/symbols.ts
606
+ function G(e, t) {
607
+ return e.find((e) => e.id === t);
608
+ }
609
+ function Ne(e, t, n) {
610
+ let r = t.trim().toLowerCase();
611
+ return e.filter((e) => !r || e.label.toLowerCase().includes(r) || e.id.toLowerCase().includes(r)).slice().sort((e, t) => {
612
+ if (n) {
613
+ let r = e.type === n ? 0 : 1, i = t.type === n ? 0 : 1;
614
+ if (r !== i) return r - i;
615
+ }
616
+ return e.label.localeCompare(t.label);
617
+ });
618
+ }
619
+ //#endregion
620
+ //#region src/data-model/classify.ts
621
+ function Pe(e, t) {
622
+ return Array.isArray(e) ? "function" : typeof e == "number" ? "number" : typeof e == "boolean" ? "boolean" : G(t, e) ? "symbol" : "text";
623
+ }
624
+ //#endregion
625
+ //#region src/registry/constructs.generated.ts
626
+ var Fe = {
627
+ arithmetic: "Arithmetic",
628
+ array_arithmetic: "Array Arithmetic",
629
+ boolean_logic: "Boolean Logic",
630
+ collection: "Collections",
631
+ combinatorics: "Combinatorics",
632
+ comparison: "Comparisons",
633
+ constants: "Constants",
634
+ control_flow: "Control Flow",
635
+ core: "Core",
636
+ datetime: "Date & Time",
637
+ functional: "Functional",
638
+ number_theory: "Number Theory",
639
+ special_function: "Special Functions",
640
+ statistics: "Statistics",
641
+ string: "Strings",
642
+ trigonometric: "Trigonometric"
643
+ }, K = [
644
+ {
645
+ name: "Abs",
646
+ category: "arithmetic"
647
+ },
648
+ {
649
+ name: "Add",
650
+ category: "arithmetic"
651
+ },
652
+ {
653
+ name: "Average",
654
+ category: "arithmetic"
655
+ },
656
+ {
657
+ name: "Ceil",
658
+ category: "arithmetic"
659
+ },
660
+ {
661
+ name: "Clamp",
662
+ category: "arithmetic"
663
+ },
664
+ {
665
+ name: "Denominator",
666
+ category: "arithmetic"
667
+ },
668
+ {
669
+ name: "Divide",
670
+ category: "arithmetic"
671
+ },
672
+ {
673
+ name: "Equal",
674
+ category: "arithmetic"
675
+ },
676
+ {
677
+ name: "Exp",
678
+ category: "arithmetic"
679
+ },
680
+ {
681
+ name: "Float",
682
+ category: "arithmetic"
683
+ },
684
+ {
685
+ name: "Floor",
686
+ category: "arithmetic"
687
+ },
688
+ {
689
+ name: "If",
690
+ category: "arithmetic"
691
+ },
692
+ {
693
+ name: "Int",
694
+ category: "arithmetic"
695
+ },
696
+ {
697
+ name: "IsFalse",
698
+ category: "arithmetic"
699
+ },
700
+ {
701
+ name: "IsTrue",
702
+ category: "arithmetic"
703
+ },
704
+ {
705
+ name: "Lb",
706
+ category: "arithmetic"
707
+ },
708
+ {
709
+ name: "Lg",
710
+ category: "arithmetic"
711
+ },
712
+ {
713
+ name: "List",
714
+ category: "arithmetic"
715
+ },
716
+ {
717
+ name: "Ln",
718
+ category: "arithmetic"
719
+ },
720
+ {
721
+ name: "Log",
722
+ category: "arithmetic"
723
+ },
724
+ {
725
+ name: "Log10",
726
+ category: "arithmetic"
727
+ },
728
+ {
729
+ name: "Log2",
730
+ category: "arithmetic"
731
+ },
732
+ {
733
+ name: "LogOnePlus",
734
+ category: "arithmetic"
735
+ },
736
+ {
737
+ name: "Max",
738
+ category: "arithmetic"
739
+ },
740
+ {
741
+ name: "Mean",
742
+ category: "arithmetic"
743
+ },
744
+ {
745
+ name: "Median",
746
+ category: "arithmetic"
747
+ },
748
+ {
749
+ name: "Min",
750
+ category: "arithmetic"
751
+ },
752
+ {
753
+ name: "Multiply",
754
+ category: "arithmetic"
755
+ },
756
+ {
757
+ name: "Negate",
758
+ category: "arithmetic"
759
+ },
760
+ {
761
+ name: "NotEqual",
762
+ category: "arithmetic"
763
+ },
764
+ {
765
+ name: "Numerator",
766
+ category: "arithmetic"
767
+ },
768
+ {
769
+ name: "Power",
770
+ category: "arithmetic"
771
+ },
772
+ {
773
+ name: "Product",
774
+ category: "arithmetic"
775
+ },
776
+ {
777
+ name: "Rational",
778
+ category: "arithmetic"
779
+ },
780
+ {
781
+ name: "Root",
782
+ category: "arithmetic"
783
+ },
784
+ {
785
+ name: "Round",
786
+ category: "arithmetic"
787
+ },
788
+ {
789
+ name: "Sqrt",
790
+ category: "arithmetic"
791
+ },
792
+ {
793
+ name: "Square",
794
+ category: "arithmetic"
795
+ },
796
+ {
797
+ name: "StrictEqual",
798
+ category: "arithmetic"
799
+ },
800
+ {
801
+ name: "Subtract",
802
+ category: "arithmetic"
803
+ },
804
+ {
805
+ name: "Sum",
806
+ category: "arithmetic"
807
+ },
808
+ {
809
+ name: "AddArray",
810
+ category: "array_arithmetic"
811
+ },
812
+ {
813
+ name: "AddScalar",
814
+ category: "array_arithmetic"
815
+ },
816
+ {
817
+ name: "AtIndex",
818
+ category: "array_arithmetic"
819
+ },
820
+ {
821
+ name: "CumulativeProduct",
822
+ category: "array_arithmetic"
823
+ },
824
+ {
825
+ name: "CumulativeSum",
826
+ category: "array_arithmetic"
827
+ },
828
+ {
829
+ name: "FindIntervalIndex",
830
+ category: "array_arithmetic"
831
+ },
832
+ {
833
+ name: "GenerateRange",
834
+ category: "array_arithmetic"
835
+ },
836
+ {
837
+ name: "Interp",
838
+ category: "array_arithmetic"
839
+ },
840
+ {
841
+ name: "MultiplyByArray",
842
+ category: "array_arithmetic"
843
+ },
844
+ {
845
+ name: "MultiplyByScalar",
846
+ category: "array_arithmetic"
847
+ },
848
+ {
849
+ name: "Slice",
850
+ category: "array_arithmetic"
851
+ },
852
+ {
853
+ name: "SubtractArray",
854
+ category: "array_arithmetic"
855
+ },
856
+ {
857
+ name: "SubtractScalar",
858
+ category: "array_arithmetic"
859
+ },
860
+ {
861
+ name: "TrapezoidalIntegrate",
862
+ category: "array_arithmetic"
863
+ },
864
+ {
865
+ name: "Equivalent",
866
+ category: "boolean_logic"
867
+ },
868
+ {
869
+ name: "Implies",
870
+ category: "boolean_logic"
871
+ },
872
+ {
873
+ name: "Nand",
874
+ category: "boolean_logic"
875
+ },
876
+ {
877
+ name: "Nor",
878
+ category: "boolean_logic"
879
+ },
880
+ {
881
+ name: "Xor",
882
+ category: "boolean_logic"
883
+ },
884
+ {
885
+ name: "All",
886
+ category: "collection"
887
+ },
888
+ {
889
+ name: "Any",
890
+ category: "collection"
891
+ },
892
+ {
893
+ name: "Append",
894
+ category: "collection"
895
+ },
896
+ {
897
+ name: "Appended",
898
+ category: "collection"
899
+ },
900
+ {
901
+ name: "ArgMax",
902
+ category: "collection"
903
+ },
904
+ {
905
+ name: "ArgMin",
906
+ category: "collection"
907
+ },
908
+ {
909
+ name: "Array",
910
+ category: "collection"
911
+ },
912
+ {
913
+ name: "At",
914
+ category: "collection"
915
+ },
916
+ {
917
+ name: "Chunk",
918
+ category: "collection"
919
+ },
920
+ {
921
+ name: "ChunkBy",
922
+ category: "collection"
923
+ },
924
+ {
925
+ name: "Contains",
926
+ category: "collection"
927
+ },
928
+ {
929
+ name: "ContainsAllOf",
930
+ category: "collection"
931
+ },
932
+ {
933
+ name: "ContainsAnyOf",
934
+ category: "collection"
935
+ },
936
+ {
937
+ name: "ContainsNoneOf",
938
+ category: "collection"
939
+ },
940
+ {
941
+ name: "Contains_all_of",
942
+ category: "collection"
943
+ },
944
+ {
945
+ name: "Contains_any_of",
946
+ category: "collection"
947
+ },
948
+ {
949
+ name: "Contains_none_of",
950
+ category: "collection"
951
+ },
952
+ {
953
+ name: "Count",
954
+ category: "collection"
955
+ },
956
+ {
957
+ name: "CountIf",
958
+ category: "collection"
959
+ },
960
+ {
961
+ name: "Dedup",
962
+ category: "collection"
963
+ },
964
+ {
965
+ name: "DeleteAt",
966
+ category: "collection"
967
+ },
968
+ {
969
+ name: "Differences",
970
+ category: "collection"
971
+ },
972
+ {
973
+ name: "Drop",
974
+ category: "collection"
975
+ },
976
+ {
977
+ name: "DropWhile",
978
+ category: "collection"
979
+ },
980
+ {
981
+ name: "Element",
982
+ category: "collection"
983
+ },
984
+ {
985
+ name: "Find",
986
+ category: "collection"
987
+ },
988
+ {
989
+ name: "First",
990
+ category: "collection"
991
+ },
992
+ {
993
+ name: "FlatMap",
994
+ category: "collection"
995
+ },
996
+ {
997
+ name: "GroupBy",
998
+ category: "collection"
999
+ },
1000
+ {
1001
+ name: "HasMatchingSublist",
1002
+ category: "collection"
1003
+ },
1004
+ {
1005
+ name: "In",
1006
+ category: "collection"
1007
+ },
1008
+ {
1009
+ name: "IndexOf",
1010
+ category: "collection"
1011
+ },
1012
+ {
1013
+ name: "IndexWhere",
1014
+ category: "collection"
1015
+ },
1016
+ {
1017
+ name: "Insert",
1018
+ category: "collection"
1019
+ },
1020
+ {
1021
+ name: "Intersection",
1022
+ category: "collection"
1023
+ },
1024
+ {
1025
+ name: "Interval",
1026
+ category: "collection"
1027
+ },
1028
+ {
1029
+ name: "IsEmpty",
1030
+ category: "collection"
1031
+ },
1032
+ {
1033
+ name: "Join",
1034
+ category: "collection"
1035
+ },
1036
+ {
1037
+ name: "Last",
1038
+ category: "collection"
1039
+ },
1040
+ {
1041
+ name: "Length",
1042
+ category: "collection"
1043
+ },
1044
+ {
1045
+ name: "MaxBy",
1046
+ category: "collection"
1047
+ },
1048
+ {
1049
+ name: "MinBy",
1050
+ category: "collection"
1051
+ },
1052
+ {
1053
+ name: "Most",
1054
+ category: "collection"
1055
+ },
1056
+ {
1057
+ name: "NotElement",
1058
+ category: "collection"
1059
+ },
1060
+ {
1061
+ name: "NotIn",
1062
+ category: "collection"
1063
+ },
1064
+ {
1065
+ name: "NotSubset",
1066
+ category: "collection"
1067
+ },
1068
+ {
1069
+ name: "NotSuperset",
1070
+ category: "collection"
1071
+ },
1072
+ {
1073
+ name: "Not_in",
1074
+ category: "collection"
1075
+ },
1076
+ {
1077
+ name: "Open",
1078
+ category: "collection"
1079
+ },
1080
+ {
1081
+ name: "Ordering",
1082
+ category: "collection"
1083
+ },
1084
+ {
1085
+ name: "Partition",
1086
+ category: "collection"
1087
+ },
1088
+ {
1089
+ name: "Position",
1090
+ category: "collection"
1091
+ },
1092
+ {
1093
+ name: "Range",
1094
+ category: "collection"
1095
+ },
1096
+ {
1097
+ name: "ReplaceAt",
1098
+ category: "collection"
1099
+ },
1100
+ {
1101
+ name: "Rest",
1102
+ category: "collection"
1103
+ },
1104
+ {
1105
+ name: "Reverse",
1106
+ category: "collection"
1107
+ },
1108
+ {
1109
+ name: "RotateLeft",
1110
+ category: "collection"
1111
+ },
1112
+ {
1113
+ name: "RotateRight",
1114
+ category: "collection"
1115
+ },
1116
+ {
1117
+ name: "Scan",
1118
+ category: "collection"
1119
+ },
1120
+ {
1121
+ name: "Second",
1122
+ category: "collection"
1123
+ },
1124
+ {
1125
+ name: "SetMinus",
1126
+ category: "collection"
1127
+ },
1128
+ {
1129
+ name: "Sort",
1130
+ category: "collection"
1131
+ },
1132
+ {
1133
+ name: "Subset",
1134
+ category: "collection"
1135
+ },
1136
+ {
1137
+ name: "SubsetEqual",
1138
+ category: "collection"
1139
+ },
1140
+ {
1141
+ name: "Superset",
1142
+ category: "collection"
1143
+ },
1144
+ {
1145
+ name: "SupersetEqual",
1146
+ category: "collection"
1147
+ },
1148
+ {
1149
+ name: "SymmetricDifference",
1150
+ category: "collection"
1151
+ },
1152
+ {
1153
+ name: "Take",
1154
+ category: "collection"
1155
+ },
1156
+ {
1157
+ name: "TakeWhile",
1158
+ category: "collection"
1159
+ },
1160
+ {
1161
+ name: "Tally",
1162
+ category: "collection"
1163
+ },
1164
+ {
1165
+ name: "Third",
1166
+ category: "collection"
1167
+ },
1168
+ {
1169
+ name: "Union",
1170
+ category: "collection"
1171
+ },
1172
+ {
1173
+ name: "Unique",
1174
+ category: "collection"
1175
+ },
1176
+ {
1177
+ name: "Zip",
1178
+ category: "collection"
1179
+ },
1180
+ {
1181
+ name: "BellNumber",
1182
+ category: "combinatorics"
1183
+ },
1184
+ {
1185
+ name: "CartesianProduct",
1186
+ category: "combinatorics"
1187
+ },
1188
+ {
1189
+ name: "Choose",
1190
+ category: "combinatorics"
1191
+ },
1192
+ {
1193
+ name: "Combinations",
1194
+ category: "combinatorics"
1195
+ },
1196
+ {
1197
+ name: "Fibonacci",
1198
+ category: "combinatorics"
1199
+ },
1200
+ {
1201
+ name: "Multinomial",
1202
+ category: "combinatorics"
1203
+ },
1204
+ {
1205
+ name: "Permutations",
1206
+ category: "combinatorics"
1207
+ },
1208
+ {
1209
+ name: "PowerSet",
1210
+ category: "combinatorics"
1211
+ },
1212
+ {
1213
+ name: "Subfactorial",
1214
+ category: "combinatorics"
1215
+ },
1216
+ {
1217
+ name: "And",
1218
+ category: "comparison"
1219
+ },
1220
+ {
1221
+ name: "Congruent",
1222
+ category: "comparison"
1223
+ },
1224
+ {
1225
+ name: "Greater",
1226
+ category: "comparison"
1227
+ },
1228
+ {
1229
+ name: "GreaterEqual",
1230
+ category: "comparison"
1231
+ },
1232
+ {
1233
+ name: "IdenticallyEqual",
1234
+ category: "comparison"
1235
+ },
1236
+ {
1237
+ name: "IsDefined",
1238
+ category: "comparison"
1239
+ },
1240
+ {
1241
+ name: "IsUndefined",
1242
+ category: "comparison"
1243
+ },
1244
+ {
1245
+ name: "Less",
1246
+ category: "comparison"
1247
+ },
1248
+ {
1249
+ name: "LessEqual",
1250
+ category: "comparison"
1251
+ },
1252
+ {
1253
+ name: "Not",
1254
+ category: "comparison"
1255
+ },
1256
+ {
1257
+ name: "Or",
1258
+ category: "comparison"
1259
+ },
1260
+ {
1261
+ name: "CatalanConstant",
1262
+ category: "constants"
1263
+ },
1264
+ {
1265
+ name: "Degrees",
1266
+ category: "constants"
1267
+ },
1268
+ {
1269
+ name: "EulerGamma",
1270
+ category: "constants"
1271
+ },
1272
+ {
1273
+ name: "ExponentialE",
1274
+ category: "constants"
1275
+ },
1276
+ {
1277
+ name: "GoldenRatio",
1278
+ category: "constants"
1279
+ },
1280
+ {
1281
+ name: "MachineEpsilon",
1282
+ category: "constants"
1283
+ },
1284
+ {
1285
+ name: "Constants",
1286
+ category: "control_flow"
1287
+ },
1288
+ {
1289
+ name: "Function",
1290
+ category: "control_flow"
1291
+ },
1292
+ {
1293
+ name: "StrictSwitch",
1294
+ category: "control_flow"
1295
+ },
1296
+ {
1297
+ name: "Switch",
1298
+ category: "control_flow"
1299
+ },
1300
+ {
1301
+ name: "Variable",
1302
+ category: "control_flow"
1303
+ },
1304
+ {
1305
+ name: "Which",
1306
+ category: "control_flow"
1307
+ },
1308
+ {
1309
+ name: "Head",
1310
+ category: "core"
1311
+ },
1312
+ {
1313
+ name: "Hold",
1314
+ category: "core"
1315
+ },
1316
+ {
1317
+ name: "Identity",
1318
+ category: "core"
1319
+ },
1320
+ {
1321
+ name: "IsSame",
1322
+ category: "core"
1323
+ },
1324
+ {
1325
+ name: "Same",
1326
+ category: "core"
1327
+ },
1328
+ {
1329
+ name: "Tail",
1330
+ category: "core"
1331
+ },
1332
+ {
1333
+ name: "Type",
1334
+ category: "core"
1335
+ },
1336
+ {
1337
+ name: "Now",
1338
+ category: "datetime"
1339
+ },
1340
+ {
1341
+ name: "Strftime",
1342
+ category: "datetime"
1343
+ },
1344
+ {
1345
+ name: "Strptime",
1346
+ category: "datetime"
1347
+ },
1348
+ {
1349
+ name: "TimeDeltaDays",
1350
+ category: "datetime"
1351
+ },
1352
+ {
1353
+ name: "TimeDeltaHours",
1354
+ category: "datetime"
1355
+ },
1356
+ {
1357
+ name: "TimeDeltaMinutes",
1358
+ category: "datetime"
1359
+ },
1360
+ {
1361
+ name: "TimeDeltaWeeks",
1362
+ category: "datetime"
1363
+ },
1364
+ {
1365
+ name: "Today",
1366
+ category: "datetime"
1367
+ },
1368
+ {
1369
+ name: "Filter",
1370
+ category: "functional"
1371
+ },
1372
+ {
1373
+ name: "Fold",
1374
+ category: "functional"
1375
+ },
1376
+ {
1377
+ name: "Map",
1378
+ category: "functional"
1379
+ },
1380
+ {
1381
+ name: "Reduce",
1382
+ category: "functional"
1383
+ },
1384
+ {
1385
+ name: "StrictMap",
1386
+ category: "functional"
1387
+ },
1388
+ {
1389
+ name: "BernoulliB",
1390
+ category: "number_theory"
1391
+ },
1392
+ {
1393
+ name: "Binomial",
1394
+ category: "number_theory"
1395
+ },
1396
+ {
1397
+ name: "CarmichaelLambda",
1398
+ category: "number_theory"
1399
+ },
1400
+ {
1401
+ name: "CatalanNumber",
1402
+ category: "number_theory"
1403
+ },
1404
+ {
1405
+ name: "ChineseRemainder",
1406
+ category: "number_theory"
1407
+ },
1408
+ {
1409
+ name: "Chop",
1410
+ category: "number_theory"
1411
+ },
1412
+ {
1413
+ name: "ContinuedFraction",
1414
+ category: "number_theory"
1415
+ },
1416
+ {
1417
+ name: "DigitCount",
1418
+ category: "number_theory"
1419
+ },
1420
+ {
1421
+ name: "DigitSum",
1422
+ category: "number_theory"
1423
+ },
1424
+ {
1425
+ name: "Divides",
1426
+ category: "number_theory"
1427
+ },
1428
+ {
1429
+ name: "DivisorSigma",
1430
+ category: "number_theory"
1431
+ },
1432
+ {
1433
+ name: "Divisors",
1434
+ category: "number_theory"
1435
+ },
1436
+ {
1437
+ name: "Erf",
1438
+ category: "number_theory"
1439
+ },
1440
+ {
1441
+ name: "Erfc",
1442
+ category: "number_theory"
1443
+ },
1444
+ {
1445
+ name: "ExtendedGCD",
1446
+ category: "number_theory"
1447
+ },
1448
+ {
1449
+ name: "FactorInteger",
1450
+ category: "number_theory"
1451
+ },
1452
+ {
1453
+ name: "Factorial",
1454
+ category: "number_theory"
1455
+ },
1456
+ {
1457
+ name: "FromContinuedFraction",
1458
+ category: "number_theory"
1459
+ },
1460
+ {
1461
+ name: "FromDigits",
1462
+ category: "number_theory"
1463
+ },
1464
+ {
1465
+ name: "GCD",
1466
+ category: "number_theory"
1467
+ },
1468
+ {
1469
+ name: "IntegerDigits",
1470
+ category: "number_theory"
1471
+ },
1472
+ {
1473
+ name: "IntegerSqrt",
1474
+ category: "number_theory"
1475
+ },
1476
+ {
1477
+ name: "IsAbundant",
1478
+ category: "number_theory"
1479
+ },
1480
+ {
1481
+ name: "IsCenteredSquare",
1482
+ category: "number_theory"
1483
+ },
1484
+ {
1485
+ name: "IsHappy",
1486
+ category: "number_theory"
1487
+ },
1488
+ {
1489
+ name: "IsOctahedral",
1490
+ category: "number_theory"
1491
+ },
1492
+ {
1493
+ name: "IsPentagonal",
1494
+ category: "number_theory"
1495
+ },
1496
+ {
1497
+ name: "IsPerfect",
1498
+ category: "number_theory"
1499
+ },
1500
+ {
1501
+ name: "IsPerfectPower",
1502
+ category: "number_theory"
1503
+ },
1504
+ {
1505
+ name: "IsPrime",
1506
+ category: "number_theory"
1507
+ },
1508
+ {
1509
+ name: "IsSquare",
1510
+ category: "number_theory"
1511
+ },
1512
+ {
1513
+ name: "IsSquareFree",
1514
+ category: "number_theory"
1515
+ },
1516
+ {
1517
+ name: "IsTriangular",
1518
+ category: "number_theory"
1519
+ },
1520
+ {
1521
+ name: "JacobiSymbol",
1522
+ category: "number_theory"
1523
+ },
1524
+ {
1525
+ name: "LCM",
1526
+ category: "number_theory"
1527
+ },
1528
+ {
1529
+ name: "LegendreSymbol",
1530
+ category: "number_theory"
1531
+ },
1532
+ {
1533
+ name: "LucasL",
1534
+ category: "number_theory"
1535
+ },
1536
+ {
1537
+ name: "Mod",
1538
+ category: "number_theory"
1539
+ },
1540
+ {
1541
+ name: "ModularInverse",
1542
+ category: "number_theory"
1543
+ },
1544
+ {
1545
+ name: "MultiplicativeOrder",
1546
+ category: "number_theory"
1547
+ },
1548
+ {
1549
+ name: "NextPrime",
1550
+ category: "number_theory"
1551
+ },
1552
+ {
1553
+ name: "NthPrime",
1554
+ category: "number_theory"
1555
+ },
1556
+ {
1557
+ name: "PowerMod",
1558
+ category: "number_theory"
1559
+ },
1560
+ {
1561
+ name: "PrimeFactors",
1562
+ category: "number_theory"
1563
+ },
1564
+ {
1565
+ name: "PrimeNu",
1566
+ category: "number_theory"
1567
+ },
1568
+ {
1569
+ name: "PrimeOmega",
1570
+ category: "number_theory"
1571
+ },
1572
+ {
1573
+ name: "PrimePi",
1574
+ category: "number_theory"
1575
+ },
1576
+ {
1577
+ name: "PrimitiveRoot",
1578
+ category: "number_theory"
1579
+ },
1580
+ {
1581
+ name: "Radical",
1582
+ category: "number_theory"
1583
+ },
1584
+ {
1585
+ name: "Sigma0",
1586
+ category: "number_theory"
1587
+ },
1588
+ {
1589
+ name: "Sigma1",
1590
+ category: "number_theory"
1591
+ },
1592
+ {
1593
+ name: "SigmaMinus1",
1594
+ category: "number_theory"
1595
+ },
1596
+ {
1597
+ name: "Totient",
1598
+ category: "number_theory"
1599
+ },
1600
+ {
1601
+ name: "AGM",
1602
+ category: "special_function"
1603
+ },
1604
+ {
1605
+ name: "AiryAi",
1606
+ category: "special_function"
1607
+ },
1608
+ {
1609
+ name: "AiryAiPrime",
1610
+ category: "special_function"
1611
+ },
1612
+ {
1613
+ name: "AiryBi",
1614
+ category: "special_function"
1615
+ },
1616
+ {
1617
+ name: "AiryBiPrime",
1618
+ category: "special_function"
1619
+ },
1620
+ {
1621
+ name: "BesselI",
1622
+ category: "special_function"
1623
+ },
1624
+ {
1625
+ name: "BesselJ",
1626
+ category: "special_function"
1627
+ },
1628
+ {
1629
+ name: "BesselK",
1630
+ category: "special_function"
1631
+ },
1632
+ {
1633
+ name: "BesselY",
1634
+ category: "special_function"
1635
+ },
1636
+ {
1637
+ name: "Beta",
1638
+ category: "special_function"
1639
+ },
1640
+ {
1641
+ name: "BetaRegularized",
1642
+ category: "special_function"
1643
+ },
1644
+ {
1645
+ name: "EllipticE",
1646
+ category: "special_function"
1647
+ },
1648
+ {
1649
+ name: "EllipticK",
1650
+ category: "special_function"
1651
+ },
1652
+ {
1653
+ name: "ErfInv",
1654
+ category: "special_function"
1655
+ },
1656
+ {
1657
+ name: "Factorial2",
1658
+ category: "special_function"
1659
+ },
1660
+ {
1661
+ name: "Gamma",
1662
+ category: "special_function"
1663
+ },
1664
+ {
1665
+ name: "GammaLn",
1666
+ category: "special_function"
1667
+ },
1668
+ {
1669
+ name: "GammaRegularized",
1670
+ category: "special_function"
1671
+ },
1672
+ {
1673
+ name: "Hypergeometric1F1",
1674
+ category: "special_function"
1675
+ },
1676
+ {
1677
+ name: "Hypergeometric2F1",
1678
+ category: "special_function"
1679
+ },
1680
+ {
1681
+ name: "LambertW",
1682
+ category: "special_function"
1683
+ },
1684
+ {
1685
+ name: "Zeta",
1686
+ category: "special_function"
1687
+ },
1688
+ {
1689
+ name: "BinomialDistribution",
1690
+ category: "statistics"
1691
+ },
1692
+ {
1693
+ name: "CDF",
1694
+ category: "statistics"
1695
+ },
1696
+ {
1697
+ name: "Correlation",
1698
+ category: "statistics"
1699
+ },
1700
+ {
1701
+ name: "Covariance",
1702
+ category: "statistics"
1703
+ },
1704
+ {
1705
+ name: "ExponentialDistribution",
1706
+ category: "statistics"
1707
+ },
1708
+ {
1709
+ name: "InterquartileRange",
1710
+ category: "statistics"
1711
+ },
1712
+ {
1713
+ name: "Kurtosis",
1714
+ category: "statistics"
1715
+ },
1716
+ {
1717
+ name: "LinearRegression",
1718
+ category: "statistics"
1719
+ },
1720
+ {
1721
+ name: "Mode",
1722
+ category: "statistics"
1723
+ },
1724
+ {
1725
+ name: "NormalDistribution",
1726
+ category: "statistics"
1727
+ },
1728
+ {
1729
+ name: "PDF",
1730
+ category: "statistics"
1731
+ },
1732
+ {
1733
+ name: "PoissonDistribution",
1734
+ category: "statistics"
1735
+ },
1736
+ {
1737
+ name: "PolynomialFit",
1738
+ category: "statistics"
1739
+ },
1740
+ {
1741
+ name: "PopulationStandardDeviation",
1742
+ category: "statistics"
1743
+ },
1744
+ {
1745
+ name: "PopulationVariance",
1746
+ category: "statistics"
1747
+ },
1748
+ {
1749
+ name: "Quantile",
1750
+ category: "statistics"
1751
+ },
1752
+ {
1753
+ name: "Quartiles",
1754
+ category: "statistics"
1755
+ },
1756
+ {
1757
+ name: "Skewness",
1758
+ category: "statistics"
1759
+ },
1760
+ {
1761
+ name: "StandardDeviation",
1762
+ category: "statistics"
1763
+ },
1764
+ {
1765
+ name: "UniformDistribution",
1766
+ category: "statistics"
1767
+ },
1768
+ {
1769
+ name: "Variance",
1770
+ category: "statistics"
1771
+ },
1772
+ {
1773
+ name: "Arctan2",
1774
+ category: "string"
1775
+ },
1776
+ {
1777
+ name: "CaseFold",
1778
+ category: "string"
1779
+ },
1780
+ {
1781
+ name: "Characters",
1782
+ category: "string"
1783
+ },
1784
+ {
1785
+ name: "DigitsFrom",
1786
+ category: "string"
1787
+ },
1788
+ {
1789
+ name: "GraphemeClusters",
1790
+ category: "string"
1791
+ },
1792
+ {
1793
+ name: "IntegerString",
1794
+ category: "string"
1795
+ },
1796
+ {
1797
+ name: "IsMatch",
1798
+ category: "string"
1799
+ },
1800
+ {
1801
+ name: "NumberFrom",
1802
+ category: "string"
1803
+ },
1804
+ {
1805
+ name: "PadEnd",
1806
+ category: "string"
1807
+ },
1808
+ {
1809
+ name: "PadStart",
1810
+ category: "string"
1811
+ },
1812
+ {
1813
+ name: "RegExp",
1814
+ category: "string"
1815
+ },
1816
+ {
1817
+ name: "Str",
1818
+ category: "string"
1819
+ },
1820
+ {
1821
+ name: "String",
1822
+ category: "string"
1823
+ },
1824
+ {
1825
+ name: "StringCompare",
1826
+ category: "string"
1827
+ },
1828
+ {
1829
+ name: "StringFrom",
1830
+ category: "string"
1831
+ },
1832
+ {
1833
+ name: "StringJoin",
1834
+ category: "string"
1835
+ },
1836
+ {
1837
+ name: "StringMatch",
1838
+ category: "string"
1839
+ },
1840
+ {
1841
+ name: "StringMatchAll",
1842
+ category: "string"
1843
+ },
1844
+ {
1845
+ name: "StringRepeat",
1846
+ category: "string"
1847
+ },
1848
+ {
1849
+ name: "StringReplace",
1850
+ category: "string"
1851
+ },
1852
+ {
1853
+ name: "StringSplit",
1854
+ category: "string"
1855
+ },
1856
+ {
1857
+ name: "ToLowerCase",
1858
+ category: "string"
1859
+ },
1860
+ {
1861
+ name: "ToUpperCase",
1862
+ category: "string"
1863
+ },
1864
+ {
1865
+ name: "Trim",
1866
+ category: "string"
1867
+ },
1868
+ {
1869
+ name: "TrimEnd",
1870
+ category: "string"
1871
+ },
1872
+ {
1873
+ name: "TrimStart",
1874
+ category: "string"
1875
+ },
1876
+ {
1877
+ name: "UnicodeScalars",
1878
+ category: "string"
1879
+ },
1880
+ {
1881
+ name: "Utf16",
1882
+ category: "string"
1883
+ },
1884
+ {
1885
+ name: "Utf8",
1886
+ category: "string"
1887
+ },
1888
+ {
1889
+ name: "Arccos",
1890
+ category: "trigonometric"
1891
+ },
1892
+ {
1893
+ name: "Arccot",
1894
+ category: "trigonometric"
1895
+ },
1896
+ {
1897
+ name: "Arccsc",
1898
+ category: "trigonometric"
1899
+ },
1900
+ {
1901
+ name: "Arcosh",
1902
+ category: "trigonometric"
1903
+ },
1904
+ {
1905
+ name: "Arcoth",
1906
+ category: "trigonometric"
1907
+ },
1908
+ {
1909
+ name: "Arcsch",
1910
+ category: "trigonometric"
1911
+ },
1912
+ {
1913
+ name: "Arcsec",
1914
+ category: "trigonometric"
1915
+ },
1916
+ {
1917
+ name: "Arcsin",
1918
+ category: "trigonometric"
1919
+ },
1920
+ {
1921
+ name: "Arctan",
1922
+ category: "trigonometric"
1923
+ },
1924
+ {
1925
+ name: "Arsech",
1926
+ category: "trigonometric"
1927
+ },
1928
+ {
1929
+ name: "Arsinh",
1930
+ category: "trigonometric"
1931
+ },
1932
+ {
1933
+ name: "Artanh",
1934
+ category: "trigonometric"
1935
+ },
1936
+ {
1937
+ name: "Cos",
1938
+ category: "trigonometric"
1939
+ },
1940
+ {
1941
+ name: "Cosh",
1942
+ category: "trigonometric"
1943
+ },
1944
+ {
1945
+ name: "Cot",
1946
+ category: "trigonometric"
1947
+ },
1948
+ {
1949
+ name: "Coth",
1950
+ category: "trigonometric"
1951
+ },
1952
+ {
1953
+ name: "Csc",
1954
+ category: "trigonometric"
1955
+ },
1956
+ {
1957
+ name: "Csch",
1958
+ category: "trigonometric"
1959
+ },
1960
+ {
1961
+ name: "Hypot",
1962
+ category: "trigonometric"
1963
+ },
1964
+ {
1965
+ name: "Pi",
1966
+ category: "trigonometric"
1967
+ },
1968
+ {
1969
+ name: "Sec",
1970
+ category: "trigonometric"
1971
+ },
1972
+ {
1973
+ name: "Sech",
1974
+ category: "trigonometric"
1975
+ },
1976
+ {
1977
+ name: "Sin",
1978
+ category: "trigonometric"
1979
+ },
1980
+ {
1981
+ name: "Sinc",
1982
+ category: "trigonometric"
1983
+ },
1984
+ {
1985
+ name: "Sinh",
1986
+ category: "trigonometric"
1987
+ },
1988
+ {
1989
+ name: "Tan",
1990
+ category: "trigonometric"
1991
+ },
1992
+ {
1993
+ name: "Tanh",
1994
+ category: "trigonometric"
1995
+ }
1996
+ ], Ie = {
1997
+ Add: [{
1998
+ label: "value",
1999
+ variadic: !0
2000
+ }],
2001
+ Subtract: [{
2002
+ label: "value",
2003
+ variadic: !0
2004
+ }],
2005
+ Multiply: [{
2006
+ label: "value",
2007
+ variadic: !0
2008
+ }],
2009
+ Divide: [{ label: "numerator" }, { label: "denominator" }],
2010
+ Negate: [{ label: "value" }],
2011
+ Power: [{ label: "base" }, { label: "exponent" }],
2012
+ Sqrt: [{ label: "value" }],
2013
+ Square: [{ label: "value" }],
2014
+ Root: [{ label: "value" }, { label: "degree" }],
2015
+ Round: [{ label: "value" }, {
2016
+ label: "digits",
2017
+ optional: !0,
2018
+ defaultValue: 0
2019
+ }],
2020
+ Floor: [{ label: "value" }],
2021
+ Ceil: [{ label: "value" }],
2022
+ Abs: [{ label: "value" }],
2023
+ Min: [{
2024
+ label: "value",
2025
+ variadic: !0
2026
+ }],
2027
+ Max: [{
2028
+ label: "value",
2029
+ variadic: !0
2030
+ }],
2031
+ Average: [{
2032
+ label: "value",
2033
+ variadic: !0
2034
+ }],
2035
+ Median: [{
2036
+ label: "value",
2037
+ variadic: !0
2038
+ }],
2039
+ Sum: [{
2040
+ label: "value",
2041
+ variadic: !0
2042
+ }],
2043
+ Product: [{ label: "values" }],
2044
+ Clamp: [
2045
+ { label: "value" },
2046
+ { label: "min" },
2047
+ { label: "max" }
2048
+ ],
2049
+ Mod: [{ label: "value" }, { label: "divisor" }],
2050
+ If: [
2051
+ {
2052
+ label: "condition",
2053
+ defaultValue: !0
2054
+ },
2055
+ { label: "then" },
2056
+ { label: "else" }
2057
+ ],
2058
+ Switch: [{
2059
+ label: "value / case / result ...",
2060
+ variadic: !0
2061
+ }],
2062
+ Which: [{
2063
+ label: "condition / result ...",
2064
+ variadic: !0
2065
+ }],
2066
+ Equal: [{ label: "a" }, { label: "b" }],
2067
+ NotEqual: [{ label: "a" }, { label: "b" }],
2068
+ Greater: [{ label: "a" }, { label: "b" }],
2069
+ GreaterEqual: [{ label: "a" }, { label: "b" }],
2070
+ Less: [{ label: "a" }, { label: "b" }],
2071
+ LessEqual: [{ label: "a" }, { label: "b" }],
2072
+ And: [{
2073
+ label: "condition",
2074
+ variadic: !0
2075
+ }],
2076
+ Or: [{
2077
+ label: "condition",
2078
+ variadic: !0
2079
+ }],
2080
+ Not: [{ label: "condition" }],
2081
+ StringJoin: [{
2082
+ label: "value",
2083
+ variadic: !0
2084
+ }],
2085
+ ToUpperCase: [{ label: "text" }],
2086
+ ToLowerCase: [{ label: "text" }],
2087
+ Trim: [{ label: "text" }]
2088
+ }, Le = {
2089
+ Add: "Addition",
2090
+ Subtract: "Subtraction",
2091
+ Multiply: "Multiplication",
2092
+ And: "And",
2093
+ Or: "Or",
2094
+ Divide: "Division",
2095
+ Power: "Power",
2096
+ Square: "Square",
2097
+ Sqrt: "Square Root",
2098
+ Root: "Root",
2099
+ Sum: "Sum",
2100
+ Product: "Product",
2101
+ Equal: "Equal To",
2102
+ NotEqual: "Not Equal To",
2103
+ Greater: "Greater Than",
2104
+ GreaterEqual: "Greater Than or Equal To",
2105
+ Less: "Less Than",
2106
+ LessEqual: "Less Than or Equal To",
2107
+ In: "In",
2108
+ NotIn: "Not In",
2109
+ Contains: "Contains",
2110
+ ContainsAnyOf: "Contains Any Of",
2111
+ ContainsAllOf: "Contains All Of",
2112
+ ContainsNoneOf: "Contains None Of",
2113
+ Subset: "Subset Of",
2114
+ SubsetEqual: "Subset Of Or Equal To",
2115
+ Superset: "Superset Of",
2116
+ SupersetEqual: "Superset Of Or Equal To",
2117
+ NotSubset: "Not A Subset Of",
2118
+ NotSuperset: "Not A Superset Of",
2119
+ Element: "In Range",
2120
+ NotElement: "Not In Range",
2121
+ Array: "List",
2122
+ List: "List"
2123
+ }, Re = {
2124
+ Add: {
2125
+ kind: "infix",
2126
+ symbol: "+"
2127
+ },
2128
+ Subtract: {
2129
+ kind: "infix",
2130
+ symbol: "−"
2131
+ },
2132
+ Multiply: {
2133
+ kind: "infix",
2134
+ symbol: "·"
2135
+ },
2136
+ And: {
2137
+ kind: "infix",
2138
+ symbol: "∧"
2139
+ },
2140
+ Or: {
2141
+ kind: "infix",
2142
+ symbol: "∨"
2143
+ },
2144
+ Divide: { kind: "fraction" },
2145
+ Power: { kind: "power" },
2146
+ Square: {
2147
+ kind: "power",
2148
+ symbol: "2"
2149
+ },
2150
+ Sqrt: { kind: "sqrt" },
2151
+ Root: { kind: "root" },
2152
+ Sum: {
2153
+ kind: "reducer",
2154
+ symbol: "Σ"
2155
+ },
2156
+ Product: {
2157
+ kind: "reducer",
2158
+ symbol: "Π"
2159
+ },
2160
+ Array: { kind: "array" },
2161
+ List: { kind: "array" },
2162
+ Equal: {
2163
+ kind: "comparison",
2164
+ symbol: "="
2165
+ },
2166
+ NotEqual: {
2167
+ kind: "comparison",
2168
+ symbol: "≠"
2169
+ },
2170
+ Greater: {
2171
+ kind: "comparison",
2172
+ symbol: ">"
2173
+ },
2174
+ GreaterEqual: {
2175
+ kind: "comparison",
2176
+ symbol: "≥"
2177
+ },
2178
+ Less: {
2179
+ kind: "comparison",
2180
+ symbol: "<"
2181
+ },
2182
+ LessEqual: {
2183
+ kind: "comparison",
2184
+ symbol: "≤"
2185
+ },
2186
+ In: {
2187
+ kind: "comparison",
2188
+ symbol: "in"
2189
+ },
2190
+ NotIn: {
2191
+ kind: "comparison",
2192
+ symbol: "not in"
2193
+ },
2194
+ Contains: {
2195
+ kind: "comparison",
2196
+ symbol: "contains"
2197
+ },
2198
+ ContainsAnyOf: {
2199
+ kind: "comparison",
2200
+ symbol: "contains any of"
2201
+ },
2202
+ ContainsAllOf: {
2203
+ kind: "comparison",
2204
+ symbol: "contains all of"
2205
+ },
2206
+ ContainsNoneOf: {
2207
+ kind: "comparison",
2208
+ symbol: "contains none of"
2209
+ },
2210
+ Subset: {
2211
+ kind: "comparison",
2212
+ symbol: "⊂"
2213
+ },
2214
+ SubsetEqual: {
2215
+ kind: "comparison",
2216
+ symbol: "⊆"
2217
+ },
2218
+ Superset: {
2219
+ kind: "comparison",
2220
+ symbol: "⊃"
2221
+ },
2222
+ SupersetEqual: {
2223
+ kind: "comparison",
2224
+ symbol: "⊇"
2225
+ },
2226
+ NotSubset: {
2227
+ kind: "comparison",
2228
+ symbol: "⊄"
2229
+ },
2230
+ NotSuperset: {
2231
+ kind: "comparison",
2232
+ symbol: "⊅"
2233
+ }
2234
+ }, ze = [
2235
+ "Equal",
2236
+ "NotEqual",
2237
+ "Greater",
2238
+ "GreaterEqual",
2239
+ "Less",
2240
+ "LessEqual",
2241
+ "In",
2242
+ "NotIn",
2243
+ "Contains",
2244
+ "ContainsAnyOf",
2245
+ "ContainsAllOf",
2246
+ "ContainsNoneOf",
2247
+ "Subset",
2248
+ "SubsetEqual",
2249
+ "Superset",
2250
+ "SupersetEqual",
2251
+ "NotSubset",
2252
+ "NotSuperset"
2253
+ ], Be = [
2254
+ [
2255
+ "Add",
2256
+ "Subtract",
2257
+ "Multiply"
2258
+ ],
2259
+ ["And", "Or"],
2260
+ ze
2261
+ ];
2262
+ function Ve(e) {
2263
+ let t = Be.find((t) => t.includes(e));
2264
+ return t ? t.filter((t) => t !== e) : [];
2265
+ }
2266
+ function He(e) {
2267
+ return ze.includes(e);
2268
+ }
2269
+ var Ue = /* @__PURE__ */ new Set(["Contains"]);
2270
+ function We(e, t) {
2271
+ return Ue.has(e) !== Ue.has(t);
2272
+ }
2273
+ function Ge(e) {
2274
+ return Re[e]?.symbol ?? e;
2275
+ }
2276
+ //#endregion
2277
+ //#region src/registry/registry.ts
2278
+ var Ke = new Map(K.map((e) => [e.name, {
2279
+ ...e,
2280
+ args: Ie[e.name]
2281
+ }]));
2282
+ function qe() {
2283
+ return K;
2284
+ }
2285
+ function q(e) {
2286
+ return Ke.get(e);
2287
+ }
2288
+ function Je(e) {
2289
+ return Re[e];
2290
+ }
2291
+ function Ye(e) {
2292
+ return Fe[e] ?? e;
2293
+ }
2294
+ function J(e) {
2295
+ return Le[e] ?? e;
2296
+ }
2297
+ function Xe(e) {
2298
+ let t = q(e)?.args;
2299
+ if (!t || t.length === 0) return;
2300
+ if (t[t.length - 1]?.variadic) return {
2301
+ min: t.length,
2302
+ max: Infinity
2303
+ };
2304
+ let n = t.filter((e) => e.optional).length;
2305
+ return {
2306
+ min: t.length - n,
2307
+ max: t.length
2308
+ };
2309
+ }
2310
+ function Ze(e, t = []) {
2311
+ let n = e.trim().toLowerCase(), r = new Set(t);
2312
+ return K.filter((e) => r.has(e.name) ? !1 : !n || e.name.toLowerCase().includes(n) || Ye(e.category).toLowerCase().includes(n));
2313
+ }
2314
+ function Y(e) {
2315
+ let t = Je(e);
2316
+ if (t) switch (t.kind) {
2317
+ case "fraction": return [0, 1];
2318
+ case "power": return e === "Square" ? [0] : [0, 2];
2319
+ case "sqrt": return [0];
2320
+ case "root": return [0, 2];
2321
+ case "comparison": return [0, 0];
2322
+ case "infix": return e === "And" || e === "Or" ? [!0, !0] : [0, 0];
2323
+ case "reducer": return e === "Product" ? [["Array", 1]] : [0];
2324
+ }
2325
+ let n = q(e);
2326
+ return n?.args?.length ? n.args.map((e) => e.defaultValue ?? 0) : [0];
2327
+ }
2328
+ //#endregion
2329
+ //#region src/registry/notation-shape.ts
2330
+ function Qe(e, t, n) {
2331
+ switch (t.kind) {
2332
+ case "infix": return n.length >= 3;
2333
+ case "fraction":
2334
+ case "comparison": return n.length === 3;
2335
+ case "power": return e === "Square" ? n.length === 2 : n.length === 3;
2336
+ case "sqrt": return n.length === 2;
2337
+ case "root": return n.length === 3;
2338
+ case "reducer":
2339
+ if (e === "Product") {
2340
+ let e = n[1];
2341
+ return n.length === 2 && e !== void 0 && B(e) && e[0] === "Array";
2342
+ }
2343
+ return n.length >= 2;
2344
+ case "array": return !0;
2345
+ }
2346
+ }
2347
+ //#endregion
2348
+ //#region src/styles.ts
2349
+ var $e = o`
2350
+ :host {
2351
+ --mjtb-font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
2352
+ --mjtb-font-size: 14px;
2353
+ --mjtb-text: light-dark(#1f2023, #e7e7ea);
2354
+ --mjtb-bg: light-dark(#ffffff, #1c1c1f);
2355
+ --mjtb-node-bg: light-dark(#f7f7f9, #29292e);
2356
+ --mjtb-node-border: light-dark(#dcdce1, #3c3c42);
2357
+ --mjtb-accent: light-dark(#4f46e5, #8583f0);
2358
+ --mjtb-danger: light-dark(#dc2626, #f87171);
2359
+ --mjtb-radius: 6px;
2360
+
2361
+ color-scheme: light dark;
2362
+ display: inline-block;
2363
+ font-family: var(--mjtb-font-family);
2364
+ font-size: var(--mjtb-font-size);
2365
+ color: var(--mjtb-text);
2366
+ background: var(--mjtb-bg);
2367
+ }
2368
+
2369
+ * {
2370
+ box-sizing: border-box;
2371
+ }
2372
+
2373
+ .mjtb-root {
2374
+ display: inline-block;
2375
+ }
2376
+
2377
+ .mjtb-toolbar {
2378
+ display: flex;
2379
+ align-items: center;
2380
+ gap: 8px;
2381
+ margin-bottom: 8px;
2382
+ }
2383
+
2384
+ .mode-toggle {
2385
+ font: inherit;
2386
+ padding: 3px 9px;
2387
+ border-radius: 4px;
2388
+ border: 1px solid var(--mjtb-node-border);
2389
+ background: var(--mjtb-bg);
2390
+ color: inherit;
2391
+ cursor: pointer;
2392
+ }
2393
+
2394
+ .mode-toggle:hover {
2395
+ border-color: var(--mjtb-accent);
2396
+ }
2397
+
2398
+ .mode-toggle:disabled {
2399
+ opacity: 0.5;
2400
+ cursor: not-allowed;
2401
+ }
2402
+
2403
+ .json-error-hint {
2404
+ font-size: 0.85em;
2405
+ color: var(--mjtb-danger);
2406
+ }
2407
+
2408
+ .json-view {
2409
+ display: flex;
2410
+ flex-direction: column;
2411
+ gap: 6px;
2412
+ }
2413
+
2414
+ .json-textarea {
2415
+ display: block;
2416
+ width: 100%;
2417
+ min-width: 320px;
2418
+ min-height: 200px;
2419
+ box-sizing: border-box;
2420
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
2421
+ font-size: 0.95em;
2422
+ line-height: 1.4;
2423
+ tab-size: 2;
2424
+ padding: 10px;
2425
+ border: 1px solid var(--mjtb-node-border);
2426
+ border-radius: var(--mjtb-radius);
2427
+ background: var(--mjtb-node-bg);
2428
+ color: inherit;
2429
+ resize: vertical;
2430
+ }
2431
+
2432
+ .json-textarea:focus-visible {
2433
+ outline: 2px solid var(--mjtb-accent);
2434
+ outline-offset: 1px;
2435
+ }
2436
+
2437
+ .json-error {
2438
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
2439
+ font-size: 0.85em;
2440
+ color: var(--mjtb-danger);
2441
+ background: color-mix(in srgb, var(--mjtb-danger) 10%, transparent);
2442
+ border: 1px solid var(--mjtb-danger);
2443
+ border-radius: 4px;
2444
+ padding: 6px 8px;
2445
+ white-space: pre-wrap;
2446
+ }
2447
+
2448
+ /*
2449
+ * Shared base: every construct box is an inline-flex row with its menu
2450
+ * trailing alongside it. Only .generic (the boxed fallback) opts into
2451
+ * the bordered-card chrome and column stacking — the curated notation
2452
+ * kinds stay visually plain so they read as math, not as nested
2453
+ * cards. Every node is click-to-edit: plain content until it's the
2454
+ * active one, so a hover tint is a notation box's only "this is
2455
+ * clickable" hint (.generic already reads as a box on its own).
2456
+ */
2457
+ .node.construct {
2458
+ display: inline-flex;
2459
+ align-items: center;
2460
+ gap: 6px;
2461
+ vertical-align: middle;
2462
+ border-radius: 4px;
2463
+ cursor: pointer;
2464
+ /* Positioning context for .construct-menu's .popover below — anchors
2465
+ the open menu to the whole node's own box, not to the small
2466
+ trailing trigger it no longer visibly has. */
2467
+ position: relative;
2468
+ }
2469
+
2470
+ .node.construct.generic {
2471
+ flex-direction: column;
2472
+ align-items: stretch;
2473
+ gap: 4px;
2474
+ padding: 6px 8px;
2475
+ background: var(--mjtb-node-bg);
2476
+ border: 1px solid var(--mjtb-node-border);
2477
+ border-radius: var(--mjtb-radius);
2478
+ }
2479
+
2480
+ /*
2481
+ * :hover is true for every ancestor box the pointer happens to be
2482
+ * over, not just the innermost one under the cursor — nested notation
2483
+ * boxes overlap almost entirely (e.g. a comparison as the last operand
2484
+ * of an And chain), so without :has() here, hovering the innermost one
2485
+ * would light up every construct wrapping it too, all the way up,
2486
+ * reading as "the whole expression" rather than the specific node a
2487
+ * click would activate. :has(...:hover) lets an ancestor notice it
2488
+ * contains a more specific hover target and step aside so only the
2489
+ * true innermost one highlights.
2490
+ */
2491
+ .node.construct:not(.generic):hover:not(:has(.node.construct:hover, .value-text:hover)) {
2492
+ background: var(--mjtb-node-bg);
2493
+ }
2494
+
2495
+ .construct-header {
2496
+ display: flex;
2497
+ align-items: center;
2498
+ gap: 6px;
2499
+ flex-wrap: wrap;
2500
+ }
2501
+
2502
+ .construct-name {
2503
+ font-weight: 600;
2504
+ }
2505
+
2506
+ .construct-category {
2507
+ font-size: 0.75em;
2508
+ opacity: 0.6;
2509
+ }
2510
+
2511
+ .construct-args {
2512
+ display: flex;
2513
+ flex-direction: column;
2514
+ gap: 4px;
2515
+ padding-left: 14px;
2516
+ border-left: 2px solid var(--mjtb-node-border);
2517
+ }
2518
+
2519
+ /* Constants: named, individually collapsible bindings, then a
2520
+ final expression — visually distinct from a plain argument list so
2521
+ a name reads as a name, not an anonymous positional argument. */
2522
+ .constants-bindings {
2523
+ display: flex;
2524
+ flex-direction: column;
2525
+ gap: 4px;
2526
+ margin: 2px 0;
2527
+ }
2528
+
2529
+ .constant-card {
2530
+ border: 1px solid var(--mjtb-node-border);
2531
+ border-radius: 4px;
2532
+ padding: 4px 6px;
2533
+ background: var(--mjtb-bg);
2534
+ }
2535
+
2536
+ .constant-header {
2537
+ display: flex;
2538
+ align-items: center;
2539
+ gap: 6px;
2540
+ }
2541
+
2542
+ .fold-toggle {
2543
+ font: inherit;
2544
+ line-height: 1;
2545
+ padding: 2px 6px;
2546
+ border-radius: 4px;
2547
+ border: 1px solid var(--mjtb-node-border);
2548
+ background: var(--mjtb-bg);
2549
+ color: inherit;
2550
+ cursor: pointer;
2551
+ }
2552
+
2553
+ .fold-toggle:hover {
2554
+ border-color: var(--mjtb-accent);
2555
+ }
2556
+
2557
+ .constant-name .value-text,
2558
+ .constant-name input {
2559
+ font-weight: 600;
2560
+ }
2561
+
2562
+ .small-remove {
2563
+ font: inherit;
2564
+ line-height: 1;
2565
+ margin-left: auto;
2566
+ padding: 2px 6px;
2567
+ border-radius: 4px;
2568
+ border: 1px solid var(--mjtb-node-border);
2569
+ background: var(--mjtb-bg);
2570
+ color: var(--mjtb-danger);
2571
+ cursor: pointer;
2572
+ }
2573
+
2574
+ .small-remove:hover {
2575
+ border-color: var(--mjtb-danger);
2576
+ }
2577
+
2578
+ .constant-value {
2579
+ display: block;
2580
+ margin-top: 4px;
2581
+ padding-left: 14px;
2582
+ border-left: 2px solid var(--mjtb-node-border);
2583
+ }
2584
+
2585
+ .constants-final {
2586
+ display: flex;
2587
+ align-items: center;
2588
+ gap: 6px;
2589
+ margin-top: 6px;
2590
+ padding-top: 6px;
2591
+ border-top: 1px dashed var(--mjtb-node-border);
2592
+ }
2593
+
2594
+ /* If (both the flat CortexJS form and the pair/elseif-chain form share
2595
+ this same row layout — see #renderIf). */
2596
+ .if-branches {
2597
+ display: flex;
2598
+ flex-direction: column;
2599
+ gap: 4px;
2600
+ }
2601
+
2602
+ .if-row {
2603
+ display: flex;
2604
+ align-items: center;
2605
+ gap: 6px;
2606
+ flex-wrap: wrap;
2607
+ }
2608
+
2609
+ .if-keyword {
2610
+ font-size: 0.75em;
2611
+ font-weight: 600;
2612
+ text-transform: uppercase;
2613
+ letter-spacing: 0.02em;
2614
+ opacity: 0.6;
2615
+ }
2616
+
2617
+ .slot {
2618
+ display: inline-flex;
2619
+ align-items: center;
2620
+ gap: 4px;
2621
+ flex-wrap: wrap;
2622
+ }
2623
+
2624
+ .arg-label {
2625
+ font-size: 0.75em;
2626
+ opacity: 0.6;
2627
+ }
2628
+
2629
+ input[type="number"],
2630
+ input[type="text"],
2631
+ input[type="search"] {
2632
+ font: inherit;
2633
+ padding: 2px 4px;
2634
+ border: 1px solid var(--mjtb-node-border);
2635
+ border-radius: 4px;
2636
+ background: var(--mjtb-bg);
2637
+ color: inherit;
2638
+ width: 6em;
2639
+ }
2640
+
2641
+ input[type="search"] {
2642
+ width: 12em;
2643
+ }
2644
+
2645
+ .symbol-select {
2646
+ font: inherit;
2647
+ padding: 2px 4px;
2648
+ border: 1px solid var(--mjtb-accent);
2649
+ border-radius: 4px;
2650
+ background: var(--mjtb-bg);
2651
+ color: inherit;
2652
+ max-width: 16em;
2653
+ }
2654
+
2655
+ .symbol-chip {
2656
+ background: color-mix(in srgb, var(--mjtb-accent) 15%, transparent);
2657
+ border: 1px solid var(--mjtb-accent);
2658
+ border-radius: 999px;
2659
+ padding: 1px 10px;
2660
+ white-space: nowrap;
2661
+ cursor: pointer;
2662
+ }
2663
+
2664
+ /* Read-mode literal: plain text, not an input, until activated. */
2665
+ .value-text {
2666
+ display: inline-block;
2667
+ min-width: 0.75em;
2668
+ min-height: 1.2em;
2669
+ padding: 1px 4px;
2670
+ margin: -1px -4px;
2671
+ border-radius: 4px;
2672
+ cursor: pointer;
2673
+ }
2674
+
2675
+ .value-text:hover {
2676
+ background: var(--mjtb-node-bg);
2677
+ }
2678
+
2679
+ [tabindex="0"]:focus-visible {
2680
+ outline: 2px solid var(--mjtb-accent);
2681
+ outline-offset: 2px;
2682
+ border-radius: 4px;
2683
+ }
2684
+
2685
+ .bool-toggle {
2686
+ font: inherit;
2687
+ line-height: 1;
2688
+ padding: 3px 7px;
2689
+ border-radius: 4px;
2690
+ border: 1px solid var(--mjtb-node-border);
2691
+ background: var(--mjtb-bg);
2692
+ color: inherit;
2693
+ cursor: pointer;
2694
+ }
2695
+
2696
+ .bool-toggle:hover {
2697
+ border-color: var(--mjtb-accent);
2698
+ }
2699
+
2700
+ /*
2701
+ * Every slot/node exposes exactly one visible affordance — a "⋯" trigger
2702
+ * — rather than a row of individual icon buttons, to keep a deeply
2703
+ * nested tree from turning into a wall of buttons. Everything that used
2704
+ * to be its own button (change type, insert symbol, wrap, remove, ...)
2705
+ * is a labeled item in this one popover instead.
2706
+ */
2707
+ .picker {
2708
+ position: relative;
2709
+ display: inline-block;
2710
+ /* A context menu is UI chrome, not notation content — it must never
2711
+ shrink just because it's nested inside a scaled-down exponent/
2712
+ degree/reducer-symbol (or several, compounded). Resetting the size
2713
+ here, not just at those individual rules, keeps it correct no
2714
+ matter what scaling exists elsewhere now or is added later. */
2715
+ font-size: var(--mjtb-font-size);
2716
+ }
2717
+
2718
+ .picker > summary {
2719
+ list-style: none;
2720
+ cursor: pointer;
2721
+ font: inherit;
2722
+ padding: 3px 7px;
2723
+ border-radius: 4px;
2724
+ border: 1px solid var(--mjtb-node-border);
2725
+ background: var(--mjtb-bg);
2726
+ }
2727
+
2728
+ .picker > summary::-webkit-details-marker {
2729
+ display: none;
2730
+ }
2731
+
2732
+ .picker .popover {
2733
+ position: absolute;
2734
+ top: calc(100% + 4px);
2735
+ left: 0;
2736
+ z-index: 10;
2737
+ display: block;
2738
+ background: var(--mjtb-bg);
2739
+ border: 1px solid var(--mjtb-node-border);
2740
+ border-radius: 4px;
2741
+ padding: 4px;
2742
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
2743
+ }
2744
+
2745
+ /*
2746
+ * The construct-level menu opens the instant its node activates (see
2747
+ * #customMenu), so — unlike the leaf menu — it has no click-to-open
2748
+ * trigger left to show. Hiding the summary and giving up this
2749
+ * element's own position: relative (falling back to .node.construct's,
2750
+ * set above) means .popover anchors to the whole node's own box: it
2751
+ * collapses to zero size (an empty inline-block with an
2752
+ * absolutely-positioned-only child needs no help from display:contents
2753
+ * to do that) and the menu appears directly under whatever you
2754
+ * actually clicked, not trailing off after it.
2755
+ */
2756
+ .picker.construct-menu {
2757
+ position: static;
2758
+ }
2759
+
2760
+ .picker.construct-menu > summary {
2761
+ display: none;
2762
+ }
2763
+
2764
+ /* Centered under the whole node rather than left-aligned to it — for a
2765
+ long infix/comparison chain, the click that opened this could have
2766
+ landed anywhere along the line, so centering under the full node
2767
+ reads as closer to "under what you clicked" than always jumping to
2768
+ the line's start would. */
2769
+ .picker.construct-menu .popover {
2770
+ left: 50%;
2771
+ transform: translateX(-50%);
2772
+ }
2773
+
2774
+ .menu-popover {
2775
+ display: flex;
2776
+ flex-direction: column;
2777
+ gap: 1px;
2778
+ min-width: 160px;
2779
+ }
2780
+
2781
+ .menu-item {
2782
+ display: block;
2783
+ width: 100%;
2784
+ text-align: left;
2785
+ font: inherit;
2786
+ padding: 6px 8px;
2787
+ border: none;
2788
+ border-radius: 4px;
2789
+ background: none;
2790
+ color: inherit;
2791
+ cursor: pointer;
2792
+ }
2793
+
2794
+ .menu-item:hover {
2795
+ background: var(--mjtb-node-bg);
2796
+ }
2797
+
2798
+ .menu-item.danger {
2799
+ color: var(--mjtb-danger);
2800
+ }
2801
+
2802
+ /* Non-clickable: identifies which node this menu belongs to. */
2803
+ .menu-header {
2804
+ padding: 4px 8px 6px;
2805
+ margin-bottom: 2px;
2806
+ border-bottom: 1px solid var(--mjtb-node-border);
2807
+ font-size: 0.75em;
2808
+ font-weight: 600;
2809
+ text-transform: uppercase;
2810
+ letter-spacing: 0.02em;
2811
+ opacity: 0.6;
2812
+ cursor: default;
2813
+ user-select: none;
2814
+ white-space: nowrap;
2815
+ }
2816
+
2817
+ /* A submenu is a menu item that expands into its own search popover. */
2818
+ .submenu {
2819
+ position: relative;
2820
+ }
2821
+
2822
+ .submenu > summary {
2823
+ list-style: none;
2824
+ cursor: pointer;
2825
+ font: inherit;
2826
+ display: block;
2827
+ padding: 6px 8px;
2828
+ border-radius: 4px;
2829
+ }
2830
+
2831
+ .submenu > summary::-webkit-details-marker {
2832
+ display: none;
2833
+ }
2834
+
2835
+ .submenu > summary:hover {
2836
+ background: var(--mjtb-node-bg);
2837
+ }
2838
+
2839
+ .submenu .popover {
2840
+ top: 0;
2841
+ left: calc(100% + 4px);
2842
+ }
2843
+
2844
+ /* "Change operator…" (swapTargets): a small known set, so a flat grid of
2845
+ symbol/short-text buttons beats a searchable picker. For the
2846
+ comparison/membership/subset group, "In range…"/"Not in range…"
2847
+ (structural conversions, not plain renames) stack below the grid as
2848
+ regular full-width menu items instead. */
2849
+ .operator-menu {
2850
+ display: flex;
2851
+ flex-direction: column;
2852
+ gap: 6px;
2853
+ }
2854
+
2855
+ .operator-grid {
2856
+ display: flex;
2857
+ flex-wrap: wrap;
2858
+ gap: 4px;
2859
+ width: 11em;
2860
+ }
2861
+
2862
+ .operator-btn {
2863
+ flex: 1 0 calc(33% - 4px);
2864
+ font: inherit;
2865
+ font-size: 1.1em;
2866
+ line-height: 1;
2867
+ padding: 4px 8px;
2868
+ border-radius: 4px;
2869
+ border: 1px solid var(--mjtb-node-border);
2870
+ background: var(--mjtb-bg);
2871
+ color: inherit;
2872
+ cursor: pointer;
2873
+ white-space: nowrap;
2874
+ }
2875
+
2876
+ .operator-btn:hover {
2877
+ border-color: var(--mjtb-accent);
2878
+ }
2879
+
2880
+ /* --- notation --- */
2881
+
2882
+ .infix-row {
2883
+ display: inline-flex;
2884
+ align-items: center;
2885
+ gap: 6px;
2886
+ flex-wrap: wrap;
2887
+ }
2888
+
2889
+ .infix-stacked {
2890
+ display: inline-flex;
2891
+ flex-direction: column;
2892
+ align-items: flex-start;
2893
+ gap: 4px;
2894
+ }
2895
+
2896
+ .infix-stacked-row {
2897
+ display: inline-flex;
2898
+ align-items: center;
2899
+ gap: 6px;
2900
+ }
2901
+
2902
+ .op {
2903
+ opacity: 0.75;
2904
+ padding: 0 2px;
2905
+ }
2906
+
2907
+ .reducer-symbol {
2908
+ /* Anchored to the fixed component base, not em off the current
2909
+ (possibly already-scaled) context - a reducer nested inside another
2910
+ reducer (or an exponent, or several) must not keep compounding
2911
+ bigger/smaller each level. Same reasoning throughout this file
2912
+ wherever notation scales a nested subtree: .power-exp,
2913
+ .radical-degree. */
2914
+ font-size: calc(var(--mjtb-font-size) * 1.3);
2915
+ font-weight: 600;
2916
+ margin-right: 2px;
2917
+ }
2918
+
2919
+ .comma {
2920
+ opacity: 0.6;
2921
+ }
2922
+
2923
+ .frac {
2924
+ display: inline-grid;
2925
+ grid-template-rows: auto auto auto;
2926
+ justify-items: center;
2927
+ vertical-align: middle;
2928
+ padding: 2px 4px;
2929
+ }
2930
+ .frac-line {
2931
+ width: 100%;
2932
+ border-bottom: 1.5px solid currentColor;
2933
+ margin: 2px 0;
2934
+ }
2935
+
2936
+ /*
2937
+ * Real flex top-alignment, not a transform: .power-base and .power-exp
2938
+ * start from the same top edge, and the exponent's smaller font-size
2939
+ * alone makes it read as raised - no extra shift needed. This matters
2940
+ * for two things a transform gets wrong: (1) a transform repositions
2941
+ * pixels without resizing the box, so an ancestor (e.g. a fraction's
2942
+ * denominator row) wouldn't grow to fit a raised exponent and it could
2943
+ * visually cross above the dividing line; (2) flex-start aligns to the
2944
+ * TOP of whichever sibling is tallest, so a compound, parenthesized,
2945
+ * multi-line base (e.g. (1/2)^2) still gets its exponent placed at the
2946
+ * base's top-right, not vertically centered against it. Do not add
2947
+ * vertical-align here instead: .power-base is itself a flex container
2948
+ * (for the stretchy parens below) whose first child is an empty
2949
+ * decorative span, and flexbox synthesizes a container's baseline from
2950
+ * its first item's margin edge when that item has no real one - here
2951
+ * that's the *bottom* of the stretched paren, so vertical-align would
2952
+ * raise the exponent relative to the wrong (bottom-anchored) baseline
2953
+ * and it would barely lift off the bottom at all.
2954
+ */
2955
+ .power-frame {
2956
+ display: inline-flex;
2957
+ align-items: flex-start;
2958
+ }
2959
+
2960
+ .power-exp {
2961
+ /* calc() off the fixed base, not em off the parent - see the
2962
+ .reducer-symbol comment above. Without this, nesting Power inside
2963
+ its own exponent a few times shrinks the text (and the menu
2964
+ inside it, before the .picker fix above) to unreadable. */
2965
+ font-size: calc(var(--mjtb-font-size) * 0.7);
2966
+ }
2967
+
2968
+ /*
2969
+ * Marks the boundary of a compound base, e.g. (x+y)^2 - without this,
2970
+ * a base that's itself a multi-term expression reads ambiguously once
2971
+ * a bare exponent is stacked on top of it. .paren (an inline SVG, see
2972
+ * the PAREN_OPEN/PAREN_CLOSE doc comment in element.ts) is stretched to
2973
+ * the full height of .power-base by that flex container's default
2974
+ * align-items:stretch - a plain text glyph sits at one fixed
2975
+ * line-height and would only ever wrap the *first line* of a tall
2976
+ * base (e.g. a fraction), never visually embracing all of it.
2977
+ */
2978
+ .power-base {
2979
+ display: inline-flex;
2980
+ align-items: stretch;
2981
+ }
2982
+
2983
+ .paren {
2984
+ width: 0.3em;
2985
+ overflow: visible;
2986
+ opacity: 0.7;
2987
+ }
2988
+
2989
+ .paren path {
2990
+ fill: none;
2991
+ stroke: currentColor;
2992
+ stroke-width: 1.6;
2993
+ stroke-linecap: round;
2994
+ vector-effect: non-scaling-stroke;
2995
+ }
2996
+
2997
+ /*
2998
+ * A dedicated span, not the outer "node construct radical" element
2999
+ * itself: .node.construct's own align-items: center (two classes)
3000
+ * would otherwise beat this rule's align-items: stretch (one class)
3001
+ * in the cascade no matter the source order, same as .power-base.
3002
+ *
3003
+ * align-items: stretch (not flex-end, as this used to be): the hook's
3004
+ * SVG needs to be told to actually fill the row's full height — same
3005
+ * reasoning as .power-base above. Without it, a tall radicand (e.g.
3006
+ * one containing a fraction) grows past a hook that stayed pinned to
3007
+ * one fixed line-height, exactly the "broken roots" this replaced.
3008
+ */
3009
+ .radical-frame {
3010
+ display: inline-flex;
3011
+ align-items: stretch;
3012
+ }
3013
+
3014
+ .radical-degree {
3015
+ /* Stays pinned near the top notch regardless of how tall the row
3016
+ stretches — real typesetting keeps the degree small and near the
3017
+ top no matter how large the radicand is, it never scales with it. */
3018
+ align-self: flex-start;
3019
+ font-size: calc(var(--mjtb-font-size) * 0.65);
3020
+ margin-right: -0.15em;
3021
+ position: relative;
3022
+ top: -0.15em;
3023
+ }
3024
+
3025
+ .radical-hook {
3026
+ width: 0.5em;
3027
+ overflow: visible;
3028
+ flex-shrink: 0;
3029
+ }
3030
+
3031
+ .radical-hook path {
3032
+ fill: none;
3033
+ stroke: currentColor;
3034
+ stroke-width: 1.6;
3035
+ stroke-linecap: round;
3036
+ stroke-linejoin: round;
3037
+ vector-effect: non-scaling-stroke;
3038
+ }
3039
+
3040
+ .radical-sign {
3041
+ /* Flush against the hook's top-right point (see ROOT_HOOK's own
3042
+ comment) so the vinculum reads as one continuous line, not two
3043
+ disconnected pieces. A little padding-top, though, so the radicand
3044
+ itself doesn't touch the vinculum — same reason a fraction bar
3045
+ doesn't sit flush against its numerator. */
3046
+ border-top: 1.5px solid currentColor;
3047
+ padding: 2px 3px 0 2px;
3048
+ }
3049
+
3050
+ .comparison {
3051
+ display: inline-flex;
3052
+ align-items: center;
3053
+ gap: 6px;
3054
+ }
3055
+ `;
3056
+ //#endregion
3057
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
3058
+ function X(e, t, n, r) {
3059
+ var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
3060
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
3061
+ else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
3062
+ return i > 3 && a && Object.defineProperty(t, n, a), a;
3063
+ }
3064
+ //#endregion
3065
+ //#region src/element.ts
3066
+ var Z = (e) => e.length ? e.join(".") : "root", et = {
3067
+ number: "Number",
3068
+ boolean: "Boolean",
3069
+ text: "Text",
3070
+ symbol: "Symbol"
3071
+ }, tt = O`<svg class="paren" viewBox="0 0 10 100" preserveAspectRatio="none" aria-hidden="true">
3072
+ <path d="M 7,3 Q 1,50 7,97" />
3073
+ </svg>`, nt = O`<svg class="paren" viewBox="0 0 10 100" preserveAspectRatio="none" aria-hidden="true">
3074
+ <path d="M 3,3 Q 9,50 3,97" />
3075
+ </svg>`, rt = O`<svg class="radical-hook" viewBox="0 0 20 100" preserveAspectRatio="none" aria-hidden="true">
3076
+ <path d="M 0,55 L 6,97 L 19,3" />
3077
+ </svg>`;
3078
+ function it(e) {
3079
+ let t = new Set(e.map((e) => Array.isArray(e) && typeof e[0] == "string" ? e[0] : null).filter((e) => e !== null));
3080
+ if (!t.has("constant")) return "constant";
3081
+ let n = 2;
3082
+ for (; t.has(`constant_${n}`);) n++;
3083
+ return `constant_${n}`;
3084
+ }
3085
+ function at(e) {
3086
+ return !Array.isArray(e) || e.length > 0 && typeof e[0] == "string" && q(e[0]) !== void 0;
3087
+ }
3088
+ function Q(e) {
3089
+ let t = e;
3090
+ for (; t;) t instanceof HTMLDetailsElement && (t.open = !1), t = t.parentElement;
3091
+ }
3092
+ var $ = class extends L {
3093
+ constructor(...e) {
3094
+ super(...e), this.value = 0, this.symbols = [], this.blacklist = [], this.inlineToStackedThreshold = 3, this.activePath = null, this.jsonMode = !1, this.jsonDraft = "", this.jsonError = null, this.expandedConstants = /* @__PURE__ */ new Set(), this.#i = (e) => {
3095
+ let t = e.target.closest("[data-path]");
3096
+ t && (this.activePath = t.dataset.path ?? null);
3097
+ }, this.#a = (e) => {
3098
+ e.key === "Escape" && this.activePath && (this.activePath = null, (this.shadowRoot?.activeElement)?.blur());
3099
+ }, this.#o = (e) => {
3100
+ this.activePath && !e.composedPath().includes(this) && (this.activePath = null);
3101
+ };
3102
+ }
3103
+ static {
3104
+ this.styles = $e;
3105
+ }
3106
+ #e(e) {
3107
+ let t = new Set(this.expandedConstants);
3108
+ t.has(e) ? t.delete(e) : t.add(e), this.expandedConstants = t;
3109
+ }
3110
+ #t(e, t) {
3111
+ this.value = U(this.value, e, t), this.#n();
3112
+ }
3113
+ #n() {
3114
+ this.dispatchEvent(new CustomEvent("change", {
3115
+ detail: { value: this.value },
3116
+ bubbles: !0,
3117
+ composed: !0
3118
+ }));
3119
+ }
3120
+ #r(e) {
3121
+ this.activePath = null;
3122
+ let t = e.slice(0, -1), n = e[e.length - 1], r = H(this.value, t);
3123
+ this.#t(t, Ae(r, n));
3124
+ }
3125
+ #i;
3126
+ #a;
3127
+ #o;
3128
+ connectedCallback() {
3129
+ super.connectedCallback(), document.addEventListener("click", this.#o);
3130
+ }
3131
+ disconnectedCallback() {
3132
+ document.removeEventListener("click", this.#o), super.disconnectedCallback();
3133
+ }
3134
+ updated(e) {
3135
+ if (!e.has("activePath") || !this.activePath) return;
3136
+ let t = this.shadowRoot?.querySelector(".slot-leaf.active > input[type=\"number\"], .slot-leaf.active > input[type=\"text\"], .slot-leaf.active > select");
3137
+ t && this.shadowRoot?.activeElement !== t && (t.focus(), t instanceof HTMLInputElement && t.select());
3138
+ }
3139
+ #s() {
3140
+ if (this.jsonMode) {
3141
+ if (this.jsonError) return;
3142
+ this.jsonMode = !1;
3143
+ return;
3144
+ }
3145
+ this.activePath = null, this.jsonDraft = JSON.stringify(this.value, null, 2), this.jsonError = null, this.jsonMode = !0;
3146
+ }
3147
+ #c(e) {
3148
+ this.jsonDraft = e;
3149
+ let t;
3150
+ try {
3151
+ t = JSON.parse(e);
3152
+ } catch (e) {
3153
+ this.jsonError = e instanceof Error ? e.message : "Invalid JSON";
3154
+ return;
3155
+ }
3156
+ if (!V(t)) {
3157
+ this.jsonError = "Not a valid MathJSON expression — expected a number, boolean, string, or array.";
3158
+ return;
3159
+ }
3160
+ this.jsonError = null, this.value = t, this.#n();
3161
+ }
3162
+ #l() {
3163
+ return O`<div class="json-view">
3164
+ <textarea
3165
+ class="json-textarea"
3166
+ spellcheck="false"
3167
+ .value=${this.jsonDraft}
3168
+ @input=${(e) => this.#c(e.currentTarget.value)}
3169
+ ></textarea>
3170
+ ${this.jsonError ? O`<div class="json-error">${this.jsonError}</div>` : A}
3171
+ </div>`;
3172
+ }
3173
+ render() {
3174
+ return O`<div class="mjtb-toolbar">
3175
+ <button class="mode-toggle" ?disabled=${this.jsonMode && !!this.jsonError} @click=${() => this.#s()}>
3176
+ ${this.jsonMode ? "Tree view" : "JSON view"}
3177
+ </button>
3178
+ ${this.jsonMode && this.jsonError ? O`<span class="json-error-hint">Fix the error below to switch back</span>` : A}
3179
+ </div>
3180
+ ${this.jsonMode ? this.#l() : O`<div class="mjtb-root" @focusin=${this.#i} @keydown=${this.#a}>
3181
+ ${this.#u(this.value, [], void 0, !1)}
3182
+ </div>`}`;
3183
+ }
3184
+ #u(e, t, n, r) {
3185
+ let i = Pe(e, this.symbols), a = Z(t), o = this.activePath === a;
3186
+ if (i === "function") return O`<span class="slot slot-function">
3187
+ ${n ? O`<span class="arg-label">${n}</span>` : A}
3188
+ ${this.#p(e, t, r)}
3189
+ </span>`;
3190
+ if (i === "symbol") {
3191
+ let s = G(this.symbols, e);
3192
+ return o ? O`<span class="slot slot-leaf active" data-kind="symbol" data-path=${a}>
3193
+ ${n ? O`<span class="arg-label">${n}</span>` : A}
3194
+ <select
3195
+ class="symbol-select"
3196
+ @change=${(e) => this.#t(t, e.currentTarget.value)}
3197
+ >
3198
+ ${this.symbols.map((e) => O`<option value=${e.id} ?selected=${e.id === s.id}>${e.label}</option>`)}
3199
+ </select>
3200
+ ${this.#d(t, i, r)}
3201
+ </span>` : O`<span class="slot slot-leaf" data-kind="symbol" data-path=${a}>
3202
+ ${n ? O`<span class="arg-label">${n}</span>` : A}
3203
+ <span class="symbol-chip" tabindex="0" title=${s.id}>${s.label}</span>
3204
+ </span>`;
3205
+ }
3206
+ if (!o) {
3207
+ let t = i === "number" ? String(e) : i === "boolean" ? e ? "true" : "false" : e;
3208
+ return O`<span class="slot slot-leaf" data-kind=${i} data-path=${a}>
3209
+ ${n ? O`<span class="arg-label">${n}</span>` : A}
3210
+ <span class="value-text" tabindex="0">${t || A}</span>
3211
+ </span>`;
3212
+ }
3213
+ let s;
3214
+ return s = i === "number" ? O`<input
3215
+ type="number"
3216
+ .valueAsNumber=${e}
3217
+ @change=${(e) => this.#t(t, e.currentTarget.valueAsNumber)}
3218
+ />` : i === "boolean" ? O`<button
3219
+ class="bool-toggle"
3220
+ @click=${() => this.#t(t, !e)}
3221
+ >
3222
+ ${e ? "true" : "false"}
3223
+ </button>` : O`<input
3224
+ type="text"
3225
+ .value=${e}
3226
+ @change=${(e) => this.#t(t, e.currentTarget.value)}
3227
+ />`, O`<span class="slot slot-leaf active" data-kind=${i} data-path=${a}>
3228
+ ${n ? O`<span class="arg-label">${n}</span>` : A}
3229
+ ${s}
3230
+ ${this.#d(t, i, r)}
3231
+ </span>`;
3232
+ }
3233
+ #d(e, t, n) {
3234
+ let r = t === "symbol" ? O`<button
3235
+ class="menu-item"
3236
+ @click=${(t) => {
3237
+ this.#t(e, ""), Q(t.currentTarget);
3238
+ }}
3239
+ >
3240
+ Convert to literal
3241
+ </button>` : O`<button
3242
+ class="menu-item"
3243
+ @click=${(n) => {
3244
+ this.#f(e, t), Q(n.currentTarget);
3245
+ }}
3246
+ >
3247
+ Change type
3248
+ </button>`;
3249
+ return O`<details class="picker menu" @click=${(e) => e.stopPropagation()}>
3250
+ <summary title="Actions">&hellip;</summary>
3251
+ <div class="popover menu-popover">
3252
+ <div class="menu-header">${et[t]}</div>
3253
+ ${r}
3254
+ ${this.symbols.length ? this.#N(e) : A}
3255
+ ${this.#P(e)}
3256
+ ${this.#F(e)}
3257
+ ${n ? O`<button
3258
+ class="menu-item danger"
3259
+ @click=${(t) => {
3260
+ this.#r(e), Q(t.currentTarget);
3261
+ }}
3262
+ >
3263
+ Remove
3264
+ </button>` : A}
3265
+ </div>
3266
+ </details>`;
3267
+ }
3268
+ #f(e, t) {
3269
+ let n = [
3270
+ "number",
3271
+ "text",
3272
+ "boolean"
3273
+ ], r = n[(n.indexOf(t) + 1) % n.length], i = r === "number" ? 0 : r !== "text" || "";
3274
+ this.#t(e, i);
3275
+ }
3276
+ #p(e, t, n) {
3277
+ let r = e[0];
3278
+ if (r === "Constants" && e.length >= 2) return this.#h(e, t, n);
3279
+ if (r === "If" && e.length >= 3) return this.#v(e, t, n);
3280
+ let i = Je(r);
3281
+ return i && Qe(r, i, e) ? this.#S(r, i, e, t, n) : this.#m(r, e, t, n);
3282
+ }
3283
+ #m(e, t, n, r) {
3284
+ let i = q(e), a = t.slice(1), o = Xe(e), s = i?.args?.at(-1)?.variadic ?? !1, c = !o || a.length < o.max ? () => this.#t(n, W(t, 0)) : void 0, l = (e) => o ? a.length <= o.min ? !1 : s || e === a.length - 1 : !0, u = Z(n), d = this.activePath === u;
3285
+ return O`<span class="node construct generic" tabindex="0" data-path=${u}>
3286
+ <span class="construct-header">
3287
+ <span class="construct-name">${e}</span>
3288
+ ${i ? O`<span class="construct-category">${Ye(i.category)}</span>` : A}
3289
+ ${d ? this.#A(e, n, r, c) : A}
3290
+ </span>
3291
+ <span class="construct-args">
3292
+ ${a.map((e, t) => this.#u(e, [...n, t + 1], i?.args?.[t]?.label, l(t)))}
3293
+ </span>
3294
+ </span>`;
3295
+ }
3296
+ #h(e, t, n) {
3297
+ let r = e.slice(1, -1), i = e.length - 1, a = e[i], o = () => {
3298
+ let n = it(r);
3299
+ this.#t(t, [
3300
+ ...e.slice(0, -1),
3301
+ [n, 0],
3302
+ e[i]
3303
+ ]);
3304
+ }, s = Z(t);
3305
+ return O`<span class="node construct generic constants" tabindex="0" data-path=${s}>
3306
+ <span class="construct-header">
3307
+ <span class="construct-name">Constants</span>
3308
+ ${this.activePath === s ? this.#A("Constants", t, n, o, "Add constant") : A}
3309
+ </span>
3310
+ <span class="constants-bindings">
3311
+ ${r.map((e, n) => this.#g(e, [...t, n + 1]))}
3312
+ </span>
3313
+ <span class="constants-final">
3314
+ <span class="arg-label">result</span>
3315
+ ${this.#u(a, [...t, i], void 0, !1)}
3316
+ </span>
3317
+ </span>`;
3318
+ }
3319
+ #g(e, t) {
3320
+ if (!Array.isArray(e) || e.length !== 2 || typeof e[0] != "string") return this.#u(e, t, void 0, !0);
3321
+ let [n, r] = e, i = [...t, 0], a = [...t, 1], o = Z(t), s = !this.expandedConstants.has(o);
3322
+ return O`<span class="constant-card">
3323
+ <span class="constant-header">
3324
+ <button
3325
+ class="fold-toggle"
3326
+ title=${s ? "Expand" : "Collapse"}
3327
+ @click=${() => this.#e(o)}
3328
+ >
3329
+ ${s ? "▸" : "▾"}
3330
+ </button>
3331
+ ${this.#_(n, i)}
3332
+ <button
3333
+ class="small-remove"
3334
+ title="Remove this constant"
3335
+ @click=${() => this.#r(t)}
3336
+ >
3337
+ &times;
3338
+ </button>
3339
+ </span>
3340
+ ${s ? A : O`<span class="constant-value">${this.#u(r, a, void 0, !1)}</span>`}
3341
+ </span>`;
3342
+ }
3343
+ #_(e, t) {
3344
+ let n = Z(t);
3345
+ return this.activePath === n ? O`<span class="slot slot-leaf active constant-name" data-path=${n}>
3346
+ <input
3347
+ type="text"
3348
+ .value=${e}
3349
+ @change=${(e) => this.#t(t, e.currentTarget.value)}
3350
+ />
3351
+ </span>` : O`<span class="slot slot-leaf constant-name" data-path=${n}>
3352
+ <span class="value-text" tabindex="0">${e}</span>
3353
+ </span>`;
3354
+ }
3355
+ #v(e, t, n) {
3356
+ return at(e[1]) ? this.#y(e, t, n) : this.#b(e, t, n);
3357
+ }
3358
+ #y(e, t, n) {
3359
+ let r = e.length === 4, i = [r ? A : O`<button
3360
+ class="menu-item"
3361
+ @click=${(n) => {
3362
+ this.#t(t, W(e, 0)), Q(n.currentTarget);
3363
+ }}
3364
+ >
3365
+ Add else
3366
+ </button>`, O`<button
3367
+ class="menu-item"
3368
+ @click=${(n) => {
3369
+ let i = e[1], a = e[2], o = r ? e[3] : 0;
3370
+ this.#t(t, [
3371
+ "If",
3372
+ [i, a],
3373
+ [!0, 0],
3374
+ o
3375
+ ]), Q(n.currentTarget);
3376
+ }}
3377
+ >
3378
+ Add elseif
3379
+ </button>`], a = Z(t);
3380
+ return O`<span class="node construct generic if-block" tabindex="0" data-path=${a}>
3381
+ <span class="construct-header">
3382
+ <span class="construct-name">If</span>
3383
+ ${this.activePath === a ? this.#j("If", t, n, i) : A}
3384
+ </span>
3385
+ <span class="if-branches">
3386
+ <span class="if-row">
3387
+ <span class="if-keyword">if</span>
3388
+ ${this.#u(e[1], [...t, 1], void 0, !1)}
3389
+ </span>
3390
+ <span class="if-row">
3391
+ <span class="if-keyword">then</span>
3392
+ ${this.#u(e[2], [...t, 2], void 0, !1)}
3393
+ </span>
3394
+ ${r ? O`<span class="if-row">
3395
+ <span class="if-keyword">else</span>
3396
+ ${this.#u(e[3], [...t, 3], void 0, !0)}
3397
+ </span>` : A}
3398
+ </span>
3399
+ </span>`;
3400
+ }
3401
+ #b(e, t, n) {
3402
+ let r = e.slice(1, -1), i = e.length - 1, a = r.length > 1, o = [O`<button
3403
+ class="menu-item"
3404
+ @click=${(n) => {
3405
+ this.#t(t, [
3406
+ ...e.slice(0, -1),
3407
+ [!0, 0],
3408
+ e[i]
3409
+ ]), Q(n.currentTarget);
3410
+ }}
3411
+ >
3412
+ Add elseif
3413
+ </button>`], s = Z(t);
3414
+ return O`<span class="node construct generic if-block" tabindex="0" data-path=${s}>
3415
+ <span class="construct-header">
3416
+ <span class="construct-name">If</span>
3417
+ ${this.activePath === s ? this.#j("If", t, n, o) : A}
3418
+ </span>
3419
+ <span class="if-branches">
3420
+ ${r.map((e, n) => this.#x(e, [...t, n + 1], n === 0, a))}
3421
+ <span class="if-row">
3422
+ <span class="if-keyword">else</span>
3423
+ ${this.#u(e[i], [...t, i], void 0, !1)}
3424
+ </span>
3425
+ </span>
3426
+ </span>`;
3427
+ }
3428
+ #x(e, t, n, r) {
3429
+ if (!Array.isArray(e) || e.length !== 2) return O`<span class="if-row">${this.#u(e, t, void 0, r)}</span>`;
3430
+ let [i, a] = e;
3431
+ return O`<span class="if-row">
3432
+ <span class="if-keyword">${n ? "if" : "else if"}</span>
3433
+ ${this.#u(i, [...t, 0], void 0, !1)}
3434
+ <span class="if-keyword">then</span>
3435
+ ${this.#u(a, [...t, 1], void 0, !1)}
3436
+ ${r ? O`<button
3437
+ class="small-remove"
3438
+ title="Remove this branch"
3439
+ @click=${() => this.#r(t)}
3440
+ >
3441
+ &times;
3442
+ </button>` : A}
3443
+ </span>`;
3444
+ }
3445
+ #S(e, t, n, r, i) {
3446
+ switch (t.kind) {
3447
+ case "infix": return this.#C(e, t, n, r, i);
3448
+ case "fraction": return this.#w(e, n, r, i);
3449
+ case "power": return this.#T(e, n, r, i);
3450
+ case "sqrt":
3451
+ case "root": return this.#E(e, n, r, i);
3452
+ case "reducer": return this.#D(e, t, n, r, i);
3453
+ case "comparison": return this.#O(e, t, n, r, i);
3454
+ case "array": return this.#k(e, n, r, i);
3455
+ }
3456
+ }
3457
+ #C(e, t, n, r, i) {
3458
+ let a = n.slice(1), o = typeof a[0] == "boolean", s = () => this.#t(r, W(n, o ? !0 : 0)), c = a.length > 2, l = Z(r), u = this.activePath === l, d = (e === "And" || e === "Or") && a.length > this.inlineToStackedThreshold, f = a.map((e, n) => O`
3459
+ ${n > 0 ? O`<span class="op">${t.symbol}</span>` : A}
3460
+ ${this.#u(e, [...r, n + 1], void 0, c)}
3461
+ `);
3462
+ return O`<span class="node construct infix" tabindex="0" data-path=${l}>
3463
+ <span class="${d ? "infix-stacked" : "infix-row"}">
3464
+ ${d ? f.map((e) => O`<span class="infix-stacked-row">${e}</span>`) : f}
3465
+ </span>
3466
+ ${u ? this.#A(e, r, i, s) : A}
3467
+ </span>`;
3468
+ }
3469
+ #w(e, t, n, r) {
3470
+ let i = Z(n), a = this.activePath === i;
3471
+ return O`<span class="node construct fraction" tabindex="0" data-path=${i}>
3472
+ <span class="frac">
3473
+ <span class="frac-num">${this.#u(t[1], [...n, 1], void 0, !1)}</span>
3474
+ <span class="frac-line"></span>
3475
+ <span class="frac-den">${this.#u(t[2], [...n, 2], void 0, !1)}</span>
3476
+ </span>
3477
+ ${a ? this.#A(e, n, r, void 0) : A}
3478
+ </span>`;
3479
+ }
3480
+ #T(e, t, n, r) {
3481
+ let i = e === "Square", a = t[1], o = B(a), s = Z(n), c = this.activePath === s;
3482
+ return O`<span class="node construct power" tabindex="0" data-path=${s}>
3483
+ <span class="power-frame">
3484
+ <span class="power-base">
3485
+ ${o ? tt : A}${this.#u(a, [...n, 1], void 0, !1)}${o ? nt : A}
3486
+ </span>
3487
+ <span class="power-exp">
3488
+ ${i ? O`<span class="literal-exp">2</span>` : this.#u(t[2], [...n, 2], void 0, !1)}
3489
+ </span>
3490
+ </span>
3491
+ ${c ? this.#A(e, n, r, void 0) : A}
3492
+ </span>`;
3493
+ }
3494
+ #E(e, t, n, r) {
3495
+ let i = e === "Root", a = Z(n), o = this.activePath === a;
3496
+ return O`<span class="node construct radical" tabindex="0" data-path=${a}>
3497
+ <span class="radical-frame">
3498
+ ${i ? O`<span class="radical-degree">${this.#u(t[2], [...n, 2], void 0, !1)}</span>` : A}
3499
+ ${rt}
3500
+ <span class="radical-sign">
3501
+ <span class="radicand">${this.#u(t[1], [...n, 1], void 0, !1)}</span>
3502
+ </span>
3503
+ </span>
3504
+ ${o ? this.#A(e, n, r, void 0) : A}
3505
+ </span>`;
3506
+ }
3507
+ #D(e, t, n, r, i) {
3508
+ let a = n[1], o = a !== void 0 && B(a) && a[0] === "Array", s = o ? [...r, 1] : r, c = o ? n[1] : n, l = c.slice(1), u = () => this.#t(s, W(c, 0)), d = l.length > +!o, f = Z(r), ee = this.activePath === f;
3509
+ return O`<span class="node construct reducer" tabindex="0" data-path=${f}>
3510
+ <span class="reducer-symbol">${t.symbol}</span>(<span class="reducer-args">
3511
+ ${l.map((e, t) => O`
3512
+ ${t > 0 ? O`<span class="comma">, </span>` : A}
3513
+ ${this.#u(e, [...s, t + 1], void 0, d)}
3514
+ `)}
3515
+ </span>)
3516
+ ${ee ? this.#A(e, r, i, u) : A}
3517
+ </span>`;
3518
+ }
3519
+ #O(e, t, n, r, i) {
3520
+ let a = Z(r), o = this.activePath === a;
3521
+ return O`<span class="node construct comparison" tabindex="0" data-path=${a}>
3522
+ ${this.#u(n[1], [...r, 1], void 0, !1)}
3523
+ <span class="op">${t.symbol}</span>
3524
+ ${this.#u(n[2], [...r, 2], void 0, !1)}
3525
+ ${o ? this.#A(e, r, i, void 0) : A}
3526
+ </span>`;
3527
+ }
3528
+ #k(e, t, n, r) {
3529
+ let i = t.slice(1), a = () => this.#t(n, W(t, 0)), o = Z(n), s = this.activePath === o;
3530
+ return O`<span class="node construct array-list" tabindex="0" data-path=${o}
3531
+ >(<span class="list-elements">
3532
+ ${i.map((e, t) => O`
3533
+ ${t > 0 ? O`<span class="comma">, </span>` : A}
3534
+ ${this.#u(e, [...n, t + 1], void 0, !0)}
3535
+ `)}
3536
+ </span>)${s ? this.#A(e, n, r, a) : A}
3537
+ </span>`;
3538
+ }
3539
+ #A(e, t, n, r, i = "Add argument") {
3540
+ let a = r ? [O`<button
3541
+ class="menu-item"
3542
+ @click=${(e) => {
3543
+ r(), Q(e.currentTarget);
3544
+ }}
3545
+ >
3546
+ ${i}
3547
+ </button>`] : [];
3548
+ return this.#j(e, t, n, a);
3549
+ }
3550
+ #j(e, t, n, r) {
3551
+ return O`<details class="picker menu construct-menu" open @click=${(e) => e.stopPropagation()}>
3552
+ <summary title="Actions">&hellip;</summary>
3553
+ <div class="popover menu-popover">
3554
+ <div class="menu-header">${J(e)}</div>
3555
+ ${r}
3556
+ ${this.symbols.length ? this.#N(t, "Replace with symbol…") : A}
3557
+ ${this.#P(t)}
3558
+ ${this.#M(e, t)}
3559
+ ${this.#F(t)}
3560
+ ${n ? O`<button
3561
+ class="menu-item danger"
3562
+ @click=${(e) => {
3563
+ this.#r(t), Q(e.currentTarget);
3564
+ }}
3565
+ >
3566
+ Remove
3567
+ </button>` : A}
3568
+ </div>
3569
+ </details>`;
3570
+ }
3571
+ #M(e, t) {
3572
+ let n = Ve(e), r = He(e);
3573
+ if (n.length === 0 && !r) return A;
3574
+ let i = (n, r) => {
3575
+ this.value = Me(this.value, t, r, We(e, r)), this.#n(), Q(n.currentTarget);
3576
+ };
3577
+ return O`<details class="submenu">
3578
+ <summary>Change operator&hellip;</summary>
3579
+ <span class="popover operator-menu">
3580
+ <span class="operator-grid">
3581
+ ${n.map((e) => O`<button
3582
+ class="operator-btn"
3583
+ title=${J(e)}
3584
+ @click=${(t) => i(t, e)}
3585
+ >
3586
+ ${Ge(e)}
3587
+ </button>`)}
3588
+ ${r ? O`
3589
+ <button
3590
+ class="operator-btn"
3591
+ title="Always true"
3592
+ @click=${(e) => {
3593
+ this.#t(t, !0), Q(e.currentTarget);
3594
+ }}
3595
+ >
3596
+ true
3597
+ </button>
3598
+ <button
3599
+ class="operator-btn"
3600
+ title="Always false"
3601
+ @click=${(e) => {
3602
+ this.#t(t, !1), Q(e.currentTarget);
3603
+ }}
3604
+ >
3605
+ false
3606
+ </button>
3607
+ ` : A}
3608
+ </span>
3609
+ ${r ? O`
3610
+ <button
3611
+ class="menu-item"
3612
+ @click=${(e) => {
3613
+ let n = H(this.value, t).slice(1);
3614
+ this.#t(t, [
3615
+ "Element",
3616
+ n[0] ?? 0,
3617
+ [
3618
+ "Interval",
3619
+ n[1] ?? 0,
3620
+ 0
3621
+ ]
3622
+ ]), Q(e.currentTarget);
3623
+ }}
3624
+ >
3625
+ In range&hellip;
3626
+ </button>
3627
+ <button
3628
+ class="menu-item"
3629
+ @click=${(e) => {
3630
+ let n = H(this.value, t).slice(1);
3631
+ this.#t(t, [
3632
+ "NotElement",
3633
+ n[0] ?? 0,
3634
+ [
3635
+ "Interval",
3636
+ n[1] ?? 0,
3637
+ 0
3638
+ ]
3639
+ ]), Q(e.currentTarget);
3640
+ }}
3641
+ >
3642
+ Not in range&hellip;
3643
+ </button>
3644
+ ` : A}
3645
+ </span>
3646
+ </details>`;
3647
+ }
3648
+ #N(e, t = "Insert symbol…") {
3649
+ let n = `mjtb-sym-${Z(e)}`;
3650
+ return O`<details class="submenu">
3651
+ <summary>${t}</summary>
3652
+ <span class="popover">
3653
+ <input
3654
+ type="search"
3655
+ list=${n}
3656
+ placeholder="Symbol…"
3657
+ @change=${(t) => {
3658
+ let n = t.currentTarget, r = this.symbols.find((e) => e.label === n.value);
3659
+ r && this.#t(e, r.id), n.value = "", Q(n);
3660
+ }}
3661
+ />
3662
+ <datalist id=${n}>
3663
+ ${this.symbols.map((e) => O`<option value=${e.label}></option>`)}
3664
+ </datalist>
3665
+ </span>
3666
+ </details>`;
3667
+ }
3668
+ #P(e) {
3669
+ let t = `mjtb-fn-${Z(e)}`;
3670
+ return O`<details class="submenu">
3671
+ <summary>Turn into function&hellip;</summary>
3672
+ <span class="popover">
3673
+ <input
3674
+ type="search"
3675
+ list=${t}
3676
+ placeholder="Function…"
3677
+ @change=${(t) => {
3678
+ let n = t.currentTarget, r = n.value;
3679
+ q(r) && !this.blacklist.includes(r) && this.#t(e, [r, ...Y(r)]), n.value = "", Q(n);
3680
+ }}
3681
+ />
3682
+ <datalist id=${t}>
3683
+ ${Ze("", this.blacklist).map((e) => O`<option value=${e.name}></option>`)}
3684
+ </datalist>
3685
+ </span>
3686
+ </details>`;
3687
+ }
3688
+ #F(e) {
3689
+ let t = `mjtb-wrap-${Z(e)}`;
3690
+ return O`<details class="submenu">
3691
+ <summary>Wrap in&hellip;</summary>
3692
+ <span class="popover">
3693
+ <input
3694
+ type="search"
3695
+ list=${t}
3696
+ placeholder="Wrap in…"
3697
+ @change=${(t) => {
3698
+ let n = t.currentTarget, r = n.value;
3699
+ if (q(r) && !this.blacklist.includes(r)) {
3700
+ let t = Y(r).slice(1);
3701
+ this.value = je(this.value, e, r, t), this.#n();
3702
+ }
3703
+ n.value = "", Q(n);
3704
+ }}
3705
+ />
3706
+ <datalist id=${t}>
3707
+ ${Ze("", this.blacklist).map((e) => O`<option value=${e.name}></option>`)}
3708
+ </datalist>
3709
+ </span>
3710
+ </details>`;
3711
+ }
3712
+ };
3713
+ X([R({ attribute: !1 })], $.prototype, "value", void 0), X([R({ attribute: !1 })], $.prototype, "symbols", void 0), X([R({ attribute: !1 })], $.prototype, "blacklist", void 0), X([R({ attribute: !1 })], $.prototype, "evaluate", void 0), X([R({
3714
+ type: Number,
3715
+ attribute: "inline-to-stacked-threshold"
3716
+ })], $.prototype, "inlineToStackedThreshold", void 0), X([z()], $.prototype, "activePath", void 0), X([z()], $.prototype, "jsonMode", void 0), X([z()], $.prototype, "jsonDraft", void 0), X([z()], $.prototype, "jsonError", void 0), X([z()], $.prototype, "expandedConstants", void 0), customElements.get("mathjson-tree-builder") || customElements.define("mathjson-tree-builder", $);
3717
+ //#endregion
3718
+ export { Fe as CATEGORY_LABELS, $ as MathJsonTreeBuilderElement, qe as allConstructs, Xe as argBounds, Ye as categoryLabel, Y as defaultArgsFor, J as displayName, H as getAtPath, q as getConstruct, Je as getNotation, He as isComparisonLike, B as isCompound, V as isValidMathJson, Ge as operatorGlyph, G as resolveSymbol, Ze as searchConstructs, Ne as searchSymbols, U as setAtPath, We as swapNeedsArgReversal, Me as swapOperator, Ve as swapTargets, W as withArgAdded, Ae as withArgRemoved, je as wrapAtPath };
3719
+
3720
+ //# sourceMappingURL=mathjson-tree-builder.js.map