@luzmo/lucero 1.0.1-alpha.40 → 1.0.1-alpha.43

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 (89) hide show
  1. package/components/accordion/index.js +1 -1
  2. package/components/action-bar/index.cjs +1 -1
  3. package/components/action-bar/index.js +2 -2
  4. package/components/action-button/index.cjs +1 -1
  5. package/components/action-button/index.js +2 -2
  6. package/components/action-group/index.js +1 -1
  7. package/components/action-menu/index.js +1 -1
  8. package/components/avatar/index.js +1 -1
  9. package/components/button/index.cjs +2 -2
  10. package/components/button/index.js +78 -49
  11. package/components/{button-base-B5uul3tZ.js → button-base-B_SkfcFn.js} +1 -1
  12. package/components/{button-base-C7or8-FB.cjs → button-base-BdzHcHRs.cjs} +1 -1
  13. package/components/button-group/index.js +1 -1
  14. package/components/calendar/index.js +1 -1
  15. package/components/chat-message/chat-message.d.ts +127 -0
  16. package/components/chat-message/index.cjs +80 -0
  17. package/components/chat-message/index.d.ts +8 -0
  18. package/components/chat-message/index.js +254 -0
  19. package/components/chat-message-group/chat-message-group.d.ts +50 -0
  20. package/components/chat-message-group/index.cjs +24 -0
  21. package/components/chat-message-group/index.d.ts +7 -0
  22. package/components/chat-message-group/index.js +144 -0
  23. package/components/checkbox/index.cjs +1 -1
  24. package/components/checkbox/index.js +8 -8
  25. package/components/{close-button-R-Cyxi_j.js → close-button-CGZxCNlI.js} +1 -1
  26. package/components/{close-button-C4zqQJRL.cjs → close-button-Decm0Qbb.cjs} +1 -1
  27. package/components/color-area/index.js +1 -1
  28. package/components/color-field/index.js +1 -1
  29. package/components/color-handle/index.js +1 -1
  30. package/components/color-loupe/index.js +1 -1
  31. package/components/color-menu/index.js +1 -1
  32. package/components/color-palette/index.js +1 -1
  33. package/components/color-palette-group/index.js +1 -1
  34. package/components/color-picker/index.js +1 -1
  35. package/components/color-slider/index.js +1 -1
  36. package/components/date-time-picker/index.js +1 -1
  37. package/components/divider/index.js +1 -1
  38. package/components/field-group/index.js +1 -1
  39. package/components/field-label/index.js +1 -1
  40. package/components/icon/index.js +1 -1
  41. package/components/index.cjs +1 -1
  42. package/components/index.js +161 -156
  43. package/components/infield-button/index.cjs +1 -1
  44. package/components/infield-button/index.js +2 -2
  45. package/components/label/index.js +1 -1
  46. package/components/menu/index.js +1 -1
  47. package/components/multi-language-field/index.js +1 -1
  48. package/components/number-field/index.js +1 -1
  49. package/components/options/index.js +1 -1
  50. package/components/overlay/index.js +1 -1
  51. package/components/picker/index.js +1 -1
  52. package/components/picker-button/index.cjs +2 -2
  53. package/components/picker-button/index.js +3 -3
  54. package/components/popover/index.js +1 -1
  55. package/components/progress-circle/index.js +1 -1
  56. package/components/prompt-box/index.cjs +222 -0
  57. package/components/prompt-box/index.d.ts +8 -0
  58. package/components/prompt-box/index.js +832 -0
  59. package/components/prompt-box/prompt-box.d.ts +326 -0
  60. package/components/radio/index.js +1 -1
  61. package/components/search/index.js +1 -1
  62. package/components/select/index.js +1 -1
  63. package/components/slider/index.js +1 -1
  64. package/components/swatch/index.js +1 -1
  65. package/components/switch/index.js +1 -1
  66. package/components/tabs/index.js +1 -1
  67. package/components/tags/index.cjs +5 -5
  68. package/components/tags/index.js +34 -21
  69. package/components/tags/tag.d.ts +2 -0
  70. package/components/tags/tags.d.ts +3 -1
  71. package/components/text-field/index.js +1 -1
  72. package/components/toast/index.cjs +1 -1
  73. package/components/toast/index.js +3 -3
  74. package/components/tooltip/index.js +1 -1
  75. package/components/utils.cjs +1 -1
  76. package/components/utils.js +10 -8
  77. package/components/voice-recorder-BRq_gEkz.js +210 -0
  78. package/components/voice-recorder-CAm5iDre.cjs +18 -0
  79. package/custom-elements.json +1 -1
  80. package/index.d.ts +3 -1
  81. package/package.json +19 -7
  82. package/utils/index.d.ts +1 -0
  83. package/utils/voice-recorder.d.ts +121 -0
  84. package/components/clear-button-Bjp7N52G.js +0 -54
  85. package/components/clear-button-C39c3PH0.cjs +0 -18
  86. package/components/unit-input/index.cjs +0 -43
  87. package/components/unit-input/index.d.ts +0 -7
  88. package/components/unit-input/index.js +0 -184
  89. package/components/unit-input/unit-input.d.ts +0 -33
