@opentiny/tiny-robot 0.5.1-alpha.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/dist/attachments/index.js +261 -258
  2. package/dist/index.d.ts +5533 -51
  3. package/dist/index.js +30 -28
  4. package/dist/sender/index.js +1114 -1077
  5. package/dist/style.css +1 -1
  6. package/dist/theme-provider/index.js +41 -32
  7. package/dist/useSenderContentRegistration.js +8 -0
  8. package/package.json +3 -22
  9. package/dist/action-group/ActionGroup.vue.d.ts +0 -26
  10. package/dist/action-group/ActionGroupItem.vue.d.ts +0 -18
  11. package/dist/action-group/index.d.ts +0 -12
  12. package/dist/action-group/index.type.d.ts +0 -17
  13. package/dist/anchor/components/AnchorItem.vue.d.ts +0 -24
  14. package/dist/anchor/components/AnchorList.vue.d.ts +0 -20
  15. package/dist/anchor/components/AnchorOverlay.vue.d.ts +0 -33
  16. package/dist/anchor/components/AnchorSearch.vue.d.ts +0 -7
  17. package/dist/anchor/composables/index.d.ts +0 -5
  18. package/dist/anchor/composables/useActiveSync.d.ts +0 -10
  19. package/dist/anchor/composables/useFloatingOffset.d.ts +0 -6
  20. package/dist/anchor/composables/useNavController.d.ts +0 -12
  21. package/dist/anchor/composables/useOverlayInteractions.d.ts +0 -6
  22. package/dist/anchor/composables/useTargetFeedback.d.ts +0 -5
  23. package/dist/anchor/defaults.d.ts +0 -16
  24. package/dist/anchor/index.d.ts +0 -7
  25. package/dist/anchor/index.type.d.ts +0 -60
  26. package/dist/anchor/index.vue.d.ts +0 -159
  27. package/dist/anchor/internal.type.d.ts +0 -103
  28. package/dist/anchor/utils/scroll.d.ts +0 -7
  29. package/dist/anchor/utils/target.d.ts +0 -6
  30. package/dist/attachments/components/FileCard.vue.d.ts +0 -18
  31. package/dist/attachments/components/ImagePreview.vue.d.ts +0 -17
  32. package/dist/attachments/components/index.d.ts +0 -2
  33. package/dist/attachments/composables/index.d.ts +0 -5
  34. package/dist/attachments/composables/useFileCard.d.ts +0 -15
  35. package/dist/attachments/composables/useFileType.d.ts +0 -20
  36. package/dist/attachments/composables/useImagePreview.d.ts +0 -18
  37. package/dist/attachments/composables/useListType.d.ts +0 -11
  38. package/dist/attachments/index.d.ts +0 -7
  39. package/dist/attachments/index.type.d.ts +0 -70
  40. package/dist/attachments/index.vue.d.ts +0 -27
  41. package/dist/attachments/utils.d.ts +0 -3
  42. package/dist/base-popper/components/Popper.vue.d.ts +0 -28
  43. package/dist/base-popper/index.d.ts +0 -2
  44. package/dist/base-popper/index.vue.d.ts +0 -41
  45. package/dist/bubble/Bubble.vue.d.ts +0 -47
  46. package/dist/bubble/BubbleBoxWrapper.vue.d.ts +0 -22
  47. package/dist/bubble/BubbleContentWrapper.vue.d.ts +0 -22
  48. package/dist/bubble/BubbleItem.vue.d.ts +0 -44
  49. package/dist/bubble/BubbleList.vue.d.ts +0 -43
  50. package/dist/bubble/BubbleProvider.vue.d.ts +0 -18
  51. package/dist/bubble/composables/index.d.ts +0 -11
  52. package/dist/bubble/composables/useBubbleBoxRenderer.d.ts +0 -18
  53. package/dist/bubble/composables/useBubbleContentRenderer.d.ts +0 -18
  54. package/dist/bubble/composables/useBubbleEvent.d.ts +0 -3
  55. package/dist/bubble/composables/useBubbleStateChange.d.ts +0 -1
  56. package/dist/bubble/composables/useBubbleStore.d.ts +0 -16
  57. package/dist/bubble/composables/useContentResolver.d.ts +0 -5
  58. package/dist/bubble/composables/useCopyCleanup.d.ts +0 -6
  59. package/dist/bubble/composables/useMessageContent.d.ts +0 -5
  60. package/dist/bubble/composables/useMessageGroup.d.ts +0 -4
  61. package/dist/bubble/composables/useOmitMessageFields.d.ts +0 -12
  62. package/dist/bubble/composables/useToolCall.d.ts +0 -25
  63. package/dist/bubble/constants.d.ts +0 -42
  64. package/dist/bubble/index.d.ts +0 -19
  65. package/dist/bubble/index.type.d.ts +0 -185
  66. package/dist/bubble/renderers/Box.vue.d.ts +0 -18
  67. package/dist/bubble/renderers/Image.vue.d.ts +0 -4
  68. package/dist/bubble/renderers/Loading.vue.d.ts +0 -4
  69. package/dist/bubble/renderers/Markdown.vue.d.ts +0 -4
  70. package/dist/bubble/renderers/Reasoning.vue.d.ts +0 -9
  71. package/dist/bubble/renderers/Text.vue.d.ts +0 -4
  72. package/dist/bubble/renderers/Tool.vue.d.ts +0 -14
  73. package/dist/bubble/renderers/ToolRole.vue.d.ts +0 -4
  74. package/dist/bubble/renderers/Tools.vue.d.ts +0 -4
  75. package/dist/bubble/renderers/allRenderers.d.ts +0 -93
  76. package/dist/bubble/renderers/defaultRenderers.d.ts +0 -27
  77. package/dist/bubble/utils.d.ts +0 -7
  78. package/dist/chat/components/ChatConversation.vue.d.ts +0 -305
  79. package/dist/chat/components/ChatLauncherButton.vue.d.ts +0 -12
  80. package/dist/chat/components/ChatMcpTrigger.vue.d.ts +0 -30
  81. package/dist/chat/components/ChatThemeToggleButton.vue.d.ts +0 -6
  82. package/dist/chat/components/ChatWelcome.vue.d.ts +0 -14
  83. package/dist/chat/components/icons/IconModelAliyunBailian.vue.d.ts +0 -7
  84. package/dist/chat/components/icons/IconModelDeepseek.vue.d.ts +0 -7
  85. package/dist/chat/components/icons/index.d.ts +0 -5
  86. package/dist/chat/composables/useChatConversation.d.ts +0 -37
  87. package/dist/chat/composables/useChatMcp.d.ts +0 -29
  88. package/dist/chat/composables/useChatModel.d.ts +0 -27
  89. package/dist/chat/index.d.ts +0 -9
  90. package/dist/chat/index.js +0 -13904
  91. package/dist/chat/index.type.d.ts +0 -92
  92. package/dist/chat/index.vue.d.ts +0 -51
  93. package/dist/chat/locale.d.ts +0 -12
  94. package/dist/chat/mcpServers.d.ts +0 -3
  95. package/dist/container/index.d.ts +0 -7
  96. package/dist/container/index.type.d.ts +0 -20
  97. package/dist/container/index.vue.d.ts +0 -32
  98. package/dist/conversations/index.d.ts +0 -7
  99. package/dist/conversations/index.vue.d.ts +0 -2
  100. package/dist/drag-overlay/constants.d.ts +0 -17
  101. package/dist/drag-overlay/directives/vDropzone.d.ts +0 -14
  102. package/dist/drag-overlay/index.d.ts +0 -7
  103. package/dist/drag-overlay/index.type.d.ts +0 -105
  104. package/dist/drag-overlay/index.vue.d.ts +0 -20
  105. package/dist/dropdown-menu/composables/usePopperHover.d.ts +0 -6
  106. package/dist/dropdown-menu/index.d.ts +0 -7
  107. package/dist/dropdown-menu/index.type.d.ts +0 -42
  108. package/dist/dropdown-menu/index.vue.d.ts +0 -217
  109. package/dist/feedback/components/SourceList.vue.d.ts +0 -11
  110. package/dist/feedback/components/index.d.ts +0 -1
  111. package/dist/feedback/index.d.ts +0 -7
  112. package/dist/feedback/index.type.d.ts +0 -25
  113. package/dist/feedback/index.vue.d.ts +0 -13
  114. package/dist/flow-layout-buttons/index.d.ts +0 -7
  115. package/dist/flow-layout-buttons/index.type.d.ts +0 -35
  116. package/dist/flow-layout-buttons/index.vue.d.ts +0 -22
  117. package/dist/history/components/Empty.vue.d.ts +0 -7
  118. package/dist/history/components/MenuList.vue.d.ts +0 -24
  119. package/dist/history/composables/useRenameEditor.d.ts +0 -22
  120. package/dist/history/constants.d.ts +0 -1
  121. package/dist/history/index.d.ts +0 -7
  122. package/dist/history/index.type.d.ts +0 -33
  123. package/dist/history/index.vue.d.ts +0 -18
  124. package/dist/icon-button/index.d.ts +0 -7
  125. package/dist/icon-button/index.type.d.ts +0 -7
  126. package/dist/icon-button/index.vue.d.ts +0 -6
  127. package/dist/layout/Layout.vue.d.ts +0 -246
  128. package/dist/layout/LayoutAsideToggle.vue.d.ts +0 -20
  129. package/dist/layout/LayoutProxyScrollbar.vue.d.ts +0 -6
  130. package/dist/layout/components/AsideContent.vue.d.ts +0 -35
  131. package/dist/layout/components/AsideResizeTrigger.vue.d.ts +0 -20
  132. package/dist/layout/components/FloatingDragBar.vue.d.ts +0 -18
  133. package/dist/layout/components/FloatingResizeTrigger.vue.d.ts +0 -17
  134. package/dist/layout/components/FloatingResizeTriggers.vue.d.ts +0 -14
  135. package/dist/layout/components/LayoutSurface.vue.d.ts +0 -41
  136. package/dist/layout/composables/useLayoutAsideStates.d.ts +0 -21
  137. package/dist/layout/composables/useLayoutContext.d.ts +0 -4
  138. package/dist/layout/composables/usePointerDrag.d.ts +0 -19
  139. package/dist/layout/index.d.ts +0 -22
  140. package/dist/layout/index.type.d.ts +0 -111
  141. package/dist/layout/internal.type.d.ts +0 -43
  142. package/dist/layout/utils/asideEventEmitters.d.ts +0 -6
  143. package/dist/layout/utils/asidePresets.d.ts +0 -5
  144. package/dist/layout/utils/cssLength.d.ts +0 -2
  145. package/dist/layout/utils/domInteraction.d.ts +0 -1
  146. package/dist/layout/utils/number.d.ts +0 -1
  147. package/dist/layout/utils/surfaceGeometry.d.ts +0 -87
  148. package/dist/layout/utils/surfaceResize.d.ts +0 -10
  149. package/dist/mcp-add-form/components/CodeEditor.vue.d.ts +0 -9
  150. package/dist/mcp-add-form/components/FormEditor.vue.d.ts +0 -10
  151. package/dist/mcp-add-form/components/index.d.ts +0 -2
  152. package/dist/mcp-add-form/index.d.ts +0 -7
  153. package/dist/mcp-add-form/index.type.d.ts +0 -19
  154. package/dist/mcp-add-form/index.vue.d.ts +0 -13
  155. package/dist/mcp-server-picker/components/NoData.vue.d.ts +0 -7
  156. package/dist/mcp-server-picker/components/PluginCard.vue.d.ts +0 -40
  157. package/dist/mcp-server-picker/components/PluginModal.vue.d.ts +0 -15
  158. package/dist/mcp-server-picker/components/index.d.ts +0 -3
  159. package/dist/mcp-server-picker/index.d.ts +0 -7
  160. package/dist/mcp-server-picker/index.type.d.ts +0 -99
  161. package/dist/mcp-server-picker/index.vue.d.ts +0 -71
  162. package/dist/prompts/index.d.ts +0 -12
  163. package/dist/prompts/index.type.d.ts +0 -59
  164. package/dist/prompts/prompt.vue.d.ts +0 -5
  165. package/dist/prompts/prompts.vue.d.ts +0 -20
  166. package/dist/sender/components/editor-content/index.vue.d.ts +0 -4
  167. package/dist/sender/components/footer/index.vue.d.ts +0 -38
  168. package/dist/sender/components/layouts/MultiLineLayout.vue.d.ts +0 -43
  169. package/dist/sender/components/layouts/SingleLineLayout.vue.d.ts +0 -32
  170. package/dist/sender/composables/index.d.ts +0 -7
  171. package/dist/sender/composables/useAutoSize.d.ts +0 -5
  172. package/dist/sender/composables/useEditor.d.ts +0 -13
  173. package/dist/sender/composables/useKeyboardShortcuts.d.ts +0 -7
  174. package/dist/sender/composables/useModeSwitch.d.ts +0 -4
  175. package/dist/sender/composables/useSenderCore.d.ts +0 -31
  176. package/dist/sender/composables/useSlotScope.d.ts +0 -10
  177. package/dist/sender/context/index.d.ts +0 -6
  178. package/dist/sender/context/types.d.ts +0 -7
  179. package/dist/sender/extensions/constants.d.ts +0 -94
  180. package/dist/sender/extensions/index.d.ts +0 -12
  181. package/dist/sender/extensions/mention/commands.d.ts +0 -20
  182. package/dist/sender/extensions/mention/components/mention-list.vue.d.ts +0 -18
  183. package/dist/sender/extensions/mention/components/mention-view.vue.d.ts +0 -19
  184. package/dist/sender/extensions/mention/extension.d.ts +0 -6
  185. package/dist/sender/extensions/mention/index.d.ts +0 -22
  186. package/dist/sender/extensions/mention/plugin.d.ts +0 -16
  187. package/dist/sender/extensions/mention/types.d.ts +0 -126
  188. package/dist/sender/extensions/mention/utils.d.ts +0 -34
  189. package/dist/sender/extensions/suggestion/extension.d.ts +0 -8
  190. package/dist/sender/extensions/suggestion/index.d.ts +0 -20
  191. package/dist/sender/extensions/suggestion/plugin.d.ts +0 -21
  192. package/dist/sender/extensions/suggestion/suggestion-list.vue.d.ts +0 -46
  193. package/dist/sender/extensions/suggestion/types.d.ts +0 -254
  194. package/dist/sender/extensions/suggestion/utils/filter.d.ts +0 -29
  195. package/dist/sender/extensions/suggestion/utils/highlight.d.ts +0 -73
  196. package/dist/sender/extensions/template/block/extension.d.ts +0 -6
  197. package/dist/sender/extensions/template/block/plugins.d.ts +0 -13
  198. package/dist/sender/extensions/template/block/template-block-view.vue.d.ts +0 -14
  199. package/dist/sender/extensions/template/commands.d.ts +0 -31
  200. package/dist/sender/extensions/template/extension.d.ts +0 -6
  201. package/dist/sender/extensions/template/index.d.ts +0 -21
  202. package/dist/sender/extensions/template/select/dropdown-manager.d.ts +0 -23
  203. package/dist/sender/extensions/template/select/extension.d.ts +0 -5
  204. package/dist/sender/extensions/template/select/plugins.d.ts +0 -34
  205. package/dist/sender/extensions/template/select/template-select-view.vue.d.ts +0 -20
  206. package/dist/sender/extensions/template/types.d.ts +0 -100
  207. package/dist/sender/extensions/template/utils.d.ts +0 -20
  208. package/dist/sender/extensions/utils/id-generator.d.ts +0 -16
  209. package/dist/sender/extensions/utils/index.d.ts +0 -7
  210. package/dist/sender/extensions/utils/keyboard.d.ts +0 -49
  211. package/dist/sender/extensions/utils/position.d.ts +0 -25
  212. package/dist/sender/index.d.ts +0 -139
  213. package/dist/sender/index.type.d.ts +0 -311
  214. package/dist/sender/index.vue.d.ts +0 -93
  215. package/dist/sender/types/base.d.ts +0 -239
  216. package/dist/sender/types/components.d.ts +0 -68
  217. package/dist/sender/types/composables.d.ts +0 -122
  218. package/dist/sender/types/context.d.ts +0 -138
  219. package/dist/sender/types/slots.d.ts +0 -67
  220. package/dist/sender/utils/countGraphemes.d.ts +0 -1
  221. package/dist/sender-actions/action-button/index.vue.d.ts +0 -23
  222. package/dist/sender-actions/clear-button/index.vue.d.ts +0 -2
  223. package/dist/sender-actions/clear-button/useClearButtonState.d.ts +0 -6
  224. package/dist/sender-actions/default-actions/index.vue.d.ts +0 -17
  225. package/dist/sender-actions/index.d.ts +0 -21
  226. package/dist/sender-actions/index.type.d.ts +0 -7
  227. package/dist/sender-actions/submit-button/index.vue.d.ts +0 -2
  228. package/dist/sender-actions/types/common.d.ts +0 -40
  229. package/dist/sender-actions/types/index.d.ts +0 -5
  230. package/dist/sender-actions/types/tooltip.d.ts +0 -7
  231. package/dist/sender-actions/upload-button/index.type.d.ts +0 -57
  232. package/dist/sender-actions/upload-button/index.vue.d.ts +0 -16
  233. package/dist/sender-actions/utils/tooltip.d.ts +0 -8
  234. package/dist/sender-actions/voice-button/index.type.d.ts +0 -78
  235. package/dist/sender-actions/voice-button/index.vue.d.ts +0 -43
  236. package/dist/sender-actions/voice-button/speech.types.d.ts +0 -40
  237. package/dist/sender-actions/voice-button/useSpeechHandler.d.ts +0 -10
  238. package/dist/sender-actions/voice-button/webSpeechHandler.d.ts +0 -40
  239. package/dist/sender-actions/word-counter/index.vue.d.ts +0 -2
  240. package/dist/sender-compat/index.d.ts +0 -7
  241. package/dist/sender-compat/index.type.d.ts +0 -91
  242. package/dist/sender-compat/index.vue.d.ts +0 -538
  243. package/dist/shared/composables/createTeleport.d.ts +0 -2
  244. package/dist/shared/composables/index.d.ts +0 -6
  245. package/dist/shared/composables/useAutoScroll.d.ts +0 -25
  246. package/dist/shared/composables/useControllableState.d.ts +0 -20
  247. package/dist/shared/composables/useSlotRefs.d.ts +0 -12
  248. package/dist/shared/composables/useTeleportTarget.d.ts +0 -11
  249. package/dist/shared/composables/useTouchDevice.d.ts +0 -3
  250. package/dist/shared/utils.d.ts +0 -7
  251. package/dist/suggestion-pills/components/PillButton.vue.d.ts +0 -16
  252. package/dist/suggestion-pills/components/index.d.ts +0 -1
  253. package/dist/suggestion-pills/index.d.ts +0 -13
  254. package/dist/suggestion-pills/index.type.d.ts +0 -45
  255. package/dist/suggestion-pills/index.vue.d.ts +0 -44
  256. package/dist/suggestion-popover/components/Backdrop.vue.d.ts +0 -5
  257. package/dist/suggestion-popover/components/Header.vue.d.ts +0 -4
  258. package/dist/suggestion-popover/components/Loading.vue.d.ts +0 -17
  259. package/dist/suggestion-popover/components/NoData.vue.d.ts +0 -17
  260. package/dist/suggestion-popover/components/Tooltip.vue.d.ts +0 -19
  261. package/dist/suggestion-popover/index.d.ts +0 -7
  262. package/dist/suggestion-popover/index.type.d.ts +0 -80
  263. package/dist/suggestion-popover/index.vue.d.ts +0 -262
  264. package/dist/theme-provider/constants.d.ts +0 -6
  265. package/dist/theme-provider/index.d.ts +0 -9
  266. package/dist/theme-provider/index.type.d.ts +0 -18
  267. package/dist/theme-provider/index.vue.d.ts +0 -32
  268. package/dist/theme-provider/useTheme.d.ts +0 -11
  269. package/dist/useTheme.js +0 -22
  270. package/dist/welcome/index.d.ts +0 -7
  271. package/dist/welcome/index.type.d.ts +0 -10
  272. package/dist/welcome/index.vue.d.ts +0 -18
