@burdenoff/fe-libs 2026.1028.4 → 2026.1028.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/shared/assistant/appControls/grammar.d.ts +2 -0
  2. package/dist/shared/assistant/appControls/grammar.js +101 -93
  3. package/dist/shared/assistant/appControls/registry.d.ts +2 -0
  4. package/dist/shared/assistant/appControls/registry.js +20 -12
  5. package/dist/shared/assistant/commandCompletions.d.ts +9 -0
  6. package/dist/shared/assistant/commandCompletions.js +161 -0
  7. package/dist/shared/assistant/index.d.ts +3 -0
  8. package/dist/shared/assistant/localUiCommands.d.ts +16 -0
  9. package/dist/shared/assistant/localUiCommands.js +192 -105
  10. package/dist/shared/assistant/localeCommands/engine.d.ts +6 -0
  11. package/dist/shared/assistant/localeCommands/engine.js +212 -116
  12. package/dist/shared/assistant/ui/AssistantChatArea.js +1491 -1406
  13. package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +8 -0
  14. package/dist/shared/assistant/ui/composer/AssistantComposer.js +142 -131
  15. package/dist/shared/assistant/ui/draftCommandCheck.d.ts +7 -0
  16. package/dist/shared/assistant/ui/draftCommandCheck.js +17 -0
  17. package/dist/shared/assistant/uiActions/backStack.d.ts +1 -0
  18. package/dist/shared/assistant/uiActions/backStack.js +13 -5
  19. package/dist/shared/assistant/uiActions/deixis.d.ts +2 -0
  20. package/dist/shared/assistant/uiActions/deixis.js +12 -1
  21. package/dist/shared/assistant/uiActions/draftPathname.d.ts +13 -0
  22. package/dist/shared/assistant/uiActions/draftPathname.js +31 -0
  23. package/dist/shared/assistant/uiActions/recordNames.js +33 -30
  24. package/dist/shared-assistant.js +329 -326
  25. package/package.json +1 -1
@@ -1,12 +1,13 @@
1
- import { effectiveManifest as e, isEnabled as t } from "./gate.js";
2
- import { foldText as n, foldWords as r } from "./fold.js";
3
- import { closedSlot as i, compileFrame as a, matchFrame as o } from "./frames.js";
4
- import { buildPrep as s, isQuestionText as c, normaliseSaid as l } from "./normalise.js";
5
- import { languageNameMap as u } from "./languageNames.js";
6
- import { LOCALE_TABLES as d, activeCommandLocales as f } from "./active.js";
7
- import { ENGLISH_COMMAND_ADDITIONS as p } from "./tables/en.js";
1
+ import { hasCommandCompletion as e } from "../commandCompletions.js";
2
+ import { effectiveManifest as t, isEnabled as n } from "./gate.js";
3
+ import { foldText as r, foldWords as i } from "./fold.js";
4
+ import { closedSlot as a, compileFrame as o, matchFrame as s } from "./frames.js";
5
+ import { buildPrep as c, isQuestionText as l, normaliseSaid as u } from "./normalise.js";
6
+ import { languageNameMap as d } from "./languageNames.js";
7
+ import { LOCALE_TABLES as f, activeCommandLocales as p } from "./active.js";
8
+ import { ENGLISH_COMMAND_ADDITIONS as m } from "./tables/en.js";
8
9
  //#region src/shared/assistant/localeCommands/engine.ts
