@arcgis/ai-components 5.2.0-next.120 → 5.2.0-next.121

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 (133) hide show
  1. package/dist/agent-utils/LLMAgent.js +2 -0
  2. package/dist/agents/runtime/skill/createSkillAgent.js +115 -131
  3. package/dist/cdn/2DYOTV7W.js +4 -0
  4. package/dist/cdn/2WT4JANT.js +2 -0
  5. package/dist/cdn/{2NODROJN.js → 3F5EZZSG.js} +20 -24
  6. package/dist/cdn/4V3Q7XGS.js +2 -0
  7. package/dist/cdn/5GALSAQF.js +3 -0
  8. package/dist/cdn/72KYGCIU.js +2 -0
  9. package/dist/cdn/75OPJOCY.js +2 -0
  10. package/dist/cdn/7D6POJJA.js +2 -0
  11. package/dist/cdn/{SLR75R32.js → 7HVK7G55.js} +1 -1
  12. package/dist/cdn/7L6LPWRH.js +2 -0
  13. package/dist/cdn/7TAIUEMW.js +2 -0
  14. package/dist/cdn/{C2W6MBDB.js → D3E5NSY3.js} +1 -1
  15. package/dist/cdn/ESPC6NTI.js +68 -0
  16. package/dist/cdn/{HTB76P2C.js → EWO73MJA.js} +1 -1
  17. package/dist/cdn/{EIZR3Q5O.js → FGQLS3UX.js} +1 -1
  18. package/dist/cdn/FOZAOJCM.js +2 -0
  19. package/dist/cdn/GZDI2LAT.js +2 -0
  20. package/dist/cdn/H4ERKWFA.js +2 -0
  21. package/dist/cdn/{7W7KWR5O.js → H5AVPDSE.js} +4 -4
  22. package/dist/cdn/{2I2FHPHR.js → HDAMDEYL.js} +6 -6
  23. package/dist/cdn/JE55XX2C.js +2 -0
  24. package/dist/cdn/K36XPG2M.js +2 -0
  25. package/dist/cdn/KDE5MMMR.js +2 -0
  26. package/dist/cdn/{ZGZX7GR5.js → KONQTXBJ.js} +1 -1
  27. package/dist/cdn/{J4YHT55S.js → MCZJD3A4.js} +1 -1
  28. package/dist/cdn/MNZAQM3Q.js +3 -0
  29. package/dist/cdn/NHZRDYLP.js +2 -0
  30. package/dist/cdn/NYFV4A6L.js +3 -0
  31. package/dist/cdn/OGYNTGNM.js +2 -0
  32. package/dist/cdn/PGIXKPTW.js +2 -0
  33. package/dist/cdn/PTEKX5TX.js +2 -0
  34. package/dist/cdn/PUHPFUCU.js +2 -0
  35. package/dist/cdn/{GKWMAWFZ.js → QDOKDRBB.js} +1 -1
  36. package/dist/cdn/TGZBLBEJ.js +2 -0
  37. package/dist/cdn/{K7BUBCK7.js → UBKYXKMW.js} +1 -1
  38. package/dist/cdn/UXECAKJ7.js +2 -0
  39. package/dist/cdn/WXOKGQ4D.js +2 -0
  40. package/dist/cdn/Y364LLPN.js +2 -0
  41. package/dist/cdn/YBSY32EU.js +2 -0
  42. package/dist/cdn/{CF2V3NER.js → ZLLVPKDN.js} +35 -35
  43. package/dist/cdn/agent-utils/index.js +1 -1
  44. package/dist/cdn/assets/agents/t9n/messages.ar.json +1 -0
  45. package/dist/cdn/assets/agents/t9n/messages.bg.json +1 -0
  46. package/dist/cdn/assets/agents/t9n/messages.ca.json +1 -0
  47. package/dist/cdn/assets/agents/t9n/messages.cs.json +1 -0
  48. package/dist/cdn/assets/agents/t9n/messages.da.json +1 -0
  49. package/dist/cdn/assets/agents/t9n/messages.de.json +1 -0
  50. package/dist/cdn/assets/agents/t9n/messages.el.json +1 -0
  51. package/dist/cdn/assets/agents/t9n/messages.es.json +1 -0
  52. package/dist/cdn/assets/agents/t9n/messages.et.json +1 -0
  53. package/dist/cdn/assets/agents/t9n/messages.fi.json +1 -0
  54. package/dist/cdn/assets/agents/t9n/messages.fr.json +1 -0
  55. package/dist/cdn/assets/agents/t9n/messages.he.json +1 -0
  56. package/dist/cdn/assets/agents/t9n/messages.hr.json +1 -0
  57. package/dist/cdn/assets/agents/t9n/messages.hu.json +1 -0
  58. package/dist/cdn/assets/agents/t9n/messages.id.json +1 -0
  59. package/dist/cdn/assets/agents/t9n/messages.it.json +1 -0
  60. package/dist/cdn/assets/agents/t9n/messages.ja.json +1 -0
  61. package/dist/cdn/assets/agents/t9n/messages.ko.json +1 -0
  62. package/dist/cdn/assets/agents/t9n/messages.lt.json +1 -0
  63. package/dist/cdn/assets/agents/t9n/messages.lv.json +1 -0
  64. package/dist/cdn/assets/agents/t9n/messages.nl.json +1 -0
  65. package/dist/cdn/assets/agents/t9n/messages.no.json +1 -0
  66. package/dist/cdn/assets/agents/t9n/messages.pl.json +1 -0
  67. package/dist/cdn/assets/agents/t9n/messages.pt-BR.json +1 -0
  68. package/dist/cdn/assets/agents/t9n/messages.pt-PT.json +1 -0
  69. package/dist/cdn/assets/agents/t9n/messages.ro.json +1 -0
  70. package/dist/cdn/assets/agents/t9n/messages.ru.json +1 -0
  71. package/dist/cdn/assets/agents/t9n/messages.sk.json +1 -0
  72. package/dist/cdn/assets/agents/t9n/messages.sl.json +1 -0
  73. package/dist/cdn/assets/agents/t9n/messages.sr.json +1 -0
  74. package/dist/cdn/assets/agents/t9n/messages.sv.json +1 -0
  75. package/dist/cdn/assets/agents/t9n/messages.th.json +1 -0
  76. package/dist/cdn/assets/agents/t9n/messages.tr.json +1 -0
  77. package/dist/cdn/assets/agents/t9n/messages.uk.json +1 -0
  78. package/dist/cdn/assets/agents/t9n/messages.vi.json +1 -0
  79. package/dist/cdn/assets/agents/t9n/messages.zh-CN.json +1 -0
  80. package/dist/cdn/assets/agents/t9n/messages.zh-TW.json +1 -0
  81. package/dist/cdn/assets/orchestrator/t9n/messages.en.json +1 -0
  82. package/dist/cdn/index.js +1 -1
  83. package/dist/chunks/adapter.js +54 -52
  84. package/dist/chunks/aiFactory.js +59 -41
  85. package/dist/chunks/arcgisKnowledgeGraph.js +4 -2
  86. package/dist/chunks/dataExplorationAgent.js +1 -1
  87. package/dist/chunks/generateLayerDescriptions.js +160 -156
  88. package/dist/chunks/layerStylingGraph.js +2 -0
  89. package/dist/chunks/orchestrator.js +325 -295
  90. package/dist/components/arcgis-assistant/customElement.d.ts +1 -1
  91. package/dist/components/arcgis-assistant/customElement.js +113 -112
  92. package/dist/components/arcgis-assistant-agent/customElement.js +1 -0
  93. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -0
  94. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
  95. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +5 -4
  96. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
  97. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
  98. package/dist/docs/api.json +1 -1
  99. package/dist/docs/docs.json +1 -1
  100. package/dist/docs/vscode.html-custom-data.json +1 -1
  101. package/dist/docs/web-types.json +1 -1
  102. package/dist/utils/index.js +38 -36
  103. package/package.json +7 -7
  104. package/dist/cdn/5BBXNT75.js +0 -66
  105. package/dist/cdn/5HBAJ57P.js +0 -2
  106. package/dist/cdn/5MK44FNO.js +0 -2
  107. package/dist/cdn/6ECRQVHY.js +0 -2
  108. package/dist/cdn/AUDVUNF3.js +0 -2
  109. package/dist/cdn/BJUX4AYP.js +0 -2
  110. package/dist/cdn/COH3QXWG.js +0 -4
  111. package/dist/cdn/CPQGLQGY.js +0 -2
  112. package/dist/cdn/CT2ZOYNX.js +0 -2
  113. package/dist/cdn/DNV3L5M6.js +0 -2
  114. package/dist/cdn/EDVH3G5A.js +0 -2
  115. package/dist/cdn/HWGAJ4WN.js +0 -2
  116. package/dist/cdn/IHRX74QJ.js +0 -2
  117. package/dist/cdn/LRH2ZPVW.js +0 -2
  118. package/dist/cdn/OTOQL3QM.js +0 -3
  119. package/dist/cdn/R74ZHFA6.js +0 -2
  120. package/dist/cdn/RGVC76RW.js +0 -2
  121. package/dist/cdn/RIN3RP7D.js +0 -3
  122. package/dist/cdn/SWVRA77H.js +0 -2
  123. package/dist/cdn/TLQ75QXG.js +0 -2
  124. package/dist/cdn/TPF5Z277.js +0 -3
  125. package/dist/cdn/UIIVUHXL.js +0 -2
  126. package/dist/cdn/UWZQWGZP.js +0 -2
  127. package/dist/cdn/UXYYH6XF.js +0 -2
  128. package/dist/cdn/XUYARLRP.js +0 -2
  129. package/dist/cdn/XV3DHHYJ.js +0 -2
  130. package/dist/cdn/Y2BCEVV6.js +0 -2
  131. package/dist/cdn/YJ4MZOVC.js +0 -2
  132. package/dist/cdn/YXIPCGGP.js +0 -2
  133. package/dist/cdn/YYFKFPSN.js +0 -2
