n8n-editor-ui 1.66.0 → 1.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/assets/{AuthView-31vu0x_3.js → AuthView-C7b2xzS9.js} +17 -19
  2. package/dist/assets/CanvasChat-DKeWqqZz.css +730 -0
  3. package/dist/assets/CanvasChat-QctJb8ta.js +4166 -0
  4. package/dist/assets/{CanvasControls-DkT1iClJ.js → CanvasControls-raoYims4.js} +1 -1
  5. package/dist/assets/{ChangePasswordView-DkhZAh4j.js → ChangePasswordView-BBju88Nm.js} +2 -2
  6. package/dist/assets/CollectionParameter-DNJAimAt.js +4 -0
  7. package/dist/assets/{CredentialsView-Du-lMwPW.js → CredentialsView-BfYXjOVw.js} +11 -10
  8. package/dist/assets/{ErrorView-CROJIl1H.js → ErrorView-BhPrjw7c.js} +1 -1
  9. package/dist/assets/{ExecutionsFilter-BecTg03r.css → ExecutionsTime-DVxRt-Pz.css} +6 -6
  10. package/dist/assets/{ExecutionsFilter-132FKb5o.js → ExecutionsTime.vue_vue_type_script_setup_true_lang-Ba-at9rw.js} +43 -43
  11. package/dist/assets/{ExecutionsView-B41cgHPD.js → ExecutionsView-Dcw07XZ-.js} +26 -31
  12. package/dist/assets/{ExecutionsView-Dfy6JMwb.css → ExecutionsView-DlxsqdiC.css} +44 -38
  13. package/dist/assets/{FileSaver.min-B3lWZPMp.js → FileSaver.min-CKlTVpWB.js} +1 -1
  14. package/dist/assets/FixedCollectionParameter-CkI6mCZG.js +334 -0
  15. package/dist/assets/{FixedCollectionParameter-fI2wTyfY.css → FixedCollectionParameter-DzOGMEdq.css} +10 -10
  16. package/dist/assets/{ForgotMyPasswordView-DKrE7dUn.js → ForgotMyPasswordView--eKPrTSW.js} +4 -3
  17. package/dist/assets/{MainHeader-CW31WCmm.js → MainHeader-Btek9DoL.js} +195 -118
  18. package/dist/assets/{MainHeader-Bc5G9_Uq.css → MainHeader-DJdd17Nh.css} +36 -11
  19. package/dist/assets/{MainSidebar-cNW0UJBC.css → MainSidebar-BRYJRpOA.css} +2 -2
  20. package/dist/assets/{MainSidebar-Dny90RtO.js → MainSidebar-CRjg4yDv.js} +7 -13
  21. package/dist/assets/{NodeCreation-BqSkxffS.js → NodeCreation-CDpNw3BL.js} +14 -11
  22. package/dist/assets/{NodeCreator-CoqcSKC-.js → NodeCreator-DPpQXLHf.js} +79 -65
  23. package/dist/assets/{NodeViewSwitcher-C1Gp-jKb.js → NodeViewSwitcher-CNfOOUof.js} +2891 -2905
  24. package/dist/assets/{NodeViewSwitcher-B8VPj4Rs.css → NodeViewSwitcher-DuVIKqpm.css} +185 -184
  25. package/dist/assets/{ProjectCardBadge-kHyKG50e.js → ProjectCardBadge-DzaTsr93.js} +1 -1
  26. package/dist/assets/{ResourceListHeader-DgE1VPUF.css → ProjectHeader-09VQWBZH.css} +5 -3
  27. package/dist/assets/ProjectHeader-wdvHJxbT.js +196 -0
  28. package/dist/assets/{ProjectSettings-BohhQ-z6.js → ProjectSettings-B6j0VJK5.js} +7 -36
  29. package/dist/assets/PushConnectionTracker.vue_vue_type_script_setup_true_lang-ByoMju5L.js +39 -0
  30. package/dist/assets/ResourcesListLayout-9Vpyt6Ec.js +662 -0
  31. package/dist/assets/{ResourcesListLayout-Bw99IFlO.css → ResourcesListLayout-CuA8O7do.css} +8 -8
  32. package/dist/assets/{RunDataJson-CUsbBWaI.js → RunDataJson-sPhT7c2h.js} +12 -12
  33. package/dist/assets/{RunDataJsonActions-Bnn0o9WH.js → RunDataJsonActions-DiMvLis_.js} +128 -159
  34. package/dist/assets/{RunDataSearch-BiygytJ8.js → RunDataSearch-CF_rpBKx.js} +2 -2
  35. package/dist/assets/RunDataTable-T52TXUHR.js +564 -0
  36. package/dist/assets/{SamlOnboarding-BXYS2fQg.js → SamlOnboarding-BCn53xtf.js} +2 -2
  37. package/dist/assets/SettingsApiView-DumvK072.js +227 -0
  38. package/dist/assets/{SettingsCommunityNodesView-BjakfOB1.js → SettingsCommunityNodesView-Db787Jar.js} +185 -195
  39. package/dist/assets/{SettingsExternalSecrets-BGIt9OQy.js → SettingsExternalSecrets-DKB2o2Dq.js} +3 -3
  40. package/dist/assets/{SettingsLdapView-DBY4YyYE.js → SettingsLdapView-BoKoCT5V.js} +3 -3
  41. package/dist/assets/SettingsLogStreamingView-BGX39Unz.js +500 -0
  42. package/dist/assets/{SettingsPersonalView-CgzznKXi.js → SettingsPersonalView-fTCeSJfu.js} +1 -1
  43. package/dist/assets/{SettingsSourceControl-DNWFyNrX.js → SettingsSourceControl-_G83P363.js} +3 -3
  44. package/dist/assets/{SettingsSso-B8oke872.js → SettingsSso-Bn48qAiX.js} +3 -3
  45. package/dist/assets/{SettingsUsageAndPlan-BUUYApK_.js → SettingsUsageAndPlan-DZkS0RP4.js} +4 -3
  46. package/dist/assets/{SettingsUsageAndPlan-P6SS2mWq.css → SettingsUsageAndPlan-vijI-va0.css} +3 -3
  47. package/dist/assets/{SettingsUsersView-DyuP8V6k.js → SettingsUsersView-BUh2iKEW.js} +4 -3
  48. package/dist/assets/{SettingsView-CD83Adan.js → SettingsView-D_S4x7XG.js} +2 -30
  49. package/dist/assets/{SetupView-C8XYMj2N.js → SetupView-BenKVU0l.js} +2 -2
  50. package/dist/assets/{SetupWorkflowCredentialsButton-u1qhjj5K.js → SetupWorkflowCredentialsButton-DKr9ZPLE.js} +1 -1
  51. package/dist/assets/{SetupWorkflowFromTemplateView-DdxqCGcl.js → SetupWorkflowFromTemplateView-Ce1R_CDh.js} +3 -3
  52. package/dist/assets/{SigninView-CGQ20O_c.js → SigninView-xl5aJqka.js} +4 -3
  53. package/dist/assets/{SignoutView-BZwBBglt.js → SignoutView-Bscz6u1Y.js} +1 -1
  54. package/dist/assets/{SignupView-BCT6dhhZ.js → SignupView-CZN8EhJV.js} +4 -3
  55. package/dist/assets/TemplateDetails-BAQ3vBNJ.js +179 -0
  56. package/dist/assets/TemplateList-DD7sqnpI.js +371 -0
  57. package/dist/assets/{TemplatesCollectionView-BxBSljqH.js → TemplatesCollectionView-CG3ZoY8i.js} +10 -10
  58. package/dist/assets/{TemplatesSearchView-kFcPH-ZH.js → TemplatesSearchView-22jrqI8X.js} +530 -577
  59. package/dist/assets/{TemplatesView-TPTpSdeD.js → TemplatesView-BZFc4hZ1.js} +32 -37
  60. package/dist/assets/{TemplatesWorkflowView-8NdGLWj7.js → TemplatesWorkflowView-DkXtdhUJ.js} +5 -5
  61. package/dist/assets/{VariablesView-CHXdt5-z.css → VariablesView-BPKo50HJ.css} +18 -18
  62. package/dist/assets/{VariablesView-C1NxBxBQ.js → VariablesView-DHu4ZoMN.js} +5 -5
  63. package/dist/assets/WorkerView-BfxdQiAc.js +148 -0
  64. package/dist/assets/WorkerView-Dm0b18Mh.css +22 -0
  65. package/dist/assets/{WorkflowActivator-CalsATsI.js → WorkflowActivator-CvdQVEtW.js} +2 -2
  66. package/dist/assets/{WorkflowExecutionsInfoAccordion-rUnvuY-5.js → WorkflowExecutionsInfoAccordion-D2GFnpq1.js} +1 -1
  67. package/dist/assets/{WorkflowExecutionsLandingPage-C4K7kfqv.js → WorkflowExecutionsLandingPage-D2bvAsxg.js} +2 -2
  68. package/dist/assets/{WorkflowExecutionsPreview-BO31AO7v.js → WorkflowExecutionsPreview-D6WBsbAG.js} +5 -5
  69. package/dist/assets/{WorkflowExecutionsView-B8x2-iOd.css → WorkflowExecutionsView-CZKkPKqJ.css} +9 -1
  70. package/dist/assets/{WorkflowExecutionsView-B-5zbx_n.js → WorkflowExecutionsView-DI6r5OvZ.js} +6 -6
  71. package/dist/assets/{WorkflowHistory-uvlFDwTJ.js → WorkflowHistory-Dc1f2Tsn.js} +5 -4
  72. package/dist/assets/{WorkflowOnboardingView-B869wGVb.js → WorkflowOnboardingView-DyxvWfZ7.js} +1 -1
  73. package/dist/assets/{WorkflowPreview-BlzWpiO1.js → WorkflowPreview-hC6wSe-Y.js} +1 -1
  74. package/dist/assets/{WorkflowsView-IdgMnIZY.js → WorkflowsView-SIDgO47b.js} +10 -10
  75. package/dist/assets/buttons.esm-BOkmSohe.js +477 -0
  76. package/dist/assets/{dateFormatter-BCrxaIdG.js → dateFormatter-BRi2wSZ-.js} +1 -1
  77. package/dist/assets/{index-QAq8Sa9R.js → index-40I5DMGP.js} +196843 -202970
  78. package/dist/assets/{index-DaeOVPzE.css → index-Dr3zFZlC.css} +136 -594
  79. package/dist/assets/{pushConnection.store-Cdssd0uJ.js → pushConnection.store-w_WxpOeH.js} +1 -1
  80. package/dist/assets/{templateActions-ClPy1BRa.js → templateActions-D4EHdA9n.js} +1 -1
  81. package/dist/assets/{useBugReporting-Bvr7bSQt.js → useBugReporting-CFOQlQpP.js} +1 -1
  82. package/dist/assets/{useExecutionDebugging-CwyVwJqO.js → useExecutionDebugging-LQQWXhPj.js} +3 -2
  83. package/dist/assets/{AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-CYMqjryg.js → useExecutionHelpers-CXGl_HIp.js} +55 -55
  84. package/dist/assets/{useNodeViewVersionSwitcher-BPNKvsXw.js → useNodeViewVersionSwitcher-BLo5Qp-N.js} +1 -1
  85. package/dist/assets/{usePushConnection-DDXmzoG8.js → usePushConnection-B5ija5f5.js} +9 -10
  86. package/dist/assets/{RunDataAi-x30tU8-0.css → useRunWorkflow-DH7ZzA8t.css} +97 -57
  87. package/dist/assets/useRunWorkflow-MrEKURG4.js +3710 -0
  88. package/dist/assets/{useWorkflowActivate-DKPQP7qy.js → useWorkflowActivate-CKedJlgZ.js} +1 -1
  89. package/dist/index.html +3 -2
  90. package/index.html +1 -0
  91. package/package.json +1 -1
  92. package/vite.config.mts +1 -17
  93. package/dist/assets/CollectionParameter-BDKfoIMJ.js +0 -4
  94. package/dist/assets/FixedCollectionParameter-DXh-j7zB.js +0 -355
  95. package/dist/assets/ProjectTabs-D-87NPFl.js +0 -88
  96. package/dist/assets/ProjectTabs-DjoIePoM.css +0 -3
  97. package/dist/assets/PushConnectionTracker-Bhnghrmf.js +0 -38
  98. package/dist/assets/ResourceListHeader-Bs6GLg32.js +0 -66
  99. package/dist/assets/ResourcesListLayout-ByBNP70B.js +0 -800
  100. package/dist/assets/RunDataAi-CYTNyRq_.js +0 -1539
  101. package/dist/assets/RunDataTable--RIqj8DU.js +0 -608
  102. package/dist/assets/SettingsApiView-DoibCiLo.js +0 -255
  103. package/dist/assets/SettingsFakeDoorView-DpKZ4qWG.css +0 -14
  104. package/dist/assets/SettingsFakeDoorView-DwXDXgon.js +0 -44
  105. package/dist/assets/SettingsLogStreamingView-DHQWns6I.js +0 -519
  106. package/dist/assets/TemplateDetails-BsLVCpdi.js +0 -199
  107. package/dist/assets/TemplateList-Bn7ePHhc.js +0 -433
  108. package/dist/assets/WorkerView-Bj1cvzLg.js +0 -825
  109. package/dist/assets/WorkerView-C_d54L0W.css +0 -181
  110. package/dist/assets/cloud-B6bxVT9F.js +0 -37
