@muibook/components 19.6.0 → 20.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/AGENTS.md +67 -0
  2. package/DESIGN.md +358 -0
  3. package/README.md +53 -2
  4. package/dist/esm/agent/keywords/index.js +2 -173
  5. package/dist/esm/agent/prompts/index.js +6 -432
  6. package/dist/esm/components/mui-accordion/core/index.js +25 -17
  7. package/dist/esm/components/mui-addon/index.js +14 -14
  8. package/dist/esm/components/mui-avatar/index.js +103 -43
  9. package/dist/esm/components/mui-avatar-chip/index.js +158 -0
  10. package/dist/esm/components/mui-avatar-group/index.js +88 -0
  11. package/dist/esm/components/mui-badge/index.js +37 -20
  12. package/dist/esm/components/mui-body/index.js +20 -11
  13. package/dist/esm/components/mui-button/index.js +265 -78
  14. package/dist/esm/components/mui-calendar/index.js +199 -0
  15. package/dist/esm/components/mui-card/body/index.js +33 -18
  16. package/dist/esm/components/mui-card/footer/index.js +11 -9
  17. package/dist/esm/components/mui-carousel/controller/index.js +1 -1
  18. package/dist/esm/components/mui-checkbox/index.js +23 -18
  19. package/dist/esm/components/mui-chip/index.js +219 -73
  20. package/dist/esm/components/mui-chip-input/index.js +146 -137
  21. package/dist/esm/components/mui-chip-rail/index.js +342 -0
  22. package/dist/esm/components/mui-code/index.js +26 -7
  23. package/dist/esm/components/mui-container/index.js +68 -45
  24. package/dist/esm/components/mui-date-picker/index.js +169 -0
  25. package/dist/esm/components/mui-drawer/index.js +968 -100
  26. package/dist/esm/components/mui-dropdown/index.js +255 -59
  27. package/dist/esm/components/mui-field/index.js +1 -1
  28. package/dist/esm/components/mui-file-upload/index.js +14 -4
  29. package/dist/esm/components/mui-form-group/index.js +1 -2
  30. package/dist/esm/components/mui-form-message/index.js +4 -9
  31. package/dist/esm/components/mui-heading/index.js +3 -2
  32. package/dist/esm/components/mui-hint/index.js +178 -72
  33. package/dist/esm/components/mui-icons/copy/index.js +54 -0
  34. package/dist/esm/components/mui-icons/fullscreen/index.js +5 -0
  35. package/dist/esm/components/mui-icons/icon-helper/index.js +56 -0
  36. package/dist/esm/components/mui-icons/index.js +14 -1
  37. package/dist/esm/components/mui-icons/moon/index.js +3 -1
  38. package/dist/esm/components/mui-icons/{rectangle-bottom-panel → panel}/index.js +6 -6
  39. package/dist/esm/components/mui-icons/pause/index.js +5 -0
  40. package/dist/esm/components/mui-icons/picture-in-picture/index.js +5 -0
  41. package/dist/esm/components/mui-icons/play-fill/index.js +5 -0
  42. package/dist/esm/components/mui-icons/rectangle-right-drawer/index.js +56 -0
  43. package/dist/esm/components/mui-icons/reload/index.js +5 -0
  44. package/dist/esm/components/mui-icons/speaker-mute/index.js +5 -0
  45. package/dist/esm/components/mui-icons/speaker-one-wave/index.js +5 -0
  46. package/dist/esm/components/mui-icons/speaker-two-wave/index.js +5 -0
  47. package/dist/esm/components/mui-icons/spinner/index.js +7 -5
  48. package/dist/esm/components/mui-icons/stop-fill/index.js +5 -0
  49. package/dist/esm/components/mui-icons/sun/index.js +5 -5
  50. package/dist/esm/components/mui-icons/timer/index.js +54 -0
  51. package/dist/esm/components/mui-icons/toggle/index.js +16 -6
  52. package/dist/esm/components/mui-icons/vertical-ellipsis/index.js +5 -0
  53. package/dist/esm/components/mui-illustrations/trash/index.js +6 -5
  54. package/dist/esm/components/mui-input/index.js +96 -67
  55. package/dist/esm/components/mui-link/index.js +352 -96
  56. package/dist/esm/components/mui-media-player/index.js +1577 -83
  57. package/dist/esm/components/mui-message/index.js +7 -6
  58. package/dist/esm/components/mui-model-viewer/index.js +258 -0
  59. package/dist/esm/components/mui-progress-ring/index.js +349 -0
  60. package/dist/esm/components/mui-prompt/index.js +143 -115
  61. package/dist/esm/components/mui-prompt-preview/index.js +11 -23
  62. package/dist/esm/components/mui-radio/index.js +38 -17
  63. package/dist/esm/components/mui-range-input/index.js +9 -4
  64. package/dist/esm/components/mui-responsive/index.js +60 -27
  65. package/dist/esm/components/mui-search-input/index.js +300 -0
  66. package/dist/esm/components/mui-select/index.js +235 -46
  67. package/dist/esm/components/mui-slat/slat/index.js +40 -12
  68. package/dist/esm/components/mui-spinner/index.js +11 -9
  69. package/dist/esm/components/mui-stack/hstack/index.js +10 -5
  70. package/dist/esm/components/mui-status/index.js +239 -0
  71. package/dist/esm/components/mui-stepper/step/index.js +46 -32
  72. package/dist/esm/components/mui-switch/index.js +37 -26
  73. package/dist/esm/components/mui-table/row/index.js +2 -6
  74. package/dist/esm/components/mui-table/table/index.js +157 -14
  75. package/dist/esm/components/mui-tabs/controller/index.js +17 -6
  76. package/dist/esm/components/mui-tabs/item/index.js +17 -5
  77. package/dist/esm/components/mui-tabs/tab-bar/index.js +93 -39
  78. package/dist/esm/components/mui-textarea/index.js +43 -26
  79. package/dist/esm/components/mui-time/index/index.js +336 -0
  80. package/dist/esm/components/mui-time-picker/index.js +126 -0
  81. package/dist/esm/components/mui-video-thumbnail/index.js +205 -0
  82. package/dist/esm/css/mui-brand.css +12 -8
  83. package/dist/esm/css/mui-tokens.css +646 -344
  84. package/dist/esm/css/readme.md +2 -2
  85. package/dist/esm/custom-elements.json +4506 -1707
  86. package/dist/esm/dynamic-attrs.json +271 -54
  87. package/dist/esm/index.js +33 -6
  88. package/dist/esm/knowledge/compositions/index.js +1560 -0
  89. package/dist/esm/knowledge/index.js +28 -0
  90. package/dist/esm/knowledge/keywords/index.js +306 -0
  91. package/dist/esm/knowledge/rules/index.js +199 -0
  92. package/dist/esm/tokens/js/index.js +143 -139
  93. package/dist/types/agent/keywords/index.d.ts +1 -1
  94. package/dist/types/components/mui-avatar-chip/api.d.ts +28 -0
  95. package/dist/types/components/mui-avatar-chip/index.d.ts +18 -0
  96. package/dist/types/components/mui-avatar-group/api.d.ts +28 -0
  97. package/dist/types/components/mui-avatar-group/doc.d.ts +2 -0
  98. package/dist/types/components/mui-avatar-group/index.d.ts +1 -0
  99. package/dist/types/components/mui-button/api.d.ts +6 -2
  100. package/dist/types/components/mui-calendar/api.d.ts +41 -0
  101. package/dist/types/components/mui-calendar/doc.d.ts +2 -0
  102. package/dist/types/components/mui-calendar/index.d.ts +3 -0
  103. package/dist/types/components/mui-checkbox/api.d.ts +4 -0
  104. package/dist/types/components/mui-chip/api.d.ts +4 -0
  105. package/dist/types/components/mui-chip-input/api.d.ts +4 -0
  106. package/dist/types/components/mui-chip-rail/api.d.ts +21 -0
  107. package/dist/types/components/mui-chip-rail/doc.d.ts +2 -0
  108. package/dist/types/components/mui-chip-rail/index.d.ts +4 -0
  109. package/dist/types/components/mui-date-picker/api.d.ts +38 -0
  110. package/dist/types/components/mui-date-picker/doc.d.ts +2 -0
  111. package/dist/types/components/mui-date-picker/index.d.ts +6 -0
  112. package/dist/types/components/mui-drawer/api.d.ts +4 -0
  113. package/dist/types/components/mui-drawer/index.d.ts +2 -0
  114. package/dist/types/components/mui-file-upload/api.d.ts +4 -0
  115. package/dist/types/components/mui-icons/fullscreen.d.ts +1 -0
  116. package/dist/types/components/mui-icons/icon-helper.d.ts +1 -0
  117. package/dist/types/components/mui-icons/index.d.ts +14 -1
  118. package/dist/types/components/mui-icons/panel.d.ts +1 -0
  119. package/dist/types/components/mui-icons/pause.d.ts +1 -0
  120. package/dist/types/components/mui-icons/picture-in-picture.d.ts +1 -0
  121. package/dist/types/components/mui-icons/play-fill.d.ts +1 -0
  122. package/dist/types/components/mui-icons/rectangle-right-drawer.d.ts +1 -0
  123. package/dist/types/components/mui-icons/reload.d.ts +1 -0
  124. package/dist/types/components/mui-icons/speaker-mute.d.ts +1 -0
  125. package/dist/types/components/mui-icons/speaker-one-wave.d.ts +1 -0
  126. package/dist/types/components/mui-icons/speaker-two-wave.d.ts +1 -0
  127. package/dist/types/components/mui-icons/stop-fill.d.ts +1 -0
  128. package/dist/types/components/mui-icons/timer.d.ts +1 -0
  129. package/dist/types/components/mui-icons/vertical-ellipsis.d.ts +1 -0
  130. package/dist/types/components/mui-input/api.d.ts +12 -0
  131. package/dist/types/components/mui-link/api.d.ts +4 -0
  132. package/dist/types/components/mui-media-player/api.d.ts +4 -0
  133. package/dist/types/components/mui-media-player/index.d.ts +13 -4
  134. package/dist/types/components/mui-model-viewer/api.d.ts +28 -0
  135. package/dist/types/components/mui-model-viewer/doc.d.ts +2 -0
  136. package/dist/types/components/mui-model-viewer/index.d.ts +17 -0
  137. package/dist/types/components/mui-progress-ring/api.d.ts +24 -0
  138. package/dist/types/components/mui-progress-ring/doc.d.ts +2 -0
  139. package/dist/types/components/mui-progress-ring/index.d.ts +1 -0
  140. package/dist/types/components/mui-radio/api.d.ts +12 -0
  141. package/dist/types/components/mui-range-input/api.d.ts +4 -0
  142. package/dist/types/components/mui-responsive/api.d.ts +10 -2
  143. package/dist/types/components/mui-search-input/api.d.ts +40 -0
  144. package/dist/types/components/mui-search-input/doc.d.ts +2 -0
  145. package/dist/types/components/mui-search-input/index.d.ts +3 -0
  146. package/dist/types/components/mui-select/api.d.ts +12 -0
  147. package/dist/types/components/mui-status/api.d.ts +24 -0
  148. package/dist/types/components/mui-status/doc.d.ts +2 -0
  149. package/dist/types/components/mui-status/index.d.ts +1 -0
  150. package/dist/types/components/mui-switch/api.d.ts +4 -0
  151. package/dist/types/components/mui-table/api.d.ts +15 -0
  152. package/dist/types/components/mui-textarea/api.d.ts +12 -0
  153. package/dist/types/components/mui-time/api.d.ts +41 -0
  154. package/dist/types/components/mui-time/doc.d.ts +2 -0
  155. package/dist/types/components/mui-time/index.d.ts +1 -0
  156. package/dist/types/components/mui-time-picker/api.d.ts +38 -0
  157. package/dist/types/components/mui-time-picker/doc.d.ts +2 -0
  158. package/dist/types/components/mui-time-picker/index.d.ts +4 -0
  159. package/dist/types/components/mui-video-thumbnail/api.d.ts +28 -0
  160. package/dist/types/components/mui-video-thumbnail/doc.d.ts +2 -0
  161. package/dist/types/components/mui-video-thumbnail/index.d.ts +1 -0
  162. package/dist/types/index.d.ts +27 -2
  163. package/dist/types/knowledge/compositions.d.ts +4644 -0
  164. package/dist/types/knowledge/index.d.ts +4657 -0
  165. package/dist/types/knowledge/keywords.d.ts +4 -0
  166. package/dist/types/knowledge/rules.d.ts +1 -0
  167. package/dist/types/tokens/js/index.d.ts +11 -7
  168. package/package.json +131 -12
  169. package/dist/esm/components/mui-form-hint/index.js +0 -1
  170. package/dist/types/components/mui-form-hint/index.d.ts +0 -1
  171. /package/dist/types/components/{mui-form-hint → mui-avatar-chip}/doc.d.ts +0 -0
  172. /package/dist/types/components/mui-icons/{rectangle-bottom-panel.d.ts → copy.d.ts} +0 -0