@@ -7,6 +7,8 @@ import "@arcgis/toolkit/string";
7
7
  import "../chunks/generateLayerDescriptions.js";
8
8
  import { ToolMessage as y } from "@langchain/core/messages";
9
9
  import "@langchain/core/callbacks/dispatch/web";
10
+ import "@arcgis/toolkit/intl";
11
+ import "../chunks/runtime.js";
10
12
  import "@langchain/core/callbacks/base";
11
13
  import { c } from "../chunks/aiFactory.js";
12
14
  import { watch as v } from "@arcgis/core/core/reactiveUtils.js";
@@ -1,159 +1,143 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { getCurrentTaskInput as q, Annotation as G, StateGraph as K, START as L, END as D, isGraphInterrupt as J } from "@langchain/langgraph/web";
3
- import { createMiddleware as f, createAgent as _, providerStrategy as U } from "langchain";
3
+ import { createMiddleware as k, createAgent as _, providerStrategy as U } from "langchain";
4
4
  import d, { z as m } from "zod";
5
- import { c as B } from "../../../chunks/aiFactory.js";
5
+ import { g as M, a as R, c as B } from "../../../chunks/aiFactory.js";
6
6
  import { s as p } from "../../../chunks/index.js";
7
7
  import { a as H } from "../../../chunks/baseAgentState.js";
8
8
  import { ToolMessage as Q } from "@langchain/core/messages";
