@sdata/web-vue 3.18.0 → 3.19.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 (259) hide show
  1. package/dist/sd.css +478 -0
  2. package/dist/sd.min.css +2 -2
  3. package/es/_components/icon-hover.vue.d.ts +1 -1
  4. package/es/_components/input-label/input-label.d.ts +13 -1
  5. package/es/_components/input-label/input-label.js +35 -5
  6. package/es/_components/input-label/style/index.css +6 -0
  7. package/es/_components/input-label/style/input-label.scss +8 -0
  8. package/es/_components/picker/input-range.vue.d.ts +24 -1
  9. package/es/_components/picker/input-range.vue_vue_type_script_setup_true_lang.js +42 -6
  10. package/es/_components/picker/input.vue.d.ts +24 -1
  11. package/es/_components/picker/input.vue_vue_type_script_setup_true_lang.js +31 -4
  12. package/es/_components/picker/style/index.scss +8 -0
  13. package/es/_components/select-view/select-view.d.ts +15 -3
  14. package/es/_components/select-view/select-view.js +10 -1
  15. package/es/_components/select-view/style/index.css +12 -0
  16. package/es/_components/virtual-list/virtual-list.vue.d.ts +6 -6
  17. package/es/_hooks/use-fit-width.d.ts +22 -0
  18. package/es/_hooks/use-fit-width.js +76 -0
  19. package/es/_hooks/use-form-item.d.ts +1 -1
  20. package/es/_hooks/use-size.d.ts +1 -1
  21. package/es/anchor/anchor.vue.d.ts +1 -1
  22. package/es/anchor/index.d.ts +3 -3
  23. package/es/auto-complete/auto-complete.d.ts +20 -2
  24. package/es/auto-complete/auto-complete.js +18 -0
  25. package/es/auto-complete/index.d.ts +36 -6
  26. package/es/basic-crud-table/basic-crud-table.vue.d.ts +2 -2
  27. package/es/basic-crud-table/index.d.ts +5 -5
  28. package/es/button/button.vue.d.ts +2 -2
  29. package/es/button/index.d.ts +6 -6
  30. package/es/card/card.d.ts +3 -3
  31. package/es/card/index.d.ts +6 -6
  32. package/es/carousel/carousel-indicator.vue.d.ts +1 -1
  33. package/es/cascader/base-cascader-panel.d.ts +1 -1
  34. package/es/cascader/cascader-option.d.ts +1 -1
  35. package/es/cascader/cascader-panel.vue.d.ts +1 -1
  36. package/es/cascader/cascader-search-panel.d.ts +1 -1
  37. package/es/cascader/cascader.vue.d.ts +7 -5
  38. package/es/cascader/cascader.vue_vue_type_script_setup_true_lang.js +12 -0
  39. package/es/cascader/types.d.ts +2 -1
  40. package/es/checkbox/checkbox.d.ts +3 -3
  41. package/es/checkbox/index.d.ts +6 -6
  42. package/es/collapse/collapse-item.d.ts +3 -3
  43. package/es/collapse/index.d.ts +3 -3
  44. package/es/color-picker/color-picker.d.ts +2 -2
  45. package/es/color-picker/index.d.ts +6 -6
  46. package/es/components.d.ts +4 -0
  47. package/es/config-provider/config-provider.vue.d.ts +1 -1
  48. package/es/config-provider/index.d.ts +3 -3
  49. package/es/date-picker/index.d.ts +87 -23
  50. package/es/date-picker/interface.d.ts +2 -1
  51. package/es/date-picker/picker-panel.vue.d.ts +1 -1
  52. package/es/date-picker/picker.vue.d.ts +39 -17
  53. package/es/date-picker/picker.vue_vue_type_script_setup_true_lang.js +30 -1
  54. package/es/date-picker/pickers/date-picker.d.ts +18 -0
  55. package/es/date-picker/pickers/date-picker.js +16 -0
  56. package/es/date-picker/range-picker-panel.vue.d.ts +1 -1
  57. package/es/date-picker/range-picker.vue.d.ts +39 -17
  58. package/es/date-picker/range-picker.vue_vue_type_script_setup_true_lang.js +27 -1
  59. package/es/date-picker/style/index.css +6 -0
  60. package/es/descriptions/descriptions.d.ts +3 -3
  61. package/es/descriptions/index.d.ts +9 -9
  62. package/es/divider/divider.d.ts +1 -1
  63. package/es/divider/index.d.ts +3 -3
  64. package/es/drawer/drawer.vue.d.ts +4 -4
  65. package/es/drawer/index.d.ts +11 -11
  66. package/es/dropdown/dropdown-button.vue.d.ts +2 -2
  67. package/es/dropdown/dropdown-option.vue.d.ts +1 -1
  68. package/es/dropdown/dropdown-submenu.vue.d.ts +2 -2
  69. package/es/dropdown/dropdown.vue.d.ts +1 -1
  70. package/es/dropdown/index.d.ts +21 -21
  71. package/es/ellipsis/ellipsis.vue.d.ts +1 -1
  72. package/es/ellipsis/index.d.ts +6 -6
  73. package/es/ellipsis/performant-ellipsis.vue.d.ts +1 -1
  74. package/es/form/form-item.vue.d.ts +1 -1
  75. package/es/form/form.vue.d.ts +1 -1
  76. package/es/form/index.d.ts +9 -9
  77. package/es/grid/grid-row.vue.d.ts +3 -3
  78. package/es/grid/index.d.ts +9 -9
  79. package/es/icon/icon-arrow-up/icon-arrow-up.js +5 -0
  80. package/es/icon/icon-arrow-up/icon-arrow-up.vue_vue_type_script_setup_true_lang.js +52 -0
  81. package/es/icon/icon-arrow-up/index.js +9 -0
  82. package/es/icon/icon-mute/icon-mute.js +5 -0
  83. package/es/icon/icon-mute/icon-mute.vue_vue_type_script_setup_true_lang.js +52 -0
  84. package/es/icon/icon-mute/index.js +9 -0
  85. package/es/icon/icon-voice/icon-voice.js +5 -0
  86. package/es/icon/icon-voice/icon-voice.vue_vue_type_script_setup_true_lang.js +52 -0
  87. package/es/icon/icon-voice/index.js +9 -0
  88. package/es/image/preview-action.d.ts +6 -6
  89. package/es/image/preview-group.vue.d.ts +1 -1
  90. package/es/index.css +478 -0
  91. package/es/index.d.ts +5 -0
  92. package/es/index.js +5 -1
  93. package/es/index.scss +2 -0
  94. package/es/input/index.d.ts +99 -6
  95. package/es/input/input-password.vue.d.ts +18 -0
  96. package/es/input/input-password.vue_vue_type_script_setup_true_lang.js +24 -2
  97. package/es/input/input-search.d.ts +18 -0
  98. package/es/input/input-search.js +20 -2
  99. package/es/input/input.d.ts +29 -2
  100. package/es/input/input.js +45 -3
  101. package/es/input/style/index.css +16 -0
  102. package/es/input/style/index.scss +21 -0
  103. package/es/input-number/index.d.ts +36 -6
  104. package/es/input-number/input-number.d.ts +20 -2
  105. package/es/input-number/input-number.js +19 -0
  106. package/es/input-tag/index.d.ts +36 -6
  107. package/es/input-tag/input-tag.d.ts +20 -2
  108. package/es/input-tag/input-tag.js +35 -4
  109. package/es/input-tag/style/index.css +6 -0
  110. package/es/input-tag/style/input-tag.scss +8 -0
  111. package/es/kv-list/index.d.ts +72 -32
  112. package/es/link/index.d.ts +6 -6
  113. package/es/link/link.vue.d.ts +2 -2
  114. package/es/locale/interface.d.ts +22 -0
  115. package/es/locale/lang/ar-eg.js +21 -1
  116. package/es/locale/lang/de-de.js +21 -1
  117. package/es/locale/lang/en-us.js +21 -1
  118. package/es/locale/lang/es-es.js +21 -1
  119. package/es/locale/lang/fr-fr.js +21 -1
  120. package/es/locale/lang/id-id.js +21 -1
  121. package/es/locale/lang/it-it.js +21 -1
  122. package/es/locale/lang/ja-jp.js +21 -1
  123. package/es/locale/lang/km-kh.js +21 -1
  124. package/es/locale/lang/ko-kr.js +21 -1
  125. package/es/locale/lang/ms-my.js +21 -1
  126. package/es/locale/lang/nl-nl.js +21 -1
  127. package/es/locale/lang/pt-pt.js +21 -1
  128. package/es/locale/lang/ru-ru.js +21 -1
  129. package/es/locale/lang/th-th.js +21 -1
  130. package/es/locale/lang/vi-vn.js +21 -1
  131. package/es/locale/lang/zh-cn.js +21 -1
  132. package/es/locale/lang/zh-tw.js +21 -1
  133. package/es/mention/index.d.ts +39 -9
  134. package/es/mention/mention.d.ts +21 -3
  135. package/es/mention/mention.js +24 -1
  136. package/es/mention/style/index.css +6 -0
  137. package/es/mention/style/index.scss +8 -0
  138. package/es/menu/item.d.ts +1 -1
  139. package/es/message/message-list.d.ts +1 -1
  140. package/es/modal/index.d.ts +9 -9
  141. package/es/modal/modal.vue.d.ts +3 -3
  142. package/es/popconfirm/index.d.ts +3 -3
  143. package/es/popconfirm/popconfirm.vue.d.ts +1 -1
  144. package/es/popover/index.d.ts +6 -6
  145. package/es/popover/popover.vue.d.ts +2 -2
  146. package/es/progress/circle.vue.d.ts +1 -1
  147. package/es/progress/line.vue.d.ts +1 -1
  148. package/es/qr-code/index.d.ts +15 -15
  149. package/es/qr-code/qr-code.vue.d.ts +5 -5
  150. package/es/radio/index.d.ts +6 -6
  151. package/es/radio/radio.d.ts +3 -3
  152. package/es/rate/index.d.ts +3 -3
  153. package/es/rate/rate.d.ts +1 -1
  154. package/es/resize-box/index.d.ts +5 -5
  155. package/es/resize-box/resize-box.vue.d.ts +3 -3
  156. package/es/rich-text-editor/built-in-components.d.ts +5 -0
  157. package/es/rich-text-editor/built-in-components.js +6 -0
  158. package/es/rich-text-editor/index.d.ts +195 -0
  159. package/es/rich-text-editor/index.js +12 -0
  160. package/es/rich-text-editor/nodes/inline-component-node.d.ts +30 -0
  161. package/es/rich-text-editor/nodes/inline-component-node.js +86 -0
  162. package/es/rich-text-editor/rich-text-editor.js +5 -0
  163. package/es/rich-text-editor/rich-text-editor.vue.d.ts +76 -0
  164. package/es/rich-text-editor/rich-text-editor.vue_vue_type_script_setup_true_lang.js +630 -0
  165. package/es/rich-text-editor/rich-text-node-renderer.js +5 -0
  166. package/es/rich-text-editor/rich-text-node-renderer.vue.d.ts +28 -0
  167. package/es/rich-text-editor/rich-text-node-renderer.vue_vue_type_script_setup_true_lang.js +133 -0
  168. package/es/rich-text-editor/style/css.js +2 -0
  169. package/es/rich-text-editor/style/index.css +164 -0
  170. package/es/rich-text-editor/style/index.d.ts +2 -0
  171. package/es/rich-text-editor/style/index.js +2 -0
  172. package/es/rich-text-editor/style/index.scss +193 -0
  173. package/es/rich-text-editor/style/token.scss +36 -0
  174. package/es/rich-text-editor/types.d.ts +148 -0
  175. package/es/sd-vue.js +6 -0
  176. package/es/select/index.d.ts +108 -54
  177. package/es/select/interface.d.ts +2 -1
  178. package/es/select/select.d.ts +55 -25
  179. package/es/select/select.js +18 -0
  180. package/es/sender/context.d.ts +8 -0
  181. package/es/sender/context.js +4 -0
  182. package/es/sender/index.d.ts +119 -0
  183. package/es/sender/index.js +20 -0
  184. package/es/sender/sender-header.js +5 -0
  185. package/es/sender/sender-header.vue.d.ts +28 -0
  186. package/es/sender/sender-header.vue_vue_type_script_setup_true_lang.js +127 -0
  187. package/es/sender/sender-switch.js +5 -0
  188. package/es/sender/sender-switch.vue.d.ts +32 -0
  189. package/es/sender/sender-switch.vue_vue_type_script_setup_true_lang.js +95 -0
  190. package/es/sender/sender.js +5 -0
  191. package/es/sender/sender.vue_vue_type_script_setup_true_lang.js +871 -0
  192. package/es/sender/style/css.js +3 -0
  193. package/es/sender/style/index.css +290 -0
  194. package/es/sender/style/index.d.ts +3 -0
  195. package/es/sender/style/index.js +3 -0
  196. package/es/sender/style/index.scss +346 -0
  197. package/es/sender/style/token.scss +43 -0
  198. package/es/sender/types.d.ts +171 -0
  199. package/es/sender/use-speech.d.ts +9 -0
  200. package/es/sender/use-speech.js +120 -0
  201. package/es/slider/index.d.ts +3 -3
  202. package/es/slider/slider-input.vue.d.ts +1 -1
  203. package/es/slider/slider.vue.d.ts +1 -1
  204. package/es/space/index.d.ts +9 -9
  205. package/es/space/space.d.ts +2 -2
  206. package/es/spin/index.d.ts +3 -3
  207. package/es/spin/spin.d.ts +1 -1
  208. package/es/statistic/index.d.ts +3 -3
  209. package/es/statistic/statistic.vue.d.ts +1 -1
  210. package/es/steps/index.d.ts +5 -5
  211. package/es/steps/step.vue.d.ts +2 -2
  212. package/es/steps/steps.vue.d.ts +1 -1
  213. package/es/table/index.d.ts +17 -17
  214. package/es/table/table-column.d.ts +1 -1
  215. package/es/table/table-operation-td.d.ts +12 -12
  216. package/es/table/table-td.d.ts +2 -2
  217. package/es/table/table.d.ts +5 -5
  218. package/es/tabs/index.d.ts +12 -12
  219. package/es/tabs/tabs-nav.d.ts +1 -1
  220. package/es/tabs/tabs.d.ts +4 -4
  221. package/es/tag/index.d.ts +6 -6
  222. package/es/tag/tag.vue.d.ts +2 -2
  223. package/es/textarea/index.d.ts +38 -8
  224. package/es/textarea/style/index.css +6 -0
  225. package/es/textarea/style/index.scss +8 -0
  226. package/es/textarea/textarea.vue.d.ts +21 -3
  227. package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +36 -3
  228. package/es/time-picker/index.d.ts +36 -6
  229. package/es/time-picker/interface.d.ts +2 -1
  230. package/es/time-picker/range-panel.js +58 -0
  231. package/es/time-picker/time-picker.vue.d.ts +20 -2
  232. package/es/time-picker/time-picker.vue_vue_type_script_setup_true_lang.js +30 -1
  233. package/es/timeline/index.d.ts +6 -6
  234. package/es/timeline/timeline.d.ts +3 -3
  235. package/es/tooltip/index.d.ts +6 -6
  236. package/es/tooltip/tooltip.vue.d.ts +2 -2
  237. package/es/tour/index.d.ts +3 -3
  238. package/es/tour/tour.vue.d.ts +1 -1
  239. package/es/transfer/index.d.ts +3 -3
  240. package/es/transfer/transfer.vue.d.ts +1 -1
  241. package/es/tree/tree.vue.d.ts +4 -4
  242. package/es/tree-select/interface.d.ts +2 -1
  243. package/es/tree-select/tree-select.vue.d.ts +25 -7
  244. package/es/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js +20 -0
  245. package/es/trigger/index.d.ts +12 -12
  246. package/es/trigger/trigger.d.ts +4 -4
  247. package/es/typography/base.d.ts +4 -4
  248. package/es/typography/edit-content.vue.d.ts +2 -2
  249. package/es/upload/index.d.ts +6 -6
  250. package/es/upload/upload-button.d.ts +1 -1
  251. package/es/upload/upload.d.ts +2 -2
  252. package/es/verification-code/index.d.ts +3 -3
  253. package/es/verification-code/verification-code.d.ts +1 -1
  254. package/es/watermark/index.d.ts +3 -3
  255. package/es/watermark/watermark.d.ts +1 -1
  256. package/json/vetur-attributes.json +233 -0
  257. package/json/vetur-tags.json +83 -3
  258. package/json/web-types.json +535 -2
  259. package/package.json +10 -1
