@scalar/agent-chat 0.2.3 → 0.2.6

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 (270) hide show
  1. package/LICENSE +21 -0
  2. package/dist/App.vue.d.ts +3 -2
  3. package/dist/App.vue.d.ts.map +1 -1
  4. package/dist/App.vue.js +32 -0
  5. package/dist/App.vue2.js +4 -0
  6. package/dist/Chat.vue.d.ts.map +1 -1
  7. package/dist/Chat.vue.js +23 -0
  8. package/dist/Chat.vue2.js +4 -0
  9. package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
  10. package/dist/api.d.ts +50 -0
  11. package/dist/api.d.ts.map +1 -0
  12. package/dist/api.js +68 -0
  13. package/dist/components/ApprovalSection.vue.d.ts.map +1 -1
  14. package/dist/components/ApprovalSection.vue.js +7 -0
  15. package/dist/components/ApprovalSection.vue2.js +42 -0
  16. package/dist/components/AuthenticationProvided.vue.d.ts +3 -0
  17. package/dist/components/AuthenticationProvided.vue.d.ts.map +1 -0
  18. package/dist/components/AuthenticationProvided.vue.js +13 -0
  19. package/dist/components/AuthenticationRequired.vue.d.ts +3 -0
  20. package/dist/components/AuthenticationRequired.vue.d.ts.map +1 -0
  21. package/dist/components/AuthenticationRequired.vue.js +13 -0
  22. package/dist/components/AutosendPaused.vue.d.ts.map +1 -1
  23. package/dist/components/AutosendPaused.vue.js +13 -0
  24. package/dist/components/ContextItem.vue.d.ts.map +1 -1
  25. package/dist/components/ContextItem.vue.js +7 -0
  26. package/dist/components/ContextItem.vue2.js +19 -0
  27. package/dist/components/ErrorMessage.vue.d.ts +2 -1
  28. package/dist/components/ErrorMessage.vue.d.ts.map +1 -1
  29. package/dist/components/ErrorMessage.vue.js +7 -0
  30. package/dist/components/ErrorMessage.vue2.js +22 -0
  31. package/dist/components/LoadingMiniOpenAPIDoc.vue.d.ts.map +1 -1
  32. package/dist/components/LoadingMiniOpenAPIDoc.vue.js +14 -0
  33. package/dist/components/LoadingOpenAPISpecsSummary.vue.d.ts.map +1 -1
  34. package/dist/components/LoadingOpenAPISpecsSummary.vue.js +14 -0
  35. package/dist/components/Logo.vue.d.ts.map +1 -1
  36. package/dist/components/Logo.vue.js +23 -0
  37. package/dist/components/PaymentSection.vue.d.ts.map +1 -1
  38. package/dist/components/PaymentSection.vue.js +7 -0
  39. package/dist/components/PaymentSection.vue2.js +34 -0
  40. package/dist/components/RequestApproved.vue.d.ts.map +1 -1
  41. package/dist/components/RequestApproved.vue.js +13 -0
  42. package/dist/components/RequestFailed.vue.d.ts.map +1 -1
  43. package/dist/components/RequestFailed.vue.js +24 -0
  44. package/dist/components/RequestPreview.vue.d.ts +1 -1
  45. package/dist/components/RequestPreview.vue.d.ts.map +1 -1
  46. package/dist/components/RequestPreview.vue.js +7 -0
  47. package/dist/components/RequestPreview.vue2.js +123 -0
  48. package/dist/components/RequestRejected.vue.d.ts.map +1 -1
  49. package/dist/components/RequestRejected.vue.js +22 -0
  50. package/dist/components/RequestSuccess.vue.d.ts.map +1 -1
  51. package/dist/components/RequestSuccess.vue.js +13 -0
  52. package/dist/components/ResponseBody/ResponseBody.vue.d.ts +1 -1
  53. package/dist/components/ResponseBody/ResponseBody.vue.d.ts.map +1 -1
  54. package/dist/components/ResponseBody/ResponseBody.vue.js +41 -0
  55. package/dist/components/ResponseBody/ResponseBody.vue2.js +4 -0
  56. package/dist/components/ResponseBody/ResponseBodyInfo.vue.d.ts.map +1 -1
  57. package/dist/components/ResponseBody/ResponseBodyInfo.vue.js +14 -0
  58. package/dist/components/ResponseBody/ResponseBodyPreview.vue.d.ts +1 -1
  59. package/dist/components/ResponseBody/ResponseBodyPreview.vue.d.ts.map +1 -1
  60. package/dist/components/ResponseBody/ResponseBodyPreview.vue.js +7 -0
  61. package/dist/components/ResponseBody/ResponseBodyPreview.vue2.js +65 -0
  62. package/dist/components/ResponseBody/ResponseBodyRaw.vue.d.ts.map +1 -1
  63. package/dist/components/ResponseBody/ResponseBodyRaw.vue.js +20 -0
  64. package/dist/components/ResponseBody/ResponseBodyRaw.vue2.js +4 -0
  65. package/dist/components/ResponseBody/ResponseBodyToggle.vue.d.ts +2 -2
  66. package/dist/components/ResponseBody/ResponseBodyToggle.vue.d.ts.map +1 -1
  67. package/dist/components/ResponseBody/ResponseBodyToggle.vue.js +26 -0
  68. package/dist/components/ResponseBody/ResponseBodyToggle.vue2.js +4 -0
  69. package/dist/components/ResponseBody/helpers/media-types.js +130 -0
  70. package/dist/components/ResponseBody/helpers/process-response-body.d.ts +1 -1
  71. package/dist/components/ResponseBody/helpers/process-response-body.d.ts.map +1 -1
  72. package/dist/components/ResponseBody/helpers/process-response-body.js +33 -0
  73. package/dist/components/SearchPopover.vue.d.ts +2 -2
  74. package/dist/components/SearchPopover.vue.d.ts.map +1 -1
  75. package/dist/components/SearchPopover.vue.js +7 -0
  76. package/dist/components/SearchPopover.vue2.js +67 -0
  77. package/dist/components/Selector.vue.d.ts +24 -0
  78. package/dist/components/Selector.vue.d.ts.map +1 -0
  79. package/dist/components/Selector.vue.js +67 -0
  80. package/dist/components/Selector.vue2.js +4 -0
  81. package/dist/components/SendingRequest.vue.d.ts.map +1 -1
  82. package/dist/components/SendingRequest.vue.js +24 -0
  83. package/dist/components/ServerSelector.vue.d.ts +22 -0
  84. package/dist/components/ServerSelector.vue.d.ts.map +1 -0
  85. package/dist/components/ServerSelector.vue.js +57 -0
  86. package/dist/components/ServerSelector.vue2.js +4 -0
  87. package/dist/components/Suggestion.vue.d.ts.map +1 -1
  88. package/dist/components/TestRequestButton.vue.d.ts.map +1 -1
  89. package/dist/components/{Endpoint.vue.d.ts → UploadSection.vue.d.ts} +3 -5
  90. package/dist/components/UploadSection.vue.d.ts.map +1 -0
  91. package/dist/components/UploadSection.vue.js +7 -0
  92. package/dist/components/UploadSection.vue2.js +62 -0
  93. package/dist/entities/prompt/constants.d.ts +2 -0
  94. package/dist/entities/prompt/constants.d.ts.map +1 -0
  95. package/dist/entities/prompt/constants.js +4 -0
  96. package/dist/entities/registry/document.d.ts +21 -0
  97. package/dist/entities/registry/document.d.ts.map +1 -0
  98. package/dist/entities/registry/document.js +12 -0
  99. package/dist/entities/tools/ask-for-authentication.d.ts +7 -0
  100. package/dist/entities/tools/ask-for-authentication.d.ts.map +1 -0
  101. package/dist/entities/tools/ask-for-authentication.js +8 -0
  102. package/dist/entities/tools/constants.d.ts +2 -0
  103. package/dist/entities/tools/constants.d.ts.map +1 -0
  104. package/dist/entities/tools/constants.js +4 -0
  105. package/dist/entities/tools/execute-request.d.ts +42 -0
  106. package/dist/entities/tools/execute-request.d.ts.map +1 -0
  107. package/dist/entities/tools/execute-request.js +11 -0
  108. package/dist/entities/tools/get-mini-openapi-spec.d.ts +12 -0
  109. package/dist/entities/tools/get-mini-openapi-spec.d.ts.map +1 -0
  110. package/dist/entities/tools/get-mini-openapi-spec.js +8 -0
  111. package/dist/entities/tools/get-openapi-spec-summary.d.ts +10 -0
  112. package/dist/entities/tools/get-openapi-spec-summary.d.ts.map +1 -0
  113. package/dist/entities/tools/get-openapi-spec-summary.js +4 -0
  114. package/dist/helpers.d.ts +20 -12
  115. package/dist/helpers.d.ts.map +1 -1
  116. package/dist/helpers.js +122 -0
  117. package/dist/hooks/{useChatApprovals.d.ts → use-chat-approvals.d.ts} +1 -1
  118. package/dist/hooks/use-chat-approvals.d.ts.map +1 -0
  119. package/dist/hooks/use-chat-approvals.js +21 -0
  120. package/dist/hooks/use-chat-error.d.ts +14 -0
  121. package/dist/hooks/use-chat-error.d.ts.map +1 -0
  122. package/dist/hooks/use-chat-error.js +23 -0
  123. package/dist/hooks/use-chat-pending-client-tool-parts.d.ts +19 -0
  124. package/dist/hooks/use-chat-pending-client-tool-parts.d.ts.map +1 -0
  125. package/dist/hooks/use-chat-pending-client-tool-parts.js +12 -0
  126. package/dist/hooks/{useChatScroll.d.ts → use-chat-scroll.d.ts} +1 -1
  127. package/dist/hooks/use-chat-scroll.d.ts.map +1 -0
  128. package/dist/hooks/use-chat-scroll.js +16 -0
  129. package/dist/hooks/{useSearch.d.ts → use-search.d.ts} +11 -11
  130. package/dist/hooks/use-search.d.ts.map +1 -0
  131. package/dist/hooks/use-search.js +25 -0
  132. package/dist/hooks/use-term-and-conditions.d.ts +6 -0
  133. package/dist/hooks/use-term-and-conditions.d.ts.map +1 -0
  134. package/dist/hooks/use-term-and-conditions.js +16 -0
  135. package/dist/hooks/use-upload-tmp-document.d.ts +19 -0
  136. package/dist/hooks/use-upload-tmp-document.d.ts.map +1 -0
  137. package/dist/hooks/use-upload-tmp-document.js +64 -0
  138. package/dist/index.d.ts +2 -1
  139. package/dist/index.d.ts.map +1 -1
  140. package/dist/index.js +2 -1
  141. package/dist/package.json +34 -23
  142. package/dist/registry/add-documents-to-store.d.ts +6 -6
  143. package/dist/registry/add-documents-to-store.d.ts.map +1 -1
  144. package/dist/registry/add-documents-to-store.js +40 -0
  145. package/dist/registry/create-document-name.d.ts +2 -0
  146. package/dist/registry/create-document-name.d.ts.map +1 -0
  147. package/dist/registry/create-document-name.js +6 -0
  148. package/dist/state/state.d.ts +20 -8
  149. package/dist/state/state.d.ts.map +1 -1
  150. package/dist/state/state.js +110 -0
  151. package/dist/style.css +1 -1
  152. package/dist/types.d.ts +2 -0
  153. package/dist/types.d.ts.map +1 -0
  154. package/dist/views/Chat/Chat.vue.d.ts.map +1 -1
  155. package/dist/views/Chat/Chat.vue.js +7 -0
  156. package/dist/views/Chat/Chat.vue2.js +77 -0
  157. package/dist/views/Chat/Messages/AskForAuthentication.vue.d.ts +10 -0
  158. package/dist/views/Chat/Messages/AskForAuthentication.vue.d.ts.map +1 -0
  159. package/dist/views/Chat/Messages/AskForAuthentication.vue.js +7 -0
  160. package/dist/views/Chat/Messages/AskForAuthentication.vue2.js +93 -0
  161. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts +2 -2
  162. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts.map +1 -1
  163. package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js +7 -0
  164. package/dist/views/Chat/Messages/ExecuteRequestTool.vue2.js +23 -0
  165. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.d.ts +2 -2
  166. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.d.ts.map +1 -1
  167. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.js +7 -0
  168. package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue2.js +56 -0
  169. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.d.ts +2 -2
  170. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.d.ts.map +1 -1
  171. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.js +26 -0
  172. package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue2.js +4 -0
  173. package/dist/views/Chat/Messages/Text.vue.d.ts.map +1 -1
  174. package/dist/views/Chat/Messages/Text.vue.js +16 -0
  175. package/dist/views/Chat/Messages/Text.vue2.js +4 -0
  176. package/dist/views/Layout.vue.d.ts.map +1 -1
  177. package/dist/views/Layout.vue.js +7 -0
  178. package/dist/views/Layout.vue2.js +23 -0
  179. package/dist/views/PromptForm.vue.d.ts.map +1 -1
  180. package/dist/views/PromptForm.vue.js +7 -0
  181. package/dist/views/PromptForm.vue2.js +212 -0
  182. package/dist/views/Settings/Auth.vue.d.ts.map +1 -1
  183. package/dist/views/Settings/Auth.vue.js +67 -0
  184. package/dist/views/Settings/Auth.vue2.js +4 -0
  185. package/dist/views/Settings/DocSettings.vue.d.ts.map +1 -1
  186. package/dist/views/Settings/DocSettings.vue.js +7 -0
  187. package/dist/views/Settings/DocSettings.vue2.js +48 -0
  188. package/dist/views/Settings/Settings.vue.d.ts.map +1 -1
  189. package/dist/views/Settings/Settings.vue.js +8 -0
  190. package/dist/views/Settings/Settings.vue2.js +67 -0
  191. package/dist/views/Start.vue.d.ts.map +1 -1
  192. package/dist/views/Start.vue.js +7 -0
  193. package/dist/views/Start.vue2.js +41 -0
  194. package/package.json +52 -7
  195. package/dist/Tooltip-Cm82QgNj.js +0 -575
  196. package/dist/__vite-optional-peer-dep_stream-markdown_markstream-vue_false-sdjmOmXd.js +0 -5
  197. package/dist/__vite-optional-peer-dep_stream-monaco_markstream-vue_false-HdL4xm5U.js +0 -5
  198. package/dist/__vite-optional-peer-dep_vue-i18n_markstream-vue_false-B9Pwe5kz.js +0 -5
  199. package/dist/_basePickBy-hHD8tMGb.js +0 -151
  200. package/dist/_baseUniq-DTF1wuF6.js +0 -614
  201. package/dist/arc-Dw2RQerU.js +0 -83
  202. package/dist/architecture-U656AL7Q-B00Z9eXr.js +0 -36
  203. package/dist/architectureDiagram-VXUJARFQ-BtOffFaM.js +0 -4662
  204. package/dist/blockDiagram-VD42YOAC-BUqFMMQe.js +0 -2261
  205. package/dist/c4Diagram-YG6GDRKO-NrM1YcpG.js +0 -1579
  206. package/dist/channel-105myCGU.js +0 -5
  207. package/dist/chunk-4BX2VUAB-TAxJli7C.js +0 -8
  208. package/dist/chunk-55IACEB6-VXFJ4bz5.js +0 -8
  209. package/dist/chunk-B4BG7PRW-CZDQpfj5.js +0 -1375
  210. package/dist/chunk-DI55MBZ5-D3l7TA-E.js +0 -1370
  211. package/dist/chunk-FMBD7UC4-BMXFm8I3.js +0 -19
  212. package/dist/chunk-QN33PNHL-BOUpbpWp.js +0 -19
  213. package/dist/chunk-QZHKN3VN-C-TEEx05.js +0 -15
  214. package/dist/chunk-TZMSLE5B-BUiROKNR.js +0 -64
  215. package/dist/classDiagram-2ON5EDUG-HQET4ybK.js +0 -16
  216. package/dist/classDiagram-v2-WZHVMYZB-HQET4ybK.js +0 -16
  217. package/dist/clone-CIIO71O9.js +0 -8
  218. package/dist/components/Endpoint.vue.d.ts.map +0 -1
  219. package/dist/cose-bilkent-S5V4N54A-CMsF4n-5.js +0 -2609
  220. package/dist/cytoscape.esm-DfdJODL8.js +0 -18735
  221. package/dist/dagre-6UL2VRFP-DqzdQ6Qg.js +0 -444
  222. package/dist/defaultLocale-BEa-49Qz.js +0 -171
  223. package/dist/diagram-PSM6KHXK-1xyGntw2.js +0 -531
  224. package/dist/diagram-QEK2KX5R-DdZdlAm1.js +0 -217
  225. package/dist/diagram-S2PKOQOG-C80Eo2jp.js +0 -142
  226. package/dist/erDiagram-Q2GNP2WA-DFVRrMXT.js +0 -841
  227. package/dist/flowDiagram-NV44I4VS-D9QK_qqB.js +0 -1620
  228. package/dist/ganttDiagram-LVOFAZNH-Bo1NTkeQ.js +0 -2506
  229. package/dist/gitGraph-F6HP7TQM-C5hdgcgO.js +0 -27
  230. package/dist/gitGraphDiagram-NY62KEGX-BZqnqZh6.js +0 -699
  231. package/dist/graph-Dth4IhEK.js +0 -247
  232. package/dist/hooks/useChatApprovals.d.ts.map +0 -1
  233. package/dist/hooks/useChatOperationBlocks.d.ts +0 -3
  234. package/dist/hooks/useChatOperationBlocks.d.ts.map +0 -1
  235. package/dist/hooks/useChatScroll.d.ts.map +0 -1
  236. package/dist/hooks/useSearch.d.ts.map +0 -1
  237. package/dist/index-BOvT43H8.js +0 -111780
  238. package/dist/index2-B36B-gt0.js +0 -69
  239. package/dist/index3-CtIyYUnG.js +0 -70
  240. package/dist/index4-Dzz91Ao2.js +0 -537
  241. package/dist/index5-Bmz0gMSP.js +0 -590
  242. package/dist/index6-DMB3qTSV.js +0 -196
  243. package/dist/info-NVLQJR56-azt5obk5.js +0 -27
  244. package/dist/infoDiagram-ER5ION4S-DD4Jtctm.js +0 -24
  245. package/dist/infographic_markstream-vue_false-BfsmcXxk.js +0 -5
  246. package/dist/init-DjUOC4st.js +0 -16
  247. package/dist/journeyDiagram-XKPGCS4Q-CXL6UO0r.js +0 -834
  248. package/dist/kanban-definition-3W4ZIXB7-B57do5Wg.js +0 -719
  249. package/dist/katex-SsTUIUTC.js +0 -11688
  250. package/dist/layout-7TCY8eA2.js +0 -1332
  251. package/dist/linear-DSm5i91N.js +0 -625
  252. package/dist/mermaid-parser.core-CUQWpAMM.js +0 -12746
  253. package/dist/mermaid.core-QjuzH7xx.js +0 -14164
  254. package/dist/mhchem-XHl7cef5.js +0 -2306
  255. package/dist/mindmap-definition-VGOIOE7T-DAQyGNAM.js +0 -784
  256. package/dist/ordinal-DfAQgscy.js +0 -61
  257. package/dist/packet-BFZMPI3H-CixuxAEA.js +0 -27
  258. package/dist/pie-7BOR55EZ-D3cgnzR1.js +0 -32
  259. package/dist/pieDiagram-ADFJNKIX-BqxgYwrL.js +0 -161
  260. package/dist/quadrantDiagram-AYHSOK5B-CQ4v-9Hh.js +0 -1022
  261. package/dist/radar-NHE76QYJ-DhV0Od_M.js +0 -27
  262. package/dist/requirementDiagram-UZGBJVZJ-ncWNAgFi.js +0 -850
  263. package/dist/safeRaf-I3a3-dyJ.js +0 -10
  264. package/dist/sankeyDiagram-TZEHDZUN-yCR2_cH5.js +0 -810
  265. package/dist/sequenceDiagram-WL72ISMW-DZ7wqFyd.js +0 -2511
  266. package/dist/stateDiagram-FKZM4ZOC-Dra68Tzi.js +0 -263
  267. package/dist/stateDiagram-v2-4FDKWEC3-CARbPECD.js +0 -16
  268. package/dist/timeline-definition-IT6M3QCI-DEbG9QIM.js +0 -795
  269. package/dist/treemap-KMMF4GRG-CQbPsyWe.js +0 -81
  270. package/dist/xychartDiagram-PRI3JC2R-C94Pu8hL.js +0 -1340
