@nonoun/native-chat 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/avatar/chat-avatar-element.d.ts +18 -0
  2. package/dist/avatar/chat-avatar-element.d.ts.map +1 -0
  3. package/dist/avatar/index.d.ts +2 -0
  4. package/dist/avatar/index.d.ts.map +1 -0
  5. package/dist/avatar/n-chat-avatar.d.ts +2 -0
  6. package/dist/avatar/n-chat-avatar.d.ts.map +1 -0
  7. package/dist/chat-input-element.d.ts +10 -0
  8. package/dist/chat-input-element.d.ts.map +1 -1
  9. package/dist/chat-input-structured-element-CbDnI4zv.js +1069 -0
  10. package/dist/chat-panel-element.d.ts +28 -7
  11. package/dist/chat-panel-element.d.ts.map +1 -1
  12. package/dist/feed/chat-feed-element.d.ts +29 -0
  13. package/dist/feed/chat-feed-element.d.ts.map +1 -0
  14. package/dist/feed/index.d.ts +2 -0
  15. package/dist/feed/index.d.ts.map +1 -0
  16. package/dist/feed/n-chat-feed.d.ts +2 -0
  17. package/dist/feed/n-chat-feed.d.ts.map +1 -0
  18. package/dist/index.d.ts +7 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/message/chat-input-structured-element.d.ts +43 -0
  21. package/dist/message/chat-input-structured-element.d.ts.map +1 -0
  22. package/dist/message/chat-message-activity-element.d.ts +32 -0
  23. package/dist/message/chat-message-activity-element.d.ts.map +1 -0
  24. package/dist/message/chat-message-element.d.ts +28 -0
  25. package/dist/message/chat-message-element.d.ts.map +1 -0
  26. package/dist/message/chat-message-genui-element.d.ts +45 -0
  27. package/dist/message/chat-message-genui-element.d.ts.map +1 -0
  28. package/dist/message/chat-message-seed-element.d.ts +33 -0
  29. package/dist/message/chat-message-seed-element.d.ts.map +1 -0
  30. package/dist/message/chat-message-text-element.d.ts +37 -0
  31. package/dist/message/chat-message-text-element.d.ts.map +1 -0
  32. package/dist/message/chat-messages-element.d.ts +28 -0
  33. package/dist/message/chat-messages-element.d.ts.map +1 -0
  34. package/dist/message/index.d.ts +8 -0
  35. package/dist/message/index.d.ts.map +1 -0
  36. package/dist/message/n-chat-message.d.ts +2 -0
  37. package/dist/message/n-chat-message.d.ts.map +1 -0
  38. package/dist/native-chat.css +470 -28
  39. package/dist/native-chat.js +2 -2
  40. package/dist/register.d.ts +10 -1
  41. package/dist/register.d.ts.map +1 -1
  42. package/dist/register.js +4 -4
  43. package/package.json +1 -1
  44. package/dist/chat-panel-element-CXPbtkyi.js +0 -113