@@ -0,0 +1,832 @@
1
+ /*! * Lucero - The design system for Luzmo.
2
+ *
3
+ * Copyright © 2025 Luzmo
4
+ * All rights reserved.
5
+ * Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
6
+ * This license allows users with a current active Luzmo account to use Lucero.
7
+ * This license terminates automatically if a user no longer has an active Luzmo account.
8
+ * Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
9
+ *
10
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16
+ * SOFTWARE.
17
+ * */
18
+ import { luzmoClear as $, luzmoCheck as C, luzmoMicrophone as k, luzmoArrowUp as S } from "@luzmo/icons";
19
+ import { unsafeCSS as B, html as s, nothing as f } from "lit";
20
+ import { property as m, state as h, query as w } from "lit/decorators.js";
21
+ import { repeat as E } from "lit/directives/repeat.js";
22
+ import { a as F } from "../base-CdYjmV_8.js";
23
+ import { S as L } from "../sized-mixin-cJbo3PKR.js";
24
+ import { V as _ } from "../voice-recorder-BRq_gEkz.js";
25
+ import "../action-button/index.js";
26
+ import "../button/index.js";
27
+ import "../icon/index.js";
28
+ import "../tags/index.js";
29
+ import "../text-field/index.js";
30
+ const A = () => {
31
+ if (typeof document < "u" && !document.querySelector("style[data-luzmo-vars]")) {
32
+ const b = document.createElement("style");
33
+ b.setAttribute("data-luzmo-vars", ""), b.textContent = 'html{--luzmo-animation-duration: 0.15s;--luzmo-border-color: rgba(var(--luzmo-border-color-rgb), 0.1);--luzmo-border-color-hover: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-down: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-border-color-focus: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-rgb: 0, 0, 0;--luzmo-border-color-full: rgb(180, 180, 180);--luzmo-border-color-full-hover: rgb(140, 140, 140);--luzmo-border-color-full-down: rgb(110, 110, 110);--luzmo-border-color-full-focus: rgb(140, 140, 140);--luzmo-border-color-disabled: #dddddd;--luzmo-border-radius: 6px;--luzmo-border-radius-s: 4px;--luzmo-border-radius-l: 8px;--luzmo-border-radius-xl: 12px;--luzmo-border-radius-full: 999rem;--luzmo-background-color: #ffffff;--luzmo-background-color-rgb: 255, 255, 255;--luzmo-background-color-disabled: #eeeeee;--luzmo-background-color-hover: #f0f0fc;--luzmo-background-color-down: #f1f1ff;--luzmo-background-color-focus: #f0f0fc;--luzmo-background-color-highlight: rgb(240, 240, 240);--luzmo-background-color-highlight-disabled: rgb(245, 245, 245);--luzmo-background-color-highlight-hover: rgb(225, 225, 225);--luzmo-background-color-highlight-down: rgb(215, 215, 215);--luzmo-background-color-highlight-focus: rgb(225, 225, 225);--luzmo-border-width: 1px;--luzmo-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;--luzmo-font-size-xs: 10px;--luzmo-font-size-s: 12px;--luzmo-font-size-m: 14px;--luzmo-font-size: 14px;--luzmo-font-size-l: 16px;--luzmo-font-size-xl: 18px;--luzmo-font-size-xxl: 20px;--luzmo-font-style: normal;--luzmo-line-height: normal;--luzmo-font-weight: 400;--luzmo-font-weight-semibold: 500;--luzmo-font-weight-bold: 600;--luzmo-font-color: #333;--luzmo-font-color-disabled: var(--luzmo-disabled-color);--luzmo-font-color-extra-dimmed: #888;--luzmo-font-color-hover: #333;--luzmo-font-color-down: #111;--luzmo-font-color-focus: #333;--luzmo-primary: #4434ff;--luzmo-primary-hover: #4234e4;--luzmo-primary-down: #392cc7;--luzmo-primary-focus: #4234e4;--luzmo-primary-inverse-color: #ffffff;--luzmo-primary-rgb: 68, 52, 255;--luzmo-secondary: #ff00ff;--luzmo-secondary-hover: #e309e3;--luzmo-secondary-down: #c711c7;--luzmo-secondary-focus: #e309e3;--luzmo-secondary-inverse-color: #ffffff;--luzmo-secondary-rgb: 255, 0, 255;--luzmo-negative-color: #ca221c;--luzmo-negative-color-hover: #b3241f;--luzmo-negative-color-down: #9f231f;--luzmo-negative-color-focus: #b3241f;--luzmo-negative-color-rgb: 202, 34, 28;--luzmo-positive-color: rgb(20, 150, 101);--luzmo-positive-color-hover: rgb(17, 128, 86);--luzmo-positive-color-down: rgb(16, 105, 71);--luzmo-positive-color-focus: rgb(17, 128, 86);--luzmo-positive-color-rgb: 20, 150, 101;--luzmo-selected-color: rgb(110, 110, 110);--luzmo-selected-color-hover: rgb(70, 70, 70);--luzmo-selected-color-down: rgb(40, 40, 40);--luzmo-selected-color-focus: rgb(70, 70, 70);--luzmo-selected-color-hard: #1e1e1e;--luzmo-selected-color-hard-hover: rgb(0, 0, 0);--luzmo-selected-color-hard-down: rgb(0, 0, 0);--luzmo-selected-color-hard-focus: rgb(0, 0, 0);--luzmo-informative-color: #1a77e9;--luzmo-informative-color-rgb: 26, 119, 233;--luzmo-disabled-color: #aaaaaa;--luzmo-spacing-1: 2px;--luzmo-spacing-2: 4px;--luzmo-spacing-3: 8px;--luzmo-spacing-4: 12px;--luzmo-spacing-5: 16px;--luzmo-indicator-gap: 2px;--luzmo-indicator-width: 1px;--luzmo-indicator-color: var(--luzmo-primary);--luzmo-component-height-xxs: 20px;--luzmo-component-height-xs: 24px;--luzmo-component-height-s: 28px;--luzmo-component-height: 32px;--luzmo-component-height-l: 40px;--luzmo-component-height-xl: 48px;--luzmo-component-height-xxl: 64px;--luzmo-icon-size-xxs: 10px;--luzmo-icon-size-xs: 12px;--luzmo-icon-size-s: 14px;--luzmo-icon-size-m: 16px;--luzmo-icon-size-l: 18px;--luzmo-icon-size-xl: 20px;--luzmo-icon-size-xxl: 32px}', document.head.appendChild(b);
34
+ }
35
+ };
36
+ A();
37
+ const I = ":host{display:flex;flex-direction:column;font-family:var(--luzmo-prompt-box-font-family, var(--prompt-box-font-family));font-size:var(--luzmo-prompt-box-font-size, var(--prompt-box-font-size));line-height:var(--luzmo-prompt-box-line-height, var(--prompt-box-line-height));color:var(--highcontrast-prompt-box-text-color, var(--luzmo-prompt-box-text-color, var(--prompt-box-text-color)));width:100%}:host([disabled]){opacity:var(--luzmo-prompt-box-disabled-opacity, var(--prompt-box-disabled-opacity));pointer-events:none}.container{display:flex;flex-direction:column;gap:var(--luzmo-prompt-box-gap, var(--prompt-box-gap));padding:var(--luzmo-prompt-box-vertical-padding, var(--prompt-box-vertical-padding)) var(--luzmo-prompt-box-horizontal-padding, var(--prompt-box-horizontal-padding));background-color:var(--highcontrast-prompt-box-background-color, var(--luzmo-prompt-box-background-color, var(--prompt-box-background-color)));border-radius:var(--luzmo-prompt-box-border-radius, var(--prompt-box-border-radius));border-width:var(--luzmo-prompt-box-border-width, var(--prompt-box-border-width));border-style:solid;border-color:var(--highcontrast-prompt-box-border-color, var(--luzmo-prompt-box-border-color, var(--prompt-box-border-color)));box-shadow:var(--luzmo-prompt-box-shadow, var(--prompt-box-shadow));transition:border-color var(--luzmo-prompt-box-animation-duration, var(--prompt-box-animation-duration)) ease-in-out,box-shadow var(--luzmo-prompt-box-animation-duration, var(--prompt-box-animation-duration)) ease-in-out}:host(:focus-visible) .container{border-color:var(--luzmo-prompt-box-border-color-focus, var(--prompt-box-border-color-focus));box-shadow:var(--luzmo-prompt-box-shadow-focus, var(--prompt-box-shadow-focus))}:host(.focus-visible) .container{border-color:var(--luzmo-prompt-box-border-color-focus, var(--prompt-box-border-color-focus));box-shadow:var(--luzmo-prompt-box-shadow-focus, var(--prompt-box-shadow-focus))}:host(:focus){outline:none}.top-actions{display:flex;align-items:center;gap:var(--luzmo-prompt-box-top-actions-gap, var(--prompt-box-top-actions-gap));flex-wrap:wrap;opacity:var(--luzmo-prompt-box-actions-opacity, var(--prompt-box-actions-opacity, 1));transition:opacity var(--luzmo-prompt-box-animation-duration, var(--prompt-box-animation-duration)) ease-in-out}.top-actions.empty{display:none}.hidden-file-input{position:absolute;width:0;height:0;opacity:0;overflow:hidden;pointer-events:none}.attachments{display:flex;flex-direction:column;gap:var(--luzmo-prompt-box-attachments-gap, var(--prompt-box-attachments-gap, 8px))}.image-attachments{display:flex;flex-wrap:wrap;gap:var(--luzmo-prompt-box-image-attachments-gap, var(--prompt-box-image-attachments-gap, 8px))}.image-attachment{position:relative;display:inline-flex;width:var(--luzmo-prompt-box-image-preview-size, var(--prompt-box-image-preview-size, 80px));height:var(--luzmo-prompt-box-image-preview-size, var(--prompt-box-image-preview-size, 80px));border-radius:var(--luzmo-prompt-box-image-border-radius, var(--prompt-box-image-border-radius, 8px));overflow:hidden;background-color:var(--luzmo-prompt-box-image-background, var(--prompt-box-image-background, rgba(0, 0, 0, .05)))}.image-preview{width:100%;height:100%;object-fit:cover}.attachment-remove{position:absolute;top:4px;right:4px;width:var(--luzmo-prompt-box-remove-button-size, var(--prompt-box-remove-button-size, 24px));height:var(--luzmo-prompt-box-remove-button-size, var(--prompt-box-remove-button-size, 24px));background-color:var(--luzmo-prompt-box-remove-button-background, var(--prompt-box-remove-button-background, rgba(0, 0, 0, .5)));border-radius:50%;--luzmo-clear-button-icon-color: var( --luzmo-prompt-box-remove-button-icon-color, var(--prompt-box-remove-button-icon-color, #fff) )}.attachment-remove:hover{background-color:var(--luzmo-prompt-box-remove-button-background-hover, var(--prompt-box-remove-button-background-hover, rgba(0, 0, 0, .7)))}.file-attachments{--luzmo-tag-border-radius: 16px;display:flex;flex-wrap:wrap;gap:var(--luzmo-prompt-box-file-attachments-gap, var(--prompt-box-file-attachments-gap, 4px))}.file-attachment{max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.input-wrapper{position:relative;display:flex;flex:1}.input-field{flex:1;width:100%;min-width:0;--luzmo-text-field-focus-indicator-width: 0;--luzmo-text-field-border-width: 0;--luzmo-text-field-width: 100%;--luzmo-text-field-min-width: 0;--luzmo-text-field-placeholder-text-color-default: var( --luzmo-prompt-box-placeholder-color, var(--prompt-box-placeholder-color) )}.actions-row{display:flex;align-items:center;justify-content:space-between;gap:var(--luzmo-prompt-box-actions-gap, var(--prompt-box-actions-gap))}.bottom-actions{display:flex;align-items:center;gap:var(--luzmo-prompt-box-bottom-actions-gap, var(--prompt-box-bottom-actions-gap));flex-wrap:wrap;flex:1;opacity:var(--luzmo-prompt-box-actions-opacity, var(--prompt-box-actions-opacity, 1));transition:opacity var(--luzmo-prompt-box-animation-duration, var(--prompt-box-animation-duration)) ease-in-out}.button-group{display:flex;align-items:center;gap:var(--luzmo-prompt-box-button-group-gap, var(--prompt-box-button-group-gap));margin-left:auto}.record-button,.cancel-recording-button{--luzmo-action-button-border-radius: var( --luzmo-prompt-box-record-button-border-radius, 50% );--luzmo-action-button-focus-indicator-border-radius: var( --luzmo-prompt-box-record-button-focus-indicator-border-radius, 50% )}.submit-button{margin-inline-start:var(--luzmo-prompt-box-submit-button-margin-inline-start, var(--prompt-box-submit-button-margin-inline-start))}.recording-ui{display:flex;align-items:center;gap:var(--luzmo-prompt-box-recording-gap, var(--prompt-box-recording-gap))}.waveform{display:flex;align-items:center;gap:var(--luzmo-prompt-box-waveform-gap, var(--prompt-box-waveform-gap, 3px));height:var(--luzmo-prompt-box-waveform-height, var(--prompt-box-waveform-height, 24px));padding:0 4px}.waveform-bar{width:var(--luzmo-prompt-box-waveform-bar-width, var(--prompt-box-waveform-bar-width, 3px));height:calc(var(--bar-height, .3) * var(--luzmo-prompt-box-waveform-height, var(--prompt-box-waveform-height, 24px)));min-height:4px;background-color:var(--luzmo-prompt-box-waveform-bar-color, var(--prompt-box-waveform-bar-color, currentColor));border-radius:var(--luzmo-prompt-box-waveform-bar-radius, var(--prompt-box-waveform-bar-radius, 2px));transition:height .05s ease-out;animation:waveform-pulse 1s ease-in-out infinite}.waveform-bar:nth-child(1){animation-delay:0s}.waveform-bar:nth-child(2){animation-delay:.1s}.waveform-bar:nth-child(3){animation-delay:.2s}.waveform-bar:nth-child(4){animation-delay:.1s}.waveform-bar:nth-child(5){animation-delay:0s}@keyframes waveform-pulse{0%,to{opacity:.6}50%{opacity:1}}.recording-duration{font-family:var(--luzmo-prompt-box-recording-duration-font-family, var(--prompt-box-recording-duration-font-family, monospace));font-size:var(--luzmo-prompt-box-recording-duration-font-size, var(--prompt-box-recording-duration-font-size, 14px));font-weight:var(--luzmo-prompt-box-recording-duration-font-weight, var(--prompt-box-recording-duration-font-weight, 500));color:var(--luzmo-prompt-box-recording-duration-color, var(--prompt-box-recording-duration-color, currentColor));text-align:center}::slotted([slot=top-actions]){display:inline-flex;align-items:center}::slotted([slot=bottom-actions]){display:inline-flex;align-items:center}::slotted([slot=record-button]){display:inline-flex}::slotted([slot=submit-button]){display:inline-flex;margin-inline-start:var(--luzmo-prompt-box-submit-button-margin-inline-start, var(--prompt-box-submit-button-margin-inline-start))}@media (forced-colors: active){:host{--highcontrast-prompt-box-background-color: Canvas;--highcontrast-prompt-box-border-color: CanvasText;--highcontrast-prompt-box-text-color: CanvasText}}:host{--prompt-box-font-family: var(--luzmo-font-family);--prompt-box-font-size: var(--luzmo-font-size);--prompt-box-line-height: 1.5;--prompt-box-text-color: var(--luzmo-font-color);--prompt-box-background-color: var(--luzmo-background-color);--prompt-box-border-radius: var(--luzmo-border-radius-xl);--prompt-box-border-width: var(--luzmo-border-width);--prompt-box-border-color: var(--luzmo-border-color);--prompt-box-border-color-focus: var(--luzmo-primary);--prompt-box-shadow: 0 2px 8px rgba(var(--luzmo-border-color-rgb), .08);--prompt-box-shadow-focus: 0 2px 12px rgba(var(--luzmo-primary-rgb), .15);--prompt-box-gap: var(--luzmo-spacing-5);--prompt-box-recording-gap: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--prompt-box-vertical-padding: var(--luzmo-spacing-4);--prompt-box-horizontal-padding: var(--luzmo-spacing-5);--prompt-box-actions-gap: var(--luzmo-spacing-3);--prompt-box-top-actions-gap: var(--luzmo-spacing-2);--prompt-box-bottom-actions-gap: var(--luzmo-spacing-2);--prompt-box-button-group-gap: var(--luzmo-spacing-2);--prompt-box-submit-button-margin-inline-start: var(--luzmo-spacing-3);--prompt-box-max-height: 200px;--prompt-box-placeholder-color: var(--luzmo-font-color-extra-dimmed);--prompt-box-placeholder-opacity: 1;--prompt-box-animation-duration: var(--luzmo-animation-duration, .15s);--prompt-box-disabled-opacity: .5;--prompt-box-attachments-gap: var(--luzmo-spacing-1);--prompt-box-image-attachments-gap: var(--luzmo-spacing-2);--prompt-box-file-attachments-gap: var(--luzmo-spacing-2);--prompt-box-image-preview-size: 64px;--prompt-box-image-border-radius: var(--luzmo-border-radius);--prompt-box-image-background: rgba(0, 0, 0, .05);--prompt-box-remove-button-size: 20px;--prompt-box-remove-button-background: rgba(0, 0, 0, .5);--prompt-box-remove-button-background-hover: rgba(0, 0, 0, .7);--prompt-box-remove-button-icon-color: #fff}:host([size=s]){--prompt-box-font-size: var(--luzmo-font-size-s);--prompt-box-border-radius: var(--luzmo-border-radius-l);--prompt-box-vertical-padding: var(--luzmo-spacing-3);--prompt-box-horizontal-padding: var(--luzmo-spacing-4);--prompt-box-gap: var(--luzmo-spacing-4);--prompt-box-attachments-gap: 0;--prompt-box-image-attachments-gap: var(--luzmo-spacing-1);--prompt-box-recording-gap: calc( var(--luzmo-spacing-3) + var(--luzmo-spacing-1) );--prompt-box-max-height: 150px;--prompt-box-image-preview-size: 48px;--prompt-box-remove-button-size: 18px}:host([size=l]){--prompt-box-font-size: var(--luzmo-font-size-l);--prompt-box-border-radius: var(--luzmo-border-radius-xl);--prompt-box-vertical-padding: var(--luzmo-spacing-5);--prompt-box-horizontal-padding: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--prompt-box-gap: var(--luzmo-spacing-4);--prompt-box-attachments-gap: var(--luzmo-spacing-1);--prompt-box-image-attachments-gap: calc( var(--luzmo-spacing-2) + var(--luzmo-spacing-1) );--prompt-box-recording-gap: calc( var(--luzmo-spacing-4) + var(--luzmo-spacing-1) );--prompt-box-max-height: 250px;--prompt-box-image-preview-size: 72px;--prompt-box-remove-button-size: 24px}:host([size=xl]){--prompt-box-font-size: var(--luzmo-font-size-xl);--prompt-box-border-radius: var(--luzmo-border-radius-xl);--prompt-box-vertical-padding: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--prompt-box-horizontal-padding: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-2) );--prompt-box-gap: var(--luzmo-spacing-5);--prompt-box-attachments-gap: var(--luzmo-spacing-2);--prompt-box-image-attachments-gap: var(--luzmo-spacing-3);--prompt-box-max-height: 300px;--prompt-box-image-preview-size: 96px;--prompt-box-remove-button-size: 28px}:host([pending]){--prompt-box-actions-opacity: .75}";
38
+ var T = Object.defineProperty, n = (b, t, o, e) => {
39
+ for (var a = void 0, r = b.length - 1, l; r >= 0; r--)
40
+ (l = b[r]) && (a = l(t, o, a) || a);
41
+ return a && T(t, o, a), a;
42
+ };
43
+ let z = !1;
44
+ typeof window < "u" && (document.addEventListener(
45
+ "keydown",
46
+ () => {
47
+ z = !0;
48
+ },
49
+ !0
50
+ ), document.addEventListener(
51
+ "mousedown",
52
+ () => {
53
+ z = !1;
54
+ },
55
+ !0
56
+ ), document.addEventListener(
57
+ "pointerdown",
58
+ () => {
59
+ z = !1;
60
+ },
61
+ !0
62
+ ));
63
+ var d;
64
+ const i = (d = class extends L(F, {
65
+ validSizes: ["xs", "s", "m", "l", "xl"],
66
+ defaultSize: "m"
67
+ }) {
68
+ constructor() {
69
+ super(...arguments), this.rows = 1, this.grows = !1, this.recording = !1, this.hideSubmit = !1, this.placeholder = "", this.value = "", this.disabled = !1, this.readonly = !1, this.maxlength = -1, this.pending = !1, this.allowImages = !1, this.allowFiles = !1, this.acceptedFileTypes = [], this._hasTopActions = !1, this._hasBottomActions = !1, this._hasRecordButton = !1, this._hasSubmitButton = !1, this._attachments = [], this._isRecording = !1, this._recordingDuration = 0, this._audioLevel = 0, this._voiceRecorder = null, this._shouldFocusFinishButton = !1, this._attachmentIdCounter = 0, this._handleHostFocus = () => {
70
+ z && this.classList.add("focus-visible");
71
+ }, this._handleHostBlur = () => {
72
+ this.classList.remove("focus-visible");
73
+ }, this._handlePaste = (t) => {
74
+ var a;
75
+ if (!this.allowImages || this.disabled || this.readonly || this.pending)
76
+ return;
77
+ const o = (a = t.clipboardData) == null ? void 0 : a.items;
78
+ if (!o) return;
79
+ const e = [];
80
+ for (const r of o)
81
+ if (r.type.startsWith("image/")) {
82
+ const l = r.getAsFile();
83
+ l && e.push(l);
84
+ }
85
+ e.length > 0 && this.addFiles(e);
86
+ };
87
+ }
88
+ static get styles() {
89
+ return [B(I)];
90
+ }
91
+ /**
92
+ * Get the appropriate tag size based on the prompt box size.
93
+ * Tags are one level smaller than the prompt box, with 's' being the minimum.
94
+ * @private
95
+ */
96
+ get _tagSize() {
97
+ switch (this.size) {
98
+ case "s":
99
+ case "m":
100
+ return "s";
101
+ case "l":
102
+ case "xl":
103
+ return "m";
104
+ default:
105
+ return "s";
106
+ }
107
+ }
108
+ connectedCallback() {
109
+ super.connectedCallback(), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEventListener("focus", this._handleHostFocus), this.addEventListener("blur", this._handleHostBlur), this.addEventListener("paste", this._handlePaste);
110
+ }
111
+ disconnectedCallback() {
112
+ super.disconnectedCallback(), this.removeEventListener("focus", this._handleHostFocus), this.removeEventListener("blur", this._handleHostBlur), this.removeEventListener("paste", this._handlePaste), this._revokeAllPreviewUrls(), this._destroyVoiceRecorder();
113
+ }
114
+ _revokeAllPreviewUrls() {
115
+ for (const t of this._attachments)
116
+ t.previewUrl && URL.revokeObjectURL(t.previewUrl);
117
+ }
118
+ _handleTopActionsSlotChange(t) {
119
+ const o = t.target;
120
+ this._hasTopActions = o.assignedNodes().length > 0;
121
+ }
122
+ _handleBottomActionsSlotChange(t) {
123
+ const o = t.target;
124
+ this._hasBottomActions = o.assignedNodes().length > 0;
125
+ }
126
+ _handleRecordButtonSlotChange(t) {
127
+ const o = t.target;
128
+ this._hasRecordButton = o.assignedNodes().length > 0;
129
+ }
130
+ _handleSubmitButtonSlotChange(t) {
131
+ const o = t.target;
132
+ this._hasSubmitButton = o.assignedNodes().length > 0;
133
+ }
134
+ _handleInput(t) {
135
+ const o = t.target;
136
+ this.value = o.value, this.dispatchEvent(
137
+ new Event("input", {
138
+ bubbles: !0,
139
+ composed: !0
140
+ })
141
+ );
142
+ }
143
+ _handleKeydown(t) {
144
+ t.key === "Enter" && !t.shiftKey && (t.preventDefault(), this._submit());
145
+ }
146
+ _handleFileInputChange(t) {
147
+ const o = t.target, e = o.files;
148
+ e && e.length > 0 && this.addFiles([...e]), o.value = "";
149
+ }
150
+ _isFileTypeAccepted(t) {
151
+ if (this.acceptedFileTypes.length === 0)
152
+ return !0;
153
+ const o = t.name.toLowerCase(), e = t.type.toLowerCase();
154
+ for (const a of this.acceptedFileTypes) {
155
+ const r = a.toLowerCase();
156
+ if (r.endsWith("/*")) {
157
+ const l = r.slice(0, -2);
158
+ if (e.startsWith(l + "/"))
159
+ return !0;
160
+ } else {
161
+ if (e === r)
162
+ return !0;
163
+ if (r.startsWith(".") && o.endsWith(r))
164
+ return !0;
165
+ }
166
+ }
167
+ return !1;
168
+ }
169
+ _isImageFile(t) {
170
+ return t.type.startsWith("image/");
171
+ }
172
+ _generateAttachmentId() {
173
+ return `attachment-${++this._attachmentIdCounter}-${Date.now()}`;
174
+ }
175
+ /**
176
+ * Add files as attachments.
177
+ * @param files - Array of File objects to add
178
+ * @returns Array of added attachment IDs
179
+ */
180
+ addFiles(t) {
181
+ if (this.disabled || this.readonly || this.pending)
182
+ return [];
183
+ const o = [];
184
+ for (const e of t) {
185
+ if (this._isImageFile(e) && !this.allowImages || !this._isImageFile(e) && !this.allowFiles || !this._isFileTypeAccepted(e))
186
+ continue;
187
+ const a = this._generateAttachmentId(), r = {
188
+ file: e,
189
+ id: a
190
+ };
191
+ this._isImageFile(e) && (r.previewUrl = URL.createObjectURL(e)), this._attachments = [...this._attachments, r], o.push(a);
192
+ }
193
+ return o.length > 0 && this.dispatchEvent(
194
+ new CustomEvent("luzmo-attachments-change", {
195
+ bubbles: !0,
196
+ composed: !0,
197
+ detail: { attachments: this._attachments }
198
+ })
199
+ ), o;
200
+ }
201
+ /**
202
+ * Remove an attachment by its ID.
203
+ * @param id - The attachment ID to remove
204
+ */
205
+ removeAttachment(t) {
206
+ const o = this._attachments.find((e) => e.id === t);
207
+ o && (o.previewUrl && URL.revokeObjectURL(o.previewUrl), this._attachments = this._attachments.filter((e) => e.id !== t), this.dispatchEvent(
208
+ new CustomEvent("luzmo-attachments-change", {
209
+ bubbles: !0,
210
+ composed: !0,
211
+ detail: { attachments: this._attachments }
212
+ })
213
+ ));
214
+ }
215
+ /**
216
+ * Clear all attachments.
217
+ */
218
+ clearAttachments() {
219
+ this._revokeAllPreviewUrls(), this._attachments = [], this.dispatchEvent(
220
+ new CustomEvent("luzmo-attachments-change", {
221
+ bubbles: !0,
222
+ composed: !0,
223
+ detail: { attachments: this._attachments }
224
+ })
225
+ );
226
+ }
227
+ /**
228
+ * Get all current attachments.
229
+ */
230
+ getAttachments() {
231
+ return [...this._attachments];
232
+ }
233
+ /**
234
+ * Open the file picker dialog.
235
+ */
236
+ openFilePicker() {
237
+ var t;
238
+ (t = this._fileInput) == null || t.click();
239
+ }
240
+ _handleRemoveAttachment(t) {
241
+ const e = t.currentTarget.dataset.attachmentId;
242
+ e && this.removeAttachment(e);
243
+ }
244
+ _handleTagDelete(t) {
245
+ const e = t.target.dataset.attachmentId;
246
+ e && (t.preventDefault(), this.removeAttachment(e));
247
+ }
248
+ /**
249
+ * Extract values from interactive elements within a container.
250
+ * @private
251
+ */
252
+ _extractActionValues(t) {
253
+ const o = [];
254
+ for (const e of t) {
255
+ const a = this._getInteractiveElements(e);
256
+ for (const r of a) {
257
+ const l = {
258
+ element: r,
259
+ name: r.getAttribute("name") || r.getAttribute("label") || void 0
260
+ }, p = [
261
+ "luzmo-switch",
262
+ "luzmo-checkbox",
263
+ "luzmo-radio"
264
+ ], u = r.tagName.toLowerCase();
265
+ "value" in r && (l.value = r.value), p.includes(u) && "checked" in r && (l.checked = r.checked), o.push(l);
266
+ }
267
+ }
268
+ return o;
269
+ }
270
+ _submit() {
271
+ var p, u;
272
+ if (this.disabled || this.readonly || this.pending)
273
+ return;
274
+ const t = (p = this.shadowRoot) == null ? void 0 : p.querySelector(
275
+ 'slot[name="top-actions"]'
276
+ ), o = (u = this.shadowRoot) == null ? void 0 : u.querySelector(
277
+ 'slot[name="bottom-actions"]'
278
+ ), e = (t == null ? void 0 : t.assignedElements()) ?? [], a = (o == null ? void 0 : o.assignedElements()) ?? [], r = this._extractActionValues([
279
+ ...e,
280
+ ...a
281
+ ]), l = {
282
+ value: this.value,
283
+ topActions: [...e],
284
+ bottomActions: [...a],
285
+ actionValues: r,
286
+ attachments: [...this._attachments]
287
+ };
288
+ this.dispatchEvent(
289
+ new CustomEvent("luzmo-submit", {
290
+ bubbles: !0,
291
+ composed: !0,
292
+ detail: l
293
+ })
294
+ );
295
+ }
296
+ async _handleRecordClick(t) {
297
+ if (!_.isSupported()) {
298
+ this.dispatchEvent(
299
+ new CustomEvent("luzmo-record-error", {
300
+ bubbles: !0,
301
+ composed: !0,
302
+ detail: { error: "Voice recording is not supported in this browser" }
303
+ })
304
+ );
305
+ return;
306
+ }
307
+ if (this._isRecording)
308
+ this._stopRecording();
309
+ else {
310
+ const o = t.currentTarget;
311
+ this._shouldFocusFinishButton = o.matches(":focus-visible"), await this._startRecording();
312
+ }
313
+ this.dispatchEvent(
314
+ new CustomEvent("luzmo-record", {
315
+ bubbles: !0,
316
+ composed: !0,
317
+ detail: { isRecording: this._isRecording }
318
+ })
319
+ );
320
+ }
321
+ /**
322
+ * Start voice recording.
323
+ * @private
324
+ */
325
+ async _startRecording() {
326
+ if (this._initVoiceRecorder(), !this._voiceRecorder)
327
+ return;
328
+ await this._voiceRecorder.startRecording() && (this._isRecording = !0, this._recordingDuration = 0, this._audioLevel = 0);
329
+ }
330
+ /**
331
+ * Stop voice recording.
332
+ * @private
333
+ */
334
+ _stopRecording() {
335
+ this._voiceRecorder && this._voiceRecorder.stopRecording();
336
+ }
337
+ /**
338
+ * Cancel voice recording without emitting the result.
339
+ * @private
340
+ */
341
+ _cancelRecording() {
342
+ this._voiceRecorder && this._voiceRecorder.cancelRecording(), this._isRecording = !1, this._recordingDuration = 0, this._audioLevel = 0;
343
+ }
344
+ /**
345
+ * Handle cancel recording button click.
346
+ * @private
347
+ */
348
+ _handleCancelRecordClick() {
349
+ this._cancelRecording(), this.dispatchEvent(
350
+ new CustomEvent("luzmo-record-cancel", {
351
+ bubbles: !0,
352
+ composed: !0
353
+ })
354
+ );
355
+ }
356
+ /**
357
+ * Initialize voice recorder with callbacks.
358
+ * @private
359
+ */
360
+ _initVoiceRecorder() {
361
+ this._voiceRecorder || (this._voiceRecorder = new _({
362
+ maxDuration: 3e5
363
+ // 5 minutes
364
+ }), this._voiceRecorder.onStart(() => {
365
+ this._isRecording = !0;
366
+ }).onStop((t) => {
367
+ this._isRecording = !1, this._recordingDuration = 0, this._audioLevel = 0, this.dispatchEvent(
368
+ new CustomEvent("luzmo-recording-complete", {
369
+ bubbles: !0,
370
+ composed: !0,
371
+ detail: {
372
+ audioBlob: t.audioBlob,
373
+ duration: t.duration,
374
+ mimeType: t.mimeType
375
+ }
376
+ })
377
+ );
378
+ }).onError((t) => {
379
+ this._isRecording = !1, this._recordingDuration = 0, this._audioLevel = 0, this.dispatchEvent(
380
+ new CustomEvent("luzmo-record-error", {
381
+ bubbles: !0,
382
+ composed: !0,
383
+ detail: { error: t }
384
+ })
385
+ );
386
+ }).onAudioLevel((t) => {
387
+ this._audioLevel = t;
388
+ }).onDurationUpdate((t) => {
389
+ this._recordingDuration = t;
390
+ }));
391
+ }
392
+ /**
393
+ * Destroy voice recorder and clean up.
394
+ * @private
395
+ */
396
+ _destroyVoiceRecorder() {
397
+ this._voiceRecorder && (this._voiceRecorder.destroy(), this._voiceRecorder = null), this._isRecording = !1, this._recordingDuration = 0, this._audioLevel = 0;
398
+ }
399
+ /**
400
+ * Format recording duration for display.
401
+ * @private
402
+ */
403
+ _formatRecordingDuration() {
404
+ return _.formatDuration(this._recordingDuration);
405
+ }
406
+ /**
407
+ * Focus the input element.
408
+ */
409
+ focus() {
410
+ var t;
411
+ (t = this._inputElement) == null || t.focus();
412
+ }
413
+ /**
414
+ * Clear the input value and all attachments.
415
+ */
416
+ clear() {
417
+ this.value = "", this.clearAttachments();
418
+ }
419
+ /**
420
+ * Get the slotted top actions elements.
421
+ */
422
+ getTopActions() {
423
+ var o;
424
+ const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector(
425
+ 'slot[name="top-actions"]'
426
+ );
427
+ return (t == null ? void 0 : t.assignedElements()) ?? [];
428
+ }
429
+ /**
430
+ * Get the slotted bottom actions elements.
431
+ */
432
+ getBottomActions() {
433
+ var o;
434
+ const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector(
435
+ 'slot[name="bottom-actions"]'
436
+ );
437
+ return (t == null ? void 0 : t.assignedElements()) ?? [];
438
+ }
439
+ updated(t) {
440
+ super.updated(t), (t.has("pending") || t.has("disabled")) && this._updateSlottedElementsState(), this._shouldFocusFinishButton && this._isRecording && (this._shouldFocusFinishButton = !1, requestAnimationFrame(() => {
441
+ var o;
442
+ (o = this._finishRecordingButton) == null || o.focus();
443
+ }));
444
+ }
445
+ /**
446
+ * Find all interactive children within an element (including the element itself if it matches).
447
+ * @private
448
+ */
449
+ _getInteractiveElements(t) {
450
+ const o = [];
451
+ t.matches(d.INTERACTIVE_ELEMENTS_SELECTOR) && o.push(t);
452
+ const e = t.querySelectorAll(
453
+ d.INTERACTIVE_ELEMENTS_SELECTOR
454
+ );
455
+ return o.push(...e), o;
456
+ }
457
+ /**
458
+ * Update the state of slotted elements based on disabled and pending properties.
459
+ * When disabled: set disabled attribute
460
+ * When pending: set readonly attribute (not disabled)
461
+ * @private
462
+ */
463
+ _updateSlottedElementsState() {
464
+ var p, u, v, R;
465
+ const t = (p = this.shadowRoot) == null ? void 0 : p.querySelector(
466
+ 'slot[name="submit-button"]'
467
+ ), o = (t == null ? void 0 : t.assignedElements()) ?? [];
468
+ for (const x of o) {
469
+ const y = this._getInteractiveElements(x);
470
+ for (const c of y)
471
+ this.pending ? (c.setAttribute("pending", ""), c.removeAttribute("disabled"), c.removeAttribute("readonly")) : this.disabled ? (c.removeAttribute("pending"), c.setAttribute("disabled", ""), c.removeAttribute("readonly")) : (c.removeAttribute("pending"), c.removeAttribute("disabled"), c.removeAttribute("readonly"));
472
+ }
473
+ const e = (x) => {
474
+ for (const y of x) {
475
+ const c = this._getInteractiveElements(y);
476
+ for (const g of c)
477
+ this.disabled ? (g.setAttribute("disabled", ""), g.removeAttribute("readonly")) : this.pending ? (g.removeAttribute("disabled"), g.setAttribute("readonly", "")) : (g.removeAttribute("disabled"), g.removeAttribute("readonly"));
478
+ }
479
+ }, a = (u = this.shadowRoot) == null ? void 0 : u.querySelector(
480
+ 'slot[name="top-actions"]'
481
+ );
482
+ e((a == null ? void 0 : a.assignedElements()) ?? []);
483
+ const r = (v = this.shadowRoot) == null ? void 0 : v.querySelector(
484
+ 'slot[name="bottom-actions"]'
485
+ );
486
+ e((r == null ? void 0 : r.assignedElements()) ?? []);
487
+ const l = (R = this.shadowRoot) == null ? void 0 : R.querySelector(
488
+ 'slot[name="record-button"]'
489
+ );
490
+ e((l == null ? void 0 : l.assignedElements()) ?? []);
491
+ }
492
+ renderTopActions() {
493
+ return s`
494
+ <div
495
+ class="top-actions ${this._hasTopActions ? "" : "empty"}"
496
+ part="top-actions"
497
+ >
498
+ <slot
499
+ name="top-actions"
500
+ @slotchange=${this._handleTopActionsSlotChange}
501
+ ></slot>
502
+ </div>
503
+ `;
504
+ }
505
+ renderBottomActions() {
506
+ return s`
507
+ <div
508
+ class="bottom-actions ${this._hasBottomActions ? "" : "empty"}"
509
+ part="bottom-actions"
510
+ >
511
+ <slot
512
+ name="bottom-actions"
513
+ @slotchange=${this._handleBottomActionsSlotChange}
514
+ ></slot>
515
+ </div>
516
+ `;
517
+ }
518
+ renderRecordButton() {
519
+ return !this.recording && !this._hasRecordButton ? s`<slot
520
+ name="record-button"
521
+ @slotchange=${this._handleRecordButtonSlotChange}
522
+ ></slot>` : this._hasRecordButton ? s`<slot
523
+ name="record-button"
524
+ @slotchange=${this._handleRecordButtonSlotChange}
525
+ ></slot>` : this._isRecording ? s`
526
+ <slot
527
+ name="record-button"
528
+ @slotchange=${this._handleRecordButtonSlotChange}
529
+ ></slot>
530
+ <div class="recording-ui" part="recording-ui">
531
+ <luzmo-action-button
532
+ class="cancel-recording-button"
533
+ part="cancel-recording-button"
534
+ .size=${this.size}
535
+ ?disabled=${this.disabled}
536
+ @click=${this._handleCancelRecordClick}
537
+ aria-label="Cancel recording"
538
+ >
539
+ <luzmo-icon
540
+ slot="icon"
541
+ .icon=${$}
542
+ .size=${this.size}
543
+ ></luzmo-icon>
544
+ </luzmo-action-button>
545
+ ${this.renderWaveform()}
546
+ <span class="recording-duration" part="recording-duration">
547
+ ${this._formatRecordingDuration()}
548
+ </span>
549
+ <luzmo-button
550
+ class="finish-recording-button"
551
+ part="finish-recording-button"
552
+ .size=${this.size}
553
+ icon-only
554
+ variant="primary"
555
+ ?disabled=${this.disabled}
556
+ @click=${this._handleRecordClick}
557
+ aria-label="Finish recording"
558
+ >
559
+ <luzmo-icon slot="icon" .icon=${C}></luzmo-icon>
560
+ </luzmo-button>
561
+ </div>
562
+ ` : s`
563
+ <slot
564
+ name="record-button"
565
+ @slotchange=${this._handleRecordButtonSlotChange}
566
+ ></slot>
567
+ <luzmo-action-button
568
+ class="record-button"
569
+ part="record-button"
570
+ quiet
571
+ .size=${this.size}
572
+ ?disabled=${this.disabled}
573
+ ?readonly=${this.pending}
574
+ @click=${this._handleRecordClick}
575
+ aria-label="Record"
576
+ >
577
+ <luzmo-icon
578
+ slot="icon"
579
+ .icon=${k}
580
+ .size=${this.size}
581
+ ></luzmo-icon>
582
+ </luzmo-action-button>
583
+ `;
584
+ }
585
+ renderWaveform() {
586
+ const o = [];
587
+ for (let e = 0; e < 5; e++) {
588
+ const r = Math.floor(2.5), p = 1 - Math.abs(e - r) * 0.15, u = 0.3 + this._audioLevel * 0.7 * p, v = Math.max(0.2, Math.min(1, u));
589
+ o.push(s`
590
+ <span
591
+ class="waveform-bar"
592
+ style="--bar-height: ${v}"
593
+ ></span>
594
+ `);
595
+ }
596
+ return s`
597
+ <div class="waveform" part="waveform" aria-hidden="true">${o}</div>
598
+ `;
599
+ }
600
+ renderSubmitButton() {
601
+ return this._isRecording ? s`<slot
602
+ name="submit-button"
603
+ @slotchange=${this._handleSubmitButtonSlotChange}
604
+ ></slot>` : this.hideSubmit && !this._hasSubmitButton ? s`<slot
605
+ name="submit-button"
606
+ @slotchange=${this._handleSubmitButtonSlotChange}
607
+ ></slot>` : this._hasSubmitButton ? s`<slot
608
+ name="submit-button"
609
+ @slotchange=${this._handleSubmitButtonSlotChange}
610
+ ></slot>` : s`
611
+ <slot
612
+ name="submit-button"
613
+ @slotchange=${this._handleSubmitButtonSlotChange}
614
+ ></slot>
615
+ <luzmo-button
616
+ class="submit-button"
617
+ part="submit-button"
618
+ .size=${this.size}
619
+ icon-only
620
+ variant="primary"
621
+ ?disabled=${this.disabled || !this.pending && !this.value.trim()}
622
+ ?pending=${this.pending}
623
+ @click=${this._submit}
624
+ aria-label="Submit"
625
+ >
626
+ <luzmo-icon slot="icon" .icon=${S}></luzmo-icon>
627
+ </luzmo-button>
628
+ `;
629
+ }
630
+ renderTextarea() {
631
+ return s`
632
+ <luzmo-text-field
633
+ class="input-field"
634
+ part="input"
635
+ placeholder=${this.placeholder}
636
+ .value=${this.value}
637
+ .size=${this.size}
638
+ rows=${this.rows}
639
+ ?grows=${this.grows}
640
+ ?readonly=${this.readonly || this.pending || this.disabled}
641
+ maxlength=${this.maxlength > 0 ? this.maxlength : -1}
642
+ multiline
643
+ quiet
644
+ label=${this.placeholder || "Enter your message"}
645
+ @input=${this._handleInput}
646
+ @keydown=${this._handleKeydown}
647
+ ></luzmo-text-field>
648
+ `;
649
+ }
650
+ _getAcceptAttribute() {
651
+ if (this.acceptedFileTypes.length > 0)
652
+ return this.acceptedFileTypes.join(",");
653
+ const t = [];
654
+ return this.allowImages && t.push("image/*"), this.allowFiles && t.push("*/*"), t.join(",");
655
+ }
656
+ renderHiddenFileInput() {
657
+ return !this.allowImages && !this.allowFiles ? f : s`
658
+ <input
659
+ type="file"
660
+ class="hidden-file-input"
661
+ accept=${this._getAcceptAttribute()}
662
+ multiple
663
+ @change=${this._handleFileInputChange}
664
+ aria-hidden="true"
665
+ tabindex="-1"
666
+ />
667
+ `;
668
+ }
669
+ renderImageAttachment(t) {
670
+ return s`
671
+ <div class="image-attachment" part="image-attachment">
672
+ <img
673
+ src=${t.previewUrl || ""}
674
+ alt=${t.file.name}
675
+ class="image-preview"
676
+ />
677
+ <luzmo-clear-button
678
+ class="attachment-remove"
679
+ .size=${this.size}
680
+ ?disabled=${this.disabled || this.pending}
681
+ label="Remove ${t.file.name}"
682
+ data-attachment-id=${t.id}
683
+ @click=${this._handleRemoveAttachment}
684
+ ></luzmo-clear-button>
685
+ </div>
686
+ `;
687
+ }
688
+ renderFileAttachment(t) {
689
+ return s`
690
+ <luzmo-tag
691
+ class="file-attachment"
692
+ part="file-attachment"
693
+ .size=${this._tagSize}
694
+ deletable
695
+ ?disabled=${this.disabled || this.pending}
696
+ data-attachment-id=${t.id}
697
+ @delete=${this._handleTagDelete}
698
+ >
699
+ ${t.file.name}
700
+ </luzmo-tag>
701
+ `;
702
+ }
703
+ renderAttachments() {
704
+ if (this._attachments.length === 0)
705
+ return f;
706
+ const t = this._attachments.filter(
707
+ (e) => this._isImageFile(e.file)
708
+ ), o = this._attachments.filter(
709
+ (e) => !this._isImageFile(e.file)
710
+ );
711
+ return s`
712
+ <div class="attachments" part="attachments">
713
+ ${t.length > 0 ? s`
714
+ <div class="image-attachments" part="image-attachments">
715
+ ${E(
716
+ t,
717
+ (e) => e.id,
718
+ (e) => this.renderImageAttachment(e)
719
+ )}
720
+ </div>
721
+ ` : f}
722
+ ${o.length > 0 ? s`
723
+ <luzmo-tags
724
+ class="file-attachments"
725
+ part="file-attachments"
726
+ .size=${this._tagSize}
727
+ >
728
+ ${E(
729
+ o,
730
+ (e) => e.id,
731
+ (e) => this.renderFileAttachment(e)
732
+ )}
733
+ </luzmo-tags>
734
+ ` : f}
735
+ </div>
736
+ `;
737
+ }
738
+ render() {
739
+ return s`
740
+ ${this.renderHiddenFileInput()}
741
+ <div class="container" part="container">
742
+ ${this.renderTopActions()} ${this.renderAttachments()}
743
+ <div class="input-wrapper" part="input-wrapper">
744
+ ${this.renderTextarea()}
745
+ </div>
746
+ <div class="actions-row" part="actions-row">
747
+ ${this.renderBottomActions()}
748
+ <div class="button-group" part="button-group">
749
+ ${this.renderRecordButton()} ${this.renderSubmitButton()}
750
+ </div>
751
+ </div>
752
+ </div>
753
+ `;
754
+ }
755
+ }, d.INTERACTIVE_ELEMENTS_SELECTOR = "luzmo-button, luzmo-action-button, luzmo-switch, luzmo-picker, luzmo-picker-button, luzmo-select, luzmo-text-field, luzmo-number-field", d);
756
+ n([
757
+ m({ type: Number })
758
+ ], i.prototype, "rows");
759
+ n([
760
+ m({ type: Boolean, reflect: !0 })
761
+ ], i.prototype, "grows");
762
+ n([
763
+ m({ type: Boolean, reflect: !0 })
764
+ ], i.prototype, "recording");
765
+ n([
766
+ m({ type: Boolean, reflect: !0, attribute: "hide-submit" })
767
+ ], i.prototype, "hideSubmit");
768
+ n([
769
+ m({ type: String })
770
+ ], i.prototype, "placeholder");
771
+ n([
772
+ m({ type: String })
773
+ ], i.prototype, "value");
774
+ n([
775
+ m({ type: Boolean, reflect: !0 })
776
+ ], i.prototype, "disabled");
777
+ n([
778
+ m({ type: Boolean, reflect: !0 })
779
+ ], i.prototype, "readonly");
780
+ n([
781
+ m({ type: Number })
782
+ ], i.prototype, "maxlength");
783
+ n([
784
+ m({ type: Boolean, reflect: !0 })
785
+ ], i.prototype, "pending");
786
+ n([
787
+ m({ type: Boolean, reflect: !0, attribute: "allow-images" })
788
+ ], i.prototype, "allowImages");
789
+ n([
790
+ m({ type: Boolean, reflect: !0, attribute: "allow-files" })
791
+ ], i.prototype, "allowFiles");
792
+ n([
793
+ m({ type: Array, attribute: "accepted-file-types" })
794
+ ], i.prototype, "acceptedFileTypes");
795
+ n([
796
+ h()
797
+ ], i.prototype, "_hasTopActions");
798
+ n([
799
+ h()
800
+ ], i.prototype, "_hasBottomActions");
801
+ n([
802
+ h()
803
+ ], i.prototype, "_hasRecordButton");
804
+ n([
805
+ h()
806
+ ], i.prototype, "_hasSubmitButton");
807
+ n([
808
+ h()
809
+ ], i.prototype, "_attachments");
810
+ n([
811
+ h()
812
+ ], i.prototype, "_isRecording");
813
+ n([
814
+ h()
815
+ ], i.prototype, "_recordingDuration");
816
+ n([
817
+ h()
818
+ ], i.prototype, "_audioLevel");
819
+ n([
820
+ w("luzmo-text-field")
821
+ ], i.prototype, "_inputElement");
822
+ n([
823
+ w('input[type="file"]')
824
+ ], i.prototype, "_fileInput");
825
+ n([
826
+ w(".finish-recording-button")
827
+ ], i.prototype, "_finishRecordingButton");
828
+ let D = i;
829
+ customElements.get("luzmo-prompt-box") || customElements.define("luzmo-prompt-box", D);
830
+ export {
831
+ D as LuzmoPromptBox
832
+ };