@@ -1,24 +1,25 @@
1
- import { computed as k, ref as L, onUnmounted as ae, defineComponent as z, useModel as se, openBlock as o, createElementBlock as u, withModifiers as R, createElementVNode as v, createVNode as F, unref as m, Fragment as O, renderList as N, normalizeClass as T, mergeModels as j, h as ie, createCommentVNode as C, toDisplayString as U, createBlock as M, withCtx as oe, resolveDynamicComponent as Y, watch as le } from "vue";
2
- import { IconFileOther as ce, IconFileFolder as Z, IconFilePpt as G, IconFileExcel as J, IconFileWord as Q, IconFilePdf as X, IconFileImage as ee, IconClose as de, IconArrowLeft as ue, IconArrowRight as fe, IconFileRemove as me, IconUploadLoading as W, IconError as q } from "@opentiny/tiny-robot-svgs";
1
+ import { computed as x, ref as L, onUnmounted as re, defineComponent as z, useModel as se, openBlock as l, createElementBlock as f, withModifiers as R, createElementVNode as v, createVNode as F, unref as m, Fragment as O, renderList as N, normalizeClass as T, mergeModels as j, h as ie, createCommentVNode as k, toDisplayString as U, createBlock as M, withCtx as oe, resolveDynamicComponent as Y, onBeforeUnmount as le, watch as ce } from "vue";
2
+ import { IconFileOther as de, IconFileFolder as Z, IconFilePpt as G, IconFileExcel as J, IconFileWord as Q, IconFilePdf as X, IconFileImage as ee, IconClose as ue, IconArrowLeft as fe, IconArrowRight as me, IconFileRemove as pe, IconUploadLoading as W, IconError as q } from "@opentiny/tiny-robot-svgs";
3
3
  import { _ as V } from "../_plugin-vue_export-helper.js";