@@ -0,0 +1,1069 @@
1
+ import { NativeElement as e, createDisabledEffect as t, signal as n } from "@nonoun/native-ui";
2
+ /**
3
+ * Chat message input with textarea, submit button, and Enter-to-send behavior.
4
+ * @attr {boolean} disabled - Disables interaction
5
+ * @attr {boolean} busy - Disables submit but keeps textarea enabled
6
+ * @attr {boolean} no-enter-submit - Disables Enter key submission
7
+ * @attr {boolean} no-auto-clear - Prevents clearing the textarea after send
8
+ * @fires native:send - Fired on submit with `{ value }` detail
9
+ * @fires native:composer-submit-blocked - Fired when submit is attempted while busy
10
+ * @fires native:composer-focus - Fired when the composer textarea gains focus
11
+ * @fires native:composer-blur - Fired when the composer textarea loses focus
12
+ */
13
+ var r = class extends e {
14
+ static observedAttributes = ["disabled", "busy"];
15
+ #e;
16
+ #t = n(!1);
17
+ #n = n(!1);
18
+ #r = null;
19
+ #i = null;
20
+ constructor() {
21
+ super(), this.#e = this.attachInternals();
22
+ }
23
+ get value() {
24
+ return this.#r?.value ?? "";
25
+ }
26
+ set value(e) {
27
+ this.#r && (this.#r.value = e);
28
+ }
29
+ get disabled() {
30
+ return this.#t.value;
31
+ }
32
+ set disabled(e) {
33
+ this.#t.value = e, this.toggleAttribute("disabled", e);
34
+ }
35
+ get busy() {
36
+ return this.#n.value;
37
+ }
38
+ set busy(e) {
39
+ this.#n.value = e, this.toggleAttribute("busy", e);
40
+ }
41
+ /** Focus the composer textarea. */
42
+ focusComposer() {
43
+ this.querySelector("n-textarea")?.focus();
44
+ }
45
+ /** Blur the composer textarea. */
46
+ blurComposer() {
47
+ this.querySelector("n-textarea")?.blur();
48
+ }
49
+ attributeChangedCallback(e, t, n) {
50
+ if (t !== n) {
51
+ switch (e) {
52
+ case "disabled":
53
+ this.#t.value = n !== null;
54
+ break;
55
+ case "busy":
56
+ this.#n.value = n !== null;
57
+ break;
58
+ }
59
+ super.attributeChangedCallback(e, t, n);
60
+ }
61
+ }
62
+ setup() {
63
+ super.setup(), this.addEffect(t(this, this.#t, this.#e)), this.deferChildren(() => {
64
+ this.#a(), this.addEffect(() => {
65
+ let e = this.#t.value;
66
+ this.#r && this.#r.toggleAttribute("disabled", e), this.#i && (e ? this.#i.setAttribute("disabled", "") : this.#s());
67
+ }), this.addEffect(() => {
68
+ let e = this.#n.value;
69
+ this.#i && (this.#t.value || (e ? this.#i.setAttribute("disabled", "") : this.#s()));
70
+ });
71
+ }), this.addEventListener("native:input", this.#c), this.addEventListener("native:press", this.#l), this.addEventListener("keydown", this.#f), this.addEventListener("focusin", this.#u), this.addEventListener("focusout", this.#d);
72
+ }
73
+ teardown() {
74
+ this.removeEventListener("native:input", this.#c), this.removeEventListener("native:press", this.#l), this.removeEventListener("keydown", this.#f), this.removeEventListener("focusin", this.#u), this.removeEventListener("focusout", this.#d), this.#r = null, this.#i = null, super.teardown();
75
+ }
76
+ #a() {
77
+ this.#r = this.querySelector(":scope > n-textarea"), this.#i = this.querySelector("[data-submit]") ?? this.#o();
78
+ }
79
+ #o() {
80
+ let e = this.querySelector(":scope > n-chat-input-actions");
81
+ if (!e) return null;
82
+ let t = e.querySelectorAll("n-button[variant=\"primary\"]");
83
+ return t.length ? t[t.length - 1] : null;
84
+ }
85
+ #s() {
86
+ !this.#i || this.#t.value || (!this.value.trim() || this.#n.value ? this.#i.setAttribute("disabled", "") : this.#i.removeAttribute("disabled"));
87
+ }
88
+ #c = (e) => {
89
+ this.#t.value || this.#s();
90
+ };
91
+ #l = (e) => {
92
+ this.#t.value || e.target === this.#i && this.#p();
93
+ };
94
+ #u = (e) => {
95
+ let t = e.target;
96
+ !this.#r?.contains(t) && t !== this.#r || this.dispatchEvent(new CustomEvent("native:composer-focus", {
97
+ bubbles: !0,
98
+ composed: !0
99
+ }));
100
+ };
101
+ #d = (e) => {
102
+ let t = e.target;
103
+ !this.#r?.contains(t) && t !== this.#r || this.dispatchEvent(new CustomEvent("native:composer-blur", {
104
+ bubbles: !0,
105
+ composed: !0
106
+ }));
107
+ };
108
+ #f = (e) => {
109
+ if (this.#t.value || this.hasAttribute("no-enter-submit")) return;
110
+ let t = e;
111
+ if (t.isComposing) return;
112
+ let n = t.target;
113
+ !this.#r?.contains(n) && n !== this.#r || t.key === "Enter" && !t.shiftKey && !t.ctrlKey && !t.metaKey && (t.preventDefault(), this.value.trim() && this.#p());
114
+ };
115
+ #p() {
116
+ let e = this.value.trim();
117
+ if (e) {
118
+ if (this.#n.value) {
119
+ this.dispatchEvent(new CustomEvent("native:composer-submit-blocked", {
120
+ bubbles: !0,
121
+ composed: !0,
122
+ detail: { value: e }
123
+ }));
124
+ return;
125
+ }
126
+ this.dispatchEvent(new CustomEvent("native:send", {
127
+ bubbles: !0,
128
+ composed: !0,
129
+ cancelable: !0,
130
+ detail: { value: e }
131
+ })) && !this.hasAttribute("no-auto-clear") && (this.value = "", this.#i?.setAttribute("disabled", ""));
132
+ }
133
+ }
134
+ }, i = class extends e {
135
+ static observedAttributes = ["show-stop", "show-restart"];
136
+ #e = n(!1);
137
+ #t = n(!1);
138
+ #n = null;
139
+ #r = null;
140
+ #i = null;
141
+ #a = null;
142
+ attributeChangedCallback(e, t, n) {
143
+ if (t !== n) {
144
+ switch (e) {
145
+ case "show-stop":
146
+ this.#e.value = n !== null;
147
+ break;
148
+ case "show-restart":
149
+ this.#t.value = n !== null;
150
+ break;
151
+ }
152
+ super.attributeChangedCallback(e, t, n);
153
+ }
154
+ }
155
+ get showStop() {
156
+ return this.#e.value;
157
+ }
158
+ set showStop(e) {
159
+ this.#e.value = e, this.toggleAttribute("show-stop", e);
160
+ }
161
+ get showRestart() {
162
+ return this.#t.value;
163
+ }
164
+ set showRestart(e) {
165
+ this.#t.value = e, this.toggleAttribute("show-restart", e);
166
+ }
167
+ setup() {
168
+ super.setup();
169
+ let e = document.createElement("n-header");
170
+ e.setAttribute("dividers", "");
171
+ let t = document.createElement("n-icon");
172
+ t.setAttribute("name", "chat-dots"), t.setAttribute("slot", "leading"), e.appendChild(t);
173
+ let n = document.createElement("span");
174
+ n.setAttribute("slot", "label"), n.textContent = "Assistant", e.appendChild(n);
175
+ let r = document.createElement("span");
176
+ r.setAttribute("slot", "trailing"), r.style.display = "inline-flex", r.style.alignItems = "center", r.style.gap = "calc(var(--n-space) * 2)", e.appendChild(r), this.#a = r;
177
+ let i = document.createElement("n-body"), a = document.createElement("n-chat-content");
178
+ i.appendChild(a);
179
+ let o = document.createElement("n-footer");
180
+ o.setAttribute("dividers", ""), o.setAttribute("padding", "none"), this.#n = o;
181
+ let s = document.createElement("n-chat-input");
182
+ s.setAttribute("variant", "plain");
183
+ let c = document.createElement("n-textarea");
184
+ c.setAttribute("placeholder", "Ask anything"), c.setAttribute("autogrow", ""), c.setAttribute("rows", "3"), s.appendChild(c);
185
+ let l = document.createElement("n-chat-input-actions"), u = document.createElement("n-button");
186
+ u.setAttribute("variant", "ghost"), u.setAttribute("inline", ""), u.innerHTML = "<n-icon name=\"plus\"></n-icon>", l.appendChild(u);
187
+ let d = document.createElement("n-button");
188
+ d.setAttribute("variant", "ghost"), d.setAttribute("inline", ""), d.innerHTML = "<n-icon name=\"microphone\"></n-icon>", l.appendChild(d);
189
+ let f = document.createElement("n-button");
190
+ f.setAttribute("variant", "primary"), f.setAttribute("intent", "accent"), f.setAttribute("radius", "round"), f.setAttribute("inline", ""), f.setAttribute("disabled", ""), f.classList.add("submit-btn"), f.innerHTML = "<n-icon name=\"arrow-up\"></n-icon>", l.appendChild(f), s.appendChild(l), o.appendChild(s), this.append(e, i, o), this.addEffect(() => {
191
+ let e = this.#e.value;
192
+ if (e && !this.#r) {
193
+ let e = document.createElement("n-button");
194
+ e.setAttribute("variant", "ghost"), e.setAttribute("inline", ""), e.setAttribute("aria-label", "Stop"), e.innerHTML = "<n-icon name=\"stop\"></n-icon>", e.addEventListener("native:press", this.#s), this.#r = e, this.#a?.prepend(e);
195
+ } else !e && this.#r && (this.#r.removeEventListener("native:press", this.#s), this.#r.remove(), this.#r = null);
196
+ }), this.addEffect(() => {
197
+ let e = this.#t.value;
198
+ if (e && !this.#i) {
199
+ let e = document.createElement("n-button");
200
+ e.setAttribute("variant", "ghost"), e.setAttribute("inline", ""), e.setAttribute("aria-label", "Restart"), e.innerHTML = "<n-icon name=\"arrow-counter-clockwise\"></n-icon>", e.addEventListener("native:press", this.#c), this.#i = e;
201
+ let t = this.#r?.nextSibling ?? this.#a?.firstChild ?? null;
202
+ this.#a?.insertBefore(e, t);
203
+ } else !e && this.#i && (this.#i.removeEventListener("native:press", this.#c), this.#i.remove(), this.#i = null);
204
+ }), this.deferChildren(() => {
205
+ this.#o();
206
+ });
207
+ }
208
+ teardown() {
209
+ this.#r && this.#r.removeEventListener("native:press", this.#s), this.#i && this.#i.removeEventListener("native:press", this.#c), this.#n = null, this.#r = null, this.#i = null, this.#a = null, this.innerHTML = "", super.teardown();
210
+ }
211
+ #o() {
212
+ let e = this.querySelector(":scope > [slot=\"header-trailing\"]");
213
+ e && this.#a && this.#a.appendChild(e);
214
+ let t = this.querySelector(":scope > [slot=\"footer-leading\"]");
215
+ if (t && this.#n) {
216
+ let e = this.#n.querySelector(":scope > n-chat-input");
217
+ this.#n.insertBefore(t, e);
218
+ }
219
+ }
220
+ #s = () => {
221
+ this.dispatchEvent(new CustomEvent("native:chat-stop", {
222
+ bubbles: !0,
223
+ composed: !0
224
+ }));
225
+ };
226
+ #c = () => {
227
+ this.dispatchEvent(new CustomEvent("native:chat-restart", {
228
+ bubbles: !0,
229
+ composed: !0
230
+ }));
231
+ };
232
+ }, a = 40, o = class extends e {
233
+ static observedAttributes = ["auto-scroll"];
234
+ #e;
235
+ #t = n(!0);
236
+ #n = n(!0);
237
+ #r = null;
238
+ constructor() {
239
+ super(), this.#e = this.attachInternals();
240
+ }
241
+ get isPinned() {
242
+ return this.#n.value;
243
+ }
244
+ /** Scroll to the bottom of the feed. */
245
+ scrollToBottom(e = !0) {
246
+ this.scrollTo({
247
+ top: this.scrollHeight,
248
+ behavior: e ? "smooth" : "instant"
249
+ }), this.#n.value = !0;
250
+ }
251
+ attributeChangedCallback(e, t, n) {
252
+ t !== n && (e === "auto-scroll" && (this.#t.value = n !== null), super.attributeChangedCallback(e, t, n));
253
+ }
254
+ setup() {
255
+ super.setup(), this.#e.role = "log", this.setAttribute("aria-live", "polite"), this.setAttribute("aria-label", "Conversation"), this.hasAttribute("auto-scroll") || (this.#t.value = !0), this.addEventListener("scroll", this.#i, { passive: !0 }), this.#r = new MutationObserver(this.#a), this.#r.observe(this, {
256
+ childList: !0,
257
+ subtree: !0
258
+ }), this.addEventListener("native:message-action", this.#o);
259
+ }
260
+ teardown() {
261
+ this.removeEventListener("scroll", this.#i), this.removeEventListener("native:message-action", this.#o), this.#r?.disconnect(), this.#r = null, super.teardown();
262
+ }
263
+ #i = () => {
264
+ let e = this.#n.value, t = this.scrollTop + this.clientHeight >= this.scrollHeight - a;
265
+ this.#n.value = t, t !== e && this.dispatchEvent(new CustomEvent("native:feed-scroll", {
266
+ bubbles: !0,
267
+ composed: !0,
268
+ detail: {
269
+ isPinned: t,
270
+ scrollTop: this.scrollTop
271
+ }
272
+ }));
273
+ };
274
+ #a = () => {
275
+ this.#t.value && this.#n.value && requestAnimationFrame(() => {
276
+ this.scrollTo({
277
+ top: this.scrollHeight,
278
+ behavior: "smooth"
279
+ });
280
+ });
281
+ };
282
+ #o = (e) => {};
283
+ }, s = class extends e {
284
+ static observedAttributes = [
285
+ "src",
286
+ "name",
287
+ "icon"
288
+ ];
289
+ #e = n("");
290
+ #t = n("");
291
+ #n = n("");
292
+ attributeChangedCallback(e, t, n) {
293
+ if (t !== n) {
294
+ switch (e) {
295
+ case "src":
296
+ this.#e.value = n ?? "";
297
+ break;
298
+ case "name":
299
+ this.#t.value = n ?? "";
300
+ break;
301
+ case "icon":
302
+ this.#n.value = n ?? "";
303
+ break;
304
+ }
305
+ super.attributeChangedCallback(e, t, n);
306
+ }
307
+ }
308
+ setup() {
309
+ super.setup(), this.addEffect(() => {
310
+ let e = this.#e.value, t = this.#n.value, n = this.#t.value;
311
+ if (this.textContent = "", e) {
312
+ let t = document.createElement("img");
313
+ t.src = e, t.alt = n || "", t.loading = "lazy", t.draggable = !1, this.appendChild(t);
314
+ return;
315
+ }
316
+ if (t) {
317
+ let e = document.createElement("n-icon");
318
+ e.setAttribute("name", t), this.appendChild(e);
319
+ return;
320
+ }
321
+ if (n) {
322
+ let e = document.createElement("span");
323
+ e.className = "n-chat-avatar-initials", e.textContent = c(n), e.setAttribute("aria-hidden", "true"), this.appendChild(e);
324
+ return;
325
+ }
326
+ let r = document.createElement("n-icon");
327
+ r.setAttribute("name", "user"), this.appendChild(r);
328
+ });
329
+ }
330
+ teardown() {
331
+ this.textContent = "", super.teardown();
332
+ }
333
+ };
334
+ function c(e) {
335
+ let t = e.trim().split(/\s+/);
336
+ return t.length === 0 ? "" : t.length === 1 ? t[0][0].toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
337
+ }
338
+ /**
339
+ * Individual chat message bubble.
340
+ *
341
+ * Accepts slotted content: `n-chat-message-text`, `n-chat-message-genui`,
342
+ * `n-chat-message-seed`, or any custom content.
343
+ *
344
+ * @attr {string} role - `user` | `assistant` | `system`
345
+ * @attr {string} message-id - Unique message identifier
346
+ * @attr {string} timestamp - Epoch milliseconds
347
+ * @attr {string} status - `sending` | `sent` | `error` | `streaming`
348
+ * @fires native:message-action - Fired when an action button is clicked
349
+ */
350
+ var l = class extends e {
351
+ static observedAttributes = [
352
+ "role",
353
+ "message-id",
354
+ "timestamp",
355
+ "status"
356
+ ];
357
+ #e;
358
+ #t = n("assistant");
359
+ #n = n("sent");
360
+ #r = null;
361
+ constructor() {
362
+ super(), this.#e = this.attachInternals();
363
+ }
364
+ get role() {
365
+ return this.#t.value;
366
+ }
367
+ set role(e) {
368
+ this.#t.value = e, this.setAttribute("role", e);
369
+ }
370
+ get messageId() {
371
+ return this.getAttribute("message-id") ?? "";
372
+ }
373
+ get timestamp() {
374
+ return Number(this.getAttribute("timestamp")) || 0;
375
+ }
376
+ get status() {
377
+ return this.#n.value;
378
+ }
379
+ set status(e) {
380
+ this.#n.value = e, this.setAttribute("status", e);
381
+ }
382
+ attributeChangedCallback(e, t, n) {
383
+ if (t !== n) {
384
+ switch (e) {
385
+ case "role":
386
+ this.#t.value = n ?? "assistant";
387
+ break;
388
+ case "status":
389
+ this.#n.value = n ?? "sent";
390
+ break;
391
+ }
392
+ super.attributeChangedCallback(e, t, n);
393
+ }
394
+ }
395
+ setup() {
396
+ super.setup(), this.addEffect(() => {
397
+ let e = this.#t.value;
398
+ this.#i(e);
399
+ }), this.#e.role = "article", this.addEventListener("native:press", this.#a);
400
+ }
401
+ teardown() {
402
+ this.removeEventListener("native:press", this.#a), this.#r = null, super.teardown();
403
+ }
404
+ #i(e) {
405
+ this.#r &&= (this.#r.remove(), null);
406
+ let t = document.createElement("n-toolbar");
407
+ t.className = "n-chat-message-actions", t.setAttribute("padding", "none"), t.setAttribute("aria-label", "Message actions"), e === "assistant" ? (t.appendChild(u("copy", "Copy")), t.appendChild(u("retry", "Retry")), t.appendChild(u("feedback-up", "Helpful")), t.appendChild(u("feedback-down", "Not helpful"))) : e === "user" && (t.appendChild(u("edit", "Edit")), t.appendChild(u("retry", "Resend"))), t.children.length > 0 && (this.appendChild(t), this.#r = t);
408
+ }
409
+ #a = (e) => {
410
+ let t = e.target, n = t?.getAttribute("data-action");
411
+ n && this.#r?.contains(t) && (e.stopPropagation(), this.dispatchEvent(new CustomEvent("native:message-action", {
412
+ bubbles: !0,
413
+ composed: !0,
414
+ detail: {
415
+ action: n,
416
+ messageId: this.messageId
417
+ }
418
+ })));
419
+ };
420
+ };
421
+ function u(e, t) {
422
+ let n = document.createElement("n-button");
423
+ return n.setAttribute("variant", "ghost"), n.setAttribute("size", "sm"), n.setAttribute("inline", ""), n.setAttribute("data-action", e), n.setAttribute("aria-label", t), n.textContent = t, n;
424
+ }
425
+ /**
426
+ * Message group — cluster of messages from the same sender.
427
+ *
428
+ * Provides alignment (user = right, assistant/system = left) and
429
+ * groups an avatar + message column.
430
+ *
431
+ * ```html
432
+ * <n-chat-messages role="user" sender="Kim">
433
+ * <n-chat-avatar name="Kim"></n-chat-avatar>
434
+ * <n-chat-message role="user" message-id="1">
435
+ * <n-chat-message-text>Hello!</n-chat-message-text>
436
+ * </n-chat-message>
437
+ * </n-chat-messages>
438
+ * ```
439
+ *
440
+ * @attr {string} role - `user` | `assistant` | `system`
441
+ * @attr {string} sender - Display name of the sender
442
+ */
443
+ var d = class extends e {
444
+ static observedAttributes = ["role", "sender"];
445
+ #e;
446
+ constructor() {
447
+ super(), this.#e = this.attachInternals();
448
+ }
449
+ attributeChangedCallback(e, t, n) {
450
+ t !== n && super.attributeChangedCallback(e, t, n);
451
+ }
452
+ setup() {
453
+ super.setup(), this.#e.role = "group";
454
+ let e = this.getAttribute("sender");
455
+ e && (this.#e.ariaLabel = `Messages from ${e}`);
456
+ }
457
+ teardown() {
458
+ super.teardown();
459
+ }
460
+ }, f = class extends e {
461
+ static observedAttributes = ["format"];
462
+ #e = n("markdown");
463
+ #t = n("");
464
+ #n = null;
465
+ get content() {
466
+ return this.#t.value;
467
+ }
468
+ set content(e) {
469
+ this.#t.value = e;
470
+ }
471
+ get format() {
472
+ return this.#e.value;
473
+ }
474
+ set format(e) {
475
+ this.#e.value = e, this.setAttribute("format", e);
476
+ }
477
+ attributeChangedCallback(e, t, n) {
478
+ t !== n && (e === "format" && (this.#e.value = n === "plain" ? "plain" : "markdown"), super.attributeChangedCallback(e, t, n));
479
+ }
480
+ setup() {
481
+ super.setup(), this.deferChildren(() => {
482
+ !this.#t.value && this.textContent?.trim() && (this.#t.value = this.textContent.trim()), this.#n = document.createElement("div"), this.#n.className = "n-chat-prose", this.textContent = "", this.appendChild(this.#n), this.addEffect(() => {
483
+ let e = this.#t.value, t = this.#e.value;
484
+ this.#n && (t === "plain" ? this.#n.textContent = e : this.#n.innerHTML = g(e));
485
+ });
486
+ });
487
+ }
488
+ teardown() {
489
+ this.#n = null, super.teardown();
490
+ }
491
+ }, p = new Set([
492
+ "p",
493
+ "br",
494
+ "strong",
495
+ "em",
496
+ "code",
497
+ "pre",
498
+ "a",
499
+ "h1",
500
+ "h2",
501
+ "h3",
502
+ "h4",
503
+ "h5",
504
+ "h6",
505
+ "ul",
506
+ "ol",
507
+ "li",
508
+ "blockquote",
509
+ "hr"
510
+ ]);
511
+ function m(e) {
512
+ return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
513
+ }
514
+ function h(e) {
515
+ let t = m(e);
516
+ return t = t.replace(/`([^`]+)`/g, "<code>$1</code>"), t = t.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>"), t = t.replace(/__(.+?)__/g, "<strong>$1</strong>"), t = t.replace(/\*(.+?)\*/g, "<em>$1</em>"), t = t.replace(/(?<!\w)_(.+?)_(?!\w)/g, "<em>$1</em>"), t = t.replace(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g, "<a href=\"$2\" rel=\"noopener noreferrer\" target=\"_blank\">$1</a>"), t;
517
+ }
518
+ function g(e) {
519
+ if (!e) return "";
520
+ let t = e.split("\n"), n = [], r = 0;
521
+ for (; r < t.length;) {
522
+ let e = t[r];
523
+ if (e.startsWith("```")) {
524
+ let i = e.slice(3).trim(), a = [];
525
+ for (r += 1; r < t.length && !t[r].startsWith("```");) a.push(t[r]), r += 1;
526
+ r += 1;
527
+ let o = i ? ` data-lang="${m(i)}"` : "";
528
+ n.push(`<pre${o}><code>${m(a.join("\n"))}</code></pre>`);
529
+ continue;
530
+ }
531
+ let i = e.match(/^(#{1,6})\s+(.+)/);
532
+ if (i) {
533
+ let e = i[1].length;
534
+ n.push(`<h${e}>${h(i[2])}</h${e}>`), r += 1;
535
+ continue;
536
+ }
537
+ if (/^---+$/.test(e.trim()) || /^\*\*\*+$/.test(e.trim())) {
538
+ n.push("<hr>"), r += 1;
539
+ continue;
540
+ }
541
+ if (e.startsWith("> ")) {
542
+ let e = [];
543
+ for (; r < t.length && t[r].startsWith("> ");) e.push(t[r].slice(2)), r += 1;
544
+ n.push(`<blockquote>${g(e.join("\n"))}</blockquote>`);
545
+ continue;
546
+ }
547
+ if (/^[-*+]\s/.test(e)) {
548
+ let e = [];
549
+ for (; r < t.length && /^[-*+]\s/.test(t[r]);) e.push(t[r].replace(/^[-*+]\s/, "")), r += 1;
550
+ n.push("<ul>" + e.map((e) => `<li>${h(e)}</li>`).join("") + "</ul>");
551
+ continue;
552
+ }
553
+ if (/^\d+\.\s/.test(e)) {
554
+ let e = [];
555
+ for (; r < t.length && /^\d+\.\s/.test(t[r]);) e.push(t[r].replace(/^\d+\.\s/, "")), r += 1;
556
+ n.push("<ol>" + e.map((e) => `<li>${h(e)}</li>`).join("") + "</ol>");
557
+ continue;
558
+ }
559
+ if (!e.trim()) {
560
+ r += 1;
561
+ continue;
562
+ }
563
+ let a = [];
564
+ for (; r < t.length && t[r].trim() && !t[r].startsWith("#") && !t[r].startsWith("```") && !t[r].startsWith("> ") && !/^[-*+]\s/.test(t[r]) && !/^\d+\.\s/.test(t[r]) && !/^---+$/.test(t[r].trim());) a.push(t[r]), r += 1;
565
+ a.length > 0 && n.push(`<p>${h(a.join("\n"))}</p>`);
566
+ }
567
+ return n.join("");
568
+ }
569
+ /** Sanitize rendered HTML — strip any tags not in allowlist. */
570
+ function _(e) {
571
+ return e.replace(/<\/?([a-zA-Z][a-zA-Z0-9]*)[^>]*>/g, (e, t) => {
572
+ let n = t.toLowerCase();
573
+ return p.has(n) ? e : "";
574
+ });
575
+ }
576
+ /**
577
+ * Streaming activity indicator — typing, thinking, or tool-use status.
578
+ *
579
+ * When `active`, shows an animated indicator with elapsed time.
580
+ * When `expandable`, clicking toggles visibility of slotted trace content.
581
+ *
582
+ * ```html
583
+ * <n-chat-message-activity type="thinking" active>
584
+ * <pre>Reasoning trace here...</pre>
585
+ * </n-chat-message-activity>
586
+ * ```
587
+ *
588
+ * @attr {string} type - `typing` | `thinking` | `tool-use`
589
+ * @attr {string} label - Custom label text (overrides default per-type label)
590
+ * @attr {boolean} active - Currently streaming / in progress
591
+ * @attr {boolean} expandable - Allow click to expand trace content
592
+ * @fires native:activity-toggle - Fired when trace is expanded/collapsed
593
+ */
594
+ var v = class extends e {
595
+ static observedAttributes = [
596
+ "type",
597
+ "label",
598
+ "active",
599
+ "expandable"
600
+ ];
601
+ #e;
602
+ #t = n("typing");
603
+ #n = n("");
604
+ #r = n(!1);
605
+ #i = n(!1);
606
+ #a = n(!1);
607
+ #o = 0;
608
+ #s = 0;
609
+ #c = null;
610
+ #l = null;
611
+ #u = null;
612
+ #d = null;
613
+ constructor() {
614
+ super(), this.#e = this.attachInternals();
615
+ }
616
+ get active() {
617
+ return this.#r.value;
618
+ }
619
+ set active(e) {
620
+ this.#r.value = e, this.toggleAttribute("active", e);
621
+ }
622
+ get expanded() {
623
+ return this.#a.value;
624
+ }
625
+ set expanded(e) {
626
+ this.#a.value = e, this.toggleAttribute("expanded", e);
627
+ }
628
+ attributeChangedCallback(e, t, n) {
629
+ if (t !== n) {
630
+ switch (e) {
631
+ case "type":
632
+ this.#t.value = n ?? "typing";
633
+ break;
634
+ case "label":
635
+ this.#n.value = n ?? "";
636
+ break;
637
+ case "active":
638
+ this.#r.value = n !== null;
639
+ break;
640
+ case "expandable":
641
+ this.#i.value = n !== null;
642
+ break;
643
+ }
644
+ super.attributeChangedCallback(e, t, n);
645
+ }
646
+ }
647
+ setup() {
648
+ super.setup(), this.#f(), this.addEffect(() => {
649
+ this.#r.value ? (this.#p(), this.#e.states.add("active")) : (this.#m(), this.#e.states.delete("active"));
650
+ }), this.addEffect(() => {
651
+ if (!this.#c) return;
652
+ let e = this.#n.value || y(this.#t.value);
653
+ this.#c.textContent = e;
654
+ }), this.addEffect(() => {
655
+ this.#u && (this.#u.hidden = !this.#r.value);
656
+ }), this.addEffect(() => {
657
+ if (!this.#d) return;
658
+ let e = this.#a.value && this.#i.value;
659
+ this.#d.hidden = !e, this.#e.states[e ? "add" : "delete"]("expanded");
660
+ }), this.addEventListener("click", this.#g);
661
+ }
662
+ teardown() {
663
+ this.#m(), this.removeEventListener("click", this.#g), this.#c = null, this.#l = null, this.#u = null, this.#d = null, super.teardown();
664
+ }
665
+ #f() {
666
+ let e = document.createDocumentFragment();
667
+ for (; this.firstChild;) e.appendChild(this.firstChild);
668
+ let t = document.createElement("div");
669
+ t.className = "n-chat-activity-row", this.#l = document.createElement("span"), this.#l.className = "n-chat-activity-time", this.#l.textContent = "0s";
670
+ let n = document.createElement("span");
671
+ n.className = "n-chat-activity-sep", n.textContent = "|", n.setAttribute("aria-hidden", "true"), this.#c = document.createElement("span"), this.#c.className = "n-chat-activity-label", this.#u = document.createElement("span"), this.#u.className = "n-chat-activity-dots", this.#u.setAttribute("aria-hidden", "true"), this.#u.innerHTML = "<i></i><i></i><i></i>", t.append(this.#l, n, this.#c, this.#u), this.#d = document.createElement("div"), this.#d.className = "n-chat-activity-content", this.#d.hidden = !0, this.#d.appendChild(e), this.append(t, this.#d);
672
+ }
673
+ #p() {
674
+ this.#o = performance.now(), this.#h();
675
+ }
676
+ #m() {
677
+ this.#s &&= (cancelAnimationFrame(this.#s), 0);
678
+ }
679
+ #h = () => {
680
+ if (!this.#r.value || !this.#l) return;
681
+ let e = performance.now() - this.#o;
682
+ this.#l.textContent = b(e), this.#s = requestAnimationFrame(this.#h);
683
+ };
684
+ #g = () => {
685
+ this.#i.value && (this.#a.value = !this.#a.value, this.toggleAttribute("expanded", this.#a.value), this.dispatchEvent(new CustomEvent("native:activity-toggle", {
686
+ bubbles: !0,
687
+ composed: !0,
688
+ detail: { expanded: this.#a.value }
689
+ })));
690
+ };
691
+ };
692
+ function y(e) {
693
+ switch (e) {
694
+ case "thinking": return "Thinking…";
695
+ case "tool-use": return "Using tools…";
696
+ default: return "Host is typing…";
697
+ }
698
+ }
699
+ function b(e) {
700
+ let t = Math.floor(e / 1e3);
701
+ if (t < 60) return `${t}s`;
702
+ let n = Math.floor(t / 60), r = t % 60;
703
+ return `${n}m:${String(r).padStart(2, "0")}s`;
704
+ }
705
+ /**
706
+ * Suggestion chips — pre-seeded quick responses.
707
+ *
708
+ * Options can be provided as JSON attribute or via the `options` property.
709
+ *
710
+ * ```html
711
+ * <n-chat-message-seed options='[{"value":"yes","label":"Yes"},{"value":"no","label":"No"}]'>
712
+ * </n-chat-message-seed>
713
+ * ```
714
+ *
715
+ * @attr {string} options - JSON array of `{ value, label, icon? }`
716
+ * @attr {boolean} disabled - Disables all chips
717
+ * @fires native:seed-select - Fired when a chip is clicked
718
+ */
719
+ var x = class extends e {
720
+ static observedAttributes = ["options", "disabled"];
721
+ #e;
722
+ #t = n([]);
723
+ #n = n(!1);
724
+ constructor() {
725
+ super(), this.#e = this.attachInternals();
726
+ }
727
+ get options() {
728
+ return this.#t.value;
729
+ }
730
+ set options(e) {
731
+ this.#t.value = e, this.setAttribute("options", JSON.stringify(e));
732
+ }
733
+ get disabled() {
734
+ return this.#n.value;
735
+ }
736
+ set disabled(e) {
737
+ this.#n.value = e, this.toggleAttribute("disabled", e);
738
+ }
739
+ attributeChangedCallback(e, t, n) {
740
+ if (t !== n) {
741
+ switch (e) {
742
+ case "options":
743
+ try {
744
+ this.#t.value = n ? JSON.parse(n) : [];
745
+ } catch {
746
+ this.#t.value = [];
747
+ }
748
+ break;
749
+ case "disabled":
750
+ this.#n.value = n !== null;
751
+ break;
752
+ }
753
+ super.attributeChangedCallback(e, t, n);
754
+ }
755
+ }
756
+ setup() {
757
+ super.setup(), this.addEffect(t(this, this.#n, this.#e)), this.addEffect(() => {
758
+ let e = this.#t.value;
759
+ this.textContent = "";
760
+ for (let t of e) {
761
+ let e = document.createElement("n-button");
762
+ if (e.setAttribute("variant", "outline"), e.setAttribute("size", "sm"), e.setAttribute("inline", ""), e.setAttribute("data-value", t.value), t.icon) {
763
+ let n = document.createElement("n-icon");
764
+ n.setAttribute("name", t.icon), n.setAttribute("slot", "leading"), e.appendChild(n);
765
+ }
766
+ let n = document.createElement("span");
767
+ n.setAttribute("slot", "label"), n.textContent = t.label, e.appendChild(n), this.appendChild(e);
768
+ }
769
+ }), this.addEventListener("native:press", this.#r);
770
+ }
771
+ teardown() {
772
+ this.removeEventListener("native:press", this.#r), super.teardown();
773
+ }
774
+ #r = (e) => {
775
+ if (this.#n.value) return;
776
+ let t = e.target?.getAttribute("data-value");
777
+ if (!t) return;
778
+ let n = this.#t.value.find((e) => e.value === t);
779
+ n && this.dispatchEvent(new CustomEvent("native:seed-select", {
780
+ bubbles: !0,
781
+ composed: !0,
782
+ detail: {
783
+ value: n.value,
784
+ label: n.label
785
+ }
786
+ }));
787
+ };
788
+ }, S = new Set([
789
+ "script",
790
+ "style",
791
+ "link",
792
+ "iframe",
793
+ "embed",
794
+ "object",
795
+ "form",
796
+ "input",
797
+ "textarea",
798
+ "select",
799
+ "meta",
800
+ "base",
801
+ "applet",
802
+ "frame",
803
+ "frameset",
804
+ "noscript"
805
+ ]), C = class extends e {
806
+ static observedAttributes = ["schema-type", "mode"];
807
+ #e;
808
+ #t = n("a2ui");
809
+ #n = n("inline");
810
+ #r = n(null);
811
+ #i = null;
812
+ constructor() {
813
+ super(), this.#e = this.attachInternals();
814
+ }
815
+ get schema() {
816
+ return this.#r.value;
817
+ }
818
+ set schema(e) {
819
+ this.#r.value = e;
820
+ }
821
+ get schemaType() {
822
+ return this.#t.value;
823
+ }
824
+ set schemaType(e) {
825
+ this.#t.value = e, this.setAttribute("schema-type", e);
826
+ }
827
+ get mode() {
828
+ return this.#n.value;
829
+ }
830
+ set mode(e) {
831
+ this.#n.value = e, this.setAttribute("mode", e);
832
+ }
833
+ attributeChangedCallback(e, t, n) {
834
+ if (t !== n) {
835
+ switch (e) {
836
+ case "schema-type":
837
+ this.#t.value = n ?? "a2ui";
838
+ break;
839
+ case "mode":
840
+ this.#n.value = n === "lightbox" ? "lightbox" : "inline";
841
+ break;
842
+ }
843
+ super.attributeChangedCallback(e, t, n);
844
+ }
845
+ }
846
+ setup() {
847
+ super.setup(), this.#i = document.createElement("div"), this.#i.className = "n-chat-genui-container", this.appendChild(this.#i), this.addEffect(() => {
848
+ let e = this.#r.value, t = this.#n.value;
849
+ if (!this.#i || (this.#i.textContent = "", !e)) return;
850
+ let n = w(e);
851
+ if (n.length > 0) {
852
+ this.#a(n), this.dispatchEvent(new CustomEvent("native:genui-error", {
853
+ bubbles: !0,
854
+ composed: !0,
855
+ detail: { errors: n }
856
+ }));
857
+ return;
858
+ }
859
+ if (t === "lightbox") this.#o(e);
860
+ else {
861
+ let t = T(e);
862
+ t && this.#i.appendChild(t);
863
+ }
864
+ this.#e.states.add("rendered");
865
+ }), this.addEventListener("native:press", this.#c);
866
+ }
867
+ teardown() {
868
+ this.removeEventListener("native:press", this.#c), this.#i = null, super.teardown();
869
+ }
870
+ #a(e) {
871
+ if (!this.#i) return;
872
+ let t = document.createElement("div");
873
+ t.className = "n-chat-genui-error", t.textContent = `Schema validation failed: ${e.join(", ")}`, this.#i.appendChild(t);
874
+ }
875
+ #o(e) {
876
+ if (!this.#i) return;
877
+ let t = document.createElement("n-card");
878
+ t.className = "n-chat-genui-preview";
879
+ let n = document.createElement("span");
880
+ n.textContent = `Interactive UI (${e.tag})`, t.appendChild(n);
881
+ let r = document.createElement("n-button");
882
+ r.setAttribute("variant", "outline"), r.setAttribute("size", "sm"), r.setAttribute("inline", ""), r.textContent = "Open", r.addEventListener("click", () => this.#s(e)), t.appendChild(r), this.#i.appendChild(t);
883
+ }
884
+ #s(e) {
885
+ let t = document.createElement("n-dialog"), n = T(e);
886
+ n && t.appendChild(n), this.appendChild(t), requestAnimationFrame(() => {
887
+ let e = t.querySelector("dialog");
888
+ e && e.showModal();
889
+ }), t.addEventListener("close", () => {
890
+ t.remove();
891
+ });
892
+ }
893
+ #c = (e) => {
894
+ this.#i?.contains(e.target) && this.dispatchEvent(new CustomEvent("native:genui-action", {
895
+ bubbles: !0,
896
+ composed: !0,
897
+ detail: {
898
+ schemaType: this.#t.value,
899
+ action: "press",
900
+ data: e.detail
901
+ }
902
+ }));
903
+ };
904
+ };
905
+ function w(e, t = 0) {
906
+ let n = [];
907
+ if (t > 20) return n.push("Maximum nesting depth (20) exceeded"), n;
908
+ if (!e.tag || typeof e.tag != "string") return n.push("Node missing required \"tag\" property"), n;
909
+ if (S.has(e.tag.toLowerCase()) && n.push(`Forbidden tag: <${e.tag}>`), e.children) for (let r of e.children) n.push(...w(r, t + 1));
910
+ return n;
911
+ }
912
+ function T(e) {
913
+ if (S.has(e.tag.toLowerCase())) return null;
914
+ let t = document.createElement(e.tag);
915
+ if (e.id && (t.id = e.id), e.slot && (t.slot = e.slot), e.attributes) for (let [n, r] of Object.entries(e.attributes)) t.setAttribute(n, r);
916
+ if (e.properties) for (let [n, r] of Object.entries(e.properties)) t[n] = r;
917
+ if (e.text && (t.textContent = e.text), e.children) for (let n of e.children) {
918
+ let e = T(n);
919
+ e && t.appendChild(e);
920
+ }
921
+ return t;
922
+ }
923
+ /**
924
+ * Structured multi-choice input — appears before submission for
925
+ * guided input (like modern Claude chat's multiple-choice UI).
926
+ *
927
+ * ```html
928
+ * <n-chat-input-structured
929
+ * question="What would you like to do?"
930
+ * type="single"
931
+ * options='[{"value":"a","label":"Option A"},{"value":"b","label":"Option B"}]'>
932
+ * </n-chat-input-structured>
933
+ * ```
934
+ *
935
+ * @attr {string} question - Prompt text
936
+ * @attr {string} type - `single` (default) | `multi`
937
+ * @attr {string} options - JSON array of `{ value, label, description?, icon? }`
938
+ * @attr {boolean} required - At least one selection required before submit
939
+ * @attr {boolean} disabled - Disables interaction
940
+ * @fires native:structured-submit - Fired on submit with selections
941
+ * @fires native:structured-cancel - Fired when dismissed without selecting
942
+ */
943
+ var E = class extends e {
944
+ static observedAttributes = [
945
+ "question",
946
+ "type",
947
+ "options",
948
+ "required",
949
+ "disabled"
950
+ ];
951
+ #e;
952
+ #t = n("");
953
+ #n = n("single");
954
+ #r = n([]);
955
+ #i = n(!1);
956
+ #a = n(!1);
957
+ #o = n(/* @__PURE__ */ new Set());
958
+ constructor() {
959
+ super(), this.#e = this.attachInternals();
960
+ }
961
+ get question() {
962
+ return this.#t.value;
963
+ }
964
+ set question(e) {
965
+ this.#t.value = e, this.setAttribute("question", e);
966
+ }
967
+ get options() {
968
+ return this.#r.value;
969
+ }
970
+ set options(e) {
971
+ this.#r.value = e, this.setAttribute("options", JSON.stringify(e));
972
+ }
973
+ get selections() {
974
+ let e = this.#o.value;
975
+ return this.#r.value.filter((t) => e.has(t.value));
976
+ }
977
+ get disabled() {
978
+ return this.#a.value;
979
+ }
980
+ set disabled(e) {
981
+ this.#a.value = e, this.toggleAttribute("disabled", e);
982
+ }
983
+ attributeChangedCallback(e, t, n) {
984
+ if (t !== n) {
985
+ switch (e) {
986
+ case "question":
987
+ this.#t.value = n ?? "";
988
+ break;
989
+ case "type":
990
+ this.#n.value = n === "multi" ? "multi" : "single";
991
+ break;
992
+ case "options":
993
+ try {
994
+ this.#r.value = n ? JSON.parse(n) : [];
995
+ } catch {
996
+ this.#r.value = [];
997
+ }
998
+ break;
999
+ case "required":
1000
+ this.#i.value = n !== null;
1001
+ break;
1002
+ case "disabled":
1003
+ this.#a.value = n !== null;
1004
+ break;
1005
+ }
1006
+ super.attributeChangedCallback(e, t, n);
1007
+ }
1008
+ }
1009
+ setup() {
1010
+ super.setup(), this.addEffect(t(this, this.#a, this.#e)), this.addEffect(() => {
1011
+ this.#s();
1012
+ }), this.addEventListener("native:press", this.#c);
1013
+ }
1014
+ teardown() {
1015
+ this.removeEventListener("native:press", this.#c), super.teardown();
1016
+ }
1017
+ #s() {
1018
+ let e = this.#t.value, t = this.#r.value, n = this.#o.value, r = this.#n.value;
1019
+ if (this.textContent = "", e) {
1020
+ let t = document.createElement("div");
1021
+ t.className = "n-chat-structured-question", t.textContent = e, this.appendChild(t);
1022
+ }
1023
+ let i = document.createElement("div");
1024
+ i.className = "n-chat-structured-options", i.setAttribute("role", r === "multi" ? "group" : "radiogroup");
1025
+ for (let e of t) {
1026
+ let t = document.createElement("n-button"), r = n.has(e.value);
1027
+ if (t.setAttribute("variant", r ? "primary" : "outline"), t.setAttribute("data-value", e.value), t.setAttribute("aria-pressed", String(r)), e.icon) {
1028
+ let n = document.createElement("n-icon");
1029
+ n.setAttribute("name", e.icon), n.setAttribute("slot", "leading"), t.appendChild(n);
1030
+ }
1031
+ let a = document.createElement("span");
1032
+ a.setAttribute("slot", "label"), a.textContent = e.label, t.appendChild(a), i.appendChild(t);
1033
+ }
1034
+ this.appendChild(i);
1035
+ let a = document.createElement("div");
1036
+ a.className = "n-chat-structured-actions";
1037
+ let o = document.createElement("n-button");
1038
+ o.setAttribute("variant", "ghost"), o.setAttribute("size", "sm"), o.setAttribute("inline", ""), o.setAttribute("data-action", "cancel"), o.textContent = "Skip", a.appendChild(o);
1039
+ let s = document.createElement("n-button");
1040
+ s.setAttribute("variant", "primary"), s.setAttribute("size", "sm"), s.setAttribute("inline", ""), s.setAttribute("data-action", "submit"), s.textContent = "Submit", this.#i.value && n.size === 0 && s.setAttribute("disabled", ""), a.appendChild(s), this.appendChild(a);
1041
+ }
1042
+ #c = (e) => {
1043
+ if (this.#a.value) return;
1044
+ let t = e.target, n = t?.getAttribute("data-value");
1045
+ if (n) {
1046
+ let e = new Set(this.#o.value);
1047
+ this.#n.value === "single" ? (e.clear(), e.add(n)) : e.has(n) ? e.delete(n) : e.add(n), this.#o.value = e;
1048
+ return;
1049
+ }
1050
+ let r = t?.getAttribute("data-action");
1051
+ if (r === "submit") {
1052
+ this.dispatchEvent(new CustomEvent("native:structured-submit", {
1053
+ bubbles: !0,
1054
+ composed: !0,
1055
+ detail: {
1056
+ question: this.#t.value,
1057
+ selections: this.selections
1058
+ }
1059
+ }));
1060
+ return;
1061
+ }
1062
+ r === "cancel" && this.dispatchEvent(new CustomEvent("native:structured-cancel", {
1063
+ bubbles: !0,
1064
+ composed: !0,
1065
+ detail: {}
1066
+ }));
1067
+ };
1068
+ };
1069
+ export { f as a, _ as c, s as d, o as f, v as i, d as l, r as m, C as n, h as o, i as p, x as r, g as s, E as t, l as u };