9
- var m = {
10
+ var h = {
10
11
  maxLength: 80,
11
12
  courtesy: {
12
13
  prefix: [
@@ -33,38 +34,38 @@ var m = {
33
34
  ],
34
35
  compound: []
35
36
  };
36
- function h(e, t, n) {
37
- let r = { p: i([[e.places, "place"]], n) };
37
+ function g(e, t, n) {
38
+ let r = { p: a([[e.places, "place"]], n) };
38
39
  if (t) {
39
- let { pick: e, controls: a } = t;
40
- r.o = i([...e.ordinals.map((e, t) => [e, t + 1]), [e.last, "last"]], n), r.n = i(e.numbers.map((e, t) => [e, t + 1]), n), r.d = i([[a.directions.asc, "asc"], [a.directions.desc, "desc"]], n);
40
+ let { pick: e, controls: i } = t;
41
+ r.o = a([...e.ordinals.map((e, t) => [e, t + 1]), [e.last, "last"]], n), r.n = a(e.numbers.map((e, t) => [e, t + 1]), n), r.d = a([[i.directions.asc, "asc"], [i.directions.desc, "desc"]], n);
41
42
  }
42
43
  return r;
43
44
  }
44
- var g = /* @__PURE__ */ new Map();
45
- function _(e, t, r, i, o, c) {
46
- let l = g.get(c);
45
+ var _ = /* @__PURE__ */ new Map();
46
+ function v(e, t, n, i, a, s) {
47
+ let l = _.get(s);
47
48
  if (l) return l;
48
- let u = h(t, e, o), d = (e) => e.map((e) => a(e, o, u)), f = (e) => e.map((e) => ({
49
- frame: a(e.template, o, u),
49
+ let u = g(t, e, a), d = (e) => e.map((e) => o(e, a, u)), f = (e) => e.map((e) => ({
50
+ frame: o(e.template, a, u),
50
51
  weak: e.weak === !0
51
- })), p = () => [], m = e?.controls, _ = {
52
- fold: o,
53
- zh: o === "zh",
54
- prep: s(i, o),
52
+ })), p = () => [], m = e?.controls, h = {
53
+ fold: a,
54
+ zh: a === "zh",
55
+ prep: c(i, a),
55
56
  closed: u,
56
57
  goto: {
57
58
  go: d(t.go),
58
59
  open: d(t.open),
59
60
  show: d(t.show)
60
61
  },
61
- ambiguous: new Set(t.ambiguous.map((e) => b(n(e, o), o))),
62
+ ambiguous: new Set(t.ambiguous.map((e) => x(r(e, a), a))),
62
63
  there: d(e?.there ?? []),
63
64
  back: d(e?.back ?? []),
64
65
  pick: d(e?.pick.frames ?? []),
65
- language: d(r),
66
+ language: d(n),
66
67
  theme: (e?.theme ?? []).map((e) => ({
67
- frame: a(e.template, o, u),
68
+ frame: o(e.template, a, u),
68
69
  family: e.family,
69
70
  invert: e.invert === !0,
70
71
  saysTheme: e.saysTheme === !0
@@ -91,56 +92,56 @@ function _(e, t, r, i, o, c) {
91
92
  searchClear: d(m?.searchClear ?? [])
92
93
  }
93
94
  };
94
- return g.set(c, _), _;
95
- }
96
- function v(e) {
97
- return _(e, e.goto, e.language, e, e.locale, `native:${e.locale}`);
95
+ return _.set(s, h), h;
98
96
  }
99
97
  function y(e) {
100
- let t = e?.locale ?? "en", n = e ?? m;
101
- return _(null, p.goto, p.language, {
98
+ return v(e, e.goto, e.language, e, e.locale, `native:${e.locale}`);
99
+ }
100
+ function b(e) {
101
+ let t = e?.locale ?? "en", n = e ?? h;
102
+ return v(null, m.goto, m.language, {
102
103
  ...n,
103
104
  polite: void 0
104
105
  }, t, `english:${t}`);
105
106
  }
106
- function b(e, t) {
107
+ function x(e, t) {
107
108
  return t === "es" ? e.replace(/^(?:el|la|los|las|un|una|unos|unas) (?=\S)/, "") : t === "ar" ? e.replace(/^(?:لل|ال)(?=\S{2})/, "") : e;
108
109
  }
109
- function x(e, t, r) {
110
- let i = /* @__PURE__ */ new Map(), a = (e, r) => {
111
- let a = b(n(e, t), t);
110
+ function S(e, t, n) {
111
+ let i = /* @__PURE__ */ new Map(), a = (e, n) => {
112
+ let a = x(r(e, t), t);
112
113
  if (!a) return;
113
114
  let o = i.get(a) ?? [];
114
- o.some((e) => e.path === r.path) || o.push(r), i.set(a, o);
115
+ o.some((e) => e.path === n.path) || o.push(n), i.set(a, o);
115
116
  };
116
117
  for (let t of e) {
117
118
  a(t.label, t), t.context && a(`${t.context} ${t.label}`, t);
118
- for (let e of r?.(t.label) ?? []) a(e, t);
119
+ for (let e of n?.(t.label) ?? []) a(e, t);
119
120
  }
120
121
  return i;
121
122
  }
122
- function S(e, t, r) {
123
- let i = b(e, r), a = t.filter((e) => b(n(e.label, r), r) === i);
123
+ function C(e, t, n) {
124
+ let i = x(e, n), a = t.filter((e) => x(r(e.label, n), n) === i);
124
125
  return a.length === 1 ? a[0] ?? null : null;
125
126
  }
126
- function C(e, t) {
127
- let n = b(e, t.fold);
127
+ function w(e, t) {
128
+ let n = x(e, t.fold);
128
129
  if (t.zh) return [...t.ambiguous].some((e) => n.endsWith(e));
129
130
  let r = n.split(" "), i = r[r.length - 1] ?? "", a = r.slice(-2).join(" ");
130
131
  return t.ambiguous.has(i) || t.ambiguous.has(a);
131
132
  }
132
- function w(e, t, r) {
133
+ function T(e, t, n) {
133
134
  let i = /* @__PURE__ */ new Map(), a = "";
134
- for (let s of [
135
+ for (let o of [
135
136
  "go",
136
137
  "open",
137
138
  "show"
138
- ]) for (let c of e.goto[s]) for (let l of o(c, t)) {
139
+ ]) for (let c of e.goto[o]) for (let l of s(c, t)) {
139
140
  let t = l.x;
140
141
  if (!t) continue;
141
- let o = r.get(b(t, e.fold));
142
- if (o && !(s === "open" && l.p === void 0 && (C(t, e) || o.some((t) => C(n(t.label, e.fold), e))))) {
143
- for (let e of o) i.set(e.path, e);
142
+ let s = n.get(x(t, e.fold));
143
+ if (s && !(o === "open" && l.p === void 0 && (w(t, e) || s.some((t) => w(r(t.label, e.fold), e))))) {
144
+ for (let e of s) i.set(e.path, e);
144
145
  a = t;
145
146
  }
146
147
  }
@@ -149,16 +150,16 @@ function w(e, t, r) {
149
150
  query: a
150
151
  };
151
152
  }
152
- function T(e, t, n) {
153
- for (let r of e.theme) if (!(n === "mode-only" && r.saysTheme) && o(r.frame, t).length !== 0) return {
153
+ function E(e, t, n) {
154
+ for (let r of e.theme) if (!(n === "mode-only" && r.saysTheme) && s(r.frame, t).length !== 0) return {
154
155
  kind: "family",
155
156
  family: r.invert ? r.family === "dark" ? "light" : "dark" : r.family
156
157
  };
157
158
  return null;
158
159
  }
159
- function E(e, t) {
160
+ function D(e, t) {
160
161
  let n = [];
161
- for (let r of e.pick) for (let i of o(r, t)) {
162
+ for (let r of e.pick) for (let i of s(r, t)) {
162
163
  let t = i.o ?? i.n, r = i.o === void 0 ? "n" : "o", a = t === void 0 ? void 0 : e.closed[r]?.get(t);
163
164
  a === "last" ? n.push({ kind: "last" }) : typeof a == "number" && n.push({
164
165
  kind: "ordinal",
@@ -168,15 +169,15 @@ function E(e, t) {
168
169
  let [r] = n;
169
170
  return r && n.every((e) => JSON.stringify(e) === JSON.stringify(r)) ? r : null;
170
171
  }
171
- var D = (e, t) => e.some((e) => o(e, t).length > 0);
172
- function O(e, t) {
173
- let n = e.filter((e) => o(e.frame, t).length > 0);
172
+ var O = (e, t) => e.some((e) => s(e, t).length > 0);
173
+ function k(e, t) {
174
+ let n = e.filter((e) => s(e.frame, t).length > 0);
174
175
  return n.length === 0 ? null : { weak: n.every((e) => e.weak) };
175
176
  }
176
- var k = 60, A = 4;
177
- function j(e, t, n) {
177
+ var A = 60, j = 4;
178
+ function M(e, t, n) {
178
179
  if (n.zh) return t;
179
- let i = r(e, n.fold), a = i.flatMap((e, t) => e.folded.map((e) => ({
180
+ let r = i(e, n.fold), a = r.flatMap((e, t) => e.folded.map((e) => ({
180
181
  token: e,
181
182
  owner: t
182
183
  }))), o = t.split(" ");
@@ -184,15 +185,15 @@ function j(e, t, n) {
184
185
  if (!o.every((t, n) => a[e + n]?.token === t)) continue;
185
186
  let t = a[e]?.owner, n = a[e + o.length - 1]?.owner;
186
187
  if (t === void 0 || n === void 0 || a.filter((e) => e.owner >= t && e.owner <= n).length !== o.length) break;
187
- return i.slice(t, n + 1).map((e) => e.said).join(" ");
188
+ return r.slice(t, n + 1).map((e) => e.said).join(" ");
188
189
  }
189
190
  return t;
190
191
  }
191
- function M(e, t) {
192
+ function N(e, t) {
192
193
  let n = t === void 0 ? void 0 : e.closed.d?.get(t);
193
194
  return n === "asc" || n === "desc" ? n : null;
194
195
  }
195
- function N(e, t, r, i, a, s) {
196
+ function P(e, t, n, i, a, o) {
196
197
  let { registered: c } = i;
197
198
  if (e.prep.compound.some((n) => e.zh ? t.includes(n) : ` ${t} `.includes(` ${n} `))) return null;
198
199
  let l = [], u = (e, t) => l.push({
@@ -200,7 +201,7 @@ function N(e, t, r, i, a, s) {
200
201
  weak: t
201
202
  }), { phrases: d } = e.controls, f = (e, n, r) => {
202
203
  if (!n) return;
203
- let i = O(d[e], t);
204
+ let i = k(d[e], t);
204
205
  i && u(r, i.weak);
205
206
  };
206
207
  if (f("notifications", c["header.notifications"], { control: "header.notifications" }), f("help", c["header.help"], { control: "header.help" }), f("sidebarCollapse", c.sidebar, {
@@ -210,34 +211,34 @@ function N(e, t, r, i, a, s) {
210
211
  control: "sidebar",
211
212
  collapsed: !1
212
213
  }), f("history", c["assistant.history"], { control: "assistant.history" }), f("transcript", c["assistant.transcript"], { control: "assistant.transcript" }), f("previewOpen", c["assistant.preview"], { control: "assistant.preview" }), f("previewClose", c["assistant.preview"], { control: "assistant.preview.close" }), f("newConversation", c["assistant.conversation.new"], { control: "assistant.conversation.new" }), c.language && e.language.length > 0) {
213
- let r = new Set(a.map((t) => b(n(t.label, e.fold), e.fold)));
214
- for (let n of e.language) for (let i of o(n, t)) {
215
- let t = i.lang, n = t === void 0 ? void 0 : s.get(t);
216
- n && t !== void 0 && !r.has(b(t, e.fold)) && u({
214
+ let n = new Set(a.map((t) => x(r(t.label, e.fold), e.fold)));
215
+ for (let r of e.language) for (let i of s(r, t)) {
216
+ let t = i.lang, r = t === void 0 ? void 0 : o.get(t);
217
+ r && t !== void 0 && !n.has(x(t, e.fold)) && u({
217
218
  control: "language",
218
- code: n
219
+ code: r
219
220
  }, !1);
220
221
  }
221
222
  }
222
223
  let p = i.page;
223
224
  if (p) {
224
- if (p.tabs.length > 0) for (let n of e.controls.tab) for (let r of o(n, t)) {
225
- let t = r.x ? S(r.x, p.tabs, e.fold) : null;
225
+ if (p.tabs.length > 0) for (let n of e.controls.tab) for (let r of s(n, t)) {
226
+ let t = r.x ? C(r.x, p.tabs, e.fold) : null;
226
227
  t && u({
227
228
  control: "page.tab",
228
229
  name: t.label
229
230
  }, !1);
230
231
  }
231
232
  if (p.filters.length > 0) {
232
- D(e.controls.filterClear, t) && u({
233
+ O(e.controls.filterClear, t) && u({
233
234
  control: "page.filter.clear",
234
235
  filter: null
235
236
  }, !1);
236
- for (let n of e.controls.filter) for (let r of o(n, t)) {
237
+ for (let n of e.controls.filter) for (let r of s(n, t)) {
237
238
  if (!r.x) continue;
238
- let t = p.filters.filter((t) => S(r.x, t.options, e.fold) !== null), [n] = t;
239
+ let t = p.filters.filter((t) => C(r.x, t.options, e.fold) !== null), [n] = t;
239
240
  if (!n) continue;
240
- let i = S(r.x, n.options, e.fold);
241
+ let i = C(r.x, n.options, e.fold);
241
242
  i && u({
242
243
  control: "page.filter",
243
244
  filter: t.length === 1 ? n.label : null,
@@ -246,16 +247,16 @@ function N(e, t, r, i, a, s) {
246
247
  }
247
248
  }
248
249
  if (p.sorts.length > 0) {
249
- for (let n of e.controls.sort) for (let r of o(n, t)) {
250
- let t = r.x ? S(r.x, p.sorts, e.fold) : null;
250
+ for (let n of e.controls.sort) for (let r of s(n, t)) {
251
+ let t = r.x ? C(r.x, p.sorts, e.fold) : null;
251
252
  t && u({
252
253
  control: "page.sort",
253
254
  field: t.label,
254
- direction: M(e, r.d)
255
+ direction: N(e, r.d)
255
256
  }, !1);
256
257
  }
257
- for (let n of e.controls.sortDirection) for (let r of o(n, t)) {
258
- let t = M(e, r.d);
258
+ for (let n of e.controls.sortDirection) for (let r of s(n, t)) {
259
+ let t = N(e, r.d);
259
260
  t && u({
260
261
  control: "page.sort",
261
262
  field: null,
@@ -264,69 +265,69 @@ function N(e, t, r, i, a, s) {
264
265
  }
265
266
  }
266
267
  if (p.searchable) {
267
- D(e.controls.searchClear, t) && u({ control: "page.search.clear" }, !1);
268
- let n = null, i = D(e.controls.searchVerbOnly, t);
269
- for (let r of i ? [] : e.controls.search) for (let i of o(r, t)) {
270
- let t = i.q?.trim() ?? "", r = e.zh ? 0 : t.split(" ").length;
271
- !t || t.length > k || r > A || (n === null || t.length < n.length) && (n = t);
268
+ O(e.controls.searchClear, t) && u({ control: "page.search.clear" }, !1);
269
+ let r = null, i = O(e.controls.searchVerbOnly, t);
270
+ for (let n of i ? [] : e.controls.search) for (let i of s(n, t)) {
271
+ let t = i.q?.trim() ?? "", n = e.zh ? 0 : t.split(" ").length;
272
+ !t || t.length > A || n > j || (r === null || t.length < r.length) && (r = t);
272
273
  }
273
- n !== null && u({
274
+ r !== null && u({
274
275
  control: "page.search",
275
- query: j(r, n, e)
276
+ query: M(n, r, e)
276
277
  }, !1);
277
278
  }
278
279
  }
279
280
  let m = l.filter((e) => !e.weak), h = m.length > 0 ? m : l, [g] = h;
280
281
  return g && h.every((e) => JSON.stringify(e) === JSON.stringify(g)) ? g : null;
281
282
  }
282
- function P(e, t, n, r, i, a, o) {
283
+ function F(e, t, n, r, i, a, o) {
283
284
  let s = {};
284
285
  if (i.enabled("theme")) {
285
- let n = T(e, r, t.themeWords);
286
+ let n = E(e, r, t.themeWords);
286
287
  n && (s.theme = n);
287
288
  }
288
- if (i.enabled("back") && t.backRunnable && D(e.back, r) && (s.back = !0), i.enabled("pick") && t.navigation) {
289
- let t = E(e, r);
289
+ if (i.enabled("back") && t.backRunnable && O(e.back, r) && (s.back = !0), i.enabled("pick") && t.navigation) {
290
+ let t = D(e, r);
290
291
  t && (s.pick = t);
291
292
  }
292
- if (i.enabled("there") && t.navigation && D(e.there, r) && (s.there = !0), i.enabled("goto")) {
293
- let t = w(e, r, o);
293
+ if (i.enabled("there") && t.navigation && O(e.there, r) && (s.there = !0), i.enabled("goto")) {
294
+ let t = T(e, r, o);
294
295
  t && (s.goto = t);
295
296
  }
296
297
  if (t.controls && (i.enabled("controls") || i.enabled("language"))) {
297
- let o = N(e, r, n, t.controls, t.destinations, a);
298
+ let o = P(e, r, n, t.controls, t.destinations, a);
298
299
  o && (o.request.control === "language" ? i.enabled("language") : i.enabled("controls")) && (s.control = o);
299
300
  }
300
301
  return s;
301
302
  }
302
- function F(n) {
303
- let r = e(n.manifest), i = f({
304
- ui: n.uiLocale,
305
- input: n.inputLocale,
306
- narrow: n.commandLocales,
303
+ function I(e) {
304
+ let r = t(e.manifest), i = p({
305
+ ui: e.uiLocale,
306
+ input: e.inputLocale,
307
+ narrow: e.commandLocales,
307
308
  manifest: r
308
- }), a = i.length > 0 && t(r, "en", "goto"), o = t(r, "en", "language");
309
+ }), a = i.length > 0 && n(r, "en", "goto"), o = n(r, "en", "language");
309
310
  if (i.length === 0 && !o) return [];
310
- let s = c(n.said), p = i.map((e) => d[e]), m = n.controls?.languages ?? [], h = [], g = (e) => u({
311
- tables: p,
311
+ let s = l(e.said), c = i.map((e) => f[e]), m = e.controls?.languages ?? [], h = [], g = (e) => d({
312
+ tables: c,
312
313
  appLanguages: m,
313
314
  fold: e
314
315
  });
315
- for (let e of p) {
316
- let i = v(e), a = l(n.said, i.prep, s);
316
+ for (let t of c) {
317
+ let i = y(t), a = u(e.said, i.prep, s);
317
318
  if (a === null) continue;
318
- let o = P(i, n, n.said, a, { enabled: (n) => t(r, e.locale, n) }, g(e.locale), x(n.destinations, e.locale, e.nameForms));
319
+ let o = F(i, e, e.said, a, { enabled: (e) => n(r, t.locale, e) }, g(t.locale), S(e.destinations, t.locale, t.nameForms));
319
320
  Object.keys(o).length > 0 && h.push({
320
- source: e.locale,
321
+ source: t.locale,
321
322
  intents: o
322
323
  });
323
324
  }
324
325
  if (!s && (a || o)) {
325
- let e = i.length > 0 ? p : [null];
326
- for (let t of e) {
327
- let e = y(t), r = l(n.said, e.prep, !1);
326
+ let t = i.length > 0 ? c : [null];
327
+ for (let n of t) {
328
+ let t = b(n), r = u(e.said, t.prep, !1);
328
329
  if (r === null) continue;
329
- let i = P(e, n, n.said, r, { enabled: (e) => e === "goto" ? a : e === "language" ? o : !1 }, g(e.fold), x(n.destinations, e.fold));
330
+ let i = F(t, e, e.said, r, { enabled: (e) => e === "goto" ? a : e === "language" ? o : !1 }, g(t.fold), S(e.destinations, t.fold));
330
331
  Object.keys(i).length > 0 && h.push({
331
332
  source: "en",
332
333
  intents: i
@@ -335,17 +336,112 @@ function F(n) {
335
336
  }
336
337
  return h;
337
338
  }
338
- function I(n) {
339
- let r = e(n.manifest), i = f({
340
- ui: n.uiLocale,
341
- input: n.inputLocale,
342
- narrow: n.commandLocales,
339
+ function L(e) {
340
+ let r = t(e.manifest), i = p({
341
+ ui: e.uiLocale,
342
+ input: e.inputLocale,
343
+ narrow: e.commandLocales,
343
344
  manifest: r
344
- }), a = c(n.said);
345
- return i.some((e) => {
346
- let i = d[e], o = v(i), s = l(n.said, o.prep, a);
347
- return s === null ? !1 : t(r, e, "there") && D(o.there, s) || t(r, e, "pick") && E(o, s) !== null;
345
+ }), a = l(e.said);
346
+ return i.some((t) => {
347
+ let i = f[t], o = y(i), s = u(e.said, o.prep, a);
348
+ return s === null ? !1 : n(r, t, "there") && O(o.there, s) || n(r, t, "pick") && D(o, s) !== null;
349
+ });
350
+ }
351
+ function R(i, a) {
352
+ let o = t(i.manifest), s = p({
353
+ ui: i.uiLocale,
354
+ input: i.inputLocale,
355
+ narrow: i.commandLocales,
356
+ manifest: o
357
+ }), c = s.map((e) => f[e]), m = c.map((e) => ({
358
+ compiled: y(e),
359
+ table: e,
360
+ enabled: (t) => n(o, e.locale, t)
361
+ }));
362
+ if (n(o, "en", "language") || s.length > 0 && n(o, "en", "goto")) for (let e of c.length ? c : [null]) m.push({
363
+ compiled: b(e),
364
+ table: e,
365
+ enabled: (e) => e === "language" ? n(o, "en", "language") : e === "goto" && s.length > 0 && n(o, "en", "goto")
348
366
  });
367
+ for (let { compiled: t, table: n, enabled: o } of m) {
368
+ let s = [], f = (e, t) => {
369
+ e && s.push(...t);
370
+ };
371
+ f(o("theme"), t.theme.filter((e) => i.themeWords !== "mode-only" || !e.saysTheme).map((e) => e.frame)), f(o("back") && i.backRunnable, t.back), f(o("there") && i.navigation, t.there), f(o("pick") && i.navigation, t.pick), f(o("goto"), [
372
+ ...t.goto.go,
373
+ ...t.goto.open,
374
+ ...t.goto.show
375
+ ]);
376
+ let p = i.controls, m = p?.page;
377
+ if (p && (f(o("language") && p.registered.language, t.language), o("controls"))) {
378
+ let e = p.registered;
379
+ for (let [n, r] of [
380
+ ["notifications", e["header.notifications"]],
381
+ ["help", e["header.help"]],
382
+ ["sidebarCollapse", e.sidebar],
383
+ ["sidebarExpand", e.sidebar],
384
+ ["history", e["assistant.history"]],
385
+ ["transcript", e["assistant.transcript"]],
386
+ ["previewOpen", e["assistant.preview"]],
387
+ ["previewClose", e["assistant.preview"]],
388
+ ["newConversation", e["assistant.conversation.new"]]
389
+ ]) f(r, t.controls.phrases[n].map((e) => e.frame));
390
+ m && (f(m.tabs.length > 0, t.controls.tab), f(m.filters.length > 0, [...t.controls.filter, ...t.controls.filterClear]), f(m.sorts.length > 0, [...t.controls.sort, ...t.controls.sortDirection]), f(m.searchable, [...t.controls.search, ...t.controls.searchClear]));
391
+ }
392
+ let h = new Set(S(i.destinations, t.fold, n?.nameForms).keys());
393
+ for (let e of [
394
+ ...i.destinations.map((e) => e.label),
395
+ ...(m?.tabs ?? []).map((e) => e.label),
396
+ ...(m?.sorts ?? []).map((e) => e.label),
397
+ ...(m?.filters ?? []).flatMap((e) => e.options.map((e) => e.label))
398
+ ]) h.add(r(e, t.fold));
399
+ for (let e of [...h]) {
400
+ if (t.fold === "es") for (let t of [
401
+ "el",
402
+ "la",
403
+ "los",
404
+ "las",
405
+ "un",
406
+ "una",
407
+ "unos",
408
+ "unas"
409
+ ]) h.add(`${t} ${e}`);
410
+ t.fold === "ar" && (h.add(`ال${e}`), h.add(`لل${e}`));
411
+ }
412
+ let g = d({
413
+ tables: c,
414
+ appLanguages: p?.languages ?? [],
415
+ fold: t.fold
416
+ }), _ = (n) => s.some((r) => e(r.expressions[0], n, {
417
+ maxLength: t.prep.maxLength,
418
+ slots: {
419
+ x: [...h],
420
+ lang: [...g.keys()]
421
+ }
422
+ }, a)), v = r(i.said, t.fold), y = u(i.said, t.prep, l(i.said));
423
+ if (y !== null && _(y)) return !0;
424
+ let b = u(i.said, t.prep, !0);
425
+ if (b !== null && _(b)) return !0;
426
+ for (let e = 1; e < v.length; e += 1) {
427
+ if (!t.zh && v[e] !== " ") continue;
428
+ let n = v.slice(0, e), r = v.slice(e + +!t.zh);
429
+ if (n.startsWith(r) && a(`${n}${t.zh ? "" : " "}${n}`)) return !0;
430
+ }
431
+ if ([
432
+ ...t.prep.prefix,
433
+ ...t.prep.fillers,
434
+ ...t.prep.polite?.prefix ?? []
435
+ ].some((e) => e.startsWith(y ?? v)) && _("")) return !0;
436
+ let x = t.zh ? "" : " ";
437
+ for (let e of [...t.prep.suffix, ...t.prep.polite?.suffix ?? []]) for (let t = 1; t <= e.length; t += 1) {
438
+ let n = x + e.slice(0, t);
439
+ if (!v.endsWith(n)) continue;
440
+ let r = v.slice(0, -n.length);
441
+ if (r && a(r)) return !0;
442
+ }
443
+ }
444
+ return !1;
349
445
  }
350
446
  //#endregion
351
- export { v as compileNative, F as matchLocaleIntents, I as mayBeThereOrPick };
447
+ export { y as compileNative, R as couldBeLocaleCommandPrefix, I as matchLocaleIntents, L as mayBeThereOrPick };