4
- import { TinyTooltip as pe } from "@opentiny/vue";
5
- const te = ["filename", "fileName"], ve = /^[a-zA-Z][a-zA-Z\d+.-]*:/, H = /^\/\//, E = (e) => {
4
+ import { TinyTooltip as ve } from "@opentiny/vue";
5
+ import { u as _e } from "../useSenderContentRegistration.js";
6
+ const te = ["filename", "fileName"], he = /^[a-zA-Z][a-zA-Z\d+.-]*:/, H = /^\/\//, E = (e) => {
6
7
  try {
7
8
  return decodeURIComponent(e);
8
9
  } catch {
9
10
  return e;
10
11
  }
11
- }, P = (e, r, n = !1) => {
12
- if (!r) return;
13
- const a = (n ? E(r) : r).trim();
14
- a && !e.includes(a) && e.push(a);
12
+ }, P = (e, a, t = !1) => {
13
+ if (!a) return;
14
+ const r = (t ? E(a) : a).trim();
15
+ r && !e.includes(r) && e.push(r);
15
16
  }, ne = (e) => {
16
- const r = e.trim();
17
- if (!r)
17
+ const a = e.trim();
18
+ if (!a)
18
19
  return null;
19
20
  try {
20
- if (ve.test(r) || H.test(r)) {
21
- const s = new URL(H.test(r) ? `https:${r}` : r);
21
+ if (he.test(a) || H.test(a)) {
22
+ const s = new URL(H.test(a) ? `https:${a}` : a);
22
23
  return {
23
24
  pathname: s.pathname,
24
25
  searchParams: s.searchParams
@@ -27,60 +28,60 @@ const te = ["filename", "fileName"], ve = /^[a-zA-Z][a-zA-Z\d+.-]*:/, H = /^\/\/
27
28
  } catch {
28
29
  return null;
29
30
  }
30
- const [n = ""] = r.split("#"), a = n.indexOf("?");
31
+ const [t = ""] = a.split("#"), r = t.indexOf("?");
31
32
  return {
32
- pathname: a === -1 ? n : n.slice(0, a),
33
- searchParams: new URLSearchParams(a === -1 ? "" : n.slice(a + 1))
33
+ pathname: r === -1 ? t : t.slice(0, r),
34
+ searchParams: new URLSearchParams(r === -1 ? "" : t.slice(r + 1))
34
35
  };
35
36
  }, S = (e) => {
36
- const n = e.split("/").filter(Boolean).at(-1) || "";
37
- return E(n);
38
- }, _e = (e) => {
39
- const r = [], n = e.trim();
40
- if (!n)
41
- return r;
42
- P(r, n);
43
- const a = ne(n);
44
- if (a)
37
+ const t = e.split("/").filter(Boolean).at(-1) || "";
38
+ return E(t);
39
+ }, ge = (e) => {
40
+ const a = [], t = e.trim();
41
+ if (!t)
42
+ return a;
43
+ P(a, t);
44
+ const r = ne(t);
45
+ if (r)
45
46
  return te.forEach((p) => {
46
- P(r, a.searchParams.get(p), !0);
47
- }), P(r, a.pathname, !0), P(r, S(a.pathname)), r;
48
- const s = n.split("#")[0].split("?")[0];
49
- return P(r, s), P(r, S(s)), r;
50
- }, he = (e) => {
51
- const r = ne(e);
52
- if (r) {
47
+ P(a, r.searchParams.get(p), !0);
48
+ }), P(a, r.pathname, !0), P(a, S(r.pathname)), a;
49
+ const s = t.split("#")[0].split("?")[0];
50
+ return P(a, s), P(a, S(s)), a;
51
+ }, ye = (e) => {
52
+ const a = ne(e);
53
+ if (a) {
53
54
  for (const p of te) {
54
- const _ = r.searchParams.get(p);
55
+ const _ = a.searchParams.get(p);
55
56
  if (_ != null && _.trim())
56
57
  return E(_.trim());
57
58
  }
58
- const a = S(r.pathname);
59
- if (a)
60
- return a;
61
- const s = E(r.pathname).replace(/^\/+/, "").trim();
59
+ const r = S(a.pathname);
60
+ if (r)
61
+ return r;
62
+ const s = E(a.pathname).replace(/^\/+/, "").trim();
62
63
  if (s)
63
64
  return s;
64
65
  }
65
- const n = e.trim().split("#")[0].split("?")[0];
66
- return S(n) || n;
67
- }, B = {
66
+ const t = e.trim().split("#")[0].split("?")[0];
67
+ return S(t) || t;
68
+ }, D = {
68
69
  image: ee,
69
70
  pdf: X,
70
71
  word: Q,
71
72
  excel: J,
72
73
  ppt: G,
73
74
  folder: Z,
74
- other: ce
75
+ other: de
75
76
  }, K = [
76
77
  {
77
78
  type: "image",
78
79
  matcher: (e) => {
79
- var n, a;
80
+ var t, r;
80
81
  if (typeof e != "string")
81
- return ((n = e.type) == null ? void 0 : n.startsWith("image/")) || !1;
82
- const r = ((a = e.split(".").pop()) == null ? void 0 : a.toLowerCase()) || "";
83
- return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(r);
82
+ return ((t = e.type) == null ? void 0 : t.startsWith("image/")) || !1;
83
+ const a = ((r = e.split(".").pop()) == null ? void 0 : r.toLowerCase()) || "";
84
+ return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(a);
84
85
  },
85
86
  icon: ee
86
87
  },
@@ -92,33 +93,33 @@ const te = ["filename", "fileName"], ve = /^[a-zA-Z][a-zA-Z\d+.-]*:/, H = /^\/\/
92
93
  {
93
94
  type: "word",
94
95
  matcher: (e) => {
95
- var n;
96
+ var t;
96
97
  if (typeof e != "string")
97
98
  return e.type === "application/msword" || e.type === "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
98
- const r = ((n = e.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
99
- return ["doc", "docx"].includes(r);
99
+ const a = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
100
+ return ["doc", "docx"].includes(a);
100
101
  },
101
102
  icon: Q
102
103
  },
103
104
  {
104
105
  type: "excel",
105
106
  matcher: (e) => {
106
- var n;
107
+ var t;
107
108
  if (typeof e != "string")
108
109
  return e.type === "application/vnd.ms-excel" || e.type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
109
- const r = ((n = e.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
110
- return ["xls", "xlsx"].includes(r);
110
+ const a = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
111
+ return ["xls", "xlsx"].includes(a);
111
112
  },
112
113
  icon: J
113
114
  },
114
115
  {
115
116
  type: "ppt",
116
117
  matcher: (e) => {
117
- var n;
118
+ var t;
118
119
  if (typeof e != "string")
119
120
  return e.type === "application/vnd.ms-powerpoint" || e.type === "application/vnd.openxmlformats-officedocument.presentationml.presentation";
120
- const r = ((n = e.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
121
- return ["ppt", "pptx"].includes(r);
121
+ const a = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
122
+ return ["ppt", "pptx"].includes(a);
122
123
  },
123
124
  icon: G
124
125
  },
@@ -128,86 +129,86 @@ const te = ["filename", "fileName"], ve = /^[a-zA-Z][a-zA-Z\d+.-]*:/, H = /^\/\/
128
129
  icon: Z
129
130
  }
130
131
  ];
131
- function re(e = {}) {
132
- const { customIcons: r, fileMatchers: n } = e, a = () => {
133
- let t = [];
134
- return n ? t = n.concat(K) : t = K, t;
135
- }, s = (t = "other") => k(() => {
136
- if (r != null && r[t])
137
- return r[t];
138
- const l = a().find((f) => f.type === t);
139
- return l != null && l.icon ? l.icon : B[t] ? B[t] : B.other;
140
- }), p = (t) => {
141
- const i = a(), l = typeof t == "string" ? _e(t) : [];
142
- for (const f of i)
143
- if (typeof t != "string" && f.matcher(t) || typeof t == "string" && l.some((x) => f.matcher(x)))
144
- return f.type;
132
+ function ae(e = {}) {
133
+ const { customIcons: a, fileMatchers: t } = e, r = () => {
134
+ let n = [];
135
+ return t ? n = t.concat(K) : n = K, n;
136
+ }, s = (n = "other") => x(() => {
137
+ if (a != null && a[n])
138
+ return a[n];
139
+ const i = r().find((o) => o.type === n);
140
+ return i != null && i.icon ? i.icon : D[n] ? D[n] : D.other;
141
+ }), p = (n) => {
142
+ const d = r(), i = typeof n == "string" ? ge(n) : [];
143
+ for (const o of d)
144
+ if (typeof n != "string" && o.matcher(n) || typeof n == "string" && i.some((C) => o.matcher(C)))
145
+ return o.type;
145
146
  return "other";
146
- }, _ = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), I = (t) => t < 1024 ? t + " B" : t < 1024 * 1024 ? (t / 1024).toFixed(2) + " KB" : (t / (1024 * 1024)).toFixed(2) + " MB", b = (t) => typeof t.url == "string" && !!t.url, w = (t) => t.rawFile instanceof File, d = (t) => t.reduce((i, l) => (w(l) ? i.push(h(l)) : b(l) && i.push(c(l)), i), []), g = (t) => ({
147
- id: t.id || _(),
148
- name: t.name || "",
149
- status: t.status || "success",
150
- message: t.message || ""
151
- }), c = (t) => {
152
- const i = g(t), l = t.url, f = he(l), x = i.name || f, y = p(x), $ = y === "other" ? p(l) : y;
147
+ }, _ = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), I = (n) => n < 1024 ? n + " B" : n < 1024 * 1024 ? (n / 1024).toFixed(2) + " KB" : (n / (1024 * 1024)).toFixed(2) + " MB", b = (n) => typeof n.url == "string" && !!n.url, w = (n) => n.rawFile instanceof File, u = (n) => n.reduce((d, i) => (w(i) ? d.push(h(i)) : b(i) && d.push(c(i)), d), []), g = (n) => ({
148
+ id: n.id || _(),
149
+ name: n.name || "",
150
+ status: n.status || "success",
151
+ message: n.message || ""
152
+ }), c = (n) => {
153
+ const d = g(n), i = n.url, o = ye(i), C = d.name || o, y = p(C), $ = y === "other" ? p(i) : y;
153
154
  return {
154
- ...i,
155
- name: x,
156
- fileType: t.fileType ?? $,
157
- size: t.size,
158
- url: l
155
+ ...d,
156
+ name: C,
157
+ fileType: n.fileType ?? $,
158
+ size: n.size,
159
+ url: i
159
160
  };
160
- }, h = (t) => {
161
- const i = g(t), l = t.rawFile;
161
+ }, h = (n) => {
162
+ const d = g(n), i = n.rawFile;
162
163
  return {
163
- ...i,
164
- name: i.name || l.name,
165
- fileType: t.fileType ?? p(l),
166
- rawFile: l,
167
- size: t.size ?? l.size,
168
- url: t.url
164
+ ...d,
165
+ name: d.name || i.name,
166
+ fileType: n.fileType ?? p(i),
167
+ rawFile: i,
168
+ size: n.size ?? i.size,
169
+ url: n.url
169
170
  };
170
171
  };
171
172
  return {
172
173
  detectFileType: p,
173
174
  generateID: _,
174
175
  formatFileSize: I,
175
- normalizeAttachments: d,
176
+ normalizeAttachments: u,
176
177
  getIconComponent: s
177
178
  };
178
179
  }
179
- const ge = (e, r) => {
180
+ const we = (e, a) => {
180
181
  if (e.startsWith("blob:") || e.startsWith("data:")) {
181
- const n = document.createElement("a");
182
- n.href = e, n.download = r, document.body.appendChild(n), requestAnimationFrame(() => {
183
- n.click(), document.body.removeChild(n), URL.revokeObjectURL(e);
182
+ const t = document.createElement("a");
183
+ t.href = e, t.download = a, document.body.appendChild(t), requestAnimationFrame(() => {
184
+ t.click(), document.body.removeChild(t), URL.revokeObjectURL(e);
184
185
  });
185
186
  }
186
187
  };
187
- function ye(e, r) {
188
- const n = L([]), a = k(() => e.file.fileType === "image"), s = (d) => {
189
- const g = URL.createObjectURL(d);
190
- return n.value.push(g), g;
191
- }, p = (d) => {
192
- r("preview", d, e.file);
193
- }, _ = (d) => {
194
- if (r("download", d, e.file), !d.defaultPrevented && e.file.rawFile && !e.file.url) {
188
+ function Ie(e, a) {
189
+ const t = L([]), r = x(() => e.file.fileType === "image"), s = (u) => {
190
+ const g = URL.createObjectURL(u);
191
+ return t.value.push(g), g;
192
+ }, p = (u) => {
193
+ a("preview", u, e.file);
194
+ }, _ = (u) => {
195
+ if (a("download", u, e.file), !u.defaultPrevented && e.file.rawFile && !e.file.url) {
195
196
  const g = s(e.file.rawFile);
196
- ge(g, e.file.name || e.file.rawFile.name);
197
+ we(g, e.file.name || e.file.rawFile.name);
197
198
  }
198
199
  }, I = () => {
199
- r("remove", e.file);
200
+ a("remove", e.file);
200
201
  }, b = () => {
201
- r("retry", e.file);
202
- }, w = (d, g) => {
203
- g.stopPropagation(), d.handler && d.handler(e.file), d.type === "preview" ? p(g) : d.type === "download" ? _(g) : r("action", { action: d, file: e.file });
202
+ a("retry", e.file);
203
+ }, w = (u, g) => {
204
+ g.stopPropagation(), u.handler && u.handler(e.file), u.type === "preview" ? p(g) : u.type === "download" ? _(g) : a("action", { action: u, file: e.file });
204
205
  };
205
- return ae(() => {
206
- n.value.forEach((d) => {
207
- URL.revokeObjectURL(d);
208
- }), n.value = [];
206
+ return re(() => {
207
+ t.value.forEach((u) => {
208
+ URL.revokeObjectURL(u);
209
+ }), t.value = [];
209
210
  }), {
210
- isImage: a,
211
+ isImage: r,
211
212
  handlePreview: p,
212
213
  downloadFile: _,
213
214
  handleRemove: I,
@@ -215,7 +216,7 @@ function ye(e, r) {
215
216
  handleCustomAction: w
216
217
  };
217
218
  }
218
- const we = { class: "tr-image-preview__main" }, Ie = ["disabled"], be = { class: "tr-image-preview__content" }, Ce = ["src", "alt"], ke = ["disabled"], xe = { class: "tr-image-preview__footer" }, Fe = { class: "tr-image-preview__thumbnails" }, Ue = ["onClick"], Pe = ["src", "alt"], Re = /* @__PURE__ */ z({
219
+ const be = { class: "tr-image-preview__main" }, Ce = ["disabled"], ke = { class: "tr-image-preview__content" }, xe = ["src", "alt"], Fe = ["disabled"], Ue = { class: "tr-image-preview__footer" }, Pe = { class: "tr-image-preview__thumbnails" }, Re = ["onClick"], Le = ["src", "alt"], Te = /* @__PURE__ */ z({
219
220
  __name: "ImagePreview",
220
221
  props: /* @__PURE__ */ j({
221
222
  images: {}
@@ -224,20 +225,20 @@ const we = { class: "tr-image-preview__main" }, Ie = ["disabled"], be = { class:
224
225
  currentIndexModifiers: {}
225
226
  }),
226
227
  emits: /* @__PURE__ */ j(["close"], ["update:currentIndex"]),
227
- setup(e, { emit: r }) {
228
- const n = e, a = r, s = se(e, "currentIndex"), p = k(() => n.images[s.value]), _ = () => {
228
+ setup(e, { emit: a }) {
229
+ const t = e, r = a, s = se(e, "currentIndex"), p = x(() => t.images[s.value]), _ = () => {
229
230
  s.value > 0 && s.value--;
230
231
  }, I = () => {
231
- s.value < n.images.length - 1 && s.value++;
232
- }, b = (d) => {
233
- s.value = d;
232
+ s.value < t.images.length - 1 && s.value++;
233
+ }, b = (u) => {
234
+ s.value = u;
234
235
  };
235
236
  function w() {
236
- a("close");
237
+ r("close");
237
238
  }
238
- return (d, g) => {
239
+ return (u, g) => {
239
240
  var c, h;
240
- return o(), u("div", {
241
+ return l(), f("div", {
241
242
  class: "tr-image-preview",
242
243
  onClick: R(w, ["self"])
243
244
  }, [
@@ -245,129 +246,129 @@ const we = { class: "tr-image-preview__main" }, Ie = ["disabled"], be = { class:
245
246
  class: "tr-image-preview__close",
246
247
  onClick: w
247
248
  }, [
248
- F(m(de))
249
+ F(m(ue))
249
250
  ]),
250
- v("div", we, [
251
+ v("div", be, [
251
252
  v("button", {
252
253
  class: "tr-image-preview__nav tr-image-preview__nav--left",
253
254
  onClick: R(_, ["stop"]),
254
255
  disabled: s.value === 0
255
256
  }, [
256
- F(m(ue))
257
- ], 8, Ie),
258
- v("div", be, [
257
+ F(m(fe))
258
+ ], 8, Ce),
259
+ v("div", ke, [
259
260
  v("img", {
260
261
  src: (c = p.value) == null ? void 0 : c.url,
261
262
  alt: (h = p.value) == null ? void 0 : h.name,
262
263
  class: "tr-image-preview__image"
263
- }, null, 8, Ce)
264
+ }, null, 8, xe)
264
265
  ]),
265
266
  v("button", {
266
267
  class: "tr-image-preview__nav tr-image-preview__nav--right",
267
268
  onClick: R(I, ["stop"]),
268
269
  disabled: s.value === e.images.length - 1
269
270
  }, [
270
- F(m(fe))
271
- ], 8, ke)
271
+ F(m(me))
272
+ ], 8, Fe)
272
273
  ]),
273
- v("div", xe, [
274
- v("div", Fe, [
275
- (o(!0), u(O, null, N(e.images, (t, i) => (o(), u("div", {
276
- key: t.id,
277
- class: T(["tr-image-preview__thumbnail", { "tr-image-preview__thumbnail--active": i === s.value }]),
278
- onClick: (l) => b(i)
274
+ v("div", Ue, [
275
+ v("div", Pe, [
276
+ (l(!0), f(O, null, N(e.images, (n, d) => (l(), f("div", {
277
+ key: n.id,
278
+ class: T(["tr-image-preview__thumbnail", { "tr-image-preview__thumbnail--active": d === s.value }]),
279
+ onClick: (i) => b(d)
279
280
  }, [
280
281
  v("img", {
281
- src: t.url,
282
- alt: t.name
283
- }, null, 8, Pe)
284
- ], 10, Ue))), 128))
282
+ src: n.url,
283
+ alt: n.name
284
+ }, null, 8, Le)
285
+ ], 10, Re))), 128))
285
286
  ])
286
287
  ])
287
288
  ]);
288
289
  };
289
290
  }
290
- }), Le = /* @__PURE__ */ V(Re, [["__scopeId", "data-v-027af77c"]]);
291
- function Te(e, r, n = {}) {
292
- const a = L(!1), s = L([]), p = L(0), _ = (c) => {
291
+ }), Me = /* @__PURE__ */ V(Te, [["__scopeId", "data-v-027af77c"]]);
292
+ function Ee(e, a, t = {}) {
293
+ const r = L(!1), s = L([]), p = L(0), _ = (c) => {
293
294
  p.value = c;
294
295
  }, I = (c) => {
295
- const h = e.value.findIndex((t) => t.id === c.id);
296
+ const h = e.value.findIndex((n) => n.id === c.id);
296
297
  if (h !== -1 && c.url && e.value.splice(h, 1, c), c.fileType === "image") {
297
298
  s.value = e.value.filter(
298
- (i) => i.fileType === "image" && i.status !== "error" && i.status !== "uploading"
299
+ (d) => d.fileType === "image" && d.status !== "error" && d.status !== "uploading"
299
300
  );
300
- const t = s.value.findIndex((i) => i.id === c.id);
301
- t !== -1 && (p.value = t, a.value = !0);
301
+ const n = s.value.findIndex((d) => d.id === c.id);
302
+ n !== -1 && (p.value = n, r.value = !0);
302
303
  }
303
304
  }, b = (c, h) => {
304
- r("preview", c, h), !c.defaultPrevented && I(h);
305
+ a("preview", c, h), !c.defaultPrevented && I(h);
305
306
  }, w = () => {
306
- a.value = !1;
307
- }, d = (c, h) => {
308
- n.onDownload ? n.onDownload(c, h) : r("download", c, h);
307
+ r.value = !1;
308
+ }, u = (c, h) => {
309
+ t.onDownload ? t.onDownload(c, h) : a("download", c, h);
309
310
  };
310
311
  return {
311
312
  // 显示预览
312
313
  handlePreview: b,
313
314
  // 渲染预览组件
314
- renderPreview: () => a.value ? ie(Le, {
315
+ renderPreview: () => r.value ? ie(Me, {
315
316
  images: s.value,
316
317
  currentIndex: p.value,
317
318
  "onUpdate:currentIndex": _,
318
319
  onClose: w,
319
- onDownload: d
320
+ onDownload: u
320
321
  }) : null
321
322
  };
322
323
  }
323
- function Me(e, r) {
324
+ function Se(e, a) {
324
325
  return {
325
- actualListType: k(() => r && r !== "auto" ? r : e.value.length === 0 ? "card" : e.value.every((s) => s.fileType === "image") ? "picture" : "card")
326
+ actualListType: x(() => a && a !== "auto" ? a : e.value.length === 0 ? "card" : e.value.every((s) => s.fileType === "image") ? "picture" : "card")
326
327
  };
327
328
  }
328
- const Ee = ["data-file-type"], Se = {
329
+ const Ae = ["data-file-type"], $e = {
329
330
  key: 1,
330
331
  class: "tr-file-card__picture-container"
331
- }, Ae = ["src", "alt"], $e = {
332
+ }, Be = ["src", "alt"], De = {
332
333
  key: 0,
333
334
  class: "tr-file-card__picture-overlay"
334
- }, De = {
335
+ }, ze = {
335
336
  key: 1,
336
337
  class: "tr-file-card__status-overlay tr-file-card__status-overlay--picture"
337
- }, Be = {
338
+ }, Oe = {
338
339
  key: 0,
339
340
  class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
340
- }, ze = {
341
+ }, Ne = {
341
342
  key: 0,
342
343
  class: "tr-file-card__status-icon--loading-text"
343
- }, Oe = {
344
+ }, Ve = {
344
345
  key: 2,
345
346
  class: "tr-file-card__default-container"
346
- }, Ne = { class: "tr-file-card__icon-wrapper" }, Ve = {
347
+ }, je = { class: "tr-file-card__icon-wrapper" }, We = {
347
348
  key: 0,
348
349
  class: "tr-file-card__status-overlay tr-file-card__status-overlay--icon"
349
- }, je = {
350
+ }, qe = {
350
351
  key: 0,
351
352
  class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
352
- }, We = { class: "tr-file-card__content" }, qe = { class: "tr-file-card__info" }, He = ["title"], Ke = {
353
+ }, He = { class: "tr-file-card__content" }, Ke = { class: "tr-file-card__info" }, Ye = ["title"], Ze = {
353
354
  key: 0,
354
355
  class: "tr-file-card__status"
355
- }, Ye = {
356
+ }, Ge = {
356
357
  key: 0,
357
358
  class: "tr-file-card__status-success"
358
- }, Ze = { class: "tr-file-card__status-info" }, Ge = { class: "tr-file-card__file-type" }, Je = {
359
+ }, Je = { class: "tr-file-card__status-info" }, Qe = { class: "tr-file-card__file-type" }, Xe = {
359
360
  key: 0,
360
361
  class: "tr-file-card__file-size"
361
- }, Qe = {
362
+ }, et = {
362
363
  key: 0,
363
364
  class: "tr-file-card__actions"
364
- }, Xe = ["href", "target", "onClick"], et = ["onClick"], tt = {
365
+ }, tt = ["href", "target", "onClick"], nt = ["onClick"], at = {
365
366
  key: 1,
366
367
  class: "tr-file-card__status-uploading"
367
- }, nt = {
368
+ }, rt = {
368
369
  key: 2,
369
370
  class: "tr-file-card__status-error"
370
- }, rt = /* @__PURE__ */ z({
371
+ }, st = /* @__PURE__ */ z({
371
372
  __name: "FileCard",
372
373
  props: {
373
374
  file: {},
@@ -379,52 +380,52 @@ const Ee = ["data-file-type"], Se = {
379
380
  fileMatchers: {}
380
381
  },
381
382
  emits: ["remove", "preview", "action", "retry", "download"],
382
- setup(e, { emit: r }) {
383
- const n = e, a = r, { formatFileSize: s, getIconComponent: p } = re({
384
- customIcons: n.fileIcons,
385
- fileMatchers: n.fileMatchers
386
- }), { isImage: _, handlePreview: I, handleRemove: b, handleCustomAction: w, handleRetry: d } = ye(n, a), g = k(() => p(n.file.fileType).value), c = k(() => n.file.status === "uploading"), h = k(() => n.file.status === "success"), t = k(() => n.file.status === "error"), i = k(() => [
387
- n.variant === "picture" ? "tr-file-card--picture" : "tr-file-card",
388
- `tr-file-card--${n.file.fileType || "other"}`,
383
+ setup(e, { emit: a }) {
384
+ const t = e, r = a, { formatFileSize: s, getIconComponent: p } = ae({
385
+ customIcons: t.fileIcons,
386
+ fileMatchers: t.fileMatchers
387
+ }), { isImage: _, handlePreview: I, handleRemove: b, handleCustomAction: w, handleRetry: u } = Ie(t, r), g = x(() => p(t.file.fileType).value), c = x(() => t.file.status === "uploading"), h = x(() => t.file.status === "success"), n = x(() => t.file.status === "error"), d = x(() => [
388
+ t.variant === "picture" ? "tr-file-card--picture" : "tr-file-card",
389
+ `tr-file-card--${t.file.fileType || "other"}`,
389
390
  {
390
391
  "tr-file-card--uploading": c.value,
391
- "tr-file-card--error": t.value,
392
+ "tr-file-card--error": n.value,
392
393
  "tr-file-card--success": h.value
393
394
  }
394
395
  ]);
395
- return (l, f) => {
396
- var x;
397
- return o(), u("div", {
398
- class: T(i.value),
396
+ return (i, o) => {
397
+ var C;
398
+ return l(), f("div", {
399
+ class: T(d.value),
399
400
  "data-file-type": e.file.fileType || "other",
400
- onClick: f[3] || (f[3] = (y) => e.variant === "picture" ? m(I)(y) : void 0)
401
+ onClick: o[3] || (o[3] = (y) => e.variant === "picture" ? m(I)(y) : void 0)
401
402
  }, [
402
- e.disabled ? C("", !0) : (o(), u("button", {
403
+ e.disabled ? k("", !0) : (l(), f("button", {
403
404
  key: 0,
404
405
  class: "tr-file-card__close-btn",
405
- onClick: f[0] || (f[0] = R(
406
+ onClick: o[0] || (o[0] = R(
406
407
  //@ts-ignore
407
408
  (...y) => m(b) && m(b)(...y),
408
409
  ["stop"]
409
410
  )),
410
411
  "aria-label": "移除文件"
411
412
  }, [
412
- F(m(me))
413
+ F(m(pe))
413
414
  ])),
414
- e.variant === "picture" ? (o(), u("div", Se, [
415
+ e.variant === "picture" ? (l(), f("div", $e, [
415
416
  v("img", {
416
417
  src: e.file.url,
417
418
  alt: e.file.name,
418
419
  class: "tr-file-card__picture-img"
419
- }, null, 8, Ae),
420
- h.value ? (o(), u("div", $e, [...f[4] || (f[4] = [
420
+ }, null, 8, Be),
421
+ h.value ? (l(), f("div", De, [...o[4] || (o[4] = [
421
422
  v("span", { class: "tr-file-card__picture-overlay-text" }, "预览", -1)
422
- ])])) : C("", !0),
423
- c.value || t.value ? (o(), u("div", De, [
424
- c.value ? (o(), u("div", Be, [
423
+ ])])) : k("", !0),
424
+ c.value || n.value ? (l(), f("div", ze, [
425
+ c.value ? (l(), f("div", Oe, [
425
426
  F(m(W)),
426
- e.file.message ? (o(), u("span", ze, U(e.file.message), 1)) : C("", !0)
427
- ])) : t.value ? (o(), M(m(pe), {
427
+ e.file.message ? (l(), f("span", Ne, U(e.file.message), 1)) : k("", !0)
428
+ ])) : n.value ? (l(), M(m(ve), {
428
429
  key: 1,
429
430
  content: "解析失败",
430
431
  placement: "top",
@@ -434,73 +435,73 @@ const Ee = ["data-file-type"], Se = {
434
435
  F(m(q), { class: "tr-file-card__status-icon tr-file-card__status-icon--error" })
435
436
  ]),
436
437
  _: 1
437
- })) : C("", !0)
438
- ])) : C("", !0)
439
- ])) : (o(), u("div", Oe, [
438
+ })) : k("", !0)
439
+ ])) : k("", !0)
440
+ ])) : (l(), f("div", Ve, [
440
441
  v("div", {
441
442
  class: T(["tr-file-card__icon", { "tr-file-card__icon--clickable": m(_) }]),
442
- onClick: f[1] || (f[1] = R((y) => m(_) ? m(I)(y) : null, ["stop"]))
443
+ onClick: o[1] || (o[1] = R((y) => m(_) ? m(I)(y) : null, ["stop"]))
443
444
  }, [
444
- v("div", Ne, [
445
- (o(), M(Y(g.value), { class: "tr-file-card__file-icon" })),
446
- c.value || t.value ? (o(), u("div", Ve, [
447
- c.value ? (o(), u("div", je, [
445
+ v("div", je, [
446
+ (l(), M(Y(g.value), { class: "tr-file-card__file-icon" })),
447
+ c.value || n.value ? (l(), f("div", We, [
448
+ c.value ? (l(), f("div", qe, [
448
449
  F(m(W))
449
- ])) : t.value ? (o(), M(m(q), {
450
+ ])) : n.value ? (l(), M(m(q), {
450
451
  key: 1,
451
452
  class: "tr-file-card__status-icon tr-file-card__status-icon--error"
452
- })) : C("", !0)
453
- ])) : C("", !0)
453
+ })) : k("", !0)
454
+ ])) : k("", !0)
454
455
  ])
455
456
  ], 2),
456
- v("div", We, [
457
- v("div", qe, [
457
+ v("div", He, [
458
+ v("div", Ke, [
458
459
  v("div", {
459
460
  class: "tr-file-card__name",
460
461
  title: e.file.name
461
- }, U(e.file.name), 9, He),
462
- e.showStatus ? (o(), u("div", Ke, [
463
- h.value ? (o(), u("div", Ye, [
464
- v("div", Ze, [
465
- v("span", Ge, U(((x = e.file.fileType) == null ? void 0 : x.toUpperCase()) || "FILE"), 1),
466
- e.file.size ? (o(), u("span", Je, U(m(s)(e.file.size)), 1)) : C("", !0)
462
+ }, U(e.file.name), 9, Ye),
463
+ e.showStatus ? (l(), f("div", Ze, [
464
+ h.value ? (l(), f("div", Ge, [
465
+ v("div", Je, [
466
+ v("span", Qe, U(((C = e.file.fileType) == null ? void 0 : C.toUpperCase()) || "FILE"), 1),
467
+ e.file.size ? (l(), f("span", Xe, U(m(s)(e.file.size)), 1)) : k("", !0)
467
468
  ]),
468
- e.actions ? (o(), u("div", Qe, [
469
- (o(!0), u(O, null, N(e.actions, (y, $) => (o(), u("div", {
469
+ e.actions ? (l(), f("div", et, [
470
+ (l(!0), f(O, null, N(e.actions, (y, $) => (l(), f("div", {
470
471
  key: $,
471
472
  class: "tr-file-card__action-btn"
472
473
  }, [
473
- y.type === "download" ? (o(), u("a", {
474
+ y.type === "download" ? (l(), f("a", {
474
475
  key: 0,
475
476
  class: "tr-file-card__action-btn--download",
476
477
  href: e.file.url ?? "javascript:void(0)",
477
478
  target: e.file.url ? "_blank" : "_self",
478
- onClick: (D) => m(w)(y, D)
479
- }, U(y.label), 9, Xe)) : (o(), u("button", {
479
+ onClick: (B) => m(w)(y, B)
480
+ }, U(y.label), 9, tt)) : (l(), f("button", {
480
481
  key: 1,
481
482
  class: T(`tr-file-card__action-btn--${y.type}`),
482
- onClick: (D) => m(w)(y, D)
483
- }, U(y.label), 11, et))
483
+ onClick: (B) => m(w)(y, B)
484
+ }, U(y.label), 11, nt))
484
485
  ]))), 128))
485
- ])) : C("", !0)
486
- ])) : c.value ? (o(), u("div", tt, [...f[5] || (f[5] = [
486
+ ])) : k("", !0)
487
+ ])) : c.value ? (l(), f("div", at, [...o[5] || (o[5] = [
487
488
  v("span", { class: "tr-file-card__uploading-text" }, "上传中...", -1)
488
- ])])) : t.value ? (o(), u("div", nt, [
489
- f[6] || (f[6] = v("span", { class: "tr-file-card__error-text" }, "上传失败", -1)),
489
+ ])])) : n.value ? (l(), f("div", rt, [
490
+ o[6] || (o[6] = v("span", { class: "tr-file-card__error-text" }, "上传失败", -1)),
490
491
  v("button", {
491
492
  class: "tr-file-card__retry-btn",
492
- onClick: f[2] || (f[2] = //@ts-ignore
493
- (...y) => m(d) && m(d)(...y))
493
+ onClick: o[2] || (o[2] = //@ts-ignore
494
+ (...y) => m(u) && m(u)(...y))
494
495
  }, "重试")
495
- ])) : C("", !0)
496
- ])) : C("", !0)
496
+ ])) : k("", !0)
497
+ ])) : k("", !0)
497
498
  ])
498
499
  ])
499
500
  ]))
500
- ], 10, Ee);
501
+ ], 10, Ae);
501
502
  };
502
503
  }
503
- }), at = /* @__PURE__ */ V(rt, [["__scopeId", "data-v-1772c0c6"]]), st = { class: "tr-attachments" }, it = /* @__PURE__ */ z({
504
+ }), it = /* @__PURE__ */ V(st, [["__scopeId", "data-v-1772c0c6"]]), ot = { class: "tr-attachments" }, lt = /* @__PURE__ */ z({
504
505
  __name: "index",
505
506
  props: {
506
507
  items: {},
@@ -521,41 +522,43 @@ const Ee = ["data-file-type"], Se = {
521
522
  fileMatchers: { default: () => [] }
522
523
  },
523
524
  emits: ["update:items", "remove", "download", "retry", "preview", "action"],
524
- setup(e, { emit: r }) {
525
- const n = e, a = r, s = L(n.items || []), { actualListType: p } = Me(s, n.variant), { handlePreview: _, renderPreview: I } = Te(s, a, { enableDownload: !0 });
526
- function b(t) {
527
- if (n.disabled) return;
528
- const i = s.value.findIndex((l) => l.id === t.id);
529
- i !== -1 && (s.value.splice(i, 1), a("remove", t), a("update:items", s.value));
525
+ setup(e, { emit: a }) {
526
+ const t = e, r = a, s = L(t.items || []), { actualListType: p } = Se(s, t.variant), { handlePreview: _, renderPreview: I } = Ee(s, r, { enableDownload: !0 });
527
+ function b(i) {
528
+ if (t.disabled) return;
529
+ const o = s.value.findIndex((C) => C.id === i.id);
530
+ o !== -1 && (s.value.splice(o, 1), r("remove", i), r("update:items", s.value));
530
531
  }
531
- function w(t, i) {
532
- a("download", t, i);
532
+ function w(i, o) {
533
+ r("download", i, o);
533
534
  }
534
- function d(t) {
535
- a("retry", t);
535
+ function u(i) {
536
+ r("retry", i);
536
537
  }
537
- function g(t) {
538
- a("action", t);
538
+ function g(i) {
539
+ r("action", i);
539
540
  }
540
- const c = k(() => n.wrap ? "wrap" : "no-wrap"), { normalizeAttachments: h } = re({
541
- fileMatchers: n.fileMatchers
542
- });
543
- return le(
544
- () => n.items,
545
- (t) => {
546
- s.value = h(t || []);
541
+ const c = x(() => t.wrap ? "wrap" : "no-wrap"), { normalizeAttachments: h } = ae({
542
+ fileMatchers: t.fileMatchers
543
+ }), n = _e(), d = n == null ? void 0 : n("attachments", s);
544
+ return le(() => {
545
+ d == null || d();
546
+ }), ce(
547
+ () => t.items,
548
+ (i) => {
549
+ s.value = h(i || []);
547
550
  },
548
551
  { deep: !0, immediate: !0 }
549
- ), (t, i) => (o(), u("div", st, [
550
- s.value.length > 0 ? (o(), u("div", {
552
+ ), (i, o) => (l(), f("div", ot, [
553
+ s.value.length > 0 ? (l(), f("div", {
551
554
  key: 0,
552
555
  class: T(["tr-attachments__file-list", c.value]),
553
- onClick: i[0] || (i[0] = R(() => {
556
+ onClick: o[0] || (o[0] = R(() => {
554
557
  }, ["stop"]))
555
558
  }, [
556
- (o(!0), u(O, null, N(s.value, (l) => (o(), M(at, {
557
- key: l.id,
558
- file: l,
559
+ (l(!0), f(O, null, N(s.value, (C) => (l(), M(it, {
560
+ key: C.id,
561
+ file: C,
559
562
  variant: m(p),
560
563
  "file-icons": e.fileIcons,
561
564
  disabled: e.disabled,
@@ -565,19 +568,19 @@ const Ee = ["data-file-type"], Se = {
565
568
  onRemove: b,
566
569
  onPreview: m(_),
567
570
  onDownload: w,
568
- onRetry: d,
571
+ onRetry: u,
569
572
  onAction: g
570
573
  }, null, 8, ["file", "variant", "file-icons", "disabled", "actions", "file-matchers", "onPreview"]))), 128))
571
- ], 2)) : C("", !0),
572
- (o(), M(Y(m(I)())))
574
+ ], 2)) : k("", !0),
575
+ (l(), M(Y(m(I)())))
573
576
  ]));
574
577
  }
575
- }), A = /* @__PURE__ */ V(it, [["__scopeId", "data-v-935ed86d"]]);
578
+ }), A = /* @__PURE__ */ V(lt, [["__scopeId", "data-v-1274039a"]]);
576
579
  A.name = "TrAttachments";
577
- const ot = function(e) {
580
+ const ct = function(e) {
578
581
  e.component(A.name, A);
579
582
  };
580
- A.install = ot;
583
+ A.install = ct;
581
584
  export {
582
585
  A as default
583
586
  };