@@ -1,590 +0,0 @@
1
- import { defineComponent as zt, ref as d, computed as K, watch as Y, onBeforeUnmount as Lt, onMounted as At, onUnmounted as Ft, createElementBlock as w, openBlock as g, normalizeClass as y, createCommentVNode as Q, withDirectives as Ht, renderSlot as Je, createElementVNode as n, unref as h, toDisplayString as xe, normalizeStyle as yt, createBlock as Rt, mergeProps as xt, toHandlers as kt, Teleport as Nt, createVNode as _t, Transition as Xt, withCtx as Yt, withModifiers as Vt, vShow as Zt, nextTick as A } from "vue";
2
- import { J as qt, n as It, o as Ut, Y as bt, a as Wt, m as Gt, u as Jt, b as Kt } from "./index-BOvT43H8.js";
3
- import { e as Qt } from "./safeRaf-I3a3-dyJ.js";
4
- var el = Object.defineProperty, tl = Object.defineProperties, ll = Object.getOwnPropertyDescriptors, Mt = Object.getOwnPropertySymbols, rl = Object.prototype.hasOwnProperty, nl = Object.prototype.propertyIsEnumerable, Tt = (L, j, M) => j in L ? el(L, j, { enumerable: !0, configurable: !0, writable: !0, value: M }) : L[j] = M, Ke = (L, j) => {
5
- for (var M in j || (j = {})) rl.call(j, M) && Tt(L, M, j[M]);
6
- if (Mt) for (var M of Mt(j)) nl.call(j, M) && Tt(L, M, j[M]);
7
- return L;
8
- }, D = (L, j, M) => new Promise((ke, o) => {
9
- var re = (F) => {
10
- try {
11
- P(M.next(F));
12
- } catch (ne) {
13
- o(ne);
14
- }
15
- }, be = (F) => {
16
- try {
17
- P(M.throw(F));
18
- } catch (ne) {
19
- o(ne);
20
- }
21
- }, P = (F) => F.done ? ke(F.value) : Promise.resolve(F.value).then(re, be);
22
- P((M = M.apply(L, j)).next());
23
- });
24
- const ol = { key: 0 }, al = { key: 1, class: "flex items-center gap-x-2 overflow-hidden" }, il = ["src"], ul = { key: 2 }, sl = { class: "flex items-center gap-x-1" }, cl = { class: "flex items-center gap-x-1" }, dl = { key: 4 }, vl = { key: 5, class: "flex items-center gap-x-1" }, ml = ["aria-pressed"], fl = { key: 0, xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, hl = { key: 1, xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, gl = ["disabled"], pl = ["disabled"], wl = { key: 0, xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "0.75rem", height: "0.75rem", viewBox: "0 0 24 24" }, yl = { key: 1, xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "0.75rem", height: "0.75rem", viewBox: "0 0 24 24" }, xl = { key: 1, class: "relative" }, kl = { key: 0, class: "absolute top-2 right-2 z-10 rounded-lg" }, bl = { class: "flex items-center gap-2 backdrop-blur rounded-lg" }, Ml = { class: "markstream-vue" }, Tl = { class: "absolute top-6 right-6 z-50 flex items-center gap-2" }, Qe = /* @__PURE__ */ qt(/* @__PURE__ */ zt({ __name: "MermaidBlockNode", props: { node: {}, maxHeight: { default: "500px" }, loading: { type: Boolean, default: !0 }, isDark: { type: Boolean }, workerTimeoutMs: { default: 1400 }, parseTimeoutMs: { default: 1800 }, renderTimeoutMs: { default: 2500 }, fullRenderTimeoutMs: { default: 4e3 }, showHeader: { type: Boolean, default: !0 }, showModeToggle: { type: Boolean, default: !0 }, showCopyButton: { type: Boolean, default: !0 }, showExportButton: { type: Boolean, default: !0 }, showFullscreenButton: { type: Boolean, default: !0 }, showCollapseButton: { type: Boolean, default: !0 }, showZoomControls: { type: Boolean, default: !0 }, enableWheelZoom: { type: Boolean, default: !1 }, isStrict: { type: Boolean, default: !1 } }, emits: ["copy", "export", "openModal", "toggleMode"], setup(L, { emit: j }) {
25
- var M, ke;
26
- const o = L, re = j, be = { USE_PROFILES: { svg: !0 }, FORBID_TAGS: ["script"], FORBID_ATTR: [/^on/i], ADD_TAGS: ["style"], ADD_ATTR: ["style"], SAFE_FOR_TEMPLATES: !0 }, P = d(!1), F = K(() => o.isStrict ? "strict" : "loose"), ne = K(() => ({ startOnLoad: !1, securityLevel: F.value, dompurifyConfig: F.value === "strict" ? be : void 0, flowchart: F.value === "strict" ? { htmlLabels: !1 } : void 0 })), Ct = [/javascript:/i, /expression\s*\(/i, /url\s*\(\s*javascript:/i, /@import/i], Dt = /^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;
27
- function Bt(t) {
28
- if (!t) return "";
29
- const e = t.trim();
30
- return Dt.test(e) ? e : "";
31
- }
32
- function Me(t) {
33
- if (t) try {
34
- t.replaceChildren();
35
- } catch {
36
- t.innerHTML = "";
37
- }
38
- }
39
- function oe(t, e) {
40
- if (!t) return "";
41
- if (F.value === "strict") return (function(l, r) {
42
- if (!l) return "";
43
- try {
44
- l.replaceChildren();
45
- } catch {
46
- l.innerHTML = "";
47
- }
48
- const c = (function(a) {
49
- if (typeof window > "u" || typeof DOMParser > "u" || !a) return null;
50
- const s = a.replace(/["']\s*javascript:/gi, "#").replace(/\bjavascript:/gi, "#").replace(/["']\s*vbscript:/gi, "#").replace(/\bvbscript:/gi, "#").replace(/\bdata:text\/html/gi, "#"), i = new DOMParser().parseFromString(s, "image/svg+xml").documentElement;
51
- if (!i || i.nodeName.toLowerCase() !== "svg") return null;
52
- const m = i;
53
- return (function(v) {
54
- const p = /* @__PURE__ */ new Set(["script"]), z = [v, ...Array.from(v.querySelectorAll("*"))];
55
- for (const C of z) {
56
- if (p.has(C.tagName.toLowerCase())) {
57
- C.remove();
58
- continue;
59
- }
60
- const X = Array.from(C.attributes);
61
- for (const N of X) {
62
- const b = N.name;
63
- if (/^on/i.test(b)) C.removeAttribute(b);
64
- else {
65
- if (b === "style" && N.value) {
66
- const k = N.value;
67
- if (Ct.some((Xe) => Xe.test(k))) {
68
- C.removeAttribute(b);
69
- continue;
70
- }
71
- }
72
- if ((b === "href" || b === "xlink:href") && N.value) {
73
- const k = Bt(N.value);
74
- if (!k) {
75
- C.removeAttribute(b);
76
- continue;
77
- }
78
- k !== N.value && C.setAttribute(b, k);
79
- }
80
- }
81
- }
82
- }
83
- })(m), m;
84
- })(r);
85
- return c ? (l.appendChild(c), l.innerHTML) : "";
86
- })(t, e);
87
- try {
88
- t.replaceChildren();
89
- } catch {
90
- t.innerHTML = "";
91
- }
92
- if (e) try {
93
- t.insertAdjacentHTML("afterbegin", e);
94
- } catch {
95
- t.innerHTML = e;
96
- }
97
- return t.innerHTML;
98
- }
99
- const { t: f } = It();
100
- function Te() {
101
- return D(this, null, function* () {
102
- try {
103
- const t = yield Kt();
104
- return P.value = !!t, t;
105
- } catch (t) {
106
- throw P.value = !1, t;
107
- }
108
- });
109
- }
110
- typeof window < "u" && D(null, null, function* () {
111
- var t;
112
- try {
113
- const e = yield Te();
114
- if (!e) return;
115
- (t = e?.initialize) == null || t.call(e, Ke({}, ne.value));
116
- } catch (e) {
117
- P.value = !1, console.warn("[markstream-vue] Failed to initialize mermaid renderer. Call enableMermaid() to configure a loader.", e);
118
- }
119
- });
120
- const Ce = d(!1), V = d(!1), Z = d(), u = d(), ae = d(), De = d(null), Et = Ut(), me = d(null), ie = d(typeof window > "u"), et = d(), R = K(() => o.node.code.replace(/\]::([^:])/g, "]:::$1").replace(/:::subgraphNode$/gm, "::subgraphNode")), x = d(1), O = d(0), $ = d(0), Be = d(!1), Ee = d({ x: 0, y: 0 }), E = d(!1), Se = d(!1), U = d(!1), je = d(null), Pe = d(0), Ye = d(!1);
121
- let fe = null, he = null, ge = 0;
122
- const tt = (M = globalThis.requestIdleCallback) != null ? M : (t, e) => setTimeout(() => t({ didTimeout: !0 }), 16), ue = /* @__PURE__ */ (function() {
123
- let t = null;
124
- return (...e) => {
125
- t && clearTimeout(t), t = setTimeout(() => (() => {
126
- tt(() => {
127
- pt();
128
- }, { timeout: 500 });
129
- })(...e), 300);
130
- };
131
- })();
132
- function pe() {
133
- he != null && (globalThis.clearTimeout(he), he = null);
134
- }
135
- function lt(t = 600) {
136
- if (typeof globalThis > "u") return;
137
- const e = Math.max(0, t);
138
- pe(), he = globalThis.setTimeout(() => {
139
- he = null, o.loading || U.value || !ie.value ? lt(Math.min(1200, Math.max(300, 1.2 * e))) : ue();
140
- }, e);
141
- }
142
- const W = d("360px");
143
- let se = null;
144
- const B = d(!1), ee = d(!1), G = d({}), rt = d(null), we = d(""), Ve = d(0);
145
- let H = null;
146
- const q = d(!1), te = d({ zoom: 1, translateX: 0, translateY: 0, containerHeight: "360px" }), nt = K(() => o.enableWheelZoom ? { wheel: jt } : {}), I = K(() => {
147
- var t, e, l, r;
148
- return { worker: (t = o.workerTimeoutMs) != null ? t : 1400, parse: (e = o.parseTimeoutMs) != null ? e : 1800, render: (l = o.renderTimeoutMs) != null ? l : 2500, fullRender: (r = o.fullRenderTimeoutMs) != null ? r : 4e3 };
149
- }), St = (ke = globalThis.cancelIdleCallback) != null ? ke : (t) => clearTimeout(t);
150
- let ce = null, Oe = null, de = !1, ye = 800, _ = null, $e = 0, Ze = !0;
151
- function ze(t, e) {
152
- const l = e?.timeoutMs, r = e?.signal;
153
- if (r?.aborted) return Promise.reject(new DOMException("Aborted", "AbortError"));
154
- let c = null, a = !1, s = null;
155
- return new Promise((i, m) => {
156
- const v = () => {
157
- c != null && clearTimeout(c), s && r && r.removeEventListener("abort", s);
158
- };
159
- l && l > 0 && (c = globalThis.setTimeout(() => {
160
- a || (a = !0, v(), m(new Error("Operation timed out")));
161
- }, l)), r && (s = () => {
162
- a || (a = !0, v(), m(new DOMException("Aborted", "AbortError")));
163
- }, r.addEventListener("abort", s)), t().then((p) => {
164
- a || (a = !0, v(), i(p));
165
- }).catch((p) => {
166
- a || (a = !0, v(), m(p));
167
- });
168
- });
169
- }
170
- function ot(t) {
171
- if (typeof document > "u" || !u.value) return;
172
- const e = document.createElement("div");
173
- e.className = "text-red-500 p-4", e.textContent = "Failed to render diagram: ";
174
- const l = document.createElement("span");
175
- l.textContent = t instanceof Error ? t.message : "Unknown error", e.appendChild(l), Me(u.value), u.value.appendChild(e), W.value = "360px", q.value = !0, le();
176
- }
177
- function at(t) {
178
- return !t || t.disabled;
179
- }
180
- function S(t, e, l = "top") {
181
- if (at(t.currentTarget)) return;
182
- const r = t, c = r?.clientX != null && r?.clientY != null ? { x: r.clientX, y: r.clientY } : void 0;
183
- bt(t.currentTarget, e, l, !1, c, o.isDark);
184
- }
185
- function T() {
186
- Wt();
187
- }
188
- function it(t) {
189
- if (at(t.currentTarget)) return;
190
- const e = Ce.value ? f("common.copied") || "Copied" : f("common.copy") || "Copy", l = t, r = l?.clientX != null && l?.clientY != null ? { x: l.clientX, y: l.clientY } : void 0;
191
- bt(t.currentTarget, e, "top", !1, r, o.isDark);
192
- }
193
- function ut(t, e) {
194
- const l = `%%{init: {"theme": "${e === "dark" ? "dark" : "default"}"}}%%
195
- `;
196
- return t.trimStart().startsWith("%%{") ? t : l + t;
197
- }
198
- function st() {
199
- return Ze && !E.value && !B.value && !q.value;
200
- }
201
- function ct(t) {
202
- const e = t.split(/\r?\n/);
203
- for (; e.length > 0; ) {
204
- const l = e[e.length - 1].trimEnd();
205
- if (l !== "") {
206
- if (!(/^[-=~>|<\s]+$/.test(l.trim()) || /(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(l) || /[-|><]$/.test(l) || /(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(l))) break;
207
- e.pop();
208
- } else e.pop();
209
- }
210
- return e.join(`
211
- `);
212
- }
213
- function Le(t, e, l) {
214
- return D(this, null, function* () {
215
- var r;
216
- try {
217
- return yield Jt(t, e, (r = l?.timeoutMs) != null ? r : I.value.worker);
218
- } catch {
219
- return yield (function(a, s, i) {
220
- return D(this, null, function* () {
221
- var m, v;
222
- const p = yield Te();
223
- if (!p) return;
224
- const z = p, C = ut(a, s);
225
- if (typeof z.parse == "function") return yield ze(() => z.parse(C), { timeoutMs: (m = i?.timeoutMs) != null ? m : I.value.parse, signal: i?.signal }), !0;
226
- const X = `mermaid-parse-${Math.random().toString(36).slice(2, 9)}`;
227
- return yield ze(() => p.render(X, C), { timeoutMs: (v = i?.timeoutMs) != null ? v : I.value.render, signal: i?.signal }), !0;
228
- });
229
- })(t, e, l);
230
- }
231
- });
232
- }
233
- typeof window < "u" && Y(() => Z.value, (t) => {
234
- var e;
235
- if ((e = me.value) == null || e.destroy(), me.value = null, !t) return void (ie.value = !1);
236
- const l = Et(t, { rootMargin: "400px" });
237
- me.value = l, ie.value = l.isVisible.value, l.whenVisible.then(() => {
238
- ie.value = !0;
239
- });
240
- }, { immediate: !0 }), Lt(() => {
241
- var t;
242
- (t = me.value) == null || t.destroy(), me.value = null;
243
- });
244
- const Ae = K(() => E.value || U.value || V.value);
245
- function qe(t) {
246
- if (!Z.value || !u.value) return;
247
- const e = u.value.querySelector("svg");
248
- if (!e) return;
249
- let l = 0, r = 0;
250
- const c = e.getAttribute("viewBox"), a = e.getAttribute("width"), s = e.getAttribute("height");
251
- if (c) {
252
- const i = c.split(" ");
253
- i.length === 4 && (l = Number.parseFloat(i[2]), r = Number.parseFloat(i[3]));
254
- }
255
- if (l && r || a && s && (l = Number.parseFloat(a), r = Number.parseFloat(s)), Number.isNaN(l) || Number.isNaN(r) || l <= 0 || r <= 0) try {
256
- const i = e.getBBox();
257
- i && i.width > 0 && i.height > 0 && (l = i.width, r = i.height);
258
- } catch (i) {
259
- return void console.error("Failed to get SVG BBox:", i);
260
- }
261
- if (l > 0 && r > 0) {
262
- const i = r / l;
263
- let m = (t ?? Z.value.clientWidth) * i;
264
- m > r && (m = r), W.value = `${m}px`;
265
- }
266
- }
267
- const J = d(!1), Ie = K(() => ({ transform: `translate(${O.value}px, ${$.value}px) scale(${x.value})` }));
268
- function dt(t) {
269
- t.key === "Escape" && J.value && Ue();
270
- }
271
- function Ue() {
272
- if (J.value = !1, ae.value && Me(ae.value), De.value = null, typeof document < "u") try {
273
- document.body.style.overflow = "";
274
- } catch {
275
- }
276
- if (typeof window < "u") try {
277
- window.removeEventListener("keydown", dt);
278
- } catch {
279
- }
280
- }
281
- function vt() {
282
- x.value < 3 && (x.value += 0.1);
283
- }
284
- function mt() {
285
- x.value > 0.5 && (x.value -= 0.1);
286
- }
287
- function ft() {
288
- x.value = 1, O.value = 0, $.value = 0;
289
- }
290
- function Fe(t) {
291
- Be.value = !0, t instanceof MouseEvent ? Ee.value = { x: t.clientX - O.value, y: t.clientY - $.value } : Ee.value = { x: t.touches[0].clientX - O.value, y: t.touches[0].clientY - $.value };
292
- }
293
- function He(t) {
294
- if (!Be.value) return;
295
- let e, l;
296
- t instanceof MouseEvent ? (e = t.clientX, l = t.clientY) : (e = t.touches[0].clientX, l = t.touches[0].clientY), O.value = e - Ee.value.x, $.value = l - Ee.value.y;
297
- }
298
- function ve() {
299
- Be.value = !1;
300
- }
301
- function jt(t) {
302
- if (o.enableWheelZoom && (t.ctrlKey || t.metaKey)) {
303
- if (t.preventDefault(), !Z.value) return;
304
- const e = Z.value.getBoundingClientRect(), l = t.clientX - e.left, r = t.clientY - e.top, c = l - e.width / 2, a = r - e.height / 2, s = (c - O.value) / x.value, i = (a - $.value) / x.value, m = 0.01, v = -t.deltaY * m, p = Math.min(Math.max(x.value + v, 0.5), 3);
305
- p !== x.value && (O.value = c - s * p, $.value = a - i * p, x.value = p);
306
- }
307
- }
308
- function Pt() {
309
- return D(this, null, function* () {
310
- try {
311
- const t = R.value, e = { payload: { type: "copy", text: t }, defaultPrevented: !1, preventDefault() {
312
- this.defaultPrevented = !0;
313
- } };
314
- if (re("copy", e), e.defaultPrevented) return;
315
- typeof navigator < "u" && navigator.clipboard && typeof navigator.clipboard.writeText == "function" && (yield navigator.clipboard.writeText(t)), Ce.value = !0, setTimeout(() => {
316
- Ce.value = !1;
317
- }, 1e3);
318
- } catch (t) {
319
- console.error("Failed to copy:", t);
320
- }
321
- });
322
- }
323
- function Ot() {
324
- var t;
325
- const e = (t = u.value) == null ? void 0 : t.querySelector("svg");
326
- if (!e) return void console.error("SVG element not found");
327
- const l = new XMLSerializer().serializeToString(e), r = { payload: { type: "export" }, defaultPrevented: !1, preventDefault() {
328
- this.defaultPrevented = !0;
329
- }, svgElement: e, svgString: l };
330
- re("export", r), r.defaultPrevented || (function(c, a = null) {
331
- D(this, null, function* () {
332
- try {
333
- const s = a ?? new XMLSerializer().serializeToString(c), i = new Blob([s], { type: "image/svg+xml;charset=utf-8" }), m = URL.createObjectURL(i);
334
- if (typeof document < "u") {
335
- const v = document.createElement("a");
336
- v.href = m, v.download = `mermaid-diagram-${Date.now()}.svg`;
337
- try {
338
- document.body.appendChild(v), v.click(), document.body.removeChild(v);
339
- } catch {
340
- }
341
- URL.revokeObjectURL(m);
342
- }
343
- } catch (s) {
344
- console.error("Failed to export SVG:", s);
345
- }
346
- });
347
- })(e, l);
348
- }
349
- function $t() {
350
- var t, e;
351
- const l = (e = (t = u.value) == null ? void 0 : t.querySelector("svg")) != null ? e : null, r = l ? new XMLSerializer().serializeToString(l) : null, c = { payload: { type: "open-modal" }, defaultPrevented: !1, preventDefault() {
352
- this.defaultPrevented = !0;
353
- }, svgElement: l, svgString: r };
354
- re("openModal", c), c.defaultPrevented || (function() {
355
- if (J.value = !0, typeof document < "u") try {
356
- document.body.style.overflow = "hidden";
357
- } catch {
358
- }
359
- if (typeof window < "u") try {
360
- window.addEventListener("keydown", dt);
361
- } catch {
362
- }
363
- A(() => {
364
- if (Z.value && ae.value) {
365
- const a = Z.value.cloneNode(!0);
366
- a.classList.add("fullscreen");
367
- const s = a.querySelector("[data-mermaid-wrapper]");
368
- s && (De.value = s, s.style.transform = Ie.value.transform), Me(ae.value), ae.value.appendChild(a);
369
- }
370
- });
371
- })();
372
- }
373
- function ht(t) {
374
- const e = { payload: { type: "toggle-mode", target: t }, defaultPrevented: !1, preventDefault() {
375
- this.defaultPrevented = !0;
376
- } };
377
- re("toggleMode", t, e), e.defaultPrevented || gt(t);
378
- }
379
- function gt(t) {
380
- return D(this, null, function* () {
381
- const e = et.value;
382
- if (!e) return Se.value = !0, void (E.value = t === "source");
383
- const l = e.getBoundingClientRect().height;
384
- e.style.height = `${l}px`, e.style.overflow = "hidden", Se.value = !0, E.value = t === "source", yield A();
385
- const r = e.scrollHeight;
386
- e.style.transition = "height 180ms ease", e.offsetHeight, e.style.height = `${r}px`;
387
- const c = () => {
388
- e.style.transition = "", e.style.height = "", e.style.overflow = "", e.removeEventListener("transitionend", a);
389
- };
390
- function a() {
391
- c();
392
- }
393
- e.addEventListener("transitionend", a), setTimeout(() => c(), 220);
394
- });
395
- }
396
- function Re() {
397
- return D(this, null, function* () {
398
- return U.value ? je.value : u.value || (yield A(), u.value) ? (U.value = !0, je.value = D(null, null, function* () {
399
- var t, e, l;
400
- u.value && (u.value.style.opacity = "0");
401
- try {
402
- const r = yield Te();
403
- if (!r) return;
404
- const c = `mermaid-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
405
- B.value || ee.value || (t = r.initialize) == null || t.call(r, (e = Ke({}, ne.value), l = { dompurifyConfig: Ke({}, be) }, tl(e, ll(l))));
406
- const a = (function(m, v = R.value) {
407
- const p = v, z = `%%{init: {"theme": "${m === "dark" ? "dark" : "default"}"}}%%
408
- `;
409
- return p.trim().startsWith("%%{") ? p : z + p;
410
- })(o.isDark ? "dark" : "light"), s = yield ze(() => r.render(c, a), { timeoutMs: I.value.fullRender }), i = s?.svg;
411
- if (u.value) {
412
- const m = oe(u.value, i);
413
- B.value || ee.value || (qe(), B.value = !0, te.value = { zoom: x.value, translateX: O.value, translateY: $.value, containerHeight: W.value });
414
- const v = o.isDark ? "dark" : "light";
415
- m && (G.value[v] = m), ee.value && (ee.value = !1), q.value = !1, ge = 0, pe();
416
- }
417
- } catch (r) {
418
- const c = (function(s) {
419
- const i = typeof s == "string" ? s : typeof s?.message == "string" ? s.message : "";
420
- return typeof i == "string" && /timed out/i.test(i);
421
- })(r), a = ge + 1;
422
- c && a <= 3 ? (ge = a, lt(Math.min(1200, 600 * a))) : (ge = 0, pe(), console.error("Failed to render mermaid diagram:", r), o.loading === !1 && ot(r));
423
- } finally {
424
- yield A(), u.value && (u.value.style.opacity = "1"), U.value = !1, je.value = null;
425
- }
426
- }), je.value) : void console.warn("Mermaid container not ready");
427
- });
428
- }
429
- function pt() {
430
- return D(this, null, function* () {
431
- var t, e;
432
- const l = Date.now(), r = ++Ve.value;
433
- H && H.abort(), H = new AbortController();
434
- const c = H.signal, a = o.isDark ? "dark" : "light", s = R.value, i = s.replace(/\s+/g, "");
435
- if (!s.trim()) return u.value && Me(u.value), rt.value = null, we.value = "", void (q.value = !1);
436
- if (i === we.value) return;
437
- try {
438
- const v = yield (function(z, C, X) {
439
- return D(this, null, function* () {
440
- var N;
441
- try {
442
- if (yield Le(z, C, X)) return { fullOk: !0, prefixOk: !1 };
443
- } catch (k) {
444
- if (k?.name === "AbortError") throw k;
445
- }
446
- let b = ct(z);
447
- if (b && b.trim() && b !== z) try {
448
- try {
449
- const k = yield Gt(z, C, (N = X?.timeoutMs) != null ? N : I.value.worker);
450
- k && k.trim() && (b = k);
451
- } catch {
452
- }
453
- if (yield Le(b, C, X)) return { fullOk: !1, prefixOk: !0, prefix: b };
454
- } catch (k) {
455
- if (k?.name === "AbortError") throw k;
456
- }
457
- return { fullOk: !1, prefixOk: !1 };
458
- });
459
- })(s, a, { signal: c, timeoutMs: I.value.worker });
460
- if (v.fullOk) return yield Re(), void (Ve.value === r && (rt.value = (e = (t = u.value) == null ? void 0 : t.innerHTML) != null ? e : null, we.value = i, q.value = !1));
461
- const p = $e && l <= $e;
462
- if (v.prefixOk && v.prefix && st() && !p) return void (yield (function(z) {
463
- return D(this, null, function* () {
464
- if (st() && (u.value || (yield A(), u.value)) && !U.value) {
465
- U.value = !0;
466
- try {
467
- const C = yield Te();
468
- if (!C) return;
469
- const X = `mermaid-partial-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, N = o.isDark ? "dark" : "light", b = ct(z), k = ut(b && b.trim() ? b : z, N);
470
- u.value && (u.value.style.opacity = "0");
471
- const Xe = yield ze(() => C.render(X, k), { timeoutMs: I.value.render }), wt = Xe?.svg;
472
- u.value && wt && (oe(u.value, wt), qe());
473
- } catch {
474
- } finally {
475
- yield A(), u.value && (u.value.style.opacity = "1"), U.value = !1;
476
- }
477
- }
478
- });
479
- })(v.prefix));
480
- } catch (v) {
481
- if (v?.name === "AbortError") return;
482
- }
483
- if (Ve.value !== r || q.value) return;
484
- const m = G.value[a];
485
- m && u.value && oe(u.value, m);
486
- });
487
- }
488
- function le() {
489
- de && (de = !1, ye = 800, Ze = !1, _ && (_.abort(), _ = null), ce && (globalThis.clearTimeout(ce), ce = null), Oe && (St(Oe), Oe = null), $e = Date.now());
490
- }
491
- function Ne() {
492
- if (le(), H) {
493
- try {
494
- H.abort();
495
- } catch {
496
- }
497
- H = null;
498
- }
499
- if (_) {
500
- try {
501
- _.abort();
502
- } catch {
503
- }
504
- _ = null;
505
- }
506
- pe(), ge = 0;
507
- }
508
- function We(t = 800) {
509
- de && (ce && globalThis.clearTimeout(ce), ce = globalThis.setTimeout(() => {
510
- Oe = tt(() => D(null, null, function* () {
511
- if (!de) return;
512
- if (E.value || B.value) return void le();
513
- const e = o.isDark ? "dark" : "light", l = R.value;
514
- if (l.trim()) {
515
- _ && _.abort(), _ = new AbortController();
516
- try {
517
- if ((yield Le(l, e, { signal: _.signal, timeoutMs: I.value.worker })) && (yield Re(), B.value)) return void le();
518
- } catch {
519
- }
520
- ye = Math.min(Math.floor(1.5 * ye), 4e3), We(ye);
521
- } else We(ye);
522
- }), { timeout: 500 });
523
- }, t));
524
- }
525
- function Ge() {
526
- de || E.value || B.value || (de = !0, $e = 0, Ze = !0, We(500));
527
- }
528
- Y(Ie, (t) => {
529
- J.value && De.value && (De.value.style.transform = t.transform);
530
- }, { immediate: !0 }), Y(() => R.value, () => {
531
- B.value = !1, G.value = {}, ue(), !E.value && P.value && Ge(), (function() {
532
- if (!E.value || !P.value) return;
533
- const t = R.value.length;
534
- t !== Pe.value && (Ye.value = !0, Pe.value = t, fe && clearTimeout(fe), fe = setTimeout(() => {
535
- Ye.value && E.value && R.value.trim() && (Ye.value = !1, gt("preview"));
536
- }, 500));
537
- })();
538
- }), Y(() => o.isDark, () => D(null, null, function* () {
539
- if (!B.value || q.value) return;
540
- const t = o.isDark ? "dark" : "light", e = G.value[t];
541
- if (e) return void (u.value && oe(u.value, e));
542
- const l = { zoom: x.value, translateX: O.value, translateY: $.value, containerHeight: W.value }, r = x.value !== 1 || O.value !== 0 || $.value !== 0;
543
- ee.value = !0, r && (x.value = 1, O.value = 0, $.value = 0, yield A()), yield Re(), r && (yield A(), x.value = l.zoom, O.value = l.translateX, $.value = l.translateY, W.value = l.containerHeight, te.value = l);
544
- })), Y(() => E.value, (t) => D(null, null, function* () {
545
- if (t) le(), B.value && (te.value = { zoom: x.value, translateX: O.value, translateY: $.value, containerHeight: W.value });
546
- else {
547
- if (q.value) return;
548
- const e = o.isDark ? "dark" : "light";
549
- if (B.value && G.value[e]) return yield A(), u.value && oe(u.value, G.value[e]), x.value = te.value.zoom, O.value = te.value.translateX, $.value = te.value.translateY, void (W.value = te.value.containerHeight);
550
- if (yield A(), !P.value) return;
551
- yield pt(), Ge();
552
- }
553
- })), Y(() => o.loading, (t, e) => D(null, null, function* () {
554
- if (e === !0 && t === !1) {
555
- const l = R.value.trim();
556
- if (!l) return Ne();
557
- const r = o.isDark ? "dark" : "light", c = l.replace(/\s+/g, "");
558
- if (B.value && c === we.value) return yield A(), u.value && !u.value.querySelector("svg") && G.value[r] && oe(u.value, G.value[r]), void Ne();
559
- try {
560
- yield Le(l, r, { timeoutMs: I.value.worker }), yield Re(), we.value = c, q.value = !1, Ne();
561
- } catch (a) {
562
- Ne(), ot(a);
563
- }
564
- }
565
- })), Y(Z, (t) => {
566
- se && se.disconnect(), !t || B.value || ee.value || (se = new ResizeObserver((e) => {
567
- e && e.length > 0 && !B.value && !ee.value && Qt(() => {
568
- qe(e[0].contentRect.width);
569
- });
570
- }), se.observe(t));
571
- }, { immediate: !0 }), At(() => D(null, null, function* () {
572
- yield A(), Se.value || (E.value = !P.value), ie.value && (ue(), Pe.value = R.value.length);
573
- })), Y(() => P.value, (t) => {
574
- Se.value || (E.value = !t);
575
- }), Y(() => ie.value, (t) => {
576
- t && (B.value || (ue(), Pe.value = R.value.length), o.loading || B.value || ue());
577
- }, { immediate: !1 }), Ft(() => {
578
- fe && clearTimeout(fe), se && se.disconnect(), H && (H.abort(), H = null), le(), pe();
579
- }), Y(() => V.value, (t) => D(null, null, function* () {
580
- t ? (le(), H && H.abort()) : B.value || (yield A(), ue(), E.value || Ge());
581
- }), { immediate: !1 });
582
- const _e = K(() => o.isDark ? "mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200" : "mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700");
583
- return (t, e) => (g(), w("div", { class: y(["my-4 rounded-lg border overflow-hidden shadow-sm", [o.isDark ? "border-gray-700/30" : "border-gray-200", { "is-rendering": o.loading }]]) }, [o.showHeader ? (g(), w("div", { key: 0, class: y(["mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b", o.isDark ? "bg-gray-800 border-gray-700/30" : "bg-gray-50 border-gray-200"]) }, [t.$slots["header-left"] ? (g(), w("div", ol, [Je(t.$slots, "header-left", {}, void 0, !0)])) : (g(), w("div", al, [n("img", { src: h("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20width='16'%20height='16'%3e%3cpath%20fill='none'%20stroke='%23ca9ee6'%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M1.5%202.5c0%206%202.25%205.75%204%207%20.83.67%201.17%202%201%204h3c-.17-2%20.17-3.33%201-4%201.75-1.25%204-1%204-7C12%202.5%2010%203%208%207%206%203%204%202.5%201.5%202.5'%20/%3e%3c/svg%3e"), class: "w-4 h-4 my-0", alt: "Mermaid" }, null, 8, il), n("span", { class: y(["text-sm font-medium font-mono truncate", o.isDark ? "text-gray-400" : "text-gray-600"]) }, "Mermaid", 2)])), t.$slots["header-center"] ? (g(), w("div", ul, [Je(t.$slots, "header-center", {}, void 0, !0)])) : o.showModeToggle && P.value ? (g(), w("div", { key: 3, class: y(["flex items-center gap-x-1 rounded-md p-0.5", o.isDark ? "bg-gray-700" : "bg-gray-100"]) }, [n("button", { class: y(["px-2.5 py-1 text-xs rounded transition-colors", [E.value ? o.isDark ? "text-gray-400 hover:text-gray-200" : "text-gray-500 hover:text-gray-700" : o.isDark ? "bg-gray-600 text-gray-200 shadow-sm" : "bg-white text-gray-700 shadow-sm"]]), onClick: e[0] || (e[0] = () => ht("preview")), onMouseenter: e[1] || (e[1] = (l) => S(l, h(f)("common.preview") || "Preview")), onFocus: e[2] || (e[2] = (l) => S(l, h(f)("common.preview") || "Preview")), onMouseleave: T, onBlur: T }, [n("div", sl, [e[21] || (e[21] = n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("path", { d: "M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0" }), n("circle", { cx: "12", cy: "12", r: "3" })])], -1)), n("span", null, xe(h(f)("common.preview") || "Preview"), 1)])], 34), n("button", { class: y(["px-2.5 py-1 text-xs rounded transition-colors", [E.value ? o.isDark ? "bg-gray-600 text-gray-200 shadow-sm" : "bg-white text-gray-700 shadow-sm" : o.isDark ? "text-gray-400 hover:text-gray-200" : "text-gray-500 hover:text-gray-700"]]), onClick: e[3] || (e[3] = () => ht("source")), onMouseenter: e[4] || (e[4] = (l) => S(l, h(f)("common.source") || "Source")), onFocus: e[5] || (e[5] = (l) => S(l, h(f)("common.source") || "Source")), onMouseleave: T, onBlur: T }, [n("div", cl, [e[22] || (e[22] = n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "m16 18l6-6l-6-6M8 6l-6 6l6 6" })], -1)), n("span", null, xe(h(f)("common.source") || "Source"), 1)])], 34)], 2)) : Q("", !0), t.$slots["header-right"] ? (g(), w("div", dl, [Je(t.$slots, "header-right", {}, void 0, !0)])) : (g(), w("div", vl, [o.showCollapseButton ? (g(), w("button", { key: 0, class: y(_e.value), "aria-pressed": V.value, onClick: e[6] || (e[6] = (l) => V.value = !V.value), onMouseenter: e[7] || (e[7] = (l) => S(l, V.value ? h(f)("common.expand") || "Expand" : h(f)("common.collapse") || "Collapse")), onFocus: e[8] || (e[8] = (l) => S(l, V.value ? h(f)("common.expand") || "Expand" : h(f)("common.collapse") || "Collapse")), onMouseleave: T, onBlur: T }, [(g(), w("svg", { style: yt({ rotate: V.value ? "0deg" : "90deg" }), xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [...e[23] || (e[23] = [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "m9 18l6-6l-6-6" }, null, -1)])], 4))], 42, ml)) : Q("", !0), o.showCopyButton ? (g(), w("button", { key: 1, class: y(_e.value), onClick: Pt, onMouseenter: e[9] || (e[9] = (l) => it(l)), onFocus: e[10] || (e[10] = (l) => it(l)), onMouseleave: T, onBlur: T }, [Ce.value ? (g(), w("svg", hl, [...e[25] || (e[25] = [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M20 6L9 17l-5-5" }, null, -1)])])) : (g(), w("svg", fl, [...e[24] || (e[24] = [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }), n("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })], -1)])]))], 34)) : Q("", !0), o.showExportButton && P.value ? (g(), w("button", { key: 2, class: y(`${_e.value} ${Ae.value ? "opacity-50 cursor-not-allowed" : ""}`), disabled: Ae.value, onClick: Ot, onMouseenter: e[11] || (e[11] = (l) => S(l, h(f)("common.export") || "Export")), onFocus: e[12] || (e[12] = (l) => S(l, h(f)("common.export") || "Export")), onMouseleave: T, onBlur: T }, [...e[26] || (e[26] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("path", { d: "M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), n("path", { d: "m7 10l5 5l5-5" })])], -1)])], 42, gl)) : Q("", !0), o.showFullscreenButton && P.value ? (g(), w("button", { key: 3, class: y(`${_e.value} ${Ae.value ? "opacity-50 cursor-not-allowed" : ""}`), disabled: Ae.value, onClick: $t, onMouseenter: e[13] || (e[13] = (l) => S(l, J.value ? h(f)("common.minimize") || "Minimize" : h(f)("common.open") || "Open")), onFocus: e[14] || (e[14] = (l) => S(l, J.value ? h(f)("common.minimize") || "Minimize" : h(f)("common.open") || "Open")), onMouseleave: T, onBlur: T }, [J.value ? (g(), w("svg", yl, [...e[28] || (e[28] = [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6" }, null, -1)])])) : (g(), w("svg", wl, [...e[27] || (e[27] = [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6" }, null, -1)])]))], 42, pl)) : Q("", !0)]))], 2)) : Q("", !0), Ht(n("div", { ref_key: "modeContainerRef", ref: et }, [E.value ? (g(), w("div", { key: 0, class: y(["p-4", o.isDark ? "bg-gray-900" : "bg-gray-50"]) }, [n("pre", { class: y(["text-sm font-mono whitespace-pre-wrap", o.isDark ? "text-gray-300" : "text-gray-700"]) }, xe(R.value), 3)], 2)) : (g(), w("div", xl, [o.showZoomControls ? (g(), w("div", kl, [n("div", bl, [n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: vt, onMouseenter: e[15] || (e[15] = (l) => S(l, h(f)("common.zoomIn") || "Zoom in")), onFocus: e[16] || (e[16] = (l) => S(l, h(f)("common.zoomIn") || "Zoom in")), onMouseleave: T, onBlur: T }, [...e[29] || (e[29] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("circle", { cx: "11", cy: "11", r: "8" }), n("path", { d: "m21 21l-4.35-4.35M11 8v6m-3-3h6" })])], -1)])], 34), n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: mt, onMouseenter: e[17] || (e[17] = (l) => S(l, h(f)("common.zoomOut") || "Zoom out")), onFocus: e[18] || (e[18] = (l) => S(l, h(f)("common.zoomOut") || "Zoom out")), onMouseleave: T, onBlur: T }, [...e[30] || (e[30] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("circle", { cx: "11", cy: "11", r: "8" }), n("path", { d: "m21 21l-4.35-4.35M8 11h6" })])], -1)])], 34), n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: ft, onMouseenter: e[19] || (e[19] = (l) => S(l, h(f)("common.resetZoom") || "Reset zoom")), onFocus: e[20] || (e[20] = (l) => S(l, h(f)("common.resetZoom") || "Reset zoom")), onMouseleave: T, onBlur: T }, xe(Math.round(100 * x.value)) + "% ", 35)])])) : Q("", !0), n("div", xt({ ref_key: "mermaidContainer", ref: Z, class: ["min-h-[360px] relative transition-all duration-100 overflow-hidden block", o.isDark ? "bg-gray-900" : "bg-gray-50"], style: { height: W.value } }, kt(nt.value, !0), { onMousedown: Fe, onMousemove: He, onMouseup: ve, onMouseleave: ve, onTouchstartPassive: Fe, onTouchmovePassive: He, onTouchendPassive: ve }), [n("div", { "data-mermaid-wrapper": "", class: y(["absolute inset-0 cursor-grab", { "cursor-grabbing": Be.value }]), style: yt(Ie.value) }, [n("div", { ref_key: "mermaidContent", ref: u, class: "_mermaid w-full text-center flex items-center justify-center min-h-full" }, null, 512)], 6)], 16), (g(), Rt(Nt, { to: "body" }, [n("div", Ml, [_t(Xt, { name: "mermaid-dialog", appear: "" }, { default: Yt(() => [J.value ? (g(), w("div", { key: 0, class: "fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4", onClick: Vt(Ue, ["self"]) }, [n("div", { class: y(["dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden", o.isDark ? "bg-gray-900" : "bg-white"]) }, [n("div", Tl, [n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: vt }, [...e[31] || (e[31] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("circle", { cx: "11", cy: "11", r: "8" }), n("path", { d: "m21 21l-4.35-4.35M11 8v6m-3-3h6" })])], -1)])], 2), n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: mt }, [...e[32] || (e[32] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" }, [n("circle", { cx: "11", cy: "11", r: "8" }), n("path", { d: "m21 21l-4.35-4.35M8 11h6" })])], -1)])], 2), n("button", { class: y(["p-2 text-xs rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: ft }, xe(Math.round(100 * x.value)) + "% ", 3), n("button", { class: y(["inline-flex items-center justify-center p-2 rounded transition-colors", [o.isDark ? "text-gray-400 hover:bg-gray-700" : "text-gray-600 hover:bg-gray-200"]]), onClick: Ue }, [...e[33] || (e[33] = [n("svg", { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "1em", height: "1em", viewBox: "0 0 24 24", class: "w-3 h-3" }, [n("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M18 6L6 18M6 6l12 12" })], -1)])], 2)]), n("div", xt({ ref_key: "modalContent", ref: ae, class: "w-full h-full flex items-center justify-center p-4 overflow-hidden" }, kt(nt.value, !0), { onMousedown: Fe, onMousemove: He, onMouseup: ve, onMouseleave: ve, onTouchstartPassive: Fe, onTouchmovePassive: He, onTouchendPassive: ve }), null, 16)], 2)])) : Q("", !0)]), _: 1 })])]))]))], 512), [[Zt, !V.value]])], 2));
584
- } }), [["__scopeId", "data-v-51607788"]]);
585
- Qe.install = (L) => {
586
- L.component(Qe.__name, Qe);
587
- };
588
- export {
589
- Qe as default
590
- };