@@ -20,8 +20,8 @@ class S extends HTMLElement {
20
20
  constructor() {
21
21
  super(), this.triggerEl = null, this.previewShellEl = null, this.previewRowEl = null, this.previewSlotEl = null, this.previewResizeObserver = null, this.fanAnimations = /* @__PURE__ */ new Map(), this.pendingColorFade = !1, this.lastDebugPayload = '{"event":"idle"}', this.lightDomObserver = null, this.onActionsSlotChange = () => this.updateActionsLayout(), this.enforceActionVariants = () => {
22
22
  if (!this.shadowRoot) return;
23
- const e = Array.from(this.shadowRoot.querySelectorAll('slot[name="actions"], slot[name="actions-right"]')), o = (r, n) => {
24
- if (!n || r.tagName.toLowerCase() !== "mui-button") return;
23
+ const e = Array.from(this.shadowRoot.querySelectorAll('slot[name="actions"], slot[name="actions-right"]')), o = (r, s) => {
24
+ if (!s || r.tagName.toLowerCase() !== "mui-button") return;
25
25
  if (r.hasAttribute("icon-only")) {
26
26
  r.style.marginRight = "var(--space-025)";
27
27
  return;
@@ -29,16 +29,16 @@ class S extends HTMLElement {
29
29
  r.style.marginRight === "var(--space-025)" && (r.style.marginRight = "");
30
30
  };
31
31
  e.forEach((r) => {
32
- const n = r.name === "actions";
32
+ const s = r.name === "actions";
33
33
  r.assignedElements({ flatten: !0 }).forEach((a) => {
34
- [a, ...Array.from(a.querySelectorAll("*"))].forEach((m) => {
35
- const p = m.tagName.toLowerCase();
34
+ [a, ...Array.from(a.querySelectorAll("*"))].forEach((h) => {
35
+ const p = h.tagName.toLowerCase();
36
36
  if (p === "mui-button") {
37
- m.setAttribute("variant", "tertiary"), o(m, n);
37
+ h.setAttribute("variant", "tertiary"), o(h, s);
38
38
  return;
39
39
  }
40
- p === "mui-dropdown" && m.querySelectorAll('[slot="action"]').forEach((d) => {
41
- d instanceof HTMLElement && d.tagName.toLowerCase() === "mui-button" && (d.setAttribute("variant", "tertiary"), o(d, n));
40
+ p === "mui-dropdown" && h.querySelectorAll('[slot="action"]').forEach((c) => {
41
+ c instanceof HTMLElement && c.tagName.toLowerCase() === "mui-button" && (c.setAttribute("variant", "tertiary"), o(c, s));
42
42
  });
43
43
  });
44
44
  });
@@ -48,38 +48,38 @@ class S extends HTMLElement {
48
48
  }, this.onPaste = (t) => {
49
49
  const e = t, o = e.clipboardData;
50
50
  if (!o) return;
51
- const r = Array.from(o.files || []), n = o.getData("text/plain") || "", i = n.trim(), a = i.length > 0, l = a ? this.detectMediaUrl(i) : null, m = this.getAttribute("preview-overflow-to-preview") !== "false", p = this.getAttribute("preview-threshold-chars"), c = Number.isFinite(Number.parseInt(p || "", 10)) ? Math.max(1, Number.parseInt(p || "", 10)) : 220, d = a ? this.detectBadge(i) : "", u = d !== "" && d !== "Insightful", b = m && a && (!!(l != null && l.url) || i.length >= c || u), h = r.length > 0;
52
- if (!h && !a) return;
53
- (h || b) && e.preventDefault();
54
- const v = r.map((s) => ({
55
- kind: s.type.startsWith("image/") ? "image" : s.type.startsWith("video/") ? "video" : s.type.startsWith("audio/") ? "audio" : "file",
56
- mimeType: s.type || "",
57
- file: s,
58
- fileName: s.name || "",
59
- size: s.size || 0,
60
- badge: s.type.startsWith("image/") ? "IMG" : s.type.startsWith("video/") ? "VIDEO" : s.type.startsWith("audio/") ? "MUSIC" : "FILE",
61
- preview: s.name || "Pasted file",
62
- value: s.name || ""
51
+ const r = Array.from(o.files || []), s = o.getData("text/plain") || "", i = s.trim(), a = i.length > 0, l = a ? this.detectMediaUrl(i) : null, h = this.getAttribute("preview-overflow-to-preview") !== "false", p = this.getAttribute("preview-threshold-chars"), m = Number.isFinite(Number.parseInt(p || "", 10)) ? Math.max(1, Number.parseInt(p || "", 10)) : 220, c = a ? this.detectBadge(i) : "", u = c !== "" && c !== "Insightful", b = h && a && (!!(l != null && l.url) || i.length >= m || u), v = r.length > 0;
52
+ if (!v && !a) return;
53
+ (v || b) && e.preventDefault();
54
+ const n = r.map((d) => ({
55
+ kind: d.type.startsWith("image/") ? "image" : d.type.startsWith("video/") ? "video" : d.type.startsWith("audio/") ? "audio" : "file",
56
+ mimeType: d.type || "",
57
+ file: d,
58
+ fileName: d.name || "",
59
+ size: d.size || 0,
60
+ badge: d.type.startsWith("image/") ? "IMG" : d.type.startsWith("video/") ? "VIDEO" : d.type.startsWith("audio/") ? "MUSIC" : "FILE",
61
+ preview: d.name || "Pasted file",
62
+ value: d.name || ""
63
63
  }));
64
- b && i && (l != null && l.url ? v.unshift({
64
+ b && i && (l != null && l.url ? n.unshift({
65
65
  kind: l.kind === "image" ? "image" : "text",
66
66
  mimeType: l.mimeType,
67
67
  badge: l.badge,
68
68
  preview: l.url,
69
69
  value: l.url
70
- }) : v.unshift({
70
+ }) : n.unshift({
71
71
  kind: "text",
72
72
  mimeType: "text/plain",
73
73
  badge: this.detectBadge(i),
74
74
  preview: i.slice(0, 260),
75
- value: n
75
+ value: s
76
76
  })), this.emitPromptItems({
77
77
  source: "paste",
78
- items: v,
79
- text: n || "",
80
- textBadge: (l == null ? void 0 : l.badge) || d,
78
+ items: n,
79
+ text: s || "",
80
+ textBadge: (l == null ? void 0 : l.badge) || c,
81
81
  overflowed: b,
82
- thresholdChars: c
82
+ thresholdChars: m
83
83
  });
84
84
  }, this.onInput = (t) => {
85
85
  const e = t.target;
@@ -135,8 +135,8 @@ class S extends HTMLElement {
135
135
  }, this.onContextChipDismiss = (t) => {
136
136
  t.composedPath().find(
137
137
  (r) => {
138
- var n, i, a;
139
- return r instanceof HTMLElement && (((n = r.hasAttribute) == null ? void 0 : n.call(r, "context-active")) || ((i = r.hasAttribute) == null ? void 0 : i.call(r, "context-chip")) || ((a = r.hasAttribute) == null ? void 0 : a.call(r, "context-spinner")));
138
+ var s, i, a;
139
+ return r instanceof HTMLElement && (((s = r.hasAttribute) == null ? void 0 : s.call(r, "context-active")) || ((i = r.hasAttribute) == null ? void 0 : i.call(r, "context-chip")) || ((a = r.hasAttribute) == null ? void 0 : a.call(r, "context-spinner")));
140
140
  }
141
141
  ) && (this.setContextMode("icon", "dismiss"), this.updateActionsLayout());
142
142
  }, this.toggleFanOpen = () => {
@@ -160,6 +160,7 @@ class S extends HTMLElement {
160
160
  "preview-loading-label",
161
161
  "preview-dialog-width",
162
162
  "preview-dialog-title",
163
+ "preview-dialog-bordered",
163
164
  "context-mode",
164
165
  "effects-off",
165
166
  "color-layout",
@@ -183,17 +184,17 @@ class S extends HTMLElement {
183
184
  }
184
185
  setDebugState(t, e) {
185
186
  if (!this.shadowRoot) return;
186
- const o = this.shadowRoot.querySelector(".debug-region"), r = this.shadowRoot.querySelector("#promptDebugStatus"), n = this.shadowRoot.querySelector("#promptDebugPayload");
187
- if (!o || !r || !n) return;
187
+ const o = this.shadowRoot.querySelector(".debug-region"), r = this.shadowRoot.querySelector("#promptDebugStatus"), s = this.shadowRoot.querySelector("#promptDebugPayload");
188
+ if (!o || !r || !s) return;
188
189
  const i = this.hasAttribute("debug");
189
- o.toggleAttribute("hidden", !i), i && (r.textContent = t, e && (this.lastDebugPayload = JSON.stringify(e)), n.textContent = this.lastDebugPayload);
190
+ o.toggleAttribute("hidden", !i), i && (r.textContent = t, e && (this.lastDebugPayload = JSON.stringify(e)), s.textContent = this.lastDebugPayload);
190
191
  }
191
192
  emitPromptItems({
192
193
  items: t,
193
194
  text: e,
194
195
  textBadge: o,
195
196
  overflowed: r,
196
- thresholdChars: n,
197
+ thresholdChars: s,
197
198
  source: i
198
199
  }) {
199
200
  this.dispatchEvent(
@@ -204,7 +205,7 @@ class S extends HTMLElement {
204
205
  text: e,
205
206
  textBadge: o,
206
207
  overflowed: r,
207
- thresholdChars: n,
208
+ thresholdChars: s,
208
209
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
209
210
  },
210
211
  bubbles: !0,
@@ -235,20 +236,18 @@ class S extends HTMLElement {
235
236
  if (!this.shadowRoot) return;
236
237
  const t = this.normalizeContextMode(this.getAttribute("context-mode"));
237
238
  Array.from(
238
- this.shadowRoot.querySelectorAll(
239
- 'slot[name="actions"], slot[name="actions-right"]'
240
- )
239
+ this.shadowRoot.querySelectorAll('slot[name="actions"], slot[name="actions-right"]')
241
240
  ).flatMap((r) => r.assignedElements({ flatten: !0 })).forEach((r) => {
242
241
  [r, ...Array.from(r.querySelectorAll("*"))].forEach((i) => {
243
- const l = i.tagName.toLowerCase() === "mui-prompt-toggle", m = i.hasAttribute("context-toggle"), p = i.hasAttribute("context-active") || i.hasAttribute("context-close") || i.hasAttribute("context-chip") || i.hasAttribute("context-spinner");
242
+ const l = i.tagName.toLowerCase() === "mui-prompt-toggle", h = i.hasAttribute("context-toggle"), p = i.hasAttribute("context-active") || i.hasAttribute("context-close") || i.hasAttribute("context-chip") || i.hasAttribute("context-spinner");
244
243
  if (l) {
245
244
  i.setAttribute("mode", t);
246
245
  return;
247
246
  }
248
- if (m || p) {
247
+ if (h || p) {
249
248
  i.hasAttribute("context-chip") && i.tagName.toLowerCase() === "mui-chip" && !i.hasAttribute("variant") && i.setAttribute("variant", "ghost");
250
- const c = m ? t === "icon" : t === "chip";
251
- i.toggleAttribute("hidden", !c), i.style.display = c ? "inline-flex" : "none";
249
+ const m = h ? t === "icon" : t === "chip";
250
+ i.toggleAttribute("hidden", !m), i.style.display = m ? "inline-flex" : "none";
252
251
  }
253
252
  });
254
253
  });
@@ -286,9 +285,9 @@ class S extends HTMLElement {
286
285
  return;
287
286
  }
288
287
  if (t === "context-mode") {
289
- const n = this.normalizeContextMode(o);
290
- if (o !== n) {
291
- this.setAttribute("context-mode", n);
288
+ const s = this.normalizeContextMode(o);
289
+ if (o !== s) {
290
+ this.setAttribute("context-mode", s);
292
291
  return;
293
292
  }
294
293
  this.syncContextModeUI(), this.updateActionsLayout();
@@ -434,10 +433,10 @@ class S extends HTMLElement {
434
433
  t == null || t.focus();
435
434
  }
436
435
  syncTextareaHeight(t) {
437
- const o = Number.parseInt(this.getAttribute("rows") || String(3), 10) || 3, r = Math.max(o + 6, 10), n = getComputedStyle(t), a = (Number.parseFloat(n.fontSize) || 16) * 1.55, l = Number.parseFloat(n.paddingTop) || 0, m = Number.parseFloat(n.paddingBottom) || 0, p = Number.parseFloat(n.borderTopWidth) || 0, c = Number.parseFloat(n.borderBottomWidth) || 0, d = l + m + p + c, u = 3 * a + d, b = r * a + d;
436
+ const o = Number.parseInt(this.getAttribute("rows") || String(3), 10) || 3, r = Math.max(o + 6, 10), s = getComputedStyle(t), a = (Number.parseFloat(s.fontSize) || 16) * 1.55, l = Number.parseFloat(s.paddingTop) || 0, h = Number.parseFloat(s.paddingBottom) || 0, p = Number.parseFloat(s.borderTopWidth) || 0, m = Number.parseFloat(s.borderBottomWidth) || 0, c = l + h + p + m, u = 3 * a + c, b = r * a + c;
438
437
  t.style.height = "auto";
439
- const h = t.scrollHeight, v = Math.max(u, Math.min(h, b));
440
- t.style.height = `${Math.ceil(v)}px`, t.style.overflowY = h > b ? "auto" : "hidden";
438
+ const v = t.scrollHeight, n = Math.max(u, Math.min(v, b));
439
+ t.style.height = `${Math.ceil(n)}px`, t.style.overflowY = v > b ? "auto" : "hidden";
441
440
  }
442
441
  detectBadge(t) {
443
442
  const e = t.trim();
@@ -476,7 +475,7 @@ class S extends HTMLElement {
476
475
  const o = e.match(/https?:\/\/[^\s]+/i), r = ((o == null ? void 0 : o[0]) || e).trim();
477
476
  if (!/^https?:\/\//i.test(r)) return null;
478
477
  try {
479
- const n = new URL(r), i = n.pathname.toLowerCase(), a = n.hostname.toLowerCase();
478
+ const s = new URL(r), i = s.pathname.toLowerCase(), a = s.hostname.toLowerCase();
480
479
  if (/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/.test(i))
481
480
  return { url: r, kind: "image", badge: "IMG", mimeType: "image/*" };
482
481
  if (a === "youtu.be" || a.endsWith("youtube.com") || a.endsWith("youtube-nocookie.com"))
@@ -495,13 +494,13 @@ class S extends HTMLElement {
495
494
  return null;
496
495
  }
497
496
  bindEvents() {
498
- var n;
497
+ var s;
499
498
  if (!this.shadowRoot) return;
500
499
  this.unbindEvents();
501
500
  const t = this.shadowRoot.querySelector("textarea");
502
501
  t == null || t.addEventListener("input", this.onInput), t == null || t.addEventListener("keydown", this.onKeyDown), t == null || t.addEventListener("paste", this.onPaste), t == null || t.addEventListener("focus", this.onTextareaFocus);
503
502
  const e = this.shadowRoot.querySelector('slot[name="actions"]'), o = this.shadowRoot.querySelector('slot[name="actions-right"]'), r = this.shadowRoot.querySelector("#promptDefaultSubmitAction");
504
- e == null || e.addEventListener("slotchange", this.onActionsSlotChange), o == null || o.addEventListener("slotchange", this.onActionsSlotChange), typeof MutationObserver < "u" && ((n = this.lightDomObserver) == null || n.disconnect(), this.lightDomObserver = new MutationObserver(() => this.updateActionsLayout()), this.lightDomObserver.observe(this, {
503
+ e == null || e.addEventListener("slotchange", this.onActionsSlotChange), o == null || o.addEventListener("slotchange", this.onActionsSlotChange), typeof MutationObserver < "u" && ((s = this.lightDomObserver) == null || s.disconnect(), this.lightDomObserver = new MutationObserver(() => this.updateActionsLayout()), this.lightDomObserver.observe(this, {
505
504
  childList: !0,
506
505
  subtree: !0,
507
506
  attributes: !0,
@@ -509,10 +508,10 @@ class S extends HTMLElement {
509
508
  })), r == null || r.addEventListener("click", this.onDefaultSubmitClick), this.addEventListener("prompt-preview-open", this.onPreviewOpen), this.addEventListener("click", this.onContextToggleClick), this.addEventListener("dismiss", this.onContextChipDismiss), this.syncErrorVisibility(), this.bindPreviewOverflow(), this.bindActionTrigger(), this.syncLoadingState();
510
509
  }
511
510
  unbindEvents() {
512
- var n, i, a, l;
511
+ var s, i, a, l;
513
512
  if (!this.shadowRoot) return;
514
513
  const t = this.shadowRoot.querySelector("textarea"), e = this.shadowRoot.querySelector('slot[name="actions"]'), o = this.shadowRoot.querySelector('slot[name="actions-right"]'), r = this.shadowRoot.querySelector("#promptDefaultSubmitAction");
515
- t == null || t.removeEventListener("input", this.onInput), t == null || t.removeEventListener("keydown", this.onKeyDown), t == null || t.removeEventListener("paste", this.onPaste), t == null || t.removeEventListener("focus", this.onTextareaFocus), r == null || r.removeEventListener("click", this.onDefaultSubmitClick), e == null || e.removeEventListener("slotchange", this.onActionsSlotChange), o == null || o.removeEventListener("slotchange", this.onActionsSlotChange), this.removeEventListener("prompt-preview-open", this.onPreviewOpen), this.removeEventListener("click", this.onContextToggleClick), this.removeEventListener("dismiss", this.onContextChipDismiss), this.triggerEl && (this.triggerEl.removeEventListener("click", this.toggleFanOpen), this.triggerEl = null), (n = this.previewRowEl) == null || n.removeEventListener("scroll", this.onPreviewScroll), (i = this.previewSlotEl) == null || i.removeEventListener("slotchange", this.onPreviewSlotChange), (a = this.previewResizeObserver) == null || a.disconnect(), this.previewResizeObserver = null, (l = this.lightDomObserver) == null || l.disconnect(), this.lightDomObserver = null, this.previewShellEl = null, this.previewRowEl = null, this.previewSlotEl = null;
514
+ t == null || t.removeEventListener("input", this.onInput), t == null || t.removeEventListener("keydown", this.onKeyDown), t == null || t.removeEventListener("paste", this.onPaste), t == null || t.removeEventListener("focus", this.onTextareaFocus), r == null || r.removeEventListener("click", this.onDefaultSubmitClick), e == null || e.removeEventListener("slotchange", this.onActionsSlotChange), o == null || o.removeEventListener("slotchange", this.onActionsSlotChange), this.removeEventListener("prompt-preview-open", this.onPreviewOpen), this.removeEventListener("click", this.onContextToggleClick), this.removeEventListener("dismiss", this.onContextChipDismiss), this.triggerEl && (this.triggerEl.removeEventListener("click", this.toggleFanOpen), this.triggerEl = null), (s = this.previewRowEl) == null || s.removeEventListener("scroll", this.onPreviewScroll), (i = this.previewSlotEl) == null || i.removeEventListener("slotchange", this.onPreviewSlotChange), (a = this.previewResizeObserver) == null || a.disconnect(), this.previewResizeObserver = null, (l = this.lightDomObserver) == null || l.disconnect(), this.lightDomObserver = null, this.previewShellEl = null, this.previewRowEl = null, this.previewSlotEl = null;
516
515
  }
517
516
  bindPreviewOverflow() {
518
517
  var t, e;
@@ -539,27 +538,27 @@ class S extends HTMLElement {
539
538
  });
540
539
  return;
541
540
  }
542
- const n = e === "auto" ? this.hasAttribute("loading") : !0;
541
+ const s = e === "auto" ? this.hasAttribute("loading") : !0;
543
542
  r.forEach((a) => {
544
- a.tagName.toLowerCase() === "mui-prompt-preview" && (n ? a.setAttribute("loading", "") : a.removeAttribute("loading"), o && a.setAttribute("loading-label", o));
543
+ a.tagName.toLowerCase() === "mui-prompt-preview" && (s ? a.setAttribute("loading", "") : a.removeAttribute("loading"), o && a.setAttribute("loading-label", o));
545
544
  });
546
545
  }
547
546
  normalizePreviewDetail(t) {
548
- const e = String(t.value || "").trim(), o = String(t.bgImage || "").trim(), r = String(t.badge || "").trim(), n = String(t.label || "Pasted Content"), i = String(t.imageTint || "").trim(), a = o ? "image" : e ? "code" : "text";
547
+ const e = String(t.value || "").trim(), o = String(t.bgImage || "").trim(), r = String(t.badge || "").trim(), s = String(t.label || "Pasted Content"), i = String(t.imageTint || "").trim(), a = o ? "image" : e ? "code" : "text";
549
548
  return {
550
549
  id: String(t.id || ""),
551
550
  value: e,
552
551
  badge: r || (o ? "IMG" : this.detectBadge(e)),
553
- label: n,
552
+ label: s,
554
553
  bgImage: o,
555
554
  imageTint: i,
556
555
  type: a
557
556
  };
558
557
  }
559
558
  openInternalPreviewDialog(t) {
560
- var f;
559
+ var y;
561
560
  if (!this.shadowRoot) return;
562
- const e = this.shadowRoot.querySelector("#promptAutoPreviewDialog"), o = this.shadowRoot.querySelector("#promptAutoPreviewTitle"), r = this.shadowRoot.querySelector("#promptAutoPreviewCode"), n = this.shadowRoot.querySelector("#promptAutoPreviewImage"), i = this.shadowRoot.querySelector("#promptAutoPreviewMedia"), a = this.shadowRoot.querySelector("#promptAutoPreviewMediaUrl"), l = this.normalizePreviewDetail(t), m = this.getAttribute("preview-dialog-title") || l.label, p = l.value, c = l.bgImage, d = l.badge, u = p ? this.detectMediaUrl(p) : null, b = !c && p.length > 0 && (d === "VIDEO" || d === "MUSIC"), h = !c && (!!(u && (u.kind === "video" || u.kind === "audio")) || b), v = c.length > 0, s = p.length > 0, y = (() => {
561
+ const e = this.shadowRoot.querySelector("#promptAutoPreviewDialog"), o = this.shadowRoot.querySelector("#promptAutoPreviewTitle"), r = this.shadowRoot.querySelector("#promptAutoPreviewCode"), s = this.shadowRoot.querySelector("#promptAutoPreviewImage"), i = this.shadowRoot.querySelector("#promptAutoPreviewMedia"), a = this.shadowRoot.querySelector("#promptAutoPreviewMediaUrl"), l = this.normalizePreviewDetail(t), h = this.getAttribute("preview-dialog-title") || l.label, p = l.value, m = l.bgImage, c = l.badge, u = p ? this.detectMediaUrl(p) : null, b = !m && p.length > 0 && (c === "VIDEO" || c === "MUSIC"), v = !m && (!!(u && (u.kind === "video" || u.kind === "audio")) || b), n = m.length > 0, d = p.length > 0, f = (() => {
563
562
  if (!u || u.kind !== "audio") return !1;
564
563
  try {
565
564
  const g = new URL(u.url);
@@ -568,25 +567,25 @@ class S extends HTMLElement {
568
567
  return !1;
569
568
  }
570
569
  })(), w = (() => {
571
- if (!u || !y) return "";
570
+ if (!u || !f) return "";
572
571
  try {
573
- const x = new URL(u.url).pathname.split("/").filter(Boolean).pop() || "", A = decodeURIComponent(x), E = A.replace(/\.(mp3|wav|m4a|aac|flac|ogg|oga)$/i, "") || A || "Audio";
572
+ const A = new URL(u.url).pathname.split("/").filter(Boolean).pop() || "", x = decodeURIComponent(A), E = x.replace(/\.(mp3|wav|m4a|aac|flac|ogg|oga)$/i, "") || x || "Audio";
574
573
  return E.charAt(0).toUpperCase() + E.slice(1);
575
574
  } catch {
576
575
  return "Audio";
577
576
  }
578
577
  })();
579
- if (!(!v && !s && !h)) {
580
- if (this.setAttribute("preview-dialog-value", p), this.setAttribute("preview-dialog-image", c), this.setAttribute("preview-dialog-type", d || (v ? "IMG" : "CODE")), o && (o.textContent = m), h ? e == null || e.setAttribute("content-max-height", "none") : e == null || e.removeAttribute("content-max-height"), v)
581
- a && a.setAttribute("hidden", ""), n && (n.setAttribute("src", c), n.removeAttribute("hidden")), i && i.setAttribute("hidden", ""), r && r.setAttribute("hidden", "");
582
- else if (h && u) {
578
+ if (!(!n && !d && !v)) {
579
+ if (this.setAttribute("preview-dialog-value", p), this.setAttribute("preview-dialog-image", m), this.setAttribute("preview-dialog-type", c || (n ? "IMG" : "CODE")), o && (o.textContent = h), v ? e == null || e.setAttribute("content-max-height", "none") : e == null || e.removeAttribute("content-max-height"), n)
580
+ a && a.setAttribute("hidden", ""), s && (s.setAttribute("src", m), s.removeAttribute("hidden")), i && i.setAttribute("hidden", ""), r && r.setAttribute("hidden", "");
581
+ else if (v && u) {
583
582
  if (a) {
584
- const g = y;
583
+ const g = f;
585
584
  a.textContent = g ? w : u.url, g ? (a.setAttribute("href", u.url), a.setAttribute("target", "_blank"), a.setAttribute("rel", "noopener noreferrer")) : (a.removeAttribute("href"), a.removeAttribute("target"), a.removeAttribute("rel")), a.toggleAttribute("hidden", !g);
586
585
  }
587
- i && (i.setAttribute("src", u.url), i.removeAttribute("type"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), n && (n.removeAttribute("src"), n.setAttribute("hidden", ""));
588
- } else b ? (a && (a.textContent = p, a.toggleAttribute("hidden", !0)), i && (i.setAttribute("src", p), i.setAttribute("type", d === "VIDEO" ? "video" : "audio"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), n && (n.removeAttribute("src"), n.setAttribute("hidden", ""))) : (a && a.setAttribute("hidden", ""), r && (r.textContent = this.formatPreviewCode(p, d), r.removeAttribute("hidden")), i && (i.removeAttribute("src"), i.removeAttribute("prefer-native-controls"), i.setAttribute("hidden", "")), n && (n.removeAttribute("src"), n.setAttribute("hidden", "")));
589
- (f = e == null ? void 0 : e.open) == null || f.call(e);
586
+ i && (i.setAttribute("src", u.url), i.removeAttribute("type"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), s && (s.removeAttribute("src"), s.setAttribute("hidden", ""));
587
+ } else b ? (a && (a.textContent = p, a.toggleAttribute("hidden", !0)), i && (i.setAttribute("src", p), i.setAttribute("type", c === "VIDEO" ? "video" : "audio"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), s && (s.removeAttribute("src"), s.setAttribute("hidden", ""))) : (a && a.setAttribute("hidden", ""), r && (r.textContent = this.formatPreviewCode(p, c), r.removeAttribute("hidden")), i && (i.removeAttribute("src"), i.removeAttribute("prefer-native-controls"), i.setAttribute("hidden", "")), s && (s.removeAttribute("src"), s.setAttribute("hidden", "")));
588
+ (y = e == null ? void 0 : e.open) == null || y.call(e);
590
589
  }
591
590
  }
592
591
  syncPreviewEdgeShadows() {
@@ -609,9 +608,9 @@ class S extends HTMLElement {
609
608
  e && (e.setAttribute("hidden", ""), e.style.display = "none");
610
609
  return;
611
610
  }
612
- const n = o.length === 1 && this.isContextOnlyAction(o[0]);
613
- e && (e.toggleAttribute("hidden", n), e.style.display = n ? "none" : "inline-flex");
614
- const i = n || !r ? null : e;
611
+ const s = o.length === 1 && this.isContextOnlyAction(o[0]);
612
+ e && (e.toggleAttribute("hidden", s), e.style.display = s ? "none" : "inline-flex");
613
+ const i = s || !r ? null : e;
615
614
  i && (this.triggerEl = i, this.triggerEl.addEventListener("click", this.toggleFanOpen), this.syncTriggerIconState());
616
615
  }
617
616
  syncTriggerIconState() {
@@ -636,74 +635,75 @@ class S extends HTMLElement {
636
635
  const t = this.shadowRoot.querySelector('slot[name="actions"]'), e = this.shadowRoot.querySelector("#promptDefaultActionsTrigger");
637
636
  if (!t) return;
638
637
  const o = t.assignedElements({ flatten: !0 }).filter(
639
- (s) => !s.hasAttribute("hidden")
640
- ), r = o.length > 0, n = this.shadowRoot.querySelector(".actions-slot-left");
641
- n && (n.style.display = r ? "inline-flex" : "none");
638
+ (n) => !n.hasAttribute("hidden")
639
+ ), r = o.length > 0, s = this.shadowRoot.querySelector(".actions-slot-left");
640
+ s && (s.style.display = r ? "inline-flex" : "none");
642
641
  const i = o.length === 1 && this.isContextOnlyAction(o[0]);
643
642
  if (e) {
644
- const s = !r || i;
645
- e.toggleAttribute("hidden", s), e.style.display = s ? "none" : "inline-flex";
643
+ const n = !r || i;
644
+ e.toggleAttribute("hidden", n), e.style.display = n ? "none" : "inline-flex";
646
645
  }
647
- const a = i || !r ? null : e, l = o.filter((s) => s !== a), m = a ? [a, ...l] : o, p = this.shadowRoot.querySelector('slot[name="actions-right"]'), c = (p == null ? void 0 : p.assignedElements({ flatten: !0 })) || [], d = l.length > 0;
648
- this.toggleAttribute("has-actions", r), this.toggleAttribute("has-extra-actions", d);
649
- const u = r || this.hasTruthyFlagAttribute("actions-fan"), b = this.hasAttribute("fan-open"), h = 100, v = "calc(var(--action-icon-only-size-medium) + var(--space-100))";
650
- this.enforceActionVariants(), m.forEach((s, y) => {
651
- s.style.transition = `transform ${h}ms ease, opacity ${h}ms ease`, s.style.zIndex = "";
652
- const w = this.fanAnimations.get(s);
653
- if (w && (w.cancel(), this.fanAnimations.delete(s)), !u) {
654
- this.setFanItemInert(s, !1), s.style.transitionDelay = "", s.style.transform = "", s.style.opacity = "", s.style.pointerEvents = "", s.style.filter = "";
646
+ const a = i || !r ? null : e, l = o.filter((n) => n !== a), h = a ? [a, ...l] : o, p = this.shadowRoot.querySelector('slot[name="actions-right"]'), m = (p == null ? void 0 : p.assignedElements({ flatten: !0 })) || [], c = l.length > 0;
647
+ this.toggleAttribute("has-actions", r), this.toggleAttribute("has-extra-actions", c);
648
+ const u = r || this.hasTruthyFlagAttribute("actions-fan"), b = this.hasAttribute("fan-open"), v = 100;
649
+ this.enforceActionVariants(), h.forEach((n, d) => {
650
+ n.style.transition = `transform ${v}ms ease, opacity ${v}ms ease`, n.style.zIndex = "";
651
+ const f = this.fanAnimations.get(n);
652
+ if (f && (f.cancel(), this.fanAnimations.delete(n)), !u) {
653
+ this.setFanItemInert(n, !1), n.style.transitionDelay = "", n.style.transform = "", n.style.opacity = "", n.style.pointerEvents = "", n.style.filter = "";
655
654
  return;
656
655
  }
657
- if (y === 0) {
658
- this.setFanItemInert(s, !1), s.style.transitionDelay = "", s.style.transform = "translateX(0)", s.style.opacity = "1", s.style.pointerEvents = "", s.style.filter = "";
656
+ if (d === 0) {
657
+ this.setFanItemInert(n, !1), n.style.transitionDelay = "", n.style.transform = "translateX(0)", n.style.opacity = "1", n.style.pointerEvents = "", n.style.filter = "";
659
658
  return;
660
659
  }
661
660
  if (!b) {
662
- this.setFanItemInert(s, !0), s.style.transitionDelay = "", s.style.transform = "translateX(0) scale(0.8)", s.style.opacity = "0", s.style.pointerEvents = "none", s.style.filter = "";
661
+ this.setFanItemInert(n, !0), n.style.transitionDelay = "", n.style.transform = "translateX(0) scale(0.8)", n.style.opacity = "0", n.style.pointerEvents = "none", n.style.filter = "";
663
662
  return;
664
663
  }
665
- const f = `calc(${v} * -${y})`, g = y * 50;
666
- s.style.transition = `opacity ${Math.max(120, h - 40)}ms ease, transform ${h}ms cubic-bezier(0.22, 1, 0.36, 1)`, s.style.transitionDelay = `${g}ms`, s.style.transform = "translateX(0) scale(0.92)", s.style.opacity = "0", s.style.pointerEvents = "none", s.style.filter = "", this.setFanItemInert(s, !0), requestAnimationFrame(() => {
667
- if (s.style.transform = `translateX(${f})`, s.style.opacity = "1", window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
668
- s.style.pointerEvents = "", this.setFanItemInert(s, !1);
664
+ const w = "0px", y = d * 50;
665
+ n.style.transition = `opacity ${Math.max(120, v - 40)}ms ease, transform ${v}ms cubic-bezier(0.22, 1, 0.36, 1)`, n.style.transitionDelay = `${y}ms`, n.style.transform = "translateX(0) scale(0.92)", n.style.opacity = "0", n.style.pointerEvents = "none", n.style.filter = "", this.setFanItemInert(n, !0), requestAnimationFrame(() => {
666
+ if (n.style.transform = `translateX(${w})`, n.style.opacity = "1", window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
667
+ n.style.pointerEvents = "", this.setFanItemInert(n, !1);
669
668
  return;
670
669
  }
671
- const A = s.animate(
670
+ const A = n.animate(
672
671
  [
673
672
  { transform: "translateX(0) scale(0.92)" },
674
- { transform: `translateX(${f}) scale(1.03)`, offset: 0.68 },
675
- { transform: `translateX(calc(${f} - var(--space-050))) scale(0.99)`, offset: 0.86 },
676
- { transform: `translateX(${f}) scale(1)` }
673
+ { transform: `translateX(${w}) scale(1.03)`, offset: 0.68 },
674
+ { transform: `translateX(calc(${w} - var(--space-050))) scale(0.99)`, offset: 0.86 },
675
+ { transform: `translateX(${w}) scale(1)` }
677
676
  ],
678
677
  {
679
- duration: h + 180,
680
- delay: g,
678
+ duration: v + 180,
679
+ delay: y,
681
680
  easing: "cubic-bezier(0.22, 1, 0.36, 1)",
682
681
  fill: "forwards"
683
682
  }
684
683
  );
685
- this.fanAnimations.set(s, A), A.finished.catch(() => {
684
+ this.fanAnimations.set(n, A), A.finished.catch(() => {
686
685
  }).finally(() => {
687
- s.style.pointerEvents = "", this.setFanItemInert(s, !1);
686
+ n.style.pointerEvents = "", this.setFanItemInert(n, !1);
688
687
  });
689
688
  });
690
- }), c.forEach((s) => {
691
- s.style.transition = "", s.style.zIndex = "";
689
+ }), m.forEach((n) => {
690
+ n.style.transition = "", n.style.zIndex = "";
692
691
  }), this.bindActionTrigger(), this.syncTriggerIconState();
693
692
  }
694
693
  render() {
695
694
  if (!this.shadowRoot) return;
696
- const t = this.getAttribute("placeholder") || "Reply to Mui...", e = this.getAttribute("value") || "", o = this.getAttribute("rows") || "3", r = this.hasAttribute("disabled"), n = this.getAttribute("preview-dialog-width") || "560px", i = this.getAttribute("color-top-start") || "", a = this.getAttribute("color-top-mid") || "", l = this.getAttribute("color-top-end") || "", m = this.getAttribute("color-top-accent") || "", c = (this.getAttribute("color-layout") || "default").toLowerCase() === "swap", d = c ? l || "var(--prompt-color-top-end, var(--green-500))" : i || "var(--prompt-color-top-start, var(--blue-500))", u = c ? m || "var(--prompt-color-top-accent, var(--orange-500))" : a || "var(--prompt-color-top-mid, var(--blue-500))", b = c ? i || "var(--prompt-color-top-start, var(--blue-500))" : l || "var(--prompt-color-top-end, var(--green-500))", h = c ? a || "var(--prompt-color-top-mid, var(--blue-500))" : m || "var(--prompt-color-top-accent, var(--orange-500))", v = this.getAttribute("aria-label"), s = this.getAttribute("aria-labelledby"), y = this.getAttribute("aria-describedby"), w = !v && !s ? "Prompt input" : "", f = (this.getAttribute("error-message") || "").trim(), g = f;
695
+ const t = this.getAttribute("placeholder") || "Reply to Mui...", e = this.getAttribute("value") || "", o = this.getAttribute("rows") || "3", r = this.hasAttribute("disabled"), s = this.getAttribute("preview-dialog-width") || "560px", i = this.hasAttribute("preview-dialog-bordered") ? "var(--border-thin)" : "var(--dialog-border)", a = this.getAttribute("color-top-start") || "", l = this.getAttribute("color-top-mid") || "", h = this.getAttribute("color-top-end") || "", p = this.getAttribute("color-top-accent") || "", c = (this.getAttribute("color-layout") || "default").toLowerCase() === "swap", u = c ? h || "var(--prompt-color-top-end, var(--green-500))" : a || "var(--prompt-color-top-start, var(--blue-500))", b = c ? p || "var(--prompt-color-top-accent, var(--orange-500))" : l || "var(--prompt-color-top-mid, var(--blue-500))", v = c ? a || "var(--prompt-color-top-start, var(--blue-500))" : h || "var(--prompt-color-top-end, var(--green-500))", n = c ? l || "var(--prompt-color-top-mid, var(--blue-500))" : p || "var(--prompt-color-top-accent, var(--orange-500))", d = this.getAttribute("aria-label"), f = this.getAttribute("aria-labelledby"), w = this.getAttribute("aria-describedby"), y = !d && !f ? "Prompt input" : "", g = (this.getAttribute("error-message") || "").trim(), A = g;
697
696
  this.shadowRoot.innerHTML = /*html*/
698
697
  `
699
698
  <style>
700
699
  :host {
701
700
  display: block;
702
701
  --prompt-action-radius: var(--chip-radius-small, var(--radius-400));
703
- --prompt-color-top-start-source: ${d};
704
- --prompt-color-top-mid-source: ${u};
705
- --prompt-color-top-end-source: ${b};
706
- --prompt-color-top-accent-source: ${h};
702
+ --prompt-preview-dialog-border: ${i};
703
+ --prompt-color-top-start-source: ${u};
704
+ --prompt-color-top-mid-source: ${b};
705
+ --prompt-color-top-end-source: ${v};
706
+ --prompt-color-top-accent-source: ${n};
707
707
  --prompt-accent-primary-derived: var(--prompt-accent-primary, var(--prompt-spectrum-start, var(--blue-500)));
708
708
  --prompt-accent-secondary-derived: var(--prompt-accent-secondary, var(--blue-500));
709
709
  --prompt-accent-mid: color-mix(
@@ -922,7 +922,7 @@ class S extends HTMLElement {
922
922
  var(--prompt-layer-accent-tint) 0%,
923
923
  transparent 64%
924
924
  ),
925
- var(--prompt-focus-surface-background, var(--surface-elevated-100));
925
+ var(--prompt-focus-surface-background);
926
926
  mix-blend-mode: var(--prompt-spectrum-blend-mode-hover);
927
927
  animation: none;
928
928
  }
@@ -1407,6 +1407,31 @@ class S extends HTMLElement {
1407
1407
  margin-top: var(--space-400);
1408
1408
  padding-left: var(--space-100);
1409
1409
  }
1410
+ .debug-region mui-body {
1411
+ min-width: 0;
1412
+ max-width: 100%;
1413
+ }
1414
+ .debug-region mui-body::part(width) {
1415
+ width: 100%;
1416
+ min-width: 0;
1417
+ max-width: 100%;
1418
+ }
1419
+ .debug-payload-body::part(display) {
1420
+ display: block;
1421
+ }
1422
+ .debug-payload-body::part(width) {
1423
+ width: 100%;
1424
+ min-width: 0;
1425
+ max-width: 100%;
1426
+ }
1427
+ .debug-payload-text {
1428
+ display: block;
1429
+ min-width: 0;
1430
+ max-width: 100%;
1431
+ white-space: normal;
1432
+ overflow-wrap: anywhere;
1433
+ word-break: break-word;
1434
+ }
1410
1435
  </style>
1411
1436
 
1412
1437
  <div class="surface">
@@ -1421,10 +1446,10 @@ class S extends HTMLElement {
1421
1446
  <textarea
1422
1447
  rows="${o}"
1423
1448
  placeholder="${t}"
1424
- ${v ? `aria-label="${v.replace(/"/g, "&quot;")}"` : ""}
1425
- ${s ? `aria-labelledby="${s.replace(/"/g, "&quot;")}"` : ""}
1426
- ${y ? `aria-describedby="${y.replace(/"/g, "&quot;")}"` : ""}
1427
- ${w ? `aria-label="${w}"` : ""}
1449
+ ${d ? `aria-label="${d.replace(/"/g, "&quot;")}"` : ""}
1450
+ ${f ? `aria-labelledby="${f.replace(/"/g, "&quot;")}"` : ""}
1451
+ ${w ? `aria-describedby="${w.replace(/"/g, "&quot;")}"` : ""}
1452
+ ${y ? `aria-label="${y}"` : ""}
1428
1453
  ${r ? "disabled" : ""}
1429
1454
  >${e}</textarea>
1430
1455
  </slot>
@@ -1456,22 +1481,25 @@ class S extends HTMLElement {
1456
1481
  </div>
1457
1482
  <div class="error-region" hidden>
1458
1483
 
1459
- <mui-body size="x-small" variant="error" class="error-default" ${f ? "" : "hidden"}>
1484
+ <mui-body size="x-small" variant="error" class="error-default" ${g ? "" : "hidden"}>
1460
1485
  <mui-icon-attention slot="before"></mui-icon-attention>
1461
- <span class="error-text">${g}</span>
1486
+ <span class="error-text">${A}</span>
1462
1487
  </mui-body>
1463
1488
 
1464
1489
  </div>
1465
1490
  </div>
1466
1491
  <mui-v-stack class="debug-region" space="var(--space-050)" ${this.hasAttribute("debug") ? "" : "hidden"}>
1467
1492
  <mui-body id="promptDebugStatus" size="x-small" variant="optional" weight="regular">Idle: no submit yet.</mui-body>
1468
- <mui-body id="promptDebugPayload" size="x-small" variant="optional" weight="regular">{"event":"idle"}</mui-body>
1493
+ <mui-body class="debug-payload-body" size="x-small" variant="optional" weight="regular">
1494
+ <span id="promptDebugPayload" class="debug-payload-text">{"event":"idle"}</span>
1495
+ </mui-body>
1469
1496
  </mui-v-stack>
1470
1497
 
1471
1498
  <mui-dialog
1472
1499
  id="promptAutoPreviewDialog"
1473
- width="${n}"
1500
+ width="${s}"
1474
1501
  content-padding="none"
1502
+ style="--dialog-border: var(--prompt-preview-dialog-border);"
1475
1503
  >
1476
1504
  <mui-heading id="promptAutoPreviewTitle" slot="title" size="5">Pasted Content</mui-heading>
1477
1505
  <mui-code id="promptAutoPreviewCode" size="x-small" wrap hidden></mui-code>
@@ -159,7 +159,7 @@ class S extends HTMLElement {
159
159
  }
160
160
  render() {
161
161
  if (!this.shadowRoot) return;
162
- const e = this.getAttribute("value") || "", a = e.trim() || "Paste long content to preview it here.", t = this.getBadge(e), s = C("text", "spacing", "layout", "visual"), r = this.getAttribute("accent") || "var(--prompt-preview-accent, var(--surface-elevated-200))", i = this.getAttribute("bg-image") || "", n = this.getAttribute("image-tint") || r, d = i ? n : r, v = this.hasAttribute("inverted"), g = this.hasAttribute("badge-only") ? !1 : !i || this.hasAttribute("show-text"), b = (this.getAttribute("animation-mode") || "loop").toLowerCase(), h = (this.getAttribute("variant") || "").toLowerCase(), l = this.hasAttribute("loading"), u = (this.getAttribute("loading-label") || "Loading preview").trim(), w = (this.hasAttribute("animated") || !!i) && b !== "off", f = b === "once" ? "1" : "infinite", c = h === "overlay" || !!i, x = c ? "overlay" : "neutral", y = c ? "overlay" : "secondary", A = `dismiss-action${c ? "" : " dismiss-secondary"}`, k = this.hasAttribute("clickable") && !l, o = this.extractUrl(e), $ = !!(o && this.isImageUrl(o)), z = !!(o && !i && (t === "VIDEO" || t === "MUSIC")), I = o ? this.escapeHtml(o) : "", P = i.replace(/"/g, "&quot;"), E = i ? `
162
+ const e = this.getAttribute("value") || "", a = e.trim() || "Paste long content to preview it here.", t = this.getBadge(e), s = C("text", "spacing", "layout", "visual"), r = this.getAttribute("accent") || "var(--prompt-preview-accent, var(--surface-elevated-200))", i = this.getAttribute("bg-image") || "", n = this.getAttribute("image-tint") || r, u = i ? n : r, v = this.hasAttribute("inverted"), g = this.hasAttribute("badge-only") ? !1 : !i || this.hasAttribute("show-text"), d = (this.getAttribute("animation-mode") || "loop").toLowerCase(), h = (this.getAttribute("variant") || "").toLowerCase(), l = this.hasAttribute("loading"), b = (this.getAttribute("loading-label") || "Loading preview").trim(), w = (this.hasAttribute("animated") || !!i) && d !== "off", f = d === "once" ? "1" : "infinite", c = h === "overlay" || !!i, x = c ? "overlay" : "neutral", y = c ? "overlay" : "secondary", A = `dismiss-action${c ? "" : " dismiss-secondary"}`, k = this.hasAttribute("clickable") && !l, o = this.extractUrl(e), $ = !!(o && this.isImageUrl(o)), z = !!(o && !i && (t === "VIDEO" || t === "MUSIC")), I = o ? this.escapeHtml(o) : "", P = i.replace(/"/g, "&quot;"), E = i ? `
163
163
  linear-gradient(
164
164
  180deg,
165
165
  color-mix(in srgb, ${n} 42%, transparent 58%) 0%,
@@ -193,6 +193,10 @@ class S extends HTMLElement {
193
193
  color-mix(in srgb, ${r} var(--prompt-preview-accent-mix-400), transparent) 0%,
194
194
  color-mix(in srgb, ${r} var(--prompt-preview-accent-mix-500), transparent) 30%,
195
195
  transparent 100%
196
+ ),
197
+ linear-gradient(
198
+ var(--prompt-preview-background),
199
+ var(--prompt-preview-background)
196
200
  )
197
201
  `, L = `box${i ? " has-image" : ""}${c ? " variant-overlay" : ""}${v ? " inverted" : ""}`;
198
202
  this.shadowRoot.innerHTML = /*html*/
@@ -216,17 +220,9 @@ class S extends HTMLElement {
216
220
  .box {
217
221
  position: relative;
218
222
  border: var(--border-thin);
219
- border-color: var(--form-default-border-color);
220
223
  border-radius: var(--radius-200);
221
224
  box-shadow:
222
- var(--shadow-200),
223
- 0 var(--stroke-size-100) var(--stroke-size-200) var(--black-opacity-20),
224
- inset 0 0 0 1px color-mix(in srgb, ${d} 12%, transparent 88%),
225
- inset 0 calc(var(--space-050) * -1) var(--space-300) color-mix(in srgb, #000 12%, transparent 88%);
226
- filter: var(
227
- --prompt-preview-box-drop-shadow,
228
- drop-shadow(0 var(--stroke-size-100) var(--stroke-size-200) var(--black-opacity-20))
229
- );
225
+ 0 var(--stroke-size-100) var(--stroke-size-200) var(--black-opacity-5);
230
226
  background: ${E};
231
227
  box-sizing: border-box;
232
228
  width: 100%;
@@ -296,19 +292,11 @@ class S extends HTMLElement {
296
292
  .box::before {
297
293
  background: radial-gradient(
298
294
  120% 80% at 50% -10%,
299
- color-mix(in srgb, ${d} 32%, transparent 68%) 0%,
295
+ color-mix(in srgb, ${u} 32%, transparent 68%) 0%,
300
296
  transparent 70%
301
297
  );
302
298
  filter: blur(var(--space-050));
303
299
  }
304
- .box::after {
305
- background: radial-gradient(
306
- 120% 90% at 50% 110%,
307
- color-mix(in srgb, #000 14%, transparent 86%) 0%,
308
- transparent 72%
309
- );
310
- filter: blur(var(--space-100));
311
- }
312
300
  .box.animated::before {
313
301
  animation: previewPulse 2400ms ease-in-out var(--prompt-preview-iterations);
314
302
  }
@@ -382,7 +370,7 @@ class S extends HTMLElement {
382
370
  mui-badge {
383
371
  position: absolute;
384
372
  z-index: 3;
385
- top: calc(var(--space-100) + var(--stroke-size-100));
373
+ top: calc(var(--space-100) + var(--stroke-size-200));
386
374
  left: calc(var(--space-100) + var(--stroke-size-100));
387
375
 
388
376
  }
@@ -504,12 +492,12 @@ class S extends HTMLElement {
504
492
  <mui-button class="${A}" icon-only size="xx-small" variant="${y}" aria-label="Dismiss preview">
505
493
  <mui-icon-close size="xx-small"></mui-icon-close>
506
494
  </mui-button>
507
- <mui-badge variant="${x}" size="x-small">${t}</mui-badge>
495
+ <mui-badge variant="${x}" size="xx-small">${t}</mui-badge>
508
496
  <mui-v-stack class="inner${z ? " media-inline" : ""}" space="var(--space-025)" alignX="stretch">
509
497
  ${g ? $ && !i ? `<img class="snippet-image" src="${I}" alt="${this.escapeHtml(t)} preview image" />` : `<mui-body class="snippet" size="x-small" variant="optional">${o ? `${t === "VIDEO" ? '<span class="snippet-media-only"><mui-icon-play-rectangle class="snippet-media-icon" size="medium"></mui-icon-play-rectangle></span>' : t === "MUSIC" ? '<span class="snippet-media-only"><mui-icon-music-microphone class="snippet-media-icon" size="medium"></mui-icon-music-microphone></span>' : this.escapeHtml(a.slice(0, 260))}` : this.escapeHtml(a.slice(0, 260))}</mui-body>` : ""}
510
498
  </mui-v-stack>
511
- <div class="loading-overlay" aria-live="polite" aria-label="${this.escapeHtml(u)}">
512
- <mui-spinner size="small" label="${this.escapeHtml(u)}"></mui-spinner>
499
+ <div class="loading-overlay" aria-live="polite" aria-label="${this.escapeHtml(b)}">
500
+ <mui-spinner size="small" label="${this.escapeHtml(b)}"></mui-spinner>
513
501
  </div>
514
502
  </div>
515
503
  `;