9
- import { fetchT9nStringsBundle as W } from "@arcgis/toolkit/intl";
10
- import { g as X } from "../../../chunks/runtime.js";
11
- import { tool as M } from "@langchain/core/tools";
12
- import { r as Y } from "../../../chunks/arcgisToolRegistry.js";
13
- const h = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Z = ["point", "polyline", "polygon", "extent", "custom"], V = (e) => typeof e == "string" && Z.some((t) => t === e), ee = (e, t) => {
14
- if (!(!h(e) || !("value" in e))) {
15
- if (h(e.sharedStatePatch)) {
16
- const o = { ...t.sharedStatePatch };
17
- for (const [s, r] of Object.entries(e.sharedStatePatch))
18
- h(r) && "value" in r && (o[s] = { value: r.value });
19
- t.sharedStatePatch = o;
9
+ import { tool as $ } from "@langchain/core/tools";
10
+ import { r as W } from "../../../chunks/arcgisToolRegistry.js";
11
+ const w = (e) => typeof e == "object" && e !== null && !Array.isArray(e), X = ["point", "polyline", "polygon", "extent", "custom"], Y = (e) => typeof e == "string" && X.some((s) => s === e), Z = (e, s) => {
12
+ if (!(!w(e) || !("value" in e))) {
13
+ if (w(e.sharedStatePatch)) {
14
+ const t = { ...s.sharedStatePatch };
15
+ for (const [o, r] of Object.entries(e.sharedStatePatch))
16
+ w(r) && "value" in r && (t[o] = { value: r.value });
17
+ s.sharedStatePatch = t;
20
18
  }
21
19
  if (Array.isArray(e.sharedResourceAdditions))
22
- for (const o of e.sharedResourceAdditions)
23
- h(o) && V(o.kind) && typeof o.description == "string" && "payload" in o && t.sharedResourceAdditions.push({
24
- kind: o.kind,
25
- description: o.description,
26
- payload: o.payload
20
+ for (const t of e.sharedResourceAdditions)
21
+ w(t) && Y(t.kind) && typeof t.description == "string" && "payload" in t && s.sharedResourceAdditions.push({
22
+ kind: t.kind,
23
+ description: t.description,
24
+ payload: t.payload
27
25
  });
28
26
  }
29
- }, te = () => {
27
+ }, V = () => {
30
28
  const e = { sharedResourceAdditions: [] };
31
29
  return {
32
- middleware: f({
30
+ middleware: k({
33
31
  name: "ToolArtifactMiddleware",
34
- afterAgent: (t) => {
35
- if (delete e.sharedStatePatch, e.sharedResourceAdditions.length = 0, !h(t))
32
+ afterAgent: (s) => {
33
+ if (delete e.sharedStatePatch, e.sharedResourceAdditions.length = 0, !w(s))
36
34
  return;
37
- const o = t.messages;
38
- if (Array.isArray(o)) {
39
- for (const s of o)
40
- if (Q.isInstance(s) && s.status !== "error") {
41
- const r = s.artifact;
42
- ee(r, e);
35
+ const t = s.messages;
36
+ if (Array.isArray(t)) {
37
+ for (const o of t)
38
+ if (Q.isInstance(o) && o.status !== "error") {
39
+ const r = o.artifact;
40
+ Z(r, e);
43
41
  }
44
42
  }
45
43
  }
46
44
  }),
47
45
  collectedEffects: e
48
46
  };
49
- }, oe = /^\.\/assets\/[^/]+\/t9n$/u, $ = (e) => {
50
- const t = e?.configurable;
51
- if (t && typeof t == "object" && "locale" in t) {
52
- const o = t.locale;
53
- if (typeof o == "string")
54
- return o;
55
- }
56
- return "en";
57
- };
58
- async function R(e) {
59
- if (!oe.test(e.path))
60
- throw new Error(`Invalid localization asset path: ${e.path}`);
61
- return console.log(`Fetching localization strings from path: ${e.path} with language: ${e.locale}`), await W(e.locale, X(e.path), "messages.");
62
- }
63
- const se = async (e) => {
64
- const t = await R({
47
+ }, ee = async (e) => {
48
+ const s = await M({
65
49
  path: "./assets/agents/t9n",
66
- locale: $(e)
50
+ locale: R(e)
67
51
  });
68
- return f({
52
+ return k({
69
53
  name: "TraceMiddleware",
70
- wrapModelCall: async (o, s) => {
71
- await p({ text: t.determiningNextSteps }, e);
54
+ wrapModelCall: async (t, o) => {
55
+ await p({ text: s.determiningNextSteps }, e);
72
56
  try {
73
- return await s(o);
57
+ return await o(t);
74
58
  } catch (r) {
75
- throw await p({ text: t.failedCallingModel }, e), r;
59
+ throw await p({ text: s.failedCallingModel }, e), r;
76
60
  }
77
61
  },
78
- wrapToolCall: async (o, s) => {
62
+ wrapToolCall: async (t, o) => {
79
63
  await p(
80
64
  {
81
- text: t.callingTool.replace("{toolName}", o.toolCall.name).replace("{toolArgs}", JSON.stringify(o.toolCall.args))
65
+ text: s.callingTool.replace("{toolName}", t.toolCall.name).replace("{toolArgs}", JSON.stringify(t.toolCall.args))
82
66
  },
83
67
  e
84
68
  );
85
69
  try {
86
- return await s(o);
70
+ return await o(t);
87
71
  } catch (r) {
88
72
  throw await p(
89
- { text: t.failedExecutingTool.replace("{toolName}", o.toolCall.name) },
73
+ { text: s.failedExecutingTool.replace("{toolName}", t.toolCall.name) },
90
74
  e
91
75
  ), r;
92
76
  }
93
77
  }
94
78
  });
95
- }, E = ["custom", "extent", "point", "polygon", "polyline"], re = d.object({
79
+ }, C = ["custom", "extent", "point", "polygon", "polyline"], te = d.object({
96
80
  id: d.string(),
97
- kind: d.enum(E),
81
+ kind: d.enum(C),
98
82
  description: d.string()
99
- }), ae = d.object({
100
- kinds: d.array(d.enum(E)).optional().describe("Optional resource kinds to include. Omit to list all available resources.")
101
- }), ne = ({ kinds: e }, t) => {
102
- const o = q(t), s = e ? new Set(e) : void 0, r = (o.agentExecutionContext?.sharedResources ?? []).flatMap((n) => {
103
- const i = re.safeParse(n);
104
- return i.success && (!s || s.has(i.data.kind)) ? [i.data] : [];
83
+ }), oe = d.object({
84
+ kinds: d.array(d.enum(C)).optional().describe("Optional resource kinds to include. Omit to list all available resources.")
85
+ }), se = ({ kinds: e }, s) => {
86
+ const t = q(s), o = e ? new Set(e) : void 0, r = (t.agentExecutionContext?.sharedResources ?? []).flatMap((n) => {
87
+ const i = te.safeParse(n);
88
+ return i.success && (!o || o.has(i.data.kind)) ? [i.data] : [];
105
89
  });
106
90
  return JSON.stringify({ resources: r }, null, 2);
107
- }, ie = M(ne, {
91
+ }, re = $(se, {
108
92
  name: "listSharedResources",
109
93
  description: "List IDs, kinds, and descriptions for resources created by earlier agents. Use this to reuse prior results instead of repeating work. Resource payloads are hidden.",
110
- schema: ae
111
- }), le = (e) => {
94
+ schema: oe
95
+ }), ae = (e) => {
112
96
  if (e.size === 0)
113
97
  throw new Error("At least one skill is required.");
114
- const t = [...e.keys()];
115
- return M(
116
- ({ name: o }) => {
117
- const s = e.get(o);
118
- if (!s)
119
- throw new Error(`Skill not found: ${o}`);
120
- return s.instructions;
98
+ const s = [...e.keys()];
99
+ return $(
100
+ ({ name: t }) => {
101
+ const o = e.get(t);
102
+ if (!o)
103
+ throw new Error(`Skill not found: ${t}`);
104
+ return o.instructions;
121
105
  },
122
106
  {
123
107
  name: "load_skill",
124
108
  description: "Load the detailed instructions for an available skill.",
125
- schema: d.object({ name: d.enum(t) })
109
+ schema: d.object({ name: d.enum(s) })
126
110
  }
127
111
  );
128
- }, ce = (e) => {
129
- const t = /^---\r?\nname: (?<name>[^\r\n]+)\r?\ndescription: (?<description>[^\r\n]+)\r?\n(?:allowed-tools: (?<allowedTools>[^\r\n]+)\r?\n)?---\r?\n(?<instructions>[\s\S]+)$/u.exec(
112
+ }, ne = (e) => {
113
+ const s = /^---\r?\nname: (?<name>[^\r\n]+)\r?\ndescription: (?<description>[^\r\n]+)\r?\n(?:allowed-tools: (?<allowedTools>[^\r\n]+)\r?\n)?---\r?\n(?<instructions>[\s\S]+)$/u.exec(
130
114
  e
131
115
  )?.groups;
132
- if (!t?.name || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(t.name) || t.name.length > 64 || !t.description || t.description.length > 1024 || !t.instructions)
116
+ if (!s?.name || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(s.name) || s.name.length > 64 || !s.description || s.description.length > 1024 || !s.instructions)
133
117
  throw new Error("Invalid skill Markdown.");
134
118
  return {
135
- allowedTools: t.allowedTools?.split(/\s+/u) ?? [],
136
- name: t.name,
137
- description: t.description,
138
- instructions: t.instructions.trim()
119
+ allowedTools: s.allowedTools?.split(/\s+/u) ?? [],
120
+ name: s.name,
121
+ description: s.description,
122
+ instructions: s.instructions.trim()
139
123
  };
140
- }, de = async (e) => {
141
- const t = await Promise.all(e.map(async (s) => ce(await s()))), o = /* @__PURE__ */ new Map();
142
- for (const s of t) {
143
- if (o.has(s.name))
144
- throw new Error(`Skill name must be unique: ${s.name}`);
145
- o.set(s.name, s);
124
+ }, ie = async (e) => {
125
+ const s = await Promise.all(e.map(async (o) => ne(await o()))), t = /* @__PURE__ */ new Map();
126
+ for (const o of s) {
127
+ if (t.has(o.name))
128
+ throw new Error(`Skill name must be unique: ${o.name}`);
129
+ t.set(o.name, o);
146
130
  }
147
- return o;
148
- }, b = "load_skill", T = (e) => typeof e == "object" && e !== null && "name" in e && typeof e.name == "string" ? e.name : void 0, ue = (e, t, o = []) => {
149
- let s = t;
150
- return f({
131
+ return t;
132
+ }, b = "load_skill", T = (e) => typeof e == "object" && e !== null && "name" in e && typeof e.name == "string" ? e.name : void 0, le = (e, s, t = []) => {
133
+ let o = s;
134
+ return k({
151
135
  name: "ActiveSkillMiddleware",
152
136
  wrapModelCall: async (r, n) => {
153
137
  const i = /* @__PURE__ */ new Set([
154
138
  b,
155
- ...o,
156
- ...s?.allowedTools ?? []
139
+ ...t,
140
+ ...o?.allowedTools ?? []
157
141
  ]);
158
142
  return await n({
159
143
  ...r,
@@ -167,37 +151,37 @@ const se = async (e) => {
167
151
  const i = await n(r);
168
152
  if (r.toolCall.name === b) {
169
153
  const l = T(r.toolCall.args), a = l ? e.get(l) : void 0;
170
- a && (s = a);
154
+ a && (o = a);
171
155
  }
172
156
  return i;
173
157
  }
174
158
  });
175
- }, me = async (e, t = {}) => {
176
- const o = new Set([...e.values()].flatMap((s) => s.allowedTools));
159
+ }, ce = async (e, s = {}) => {
160
+ const t = new Set([...e.values()].flatMap((o) => o.allowedTools));
177
161
  return await Promise.all(
178
- [...o].map(async (s) => {
179
- const r = t[s], n = r ? await r() : await Y(s);
180
- if (n.name !== s)
181
- throw new Error(`Skill tool "${s}" resolved to "${n.name}".`);
162
+ [...t].map(async (o) => {
163
+ const r = s[o], n = r ? await r() : await W(o);
164
+ if (n.name !== o)
165
+ throw new Error(`Skill tool "${o}" resolved to "${n.name}".`);
182
166
  return n;
183
167
  })
184
168
  );
185
- }, pe = async (e, t = {}) => {
186
- const o = await de(e), s = [...o.values()];
187
- if (s.length === 0)
169
+ }, de = async (e, s = {}) => {
170
+ const t = await ie(e), o = [...t.values()];
171
+ if (o.length === 0)
188
172
  throw new Error("createSkillRuntime requires at least one skill.");
189
- const r = [ie], n = new Set(r.map((a) => a.name));
190
- for (const a of s) {
191
- const w = a.allowedTools.find((k) => n.has(k));
192
- if (w)
173
+ const r = [re], n = new Set(r.map((a) => a.name));
174
+ for (const a of o) {
175
+ const h = a.allowedTools.find((f) => n.has(f));
176
+ if (h)
193
177
  throw new Error(
194
- `Skill "${a.name}" must not declare framework tool "${w}" in allowed-tools; it is provided automatically.`
178
+ `Skill "${a.name}" must not declare framework tool "${h}" in allowed-tools; it is provided automatically.`
195
179
  );
196
180
  }
197
- const i = await me(o, t), l = s.length === 1 ? s[0] : void 0;
181
+ const i = await ce(t, s), l = o.length === 1 ? o[0] : void 0;
198
182
  return {
199
- activeSkillMiddleware: ue(
200
- o,
183
+ activeSkillMiddleware: le(
184
+ t,
201
185
  l,
202
186
  r.map((a) => a.name)
203
187
  ),
@@ -205,13 +189,13 @@ const se = async (e) => {
205
189
  ${l.name}
206
190
 
207
191
  ${l.instructions}` : `Available skills:
208
- ${s.map((a) => `- ${a.name}: ${a.description}`).join(`
192
+ ${o.map((a) => `- ${a.name}: ${a.description}`).join(`
209
193
  `)}
210
194
 
211
195
  Call load_skill before using a skill and follow its instructions. Framework tools and the active skill's tools are available. Switch skills when another skill is needed to complete the task.`,
212
- tools: l ? [...r, ...i] : [le(o), ...r, ...i]
196
+ tools: l ? [...r, ...i] : [ae(t), ...r, ...i]
213
197
  };
214
- }, v = G.Root({ ...H() }), he = m.object({
198
+ }, v = G.Root({ ...H() }), ue = m.object({
215
199
  agentExecutionContext: m.custom()
216
200
  }), x = m.object({
217
201
  outcome: m.enum(["completed", "blocked"]).describe(
@@ -223,34 +207,34 @@ Call load_skill before using a skill and follow its instructions. Framework tool
223
207
  summary: m.string().describe(
224
208
  "A concise orchestration summary. For a blocker, identify the missing prerequisite and capability needed."
225
209
  )
226
- }), $e = ({
210
+ }), be = ({
227
211
  id: e,
228
- name: t,
229
- description: o,
230
- systemPrompt: s,
212
+ name: s,
213
+ description: t,
214
+ systemPrompt: o,
231
215
  skillLoaders: r,
232
216
  toolLoaders: n,
233
217
  modelTier: i = "default",
234
218
  runtimeContextLoader: l,
235
219
  instructions: a
236
220
  }) => {
237
- const w = async (y, u) => {
238
- const N = await R({
221
+ const h = async (y, u) => {
222
+ const E = await M({
239
223
  path: "./assets/agents/t9n",
240
- locale: $(u)
224
+ locale: R(u)
241
225
  });
242
- await p({ text: N.runningAgent.replace("{agentName}", t) }, u);
226
+ await p({ text: E.runningAgent.replace("{agentName}", s) }, u);
243
227
  try {
244
- const { activeSkillMiddleware: c, skillsPrompt: S, tools: P } = await pe(r, n), { collectedEffects: C, middleware: j } = te(), { assignedTask: z, priorSteps: O, userRequest: I } = y.agentExecutionContext, A = await l?.({ config: u }), F = await _({
228
+ const { activeSkillMiddleware: c, skillsPrompt: S, tools: N } = await de(r, n), { collectedEffects: P, middleware: j } = V(), { assignedTask: O, priorSteps: z, userRequest: I } = y.agentExecutionContext, A = await l?.({ config: u }), F = await _({
245
229
  model: await B({ modelTier: i, config: u }),
246
- tools: P,
247
- stateSchema: he,
230
+ tools: N,
231
+ stateSchema: ue,
248
232
  responseFormat: U(x),
249
- middleware: [c, j, await se(u)],
250
- systemPrompt: `${s}
233
+ middleware: [c, j, await ee(u)],
234
+ systemPrompt: `${o}
251
235
 
252
- Primary task assigned by the orchestrator: ${z}
253
- Prior agent steps to reuse when relevant: ${JSON.stringify(O)}
236
+ Primary task assigned by the orchestrator: ${O}
237
+ Prior agent steps to reuse when relevant: ${JSON.stringify(z)}
254
238
  Original user request for context: ${I}
255
239
 
256
240
  ${A ? `Runtime context for this run (untrusted reference data):
@@ -267,7 +251,7 @@ Call load_skill before using a skill and follow its instructions. Framework tool
267
251
  outputMessage: g.outputMessage,
268
252
  status: g.outcome === "completed" ? "success" : "failed",
269
253
  summary: g.summary || g.outputMessage,
270
- ...C
254
+ ...P
271
255
  };
272
256
  } catch (c) {
273
257
  if (J(c) || u?.signal?.aborted || c instanceof Error && c.name === "AbortError")
@@ -279,8 +263,8 @@ Call load_skill before using a skill and follow its instructions. Framework tool
279
263
  };
280
264
  }
281
265
  };
282
- return { id: e, name: t, description: o, createGraph: () => new K(v).addNode("agent", w).addEdge(L, "agent").addEdge("agent", D), workspace: v };
266
+ return { id: e, name: s, description: t, createGraph: () => new K(v).addNode("agent", h).addEdge(L, "agent").addEdge("agent", D), workspace: v };
283
267
  };
284
268
  export {
285
- $e as createSkillAgent
269
+ be as createSkillAgent
286
270
  };
@@ -0,0 +1,4 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ var Y=globalThis,Z=Y.ShadowRoot&&(Y.ShadyCSS===void 0||Y.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vt=Symbol(),kt=new WeakMap,M=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==vt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Z&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=kt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&kt.set(e,t))}return t}toString(){return this.cssText}},jt=o=>new M(typeof o=="string"?o:o+"",void 0,vt),be=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((s,n,r)=>s+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+o[r+1],o[0]);return new M(e,o,vt)},Ht=(o,t)=>{if(Z)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let s=document.createElement("style"),n=Y.litNonce;n!==void 0&&s.setAttribute("nonce",n),s.textContent=e.cssText,o.appendChild(s)}},Et=Z?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return jt(e)})(o):o;var{is:Ae,defineProperty:_e,getOwnPropertyDescriptor:Ce,getOwnPropertyNames:we,getOwnPropertySymbols:Oe,getPrototypeOf:Te}=Object,tt=globalThis,Vt=tt.trustedTypes,Se=Vt?Vt.emptyScript:"",Pe=tt.reactiveElementPolyfillSupport,k=(o,t)=>o,X={toAttribute(o,t){switch(t){case Boolean:o=o?Se:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},j=(o,t)=>!Ae(o,t),zt={attribute:!0,type:String,converter:X,reflect:!1,useDefault:!1,hasChanged:j};Symbol.metadata??=Symbol("metadata"),tt.litPropertyMetadata??=new WeakMap;var A=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=zt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),n=this.getPropertyDescriptor(t,s,e);n!==void 0&&_e(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){let{get:n,set:r}=Ce(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:n,set(i){let a=n?.call(this);r?.call(this,i),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??zt}static _$Ei(){if(this.hasOwnProperty(k("elementProperties")))return;let t=Te(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(k("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(k("properties"))){let e=this.properties,s=[...we(e),...Oe(e)];for(let n of s)this.createProperty(n,e[n])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,n]of e)this.elementProperties.set(s,n)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let n=this._$Eu(e,s);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let n of s)e.unshift(Et(n))}else t!==void 0&&e.push(Et(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ht(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){let s=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,s);if(n!==void 0&&s.reflect===!0){let r=(s.converter?.toAttribute!==void 0?s.converter:X).toAttribute(e,s.type);this._$Em=t,r==null?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(t,e){let s=this.constructor,n=s._$Eh.get(t);if(n!==void 0&&this._$Em!==n){let r=s.getPropertyOptions(n),i=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:X;this._$Em=n;let a=i.fromAttribute(e,r.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(t,e,s,n=!1,r){if(t!==void 0){let i=this.constructor;if(n===!1&&(r=this[t]),s??=i.getPropertyOptions(t),!((s.hasChanged??j)(r,e)||s.useDefault&&s.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:n,wrapped:r},i){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),r!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),n===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[n,r]of this._$Ep)this[n]=r;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[n,r]of s){let{wrapped:i}=r,a=this[n];i!==!0||this._$AL.has(n)||a===void 0||this.C(n,void 0,r,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[k("elementProperties")]=new Map,A[k("finalized")]=new Map,Pe?.({ReactiveElement:A}),(tt.reactiveElementVersions??=[]).push("2.1.2");var bt=globalThis,Bt=o=>o,et=bt.trustedTypes,Wt=et?et.createPolicy("lit-html",{createHTML:o=>o}):void 0,At="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,_t="?"+_,Ne=`<${_t}>`,T=document,V=()=>T.createComment(""),z=o=>o===null||typeof o!="object"&&typeof o!="function",Ct=Array.isArray,Jt=o=>Ct(o)||typeof o?.[Symbol.iterator]=="function",$t=`[
3
+ \f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ft=/-->/g,qt=/>/g,w=RegExp(`>|${$t}(?:([^\\s"'>=/]+)(${$t}*=${$t}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Gt=/'/g,Kt=/"/g,Yt=/^(?:script|style|textarea|title)$/i,wt=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),us=wt(1),fs=wt(2),ms=wt(3),f=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Qt=new WeakMap,O=T.createTreeWalker(T,129);function Zt(o,t){if(!Ct(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wt!==void 0?Wt.createHTML(t):t}var Xt=(o,t)=>{let e=o.length-1,s=[],n,r=t===2?"<svg>":t===3?"<math>":"",i=H;for(let a=0;a<e;a++){let c=o[a],h,u,l=-1,m=0;for(;m<c.length&&(i.lastIndex=m,u=i.exec(c),u!==null);)m=i.lastIndex,i===H?u[1]==="!--"?i=Ft:u[1]!==void 0?i=qt:u[2]!==void 0?(Yt.test(u[2])&&(n=RegExp("</"+u[2],"g")),i=w):u[3]!==void 0&&(i=w):i===w?u[0]===">"?(i=n??H,l=-1):u[1]===void 0?l=-2:(l=i.lastIndex-u[2].length,h=u[1],i=u[3]===void 0?w:u[3]==='"'?Kt:Gt):i===Kt||i===Gt?i=w:i===Ft||i===qt?i=H:(i=w,n=void 0);let v=i===w&&o[a+1].startsWith("/>")?" ":"";r+=i===H?c+Ne:l>=0?(s.push(h),c.slice(0,l)+At+c.slice(l)+_+v):c+_+(l===-2?a:v)}return[Zt(o,r+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},B=class o{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let r=0,i=0,a=t.length-1,c=this.parts,[h,u]=Xt(t,e);if(this.el=o.createElement(h,s),O.currentNode=this.el.content,e===2||e===3){let l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(n=O.nextNode())!==null&&c.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let l of n.getAttributeNames())if(l.endsWith(At)){let m=u[i++],v=n.getAttribute(l).split(_),C=/([.?@])?(.*)/.exec(m);c.push({type:1,index:r,name:C[2],strings:v,ctor:C[1]==="."?ot:C[1]==="?"?nt:C[1]==="@"?rt:P}),n.removeAttribute(l)}else l.startsWith(_)&&(c.push({type:6,index:r}),n.removeAttribute(l));if(Yt.test(n.tagName)){let l=n.textContent.split(_),m=l.length-1;if(m>0){n.textContent=et?et.emptyScript:"";for(let v=0;v<m;v++)n.append(l[v],V()),O.nextNode(),c.push({type:2,index:++r});n.append(l[m],V())}}}else if(n.nodeType===8)if(n.data===_t)c.push({type:2,index:r});else{let l=-1;for(;(l=n.data.indexOf(_,l+1))!==-1;)c.push({type:7,index:r}),l+=_.length-1}r++}}static createElement(t,e){let s=T.createElement("template");return s.innerHTML=t,s}};function S(o,t,e=o,s){if(t===f)return t;let n=s!==void 0?e._$Co?.[s]:e._$Cl,r=z(t)?void 0:t._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),r===void 0?n=void 0:(n=new r(o),n._$AT(o,e,s)),s!==void 0?(e._$Co??=[])[s]=n:e._$Cl=n),n!==void 0&&(t=S(o,n._$AS(o,t.values),n,s)),t}var st=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,n=(t?.creationScope??T).importNode(e,!0);O.currentNode=n;let r=O.nextNode(),i=0,a=0,c=s[0];for(;c!==void 0;){if(i===c.index){let h;c.type===2?h=new L(r,r.nextSibling,this,t):c.type===1?h=new c.ctor(r,c.name,c.strings,this,t):c.type===6&&(h=new it(r,this,t)),this._$AV.push(h),c=s[++a]}i!==c?.index&&(r=O.nextNode(),i++)}return O.currentNode=T,n}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},L=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=S(this,t,e),z(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==f&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Jt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&z(this._$AH)?this._$AA.nextSibling.data=t:this.T(T.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,n=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=B.createElement(Zt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===n)this._$AH.p(e);else{let r=new st(n,this),i=r.u(this.options);r.p(e),this.T(i),this._$AH=r}}_$AC(t){let e=Qt.get(t.strings);return e===void 0&&Qt.set(t.strings,e=new B(t)),e}k(t){Ct(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,n=0;for(let r of t)n===e.length?e.push(s=new o(this.O(V()),this.O(V()),this,this.options)):s=e[n],s._$AI(r),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let s=Bt(t).nextSibling;Bt(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,r){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,n){let r=this.strings,i=!1;if(r===void 0)t=S(this,t,e,0),i=!z(t)||t!==this._$AH&&t!==f,i&&(this._$AH=t);else{let a=t,c,h;for(t=r[0],c=0;c<r.length-1;c++)h=S(this,a[s+c],e,c),h===f&&(h=this._$AH[c]),i||=!z(h)||h!==this._$AH[c],h===d?t=d:t!==d&&(t+=(h??"")+r[c+1]),this._$AH[c]=h}i&&!n&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ot=class extends P{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},nt=class extends P{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},rt=class extends P{constructor(t,e,s,n,r){super(t,e,s,n,r),this.type=5}_$AI(t,e=this){if((t=S(this,t,e,0)??d)===f)return;let s=this._$AH,n=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==d&&(s===d||n);n&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},it=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t)}},te={M:At,P:_,A:_t,C:1,L:Xt,R:st,D:Jt,V:S,I:L,H:P,N:nt,U:rt,B:ot,F:it},De=bt.litHtmlPolyfillSupport;De?.(B,L),(bt.litHtmlVersions??=[]).push("3.3.2");var Ot=(o,t,e)=>{let s=e?.renderBefore??t,n=s._$litPart$;if(n===void 0){let r=e?.renderBefore??null;s._$litPart$=n=new L(t.insertBefore(V(),r),r,void 0,e??{})}return n._$AI(o),n};var Tt=globalThis,E=class extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ot(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return f}};E._$litElement$=!0,E.finalized=!0,Tt.litElementHydrateSupport?.({LitElement:E});var xe=Tt.litElementPolyfillSupport;xe?.({LitElement:E});(Tt.litElementVersions??=[]).push("4.2.2");var ee=new Set,se;var oe=o=>typeof o=="string"?o:"el"in o?o.el.localName:"localName"in o?o.localName:o.declaredClass,Ss=(o,t,e,s)=>{let n=oe(t);if(s?.once){let i=`${o}${n}${e}`;if(ee.has(i))return;ee.add(i)}let r;if(s?.detail){r={};for(let[i,a]of Object.entries(s.detail))if((typeof a=="object"||typeof a=="function")&&a!==null){let c=new WeakRef(a);Object.defineProperty(r,i,{enumerable:!0,get(){return c.deref()}})}else r[i]=a;se?.log.interceptors?.forEach(i=>i(o,n,e,r)),console[o](`[${n}]: ${e}`,r)}else se?.log.interceptors?.forEach(i=>i(o,n,e)),console[o](`[${n}]: ${e}`)},ne=o=>{let t=`[${oe(o)}] `;return e=>{let s=e instanceof Error&&e.message?e:new Error(String(e));s.message=`${t}${s.message}`,setTimeout(()=>{throw e})}};var p=(o,t,...e)=>{try{return o?.call(t,...e)}catch(s){console.error(s,o)}},W=async(o,t,...e)=>{try{return await o?.call(t,...e)}catch(s){console.error(s,o)}};var q=Symbol.for("controller"),Le=o=>typeof o=="object"&&o!==null&&(q in o||"hostConnected"in o||"hostDisconnected"in o||"hostUpdate"in o||"hostUpdated"in o),Ds=o=>typeof o?.then=="function";var F,D=o=>{F!==o&&(F=o,queueMicrotask(()=>F===o?F=void 0:0))},G=o=>F,N=[],ct=o=>{if(o===void 0){N=[];return}let t=N.indexOf(o);N=t===-1?[...N,o]:N.slice(0,t+1),queueMicrotask(()=>N=[])},re=()=>N,U,xs=o=>{U!==o&&(U=o,queueMicrotask(()=>U===o?U=void 0:0))},Ue=()=>{let o=U;return U=void 0,o},ie=async(o,t)=>{let e=lt(o);if(e===void 0)return o;if(await e.ready,typeof t=="function"){let s=e.watchExports(n=>t(n,s))}return e.exports},ae=async o=>{let t=lt(o);return await t.ready,t},lt=o=>{let e=G().manager.X(o);if(e!==void 0)return e;if(Le(o))return o;let s=Ue();if(s!==void 0)return s},at=!1,Ls=o=>{at=!0;try{return o()}finally{at=!1}};var b=class{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}};var ce=(o,t)=>{let e=t>Re?Ie:t/Me,s=0,n=setInterval(()=>{s+=e,s>=t&&(clearInterval(n),o())},e);return n},Re=4e3,Ie=2e3,Me=4;var ke=(o,t,e)=>{let s=Object.keys(o),n=s.length;R===void 0&&queueMicrotask(I),R??=new Map;let r=R.get(o);return r===void 0&&(r={callbacks:[],keyCount:n},R.set(o,r)),r.keyCount!==n&&(r.callbacks.forEach(i=>i(s)),r.callbacks=[],r.keyCount=n),r.callbacks.push(i=>{let a=h=>p(t,null,h),c=i[n];c===void 0?a(void 0):o[c]===e?a(c):a(void 0)}),e},R,I=()=>{R?.forEach(({callbacks:o},t)=>{let e=Object.keys(t);o.forEach(s=>s(e))}),R=void 0},je=(o,t,e)=>{let s=o.manager;return s.V!==d&&s.V!==e&&s.S(void 0,void 0),s.T.length===0&&queueMicrotask(()=>s.S(void 0,void 0)),s.V=e,s.T.push((n,r)=>p(t,void 0,e===r?n:void 0)),e},He=(o=[G(),...re()],t,e)=>{let s=Array.isArray(o)?o:[o],n=s.length+1,r=i=>{n-=1,i!==void 0&&(n=Math.min(n,0)),n===0&&t(i)};s.forEach(i=>ke(i,a=>r(a===void 0?void 0:{key:a,host:i,isReactive:!1}),e));for(let i of s)if("manager"in i&&i.manager.component===i){je(i,a=>r(a===void 0?void 0:{key:a,host:i,isReactive:!0}),e);break}return e},Ve=(o="",t={},e=G())=>{let s={emit:n=>{o===""&&I();let r=new CustomEvent(o,{detail:n,cancelable:!0,bubbles:!0,composed:!0,...t});return e.el.dispatchEvent(r),r}};return o===""&&He(void 0,n=>o=n.key,s),s},ze=Ve.bind(null,""),de;de=q;var St=class{constructor(t){this.#t=[],this.#e=[],this.#s=[],this.#n=[],this.#r=[],this.#c=[],this.#l=[],this.#d=[],this.#i=[],this.#p=!1,this.P=new b,this.connectedCalled=!1,this.loadedCalled=!1,this[de]=!0,this.#h=[];let e=this,s=t??G(new.target.name);e.#o=s,e.ready=e.P.promise,e.#a=he(e),e.component=s,e.#o.addController(e),e.#o.manager===void 0||(ct(e),queueMicrotask(()=>e.catchUpLifecycle()))}#t;#e;#s;#n;#r;#c;#l;#d;#i;#p;#o;catchUpLifecycle(){let{manager:t}=this.#o;t.connectedCalled&&!this.connectedCalled&&this.triggerConnected(),t.#p&&this.triggerLoad().then(()=>t.loadedCalled&&this.triggerLoaded()).catch(ne(this.#o))}#a;get exports(){return this.#a}set exports(t){let e=this.#a;e!==t&&(this.#a=t,this.#h.forEach(p),this.connectedCalled&&this.O!==!1&&this.#o.requestUpdate(this.O,e)),this.P.resolve(t)}setProvisionalExports(t,e=!0){this.#a=e?he(t):t,this.#h.forEach(p)}#h;watchExports(t){let e=()=>t(this.#a);return this.#h.push(e),()=>{this.#h.splice(this.#h.indexOf(e),1)}}get use(){return D(this.#o),ie}get useRef(){return D(this.#o),ae}get useRefSync(){return D(this.#o),lt}controllerRemoved(){this.#o.el.isConnected&&this.triggerDisconnected(),this.triggerDestroy()}onConnected(t){this.#t.push(t)}onDisconnected(t){this.#e.push(t)}onLoad(t){this.#s.push(t)}onLoaded(t){this.#n.push(t)}onUpdate(t){this.#r.push(t)}onUpdated(t){this.#c.push(t)}onDestroy(t){this.#l.push(t)}onLifecycle(t){this.#d.push(t),this.connectedCalled&&this.#o.el.isConnected&&this.#u(t)}triggerConnected(){let t=this;t.hostConnected&&p(t.hostConnected,t),t.#t.forEach(p),t.triggerLifecycle(),t.connectedCalled=!0}triggerDisconnected(){let t=this;t.hostDisconnected&&p(t.hostDisconnected,t),t.#e.forEach(p),t.#i.forEach(p),t.#i=[]}async triggerLoad(){if(this.#p)return;this.#p=!0;let t=this;t.hostLoad&&await W(t.hostLoad,t),this.#s.length>0&&await Promise.allSettled(this.#s.map(W)),this.P.resolve(this.#a)}triggerLoaded(){this.loadedCalled||(this.hostLoaded&&p(this.hostLoaded,this),this.#n.forEach(p),this.loadedCalled=!0)}triggerUpdate(t){this.hostUpdate&&p(this.hostUpdate,this,t),this.#r.forEach(le,t)}triggerUpdated(t){this.hostUpdated&&p(this.hostUpdated,this,t),this.#c.forEach(le,t)}triggerDestroy(){this.hostDestroy&&p(this.hostDestroy,this),this.#l.forEach(p)}triggerLifecycle(){this.hostLifecycle&&this.#u(()=>this.hostLifecycle()),this.#d.forEach(this.#u,this)}#u(t){D(this.#o);let e=p(t);(Array.isArray(e)?e:[e]).forEach(n=>{typeof n=="function"?this.#i.push(n):typeof n=="object"&&typeof n.remove=="function"&&this.#i.push(n.remove)})}};function le(o){p(o,void 0,this)}var he=o=>{if(typeof o!="object"&&typeof o!="function"||o===null)return o;let t={get(s,n,r){if(!((n==="exports"||n==="_exports")&&n in s&&s[n]===e)&&(n in s||n in Promise.prototype||typeof n=="symbol"))return typeof s=="function"?s[n]:Reflect.get(s,n,r)}},e=new Proxy(o,t);return e};var pe=St;var ht=o=>o.replace(Be,(t,e)=>`${e===0?"":"-"}${t.toLowerCase()}`),Be=/[A-Z]+(?![a-z])|[A-Z]/gu;var We="randomUUID"in crypto,Bs=()=>{if(We)return crypto.randomUUID();let o=crypto.getRandomValues(new Uint16Array(8));o[3]=o[3]&4095|16384,o[4]=o[4]&16383|32768;let t=e=>o[e].toString(16).padStart(4,"0");return`${t(0)+t(1)}-${t(2)}-${t(3)}-${t(4)}-${t(5)}${t(6)}${t(7)}`};var{I:qs}=te;var dt=o=>o.strings===void 0;var Fe={},ue=(o,t=Fe)=>o._$AH=t;var y={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},$=o=>(...t)=>({_$litDirective$:o,values:t}),g=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var K=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),K(s,t);return!0},pt=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},fe=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),Ke(t)}};function qe(o){this._$AN!==void 0?(pt(this),this._$AM=o,fe(this)):this._$AM=o}function Ge(o,t=!1,e=0){let s=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(s))for(let r=e;r<s.length;r++)K(s[r],!1),pt(s[r]);else s!=null&&(K(s,!1),pt(s));else K(this,o)}var Ke=o=>{o.type==y.CHILD&&(o._$AP??=Ge,o._$AQ??=qe)},ut=class extends g{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),fe(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(K(this,t),pt(this))}setValue(t){if(dt(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var so=()=>new Nt,Nt=class{},Pt=new WeakMap,Dt=$(class extends ut{render(o){return d}update(o,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),d}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Pt.get(t);e===void 0&&(e=new WeakMap,Pt.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?Pt.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Lt=o=>{let t=o;for(;t=t.parentNode??t.host;)if(t?.constructor?.lumina){let e=t;return e.manager?.loadedCalled||(e.J??e._offspring).push(o),(e.I??e._postLoad).promise}return!1},Ut={};function Rt(){}function It(o){for(let t of["Associated","Disabled","Reset","StateRestore"]){let e=`orm${t}Callback`;o.prototype["f"+e]=async function(...s){await this.componentOnReady(),(this.el??this).dispatchEvent(new CustomEvent(`luminaF${e}`,{detail:s}))}}}var Je=(o,t)=>function(s,n){if(!globalThis.customElements)return;let i=(n??s??{}).resourcesUrl;i&&o.setAssetPath(i);for(let[a,[c,h="",u=0]]of Object.entries(t)){if(customElements.get(a))continue;let[l,m,v]=h.split(";"),C=l?l?.split(",").map(Ye):void 0,gt=C?.map(([x])=>x),J=class extends xt{static{this.formAssociated=u===1}static{this.observedAttributes=C?.map(([,x])=>x).filter(x=>x!=="")}static{this.C=gt}static{this.E=m?m?.split(","):void 0}static{this.D=v?.split(",")}static{this.L=a}static{this.K=o}constructor(){!J.B&&(J.B=c(),J.F()),super()}};customElements.define(a,J)}},ft=Object.defineProperty,Ye=o=>{let t=o.split(":");return t.length===1?[t[0],ht(t[0])]:t},Ze=globalThis.HTMLElement??Rt,xt=class extends Ze{constructor(){super(),this.#e={},this.#s=[],this.I=new b,this.H=new b,this.J=[];let t=this,e=t.constructor;t._offspring=t.J,t._postLoad=t.I,e.C?.forEach(s=>{Object.hasOwn(t,s)&&(t.#e[s]=t[s],delete t[s])}),e.A?t.#n({a:e.A}):e.B.then(async s=>{await e.K.p,t.#n(await(s.default?.then(n=>typeof n=="function"?{a:n}:n)??s))}).catch(s=>{t.H.reject(s),setTimeout(()=>{throw s})})}static{this.lumina=!0}static F(){for(let t of this.C??[])ft(this.prototype,t,{configurable:!0,enumerable:!0,get(){return this.#e[t]},set(e){this.#e[t]=e}});for(let t of this.E??[])ft(this.prototype,t,{async value(...e){return this.#t||await this.H.promise,await this.#t[t](...e)},configurable:!0});for(let t of this.D??[])ft(this.prototype,t,{value(...e){return this.#t[t](...e)},configurable:!0})}static{It(this)}#t;#e;#s;get manager(){return this.#t?.manager}attributeChangedCallback(t,e,s){this.#t?.attributeChangedCallback(t,e,s),this.#t||this.#s.push(t)}connectedCallback(){this.#t?this.#t.connectedCallback?.():queueMicrotask(()=>this.G=Lt(this))}disconnectedCallback(){this.#t?.disconnectedCallback?.()}async componentOnReady(){return await this.H.promise,this}#n(t){let e=this.constructor,s=e.L,n=this.#e,r=Object.values(t).find(l=>l.L===s),i=`${s}--lazy`,a=r;for(;a&&!Object.hasOwn(a,"lumina");)a=Object.getPrototypeOf(a);ts(a),!e.A&&(e.A=r,customElements.define(i,r)),r.N=this;let h=document.createElement(i);r.N=void 0,this.#t=h,this.#e=h,this.#s.forEach(l=>h.attributeChangedCallback(l,null,this.getAttribute(l))),Object.entries(n).forEach(Xe,h);let u=this.isConnected;(u||this.G)&&(h.connectedCallback?.(),u||h.disconnectedCallback())}addController(){}requestUpdate(){this.#t?.requestUpdate()}};function Xe([o,t]){this[o]=t}var ts=o=>{let t=o.prototype,e=Element.prototype;Object.hasOwn(t,"isConnected")||(t.setAttribute=function(n,r){e.setAttribute.call(this.el,n,r)},t.removeAttribute=function(n){e.removeAttribute.call(this.el,n)},t.hasAttribute=function(n){return e.hasAttribute.call(this.el,n)},ft(t,"isConnected",{get(){return Reflect.get(e,"isConnected",this.el)}}))};var mt=class extends pe{constructor(t){super(t),this.destroyed=!1,this.R=!1,this.V=d,this.T=[],this.#s=new WeakMap,this.#e=t,this.exports=void 0,this.hasDestroy=yt in t&&typeof t.destroy=="function",E.prototype.addController.call(t,{hostConnected:()=>{if(this.destroyed){let e=t.el.localName;throw t.el.remove(),new Error(`The ${e} component has already been destroyed. It cannot be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the ${yt} prop.`)}this.#t!==void 0&&clearTimeout(this.#t),I();for(let e of t.M)"triggerConnected"in e?e.triggerConnected():p(e.hostConnected,e)},hostDisconnected:()=>{for(let e of t.M)"triggerDisconnected"in e?e.triggerDisconnected():p(e.hostDisconnected,e);this.hasDestroy&&!this.destroyed&&this.U()},hostUpdate:()=>{for(let e of t.M)"triggerUpdate"in e?e.triggerUpdate(this.Q):p(e.hostUpdate,e,this.Q)},hostUpdated:()=>{for(let e of t.M)"triggerUpdated"in e?e.triggerUpdated(this.Q):p(e.hostUpdated,e,this.Q);this.Q=void 0}}),queueMicrotask(()=>this.R=!0),ct(void 0),D(t)}#t;#e;async destroy(){if(!this.destroyed){this.#e.el.isConnected&&(this.hasDestroy=!1,this.#e.el.remove()),this.#t=void 0,this.destroyed=!0;for(let t of this.#e.M)"triggerDestroy"in t?t.triggerDestroy():p(t.hostDestroy,t);this.#e.M.splice(0)}}U(){if(this.#t!==void 0&&clearTimeout(this.#t),!this.#e.el.isConnected&&!this.#e.autoDestroyDisabled){let t=()=>{this.#e.destroy()};this.#t=ce(t,es)}}S(t,e){let s=this.T;this.V=d,this.T=[],s.forEach(n=>n(t,e))}#s;W(t,e){(typeof e=="object"&&e!==null||typeof e=="function")&&this.#s.set(e,t)}X(t){if(typeof t=="object"&&t!==null||typeof t=="function")return this.#s.get(t)}},es=1e3,yt="autoDestroyDisabled";var ye=$(class extends g{constructor(o){if(super(o),o.type!==y.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return" "+Object.keys(o).filter(t=>o[t]).join(" ")+" "}update(o,[t]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(let s in t)t[s]&&!this.nt?.has(s)&&this.st.add(s);return this.render(t)}let e=o.element.classList;for(let s of this.st)s in t||(e.remove(s),this.st.delete(s));for(let s in t){let n=!!t[s];n===this.st.has(s)||this.nt?.has(s)||(n?(e.add(s),this.st.add(s)):(e.remove(s),this.st.delete(s)))}return f}});var ge="important",ss=" !"+ge,os=$(class extends g{constructor(o){if(super(o),o.type!==y.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let s=o[e];return s==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let s of this.ft)t[s]==null&&(this.ft.delete(s),s.includes("-")?e.removeProperty(s):e[s]=null);for(let s in t){let n=t[s];if(n!=null){this.ft.add(s);let r=typeof n=="string"&&n.endsWith(ss);s.includes("-")||r?e.setProperty(s,r?n.slice(0,-11):n,r?ge:""):e[s]=n}}return f}});var ns=$(class extends g{constructor(o){if(super(o),o.type!==y.PROPERTY&&o.type!==y.ATTRIBUTE&&o.type!==y.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!dt(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[t]){if(t===f||t===d)return t;let e=o.element,s=o.name;if(o.type===y.PROPERTY){if(t===e[s])return f}else if(o.type===y.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(s))return f}else if(o.type===y.ATTRIBUTE&&e.getAttribute(s)===t+"")return f;return ue(o),t}});var ve=class o extends E{constructor(){super(),this.M=[],this.manager=new mt(this);let t=this,e=t.constructor,s=e.N,n=e.K.o,r=o.prototype.shouldUpdate;t.#n=s?.H??new b,t.I=s?.I??new b,t.J=s?.J??[],t._offspring=t.J,t._postLoad=t.I,t.el=s??t,t.#s=t.enableUpdating,t.enableUpdating=Rt,t.shouldUpdate!==r&&(t.#e=t.shouldUpdate,t.shouldUpdate=r),n&&(t.#t=new Map,e.elementProperties.forEach((i,a)=>t.#t.set(a,n()))),!1}static finalizeStyles(t){let e=super.finalizeStyles(t),s=this.shadowRootOptions===Ut;return this.K?.commonStyles===void 0||s?e:[this.K.commonStyles,...e]}static createProperty(t,e){let s=typeof e=="number"?e:Array.isArray(e)?e[0]:0,n=Array.isArray(e)?e[1]:void 0,r=n?.hasChanged??j,i={attribute:s&1&&typeof t=="string"?ht(t):!1,reflect:!!(s&2),type:s&4?Boolean:s&8?Number:void 0,state:!!(s&16),readOnly:!!(s&32),noAccessor:!!(s&64),useDefault:!!(s&128),c:!1,...n,hasChanged(a,c){let h=r(a,c);return i.c=h,h}};super.createProperty(t,i)}static getPropertyDescriptor(t,e,s){let n=this.K,r=super.getPropertyDescriptor(t,e,s);return s.d=r,{...r,get(){return n.t?.(this.#t.get(t)),r.get?.call(this)},set(i){let a=this.manager;if(s.readOnly&&!at&&(a.R||a.connectedCalled))throw Error(`Cannot assign to read-only property "${t}" of ${this.el.localName}. Trying to assign "${i}"`);r.set.call(this,i??void 0),s.c&&this.#t?.get(t)?.notify(),a.T.length>0&&(I(),a?.S(t,i))}}}static{this.lumina=!0}static{It(this)}#t;#e;#s;#n;#r;#c;get elementInternals(){return this.#c??=this.el.attachInternals(),this.#c}connectedCallback(){this.hasAttribute("defer-hydration")||this.#l(!0)}#l(t){let e=this.constructor.K.c?.(()=>this.requestUpdate());this.#r=e;let s=!this.manager.connectedCalled;t&&super.connectedCallback(),s?queueMicrotask(()=>this.#i().catch(n=>{this.#n.reject(n),setTimeout(()=>{throw n})})):e&&this.requestUpdate()}#d(t){try{this.#r.clear(),this.constructor.K.r(this.#r,()=>super.update(t))}catch(e){throw this.#r.clear(),e}}disconnectedCallback(){super.disconnectedCallback(),this.#r?.destroy(),this.#r=void 0}createRenderRoot(){let t=this.el.shadowRoot,e=this.constructor,s=e.shadowRootOptions,r=t??(s===Ut?this.el:this.el.attachShadow(s));if(t)return this.manager.connectedCalled||this.#l(!1),E.prototype.createRenderRoot.call(this),t;if(this.isConnected){let i=r.getRootNode();i.adoptedStyleSheets=[...i.adoptedStyleSheets,...e.elementStyles.map(a=>"styleSheet"in a?a.styleSheet:a)]}return r}async#i(){let t=this.el.G??Lt(this.el);t&&await t;let e=[];for(let n of this.M)"triggerLoad"in n?e.push(n.triggerLoad()):e.push(W(n.hostLoad,n));await Promise.all(e),await this.load?.(),this.manager.hasDestroy&&this.manager.onUpdate(n=>n.has(yt)&&this.manager.U()),this.#s(!0),this.performUpdate(),this.I.resolve(),await 0;let s=this.J.filter(n=>!n.manager?.loadedCalled);s.length&&await Promise.allSettled(s.map(async n=>await n.componentOnReady())),this.J.length=0,this.el.setAttribute(this.constructor.K.hydratedAttribute,"");for(let n of this.M)"triggerLoaded"in n?n.triggerLoaded():p(n.hostLoaded,n);this.loaded?.(),this.#n.resolve()}shouldUpdate(t){return this.manager.Q=t,this.#e?.(t)??!0}update(t){this.#r?this.#d(t):super.update(t)}listen(t,e,s){let n=e?.bind(this)??e;this.manager.onLifecycle(()=>(this.el.addEventListener(t,n,s),()=>this.el.removeEventListener(t,n,s)))}listenOn(t,e,s,n){let r=s?.bind(this)??s;this.manager.onLifecycle(()=>(t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)))}async componentOnReady(){return await this.#n.promise,this}addController(t){this.M.push(t),!(q in t)&&this.renderRoot&&this.el.isConnected&&t.hostConnected?.()}removeController(t){this.M.splice(this.M.indexOf(t),1),t.controllerRemoved?.()}};var $e=o=>{let t,e=n=>{t=new URL(n,globalThis.location?.href||void 0).href},s={...o,getAssetPath(n){let r=new URL(n,t);return r.origin!==globalThis.location?.origin?r.href:r.pathname},setAssetPath:e,customElement(n,r){r.K=s,r.L=n,customElements.get(n)||customElements.define(n,r)}};return e(o.defaultAssetPath),s};var wn=o=>typeof o=="object"&&o!=null?ye(o):o;var Mt=class extends g{#t;#e;constructor(t){super(t);let e=this;this.#e=function(n){return e.#t.call(this,n)}}render(t){return typeof t=="function"?(this.#t=t,Dt(this.#e)):Dt(t)}},On=$(Mt);var Tn=d;var Q=$e({defaultAssetPath:"https://jsdev.arcgis.com/5.2.0-next/ai-components/",hydratedAttribute:"hydrated"}),{customElement:xn,getAssetPath:Ln,setAssetPath:Un}=Q;Q.t=void 0;Q.o=void 0;Q.c=void 0;Q.r=void 0;export{Ds as a,D as b,ct as c,re as d,xs as e,Ls as f,be as g,us as h,f as i,d as j,Ss as k,ne as l,He as m,ze as n,St as o,Bs as p,Je as q,y as r,$ as s,g as t,so as u,Dt as v,ve as w,wn as x,Tn as y,Q as z,xn as A,Ln as B};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{b as $}from"./FGQLS3UX.js";import"./QUZTFUWM.js";import"./H4ERKWFA.js";import{A as S,g as b,h as u,n as v,u as m,v as f,w,x as _}from"./2DYOTV7W.js";import"./UZLQALHY.js";export default $arcgis.t(([q])=>{var R=b`:host{--calcite-text-area-border-color: var(--calcite-color-border-1);--calcite-text-area-divider-color: var(--calcite-color-border-1);--calcite-text-area-corner-radius: var(--calcite-border-radius)}.input-container{display:flex;flex-direction:column}.footer-start{display:flex;gap:var(--calcite-spacing-md);flex-wrap:wrap;align-items:center}.footer-end{display:flex;gap:var(--calcite-spacing-md);align-items:center}.focused{--calcite-text-area-shadow: var(--calcite-shadow-sm)}.suggestions-loading{padding:var(--calcite-spacing-sm)}`,P={suggestions:[],loading:!1,selectedIndex:0};function I(c){return c.filter(({trigger:t})=>t!==""&&t!=="/").sort((t,e)=>e.trigger.length-t.trigger.length)}var y=class{constructor(t){this._onStateChange=t}#t=null;#o;#e=P;get state(){return this.#e}get activeSuggestion(){return this.#o}get selectedSuggestion(){return this.#e.suggestions[this.#e.selectedIndex]}moveSelection(t){this.#a({selectedIndex:Math.max(0,Math.min(this.#e.selectedIndex+t,this.#e.suggestions.length-1))})}async update(t,e,i){this.#t?.abort();let s=this.#i(t,e,i);if(!s){this.close();return}let n=new AbortController;this.#t=n,this.#o=s,this.#a({suggestions:[],loading:!0,selectedIndex:0});try{let r=await s.provider.getSuggestions(s.query,n.signal);if(n.signal.aborted||this.#t!==n)return;this.#a({suggestions:r,loading:!1,selectedIndex:0})}catch{n.signal.aborted||this.close()}}async resolveTypedInputs(t,e,i,s){let n=await this.#s(t,e.commandProvider,i,s);return s.aborted?[]:(n.push(...await this.#r(t,e.entityProviders,i,s)),n)}close(){this.#t?.abort(),this.#t=null,this.#o=void 0,this.#a({suggestions:[],loading:!1,selectedIndex:0})}#i(t,e,i){if(e==null)return;let s=t.slice(0,e),n=s.slice(1);if(i.commandProvider&&s.startsWith("/")&&!/\s/u.test(n))return{kind:"command",provider:i.commandProvider,start:0,end:e,query:n};let r=I(i.entityProviders);for(let a of r){let l=s.lastIndexOf(a.trigger),o=s.slice(l+a.trigger.length);if(l!==-1&&a.trigger&&!/\s/u.test(o)&&(l===0||/\s/u.test(s[l-1]??"")))return{kind:"entity",provider:a,start:l,end:e,query:o}}}async#s(t,e,i,s){let n=/^\/([^\s]+)/u.exec(t);if(!n||!e)return[];let[r,a]=n;if(i.some(h=>h.start===0&&h.end===r.length))return[];let l=await e.getSuggestions(a,s);if(s.aborted)return[];let o=l.find(h=>h.id===a);return o?[{start:0,end:r.length,part:{kind:"command",id:o.id,label:o.label,agentId:o.agentId,requiresText:o.requiresText||void 0,data:o.data}}]:[]}async#r(t,e,i,s){let n=I(e),r=[];for(let a of t.matchAll(/(?:^|\s)(\S+)/gu)){let l=a[1],o=n.find(g=>l.startsWith(g.trigger));if(!o)continue;let h=a.index+a[0].length-l.length;if(i.some(g=>g.start===h&&g.end===h+l.length))continue;let d=l.slice(o.trigger.length);if(!d)continue;let k=await o.getSuggestions(d,s);if(s.aborted)return[];let p=k.find(g=>g.id===d);p&&r.push({start:h,end:h+l.length,part:{kind:"entity",providerId:o.id,trigger:o.trigger,id:p.id,label:p.label,data:p.data}})}return r}#a(t){this.#e={...this.#e,...t},this._onStateChange(this.#e)}};function V(c,t,e,i){if(c===t&&!i)return[...e];let s=0,n=Math.min(c.length,t.length,i?.start??c.length);for(;s<n&&c[s]===t[s];)s+=1;let r=c.length,a=t.length,l=Math.max(s,i?.end??s);for(;r>l&&a>s&&c[r-1]===t[a-1];)r-=1,a-=1;let o=a-r;return e.flatMap(h=>{let d=h.end<=s?h:h.start>=r?{...h,start:h.start+o,end:h.end+o}:void 0;return d&&(d.part.kind!=="command"||d.start===0)&&(d.start===0||/\s/u.test(t[d.start-1]))&&(d.end===t.length||/\s/u.test(t[d.end]))?[d]:[]})}function D(c,t){for(let e of[...t].reverse())e.part.kind==="command"&&(c=c.slice(0,e.start)+c.slice(e.end).replace(/^[\t ]+/u,""));return c.trim()}function E(c,t){let e=0;return t.flatMap(i=>{let s=i.kind==="command"?`/${i.id}`:`${i.trigger}${i.id}`,n=c.indexOf(s,e);return n===-1?[]:(e=n+s.length,[{start:n,end:e,part:i}])})}var x=class extends w{constructor(){super(...arguments),this.#t=m(),this.#o=m(),this.#i=new y(t=>this._suggestionState=t),this.#s=[],this.#r="",this.#a="",this.#d=()=>{let t=this.#t.value?.shadowRoot?.querySelector("textarea");this.#l=t?{start:t.selectionStart,end:t.selectionEnd}:void 0},this.#c=t=>{t.stopPropagation();let e=t.detail;this._setDraftValue(e.value),e.focusInput&&this.#t.value&&this.#t.value.setFocus()},this.#u=t=>{let e=t.target.value??"",i=this.#l;this.#l=void 0,this.#h(e,i),this.inputValue=e;let s=this.#t.value?.shadowRoot?.querySelector("textarea")?.selectionStart;this.#i.update(e,s,{commandProvider:this.commandProvider,entityProviders:this.entityProviders??[]})},this.#g=async t=>{if(!(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||this.keyboardShortcutsDisabled)){if(this._suggestionState.suggestions.length>0){if(t.key==="ArrowDown"){t.preventDefault(),this.#i.moveSelection(1);return}if(t.key==="ArrowUp"){t.preventDefault(),this.#i.moveSelection(-1);return}if(t.key==="Enter"){t.preventDefault(),await this.#f(this.#i.selectedSuggestion);return}if(t.key==="Escape"){t.preventDefault(),this.#i.close();return}}switch(t.key){case"Enter":t.preventDefault(),await this.submitMessage();break;case"ArrowUp":await this._navigateHistory("up",t);break;case"ArrowDown":await this._navigateHistory("down",t);break}}},this._messages=$({blocking:!0}),this._inFocus=!1,this._suggestionState=this.#i.state,this._textRequired=!1,this.keyboardShortcutsDisabled=!1,this.awaitingResponse=!1,this.voiceInputEnabled=!1,this.messages=new q([]),this.disabled=!1,this.entityProviders=[],this.arcgisCancel=v(),this.arcgisSubmit=v({cancelable:!0})}static{this.properties={_inFocus:16,_suggestionState:16,_textRequired:16,keyboardShortcutsDisabled:5,entryPlaceholder:1,awaitingResponse:5,inputValue:1,status:1,voiceInputEnabled:5,messages:0,disabled:5,commandProvider:0,entityProviders:0}}static{this.styles=R}#t;#o;#e;#i;#s;#r;#a;#n;#l;#d;#c;#u;#g;get inputValue(){return this.#a}set inputValue(t){t!==this.#a&&(this.#a=t,this.#n?.abort(),this.#n=void 0)}async submitMessage(){if(this.awaitingResponse){this.#n?.abort(),this.#n=void 0,this.arcgisCancel.emit();return}let t=this.inputValue;this.#h(t),this.#n?.abort();let e=new AbortController;this.#n=e;let i;try{if(i=await this.#i.resolveTypedInputs(t,{commandProvider:this.commandProvider,entityProviders:this.entityProviders??[]},this.#s,e.signal),e.signal.aborted||this.#n!==e)return}catch(a){if(e.signal.aborted)return;throw a}finally{this.#n===e&&(this.#n=void 0)}this.#s.push(...i.filter(a=>!this.#s.some(l=>l.start===a.start&&l.end===a.end)));let s=D(t,this.#s);if(this._textRequired=!s&&this.#s.some(a=>a.part.kind==="command"&&(a.part.requiresText??!1)),this._textRequired){await this.#t.value?.setFocus();return}let n=this.#p();if(!s&&n.length===0)return;let r={prompt:s,displayText:t.trim(),parts:n};this.arcgisSubmit.emit(r.parts.length?r:s).defaultPrevented||(this.inputValue="",this.#s=[],this.#r="",this.#e=void 0,this.#i.close(),this.#o.value?.clearDraftSession(),this.#t.value&&await this.#t.value.setFocus())}loaded(){this.manager.onLifecycle(()=>(this.el.addEventListener("arcgisVoiceInputDraftChange",this.#c),{remove:()=>{this.el.removeEventListener("arcgisVoiceInputDraftChange",this.#c)}}))}async _navigateHistory(t,e){let i=this.#t.value;if(!i)return;let s=this.messages.toArray().filter(h=>h.role==="user");if(s.length===0)return;let n=i.value??"",r=i.shadowRoot?.querySelector("textarea"),a=r?.selectionStart,l=r?.selectionEnd;if(a==null||l==null||a!==l||t==="up"&&a!==0||t==="down"&&a!==n.length)return;if(t==="up"){this.#e?this.#e.index=Math.max(0,this.#e.index-1):this.#e={index:s.length-1,draft:this.#y()},this.#v(s[this.#e.index]),e.preventDefault();return}let o=this.#e;o&&(o.index<s.length-1?(o.index+=1,this.#v(s[o.index])):(this.#e=void 0,this.#m(o.draft)),e.preventDefault())}#y(){return this.#h(this.inputValue),{value:this.inputValue,parts:this.#p()}}#p(){return this.#s.map(t=>t.part)}#v(t){let e=t.parts??[];this.#m({value:t.content,parts:e})}#m(t){this.inputValue=t.value,this.#r=t.value,this.#s=E(t.value,t.parts),this.#l=void 0,this._textRequired=!1,this.#i.close()}_setDraftValue(t){this.#i.close(),this.#s=[],this.#r=t,this.#l=void 0,this._textRequired=!1,this.inputValue=t,this.#e=void 0}#h(t,e){this._textRequired=!1,this.#s=V(this.#r,t,this.#s,e),this.#r=t}async#f(t){let e=this.#i.activeSuggestion;if(!t||!e)return;let i=`${e.kind==="command"?"/":e.provider.trigger}${t.id}`,s=`${this.inputValue.slice(0,e.start)}${i} ${this.inputValue.slice(e.end)}`;this.#h(s),this.#s.push({start:e.start,end:e.start+i.length,part:e.kind==="command"?{kind:"command",id:t.id,label:t.label,agentId:"agentId"in t?t.agentId:void 0,requiresText:"requiresText"in t&&t.requiresText||void 0,data:t.data}:{kind:"entity",providerId:e.provider.id,trigger:e.provider.trigger,id:t.id,label:t.label,data:t.data}}),this.#s.sort((a,l)=>a.start-l.start),this.inputValue=s,this.#e=void 0;let n=e.start+i.length+1;this.#i.close(),await this.updateComplete,await this.#t.value?.setFocus();let r=this.#t.value?.shadowRoot?.querySelector("textarea");r&&(r.selectionStart=n,r.selectionEnd=n)}_onFocusIn(){this._inFocus=!0}_onFocusOut(){this._inFocus=!1}#x(t){return t?u`<calcite-popover .open=${this._suggestionState.suggestions.length>0||this._suggestionState.loading} placement=top-start .label=${this._messages.suggestions} .referenceElement=${t} trigger-disabled pointer-disabled focus-trap-disabled><calcite-list .label=${this._messages.suggestions} selection-appearance=highlight selection-mode=single-persist .loading=${this._suggestionState.loading}>${this._suggestionState.loading?null:this._suggestionState.suggestions.map((e,i)=>u`<calcite-list-item .label=${e.label} .description=${e.description} .selected=${i===this._suggestionState.selectedIndex} @click=${()=>{this.#f(e)}}></calcite-list-item>`)}</calcite-list>${this._suggestionState.loading?u`<div class="suggestions-loading" role=status>${this._messages.loadingSuggestions}</div>`:null}</calcite-popover>`:null}render(){let t=this.#t.value;return u`<div class="input-container">${this._textRequired?u`<div role=alert>${this._messages.textRequired}</div>`:null}<calcite-text-area class=${_({focused:this._inFocus})} .value=${this.inputValue} .placeholder=${this.entryPlaceholder??this._messages.entryPlaceholder} resize=vertical @calciteTextAreaInput=${this.#u} @beforeinput=${this.#d} .status=${this._textRequired?"invalid":"idle"} .disabled=${this.disabled} @keydown=${this.#g} @focusin=${this._onFocusIn} @focusout=${this._onFocusOut} ${f(this.#t)}><div slot=footer-start class="footer-start"><slot name=entry-actions-start></slot></div><div slot=footer-end class="footer-end">${this.voiceInputEnabled?u`<arcgis-assistant-speech-input .awaitingResponse=${this.awaitingResponse} .inputValue=${this.inputValue} ${f(this.#o)}></arcgis-assistant-speech-input>`:null}<slot name=entry-actions-end></slot></div></calcite-text-area>${this.#x(t)}</div>`}};S("arcgis-assistant-chat-entry",x);return x},"core/Collection")