@@ -0,0 +1,871 @@
1
+ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/objectSpread2.js";
2
+ import { getPrefixCls } from "../_utils/global-config.js";
3
+ import IconClose from "../icon/icon-close/index.js";
4
+ import { useI18n } from "../locale/index.js";
5
+ import { isReadonlyModificationKey, useReadonlyTip, useReadonlyTipText } from "../_hooks/use-readonly-tip.js";
6
+ import Tooltip from "../tooltip/index.js";
7
+ import Button from "../button/index.js";
8
+ import Textarea from "../textarea/index.js";
9
+ import RichTextEditor from "../rich-text-editor/index.js";
10
+ import { senderInjectionKey } from "./context.js";
11
+ import IconArrowUp from "../icon/icon-arrow-up/index.js";
12
+ import IconMute from "../icon/icon-mute/index.js";
13
+ import IconVoice from "../icon/icon-voice/index.js";
14
+ import { useSpeech } from "./use-speech.js";
15
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, h, mergeProps, nextTick, normalizeClass, normalizeStyle, openBlock, provide, renderSlot, resolveDynamicComponent, shallowRef, toRef, unref, useAttrs, watch, withCtx } from "vue";
16
+ import { INSERT_LINE_BREAK_COMMAND } from "lexical";
17
+ //#region components/sender/sender.vue?vue&type=script&setup=true&lang.ts
18
+ var sender_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent(_objectSpread2(_objectSpread2({}, {
19
+ name: "Sender",
20
+ inheritAttrs: false
21
+ }), {}, {
22
+ __name: "sender",
23
+ props: {
24
+ modelValue: {},
25
+ defaultValue: { default: "" },
26
+ loading: { type: Boolean },
27
+ readonly: { type: [Boolean, String] },
28
+ submitType: { default: "enter" },
29
+ disabled: { type: Boolean },
30
+ slotConfig: {},
31
+ allowSpeech: { type: [Boolean, Object] },
32
+ autoSize: {
33
+ type: [Boolean, Object],
34
+ default: () => ({ maxRows: 8 })
35
+ },
36
+ skill: {},
37
+ placeholder: {},
38
+ showActions: {
39
+ type: Boolean,
40
+ default: true
41
+ },
42
+ components: {},
43
+ classNames: { default: () => ({}) },
44
+ styles: { default: () => ({}) },
45
+ onKeydown: {},
46
+ onKeyup: {}
47
+ },
48
+ emits: [
49
+ "update:modelValue",
50
+ "change",
51
+ "submit",
52
+ "cancel",
53
+ "paste",
54
+ "pasteFile",
55
+ "focus",
56
+ "blur"
57
+ ],
58
+ setup(__props, { expose: __expose, emit: __emit }) {
59
+ const props = __props;
60
+ const emit = __emit;
61
+ const { t } = useI18n();
62
+ const RenderContent = defineComponent({
63
+ name: "SenderRenderContent",
64
+ props: { content: { type: null } },
65
+ setup(renderProps) {
66
+ return () => {
67
+ var _renderProps$content;
68
+ return (_renderProps$content = renderProps.content) !== null && _renderProps$content !== void 0 ? _renderProps$content : null;
69
+ };
70
+ }
71
+ });
72
+ const CustomSlotRenderer = defineComponent({
73
+ name: "SenderCustomSlotRenderer",
74
+ props: {
75
+ renderer: {
76
+ type: Function,
77
+ required: true
78
+ },
79
+ value: { type: null },
80
+ item: {
81
+ type: Object,
82
+ required: true
83
+ },
84
+ disabled: Boolean,
85
+ readonly: Boolean
86
+ },
87
+ emits: { change: (_value) => true },
88
+ setup(renderProps, { emit: emitCustomChange }) {
89
+ return () => renderProps.renderer(renderProps.value, (value) => emitCustomChange("change", value), {
90
+ disabled: renderProps.disabled,
91
+ readonly: renderProps.readonly
92
+ }, renderProps.item);
93
+ }
94
+ });
95
+ const SkillTag = defineComponent({
96
+ name: "SenderSkillTag",
97
+ props: {
98
+ skill: {
99
+ type: Object,
100
+ required: true
101
+ },
102
+ disabled: Boolean,
103
+ readonly: Boolean
104
+ },
105
+ emits: { remove: (_event) => true },
106
+ setup(tagProps, { emit: emitRemove, slots }) {
107
+ const closeClass = computed(() => [`${prefixCls}-skill-tag-close`, { [`${prefixCls}-skill-tag-close-disabled`]: tagProps.disabled || tagProps.readonly || typeof tagProps.skill.closable === "object" && tagProps.skill.closable.disabled }]);
108
+ const tooltipProps = computed(() => typeof tagProps.skill.tooltip === "string" ? { content: tagProps.skill.tooltip } : tagProps.skill.tooltip);
109
+ const handleRemove = (event) => {
110
+ event.stopPropagation();
111
+ emitRemove("remove", event);
112
+ };
113
+ const handleRemoveKeydown = (event) => {
114
+ if (event.key !== "Enter" && event.key !== " ") return;
115
+ event.preventDefault();
116
+ event.stopPropagation();
117
+ emitRemove("remove", event);
118
+ };
119
+ const renderTag = () => {
120
+ var _slots$skillTitle, _slots$skillCloseIc;
121
+ return h("span", {
122
+ class: `${prefixCls}-skill-tag`,
123
+ tabindex: tagProps.skill.tooltip ? "0" : void 0
124
+ }, [h("span", { class: `${prefixCls}-skill-tag-text` }, [(_slots$skillTitle = slots["skill-title"]) === null || _slots$skillTitle === void 0 ? void 0 : _slots$skillTitle.call(slots, { skill: tagProps.skill })]), tagProps.skill.closable ? h("span", {
125
+ "class": closeClass.value,
126
+ "role": "button",
127
+ "tabindex": "0",
128
+ "aria-label": t("sender.removeSkill"),
129
+ "onClick": handleRemove,
130
+ "onKeydown": handleRemoveKeydown
131
+ }, [(_slots$skillCloseIc = slots["skill-close-icon"]) === null || _slots$skillCloseIc === void 0 ? void 0 : _slots$skillCloseIc.call(slots, { skill: tagProps.skill })]) : null]);
132
+ };
133
+ return () => tagProps.skill.tooltip ? h(Tooltip, tooltipProps.value, { default: renderTag }) : renderTag();
134
+ }
135
+ });
136
+ const attrs = useAttrs();
137
+ const instance = getCurrentInstance();
138
+ const prefixCls = getPrefixCls("sender");
139
+ const readonlyTipHoverVisible = shallowRef(false);
140
+ const { tipVisible: readonlyTipInteractionVisible, show: showReadonlyTip, hide: hideReadonlyTip } = useReadonlyTip(toRef(props, "readonly"), computed(() => Boolean(props.disabled)));
141
+ const readonlyTipText = useReadonlyTipText(toRef(props, "readonly"));
142
+ const readonlyTipDisabled = computed(() => !props.readonly || props.disabled);
143
+ const readonlyTipVisible = computed(() => !readonlyTipDisabled.value && (readonlyTipHoverVisible.value || readonlyTipInteractionVisible.value));
144
+ const containerRef = shallowRef();
145
+ const textareaRef = shallowRef();
146
+ const slotInputRef = shallowRef();
147
+ const slotEditorReady = shallowRef(false);
148
+ const runtimeSlotConfig = shallowRef([]);
149
+ const activeSkill = shallowRef();
150
+ if (props.skill) activeSkill.value = props.skill;
151
+ const slotValue = shallowRef({
152
+ value: "",
153
+ slotConfig: [],
154
+ skill: props.skill
155
+ });
156
+ const innerValue = shallowRef(props.defaultValue);
157
+ const pendingValue = shallowRef();
158
+ provide(senderInjectionKey, {
159
+ prefixCls,
160
+ classNames: toRef(props, "classNames"),
161
+ styles: toRef(props, "styles")
162
+ });
163
+ const isControlled = computed(() => {
164
+ var _instance$vnode$props;
165
+ return Object.hasOwn((_instance$vnode$props = instance === null || instance === void 0 ? void 0 : instance.vnode.props) !== null && _instance$vnode$props !== void 0 ? _instance$vnode$props : {}, "modelValue");
166
+ });
167
+ const mergedValue = computed(() => {
168
+ var _props$modelValue;
169
+ return isControlled.value ? (_props$modelValue = props.modelValue) !== null && _props$modelValue !== void 0 ? _props$modelValue : "" : innerValue.value;
170
+ });
171
+ const isSlotMode = computed(() => props.slotConfig !== void 0 || Boolean(props.skill));
172
+ const inputComponent = computed(() => {
173
+ var _props$components$inp, _props$components;
174
+ return (_props$components$inp = (_props$components = props.components) === null || _props$components === void 0 ? void 0 : _props$components.input) !== null && _props$components$inp !== void 0 ? _props$components$inp : Textarea;
175
+ });
176
+ const allSlotConfig = computed(() => {
177
+ var _props$slotConfig, _props$slotConfig2;
178
+ const propKeys = new Set(((_props$slotConfig = props.slotConfig) !== null && _props$slotConfig !== void 0 ? _props$slotConfig : []).flatMap((item) => item.key ? [item.key] : []));
179
+ return [...(_props$slotConfig2 = props.slotConfig) !== null && _props$slotConfig2 !== void 0 ? _props$slotConfig2 : [], ...runtimeSlotConfig.value.filter((item) => !item.key || !propKeys.has(item.key))];
180
+ });
181
+ const keyedSlotConfig = computed(() => new Map(allSlotConfig.value.flatMap((item) => item.key ? [[item.key, item]] : [])));
182
+ const slotEditorClassNames = computed(() => ({
183
+ root: [
184
+ `${prefixCls}-input`,
185
+ `${prefixCls}-input-slot`,
186
+ props.classNames.input
187
+ ].filter(Boolean).join(" "),
188
+ content: `${prefixCls}-input-slot-content`,
189
+ placeholder: `${prefixCls}-input-slot-placeholder`,
190
+ component: `${prefixCls}-slot`
191
+ }));
192
+ const slotEditorStyles = computed(() => ({ root: props.styles.input }));
193
+ const handleReadonlyTipVisibleChange = (visible) => {
194
+ readonlyTipHoverVisible.value = visible && !readonlyTipDisabled.value;
195
+ };
196
+ const handleReadonlyKeydown = (event) => {
197
+ const target = event.target;
198
+ if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {
199
+ readonlyTipHoverVisible.value = false;
200
+ hideReadonlyTip();
201
+ return;
202
+ }
203
+ if (isReadonlyModificationKey(event)) showReadonlyTip();
204
+ };
205
+ const rootClass = computed(() => [
206
+ prefixCls,
207
+ `${prefixCls}-main`,
208
+ attrs.class,
209
+ props.classNames.root,
210
+ { [`${prefixCls}-disabled`]: props.disabled }
211
+ ]);
212
+ const toJsonValue = (value) => {
213
+ if (value === void 0) return null;
214
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
215
+ try {
216
+ return JSON.parse(JSON.stringify(value));
217
+ } catch (_unused) {
218
+ return String(value);
219
+ }
220
+ };
221
+ const updateCustomSlot = (update, value) => {
222
+ update(toJsonValue(value));
223
+ };
224
+ const getSlotDefaultValue = (config) => {
225
+ var _config$value, _ref, _config$props$value, _config$props, _config$props2, _config$props$default, _config$props3;
226
+ if (config.type === "text") return (_config$value = config.value) !== null && _config$value !== void 0 ? _config$value : "";
227
+ if (config.type === "tag") return (_ref = (_config$props$value = (_config$props = config.props) === null || _config$props === void 0 ? void 0 : _config$props.value) !== null && _config$props$value !== void 0 ? _config$props$value : (_config$props2 = config.props) === null || _config$props2 === void 0 ? void 0 : _config$props2.label) !== null && _ref !== void 0 ? _ref : "";
228
+ return (_config$props$default = (_config$props3 = config.props) === null || _config$props3 === void 0 ? void 0 : _config$props3.defaultValue) !== null && _config$props$default !== void 0 ? _config$props$default : "";
229
+ };
230
+ const createSlotNode = (config, previousValue) => {
231
+ const value = toJsonValue(previousValue !== null && previousValue !== void 0 ? previousValue : getSlotDefaultValue(config));
232
+ if (config.type === "input" || config.type === "content") {
233
+ var _config$props$placeho, _config$props4;
234
+ return {
235
+ key: config.key,
236
+ name: "input",
237
+ value,
238
+ props: _objectSpread2({ placeholder: (_config$props$placeho = (_config$props4 = config.props) === null || _config$props4 === void 0 ? void 0 : _config$props4.placeholder) !== null && _config$props$placeho !== void 0 ? _config$props$placeho : "" }, config.type === "content" ? { class: `${prefixCls}-slot-content` } : {}),
239
+ textValue: String(value !== null && value !== void 0 ? value : "")
240
+ };
241
+ }
242
+ if (config.type === "select") {
243
+ var _config$props$placeho2, _config$props5, _config$props$options, _config$props6;
244
+ return {
245
+ key: config.key,
246
+ name: "select",
247
+ value,
248
+ props: {
249
+ placeholder: (_config$props$placeho2 = (_config$props5 = config.props) === null || _config$props5 === void 0 ? void 0 : _config$props5.placeholder) !== null && _config$props$placeho2 !== void 0 ? _config$props$placeho2 : "",
250
+ options: (_config$props$options = (_config$props6 = config.props) === null || _config$props6 === void 0 ? void 0 : _config$props6.options.map((option) => ({
251
+ label: option,
252
+ value: option
253
+ }))) !== null && _config$props$options !== void 0 ? _config$props$options : []
254
+ },
255
+ textValue: String(value !== null && value !== void 0 ? value : "")
256
+ };
257
+ }
258
+ if (config.type === "tag") {
259
+ var _config$props7, _config$props$value2, _config$props8;
260
+ const label = (_config$props7 = config.props) === null || _config$props7 === void 0 ? void 0 : _config$props7.label;
261
+ return {
262
+ key: config.key,
263
+ name: "tag",
264
+ value,
265
+ props: { label: typeof label === "string" || typeof label === "number" ? String(label) : String((_config$props$value2 = (_config$props8 = config.props) === null || _config$props8 === void 0 ? void 0 : _config$props8.value) !== null && _config$props$value2 !== void 0 ? _config$props$value2 : "") },
266
+ textValue: String(value !== null && value !== void 0 ? value : "")
267
+ };
268
+ }
269
+ return {
270
+ key: config.key,
271
+ name: "senderCustom",
272
+ value,
273
+ textValue: String(value !== null && value !== void 0 ? value : "")
274
+ };
275
+ };
276
+ const createSkillNode = () => activeSkill.value ? {
277
+ key: "__sender_skill__",
278
+ name: "senderSkill",
279
+ value: activeSkill.value.value,
280
+ textValue: ""
281
+ } : void 0;
282
+ const createSlotEditorContent = (previousContent = []) => {
283
+ const previousValues = new Map(previousContent.flatMap((item) => typeof item === "string" ? [] : [[item.key, item.value]]));
284
+ const skillNode = createSkillNode();
285
+ return [...skillNode ? [skillNode] : [], ...allSlotConfig.value.map((config) => {
286
+ var _config$value2;
287
+ return config.type === "text" ? (_config$value2 = config.value) !== null && _config$value2 !== void 0 ? _config$value2 : "" : createSlotNode(config, previousValues.get(config.key));
288
+ })];
289
+ };
290
+ function resolveSlotValue(content) {
291
+ const result = [];
292
+ const resolvedConfig = [];
293
+ for (const item of content) {
294
+ var _item$value, _config$formatResult, _config$formatResult2;
295
+ if (typeof item === "string") {
296
+ result.push(item);
297
+ if (item) resolvedConfig.push({
298
+ type: "text",
299
+ value: item
300
+ });
301
+ continue;
302
+ }
303
+ if (item.name === "senderSkill") continue;
304
+ const config = keyedSlotConfig.value.get(item.key);
305
+ if (!config) continue;
306
+ const rawValue = (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : "";
307
+ result.push((_config$formatResult = (_config$formatResult2 = config.formatResult) === null || _config$formatResult2 === void 0 ? void 0 : _config$formatResult2.call(config, rawValue)) !== null && _config$formatResult !== void 0 ? _config$formatResult : String(rawValue));
308
+ resolvedConfig.push(_objectSpread2(_objectSpread2({}, config), {}, { value: rawValue }));
309
+ }
310
+ return {
311
+ value: result.join(""),
312
+ slotConfig: resolvedConfig,
313
+ skill: activeSkill.value
314
+ };
315
+ }
316
+ const syncSlotEditor = () => {
317
+ if (!slotEditorReady.value || !slotInputRef.value) return;
318
+ const content = createSlotEditorContent(slotInputRef.value.getContent());
319
+ slotInputRef.value.setContent(content, { tag: "sd-sender-slot-sync" });
320
+ };
321
+ const handleSlotEditorReady = () => {
322
+ slotEditorReady.value = true;
323
+ syncSlotEditor();
324
+ };
325
+ const handleSlotEditorChange = () => {
326
+ var _slotInputRef$value$g, _slotInputRef$value;
327
+ if (!slotEditorReady.value) return;
328
+ const content = (_slotInputRef$value$g = (_slotInputRef$value = slotInputRef.value) === null || _slotInputRef$value === void 0 ? void 0 : _slotInputRef$value.getContent()) !== null && _slotInputRef$value$g !== void 0 ? _slotInputRef$value$g : [];
329
+ if (activeSkill.value && !content.some((item) => typeof item !== "string" && item.name === "senderSkill")) activeSkill.value = void 0;
330
+ slotValue.value = resolveSlotValue(content);
331
+ handleSlotChange(slotValue.value);
332
+ };
333
+ const getCustomSlotName = (key) => `slot-${key}`;
334
+ const getCustomConfig = (key) => {
335
+ const config = keyedSlotConfig.value.get(key);
336
+ return (config === null || config === void 0 ? void 0 : config.type) === "custom" ? config : void 0;
337
+ };
338
+ const removeSkill = (event, remove) => {
339
+ var _activeSkill$value, _config$onClose;
340
+ if (!((_activeSkill$value = activeSkill.value) === null || _activeSkill$value === void 0 ? void 0 : _activeSkill$value.closable) || props.disabled || props.readonly) return;
341
+ const config = typeof activeSkill.value.closable === "object" ? activeSkill.value.closable : void 0;
342
+ if (config === null || config === void 0 ? void 0 : config.disabled) return;
343
+ activeSkill.value = void 0;
344
+ remove();
345
+ config === null || config === void 0 || (_config$onClose = config.onClose) === null || _config$onClose === void 0 || _config$onClose.call(config, event);
346
+ };
347
+ function clearSlotEditor() {
348
+ var _slotInputRef$value2;
349
+ runtimeSlotConfig.value = [];
350
+ activeSkill.value = props.skill;
351
+ const skillNode = createSkillNode();
352
+ (_slotInputRef$value2 = slotInputRef.value) === null || _slotInputRef$value2 === void 0 || _slotInputRef$value2.setContent(skillNode ? [skillNode] : [], { tag: "sd-sender-slot-clear" });
353
+ }
354
+ const getNormalValue = () => ({
355
+ value: mergedValue.value,
356
+ slotConfig: [],
357
+ skill: void 0
358
+ });
359
+ const getCurrentValue = () => isSlotMode.value ? slotValue.value : getNormalValue();
360
+ const setNormalValue = (value, event) => {
361
+ if (!isControlled.value) innerValue.value = value;
362
+ emit("update:modelValue", value);
363
+ emit("change", value, event, [], void 0);
364
+ };
365
+ const handleValueUpdate = (value) => {
366
+ pendingValue.value = value;
367
+ queueMicrotask(() => {
368
+ if (pendingValue.value !== value) return;
369
+ pendingValue.value = void 0;
370
+ setNormalValue(value);
371
+ });
372
+ };
373
+ const handleInput = (value, event) => {
374
+ pendingValue.value = void 0;
375
+ setNormalValue(value, event);
376
+ };
377
+ function handleSlotChange(value, event) {
378
+ emit("change", value.value, event, value.slotConfig, value.skill);
379
+ }
380
+ const submitDisabled = computed(() => !getCurrentValue().value);
381
+ const clearDisabled = computed(() => !getCurrentValue().value);
382
+ const cancelDisabled = computed(() => !props.loading);
383
+ const triggerSend = () => {
384
+ if (props.loading || props.disabled || submitDisabled.value) return;
385
+ const value = getCurrentValue();
386
+ emit("submit", value.value, value.slotConfig, value.skill);
387
+ };
388
+ const triggerClear = () => {
389
+ if (props.disabled || clearDisabled.value) return;
390
+ if (isSlotMode.value) clearSlotEditor();
391
+ else setNormalValue("");
392
+ };
393
+ const triggerCancel = () => {
394
+ if (cancelDisabled.value || props.disabled) return;
395
+ emit("cancel");
396
+ };
397
+ const { available: speechAvailable, recording, requesting: speechRequesting, statusText: speechStatusText, trigger: triggerSpeech } = useSpeech(toRef(props, "allowSpeech"), (transcript) => {
398
+ if (isSlotMode.value) {
399
+ var _slotInputRef$value3;
400
+ (_slotInputRef$value3 = slotInputRef.value) === null || _slotInputRef$value3 === void 0 || _slotInputRef$value3.insertText(transcript, { position: "end" });
401
+ } else setNormalValue(`${mergedValue.value} ${transcript}`);
402
+ });
403
+ const actionContext = computed(() => ({
404
+ send: triggerSend,
405
+ clear: triggerClear,
406
+ cancel: triggerCancel,
407
+ speech: () => triggerSpeech(false),
408
+ submitDisabled: Boolean(props.disabled || submitDisabled.value),
409
+ clearDisabled: Boolean(props.disabled || clearDisabled.value),
410
+ cancelDisabled: Boolean(props.disabled || cancelDisabled.value),
411
+ speechDisabled: Boolean(props.disabled || !speechAvailable.value || speechRequesting.value),
412
+ recording: recording.value,
413
+ loading: Boolean(props.loading)
414
+ }));
415
+ const shouldSubmit = (event) => {
416
+ if (event.isComposing || event.key !== "Enter") return false;
417
+ const modifierPressed = event.ctrlKey || event.altKey || event.metaKey;
418
+ return props.submitType === "enter" && !event.shiftKey && !modifierPressed || props.submitType === "shiftEnter" && event.shiftKey && !modifierPressed;
419
+ };
420
+ const handleKeydown = (event) => {
421
+ var _props$onKeydown;
422
+ if (((_props$onKeydown = props.onKeydown) === null || _props$onKeydown === void 0 ? void 0 : _props$onKeydown.call(props, event)) === false) return;
423
+ if (shouldSubmit(event)) {
424
+ event.preventDefault();
425
+ triggerSend();
426
+ }
427
+ };
428
+ const handleSlotKeydown = (event) => {
429
+ var _props$onKeydown2;
430
+ if (((_props$onKeydown2 = props.onKeydown) === null || _props$onKeydown2 === void 0 ? void 0 : _props$onKeydown2.call(props, event)) === false || event.isComposing || event.key !== "Enter") return;
431
+ const target = event.target;
432
+ if (target instanceof Element && target.closest(`.${prefixCls}-skill-tag`)) return;
433
+ const modifierPressed = event.ctrlKey || event.altKey || event.metaKey;
434
+ if (shouldSubmit(event)) {
435
+ event.preventDefault();
436
+ event.stopPropagation();
437
+ triggerSend();
438
+ return;
439
+ }
440
+ if (!modifierPressed) {
441
+ var _slotInputRef$value4;
442
+ event.preventDefault();
443
+ event.stopPropagation();
444
+ (_slotInputRef$value4 = slotInputRef.value) === null || _slotInputRef$value4 === void 0 || _slotInputRef$value4.dispatchCommand(INSERT_LINE_BREAK_COMMAND, void 0);
445
+ }
446
+ };
447
+ const handlePaste = (event) => {
448
+ var _event$clipboardData, _event$clipboardData2;
449
+ const files = (_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 ? void 0 : _event$clipboardData.files;
450
+ if (!((_event$clipboardData2 = event.clipboardData) === null || _event$clipboardData2 === void 0 ? void 0 : _event$clipboardData2.getData("text/plain")) && (files === null || files === void 0 ? void 0 : files.length)) {
451
+ event.preventDefault();
452
+ emit("pasteFile", files);
453
+ }
454
+ emit("paste", event);
455
+ };
456
+ const handleSlotPaste = (event) => {
457
+ var _event$clipboardData3, _event$clipboardData4;
458
+ const files = (_event$clipboardData3 = event.clipboardData) === null || _event$clipboardData3 === void 0 ? void 0 : _event$clipboardData3.files;
459
+ const text = (_event$clipboardData4 = event.clipboardData) === null || _event$clipboardData4 === void 0 ? void 0 : _event$clipboardData4.getData("text/plain");
460
+ handlePaste(event);
461
+ if (!text && (files === null || files === void 0 ? void 0 : files.length)) event.stopPropagation();
462
+ };
463
+ const getNativeTextarea = () => {
464
+ var _containerRef$value$q, _containerRef$value;
465
+ const exposed = textareaRef.value;
466
+ if (exposed instanceof HTMLTextAreaElement) return exposed;
467
+ const element = exposed === null || exposed === void 0 ? void 0 : exposed.$el;
468
+ if (element instanceof HTMLTextAreaElement) return element;
469
+ if (element instanceof Element) {
470
+ const textarea = element.querySelector("textarea");
471
+ if (textarea) return textarea;
472
+ }
473
+ return (_containerRef$value$q = (_containerRef$value = containerRef.value) === null || _containerRef$value === void 0 ? void 0 : _containerRef$value.querySelector("textarea")) !== null && _containerRef$value$q !== void 0 ? _containerRef$value$q : null;
474
+ };
475
+ const focus = (options) => {
476
+ var _textareaRef$value, _textareaRef$value$fo, _options$cursor;
477
+ if (isSlotMode.value) {
478
+ var _slotInputRef$value6;
479
+ const { cursor = "end", preventScroll = false, key } = options !== null && options !== void 0 ? options : {};
480
+ if (cursor === "slot") {
481
+ var _slotInputRef$value5, _ref2;
482
+ const root = (_slotInputRef$value5 = slotInputRef.value) === null || _slotInputRef$value5 === void 0 ? void 0 : _slotInputRef$value5.rootElement;
483
+ const selector = key ? `[data-rich-text-component-key="${CSS.escape(key)}"]` : "[data-rich-text-component]";
484
+ const component = root === null || root === void 0 ? void 0 : root.querySelector(selector);
485
+ const control = component === null || component === void 0 ? void 0 : component.querySelector("input, textarea, button, [contenteditable=\"true\"]");
486
+ (_ref2 = control !== null && control !== void 0 ? control : component) === null || _ref2 === void 0 || _ref2.focus({ preventScroll });
487
+ return;
488
+ }
489
+ (_slotInputRef$value6 = slotInputRef.value) === null || _slotInputRef$value6 === void 0 || _slotInputRef$value6.focus(void 0, {
490
+ preventScroll,
491
+ selection: cursor === "all" ? "all" : cursor
492
+ });
493
+ return;
494
+ }
495
+ const textarea = getNativeTextarea();
496
+ if (textarea) textarea.focus({ preventScroll: options === null || options === void 0 ? void 0 : options.preventScroll });
497
+ else (_textareaRef$value = textareaRef.value) === null || _textareaRef$value === void 0 || (_textareaRef$value$fo = _textareaRef$value.focus) === null || _textareaRef$value$fo === void 0 || _textareaRef$value$fo.call(_textareaRef$value);
498
+ if (!textarea) return;
499
+ const cursor = (_options$cursor = options === null || options === void 0 ? void 0 : options.cursor) !== null && _options$cursor !== void 0 ? _options$cursor : "end";
500
+ const position = cursor === "start" ? 0 : textarea.value.length;
501
+ if (cursor === "all") textarea.select();
502
+ else textarea.setSelectionRange(position, position);
503
+ };
504
+ const blur = () => {
505
+ var _slotInputRef$value7;
506
+ if (isSlotMode.value) (_slotInputRef$value7 = slotInputRef.value) === null || _slotInputRef$value7 === void 0 || _slotInputRef$value7.blur();
507
+ else {
508
+ var _textareaRef$value2, _textareaRef$value2$b;
509
+ const textarea = getNativeTextarea();
510
+ if (textarea) textarea.blur();
511
+ else (_textareaRef$value2 = textareaRef.value) === null || _textareaRef$value2 === void 0 || (_textareaRef$value2$b = _textareaRef$value2.blur) === null || _textareaRef$value2$b === void 0 || _textareaRef$value2$b.call(_textareaRef$value2);
512
+ }
513
+ };
514
+ const insert = (value, position = "cursor", replaceCharacters, preventScroll) => {
515
+ if (isSlotMode.value) {
516
+ if (typeof value === "string") {
517
+ var _slotInputRef$value8;
518
+ (_slotInputRef$value8 = slotInputRef.value) === null || _slotInputRef$value8 === void 0 || _slotInputRef$value8.insertText(value, {
519
+ position,
520
+ replaceCharacters
521
+ });
522
+ } else {
523
+ var _slotInputRef$value9;
524
+ runtimeSlotConfig.value = [...runtimeSlotConfig.value, ...value];
525
+ (_slotInputRef$value9 = slotInputRef.value) === null || _slotInputRef$value9 === void 0 || _slotInputRef$value9.insertContent(value.map((config) => {
526
+ var _config$value3;
527
+ return config.type === "text" ? (_config$value3 = config.value) !== null && _config$value3 !== void 0 ? _config$value3 : "" : createSlotNode(config);
528
+ }), {
529
+ position,
530
+ replaceCharacters
531
+ });
532
+ }
533
+ if (preventScroll) nextTick(() => focus({
534
+ cursor: "end",
535
+ preventScroll: true
536
+ }));
537
+ return;
538
+ }
539
+ const insertValue = typeof value === "string" ? value : value.map(formatSlot).join("");
540
+ const textarea = getNativeTextarea();
541
+ const current = mergedValue.value;
542
+ let start = position === "start" ? 0 : current.length;
543
+ let end = start;
544
+ if (position === "cursor" && textarea) {
545
+ start = textarea.selectionStart;
546
+ end = textarea.selectionEnd;
547
+ }
548
+ if (replaceCharacters && current.slice(0, start).endsWith(replaceCharacters)) start -= replaceCharacters.length;
549
+ setNormalValue(`${current.slice(0, start)}${insertValue}${current.slice(end)}`);
550
+ requestAnimationFrame(() => {
551
+ var _getNativeTextarea;
552
+ focus({ preventScroll });
553
+ const nextPosition = start + insertValue.length;
554
+ (_getNativeTextarea = getNativeTextarea()) === null || _getNativeTextarea === void 0 || _getNativeTextarea.setSelectionRange(nextPosition, nextPosition);
555
+ });
556
+ };
557
+ const clear = () => {
558
+ if (isSlotMode.value) clearSlotEditor();
559
+ else setNormalValue("");
560
+ };
561
+ const getValue = () => getCurrentValue();
562
+ watch(() => props.slotConfig, () => syncSlotEditor(), { deep: true });
563
+ watch(() => props.skill, (skill) => {
564
+ activeSkill.value = skill;
565
+ syncSlotEditor();
566
+ });
567
+ watch(isSlotMode, (enabled) => {
568
+ if (!enabled) slotEditorReady.value = false;
569
+ });
570
+ function formatSlot(slot) {
571
+ var _slot$value, _ref3, _slot$props$value, _slot$props, _slot$props2, _slot$props$defaultVa, _slot$props3, _slot$formatResult, _slot$formatResult2;
572
+ if (slot.type === "text") return (_slot$value = slot.value) !== null && _slot$value !== void 0 ? _slot$value : "";
573
+ if (slot.type === "tag") return String((_ref3 = (_slot$props$value = (_slot$props = slot.props) === null || _slot$props === void 0 ? void 0 : _slot$props.value) !== null && _slot$props$value !== void 0 ? _slot$props$value : (_slot$props2 = slot.props) === null || _slot$props2 === void 0 ? void 0 : _slot$props2.label) !== null && _ref3 !== void 0 ? _ref3 : "");
574
+ const value = (_slot$props$defaultVa = (_slot$props3 = slot.props) === null || _slot$props3 === void 0 ? void 0 : _slot$props3.defaultValue) !== null && _slot$props$defaultVa !== void 0 ? _slot$props$defaultVa : "";
575
+ return (_slot$formatResult = (_slot$formatResult2 = slot.formatResult) === null || _slot$formatResult2 === void 0 ? void 0 : _slot$formatResult2.call(slot, value)) !== null && _slot$formatResult !== void 0 ? _slot$formatResult : String(value);
576
+ }
577
+ const handleContentMousedown = (event) => {
578
+ if (event.target === event.currentTarget) {
579
+ event.preventDefault();
580
+ focus();
581
+ }
582
+ };
583
+ const StopLoadingIcon = defineComponent({
584
+ name: "SenderStopLoadingIcon",
585
+ inheritAttrs: false,
586
+ setup(_, { attrs: iconAttrs }) {
587
+ return () => h("svg", _objectSpread2(_objectSpread2({}, iconAttrs), {}, {
588
+ color: "currentColor",
589
+ viewBox: "0 0 1000 1000",
590
+ xmlns: "http://www.w3.org/2000/svg"
591
+ }), [
592
+ h("title", null, t("sender.stopGenerating")),
593
+ h("rect", {
594
+ fill: "currentColor",
595
+ height: 250,
596
+ rx: 24,
597
+ ry: 24,
598
+ width: 250,
599
+ x: 375,
600
+ y: 375
601
+ }),
602
+ h("circle", {
603
+ cx: 500,
604
+ cy: 500,
605
+ fill: "none",
606
+ r: 450,
607
+ stroke: "currentColor",
608
+ strokeWidth: 100,
609
+ opacity: .45
610
+ }),
611
+ h("circle", {
612
+ class: `${prefixCls}-loading-spinner`,
613
+ cx: 500,
614
+ cy: 500,
615
+ fill: "none",
616
+ r: 450,
617
+ stroke: "currentColor",
618
+ strokeWidth: 100,
619
+ strokeDasharray: "600 9999999"
620
+ })
621
+ ]);
622
+ }
623
+ });
624
+ const RecordingIcon = defineComponent({
625
+ name: "SenderRecordingIcon",
626
+ inheritAttrs: false,
627
+ setup(_, { attrs: iconAttrs }) {
628
+ const bars = Array.from({ length: 4 }, (__, index) => h("rect", {
629
+ class: `${prefixCls}-recording-bar`,
630
+ style: { animationDelay: `${index * .2}s` },
631
+ fill: "currentColor",
632
+ rx: 70,
633
+ ry: 70,
634
+ height: 250,
635
+ width: 140,
636
+ x: index * 286.6667,
637
+ y: 375
638
+ }));
639
+ return () => h("svg", _objectSpread2(_objectSpread2({}, iconAttrs), {}, {
640
+ color: "currentColor",
641
+ viewBox: "0 0 1000 1000",
642
+ xmlns: "http://www.w3.org/2000/svg"
643
+ }), [h("title", null, t("sender.recording")), ...bars]);
644
+ }
645
+ });
646
+ __expose({
647
+ get inputElement() {
648
+ var _slotInputRef$value$r, _slotInputRef$value10;
649
+ return isSlotMode.value ? (_slotInputRef$value$r = (_slotInputRef$value10 = slotInputRef.value) === null || _slotInputRef$value10 === void 0 ? void 0 : _slotInputRef$value10.rootElement) !== null && _slotInputRef$value$r !== void 0 ? _slotInputRef$value$r : null : getNativeTextarea();
650
+ },
651
+ get nativeElement() {
652
+ var _containerRef$value2;
653
+ return (_containerRef$value2 = containerRef.value) !== null && _containerRef$value2 !== void 0 ? _containerRef$value2 : null;
654
+ },
655
+ focus,
656
+ blur,
657
+ insert,
658
+ clear,
659
+ getValue
660
+ });
661
+ return (_ctx, _cache) => {
662
+ return openBlock(), createBlock(unref(Tooltip), {
663
+ "popup-visible": readonlyTipVisible.value,
664
+ content: unref(readonlyTipText),
665
+ disabled: readonlyTipDisabled.value,
666
+ position: "top",
667
+ onPopupVisibleChange: handleReadonlyTipVisibleChange
668
+ }, {
669
+ default: withCtx(() => {
670
+ var _props$styles, _props$classNames, _props$styles2, _props$classNames2, _props$styles3, _props$classNames3, _props$styles4, _props$classNames4, _props$styles5, _props$classNames5, _props$styles6;
671
+ return [createElementVNode("div", mergeProps({
672
+ ref_key: "containerRef",
673
+ ref: containerRef
674
+ }, _ctx.$attrs, {
675
+ class: rootClass.value,
676
+ style: (_props$styles = __props.styles) === null || _props$styles === void 0 ? void 0 : _props$styles.root,
677
+ onClick: _cache[5] || (_cache[5] = (...args) => unref(showReadonlyTip) && unref(showReadonlyTip)(...args)),
678
+ onKeydownCapture: handleReadonlyKeydown
679
+ }), [
680
+ renderSlot(_ctx.$slots, "header", { actions: actionContext.value }),
681
+ createElementVNode("div", {
682
+ class: normalizeClass([`${unref(prefixCls)}-content`, (_props$classNames = __props.classNames) === null || _props$classNames === void 0 ? void 0 : _props$classNames.content]),
683
+ style: normalizeStyle((_props$styles2 = __props.styles) === null || _props$styles2 === void 0 ? void 0 : _props$styles2.content),
684
+ onMousedown: handleContentMousedown
685
+ }, [
686
+ _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
687
+ key: 0,
688
+ class: normalizeClass([`${unref(prefixCls)}-prefix`, (_props$classNames2 = __props.classNames) === null || _props$classNames2 === void 0 ? void 0 : _props$classNames2.prefix]),
689
+ style: normalizeStyle((_props$styles3 = __props.styles) === null || _props$styles3 === void 0 ? void 0 : _props$styles3.prefix)
690
+ }, [renderSlot(_ctx.$slots, "prefix", { actions: actionContext.value })], 6)) : createCommentVNode("", true),
691
+ isSlotMode.value ? (openBlock(), createBlock(unref(RichTextEditor), {
692
+ key: 1,
693
+ ref_key: "slotInputRef",
694
+ ref: slotInputRef,
695
+ placeholder: __props.placeholder,
696
+ disabled: __props.disabled,
697
+ readonly: Boolean(__props.readonly),
698
+ "auto-size": __props.autoSize,
699
+ "class-names": slotEditorClassNames.value,
700
+ styles: slotEditorStyles.value,
701
+ "aria-label": unref(t)("sender.messageInput"),
702
+ onReady: handleSlotEditorReady,
703
+ onChange: handleSlotEditorChange,
704
+ onKeydownCapture: handleSlotKeydown,
705
+ onKeyupCapture: __props.onKeyup,
706
+ onPasteCapture: handleSlotPaste,
707
+ onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
708
+ onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event))
709
+ }, {
710
+ "node-senderSkill": withCtx(({ remove }) => [activeSkill.value ? (openBlock(), createBlock(unref(SkillTag), {
711
+ key: 0,
712
+ skill: activeSkill.value,
713
+ disabled: __props.disabled,
714
+ readonly: Boolean(__props.readonly),
715
+ onRemove: (event) => removeSkill(event, remove)
716
+ }, {
717
+ "skill-title": withCtx(({ skill }) => [renderSlot(_ctx.$slots, "skill-title", { skill }, () => {
718
+ var _skill$title;
719
+ return [createVNode(unref(RenderContent), { content: (_skill$title = skill.title) !== null && _skill$title !== void 0 ? _skill$title : skill.value }, null, 8, ["content"])];
720
+ })]),
721
+ "skill-close-icon": withCtx(({ skill }) => [renderSlot(_ctx.$slots, "skill-close-icon", { skill }, () => [typeof skill.closable === "object" && skill.closable.closeIcon ? (openBlock(), createBlock(unref(RenderContent), {
722
+ key: 0,
723
+ content: skill.closable.closeIcon
724
+ }, null, 8, ["content"])) : (openBlock(), createBlock(unref(IconClose), { key: 1 }))])]),
725
+ _: 3
726
+ }, 8, [
727
+ "skill",
728
+ "disabled",
729
+ "readonly",
730
+ "onRemove"
731
+ ])) : createCommentVNode("", true)]),
732
+ "node-senderCustom": withCtx((slotProps) => {
733
+ var _getCustomConfig;
734
+ return [_ctx.$slots[getCustomSlotName(slotProps.node.key)] ? renderSlot(_ctx.$slots, getCustomSlotName(slotProps.node.key), {
735
+ value: slotProps.node.value,
736
+ item: getCustomConfig(slotProps.node.key),
737
+ disabled: slotProps.disabled,
738
+ readonly: slotProps.readonly,
739
+ onChange: (value) => updateCustomSlot(slotProps.update, value)
740
+ }, void 0, void 0, 0) : ((_getCustomConfig = getCustomConfig(slotProps.node.key)) === null || _getCustomConfig === void 0 ? void 0 : _getCustomConfig.customRender) ? (openBlock(), createBlock(unref(CustomSlotRenderer), {
741
+ key: 1,
742
+ renderer: getCustomConfig(slotProps.node.key).customRender,
743
+ value: slotProps.node.value,
744
+ item: getCustomConfig(slotProps.node.key),
745
+ disabled: slotProps.disabled,
746
+ readonly: slotProps.readonly,
747
+ onChange: ($event) => updateCustomSlot(slotProps.update, $event)
748
+ }, null, 8, [
749
+ "renderer",
750
+ "value",
751
+ "item",
752
+ "disabled",
753
+ "readonly",
754
+ "onChange"
755
+ ])) : createCommentVNode("", true)];
756
+ }),
757
+ _: 3
758
+ }, 8, [
759
+ "placeholder",
760
+ "disabled",
761
+ "readonly",
762
+ "auto-size",
763
+ "class-names",
764
+ "styles",
765
+ "aria-label",
766
+ "onKeyupCapture"
767
+ ])) : (openBlock(), createBlock(resolveDynamicComponent(inputComponent.value), {
768
+ key: 2,
769
+ ref_key: "textareaRef",
770
+ ref: textareaRef,
771
+ "model-value": mergedValue.value,
772
+ "default-value": __props.defaultValue,
773
+ placeholder: __props.placeholder,
774
+ disabled: __props.disabled,
775
+ readonly: __props.readonly,
776
+ "auto-size": __props.autoSize,
777
+ class: normalizeClass([`${unref(prefixCls)}-input`, (_props$classNames3 = __props.classNames) === null || _props$classNames3 === void 0 ? void 0 : _props$classNames3.input]),
778
+ style: normalizeStyle((_props$styles4 = __props.styles) === null || _props$styles4 === void 0 ? void 0 : _props$styles4.input),
779
+ "onUpdate:modelValue": handleValueUpdate,
780
+ onInput: handleInput,
781
+ onKeydown: handleKeydown,
782
+ onKeyup: __props.onKeyup,
783
+ onPaste: handlePaste,
784
+ onFocus: _cache[2] || (_cache[2] = ($event) => emit("focus", $event)),
785
+ onBlur: _cache[3] || (_cache[3] = ($event) => emit("blur", $event))
786
+ }, null, 40, [
787
+ "model-value",
788
+ "default-value",
789
+ "placeholder",
790
+ "disabled",
791
+ "readonly",
792
+ "auto-size",
793
+ "class",
794
+ "style",
795
+ "onKeyup"
796
+ ])),
797
+ __props.showActions ? (openBlock(), createElementBlock("div", {
798
+ key: 3,
799
+ class: normalizeClass([`${unref(prefixCls)}-actions-list`, (_props$classNames4 = __props.classNames) === null || _props$classNames4 === void 0 ? void 0 : _props$classNames4.suffix]),
800
+ style: normalizeStyle((_props$styles5 = __props.styles) === null || _props$styles5 === void 0 ? void 0 : _props$styles5.suffix)
801
+ }, [renderSlot(_ctx.$slots, "suffix", { actions: actionContext.value }, () => [createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-actions-list-presets`) }, [__props.allowSpeech ? (openBlock(), createBlock(unref(Button), {
802
+ key: 0,
803
+ type: "text",
804
+ loading: unref(speechRequesting),
805
+ disabled: actionContext.value.speechDisabled,
806
+ title: unref(speechStatusText),
807
+ class: normalizeClass([`${unref(prefixCls)}-actions-btn`, { [`${unref(prefixCls)}-actions-btn-disabled`]: actionContext.value.speechDisabled }]),
808
+ "aria-label": unref(speechStatusText),
809
+ onClick: _cache[4] || (_cache[4] = ($event) => unref(triggerSpeech)())
810
+ }, {
811
+ icon: withCtx(() => [unref(recording) ? (openBlock(), createBlock(unref(RecordingIcon), {
812
+ key: 0,
813
+ class: normalizeClass(`${unref(prefixCls)}-actions-btn-recording-icon`)
814
+ }, null, 8, ["class"])) : actionContext.value.speechDisabled ? (openBlock(), createBlock(unref(IconMute), { key: 1 })) : (openBlock(), createBlock(unref(IconVoice), { key: 2 }))]),
815
+ _: 1
816
+ }, 8, [
817
+ "loading",
818
+ "disabled",
819
+ "title",
820
+ "class",
821
+ "aria-label"
822
+ ])) : createCommentVNode("", true), __props.loading ? (openBlock(), createBlock(unref(Button), {
823
+ key: 1,
824
+ type: "text",
825
+ shape: "circle",
826
+ disabled: actionContext.value.cancelDisabled,
827
+ class: normalizeClass([`${unref(prefixCls)}-actions-btn`, `${unref(prefixCls)}-actions-btn-loading-button`]),
828
+ "aria-label": unref(t)("sender.stopGenerating"),
829
+ onClick: triggerCancel
830
+ }, {
831
+ icon: withCtx(() => [createVNode(unref(StopLoadingIcon), { class: normalizeClass(`${unref(prefixCls)}-actions-btn-loading-icon`) }, null, 8, ["class"])]),
832
+ _: 1
833
+ }, 8, [
834
+ "disabled",
835
+ "class",
836
+ "aria-label"
837
+ ])) : (openBlock(), createBlock(unref(Button), {
838
+ key: 2,
839
+ type: "primary",
840
+ shape: "circle",
841
+ disabled: actionContext.value.submitDisabled,
842
+ class: normalizeClass([`${unref(prefixCls)}-actions-btn`, { [`${unref(prefixCls)}-actions-btn-disabled`]: actionContext.value.submitDisabled }]),
843
+ "aria-label": unref(t)("sender.send"),
844
+ onClick: triggerSend
845
+ }, {
846
+ icon: withCtx(() => [createVNode(unref(IconArrowUp))]),
847
+ _: 1
848
+ }, 8, [
849
+ "disabled",
850
+ "class",
851
+ "aria-label"
852
+ ]))], 2)])], 6)) : createCommentVNode("", true)
853
+ ], 38),
854
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
855
+ key: 0,
856
+ class: normalizeClass([`${unref(prefixCls)}-footer`, (_props$classNames5 = __props.classNames) === null || _props$classNames5 === void 0 ? void 0 : _props$classNames5.footer]),
857
+ style: normalizeStyle((_props$styles6 = __props.styles) === null || _props$styles6 === void 0 ? void 0 : _props$styles6.footer)
858
+ }, [renderSlot(_ctx.$slots, "footer", { actions: actionContext.value })], 6)) : createCommentVNode("", true)
859
+ ], 16)];
860
+ }),
861
+ _: 3
862
+ }, 8, [
863
+ "popup-visible",
864
+ "content",
865
+ "disabled"
866
+ ]);
867
+ };
868
+ }
869
+ }));
870
+ //#endregion
871
+ export { sender_vue_vue_type_script_setup_true_lang_default as default };