@@ -0,0 +1,4166 @@
1
+ import { aN as inject, aO as isRef, c as openBlock, h as createElementBlock, j as createBaseVNode, d as defineComponent, p as computed, i as createVNode, A as unref, t as toDisplayString, I as withModifiers, e as createBlock, f as createCommentVNode, _ as _export_sfc, aP as toRefs, r as ref, o as onMounted, q as renderSlot, aQ as normalizeProps, aR as guardReactiveProps, aS as mergeProps, aT as resolveDynamicComponent, aU as VueMarkdown, F as Fragment, z as renderList, n as normalizeClass, aV as markdownLink, aW as useFileDialog, aX as onUnmounted, aw as withDirectives, aY as vModelText, G as withKeys, B as normalizeStyle, w as withCtx, H as watch, l as resolveComponent, k as createTextVNode, aZ as useClipboard, a as useToast, g as useI18n$1, ae as MODAL_CONFIRM, al as useMessage, a_ as CHAT_TRIGGER_NODE_TYPE, a$ as MANUAL_CHAT_TRIGGER_NODE_TYPE, b0 as CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE, b1 as AI_SUBCATEGORY, b2 as AI_CATEGORY_AGENTS, b3 as AI_CATEGORY_CHAINS, b4 as AI_CODE_NODE_TYPE, b5 as getNodeInputs, b6 as getConnectionTypes, b7 as getNodeOutputs, b8 as NodeConnectionType, b9 as get, ba as v4, bb as isEmpty, bc as last, bd as CHAT_TRIGGER_NODE_TYPE$1, aE as useStorage, be as watchEffect, v as onBeforeUnmount, J as useDebounce, T as useWorkflowsStore, K as useUIStore, $ as useCanvasStore, bf as useNodeTypesStore, bg as useNodeHelpers, b as useRouter, V as VIEWS, bh as provide } from "./index-40I5DMGP.js";
2
+ import { H as HighlightJS, R as RunDataAi, u as usePinnedData, a as useRunWorkflow } from "./useRunWorkflow-MrEKURG4.js";
3
+ const ChatSymbol = "Chat";
4
+ const ChatOptionsSymbol = "ChatOptions";
5
+ function createEventBus() {
6
+ const handlers = /* @__PURE__ */ new Map();
7
+ function off(eventName, fn) {
8
+ const eventFns = handlers.get(eventName);
9
+ if (eventFns) {
10
+ eventFns.splice(eventFns.indexOf(fn) >>> 0, 1);
11
+ }
12
+ }
13
+ function on(eventName, fn) {
14
+ let eventFns = handlers.get(eventName);
15
+ if (!eventFns) {
16
+ eventFns = [fn];
17
+ } else {
18
+ eventFns.push(fn);
19
+ }
20
+ handlers.set(eventName, eventFns);
21
+ return () => off(eventName, fn);
22
+ }
23
+ function emit(eventName, event) {
24
+ const eventFns = handlers.get(eventName);
25
+ if (eventFns) {
26
+ eventFns.slice().forEach(async (handler) => {
27
+ await handler(event);
28
+ });
29
+ }
30
+ }
31
+ return {
32
+ on,
33
+ off,
34
+ emit
35
+ };
36
+ }
37
+ const chatEventBus = createEventBus();
38
+ function bash(hljs) {
39
+ const regex = hljs.regex;
40
+ const VAR = {};
41
+ const BRACED_VAR = {
42
+ begin: /\$\{/,
43
+ end: /\}/,
44
+ contains: [
45
+ "self",
46
+ {
47
+ begin: /:-/,
48
+ contains: [VAR]
49
+ }
50
+ // default values
51
+ ]
52
+ };
53
+ Object.assign(VAR, {
54
+ className: "variable",
55
+ variants: [
56
+ { begin: regex.concat(
57
+ /\$[\w\d#@][\w\d_]*/,
58
+ // negative look-ahead tries to avoid matching patterns that are not
59
+ // Perl at all like $ident$, @ident@, etc.
60
+ `(?![\\w\\d])(?![$])`
61
+ ) },
62
+ BRACED_VAR
63
+ ]
64
+ });
65
+ const SUBST = {
66
+ className: "subst",
67
+ begin: /\$\(/,
68
+ end: /\)/,
69
+ contains: [hljs.BACKSLASH_ESCAPE]
70
+ };
71
+ const HERE_DOC = {
72
+ begin: /<<-?\s*(?=\w+)/,
73
+ starts: { contains: [
74
+ hljs.END_SAME_AS_BEGIN({
75
+ begin: /(\w+)/,
76
+ end: /(\w+)/,
77
+ className: "string"
78
+ })
79
+ ] }
80
+ };
81
+ const QUOTE_STRING = {
82
+ className: "string",
83
+ begin: /"/,
84
+ end: /"/,
85
+ contains: [
86
+ hljs.BACKSLASH_ESCAPE,
87
+ VAR,
88
+ SUBST
89
+ ]
90
+ };
91
+ SUBST.contains.push(QUOTE_STRING);
92
+ const ESCAPED_QUOTE = {
93
+ match: /\\"/
94
+ };
95
+ const APOS_STRING = {
96
+ className: "string",
97
+ begin: /'/,
98
+ end: /'/
99
+ };
100
+ const ESCAPED_APOS = {
101
+ match: /\\'/
102
+ };
103
+ const ARITHMETIC = {
104
+ begin: /\$?\(\(/,
105
+ end: /\)\)/,
106
+ contains: [
107
+ {
108
+ begin: /\d+#[0-9a-f]+/,
109
+ className: "number"
110
+ },
111
+ hljs.NUMBER_MODE,
112
+ VAR
113
+ ]
114
+ };
115
+ const SH_LIKE_SHELLS = [
116
+ "fish",
117
+ "bash",
118
+ "zsh",
119
+ "sh",
120
+ "csh",
121
+ "ksh",
122
+ "tcsh",
123
+ "dash",
124
+ "scsh"
125
+ ];
126
+ const KNOWN_SHEBANG = hljs.SHEBANG({
127
+ binary: `(${SH_LIKE_SHELLS.join("|")})`,
128
+ relevance: 10
129
+ });
130
+ const FUNCTION = {
131
+ className: "function",
132
+ begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/,
133
+ returnBegin: true,
134
+ contains: [hljs.inherit(hljs.TITLE_MODE, { begin: /\w[\w\d_]*/ })],
135
+ relevance: 0
136
+ };
137
+ const KEYWORDS2 = [
138
+ "if",
139
+ "then",
140
+ "else",
141
+ "elif",
142
+ "fi",
143
+ "for",
144
+ "while",
145
+ "until",
146
+ "in",
147
+ "do",
148
+ "done",
149
+ "case",
150
+ "esac",
151
+ "function",
152
+ "select"
153
+ ];
154
+ const LITERALS2 = [
155
+ "true",
156
+ "false"
157
+ ];
158
+ const PATH_MODE = { match: /(\/[a-z._-]+)+/ };
159
+ const SHELL_BUILT_INS = [
160
+ "break",
161
+ "cd",
162
+ "continue",
163
+ "eval",
164
+ "exec",
165
+ "exit",
166
+ "export",
167
+ "getopts",
168
+ "hash",
169
+ "pwd",
170
+ "readonly",
171
+ "return",
172
+ "shift",
173
+ "test",
174
+ "times",
175
+ "trap",
176
+ "umask",
177
+ "unset"
178
+ ];
179
+ const BASH_BUILT_INS = [
180
+ "alias",
181
+ "bind",
182
+ "builtin",
183
+ "caller",
184
+ "command",
185
+ "declare",
186
+ "echo",
187
+ "enable",
188
+ "help",
189
+ "let",
190
+ "local",
191
+ "logout",
192
+ "mapfile",
193
+ "printf",
194
+ "read",
195
+ "readarray",
196
+ "source",
197
+ "type",
198
+ "typeset",
199
+ "ulimit",
200
+ "unalias"
201
+ ];
202
+ const ZSH_BUILT_INS = [
203
+ "autoload",
204
+ "bg",
205
+ "bindkey",
206
+ "bye",
207
+ "cap",
208
+ "chdir",
209
+ "clone",
210
+ "comparguments",
211
+ "compcall",
212
+ "compctl",
213
+ "compdescribe",
214
+ "compfiles",
215
+ "compgroups",
216
+ "compquote",
217
+ "comptags",
218
+ "comptry",
219
+ "compvalues",
220
+ "dirs",
221
+ "disable",
222
+ "disown",
223
+ "echotc",
224
+ "echoti",
225
+ "emulate",
226
+ "fc",
227
+ "fg",
228
+ "float",
229
+ "functions",
230
+ "getcap",
231
+ "getln",
232
+ "history",
233
+ "integer",
234
+ "jobs",
235
+ "kill",
236
+ "limit",
237
+ "log",
238
+ "noglob",
239
+ "popd",
240
+ "print",
241
+ "pushd",
242
+ "pushln",
243
+ "rehash",
244
+ "sched",
245
+ "setcap",
246
+ "setopt",
247
+ "stat",
248
+ "suspend",
249
+ "ttyctl",
250
+ "unfunction",
251
+ "unhash",
252
+ "unlimit",
253
+ "unsetopt",
254
+ "vared",
255
+ "wait",
256
+ "whence",
257
+ "where",
258
+ "which",
259
+ "zcompile",
260
+ "zformat",
261
+ "zftp",
262
+ "zle",
263
+ "zmodload",
264
+ "zparseopts",
265
+ "zprof",
266
+ "zpty",
267
+ "zregexparse",
268
+ "zsocket",
269
+ "zstyle",
270
+ "ztcp"
271
+ ];
272
+ const GNU_CORE_UTILS = [
273
+ "chcon",
274
+ "chgrp",
275
+ "chown",
276
+ "chmod",
277
+ "cp",
278
+ "dd",
279
+ "df",
280
+ "dir",
281
+ "dircolors",
282
+ "ln",
283
+ "ls",
284
+ "mkdir",
285
+ "mkfifo",
286
+ "mknod",
287
+ "mktemp",
288
+ "mv",
289
+ "realpath",
290
+ "rm",
291
+ "rmdir",
292
+ "shred",
293
+ "sync",
294
+ "touch",
295
+ "truncate",
296
+ "vdir",
297
+ "b2sum",
298
+ "base32",
299
+ "base64",
300
+ "cat",
301
+ "cksum",
302
+ "comm",
303
+ "csplit",
304
+ "cut",
305
+ "expand",
306
+ "fmt",
307
+ "fold",
308
+ "head",
309
+ "join",
310
+ "md5sum",
311
+ "nl",
312
+ "numfmt",
313
+ "od",
314
+ "paste",
315
+ "ptx",
316
+ "pr",
317
+ "sha1sum",
318
+ "sha224sum",
319
+ "sha256sum",
320
+ "sha384sum",
321
+ "sha512sum",
322
+ "shuf",
323
+ "sort",
324
+ "split",
325
+ "sum",
326
+ "tac",
327
+ "tail",
328
+ "tr",
329
+ "tsort",
330
+ "unexpand",
331
+ "uniq",
332
+ "wc",
333
+ "arch",
334
+ "basename",
335
+ "chroot",
336
+ "date",
337
+ "dirname",
338
+ "du",
339
+ "echo",
340
+ "env",
341
+ "expr",
342
+ "factor",
343
+ // "false", // keyword literal already
344
+ "groups",
345
+ "hostid",
346
+ "id",
347
+ "link",
348
+ "logname",
349
+ "nice",
350
+ "nohup",
351
+ "nproc",
352
+ "pathchk",
353
+ "pinky",
354
+ "printenv",
355
+ "printf",
356
+ "pwd",
357
+ "readlink",
358
+ "runcon",
359
+ "seq",
360
+ "sleep",
361
+ "stat",
362
+ "stdbuf",
363
+ "stty",
364
+ "tee",
365
+ "test",
366
+ "timeout",
367
+ // "true", // keyword literal already
368
+ "tty",
369
+ "uname",
370
+ "unlink",
371
+ "uptime",
372
+ "users",
373
+ "who",
374
+ "whoami",
375
+ "yes"
376
+ ];
377
+ return {
378
+ name: "Bash",
379
+ aliases: ["sh"],
380
+ keywords: {
381
+ $pattern: /\b[a-z][a-z0-9._-]+\b/,
382
+ keyword: KEYWORDS2,
383
+ literal: LITERALS2,
384
+ built_in: [
385
+ ...SHELL_BUILT_INS,
386
+ ...BASH_BUILT_INS,
387
+ // Shell modifiers
388
+ "set",
389
+ "shopt",
390
+ ...ZSH_BUILT_INS,
391
+ ...GNU_CORE_UTILS
392
+ ]
393
+ },
394
+ contains: [
395
+ KNOWN_SHEBANG,
396
+ // to catch known shells and boost relevancy
397
+ hljs.SHEBANG(),
398
+ // to catch unknown shells but still highlight the shebang
399
+ FUNCTION,
400
+ ARITHMETIC,
401
+ hljs.HASH_COMMENT_MODE,
402
+ HERE_DOC,
403
+ PATH_MODE,
404
+ QUOTE_STRING,
405
+ ESCAPED_QUOTE,
406
+ APOS_STRING,
407
+ ESCAPED_APOS,
408
+ VAR
409
+ ]
410
+ };
411
+ }
412
+ const IDENT_RE$1 = "[A-Za-z$_][0-9A-Za-z$_]*";
413
+ const KEYWORDS$1 = [
414
+ "as",
415
+ // for exports
416
+ "in",
417
+ "of",
418
+ "if",
419
+ "for",
420
+ "while",
421
+ "finally",
422
+ "var",
423
+ "new",
424
+ "function",
425
+ "do",
426
+ "return",
427
+ "void",
428
+ "else",
429
+ "break",
430
+ "catch",
431
+ "instanceof",
432
+ "with",
433
+ "throw",
434
+ "case",
435
+ "default",
436
+ "try",
437
+ "switch",
438
+ "continue",
439
+ "typeof",
440
+ "delete",
441
+ "let",
442
+ "yield",
443
+ "const",
444
+ "class",
445
+ // JS handles these with a special rule
446
+ // "get",
447
+ // "set",
448
+ "debugger",
449
+ "async",
450
+ "await",
451
+ "static",
452
+ "import",
453
+ "from",
454
+ "export",
455
+ "extends"
456
+ ];
457
+ const LITERALS$1 = [
458
+ "true",
459
+ "false",
460
+ "null",
461
+ "undefined",
462
+ "NaN",
463
+ "Infinity"
464
+ ];
465
+ const TYPES$1 = [
466
+ // Fundamental objects
467
+ "Object",
468
+ "Function",
469
+ "Boolean",
470
+ "Symbol",
471
+ // numbers and dates
472
+ "Math",
473
+ "Date",
474
+ "Number",
475
+ "BigInt",
476
+ // text
477
+ "String",
478
+ "RegExp",
479
+ // Indexed collections
480
+ "Array",
481
+ "Float32Array",
482
+ "Float64Array",
483
+ "Int8Array",
484
+ "Uint8Array",
485
+ "Uint8ClampedArray",
486
+ "Int16Array",
487
+ "Int32Array",
488
+ "Uint16Array",
489
+ "Uint32Array",
490
+ "BigInt64Array",
491
+ "BigUint64Array",
492
+ // Keyed collections
493
+ "Set",
494
+ "Map",
495
+ "WeakSet",
496
+ "WeakMap",
497
+ // Structured data
498
+ "ArrayBuffer",
499
+ "SharedArrayBuffer",
500
+ "Atomics",
501
+ "DataView",
502
+ "JSON",
503
+ // Control abstraction objects
504
+ "Promise",
505
+ "Generator",
506
+ "GeneratorFunction",
507
+ "AsyncFunction",
508
+ // Reflection
509
+ "Reflect",
510
+ "Proxy",
511
+ // Internationalization
512
+ "Intl",
513
+ // WebAssembly
514
+ "WebAssembly"
515
+ ];
516
+ const ERROR_TYPES$1 = [
517
+ "Error",
518
+ "EvalError",
519
+ "InternalError",
520
+ "RangeError",
521
+ "ReferenceError",
522
+ "SyntaxError",
523
+ "TypeError",
524
+ "URIError"
525
+ ];
526
+ const BUILT_IN_GLOBALS$1 = [
527
+ "setInterval",
528
+ "setTimeout",
529
+ "clearInterval",
530
+ "clearTimeout",
531
+ "require",
532
+ "exports",
533
+ "eval",
534
+ "isFinite",
535
+ "isNaN",
536
+ "parseFloat",
537
+ "parseInt",
538
+ "decodeURI",
539
+ "decodeURIComponent",
540
+ "encodeURI",
541
+ "encodeURIComponent",
542
+ "escape",
543
+ "unescape"
544
+ ];
545
+ const BUILT_IN_VARIABLES$1 = [
546
+ "arguments",
547
+ "this",
548
+ "super",
549
+ "console",
550
+ "window",
551
+ "document",
552
+ "localStorage",
553
+ "sessionStorage",
554
+ "module",
555
+ "global"
556
+ // Node.js
557
+ ];
558
+ const BUILT_INS$1 = [].concat(
559
+ BUILT_IN_GLOBALS$1,
560
+ TYPES$1,
561
+ ERROR_TYPES$1
562
+ );
563
+ function javascript$1(hljs) {
564
+ const regex = hljs.regex;
565
+ const hasClosingTag = (match, { after }) => {
566
+ const tag = "</" + match[0].slice(1);
567
+ const pos = match.input.indexOf(tag, after);
568
+ return pos !== -1;
569
+ };
570
+ const IDENT_RE$1$1 = IDENT_RE$1;
571
+ const FRAGMENT = {
572
+ begin: "<>",
573
+ end: "</>"
574
+ };
575
+ const XML_SELF_CLOSING = /<[A-Za-z0-9\\._:-]+\s*\/>/;
576
+ const XML_TAG = {
577
+ begin: /<[A-Za-z0-9\\._:-]+/,
578
+ end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
579
+ /**
580
+ * @param {RegExpMatchArray} match
581
+ * @param {CallbackResponse} response
582
+ */
583
+ isTrulyOpeningTag: (match, response) => {
584
+ const afterMatchIndex = match[0].length + match.index;
585
+ const nextChar = match.input[afterMatchIndex];
586
+ if (
587
+ // HTML should not include another raw `<` inside a tag
588
+ // nested type?
589
+ // `<Array<Array<number>>`, etc.
590
+ nextChar === "<" || // the , gives away that this is not HTML
591
+ // `<T, A extends keyof T, V>`
592
+ nextChar === ","
593
+ ) {
594
+ response.ignoreMatch();
595
+ return;
596
+ }
597
+ if (nextChar === ">") {
598
+ if (!hasClosingTag(match, { after: afterMatchIndex })) {
599
+ response.ignoreMatch();
600
+ }
601
+ }
602
+ let m;
603
+ const afterMatch = match.input.substring(afterMatchIndex);
604
+ if (m = afterMatch.match(/^\s*=/)) {
605
+ response.ignoreMatch();
606
+ return;
607
+ }
608
+ if (m = afterMatch.match(/^\s+extends\s+/)) {
609
+ if (m.index === 0) {
610
+ response.ignoreMatch();
611
+ return;
612
+ }
613
+ }
614
+ }
615
+ };
616
+ const KEYWORDS$1$1 = {
617
+ $pattern: IDENT_RE$1,
618
+ keyword: KEYWORDS$1,
619
+ literal: LITERALS$1,
620
+ built_in: BUILT_INS$1,
621
+ "variable.language": BUILT_IN_VARIABLES$1
622
+ };
623
+ const decimalDigits = "[0-9](_?[0-9])*";
624
+ const frac = `\\.(${decimalDigits})`;
625
+ const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;
626
+ const NUMBER = {
627
+ className: "number",
628
+ variants: [
629
+ // DecimalLiteral
630
+ { begin: `(\\b(${decimalInteger})((${frac})|\\.)?|(${frac}))[eE][+-]?(${decimalDigits})\\b` },
631
+ { begin: `\\b(${decimalInteger})\\b((${frac})\\b|\\.)?|(${frac})\\b` },
632
+ // DecimalBigIntegerLiteral
633
+ { begin: `\\b(0|[1-9](_?[0-9])*)n\\b` },
634
+ // NonDecimalIntegerLiteral
635
+ { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" },
636
+ { begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" },
637
+ { begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" },
638
+ // LegacyOctalIntegerLiteral (does not include underscore separators)
639
+ // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
640
+ { begin: "\\b0[0-7]+n?\\b" }
641
+ ],
642
+ relevance: 0
643
+ };
644
+ const SUBST = {
645
+ className: "subst",
646
+ begin: "\\$\\{",
647
+ end: "\\}",
648
+ keywords: KEYWORDS$1$1,
649
+ contains: []
650
+ // defined later
651
+ };
652
+ const HTML_TEMPLATE = {
653
+ begin: "html`",
654
+ end: "",
655
+ starts: {
656
+ end: "`",
657
+ returnEnd: false,
658
+ contains: [
659
+ hljs.BACKSLASH_ESCAPE,
660
+ SUBST
661
+ ],
662
+ subLanguage: "xml"
663
+ }
664
+ };
665
+ const CSS_TEMPLATE = {
666
+ begin: "css`",
667
+ end: "",
668
+ starts: {
669
+ end: "`",
670
+ returnEnd: false,
671
+ contains: [
672
+ hljs.BACKSLASH_ESCAPE,
673
+ SUBST
674
+ ],
675
+ subLanguage: "css"
676
+ }
677
+ };
678
+ const GRAPHQL_TEMPLATE = {
679
+ begin: "gql`",
680
+ end: "",
681
+ starts: {
682
+ end: "`",
683
+ returnEnd: false,
684
+ contains: [
685
+ hljs.BACKSLASH_ESCAPE,
686
+ SUBST
687
+ ],
688
+ subLanguage: "graphql"
689
+ }
690
+ };
691
+ const TEMPLATE_STRING = {
692
+ className: "string",
693
+ begin: "`",
694
+ end: "`",
695
+ contains: [
696
+ hljs.BACKSLASH_ESCAPE,
697
+ SUBST
698
+ ]
699
+ };
700
+ const JSDOC_COMMENT = hljs.COMMENT(
701
+ /\/\*\*(?!\/)/,
702
+ "\\*/",
703
+ {
704
+ relevance: 0,
705
+ contains: [
706
+ {
707
+ begin: "(?=@[A-Za-z]+)",
708
+ relevance: 0,
709
+ contains: [
710
+ {
711
+ className: "doctag",
712
+ begin: "@[A-Za-z]+"
713
+ },
714
+ {
715
+ className: "type",
716
+ begin: "\\{",
717
+ end: "\\}",
718
+ excludeEnd: true,
719
+ excludeBegin: true,
720
+ relevance: 0
721
+ },
722
+ {
723
+ className: "variable",
724
+ begin: IDENT_RE$1$1 + "(?=\\s*(-)|$)",
725
+ endsParent: true,
726
+ relevance: 0
727
+ },
728
+ // eat spaces (not newlines) so we can find
729
+ // types or variables
730
+ {
731
+ begin: /(?=[^\n])\s/,
732
+ relevance: 0
733
+ }
734
+ ]
735
+ }
736
+ ]
737
+ }
738
+ );
739
+ const COMMENT = {
740
+ className: "comment",
741
+ variants: [
742
+ JSDOC_COMMENT,
743
+ hljs.C_BLOCK_COMMENT_MODE,
744
+ hljs.C_LINE_COMMENT_MODE
745
+ ]
746
+ };
747
+ const SUBST_INTERNALS = [
748
+ hljs.APOS_STRING_MODE,
749
+ hljs.QUOTE_STRING_MODE,
750
+ HTML_TEMPLATE,
751
+ CSS_TEMPLATE,
752
+ GRAPHQL_TEMPLATE,
753
+ TEMPLATE_STRING,
754
+ // Skip numbers when they are part of a variable name
755
+ { match: /\$\d+/ },
756
+ NUMBER
757
+ // This is intentional:
758
+ // See https://github.com/highlightjs/highlight.js/issues/3288
759
+ // hljs.REGEXP_MODE
760
+ ];
761
+ SUBST.contains = SUBST_INTERNALS.concat({
762
+ // we need to pair up {} inside our subst to prevent
763
+ // it from ending too early by matching another }
764
+ begin: /\{/,
765
+ end: /\}/,
766
+ keywords: KEYWORDS$1$1,
767
+ contains: [
768
+ "self"
769
+ ].concat(SUBST_INTERNALS)
770
+ });
771
+ const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);
772
+ const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([
773
+ // eat recursive parens in sub expressions
774
+ {
775
+ begin: /\(/,
776
+ end: /\)/,
777
+ keywords: KEYWORDS$1$1,
778
+ contains: ["self"].concat(SUBST_AND_COMMENTS)
779
+ }
780
+ ]);
781
+ const PARAMS = {
782
+ className: "params",
783
+ begin: /\(/,
784
+ end: /\)/,
785
+ excludeBegin: true,
786
+ excludeEnd: true,
787
+ keywords: KEYWORDS$1$1,
788
+ contains: PARAMS_CONTAINS
789
+ };
790
+ const CLASS_OR_EXTENDS = {
791
+ variants: [
792
+ // class Car extends vehicle
793
+ {
794
+ match: [
795
+ /class/,
796
+ /\s+/,
797
+ IDENT_RE$1$1,
798
+ /\s+/,
799
+ /extends/,
800
+ /\s+/,
801
+ regex.concat(IDENT_RE$1$1, "(", regex.concat(/\./, IDENT_RE$1$1), ")*")
802
+ ],
803
+ scope: {
804
+ 1: "keyword",
805
+ 3: "title.class",
806
+ 5: "keyword",
807
+ 7: "title.class.inherited"
808
+ }
809
+ },
810
+ // class Car
811
+ {
812
+ match: [
813
+ /class/,
814
+ /\s+/,
815
+ IDENT_RE$1$1
816
+ ],
817
+ scope: {
818
+ 1: "keyword",
819
+ 3: "title.class"
820
+ }
821
+ }
822
+ ]
823
+ };
824
+ const CLASS_REFERENCE = {
825
+ relevance: 0,
826
+ match: regex.either(
827
+ // Hard coded exceptions
828
+ /\bJSON/,
829
+ // Float32Array, OutT
830
+ /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,
831
+ // CSSFactory, CSSFactoryT
832
+ /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,
833
+ // FPs, FPsT
834
+ /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/
835
+ // P
836
+ // single letters are not highlighted
837
+ // BLAH
838
+ // this will be flagged as a UPPER_CASE_CONSTANT instead
839
+ ),
840
+ className: "title.class",
841
+ keywords: {
842
+ _: [
843
+ // se we still get relevance credit for JS library classes
844
+ ...TYPES$1,
845
+ ...ERROR_TYPES$1
846
+ ]
847
+ }
848
+ };
849
+ const USE_STRICT = {
850
+ label: "use_strict",
851
+ className: "meta",
852
+ relevance: 10,
853
+ begin: /^\s*['"]use (strict|asm)['"]/
854
+ };
855
+ const FUNCTION_DEFINITION = {
856
+ variants: [
857
+ {
858
+ match: [
859
+ /function/,
860
+ /\s+/,
861
+ IDENT_RE$1$1,
862
+ /(?=\s*\()/
863
+ ]
864
+ },
865
+ // anonymous function
866
+ {
867
+ match: [
868
+ /function/,
869
+ /\s*(?=\()/
870
+ ]
871
+ }
872
+ ],
873
+ className: {
874
+ 1: "keyword",
875
+ 3: "title.function"
876
+ },
877
+ label: "func.def",
878
+ contains: [PARAMS],
879
+ illegal: /%/
880
+ };
881
+ const UPPER_CASE_CONSTANT = {
882
+ relevance: 0,
883
+ match: /\b[A-Z][A-Z_0-9]+\b/,
884
+ className: "variable.constant"
885
+ };
886
+ function noneOf(list) {
887
+ return regex.concat("(?!", list.join("|"), ")");
888
+ }
889
+ const FUNCTION_CALL = {
890
+ match: regex.concat(
891
+ /\b/,
892
+ noneOf([
893
+ ...BUILT_IN_GLOBALS$1,
894
+ "super",
895
+ "import"
896
+ ]),
897
+ IDENT_RE$1$1,
898
+ regex.lookahead(/\(/)
899
+ ),
900
+ className: "title.function",
901
+ relevance: 0
902
+ };
903
+ const PROPERTY_ACCESS = {
904
+ begin: regex.concat(/\./, regex.lookahead(
905
+ regex.concat(IDENT_RE$1$1, /(?![0-9A-Za-z$_(])/)
906
+ )),
907
+ end: IDENT_RE$1$1,
908
+ excludeBegin: true,
909
+ keywords: "prototype",
910
+ className: "property",
911
+ relevance: 0
912
+ };
913
+ const GETTER_OR_SETTER = {
914
+ match: [
915
+ /get|set/,
916
+ /\s+/,
917
+ IDENT_RE$1$1,
918
+ /(?=\()/
919
+ ],
920
+ className: {
921
+ 1: "keyword",
922
+ 3: "title.function"
923
+ },
924
+ contains: [
925
+ {
926
+ // eat to avoid empty params
927
+ begin: /\(\)/
928
+ },
929
+ PARAMS
930
+ ]
931
+ };
932
+ const FUNC_LEAD_IN_RE = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + hljs.UNDERSCORE_IDENT_RE + ")\\s*=>";
933
+ const FUNCTION_VARIABLE = {
934
+ match: [
935
+ /const|var|let/,
936
+ /\s+/,
937
+ IDENT_RE$1$1,
938
+ /\s*/,
939
+ /=\s*/,
940
+ /(async\s*)?/,
941
+ // async is optional
942
+ regex.lookahead(FUNC_LEAD_IN_RE)
943
+ ],
944
+ keywords: "async",
945
+ className: {
946
+ 1: "keyword",
947
+ 3: "title.function"
948
+ },
949
+ contains: [
950
+ PARAMS
951
+ ]
952
+ };
953
+ return {
954
+ name: "JavaScript",
955
+ aliases: ["js", "jsx", "mjs", "cjs"],
956
+ keywords: KEYWORDS$1$1,
957
+ // this will be extended by TypeScript
958
+ exports: { PARAMS_CONTAINS, CLASS_REFERENCE },
959
+ illegal: /#(?![$_A-z])/,
960
+ contains: [
961
+ hljs.SHEBANG({
962
+ label: "shebang",
963
+ binary: "node",
964
+ relevance: 5
965
+ }),
966
+ USE_STRICT,
967
+ hljs.APOS_STRING_MODE,
968
+ hljs.QUOTE_STRING_MODE,
969
+ HTML_TEMPLATE,
970
+ CSS_TEMPLATE,
971
+ GRAPHQL_TEMPLATE,
972
+ TEMPLATE_STRING,
973
+ COMMENT,
974
+ // Skip numbers when they are part of a variable name
975
+ { match: /\$\d+/ },
976
+ NUMBER,
977
+ CLASS_REFERENCE,
978
+ {
979
+ className: "attr",
980
+ begin: IDENT_RE$1$1 + regex.lookahead(":"),
981
+ relevance: 0
982
+ },
983
+ FUNCTION_VARIABLE,
984
+ {
985
+ // "value" container
986
+ begin: "(" + hljs.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
987
+ keywords: "return throw case",
988
+ relevance: 0,
989
+ contains: [
990
+ COMMENT,
991
+ hljs.REGEXP_MODE,
992
+ {
993
+ className: "function",
994
+ // we have to count the parens to make sure we actually have the
995
+ // correct bounding ( ) before the =>. There could be any number of
996
+ // sub-expressions inside also surrounded by parens.
997
+ begin: FUNC_LEAD_IN_RE,
998
+ returnBegin: true,
999
+ end: "\\s*=>",
1000
+ contains: [
1001
+ {
1002
+ className: "params",
1003
+ variants: [
1004
+ {
1005
+ begin: hljs.UNDERSCORE_IDENT_RE,
1006
+ relevance: 0
1007
+ },
1008
+ {
1009
+ className: null,
1010
+ begin: /\(\s*\)/,
1011
+ skip: true
1012
+ },
1013
+ {
1014
+ begin: /\(/,
1015
+ end: /\)/,
1016
+ excludeBegin: true,
1017
+ excludeEnd: true,
1018
+ keywords: KEYWORDS$1$1,
1019
+ contains: PARAMS_CONTAINS
1020
+ }
1021
+ ]
1022
+ }
1023
+ ]
1024
+ },
1025
+ {
1026
+ // could be a comma delimited list of params to a function call
1027
+ begin: /,/,
1028
+ relevance: 0
1029
+ },
1030
+ {
1031
+ match: /\s+/,
1032
+ relevance: 0
1033
+ },
1034
+ {
1035
+ // JSX
1036
+ variants: [
1037
+ { begin: FRAGMENT.begin, end: FRAGMENT.end },
1038
+ { match: XML_SELF_CLOSING },
1039
+ {
1040
+ begin: XML_TAG.begin,
1041
+ // we carefully check the opening tag to see if it truly
1042
+ // is a tag and not a false positive
1043
+ "on:begin": XML_TAG.isTrulyOpeningTag,
1044
+ end: XML_TAG.end
1045
+ }
1046
+ ],
1047
+ subLanguage: "xml",
1048
+ contains: [
1049
+ {
1050
+ begin: XML_TAG.begin,
1051
+ end: XML_TAG.end,
1052
+ skip: true,
1053
+ contains: ["self"]
1054
+ }
1055
+ ]
1056
+ }
1057
+ ]
1058
+ },
1059
+ FUNCTION_DEFINITION,
1060
+ {
1061
+ // prevent this from getting swallowed up by function
1062
+ // since they appear "function like"
1063
+ beginKeywords: "while if switch catch for"
1064
+ },
1065
+ {
1066
+ // we have to count the parens to make sure we actually have the correct
1067
+ // bounding ( ). There could be any number of sub-expressions inside
1068
+ // also surrounded by parens.
1069
+ begin: "\\b(?!function)" + hljs.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
1070
+ // end parens
1071
+ returnBegin: true,
1072
+ label: "func.def",
1073
+ contains: [
1074
+ PARAMS,
1075
+ hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1$1, className: "title.function" })
1076
+ ]
1077
+ },
1078
+ // catch ... so it won't trigger the property rule below
1079
+ {
1080
+ match: /\.\.\./,
1081
+ relevance: 0
1082
+ },
1083
+ PROPERTY_ACCESS,
1084
+ // hack: prevents detection of keywords in some circumstances
1085
+ // .keyword()
1086
+ // $keyword = x
1087
+ {
1088
+ match: "\\$" + IDENT_RE$1$1,
1089
+ relevance: 0
1090
+ },
1091
+ {
1092
+ match: [/\bconstructor(?=\s*\()/],
1093
+ className: { 1: "title.function" },
1094
+ contains: [PARAMS]
1095
+ },
1096
+ FUNCTION_CALL,
1097
+ UPPER_CASE_CONSTANT,
1098
+ CLASS_OR_EXTENDS,
1099
+ GETTER_OR_SETTER,
1100
+ {
1101
+ match: /\$[(.]/
1102
+ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
1103
+ }
1104
+ ]
1105
+ };
1106
+ }
1107
+ function python(hljs) {
1108
+ const regex = hljs.regex;
1109
+ const IDENT_RE2 = new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*", "u");
1110
+ const RESERVED_WORDS = [
1111
+ "and",
1112
+ "as",
1113
+ "assert",
1114
+ "async",
1115
+ "await",
1116
+ "break",
1117
+ "case",
1118
+ "class",
1119
+ "continue",
1120
+ "def",
1121
+ "del",
1122
+ "elif",
1123
+ "else",
1124
+ "except",
1125
+ "finally",
1126
+ "for",
1127
+ "from",
1128
+ "global",
1129
+ "if",
1130
+ "import",
1131
+ "in",
1132
+ "is",
1133
+ "lambda",
1134
+ "match",
1135
+ "nonlocal|10",
1136
+ "not",
1137
+ "or",
1138
+ "pass",
1139
+ "raise",
1140
+ "return",
1141
+ "try",
1142
+ "while",
1143
+ "with",
1144
+ "yield"
1145
+ ];
1146
+ const BUILT_INS2 = [
1147
+ "__import__",
1148
+ "abs",
1149
+ "all",
1150
+ "any",
1151
+ "ascii",
1152
+ "bin",
1153
+ "bool",
1154
+ "breakpoint",
1155
+ "bytearray",
1156
+ "bytes",
1157
+ "callable",
1158
+ "chr",
1159
+ "classmethod",
1160
+ "compile",
1161
+ "complex",
1162
+ "delattr",
1163
+ "dict",
1164
+ "dir",
1165
+ "divmod",
1166
+ "enumerate",
1167
+ "eval",
1168
+ "exec",
1169
+ "filter",
1170
+ "float",
1171
+ "format",
1172
+ "frozenset",
1173
+ "getattr",
1174
+ "globals",
1175
+ "hasattr",
1176
+ "hash",
1177
+ "help",
1178
+ "hex",
1179
+ "id",
1180
+ "input",
1181
+ "int",
1182
+ "isinstance",
1183
+ "issubclass",
1184
+ "iter",
1185
+ "len",
1186
+ "list",
1187
+ "locals",
1188
+ "map",
1189
+ "max",
1190
+ "memoryview",
1191
+ "min",
1192
+ "next",
1193
+ "object",
1194
+ "oct",
1195
+ "open",
1196
+ "ord",
1197
+ "pow",
1198
+ "print",
1199
+ "property",
1200
+ "range",
1201
+ "repr",
1202
+ "reversed",
1203
+ "round",
1204
+ "set",
1205
+ "setattr",
1206
+ "slice",
1207
+ "sorted",
1208
+ "staticmethod",
1209
+ "str",
1210
+ "sum",
1211
+ "super",
1212
+ "tuple",
1213
+ "type",
1214
+ "vars",
1215
+ "zip"
1216
+ ];
1217
+ const LITERALS2 = [
1218
+ "__debug__",
1219
+ "Ellipsis",
1220
+ "False",
1221
+ "None",
1222
+ "NotImplemented",
1223
+ "True"
1224
+ ];
1225
+ const TYPES2 = [
1226
+ "Any",
1227
+ "Callable",
1228
+ "Coroutine",
1229
+ "Dict",
1230
+ "List",
1231
+ "Literal",
1232
+ "Generic",
1233
+ "Optional",
1234
+ "Sequence",
1235
+ "Set",
1236
+ "Tuple",
1237
+ "Type",
1238
+ "Union"
1239
+ ];
1240
+ const KEYWORDS2 = {
1241
+ $pattern: /[A-Za-z]\w+|__\w+__/,
1242
+ keyword: RESERVED_WORDS,
1243
+ built_in: BUILT_INS2,
1244
+ literal: LITERALS2,
1245
+ type: TYPES2
1246
+ };
1247
+ const PROMPT = {
1248
+ className: "meta",
1249
+ begin: /^(>>>|\.\.\.) /
1250
+ };
1251
+ const SUBST = {
1252
+ className: "subst",
1253
+ begin: /\{/,
1254
+ end: /\}/,
1255
+ keywords: KEYWORDS2,
1256
+ illegal: /#/
1257
+ };
1258
+ const LITERAL_BRACKET = {
1259
+ begin: /\{\{/,
1260
+ relevance: 0
1261
+ };
1262
+ const STRING = {
1263
+ className: "string",
1264
+ contains: [hljs.BACKSLASH_ESCAPE],
1265
+ variants: [
1266
+ {
1267
+ begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,
1268
+ end: /'''/,
1269
+ contains: [
1270
+ hljs.BACKSLASH_ESCAPE,
1271
+ PROMPT
1272
+ ],
1273
+ relevance: 10
1274
+ },
1275
+ {
1276
+ begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,
1277
+ end: /"""/,
1278
+ contains: [
1279
+ hljs.BACKSLASH_ESCAPE,
1280
+ PROMPT
1281
+ ],
1282
+ relevance: 10
1283
+ },
1284
+ {
1285
+ begin: /([fF][rR]|[rR][fF]|[fF])'''/,
1286
+ end: /'''/,
1287
+ contains: [
1288
+ hljs.BACKSLASH_ESCAPE,
1289
+ PROMPT,
1290
+ LITERAL_BRACKET,
1291
+ SUBST
1292
+ ]
1293
+ },
1294
+ {
1295
+ begin: /([fF][rR]|[rR][fF]|[fF])"""/,
1296
+ end: /"""/,
1297
+ contains: [
1298
+ hljs.BACKSLASH_ESCAPE,
1299
+ PROMPT,
1300
+ LITERAL_BRACKET,
1301
+ SUBST
1302
+ ]
1303
+ },
1304
+ {
1305
+ begin: /([uU]|[rR])'/,
1306
+ end: /'/,
1307
+ relevance: 10
1308
+ },
1309
+ {
1310
+ begin: /([uU]|[rR])"/,
1311
+ end: /"/,
1312
+ relevance: 10
1313
+ },
1314
+ {
1315
+ begin: /([bB]|[bB][rR]|[rR][bB])'/,
1316
+ end: /'/
1317
+ },
1318
+ {
1319
+ begin: /([bB]|[bB][rR]|[rR][bB])"/,
1320
+ end: /"/
1321
+ },
1322
+ {
1323
+ begin: /([fF][rR]|[rR][fF]|[fF])'/,
1324
+ end: /'/,
1325
+ contains: [
1326
+ hljs.BACKSLASH_ESCAPE,
1327
+ LITERAL_BRACKET,
1328
+ SUBST
1329
+ ]
1330
+ },
1331
+ {
1332
+ begin: /([fF][rR]|[rR][fF]|[fF])"/,
1333
+ end: /"/,
1334
+ contains: [
1335
+ hljs.BACKSLASH_ESCAPE,
1336
+ LITERAL_BRACKET,
1337
+ SUBST
1338
+ ]
1339
+ },
1340
+ hljs.APOS_STRING_MODE,
1341
+ hljs.QUOTE_STRING_MODE
1342
+ ]
1343
+ };
1344
+ const digitpart = "[0-9](_?[0-9])*";
1345
+ const pointfloat = `(\\b(${digitpart}))?\\.(${digitpart})|\\b(${digitpart})\\.`;
1346
+ const lookahead = `\\b|${RESERVED_WORDS.join("|")}`;
1347
+ const NUMBER = {
1348
+ className: "number",
1349
+ relevance: 0,
1350
+ variants: [
1351
+ // exponentfloat, pointfloat
1352
+ // https://docs.python.org/3.9/reference/lexical_analysis.html#floating-point-literals
1353
+ // optionally imaginary
1354
+ // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
1355
+ // Note: no leading \b because floats can start with a decimal point
1356
+ // and we don't want to mishandle e.g. `fn(.5)`,
1357
+ // no trailing \b for pointfloat because it can end with a decimal point
1358
+ // and we don't want to mishandle e.g. `0..hex()`; this should be safe
1359
+ // because both MUST contain a decimal point and so cannot be confused with
1360
+ // the interior part of an identifier
1361
+ {
1362
+ begin: `(\\b(${digitpart})|(${pointfloat}))[eE][+-]?(${digitpart})[jJ]?(?=${lookahead})`
1363
+ },
1364
+ {
1365
+ begin: `(${pointfloat})[jJ]?`
1366
+ },
1367
+ // decinteger, bininteger, octinteger, hexinteger
1368
+ // https://docs.python.org/3.9/reference/lexical_analysis.html#integer-literals
1369
+ // optionally "long" in Python 2
1370
+ // https://docs.python.org/2.7/reference/lexical_analysis.html#integer-and-long-integer-literals
1371
+ // decinteger is optionally imaginary
1372
+ // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
1373
+ {
1374
+ begin: `\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${lookahead})`
1375
+ },
1376
+ {
1377
+ begin: `\\b0[bB](_?[01])+[lL]?(?=${lookahead})`
1378
+ },
1379
+ {
1380
+ begin: `\\b0[oO](_?[0-7])+[lL]?(?=${lookahead})`
1381
+ },
1382
+ {
1383
+ begin: `\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${lookahead})`
1384
+ },
1385
+ // imagnumber (digitpart-based)
1386
+ // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
1387
+ {
1388
+ begin: `\\b(${digitpart})[jJ](?=${lookahead})`
1389
+ }
1390
+ ]
1391
+ };
1392
+ const COMMENT_TYPE = {
1393
+ className: "comment",
1394
+ begin: regex.lookahead(/# type:/),
1395
+ end: /$/,
1396
+ keywords: KEYWORDS2,
1397
+ contains: [
1398
+ {
1399
+ // prevent keywords from coloring `type`
1400
+ begin: /# type:/
1401
+ },
1402
+ // comment within a datatype comment includes no keywords
1403
+ {
1404
+ begin: /#/,
1405
+ end: /\b\B/,
1406
+ endsWithParent: true
1407
+ }
1408
+ ]
1409
+ };
1410
+ const PARAMS = {
1411
+ className: "params",
1412
+ variants: [
1413
+ // Exclude params in functions without params
1414
+ {
1415
+ className: "",
1416
+ begin: /\(\s*\)/,
1417
+ skip: true
1418
+ },
1419
+ {
1420
+ begin: /\(/,
1421
+ end: /\)/,
1422
+ excludeBegin: true,
1423
+ excludeEnd: true,
1424
+ keywords: KEYWORDS2,
1425
+ contains: [
1426
+ "self",
1427
+ PROMPT,
1428
+ NUMBER,
1429
+ STRING,
1430
+ hljs.HASH_COMMENT_MODE
1431
+ ]
1432
+ }
1433
+ ]
1434
+ };
1435
+ SUBST.contains = [
1436
+ STRING,
1437
+ NUMBER,
1438
+ PROMPT
1439
+ ];
1440
+ return {
1441
+ name: "Python",
1442
+ aliases: [
1443
+ "py",
1444
+ "gyp",
1445
+ "ipython"
1446
+ ],
1447
+ unicodeRegex: true,
1448
+ keywords: KEYWORDS2,
1449
+ illegal: /(<\/|\?)|=>/,
1450
+ contains: [
1451
+ PROMPT,
1452
+ NUMBER,
1453
+ {
1454
+ // very common convention
1455
+ begin: /\bself\b/
1456
+ },
1457
+ {
1458
+ // eat "if" prior to string so that it won't accidentally be
1459
+ // labeled as an f-string
1460
+ beginKeywords: "if",
1461
+ relevance: 0
1462
+ },
1463
+ STRING,
1464
+ COMMENT_TYPE,
1465
+ hljs.HASH_COMMENT_MODE,
1466
+ {
1467
+ match: [
1468
+ /\bdef/,
1469
+ /\s+/,
1470
+ IDENT_RE2
1471
+ ],
1472
+ scope: {
1473
+ 1: "keyword",
1474
+ 3: "title.function"
1475
+ },
1476
+ contains: [PARAMS]
1477
+ },
1478
+ {
1479
+ variants: [
1480
+ {
1481
+ match: [
1482
+ /\bclass/,
1483
+ /\s+/,
1484
+ IDENT_RE2,
1485
+ /\s*/,
1486
+ /\(\s*/,
1487
+ IDENT_RE2,
1488
+ /\s*\)/
1489
+ ]
1490
+ },
1491
+ {
1492
+ match: [
1493
+ /\bclass/,
1494
+ /\s+/,
1495
+ IDENT_RE2
1496
+ ]
1497
+ }
1498
+ ],
1499
+ scope: {
1500
+ 1: "keyword",
1501
+ 3: "title.class",
1502
+ 6: "title.class.inherited"
1503
+ }
1504
+ },
1505
+ {
1506
+ className: "meta",
1507
+ begin: /^[\t ]*@/,
1508
+ end: /(?=#)|$/,
1509
+ contains: [
1510
+ NUMBER,
1511
+ PARAMS,
1512
+ STRING
1513
+ ]
1514
+ }
1515
+ ]
1516
+ };
1517
+ }
1518
+ const IDENT_RE = "[A-Za-z$_][0-9A-Za-z$_]*";
1519
+ const KEYWORDS = [
1520
+ "as",
1521
+ // for exports
1522
+ "in",
1523
+ "of",
1524
+ "if",
1525
+ "for",
1526
+ "while",
1527
+ "finally",
1528
+ "var",
1529
+ "new",
1530
+ "function",
1531
+ "do",
1532
+ "return",
1533
+ "void",
1534
+ "else",
1535
+ "break",
1536
+ "catch",
1537
+ "instanceof",
1538
+ "with",
1539
+ "throw",
1540
+ "case",
1541
+ "default",
1542
+ "try",
1543
+ "switch",
1544
+ "continue",
1545
+ "typeof",
1546
+ "delete",
1547
+ "let",
1548
+ "yield",
1549
+ "const",
1550
+ "class",
1551
+ // JS handles these with a special rule
1552
+ // "get",
1553
+ // "set",
1554
+ "debugger",
1555
+ "async",
1556
+ "await",
1557
+ "static",
1558
+ "import",
1559
+ "from",
1560
+ "export",
1561
+ "extends"
1562
+ ];
1563
+ const LITERALS = [
1564
+ "true",
1565
+ "false",
1566
+ "null",
1567
+ "undefined",
1568
+ "NaN",
1569
+ "Infinity"
1570
+ ];
1571
+ const TYPES = [
1572
+ // Fundamental objects
1573
+ "Object",
1574
+ "Function",
1575
+ "Boolean",
1576
+ "Symbol",
1577
+ // numbers and dates
1578
+ "Math",
1579
+ "Date",
1580
+ "Number",
1581
+ "BigInt",
1582
+ // text
1583
+ "String",
1584
+ "RegExp",
1585
+ // Indexed collections
1586
+ "Array",
1587
+ "Float32Array",
1588
+ "Float64Array",
1589
+ "Int8Array",
1590
+ "Uint8Array",
1591
+ "Uint8ClampedArray",
1592
+ "Int16Array",
1593
+ "Int32Array",
1594
+ "Uint16Array",
1595
+ "Uint32Array",
1596
+ "BigInt64Array",
1597
+ "BigUint64Array",
1598
+ // Keyed collections
1599
+ "Set",
1600
+ "Map",
1601
+ "WeakSet",
1602
+ "WeakMap",
1603
+ // Structured data
1604
+ "ArrayBuffer",
1605
+ "SharedArrayBuffer",
1606
+ "Atomics",
1607
+ "DataView",
1608
+ "JSON",
1609
+ // Control abstraction objects
1610
+ "Promise",
1611
+ "Generator",
1612
+ "GeneratorFunction",
1613
+ "AsyncFunction",
1614
+ // Reflection
1615
+ "Reflect",
1616
+ "Proxy",
1617
+ // Internationalization
1618
+ "Intl",
1619
+ // WebAssembly
1620
+ "WebAssembly"
1621
+ ];
1622
+ const ERROR_TYPES = [
1623
+ "Error",
1624
+ "EvalError",
1625
+ "InternalError",
1626
+ "RangeError",
1627
+ "ReferenceError",
1628
+ "SyntaxError",
1629
+ "TypeError",
1630
+ "URIError"
1631
+ ];
1632
+ const BUILT_IN_GLOBALS = [
1633
+ "setInterval",
1634
+ "setTimeout",
1635
+ "clearInterval",
1636
+ "clearTimeout",
1637
+ "require",
1638
+ "exports",
1639
+ "eval",
1640
+ "isFinite",
1641
+ "isNaN",
1642
+ "parseFloat",
1643
+ "parseInt",
1644
+ "decodeURI",
1645
+ "decodeURIComponent",
1646
+ "encodeURI",
1647
+ "encodeURIComponent",
1648
+ "escape",
1649
+ "unescape"
1650
+ ];
1651
+ const BUILT_IN_VARIABLES = [
1652
+ "arguments",
1653
+ "this",
1654
+ "super",
1655
+ "console",
1656
+ "window",
1657
+ "document",
1658
+ "localStorage",
1659
+ "sessionStorage",
1660
+ "module",
1661
+ "global"
1662
+ // Node.js
1663
+ ];
1664
+ const BUILT_INS = [].concat(
1665
+ BUILT_IN_GLOBALS,
1666
+ TYPES,
1667
+ ERROR_TYPES
1668
+ );
1669
+ function javascript(hljs) {
1670
+ const regex = hljs.regex;
1671
+ const hasClosingTag = (match, { after }) => {
1672
+ const tag = "</" + match[0].slice(1);
1673
+ const pos = match.input.indexOf(tag, after);
1674
+ return pos !== -1;
1675
+ };
1676
+ const IDENT_RE$12 = IDENT_RE;
1677
+ const FRAGMENT = {
1678
+ begin: "<>",
1679
+ end: "</>"
1680
+ };
1681
+ const XML_SELF_CLOSING = /<[A-Za-z0-9\\._:-]+\s*\/>/;
1682
+ const XML_TAG = {
1683
+ begin: /<[A-Za-z0-9\\._:-]+/,
1684
+ end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
1685
+ /**
1686
+ * @param {RegExpMatchArray} match
1687
+ * @param {CallbackResponse} response
1688
+ */
1689
+ isTrulyOpeningTag: (match, response) => {
1690
+ const afterMatchIndex = match[0].length + match.index;
1691
+ const nextChar = match.input[afterMatchIndex];
1692
+ if (
1693
+ // HTML should not include another raw `<` inside a tag
1694
+ // nested type?
1695
+ // `<Array<Array<number>>`, etc.
1696
+ nextChar === "<" || // the , gives away that this is not HTML
1697
+ // `<T, A extends keyof T, V>`
1698
+ nextChar === ","
1699
+ ) {
1700
+ response.ignoreMatch();
1701
+ return;
1702
+ }
1703
+ if (nextChar === ">") {
1704
+ if (!hasClosingTag(match, { after: afterMatchIndex })) {
1705
+ response.ignoreMatch();
1706
+ }
1707
+ }
1708
+ let m;
1709
+ const afterMatch = match.input.substring(afterMatchIndex);
1710
+ if (m = afterMatch.match(/^\s*=/)) {
1711
+ response.ignoreMatch();
1712
+ return;
1713
+ }
1714
+ if (m = afterMatch.match(/^\s+extends\s+/)) {
1715
+ if (m.index === 0) {
1716
+ response.ignoreMatch();
1717
+ return;
1718
+ }
1719
+ }
1720
+ }
1721
+ };
1722
+ const KEYWORDS$12 = {
1723
+ $pattern: IDENT_RE,
1724
+ keyword: KEYWORDS,
1725
+ literal: LITERALS,
1726
+ built_in: BUILT_INS,
1727
+ "variable.language": BUILT_IN_VARIABLES
1728
+ };
1729
+ const decimalDigits = "[0-9](_?[0-9])*";
1730
+ const frac = `\\.(${decimalDigits})`;
1731
+ const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;
1732
+ const NUMBER = {
1733
+ className: "number",
1734
+ variants: [
1735
+ // DecimalLiteral
1736
+ { begin: `(\\b(${decimalInteger})((${frac})|\\.)?|(${frac}))[eE][+-]?(${decimalDigits})\\b` },
1737
+ { begin: `\\b(${decimalInteger})\\b((${frac})\\b|\\.)?|(${frac})\\b` },
1738
+ // DecimalBigIntegerLiteral
1739
+ { begin: `\\b(0|[1-9](_?[0-9])*)n\\b` },
1740
+ // NonDecimalIntegerLiteral
1741
+ { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" },
1742
+ { begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" },
1743
+ { begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" },
1744
+ // LegacyOctalIntegerLiteral (does not include underscore separators)
1745
+ // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
1746
+ { begin: "\\b0[0-7]+n?\\b" }
1747
+ ],
1748
+ relevance: 0
1749
+ };
1750
+ const SUBST = {
1751
+ className: "subst",
1752
+ begin: "\\$\\{",
1753
+ end: "\\}",
1754
+ keywords: KEYWORDS$12,
1755
+ contains: []
1756
+ // defined later
1757
+ };
1758
+ const HTML_TEMPLATE = {
1759
+ begin: "html`",
1760
+ end: "",
1761
+ starts: {
1762
+ end: "`",
1763
+ returnEnd: false,
1764
+ contains: [
1765
+ hljs.BACKSLASH_ESCAPE,
1766
+ SUBST
1767
+ ],
1768
+ subLanguage: "xml"
1769
+ }
1770
+ };
1771
+ const CSS_TEMPLATE = {
1772
+ begin: "css`",
1773
+ end: "",
1774
+ starts: {
1775
+ end: "`",
1776
+ returnEnd: false,
1777
+ contains: [
1778
+ hljs.BACKSLASH_ESCAPE,
1779
+ SUBST
1780
+ ],
1781
+ subLanguage: "css"
1782
+ }
1783
+ };
1784
+ const GRAPHQL_TEMPLATE = {
1785
+ begin: "gql`",
1786
+ end: "",
1787
+ starts: {
1788
+ end: "`",
1789
+ returnEnd: false,
1790
+ contains: [
1791
+ hljs.BACKSLASH_ESCAPE,
1792
+ SUBST
1793
+ ],
1794
+ subLanguage: "graphql"
1795
+ }
1796
+ };
1797
+ const TEMPLATE_STRING = {
1798
+ className: "string",
1799
+ begin: "`",
1800
+ end: "`",
1801
+ contains: [
1802
+ hljs.BACKSLASH_ESCAPE,
1803
+ SUBST
1804
+ ]
1805
+ };
1806
+ const JSDOC_COMMENT = hljs.COMMENT(
1807
+ /\/\*\*(?!\/)/,
1808
+ "\\*/",
1809
+ {
1810
+ relevance: 0,
1811
+ contains: [
1812
+ {
1813
+ begin: "(?=@[A-Za-z]+)",
1814
+ relevance: 0,
1815
+ contains: [
1816
+ {
1817
+ className: "doctag",
1818
+ begin: "@[A-Za-z]+"
1819
+ },
1820
+ {
1821
+ className: "type",
1822
+ begin: "\\{",
1823
+ end: "\\}",
1824
+ excludeEnd: true,
1825
+ excludeBegin: true,
1826
+ relevance: 0
1827
+ },
1828
+ {
1829
+ className: "variable",
1830
+ begin: IDENT_RE$12 + "(?=\\s*(-)|$)",
1831
+ endsParent: true,
1832
+ relevance: 0
1833
+ },
1834
+ // eat spaces (not newlines) so we can find
1835
+ // types or variables
1836
+ {
1837
+ begin: /(?=[^\n])\s/,
1838
+ relevance: 0
1839
+ }
1840
+ ]
1841
+ }
1842
+ ]
1843
+ }
1844
+ );
1845
+ const COMMENT = {
1846
+ className: "comment",
1847
+ variants: [
1848
+ JSDOC_COMMENT,
1849
+ hljs.C_BLOCK_COMMENT_MODE,
1850
+ hljs.C_LINE_COMMENT_MODE
1851
+ ]
1852
+ };
1853
+ const SUBST_INTERNALS = [
1854
+ hljs.APOS_STRING_MODE,
1855
+ hljs.QUOTE_STRING_MODE,
1856
+ HTML_TEMPLATE,
1857
+ CSS_TEMPLATE,
1858
+ GRAPHQL_TEMPLATE,
1859
+ TEMPLATE_STRING,
1860
+ // Skip numbers when they are part of a variable name
1861
+ { match: /\$\d+/ },
1862
+ NUMBER
1863
+ // This is intentional:
1864
+ // See https://github.com/highlightjs/highlight.js/issues/3288
1865
+ // hljs.REGEXP_MODE
1866
+ ];
1867
+ SUBST.contains = SUBST_INTERNALS.concat({
1868
+ // we need to pair up {} inside our subst to prevent
1869
+ // it from ending too early by matching another }
1870
+ begin: /\{/,
1871
+ end: /\}/,
1872
+ keywords: KEYWORDS$12,
1873
+ contains: [
1874
+ "self"
1875
+ ].concat(SUBST_INTERNALS)
1876
+ });
1877
+ const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);
1878
+ const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([
1879
+ // eat recursive parens in sub expressions
1880
+ {
1881
+ begin: /\(/,
1882
+ end: /\)/,
1883
+ keywords: KEYWORDS$12,
1884
+ contains: ["self"].concat(SUBST_AND_COMMENTS)
1885
+ }
1886
+ ]);
1887
+ const PARAMS = {
1888
+ className: "params",
1889
+ begin: /\(/,
1890
+ end: /\)/,
1891
+ excludeBegin: true,
1892
+ excludeEnd: true,
1893
+ keywords: KEYWORDS$12,
1894
+ contains: PARAMS_CONTAINS
1895
+ };
1896
+ const CLASS_OR_EXTENDS = {
1897
+ variants: [
1898
+ // class Car extends vehicle
1899
+ {
1900
+ match: [
1901
+ /class/,
1902
+ /\s+/,
1903
+ IDENT_RE$12,
1904
+ /\s+/,
1905
+ /extends/,
1906
+ /\s+/,
1907
+ regex.concat(IDENT_RE$12, "(", regex.concat(/\./, IDENT_RE$12), ")*")
1908
+ ],
1909
+ scope: {
1910
+ 1: "keyword",
1911
+ 3: "title.class",
1912
+ 5: "keyword",
1913
+ 7: "title.class.inherited"
1914
+ }
1915
+ },
1916
+ // class Car
1917
+ {
1918
+ match: [
1919
+ /class/,
1920
+ /\s+/,
1921
+ IDENT_RE$12
1922
+ ],
1923
+ scope: {
1924
+ 1: "keyword",
1925
+ 3: "title.class"
1926
+ }
1927
+ }
1928
+ ]
1929
+ };
1930
+ const CLASS_REFERENCE = {
1931
+ relevance: 0,
1932
+ match: regex.either(
1933
+ // Hard coded exceptions
1934
+ /\bJSON/,
1935
+ // Float32Array, OutT
1936
+ /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,
1937
+ // CSSFactory, CSSFactoryT
1938
+ /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,
1939
+ // FPs, FPsT
1940
+ /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/
1941
+ // P
1942
+ // single letters are not highlighted
1943
+ // BLAH
1944
+ // this will be flagged as a UPPER_CASE_CONSTANT instead
1945
+ ),
1946
+ className: "title.class",
1947
+ keywords: {
1948
+ _: [
1949
+ // se we still get relevance credit for JS library classes
1950
+ ...TYPES,
1951
+ ...ERROR_TYPES
1952
+ ]
1953
+ }
1954
+ };
1955
+ const USE_STRICT = {
1956
+ label: "use_strict",
1957
+ className: "meta",
1958
+ relevance: 10,
1959
+ begin: /^\s*['"]use (strict|asm)['"]/
1960
+ };
1961
+ const FUNCTION_DEFINITION = {
1962
+ variants: [
1963
+ {
1964
+ match: [
1965
+ /function/,
1966
+ /\s+/,
1967
+ IDENT_RE$12,
1968
+ /(?=\s*\()/
1969
+ ]
1970
+ },
1971
+ // anonymous function
1972
+ {
1973
+ match: [
1974
+ /function/,
1975
+ /\s*(?=\()/
1976
+ ]
1977
+ }
1978
+ ],
1979
+ className: {
1980
+ 1: "keyword",
1981
+ 3: "title.function"
1982
+ },
1983
+ label: "func.def",
1984
+ contains: [PARAMS],
1985
+ illegal: /%/
1986
+ };
1987
+ const UPPER_CASE_CONSTANT = {
1988
+ relevance: 0,
1989
+ match: /\b[A-Z][A-Z_0-9]+\b/,
1990
+ className: "variable.constant"
1991
+ };
1992
+ function noneOf(list) {
1993
+ return regex.concat("(?!", list.join("|"), ")");
1994
+ }
1995
+ const FUNCTION_CALL = {
1996
+ match: regex.concat(
1997
+ /\b/,
1998
+ noneOf([
1999
+ ...BUILT_IN_GLOBALS,
2000
+ "super",
2001
+ "import"
2002
+ ]),
2003
+ IDENT_RE$12,
2004
+ regex.lookahead(/\(/)
2005
+ ),
2006
+ className: "title.function",
2007
+ relevance: 0
2008
+ };
2009
+ const PROPERTY_ACCESS = {
2010
+ begin: regex.concat(/\./, regex.lookahead(
2011
+ regex.concat(IDENT_RE$12, /(?![0-9A-Za-z$_(])/)
2012
+ )),
2013
+ end: IDENT_RE$12,
2014
+ excludeBegin: true,
2015
+ keywords: "prototype",
2016
+ className: "property",
2017
+ relevance: 0
2018
+ };
2019
+ const GETTER_OR_SETTER = {
2020
+ match: [
2021
+ /get|set/,
2022
+ /\s+/,
2023
+ IDENT_RE$12,
2024
+ /(?=\()/
2025
+ ],
2026
+ className: {
2027
+ 1: "keyword",
2028
+ 3: "title.function"
2029
+ },
2030
+ contains: [
2031
+ {
2032
+ // eat to avoid empty params
2033
+ begin: /\(\)/
2034
+ },
2035
+ PARAMS
2036
+ ]
2037
+ };
2038
+ const FUNC_LEAD_IN_RE = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + hljs.UNDERSCORE_IDENT_RE + ")\\s*=>";
2039
+ const FUNCTION_VARIABLE = {
2040
+ match: [
2041
+ /const|var|let/,
2042
+ /\s+/,
2043
+ IDENT_RE$12,
2044
+ /\s*/,
2045
+ /=\s*/,
2046
+ /(async\s*)?/,
2047
+ // async is optional
2048
+ regex.lookahead(FUNC_LEAD_IN_RE)
2049
+ ],
2050
+ keywords: "async",
2051
+ className: {
2052
+ 1: "keyword",
2053
+ 3: "title.function"
2054
+ },
2055
+ contains: [
2056
+ PARAMS
2057
+ ]
2058
+ };
2059
+ return {
2060
+ name: "JavaScript",
2061
+ aliases: ["js", "jsx", "mjs", "cjs"],
2062
+ keywords: KEYWORDS$12,
2063
+ // this will be extended by TypeScript
2064
+ exports: { PARAMS_CONTAINS, CLASS_REFERENCE },
2065
+ illegal: /#(?![$_A-z])/,
2066
+ contains: [
2067
+ hljs.SHEBANG({
2068
+ label: "shebang",
2069
+ binary: "node",
2070
+ relevance: 5
2071
+ }),
2072
+ USE_STRICT,
2073
+ hljs.APOS_STRING_MODE,
2074
+ hljs.QUOTE_STRING_MODE,
2075
+ HTML_TEMPLATE,
2076
+ CSS_TEMPLATE,
2077
+ GRAPHQL_TEMPLATE,
2078
+ TEMPLATE_STRING,
2079
+ COMMENT,
2080
+ // Skip numbers when they are part of a variable name
2081
+ { match: /\$\d+/ },
2082
+ NUMBER,
2083
+ CLASS_REFERENCE,
2084
+ {
2085
+ className: "attr",
2086
+ begin: IDENT_RE$12 + regex.lookahead(":"),
2087
+ relevance: 0
2088
+ },
2089
+ FUNCTION_VARIABLE,
2090
+ {
2091
+ // "value" container
2092
+ begin: "(" + hljs.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
2093
+ keywords: "return throw case",
2094
+ relevance: 0,
2095
+ contains: [
2096
+ COMMENT,
2097
+ hljs.REGEXP_MODE,
2098
+ {
2099
+ className: "function",
2100
+ // we have to count the parens to make sure we actually have the
2101
+ // correct bounding ( ) before the =>. There could be any number of
2102
+ // sub-expressions inside also surrounded by parens.
2103
+ begin: FUNC_LEAD_IN_RE,
2104
+ returnBegin: true,
2105
+ end: "\\s*=>",
2106
+ contains: [
2107
+ {
2108
+ className: "params",
2109
+ variants: [
2110
+ {
2111
+ begin: hljs.UNDERSCORE_IDENT_RE,
2112
+ relevance: 0
2113
+ },
2114
+ {
2115
+ className: null,
2116
+ begin: /\(\s*\)/,
2117
+ skip: true
2118
+ },
2119
+ {
2120
+ begin: /\(/,
2121
+ end: /\)/,
2122
+ excludeBegin: true,
2123
+ excludeEnd: true,
2124
+ keywords: KEYWORDS$12,
2125
+ contains: PARAMS_CONTAINS
2126
+ }
2127
+ ]
2128
+ }
2129
+ ]
2130
+ },
2131
+ {
2132
+ // could be a comma delimited list of params to a function call
2133
+ begin: /,/,
2134
+ relevance: 0
2135
+ },
2136
+ {
2137
+ match: /\s+/,
2138
+ relevance: 0
2139
+ },
2140
+ {
2141
+ // JSX
2142
+ variants: [
2143
+ { begin: FRAGMENT.begin, end: FRAGMENT.end },
2144
+ { match: XML_SELF_CLOSING },
2145
+ {
2146
+ begin: XML_TAG.begin,
2147
+ // we carefully check the opening tag to see if it truly
2148
+ // is a tag and not a false positive
2149
+ "on:begin": XML_TAG.isTrulyOpeningTag,
2150
+ end: XML_TAG.end
2151
+ }
2152
+ ],
2153
+ subLanguage: "xml",
2154
+ contains: [
2155
+ {
2156
+ begin: XML_TAG.begin,
2157
+ end: XML_TAG.end,
2158
+ skip: true,
2159
+ contains: ["self"]
2160
+ }
2161
+ ]
2162
+ }
2163
+ ]
2164
+ },
2165
+ FUNCTION_DEFINITION,
2166
+ {
2167
+ // prevent this from getting swallowed up by function
2168
+ // since they appear "function like"
2169
+ beginKeywords: "while if switch catch for"
2170
+ },
2171
+ {
2172
+ // we have to count the parens to make sure we actually have the correct
2173
+ // bounding ( ). There could be any number of sub-expressions inside
2174
+ // also surrounded by parens.
2175
+ begin: "\\b(?!function)" + hljs.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
2176
+ // end parens
2177
+ returnBegin: true,
2178
+ label: "func.def",
2179
+ contains: [
2180
+ PARAMS,
2181
+ hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$12, className: "title.function" })
2182
+ ]
2183
+ },
2184
+ // catch ... so it won't trigger the property rule below
2185
+ {
2186
+ match: /\.\.\./,
2187
+ relevance: 0
2188
+ },
2189
+ PROPERTY_ACCESS,
2190
+ // hack: prevents detection of keywords in some circumstances
2191
+ // .keyword()
2192
+ // $keyword = x
2193
+ {
2194
+ match: "\\$" + IDENT_RE$12,
2195
+ relevance: 0
2196
+ },
2197
+ {
2198
+ match: [/\bconstructor(?=\s*\()/],
2199
+ className: { 1: "title.function" },
2200
+ contains: [PARAMS]
2201
+ },
2202
+ FUNCTION_CALL,
2203
+ UPPER_CASE_CONSTANT,
2204
+ CLASS_OR_EXTENDS,
2205
+ GETTER_OR_SETTER,
2206
+ {
2207
+ match: /\$[(.]/
2208
+ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
2209
+ }
2210
+ ]
2211
+ };
2212
+ }
2213
+ function typescript(hljs) {
2214
+ const tsLanguage = javascript(hljs);
2215
+ const IDENT_RE$12 = IDENT_RE;
2216
+ const TYPES2 = [
2217
+ "any",
2218
+ "void",
2219
+ "number",
2220
+ "boolean",
2221
+ "string",
2222
+ "object",
2223
+ "never",
2224
+ "symbol",
2225
+ "bigint",
2226
+ "unknown"
2227
+ ];
2228
+ const NAMESPACE = {
2229
+ beginKeywords: "namespace",
2230
+ end: /\{/,
2231
+ excludeEnd: true,
2232
+ contains: [tsLanguage.exports.CLASS_REFERENCE]
2233
+ };
2234
+ const INTERFACE = {
2235
+ beginKeywords: "interface",
2236
+ end: /\{/,
2237
+ excludeEnd: true,
2238
+ keywords: {
2239
+ keyword: "interface extends",
2240
+ built_in: TYPES2
2241
+ },
2242
+ contains: [tsLanguage.exports.CLASS_REFERENCE]
2243
+ };
2244
+ const USE_STRICT = {
2245
+ className: "meta",
2246
+ relevance: 10,
2247
+ begin: /^\s*['"]use strict['"]/
2248
+ };
2249
+ const TS_SPECIFIC_KEYWORDS = [
2250
+ "type",
2251
+ "namespace",
2252
+ "interface",
2253
+ "public",
2254
+ "private",
2255
+ "protected",
2256
+ "implements",
2257
+ "declare",
2258
+ "abstract",
2259
+ "readonly",
2260
+ "enum",
2261
+ "override"
2262
+ ];
2263
+ const KEYWORDS$12 = {
2264
+ $pattern: IDENT_RE,
2265
+ keyword: KEYWORDS.concat(TS_SPECIFIC_KEYWORDS),
2266
+ literal: LITERALS,
2267
+ built_in: BUILT_INS.concat(TYPES2),
2268
+ "variable.language": BUILT_IN_VARIABLES
2269
+ };
2270
+ const DECORATOR = {
2271
+ className: "meta",
2272
+ begin: "@" + IDENT_RE$12
2273
+ };
2274
+ const swapMode = (mode, label, replacement) => {
2275
+ const indx = mode.contains.findIndex((m) => m.label === label);
2276
+ if (indx === -1) {
2277
+ throw new Error("can not find mode to replace");
2278
+ }
2279
+ mode.contains.splice(indx, 1, replacement);
2280
+ };
2281
+ Object.assign(tsLanguage.keywords, KEYWORDS$12);
2282
+ tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR);
2283
+ tsLanguage.contains = tsLanguage.contains.concat([
2284
+ DECORATOR,
2285
+ NAMESPACE,
2286
+ INTERFACE
2287
+ ]);
2288
+ swapMode(tsLanguage, "shebang", hljs.SHEBANG());
2289
+ swapMode(tsLanguage, "use_strict", USE_STRICT);
2290
+ const functionDeclaration = tsLanguage.contains.find((m) => m.label === "func.def");
2291
+ functionDeclaration.relevance = 0;
2292
+ Object.assign(tsLanguage, {
2293
+ name: "TypeScript",
2294
+ aliases: [
2295
+ "ts",
2296
+ "tsx",
2297
+ "mts",
2298
+ "cts"
2299
+ ]
2300
+ });
2301
+ return tsLanguage;
2302
+ }
2303
+ function xml(hljs) {
2304
+ const regex = hljs.regex;
2305
+ const TAG_NAME_RE = regex.concat(/[\p{L}_]/u, regex.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u);
2306
+ const XML_IDENT_RE = /[\p{L}0-9._:-]+/u;
2307
+ const XML_ENTITIES = {
2308
+ className: "symbol",
2309
+ begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
2310
+ };
2311
+ const XML_META_KEYWORDS = {
2312
+ begin: /\s/,
2313
+ contains: [
2314
+ {
2315
+ className: "keyword",
2316
+ begin: /#?[a-z_][a-z1-9_-]+/,
2317
+ illegal: /\n/
2318
+ }
2319
+ ]
2320
+ };
2321
+ const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {
2322
+ begin: /\(/,
2323
+ end: /\)/
2324
+ });
2325
+ const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, { className: "string" });
2326
+ const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, { className: "string" });
2327
+ const TAG_INTERNALS = {
2328
+ endsWithParent: true,
2329
+ illegal: /</,
2330
+ relevance: 0,
2331
+ contains: [
2332
+ {
2333
+ className: "attr",
2334
+ begin: XML_IDENT_RE,
2335
+ relevance: 0
2336
+ },
2337
+ {
2338
+ begin: /=\s*/,
2339
+ relevance: 0,
2340
+ contains: [
2341
+ {
2342
+ className: "string",
2343
+ endsParent: true,
2344
+ variants: [
2345
+ {
2346
+ begin: /"/,
2347
+ end: /"/,
2348
+ contains: [XML_ENTITIES]
2349
+ },
2350
+ {
2351
+ begin: /'/,
2352
+ end: /'/,
2353
+ contains: [XML_ENTITIES]
2354
+ },
2355
+ { begin: /[^\s"'=<>`]+/ }
2356
+ ]
2357
+ }
2358
+ ]
2359
+ }
2360
+ ]
2361
+ };
2362
+ return {
2363
+ name: "HTML, XML",
2364
+ aliases: [
2365
+ "html",
2366
+ "xhtml",
2367
+ "rss",
2368
+ "atom",
2369
+ "xjb",
2370
+ "xsd",
2371
+ "xsl",
2372
+ "plist",
2373
+ "wsf",
2374
+ "svg"
2375
+ ],
2376
+ case_insensitive: true,
2377
+ unicodeRegex: true,
2378
+ contains: [
2379
+ {
2380
+ className: "meta",
2381
+ begin: /<![a-z]/,
2382
+ end: />/,
2383
+ relevance: 10,
2384
+ contains: [
2385
+ XML_META_KEYWORDS,
2386
+ QUOTE_META_STRING_MODE,
2387
+ APOS_META_STRING_MODE,
2388
+ XML_META_PAR_KEYWORDS,
2389
+ {
2390
+ begin: /\[/,
2391
+ end: /\]/,
2392
+ contains: [
2393
+ {
2394
+ className: "meta",
2395
+ begin: /<![a-z]/,
2396
+ end: />/,
2397
+ contains: [
2398
+ XML_META_KEYWORDS,
2399
+ XML_META_PAR_KEYWORDS,
2400
+ QUOTE_META_STRING_MODE,
2401
+ APOS_META_STRING_MODE
2402
+ ]
2403
+ }
2404
+ ]
2405
+ }
2406
+ ]
2407
+ },
2408
+ hljs.COMMENT(
2409
+ /<!--/,
2410
+ /-->/,
2411
+ { relevance: 10 }
2412
+ ),
2413
+ {
2414
+ begin: /<!\[CDATA\[/,
2415
+ end: /\]\]>/,
2416
+ relevance: 10
2417
+ },
2418
+ XML_ENTITIES,
2419
+ // xml processing instructions
2420
+ {
2421
+ className: "meta",
2422
+ end: /\?>/,
2423
+ variants: [
2424
+ {
2425
+ begin: /<\?xml/,
2426
+ relevance: 10,
2427
+ contains: [
2428
+ QUOTE_META_STRING_MODE
2429
+ ]
2430
+ },
2431
+ {
2432
+ begin: /<\?[a-z][a-z0-9]+/
2433
+ }
2434
+ ]
2435
+ },
2436
+ {
2437
+ className: "tag",
2438
+ /*
2439
+ The lookahead pattern (?=...) ensures that 'begin' only matches
2440
+ '<style' as a single word, followed by a whitespace or an
2441
+ ending bracket.
2442
+ */
2443
+ begin: /<style(?=\s|>)/,
2444
+ end: />/,
2445
+ keywords: { name: "style" },
2446
+ contains: [TAG_INTERNALS],
2447
+ starts: {
2448
+ end: /<\/style>/,
2449
+ returnEnd: true,
2450
+ subLanguage: [
2451
+ "css",
2452
+ "xml"
2453
+ ]
2454
+ }
2455
+ },
2456
+ {
2457
+ className: "tag",
2458
+ // See the comment in the <style tag about the lookahead pattern
2459
+ begin: /<script(?=\s|>)/,
2460
+ end: />/,
2461
+ keywords: { name: "script" },
2462
+ contains: [TAG_INTERNALS],
2463
+ starts: {
2464
+ end: /<\/script>/,
2465
+ returnEnd: true,
2466
+ subLanguage: [
2467
+ "javascript",
2468
+ "handlebars",
2469
+ "xml"
2470
+ ]
2471
+ }
2472
+ },
2473
+ // we need this for now for jSX
2474
+ {
2475
+ className: "tag",
2476
+ begin: /<>|<\/>/
2477
+ },
2478
+ // open tag
2479
+ {
2480
+ className: "tag",
2481
+ begin: regex.concat(
2482
+ /</,
2483
+ regex.lookahead(regex.concat(
2484
+ TAG_NAME_RE,
2485
+ // <tag/>
2486
+ // <tag>
2487
+ // <tag ...
2488
+ regex.either(/\/>/, />/, /\s/)
2489
+ ))
2490
+ ),
2491
+ end: /\/?>/,
2492
+ contains: [
2493
+ {
2494
+ className: "name",
2495
+ begin: TAG_NAME_RE,
2496
+ relevance: 0,
2497
+ starts: TAG_INTERNALS
2498
+ }
2499
+ ]
2500
+ },
2501
+ // close tag
2502
+ {
2503
+ className: "tag",
2504
+ begin: regex.concat(
2505
+ /<\//,
2506
+ regex.lookahead(regex.concat(
2507
+ TAG_NAME_RE,
2508
+ />/
2509
+ ))
2510
+ ),
2511
+ contains: [
2512
+ {
2513
+ className: "name",
2514
+ begin: TAG_NAME_RE,
2515
+ relevance: 0
2516
+ },
2517
+ {
2518
+ begin: />/,
2519
+ relevance: 0,
2520
+ endsParent: true
2521
+ }
2522
+ ]
2523
+ }
2524
+ ]
2525
+ };
2526
+ }
2527
+ function useChat() {
2528
+ return inject(ChatSymbol);
2529
+ }
2530
+ function useOptions() {
2531
+ const options = inject(ChatOptionsSymbol);
2532
+ return {
2533
+ options
2534
+ };
2535
+ }
2536
+ function useI18n() {
2537
+ const { options } = useOptions();
2538
+ const language = (options == null ? void 0 : options.defaultLanguage) ?? "en";
2539
+ function t(key) {
2540
+ var _a, _b;
2541
+ const val = (_b = (_a = options == null ? void 0 : options.i18n) == null ? void 0 : _a[language]) == null ? void 0 : _b[key];
2542
+ if (isRef(val)) {
2543
+ return val.value;
2544
+ }
2545
+ return val ?? key;
2546
+ }
2547
+ function te(key) {
2548
+ var _a, _b;
2549
+ return !!((_b = (_a = options == null ? void 0 : options.i18n) == null ? void 0 : _a[language]) == null ? void 0 : _b[key]);
2550
+ }
2551
+ return { t, te };
2552
+ }
2553
+ const _hoisted_1$d = {
2554
+ viewBox: "0 0 24 24",
2555
+ width: "1.2em",
2556
+ height: "1.2em"
2557
+ };
2558
+ function render$7(_ctx, _cache) {
2559
+ return openBlock(), createElementBlock("svg", _hoisted_1$d, _cache[0] || (_cache[0] = [
2560
+ createBaseVNode("path", {
2561
+ fill: "currentColor",
2562
+ d: "M20 6.91L17.09 4L12 9.09L6.91 4L4 6.91L9.09 12L4 17.09L6.91 20L12 14.91L17.09 20L20 17.09L14.91 12z"
2563
+ }, null, -1)
2564
+ ]));
2565
+ }
2566
+ const IconDelete = { name: "mdi-closeThick", render: render$7 };
2567
+ const _hoisted_1$c = {
2568
+ viewBox: "0 0 24 24",
2569
+ width: "1.2em",
2570
+ height: "1.2em"
2571
+ };
2572
+ function render$6(_ctx, _cache) {
2573
+ return openBlock(), createElementBlock("svg", _hoisted_1$c, _cache[0] || (_cache[0] = [
2574
+ createBaseVNode("path", {
2575
+ fill: "currentColor",
2576
+ d: "M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m0 18h12v-8l-4 4l-2-2zM8 9a2 2 0 0 0-2 2a2 2 0 0 0 2 2a2 2 0 0 0 2-2a2 2 0 0 0-2-2"
2577
+ }, null, -1)
2578
+ ]));
2579
+ }
2580
+ const IconFileImage = { name: "mdi-fileImage", render: render$6 };
2581
+ const _hoisted_1$b = {
2582
+ viewBox: "0 0 24 24",
2583
+ width: "1.2em",
2584
+ height: "1.2em"
2585
+ };
2586
+ function render$5(_ctx, _cache) {
2587
+ return openBlock(), createElementBlock("svg", _hoisted_1$b, _cache[0] || (_cache[0] = [
2588
+ createBaseVNode("path", {
2589
+ fill: "currentColor",
2590
+ d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zm-1 11h-2v5a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2c.4 0 .7.1 1 .3V11h3zm0-4V3.5L18.5 9z"
2591
+ }, null, -1)
2592
+ ]));
2593
+ }
2594
+ const IconFileMusic = { name: "mdi-fileMusic", render: render$5 };
2595
+ const _hoisted_1$a = {
2596
+ viewBox: "0 0 24 24",
2597
+ width: "1.2em",
2598
+ height: "1.2em"
2599
+ };
2600
+ function render$4(_ctx, _cache) {
2601
+ return openBlock(), createElementBlock("svg", _hoisted_1$a, _cache[0] || (_cache[0] = [
2602
+ createBaseVNode("path", {
2603
+ fill: "currentColor",
2604
+ d: "M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m9 16v-2H6v2zm3-4v-2H6v2z"
2605
+ }, null, -1)
2606
+ ]));
2607
+ }
2608
+ const IconFileText = { name: "mdi-fileText", render: render$4 };
2609
+ const _hoisted_1$9 = {
2610
+ viewBox: "0 0 24 24",
2611
+ width: "1.2em",
2612
+ height: "1.2em"
2613
+ };
2614
+ function render$3(_ctx, _cache) {
2615
+ return openBlock(), createElementBlock("svg", _hoisted_1$9, _cache[0] || (_cache[0] = [
2616
+ createBaseVNode("path", {
2617
+ fill: "currentColor",
2618
+ d: "M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m11 17v-6l-3 2.2V13H7v6h7v-2.2z"
2619
+ }, null, -1)
2620
+ ]));
2621
+ }
2622
+ const IconFileVideo = { name: "mdi-fileVideo", render: render$3 };
2623
+ const _hoisted_1$8 = {
2624
+ viewBox: "0 0 24 24",
2625
+ width: "1.2em",
2626
+ height: "1.2em"
2627
+ };
2628
+ function render$2(_ctx, _cache) {
2629
+ return openBlock(), createElementBlock("svg", _hoisted_1$8, _cache[0] || (_cache[0] = [
2630
+ createBaseVNode("path", {
2631
+ fill: "currentColor",
2632
+ d: "M14 3v2h3.59l-9.83 9.83l1.41 1.41L19 6.41V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7h-2z"
2633
+ }, null, -1)
2634
+ ]));
2635
+ }
2636
+ const IconPreview = { name: "mdi-openInNew", render: render$2 };
2637
+ const _hoisted_1$7 = { class: "chat-file-name" };
2638
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2639
+ __name: "ChatFile",
2640
+ props: {
2641
+ file: {},
2642
+ isRemovable: { type: Boolean },
2643
+ isPreviewable: { type: Boolean }
2644
+ },
2645
+ emits: ["remove"],
2646
+ setup(__props, { emit: __emit }) {
2647
+ const props = __props;
2648
+ const emit = __emit;
2649
+ const iconMapper = {
2650
+ document: IconFileText,
2651
+ audio: IconFileMusic,
2652
+ image: IconFileImage,
2653
+ video: IconFileVideo
2654
+ };
2655
+ const TypeIcon = computed(() => {
2656
+ var _a;
2657
+ const type = (_a = props.file) == null ? void 0 : _a.type.split("/")[0];
2658
+ return iconMapper[type] || IconFileText;
2659
+ });
2660
+ function onClick() {
2661
+ if (props.isPreviewable) {
2662
+ window.open(URL.createObjectURL(props.file));
2663
+ }
2664
+ }
2665
+ function onDelete() {
2666
+ emit("remove", props.file);
2667
+ }
2668
+ return (_ctx, _cache) => {
2669
+ return openBlock(), createElementBlock("div", {
2670
+ class: "chat-file",
2671
+ onClick
2672
+ }, [
2673
+ createVNode(unref(TypeIcon)),
2674
+ createBaseVNode("p", _hoisted_1$7, toDisplayString(_ctx.file.name), 1),
2675
+ _ctx.isRemovable ? (openBlock(), createElementBlock("span", {
2676
+ key: 0,
2677
+ class: "chat-file-delete",
2678
+ onClick: withModifiers(onDelete, ["stop"])
2679
+ }, [
2680
+ createVNode(unref(IconDelete))
2681
+ ])) : _ctx.isPreviewable ? (openBlock(), createBlock(unref(IconPreview), {
2682
+ key: 1,
2683
+ class: "chat-file-preview"
2684
+ })) : createCommentVNode("", true)
2685
+ ]);
2686
+ };
2687
+ }
2688
+ });
2689
+ const ChatFile = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-70b9370d"]]);
2690
+ const _hoisted_1$6 = {
2691
+ key: 0,
2692
+ class: "chat-message-actions"
2693
+ };
2694
+ const _hoisted_2$2 = {
2695
+ key: 2,
2696
+ class: "chat-message-files"
2697
+ };
2698
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
2699
+ __name: "Message",
2700
+ props: {
2701
+ message: {}
2702
+ },
2703
+ setup(__props, { expose: __expose }) {
2704
+ const props = __props;
2705
+ HighlightJS.registerLanguage("javascript", javascript$1);
2706
+ HighlightJS.registerLanguage("typescript", typescript);
2707
+ HighlightJS.registerLanguage("python", python);
2708
+ HighlightJS.registerLanguage("xml", xml);
2709
+ HighlightJS.registerLanguage("bash", bash);
2710
+ const { message } = toRefs(props);
2711
+ const { options } = useOptions();
2712
+ const messageContainer = ref(null);
2713
+ const fileSources = ref({});
2714
+ const messageText = computed(() => {
2715
+ return message.value.text || "&lt;Empty response&gt;";
2716
+ });
2717
+ const classes = computed(() => {
2718
+ return {
2719
+ "chat-message-from-user": message.value.sender === "user",
2720
+ "chat-message-from-bot": message.value.sender === "bot",
2721
+ "chat-message-transparent": message.value.transparent === true
2722
+ };
2723
+ });
2724
+ const linksNewTabPlugin = (vueMarkdownItInstance) => {
2725
+ vueMarkdownItInstance.use(markdownLink, {
2726
+ attrs: {
2727
+ target: "_blank",
2728
+ rel: "noopener"
2729
+ }
2730
+ });
2731
+ };
2732
+ const scrollToView = () => {
2733
+ var _a;
2734
+ if ((_a = messageContainer.value) == null ? void 0 : _a.scrollIntoView) {
2735
+ messageContainer.value.scrollIntoView({
2736
+ block: "start"
2737
+ });
2738
+ }
2739
+ };
2740
+ const markdownOptions = {
2741
+ highlight(str, lang) {
2742
+ if (lang && HighlightJS.getLanguage(lang)) {
2743
+ try {
2744
+ return HighlightJS.highlight(str, { language: lang }).value;
2745
+ } catch {
2746
+ }
2747
+ }
2748
+ return "";
2749
+ }
2750
+ };
2751
+ const messageComponents = { ...(options == null ? void 0 : options.messageComponents) ?? {} };
2752
+ __expose({ scrollToView });
2753
+ const readFileAsDataURL = async (file) => await new Promise((resolve, reject) => {
2754
+ const reader = new FileReader();
2755
+ reader.onload = () => resolve(reader.result);
2756
+ reader.onerror = reject;
2757
+ reader.readAsDataURL(file);
2758
+ });
2759
+ onMounted(async () => {
2760
+ if (message.value.files) {
2761
+ for (const file of message.value.files) {
2762
+ try {
2763
+ const dataURL = await readFileAsDataURL(file);
2764
+ fileSources.value[file.name] = dataURL;
2765
+ } catch (error) {
2766
+ console.error("Error reading file:", error);
2767
+ }
2768
+ }
2769
+ }
2770
+ });
2771
+ return (_ctx, _cache) => {
2772
+ return openBlock(), createElementBlock("div", {
2773
+ ref_key: "messageContainer",
2774
+ ref: messageContainer,
2775
+ class: normalizeClass(["chat-message", classes.value])
2776
+ }, [
2777
+ _ctx.$slots.beforeMessage ? (openBlock(), createElementBlock("div", _hoisted_1$6, [
2778
+ renderSlot(_ctx.$slots, "beforeMessage", normalizeProps(guardReactiveProps({ message: unref(message) })))
2779
+ ])) : createCommentVNode("", true),
2780
+ renderSlot(_ctx.$slots, "default", {}, () => [
2781
+ unref(message).type === "component" && messageComponents[unref(message).key] ? (openBlock(), createBlock(resolveDynamicComponent(messageComponents[unref(message).key]), normalizeProps(mergeProps({ key: 0 }, unref(message).arguments)), null, 16)) : (openBlock(), createBlock(unref(VueMarkdown), {
2782
+ key: 1,
2783
+ class: "chat-message-markdown",
2784
+ source: messageText.value,
2785
+ options: markdownOptions,
2786
+ plugins: [linksNewTabPlugin]
2787
+ }, null, 8, ["source", "plugins"])),
2788
+ (unref(message).files ?? []).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
2789
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(message).files ?? [], (file) => {
2790
+ return openBlock(), createElementBlock("div", {
2791
+ key: file.name,
2792
+ class: "chat-message-file"
2793
+ }, [
2794
+ createVNode(ChatFile, {
2795
+ file,
2796
+ "is-removable": false,
2797
+ "is-previewable": true
2798
+ }, null, 8, ["file"])
2799
+ ]);
2800
+ }), 128))
2801
+ ])) : createCommentVNode("", true)
2802
+ ])
2803
+ ], 2);
2804
+ };
2805
+ }
2806
+ });
2807
+ const _hoisted_1$5 = {
2808
+ viewBox: "0 0 24 24",
2809
+ width: "1.2em",
2810
+ height: "1.2em"
2811
+ };
2812
+ function render$1(_ctx, _cache) {
2813
+ return openBlock(), createElementBlock("svg", _hoisted_1$5, _cache[0] || (_cache[0] = [
2814
+ createBaseVNode("path", {
2815
+ fill: "currentColor",
2816
+ d: "M16.5 6v11.5a4 4 0 0 1-4 4a4 4 0 0 1-4-4V5A2.5 2.5 0 0 1 11 2.5A2.5 2.5 0 0 1 13.5 5v10.5a1 1 0 0 1-1 1a1 1 0 0 1-1-1V6H10v9.5a2.5 2.5 0 0 0 2.5 2.5a2.5 2.5 0 0 0 2.5-2.5V5a4 4 0 0 0-4-4a4 4 0 0 0-4 4v12.5a5.5 5.5 0 0 0 5.5 5.5a5.5 5.5 0 0 0 5.5-5.5V6z"
2817
+ }, null, -1)
2818
+ ]));
2819
+ }
2820
+ const IconPaperclip = { name: "mdi-paperclip", render: render$1 };
2821
+ const _hoisted_1$4 = {
2822
+ viewBox: "0 0 24 24",
2823
+ width: "1.2em",
2824
+ height: "1.2em"
2825
+ };
2826
+ function render(_ctx, _cache) {
2827
+ return openBlock(), createElementBlock("svg", _hoisted_1$4, _cache[0] || (_cache[0] = [
2828
+ createBaseVNode("path", {
2829
+ fill: "currentColor",
2830
+ d: "m2 21l21-9L2 3v7l15 2l-15 2z"
2831
+ }, null, -1)
2832
+ ]));
2833
+ }
2834
+ const IconSend = { name: "mdi-send", render };
2835
+ const _hoisted_1$3 = { class: "chat-inputs" };
2836
+ const _hoisted_2$1 = ["disabled", "placeholder"];
2837
+ const _hoisted_3 = { class: "chat-inputs-controls" };
2838
+ const _hoisted_4 = ["disabled"];
2839
+ const _hoisted_5 = ["disabled"];
2840
+ const _hoisted_6 = {
2841
+ key: 0,
2842
+ class: "chat-files"
2843
+ };
2844
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
2845
+ __name: "Input",
2846
+ props: {
2847
+ placeholder: { default: "inputPlaceholder" }
2848
+ },
2849
+ emits: ["arrowKeyDown"],
2850
+ setup(__props, { emit: __emit }) {
2851
+ const props = __props;
2852
+ const { t } = useI18n();
2853
+ const emit = __emit;
2854
+ const { options } = useOptions();
2855
+ const chatStore = useChat();
2856
+ const { waitingForResponse } = chatStore;
2857
+ const files = ref(null);
2858
+ const chatTextArea = ref(null);
2859
+ const input = ref("");
2860
+ const isSubmitting = ref(false);
2861
+ const resizeObserver = ref(null);
2862
+ const isSubmitDisabled = computed(() => {
2863
+ var _a;
2864
+ return input.value === "" || waitingForResponse.value || ((_a = options.disabled) == null ? void 0 : _a.value) === true;
2865
+ });
2866
+ const isInputDisabled = computed(() => {
2867
+ var _a;
2868
+ return ((_a = options.disabled) == null ? void 0 : _a.value) === true;
2869
+ });
2870
+ const isFileUploadDisabled = computed(
2871
+ () => {
2872
+ var _a;
2873
+ return isFileUploadAllowed.value && waitingForResponse.value && !((_a = options.disabled) == null ? void 0 : _a.value);
2874
+ }
2875
+ );
2876
+ const isFileUploadAllowed = computed(() => unref(options.allowFileUploads) === true);
2877
+ const allowedFileTypes = computed(() => unref(options.allowedFilesMimeTypes));
2878
+ const styleVars = computed(() => {
2879
+ const controlsCount = isFileUploadAllowed.value ? 2 : 1;
2880
+ return {
2881
+ "--controls-count": controlsCount
2882
+ };
2883
+ });
2884
+ const {
2885
+ open: openFileDialog,
2886
+ reset: resetFileDialog,
2887
+ onChange
2888
+ } = useFileDialog({
2889
+ multiple: true,
2890
+ reset: false
2891
+ });
2892
+ onChange((newFiles) => {
2893
+ if (!newFiles) return;
2894
+ const newFilesDT = new DataTransfer();
2895
+ if (files.value) {
2896
+ for (let i = 0; i < files.value.length; i++) {
2897
+ newFilesDT.items.add(files.value[i]);
2898
+ }
2899
+ }
2900
+ for (let i = 0; i < newFiles.length; i++) {
2901
+ newFilesDT.items.add(newFiles[i]);
2902
+ }
2903
+ files.value = newFilesDT.files;
2904
+ });
2905
+ onMounted(() => {
2906
+ chatEventBus.on("focusInput", focusChatInput);
2907
+ chatEventBus.on("blurInput", blurChatInput);
2908
+ chatEventBus.on("setInputValue", setInputValue);
2909
+ if (chatTextArea.value) {
2910
+ resizeObserver.value = new ResizeObserver((entries) => {
2911
+ for (const entry of entries) {
2912
+ if (entry.target === chatTextArea.value) {
2913
+ adjustHeight({ target: chatTextArea.value });
2914
+ }
2915
+ }
2916
+ });
2917
+ resizeObserver.value.observe(chatTextArea.value);
2918
+ }
2919
+ });
2920
+ onUnmounted(() => {
2921
+ chatEventBus.off("focusInput", focusChatInput);
2922
+ chatEventBus.off("blurInput", blurChatInput);
2923
+ chatEventBus.off("setInputValue", setInputValue);
2924
+ if (resizeObserver.value) {
2925
+ resizeObserver.value.disconnect();
2926
+ resizeObserver.value = null;
2927
+ }
2928
+ });
2929
+ function blurChatInput() {
2930
+ if (chatTextArea.value) {
2931
+ chatTextArea.value.blur();
2932
+ }
2933
+ }
2934
+ function focusChatInput() {
2935
+ if (chatTextArea.value) {
2936
+ chatTextArea.value.focus();
2937
+ }
2938
+ }
2939
+ function setInputValue(value) {
2940
+ input.value = value;
2941
+ focusChatInput();
2942
+ }
2943
+ async function onSubmit(event) {
2944
+ event.preventDefault();
2945
+ if (isSubmitDisabled.value) {
2946
+ return;
2947
+ }
2948
+ const messageText = input.value;
2949
+ input.value = "";
2950
+ isSubmitting.value = true;
2951
+ await chatStore.sendMessage(messageText, Array.from(files.value ?? []));
2952
+ isSubmitting.value = false;
2953
+ resetFileDialog();
2954
+ files.value = null;
2955
+ }
2956
+ async function onSubmitKeydown(event) {
2957
+ if (event.shiftKey) {
2958
+ return;
2959
+ }
2960
+ await onSubmit(event);
2961
+ adjustHeight({ target: chatTextArea.value });
2962
+ }
2963
+ function onFileRemove(file) {
2964
+ if (!files.value) return;
2965
+ const dt = new DataTransfer();
2966
+ for (let i = 0; i < files.value.length; i++) {
2967
+ const currentFile = files.value[i];
2968
+ if (file.name !== currentFile.name) dt.items.add(currentFile);
2969
+ }
2970
+ resetFileDialog();
2971
+ files.value = dt.files;
2972
+ }
2973
+ function onKeyDown(event) {
2974
+ if (event.key === "ArrowUp" || event.key === "ArrowDown") {
2975
+ event.preventDefault();
2976
+ emit("arrowKeyDown", {
2977
+ key: event.key,
2978
+ currentInputValue: input.value
2979
+ });
2980
+ }
2981
+ }
2982
+ function onOpenFileDialog() {
2983
+ if (isFileUploadDisabled.value) return;
2984
+ openFileDialog({ accept: unref(allowedFileTypes) });
2985
+ }
2986
+ function adjustHeight(event) {
2987
+ const textarea = event.target;
2988
+ textarea.style.height = "var(--chat--textarea--height)";
2989
+ const newHeight = Math.min(textarea.scrollHeight, 480);
2990
+ textarea.style.height = `${newHeight}px`;
2991
+ }
2992
+ return (_ctx, _cache) => {
2993
+ var _a;
2994
+ return openBlock(), createElementBlock("div", {
2995
+ class: "chat-input",
2996
+ style: normalizeStyle(styleVars.value),
2997
+ onKeydown: withModifiers(onKeyDown, ["stop"])
2998
+ }, [
2999
+ createBaseVNode("div", _hoisted_1$3, [
3000
+ withDirectives(createBaseVNode("textarea", {
3001
+ ref_key: "chatTextArea",
3002
+ ref: chatTextArea,
3003
+ "data-test-id": "chat-input",
3004
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => input.value = $event),
3005
+ disabled: isInputDisabled.value,
3006
+ placeholder: unref(t)(props.placeholder),
3007
+ onKeydown: withKeys(onSubmitKeydown, ["enter"]),
3008
+ onInput: adjustHeight,
3009
+ onMousedown: adjustHeight,
3010
+ onFocus: adjustHeight
3011
+ }, null, 40, _hoisted_2$1), [
3012
+ [vModelText, input.value]
3013
+ ]),
3014
+ createBaseVNode("div", _hoisted_3, [
3015
+ isFileUploadAllowed.value ? (openBlock(), createElementBlock("button", {
3016
+ key: 0,
3017
+ disabled: isFileUploadDisabled.value,
3018
+ class: "chat-input-file-button",
3019
+ "data-test-id": "chat-attach-file-button",
3020
+ onClick: onOpenFileDialog
3021
+ }, [
3022
+ createVNode(unref(IconPaperclip), {
3023
+ height: "24",
3024
+ width: "24"
3025
+ })
3026
+ ], 8, _hoisted_4)) : createCommentVNode("", true),
3027
+ createBaseVNode("button", {
3028
+ disabled: isSubmitDisabled.value,
3029
+ class: "chat-input-send-button",
3030
+ onClick: onSubmit
3031
+ }, [
3032
+ createVNode(unref(IconSend), {
3033
+ height: "24",
3034
+ width: "24"
3035
+ })
3036
+ ], 8, _hoisted_5)
3037
+ ])
3038
+ ]),
3039
+ ((_a = files.value) == null ? void 0 : _a.length) && !isSubmitting.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
3040
+ (openBlock(true), createElementBlock(Fragment, null, renderList(files.value, (file) => {
3041
+ return openBlock(), createBlock(ChatFile, {
3042
+ key: file.name,
3043
+ file,
3044
+ "is-removable": true,
3045
+ "is-previewable": true,
3046
+ onRemove: onFileRemove
3047
+ }, null, 8, ["file"]);
3048
+ }), 128))
3049
+ ])) : createCommentVNode("", true)
3050
+ ], 36);
3051
+ };
3052
+ }
3053
+ });
3054
+ const ChatInput = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-797d44b4"]]);
3055
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3056
+ __name: "MessageTyping",
3057
+ props: {
3058
+ animation: { default: "bouncing" }
3059
+ },
3060
+ setup(__props) {
3061
+ const props = __props;
3062
+ const message = {
3063
+ id: "typing",
3064
+ text: "",
3065
+ sender: "bot",
3066
+ createdAt: ""
3067
+ };
3068
+ const messageContainer = ref();
3069
+ const classes = computed(() => {
3070
+ return {
3071
+ // eslint-disable-next-line @typescript-eslint/naming-convention
3072
+ "chat-message-typing": true,
3073
+ [`chat-message-typing-animation-${props.animation}`]: true
3074
+ };
3075
+ });
3076
+ onMounted(() => {
3077
+ var _a;
3078
+ (_a = messageContainer.value) == null ? void 0 : _a.scrollToView();
3079
+ });
3080
+ return (_ctx, _cache) => {
3081
+ return openBlock(), createBlock(unref(_sfc_main$8), {
3082
+ ref_key: "messageContainer",
3083
+ ref: messageContainer,
3084
+ class: normalizeClass(classes.value),
3085
+ message,
3086
+ "data-test-id": "chat-message-typing"
3087
+ }, {
3088
+ default: withCtx(() => _cache[0] || (_cache[0] = [
3089
+ createBaseVNode("div", { class: "chat-message-typing-body" }, [
3090
+ createBaseVNode("span", { class: "chat-message-typing-circle" }),
3091
+ createBaseVNode("span", { class: "chat-message-typing-circle" }),
3092
+ createBaseVNode("span", { class: "chat-message-typing-circle" })
3093
+ ], -1)
3094
+ ])),
3095
+ _: 1
3096
+ }, 8, ["class"]);
3097
+ };
3098
+ }
3099
+ });
3100
+ const _hoisted_1$2 = { class: "chat-messages-list" };
3101
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3102
+ __name: "MessagesList",
3103
+ props: {
3104
+ messages: {}
3105
+ },
3106
+ setup(__props) {
3107
+ const chatStore = useChat();
3108
+ const messageComponents = ref([]);
3109
+ const { initialMessages, waitingForResponse } = chatStore;
3110
+ watch(
3111
+ () => messageComponents.value.length,
3112
+ () => {
3113
+ const lastMessageComponent = messageComponents.value[messageComponents.value.length - 1];
3114
+ if (lastMessageComponent) {
3115
+ lastMessageComponent.scrollToView();
3116
+ }
3117
+ }
3118
+ );
3119
+ return (_ctx, _cache) => {
3120
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
3121
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(initialMessages), (initialMessage) => {
3122
+ return openBlock(), createBlock(_sfc_main$8, {
3123
+ key: initialMessage.id,
3124
+ message: initialMessage
3125
+ }, null, 8, ["message"]);
3126
+ }), 128)),
3127
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.messages, (message) => {
3128
+ return openBlock(), createBlock(_sfc_main$8, {
3129
+ key: message.id,
3130
+ ref_for: true,
3131
+ ref_key: "messageComponents",
3132
+ ref: messageComponents,
3133
+ message
3134
+ }, {
3135
+ beforeMessage: withCtx(({ message: message2 }) => [
3136
+ renderSlot(_ctx.$slots, "beforeMessage", mergeProps({ ref_for: true }, { message: message2 }))
3137
+ ]),
3138
+ _: 2
3139
+ }, 1032, ["message"]);
3140
+ }), 128)),
3141
+ unref(waitingForResponse) ? (openBlock(), createBlock(_sfc_main$6, { key: 0 })) : createCommentVNode("", true)
3142
+ ]);
3143
+ };
3144
+ }
3145
+ });
3146
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3147
+ __name: "MessageOptionTooltip",
3148
+ props: {
3149
+ placement: {
3150
+ type: String,
3151
+ default: "top"
3152
+ }
3153
+ },
3154
+ setup(__props) {
3155
+ return (_ctx, _cache) => {
3156
+ const _component_n8n_icon = resolveComponent("n8n-icon");
3157
+ const _component_n8n_tooltip = resolveComponent("n8n-tooltip");
3158
+ return openBlock(), createElementBlock("div", {
3159
+ class: normalizeClass(_ctx.$style.container)
3160
+ }, [
3161
+ createVNode(_component_n8n_tooltip, { placement: __props.placement }, {
3162
+ content: withCtx(() => [
3163
+ renderSlot(_ctx.$slots, "default")
3164
+ ]),
3165
+ default: withCtx(() => [
3166
+ createBaseVNode("span", {
3167
+ class: normalizeClass(_ctx.$style.icon)
3168
+ }, [
3169
+ createVNode(_component_n8n_icon, {
3170
+ icon: "info",
3171
+ size: "xsmall"
3172
+ })
3173
+ ], 2)
3174
+ ]),
3175
+ _: 3
3176
+ }, 8, ["placement"])
3177
+ ], 2);
3178
+ };
3179
+ }
3180
+ });
3181
+ const container$2 = "_container_12y0i_1";
3182
+ const icon$1 = "_icon_12y0i_7";
3183
+ const style0$4 = {
3184
+ container: container$2,
3185
+ icon: icon$1
3186
+ };
3187
+ const cssModules$4 = {
3188
+ "$style": style0$4
3189
+ };
3190
+ const MessageOptionTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__cssModules", cssModules$4]]);
3191
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3192
+ __name: "MessageOptionAction",
3193
+ props: {
3194
+ label: {
3195
+ type: String,
3196
+ required: true
3197
+ },
3198
+ icon: {
3199
+ type: String,
3200
+ required: true
3201
+ },
3202
+ placement: {
3203
+ type: String,
3204
+ default: "top"
3205
+ }
3206
+ },
3207
+ setup(__props) {
3208
+ return (_ctx, _cache) => {
3209
+ const _component_n8n_icon = resolveComponent("n8n-icon");
3210
+ const _component_n8n_tooltip = resolveComponent("n8n-tooltip");
3211
+ return openBlock(), createElementBlock("div", {
3212
+ class: normalizeClass(_ctx.$style.container)
3213
+ }, [
3214
+ createVNode(_component_n8n_tooltip, { placement: __props.placement }, {
3215
+ content: withCtx(() => [
3216
+ createTextVNode(toDisplayString(__props.label), 1)
3217
+ ]),
3218
+ default: withCtx(() => [
3219
+ createVNode(_component_n8n_icon, {
3220
+ class: normalizeClass(_ctx.$style.icon),
3221
+ icon: __props.icon,
3222
+ size: "xsmall",
3223
+ onClick: _ctx.$attrs.onClick
3224
+ }, null, 8, ["class", "icon", "onClick"])
3225
+ ]),
3226
+ _: 1
3227
+ }, 8, ["placement"])
3228
+ ], 2);
3229
+ };
3230
+ }
3231
+ });
3232
+ const container$1 = "_container_1as83_1";
3233
+ const icon = "_icon_1as83_7";
3234
+ const style0$3 = {
3235
+ container: container$1,
3236
+ icon
3237
+ };
3238
+ const cssModules$3 = {
3239
+ "$style": style0$3
3240
+ };
3241
+ const MessageOptionAction = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__cssModules", cssModules$3]]);
3242
+ const _hoisted_1$1 = ["onClick"];
3243
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3244
+ __name: "ChatMessagesPanel",
3245
+ props: {
3246
+ pastChatMessages: {},
3247
+ messages: {},
3248
+ sessionId: {}
3249
+ },
3250
+ emits: ["displayExecution", "sendMessage", "refreshSession"],
3251
+ setup(__props, { emit: __emit }) {
3252
+ const props = __props;
3253
+ const emit = __emit;
3254
+ const messageComposable = useMessage();
3255
+ const clipboard = useClipboard();
3256
+ const locale = useI18n$1();
3257
+ const toast = useToast();
3258
+ const previousMessageIndex = ref(0);
3259
+ const inputPlaceholder = computed(() => {
3260
+ if (props.messages.length > 0) {
3261
+ return locale.baseText("chat.window.chat.placeholder");
3262
+ }
3263
+ return locale.baseText("chat.window.chat.placeholderPristine");
3264
+ });
3265
+ function isTextMessage(message) {
3266
+ return message.type === "text" || !message.type;
3267
+ }
3268
+ function repostMessage(message) {
3269
+ void sendMessage(message.text);
3270
+ }
3271
+ function reuseMessage(message) {
3272
+ chatEventBus.emit("setInputValue", message.text);
3273
+ }
3274
+ function sendMessage(message) {
3275
+ previousMessageIndex.value = 0;
3276
+ emit("sendMessage", message);
3277
+ }
3278
+ async function onRefreshSession() {
3279
+ if (props.messages.length === 0) {
3280
+ emit("refreshSession");
3281
+ return;
3282
+ }
3283
+ const confirmResult = await messageComposable.confirm(
3284
+ locale.baseText("chat.window.session.reset.warning"),
3285
+ {
3286
+ title: locale.baseText("chat.window.session.reset.title"),
3287
+ type: "warning",
3288
+ confirmButtonText: locale.baseText("chat.window.session.reset.confirm"),
3289
+ showClose: true
3290
+ }
3291
+ );
3292
+ if (confirmResult === MODAL_CONFIRM) {
3293
+ emit("refreshSession");
3294
+ }
3295
+ }
3296
+ function onArrowKeyDown({ currentInputValue, key }) {
3297
+ const pastMessages = props.pastChatMessages;
3298
+ const isCurrentInputEmptyOrMatch = currentInputValue.length === 0 || pastMessages.includes(currentInputValue);
3299
+ if (isCurrentInputEmptyOrMatch && (key === "ArrowUp" || key === "ArrowDown")) {
3300
+ if (pastMessages.length === 0) return;
3301
+ chatEventBus.emit("blurInput");
3302
+ if (pastMessages.length === 1) {
3303
+ previousMessageIndex.value = 0;
3304
+ } else {
3305
+ if (key === "ArrowUp") {
3306
+ if (currentInputValue.length === 0 && previousMessageIndex.value === 0) {
3307
+ previousMessageIndex.value = pastMessages.length - 1;
3308
+ } else {
3309
+ previousMessageIndex.value = previousMessageIndex.value === 0 ? pastMessages.length - 1 : previousMessageIndex.value - 1;
3310
+ }
3311
+ } else if (key === "ArrowDown") {
3312
+ previousMessageIndex.value = previousMessageIndex.value === pastMessages.length - 1 ? 0 : previousMessageIndex.value + 1;
3313
+ }
3314
+ }
3315
+ const selectedMessage = pastMessages[previousMessageIndex.value];
3316
+ chatEventBus.emit("setInputValue", selectedMessage);
3317
+ chatEventBus.emit("focusInput");
3318
+ }
3319
+ if (!isCurrentInputEmptyOrMatch) {
3320
+ previousMessageIndex.value = 0;
3321
+ }
3322
+ }
3323
+ function copySessionId() {
3324
+ void clipboard.copy(props.sessionId);
3325
+ toast.showMessage({
3326
+ title: locale.baseText("generic.copiedToClipboard"),
3327
+ message: "",
3328
+ type: "success"
3329
+ });
3330
+ }
3331
+ return (_ctx, _cache) => {
3332
+ const _component_n8n_tooltip = resolveComponent("n8n-tooltip");
3333
+ const _component_n8n_icon_button = resolveComponent("n8n-icon-button");
3334
+ const _component_n8n_button = resolveComponent("n8n-button");
3335
+ return openBlock(), createElementBlock("div", {
3336
+ class: normalizeClass(_ctx.$style.chat),
3337
+ "data-test-id": "workflow-lm-chat-dialog"
3338
+ }, [
3339
+ createBaseVNode("header", {
3340
+ class: normalizeClass(_ctx.$style.chatHeader)
3341
+ }, [
3342
+ createBaseVNode("span", null, toDisplayString(unref(locale).baseText("chat.window.title")), 1),
3343
+ createBaseVNode("div", {
3344
+ class: normalizeClass(_ctx.$style.session)
3345
+ }, [
3346
+ createBaseVNode("span", null, toDisplayString(unref(locale).baseText("chat.window.session.title")), 1),
3347
+ createVNode(_component_n8n_tooltip, { placement: "left" }, {
3348
+ content: withCtx(() => [
3349
+ createTextVNode(toDisplayString(_ctx.sessionId), 1)
3350
+ ]),
3351
+ default: withCtx(() => [
3352
+ createBaseVNode("span", {
3353
+ class: normalizeClass(_ctx.$style.sessionId),
3354
+ "data-test-id": "chat-session-id",
3355
+ onClick: copySessionId
3356
+ }, toDisplayString(_ctx.sessionId), 3)
3357
+ ]),
3358
+ _: 1
3359
+ }),
3360
+ createVNode(_component_n8n_icon_button, {
3361
+ class: normalizeClass(_ctx.$style.refreshSession),
3362
+ "data-test-id": "refresh-session-button",
3363
+ type: "tertiary",
3364
+ text: "",
3365
+ size: "mini",
3366
+ icon: "undo",
3367
+ title: unref(locale).baseText("chat.window.session.reset.confirm"),
3368
+ onClick: onRefreshSession
3369
+ }, null, 8, ["class", "title"])
3370
+ ], 2)
3371
+ ], 2),
3372
+ createBaseVNode("main", {
3373
+ class: normalizeClass(_ctx.$style.chatBody)
3374
+ }, [
3375
+ createVNode(_sfc_main$5, {
3376
+ messages: _ctx.messages,
3377
+ class: normalizeClass([_ctx.$style.messages, "ignore-key-press-canvas"])
3378
+ }, {
3379
+ beforeMessage: withCtx(({ message }) => [
3380
+ message.sender === "bot" && !message.id.includes("preload") ? (openBlock(), createBlock(MessageOptionTooltip, {
3381
+ key: 0,
3382
+ placement: "right",
3383
+ "data-test-id": "execution-id-tooltip"
3384
+ }, {
3385
+ default: withCtx(() => [
3386
+ createTextVNode(toDisplayString(unref(locale).baseText("chat.window.chat.chatMessageOptions.executionId")) + ": ", 1),
3387
+ createBaseVNode("a", {
3388
+ href: "#",
3389
+ onClick: ($event) => emit("displayExecution", message.id)
3390
+ }, toDisplayString(message.id), 9, _hoisted_1$1)
3391
+ ]),
3392
+ _: 2
3393
+ }, 1024)) : createCommentVNode("", true),
3394
+ isTextMessage(message) && message.sender === "user" ? (openBlock(), createBlock(MessageOptionAction, {
3395
+ key: 1,
3396
+ "data-test-id": "repost-message-button",
3397
+ icon: "redo",
3398
+ label: unref(locale).baseText("chat.window.chat.chatMessageOptions.repostMessage"),
3399
+ placement: "left",
3400
+ onClickOnce: ($event) => repostMessage(message)
3401
+ }, null, 8, ["label", "onClickOnce"])) : createCommentVNode("", true),
3402
+ isTextMessage(message) && message.sender === "user" ? (openBlock(), createBlock(MessageOptionAction, {
3403
+ key: 2,
3404
+ "data-test-id": "reuse-message-button",
3405
+ icon: "copy",
3406
+ label: unref(locale).baseText("chat.window.chat.chatMessageOptions.reuseMessage"),
3407
+ placement: "left",
3408
+ onClick: ($event) => reuseMessage(message)
3409
+ }, null, 8, ["label", "onClick"])) : createCommentVNode("", true)
3410
+ ]),
3411
+ _: 1
3412
+ }, 8, ["messages", "class"])
3413
+ ], 2),
3414
+ createBaseVNode("div", {
3415
+ class: normalizeClass(_ctx.$style.messagesInput)
3416
+ }, [
3417
+ _ctx.pastChatMessages.length > 0 ? (openBlock(), createElementBlock("div", {
3418
+ key: 0,
3419
+ class: normalizeClass(_ctx.$style.messagesHistory)
3420
+ }, [
3421
+ createVNode(_component_n8n_button, {
3422
+ title: "Navigate to previous message",
3423
+ icon: "chevron-up",
3424
+ type: "tertiary",
3425
+ text: "",
3426
+ size: "mini",
3427
+ onClick: _cache[0] || (_cache[0] = ($event) => onArrowKeyDown({ currentInputValue: "", key: "ArrowUp" }))
3428
+ }),
3429
+ createVNode(_component_n8n_button, {
3430
+ title: "Navigate to next message",
3431
+ icon: "chevron-down",
3432
+ type: "tertiary",
3433
+ text: "",
3434
+ size: "mini",
3435
+ onClick: _cache[1] || (_cache[1] = ($event) => onArrowKeyDown({ currentInputValue: "", key: "ArrowDown" }))
3436
+ })
3437
+ ], 2)) : createCommentVNode("", true),
3438
+ createVNode(ChatInput, {
3439
+ "data-test-id": "lm-chat-inputs",
3440
+ placeholder: inputPlaceholder.value,
3441
+ onArrowKeyDown
3442
+ }, null, 8, ["placeholder"])
3443
+ ], 2)
3444
+ ], 2);
3445
+ };
3446
+ }
3447
+ });
3448
+ const chat$1 = "_chat_9ze98_1";
3449
+ const chatHeader = "_chatHeader_9ze98_22";
3450
+ const session = "_session_9ze98_35";
3451
+ const sessionId = "_sessionId_9ze98_43";
3452
+ const refreshSession = "_refreshSession_9ze98_51";
3453
+ const chatBody = "_chatBody_9ze98_55";
3454
+ const messages = "_messages_9ze98_61";
3455
+ const messagesInput = "_messagesInput_9ze98_72";
3456
+ const messagesHistory = "_messagesHistory_9ze98_106";
3457
+ const style0$2 = {
3458
+ chat: chat$1,
3459
+ chatHeader,
3460
+ session,
3461
+ sessionId,
3462
+ refreshSession,
3463
+ chatBody,
3464
+ messages,
3465
+ messagesInput,
3466
+ messagesHistory
3467
+ };
3468
+ const cssModules$2 = {
3469
+ "$style": style0$2
3470
+ };
3471
+ const ChatMessagesPanel = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__cssModules", cssModules$2]]);
3472
+ const _hoisted_1 = { class: "meta" };
3473
+ const _hoisted_2 = { key: 0 };
3474
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3475
+ __name: "ChatLogsPanel",
3476
+ props: {
3477
+ node: {},
3478
+ slim: { type: Boolean },
3479
+ workflow: {}
3480
+ },
3481
+ emits: ["close"],
3482
+ setup(__props, { emit: __emit }) {
3483
+ const emit = __emit;
3484
+ const locale = useI18n$1();
3485
+ return (_ctx, _cache) => {
3486
+ const _component_n8n_icon_button = resolveComponent("n8n-icon-button");
3487
+ return openBlock(), createElementBlock("div", {
3488
+ class: normalizeClass(_ctx.$style.logsWrapper),
3489
+ "data-test-id": "lm-chat-logs"
3490
+ }, [
3491
+ createBaseVNode("header", {
3492
+ class: normalizeClass(_ctx.$style.logsHeader)
3493
+ }, [
3494
+ createBaseVNode("div", _hoisted_1, [
3495
+ createTextVNode(toDisplayString(unref(locale).baseText("chat.window.logs")) + " ", 1),
3496
+ _ctx.node ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref(locale).baseText("chat.window.logsFromNode", { interpolate: { nodeName: _ctx.node.name } })), 1)) : createCommentVNode("", true)
3497
+ ]),
3498
+ createVNode(_component_n8n_icon_button, {
3499
+ class: normalizeClass(_ctx.$style.close),
3500
+ outline: "",
3501
+ icon: "times",
3502
+ type: "secondary",
3503
+ size: "mini",
3504
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
3505
+ }, null, 8, ["class"])
3506
+ ], 2),
3507
+ createBaseVNode("div", {
3508
+ class: normalizeClass(_ctx.$style.logs)
3509
+ }, [
3510
+ _ctx.node ? (openBlock(), createBlock(RunDataAi, {
3511
+ key: 0,
3512
+ class: normalizeClass(_ctx.$style.runData),
3513
+ node: _ctx.node,
3514
+ workflow: _ctx.workflow,
3515
+ slim: _ctx.slim
3516
+ }, null, 8, ["class", "node", "workflow", "slim"])) : createCommentVNode("", true)
3517
+ ], 2)
3518
+ ], 2);
3519
+ };
3520
+ }
3521
+ });
3522
+ const logsHeader = "_logsHeader_1qrym_1";
3523
+ const close = "_close_1qrym_14";
3524
+ const logsWrapper = "_logsWrapper_1qrym_21";
3525
+ const logsTitle = "_logsTitle_1qrym_30";
3526
+ const logs$1 = "_logs_1qrym_1";
3527
+ const style0$1 = {
3528
+ logsHeader,
3529
+ close,
3530
+ logsWrapper,
3531
+ logsTitle,
3532
+ logs: logs$1
3533
+ };
3534
+ const cssModules$1 = {
3535
+ "$style": style0$1
3536
+ };
3537
+ const ChatLogsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__cssModules", cssModules$1]]);
3538
+ function useChatTrigger({
3539
+ getNodeByName,
3540
+ getNodeType,
3541
+ canvasNodes,
3542
+ workflow
3543
+ }) {
3544
+ const chatTriggerName = ref(null);
3545
+ const connectedNode = ref(null);
3546
+ const chatTriggerNode = computed(
3547
+ () => chatTriggerName.value ? getNodeByName(chatTriggerName.value) : null
3548
+ );
3549
+ const allowFileUploads = computed(() => {
3550
+ var _a, _b, _c;
3551
+ return ((_c = (_b = (_a = chatTriggerNode.value) == null ? void 0 : _a.parameters) == null ? void 0 : _b.options) == null ? void 0 : _c.allowFileUploads) === true;
3552
+ });
3553
+ const allowedFilesMimeTypes = computed(() => {
3554
+ var _a, _b, _c, _d;
3555
+ return ((_d = (_c = (_b = (_a = chatTriggerNode.value) == null ? void 0 : _a.parameters) == null ? void 0 : _b.options) == null ? void 0 : _c.allowedFilesMimeTypes) == null ? void 0 : _d.toString()) ?? "";
3556
+ });
3557
+ function setChatTriggerNode() {
3558
+ const triggerNode = unref(canvasNodes).find(
3559
+ (node) => [CHAT_TRIGGER_NODE_TYPE, MANUAL_CHAT_TRIGGER_NODE_TYPE].includes(node.type)
3560
+ );
3561
+ if (!triggerNode) {
3562
+ return;
3563
+ }
3564
+ chatTriggerName.value = triggerNode.name;
3565
+ }
3566
+ function setConnectedNode() {
3567
+ const triggerNode = chatTriggerNode.value;
3568
+ if (!triggerNode) {
3569
+ return;
3570
+ }
3571
+ const chatChildren = workflow.value.getChildNodes(triggerNode.name);
3572
+ const chatRootNode = chatChildren.reverse().map((nodeName) => getNodeByName(nodeName)).filter((n) => n !== null).reverse().find((storeNode) => {
3573
+ var _a, _b, _c, _d, _e, _f;
3574
+ if (storeNode.type === CHAIN_SUMMARIZATION_LANGCHAIN_NODE_TYPE) return false;
3575
+ const nodeType = getNodeType(storeNode.type, storeNode.typeVersion);
3576
+ if (!nodeType) return false;
3577
+ const isAgent = (_c = (_b = (_a = nodeType.codex) == null ? void 0 : _a.subcategories) == null ? void 0 : _b[AI_SUBCATEGORY]) == null ? void 0 : _c.includes(AI_CATEGORY_AGENTS);
3578
+ const isChain = (_f = (_e = (_d = nodeType.codex) == null ? void 0 : _d.subcategories) == null ? void 0 : _e[AI_SUBCATEGORY]) == null ? void 0 : _f.includes(AI_CATEGORY_CHAINS);
3579
+ let isCustomChainOrAgent = false;
3580
+ if (nodeType.name === AI_CODE_NODE_TYPE) {
3581
+ const inputs = getNodeInputs(workflow.value, storeNode, nodeType);
3582
+ const inputTypes = getConnectionTypes(inputs);
3583
+ const outputs = getNodeOutputs(workflow.value, storeNode, nodeType);
3584
+ const outputTypes = getConnectionTypes(outputs);
3585
+ if (inputTypes.includes(NodeConnectionType.AiLanguageModel) && inputTypes.includes(NodeConnectionType.Main) && outputTypes.includes(NodeConnectionType.Main)) {
3586
+ isCustomChainOrAgent = true;
3587
+ }
3588
+ }
3589
+ if (!isAgent && !isChain && !isCustomChainOrAgent) return false;
3590
+ const parentNodes = workflow.value.getParentNodes(storeNode.name);
3591
+ const isChatChild = parentNodes.some(
3592
+ (parentNodeName) => parentNodeName === triggerNode.name
3593
+ );
3594
+ const result = Boolean(isChatChild && (isAgent || isChain || isCustomChainOrAgent));
3595
+ return result;
3596
+ });
3597
+ connectedNode.value = chatRootNode ?? null;
3598
+ }
3599
+ return {
3600
+ allowFileUploads,
3601
+ allowedFilesMimeTypes,
3602
+ chatTriggerNode,
3603
+ connectedNode: computed(() => connectedNode.value),
3604
+ setChatTriggerNode,
3605
+ setConnectedNode
3606
+ };
3607
+ }
3608
+ function useChatMessaging({
3609
+ chatTrigger,
3610
+ connectedNode,
3611
+ messages: messages2,
3612
+ sessionId: sessionId2,
3613
+ workflow,
3614
+ isLoading,
3615
+ executionResultData,
3616
+ getWorkflowResultDataByNodeName,
3617
+ onRunChatWorkflow
3618
+ }) {
3619
+ const locale = useI18n$1();
3620
+ const { showError } = useToast();
3621
+ const previousMessageIndex = ref(0);
3622
+ async function convertFileToBinaryData(file) {
3623
+ const reader = new FileReader();
3624
+ return await new Promise((resolve, reject) => {
3625
+ reader.onload = () => {
3626
+ var _a;
3627
+ const binaryData = {
3628
+ data: ((_a = reader.result.split("base64,")) == null ? void 0 : _a[1]) ?? "",
3629
+ mimeType: file.type,
3630
+ fileName: file.name,
3631
+ fileSize: `${file.size} bytes`,
3632
+ fileExtension: file.name.split(".").pop() ?? "",
3633
+ fileType: file.type.split("/")[0]
3634
+ };
3635
+ resolve(binaryData);
3636
+ };
3637
+ reader.onerror = () => {
3638
+ reject(new Error("Failed to convert file to binary data"));
3639
+ };
3640
+ reader.readAsDataURL(file);
3641
+ });
3642
+ }
3643
+ async function getKeyedFiles(files) {
3644
+ const binaryData = {};
3645
+ await Promise.all(
3646
+ files.map(async (file, index) => {
3647
+ const data = await convertFileToBinaryData(file);
3648
+ const key = `data${index}`;
3649
+ binaryData[key] = data;
3650
+ })
3651
+ );
3652
+ return binaryData;
3653
+ }
3654
+ function extractFileMeta(file) {
3655
+ return {
3656
+ fileName: file.name,
3657
+ fileSize: `${file.size} bytes`,
3658
+ fileExtension: file.name.split(".").pop() ?? "",
3659
+ fileType: file.type.split("/")[0],
3660
+ mimeType: file.type
3661
+ };
3662
+ }
3663
+ async function startWorkflowWithMessage(message, files) {
3664
+ const triggerNode = chatTrigger.value;
3665
+ if (!triggerNode) {
3666
+ showError(new Error("Chat Trigger Node could not be found!"), "Trigger Node not found");
3667
+ return;
3668
+ }
3669
+ let inputKey = "chatInput";
3670
+ if (triggerNode.type === MANUAL_CHAT_TRIGGER_NODE_TYPE && triggerNode.typeVersion < 1.1) {
3671
+ inputKey = "input";
3672
+ }
3673
+ if (triggerNode.type === CHAT_TRIGGER_NODE_TYPE$1) {
3674
+ inputKey = "chatInput";
3675
+ }
3676
+ const inputPayload = {
3677
+ json: {
3678
+ sessionId: sessionId2.value,
3679
+ action: "sendMessage",
3680
+ [inputKey]: message
3681
+ }
3682
+ };
3683
+ if (files && files.length > 0) {
3684
+ const filesMeta = files.map((file) => extractFileMeta(file));
3685
+ const binaryData = await getKeyedFiles(files);
3686
+ inputPayload.json.files = filesMeta;
3687
+ inputPayload.binary = binaryData;
3688
+ }
3689
+ const nodeData = {
3690
+ startTime: (/* @__PURE__ */ new Date()).getTime(),
3691
+ executionTime: 0,
3692
+ executionStatus: "success",
3693
+ data: {
3694
+ main: [[inputPayload]]
3695
+ },
3696
+ source: [null]
3697
+ };
3698
+ const response = await onRunChatWorkflow({
3699
+ triggerNode: triggerNode.name,
3700
+ nodeData,
3701
+ source: "RunData.ManualChatMessage",
3702
+ message
3703
+ });
3704
+ if (!(response == null ? void 0 : response.executionId)) {
3705
+ showError(
3706
+ new Error("It was not possible to start workflow!"),
3707
+ "Workflow could not be started"
3708
+ );
3709
+ return;
3710
+ }
3711
+ waitForExecution(response.executionId);
3712
+ }
3713
+ function waitForExecution(executionId) {
3714
+ const waitInterval = setInterval(() => {
3715
+ var _a;
3716
+ if (!isLoading.value) {
3717
+ clearInterval(waitInterval);
3718
+ const lastNodeExecuted = (_a = executionResultData.value) == null ? void 0 : _a.lastNodeExecuted;
3719
+ if (!lastNodeExecuted) return;
3720
+ const nodeResponseDataArray = get(executionResultData.value.runData, lastNodeExecuted) ?? [];
3721
+ const nodeResponseData = nodeResponseDataArray[nodeResponseDataArray.length - 1];
3722
+ let responseMessage;
3723
+ if (get(nodeResponseData, "error")) {
3724
+ responseMessage = "[ERROR: " + get(nodeResponseData, "error.message") + "]";
3725
+ } else {
3726
+ const responseData = get(nodeResponseData, "data.main[0][0].json");
3727
+ responseMessage = extractResponseMessage(responseData);
3728
+ }
3729
+ messages2.value.push({
3730
+ text: responseMessage,
3731
+ sender: "bot",
3732
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3733
+ id: executionId ?? v4()
3734
+ });
3735
+ }
3736
+ }, 500);
3737
+ }
3738
+ function extractResponseMessage(responseData) {
3739
+ if (!responseData || isEmpty(responseData)) {
3740
+ return locale.baseText("chat.window.chat.response.empty");
3741
+ }
3742
+ const paths = ["output", "text", "response.text"];
3743
+ const matchedPath = paths.find((path) => get(responseData, path));
3744
+ if (!matchedPath) return JSON.stringify(responseData, null, 2);
3745
+ const matchedOutput = get(responseData, matchedPath);
3746
+ if (typeof matchedOutput === "object") {
3747
+ return "```json\n" + JSON.stringify(matchedOutput, null, 2) + "\n```";
3748
+ }
3749
+ return (matchedOutput == null ? void 0 : matchedOutput.toString()) ?? "";
3750
+ }
3751
+ async function sendMessage(message, files) {
3752
+ previousMessageIndex.value = 0;
3753
+ if (message.trim() === "" && (!files || files.length === 0)) {
3754
+ showError(
3755
+ new Error(locale.baseText("chat.window.chat.provideMessage")),
3756
+ locale.baseText("chat.window.chat.emptyChatMessage")
3757
+ );
3758
+ return;
3759
+ }
3760
+ const pinnedChatData = usePinnedData(chatTrigger.value);
3761
+ if (pinnedChatData.hasData.value) {
3762
+ const confirmResult = await useMessage().confirm(
3763
+ locale.baseText("chat.window.chat.unpinAndExecute.description"),
3764
+ locale.baseText("chat.window.chat.unpinAndExecute.title"),
3765
+ {
3766
+ confirmButtonText: locale.baseText("chat.window.chat.unpinAndExecute.confirm"),
3767
+ cancelButtonText: locale.baseText("chat.window.chat.unpinAndExecute.cancel")
3768
+ }
3769
+ );
3770
+ if (!(confirmResult === MODAL_CONFIRM)) return;
3771
+ pinnedChatData.unsetData("unpin-and-send-chat-message-modal");
3772
+ }
3773
+ const newMessage = {
3774
+ text: message,
3775
+ sender: "user",
3776
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3777
+ sessionId: sessionId2.value,
3778
+ id: v4(),
3779
+ files
3780
+ };
3781
+ messages2.value.push(newMessage);
3782
+ await startWorkflowWithMessage(newMessage.text, files);
3783
+ }
3784
+ function getChatMessages() {
3785
+ var _a, _b, _c;
3786
+ if (!connectedNode.value) return [];
3787
+ const connectedMemoryInputs = (_b = (_a = workflow.value.connectionsByDestinationNode) == null ? void 0 : _a[connectedNode.value.name]) == null ? void 0 : _b[NodeConnectionType.AiMemory];
3788
+ if (!connectedMemoryInputs) return [];
3789
+ const memoryConnection = (_c = (connectedMemoryInputs ?? []).find((i) => i.length > 0)) == null ? void 0 : _c[0];
3790
+ if (!memoryConnection) return [];
3791
+ const nodeResultData = getWorkflowResultDataByNodeName(memoryConnection.node);
3792
+ const memoryOutputData = (nodeResultData ?? []).map((data) => get(data, ["data", NodeConnectionType.AiMemory, 0, 0, "json"])).find((data) => data && data.action === "saveContext");
3793
+ return ((memoryOutputData == null ? void 0 : memoryOutputData.chatHistory) ?? []).map((message, index) => {
3794
+ return {
3795
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3796
+ text: message.kwargs.content,
3797
+ id: `preload__${index}`,
3798
+ sender: last(message.id) === "HumanMessage" ? "user" : "bot"
3799
+ };
3800
+ });
3801
+ }
3802
+ return {
3803
+ previousMessageIndex,
3804
+ sendMessage,
3805
+ extractResponseMessage,
3806
+ waitForExecution,
3807
+ getChatMessages
3808
+ };
3809
+ }
3810
+ const LOCAL_STORAGE_PANEL_HEIGHT = "N8N_CANVAS_CHAT_HEIGHT";
3811
+ const LOCAL_STORAGE_PANEL_WIDTH = "N8N_CANVAS_CHAT_WIDTH";
3812
+ const MAX_WIDTH_PERCENTAGE = 0.8;
3813
+ const MIN_WIDTH_PERCENTAGE = 0.3;
3814
+ const MIN_HEIGHT_PERCENTAGE = 0.3;
3815
+ const MAX_HEIGHT_PERCENTAGE = 0.75;
3816
+ function useResize(container2) {
3817
+ const storage = {
3818
+ height: useStorage(LOCAL_STORAGE_PANEL_HEIGHT),
3819
+ width: useStorage(LOCAL_STORAGE_PANEL_WIDTH)
3820
+ };
3821
+ const dimensions = {
3822
+ container: ref(0),
3823
+ // Container width
3824
+ minHeight: ref(0),
3825
+ maxHeight: ref(0),
3826
+ chat: ref(0),
3827
+ // Chat panel width
3828
+ logs: ref(0),
3829
+ height: ref(0)
3830
+ };
3831
+ const rootStyles = computed(() => ({
3832
+ "--panel-height": `${dimensions.height.value}px`,
3833
+ "--chat-width": `${dimensions.chat.value}px`
3834
+ }));
3835
+ const panelToContainerRatio = computed(() => {
3836
+ const chatRatio = dimensions.chat.value / dimensions.container.value;
3837
+ const containerRatio = dimensions.container.value / window.screen.width;
3838
+ return {
3839
+ chat: chatRatio.toFixed(2),
3840
+ logs: (1 - chatRatio).toFixed(2),
3841
+ container: containerRatio.toFixed(2)
3842
+ };
3843
+ });
3844
+ function onResize(newHeight) {
3845
+ const { minHeight, maxHeight } = dimensions;
3846
+ dimensions.height.value = Math.min(Math.max(newHeight, minHeight.value), maxHeight.value);
3847
+ }
3848
+ function onResizeDebounced(data) {
3849
+ void useDebounce().callDebounced(onResize, { debounceTime: 10, trailing: true }, data.height);
3850
+ }
3851
+ function onResizeChat(width) {
3852
+ const containerWidth = dimensions.container.value;
3853
+ const maxWidth = containerWidth * MAX_WIDTH_PERCENTAGE;
3854
+ const minWidth = containerWidth * MIN_WIDTH_PERCENTAGE;
3855
+ dimensions.chat.value = Math.min(Math.max(width, minWidth), maxWidth);
3856
+ dimensions.logs.value = dimensions.container.value - dimensions.chat.value;
3857
+ }
3858
+ function onResizeChatDebounced(data) {
3859
+ void useDebounce().callDebounced(
3860
+ onResizeChat,
3861
+ { debounceTime: 10, trailing: true },
3862
+ data.width
3863
+ );
3864
+ }
3865
+ function restorePersistedDimensions() {
3866
+ const persistedHeight = parseInt(storage.height.value ?? "0", 10);
3867
+ const persistedWidth = parseInt(storage.width.value ?? "0", 10);
3868
+ if (persistedHeight) onResize(persistedHeight);
3869
+ if (persistedWidth) onResizeChat(persistedWidth);
3870
+ }
3871
+ function onWindowResize() {
3872
+ if (!container2.value) return;
3873
+ dimensions.container.value = container2.value.getBoundingClientRect().width;
3874
+ onResizeChat(dimensions.chat.value);
3875
+ dimensions.minHeight.value = window.innerHeight * MIN_HEIGHT_PERCENTAGE;
3876
+ dimensions.maxHeight.value = window.innerHeight * MAX_HEIGHT_PERCENTAGE;
3877
+ onResize(dimensions.height.value);
3878
+ }
3879
+ watchEffect(() => {
3880
+ const { chat: chat2, height } = dimensions;
3881
+ if (chat2.value > 0) storage.width.value = chat2.value.toString();
3882
+ if (height.value > 0) storage.height.value = height.value.toString();
3883
+ });
3884
+ watchEffect(() => {
3885
+ if (container2.value) {
3886
+ onWindowResize();
3887
+ restorePersistedDimensions();
3888
+ }
3889
+ });
3890
+ onMounted(() => window.addEventListener("resize", onWindowResize));
3891
+ onBeforeUnmount(() => window.removeEventListener("resize", onWindowResize));
3892
+ return {
3893
+ height: dimensions.height,
3894
+ chatWidth: dimensions.chat,
3895
+ logsWidth: dimensions.logs,
3896
+ rootStyles,
3897
+ onWindowResize,
3898
+ onResizeDebounced,
3899
+ onResizeChatDebounced,
3900
+ panelToContainerRatio
3901
+ };
3902
+ }
3903
+ const _sfc_main = /* @__PURE__ */ defineComponent({
3904
+ __name: "CanvasChat",
3905
+ setup(__props, { expose: __expose }) {
3906
+ const workflowsStore = useWorkflowsStore();
3907
+ const uiStore = useUIStore();
3908
+ const canvasStore = useCanvasStore();
3909
+ const nodeTypesStore = useNodeTypesStore();
3910
+ const nodeHelpers = useNodeHelpers();
3911
+ const router = useRouter();
3912
+ const messages2 = ref([]);
3913
+ const currentSessionId = ref(v4().replace(/-/g, ""));
3914
+ const isDisabled = ref(false);
3915
+ const container2 = ref();
3916
+ const workflow = computed(() => workflowsStore.getCurrentWorkflow());
3917
+ const isLoading = computed(() => {
3918
+ const result = uiStore.isActionActive.workflowRunning;
3919
+ return result;
3920
+ });
3921
+ const allConnections = computed(() => workflowsStore.allConnections);
3922
+ const isChatOpen = computed(() => {
3923
+ const result = workflowsStore.isChatPanelOpen;
3924
+ return result;
3925
+ });
3926
+ const canvasNodes = computed(() => workflowsStore.allNodes);
3927
+ const isLogsOpen = computed(() => workflowsStore.isLogsPanelOpen);
3928
+ const previousChatMessages = computed(() => workflowsStore.getPastChatMessages);
3929
+ __expose({
3930
+ messages: messages2,
3931
+ currentSessionId,
3932
+ isDisabled,
3933
+ workflow,
3934
+ isLoading
3935
+ });
3936
+ const { runWorkflow } = useRunWorkflow({ router });
3937
+ const { chatTriggerNode, connectedNode, allowFileUploads, setChatTriggerNode, setConnectedNode } = useChatTrigger({
3938
+ workflow,
3939
+ canvasNodes,
3940
+ getNodeByName: workflowsStore.getNodeByName,
3941
+ getNodeType: nodeTypesStore.getNodeType
3942
+ });
3943
+ const { sendMessage, getChatMessages } = useChatMessaging({
3944
+ chatTrigger: chatTriggerNode,
3945
+ connectedNode,
3946
+ messages: messages2,
3947
+ sessionId: currentSessionId,
3948
+ workflow,
3949
+ isLoading,
3950
+ executionResultData: computed(() => {
3951
+ var _a, _b;
3952
+ return (_b = (_a = workflowsStore.getWorkflowExecution) == null ? void 0 : _a.data) == null ? void 0 : _b.resultData;
3953
+ }),
3954
+ getWorkflowResultDataByNodeName: workflowsStore.getWorkflowResultDataByNodeName,
3955
+ onRunChatWorkflow
3956
+ });
3957
+ const {
3958
+ height,
3959
+ chatWidth,
3960
+ rootStyles,
3961
+ logsWidth,
3962
+ onResizeDebounced,
3963
+ onResizeChatDebounced,
3964
+ onWindowResize
3965
+ } = useResize(container2);
3966
+ function createChatConfig(params) {
3967
+ const chatConfig2 = {
3968
+ messages: params.messages,
3969
+ sendMessage: params.sendMessage,
3970
+ initialMessages: ref([]),
3971
+ currentSessionId: params.currentSessionId,
3972
+ waitingForResponse: params.isLoading
3973
+ };
3974
+ const chatOptions2 = {
3975
+ i18n: {
3976
+ en: {
3977
+ title: "",
3978
+ footer: "",
3979
+ subtitle: "",
3980
+ inputPlaceholder: params.locale.baseText("chat.window.chat.placeholder"),
3981
+ getStarted: "",
3982
+ closeButtonTooltip: ""
3983
+ }
3984
+ },
3985
+ webhookUrl: "",
3986
+ mode: "window",
3987
+ showWindowCloseButton: true,
3988
+ disabled: params.isDisabled,
3989
+ allowFileUploads: params.allowFileUploads,
3990
+ allowedFilesMimeTypes: ""
3991
+ };
3992
+ return { chatConfig: chatConfig2, chatOptions: chatOptions2 };
3993
+ }
3994
+ function displayExecution(params) {
3995
+ const route = params.router.resolve({
3996
+ name: VIEWS.EXECUTION_PREVIEW,
3997
+ params: { name: params.workflowId, executionId: params.executionId }
3998
+ });
3999
+ window.open(route.href, "_blank");
4000
+ }
4001
+ function refreshSession2(params) {
4002
+ workflowsStore.setWorkflowExecutionData(null);
4003
+ nodeHelpers.updateNodesExecutionIssues();
4004
+ params.messages.value = [];
4005
+ params.currentSessionId.value = v4().replace(/-/g, "");
4006
+ }
4007
+ const handleDisplayExecution = (executionId) => {
4008
+ displayExecution({
4009
+ router,
4010
+ workflowId: workflow.value.id,
4011
+ executionId
4012
+ });
4013
+ };
4014
+ const handleRefreshSession = () => {
4015
+ refreshSession2({
4016
+ messages: messages2,
4017
+ currentSessionId
4018
+ });
4019
+ };
4020
+ const closePanel = () => {
4021
+ workflowsStore.setPanelOpen("chat", false);
4022
+ };
4023
+ async function onRunChatWorkflow(payload) {
4024
+ const response = await runWorkflow({
4025
+ triggerNode: payload.triggerNode,
4026
+ nodeData: payload.nodeData,
4027
+ source: payload.source
4028
+ });
4029
+ workflowsStore.appendChatMessage(payload.message);
4030
+ return response;
4031
+ }
4032
+ const { chatConfig, chatOptions } = createChatConfig({
4033
+ messages: messages2,
4034
+ sendMessage,
4035
+ currentSessionId,
4036
+ isLoading,
4037
+ isDisabled,
4038
+ allowFileUploads,
4039
+ locale: useI18n$1()
4040
+ });
4041
+ provide(ChatSymbol, chatConfig);
4042
+ provide(ChatOptionsSymbol, chatOptions);
4043
+ watch(
4044
+ () => isChatOpen.value,
4045
+ (isOpen) => {
4046
+ if (isOpen) {
4047
+ setChatTriggerNode();
4048
+ setConnectedNode();
4049
+ if (messages2.value.length === 0) {
4050
+ messages2.value = getChatMessages();
4051
+ }
4052
+ setTimeout(() => {
4053
+ onWindowResize();
4054
+ chatEventBus.emit("focusInput");
4055
+ }, 0);
4056
+ }
4057
+ },
4058
+ { immediate: true }
4059
+ );
4060
+ watch(
4061
+ () => allConnections.value,
4062
+ () => {
4063
+ if (canvasStore.isLoading) return;
4064
+ setTimeout(() => {
4065
+ if (!chatTriggerNode.value) {
4066
+ setChatTriggerNode();
4067
+ }
4068
+ setConnectedNode();
4069
+ }, 0);
4070
+ },
4071
+ { deep: true }
4072
+ );
4073
+ watchEffect(() => {
4074
+ canvasStore.setPanelHeight(isChatOpen.value || isLogsOpen.value ? height.value : 0);
4075
+ });
4076
+ return (_ctx, _cache) => {
4077
+ const _component_n8n_resize_wrapper = resolveComponent("n8n-resize-wrapper");
4078
+ return unref(chatTriggerNode) ? (openBlock(), createBlock(_component_n8n_resize_wrapper, {
4079
+ key: 0,
4080
+ "is-resizing-enabled": isChatOpen.value || isLogsOpen.value,
4081
+ "supported-directions": ["top"],
4082
+ class: normalizeClass([_ctx.$style.resizeWrapper, !isChatOpen.value && !isLogsOpen.value && _ctx.$style.empty]),
4083
+ height: unref(height),
4084
+ style: normalizeStyle(unref(rootStyles)),
4085
+ onResize: unref(onResizeDebounced)
4086
+ }, {
4087
+ default: withCtx(() => [
4088
+ createBaseVNode("div", {
4089
+ ref_key: "container",
4090
+ ref: container2,
4091
+ class: normalizeClass(_ctx.$style.container)
4092
+ }, [
4093
+ isChatOpen.value || isLogsOpen.value ? (openBlock(), createElementBlock("div", {
4094
+ key: 0,
4095
+ class: normalizeClass(_ctx.$style.chatResizer)
4096
+ }, [
4097
+ isChatOpen.value ? (openBlock(), createBlock(_component_n8n_resize_wrapper, {
4098
+ key: 0,
4099
+ "supported-directions": ["right"],
4100
+ width: unref(chatWidth),
4101
+ class: normalizeClass(_ctx.$style.chat),
4102
+ onResize: unref(onResizeChatDebounced)
4103
+ }, {
4104
+ default: withCtx(() => [
4105
+ createBaseVNode("div", {
4106
+ class: normalizeClass(_ctx.$style.inner)
4107
+ }, [
4108
+ createVNode(ChatMessagesPanel, {
4109
+ "data-test-id": "canvas-chat",
4110
+ messages: messages2.value,
4111
+ "session-id": currentSessionId.value,
4112
+ "past-chat-messages": previousChatMessages.value,
4113
+ onRefreshSession: handleRefreshSession,
4114
+ onDisplayExecution: handleDisplayExecution,
4115
+ onSendMessage: unref(sendMessage)
4116
+ }, null, 8, ["messages", "session-id", "past-chat-messages", "onSendMessage"])
4117
+ ], 2)
4118
+ ]),
4119
+ _: 1
4120
+ }, 8, ["width", "class", "onResize"])) : createCommentVNode("", true),
4121
+ isLogsOpen.value && unref(connectedNode) ? (openBlock(), createElementBlock("div", {
4122
+ key: 1,
4123
+ class: normalizeClass(_ctx.$style.logs)
4124
+ }, [
4125
+ (openBlock(), createBlock(ChatLogsPanel, {
4126
+ key: messages2.value.length,
4127
+ workflow: workflow.value,
4128
+ "data-test-id": "canvas-chat-logs",
4129
+ node: unref(connectedNode),
4130
+ slim: unref(logsWidth) < 700,
4131
+ onClose: closePanel
4132
+ }, null, 8, ["workflow", "node", "slim"]))
4133
+ ], 2)) : createCommentVNode("", true)
4134
+ ], 2)) : createCommentVNode("", true)
4135
+ ], 2)
4136
+ ]),
4137
+ _: 1
4138
+ }, 8, ["is-resizing-enabled", "class", "height", "style", "onResize"])) : createCommentVNode("", true);
4139
+ };
4140
+ }
4141
+ });
4142
+ const resizeWrapper = "_resizeWrapper_gmykl_1";
4143
+ const empty = "_empty_gmykl_8";
4144
+ const container = "_container_gmykl_14";
4145
+ const chatResizer = "_chatResizer_gmykl_22";
4146
+ const footer = "_footer_gmykl_29";
4147
+ const chat = "_chat_gmykl_22";
4148
+ const inner = "_inner_gmykl_48";
4149
+ const logs = "_logs_gmykl_56";
4150
+ const style0 = {
4151
+ resizeWrapper,
4152
+ empty,
4153
+ container,
4154
+ chatResizer,
4155
+ footer,
4156
+ chat,
4157
+ inner,
4158
+ logs
4159
+ };
4160
+ const cssModules = {
4161
+ "$style": style0
4162
+ };
4163
+ const CanvasChat = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules]]);
4164
+ export {
4165
+ CanvasChat as default
4166
+ };