@mcp-use/inspector 20.0.0-beta.1 → 20.0.0-beta.2

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 (196) hide show
  1. package/README.md +5 -0
  2. package/dist/cdn/{AnimatePresence-B4HhIdgq.js → AnimatePresence-Dcw-FOy8.js} +50 -50
  3. package/dist/cdn/ChatTab-DBl6dHVH.js +6744 -0
  4. package/dist/cdn/{CheckboxIndicator-BF2cKfbA.js → CheckboxIndicator-Bt4IICtv.js} +77 -77
  5. package/dist/cdn/{ConnectionSettingsForm-BNS6bOMD.js → ConnectionSettingsForm-BFsZpwK4.js} +348 -292
  6. package/dist/cdn/ConnectionSettingsTab-DDk06dhT.js +150 -0
  7. package/dist/cdn/{ElicitationTab-upPXq2q7.js → ElicitationTab-CL1KJ0bz.js} +39 -39
  8. package/dist/cdn/{FormContext-Cl51-7O7.js → FormContext-tmgN_Vdr.js} +1 -1
  9. package/dist/cdn/{InspectorContext-DzXtgyTx.js → InspectorContext-UjtEbNod.js} +1 -21
  10. package/dist/cdn/{JSONDisplay-D3RcyO9z.js → JSONDisplay-BFxf5oEu.js} +18 -18
  11. package/dist/cdn/{ListTabHeader-8lULn-90.js → ListTabHeader-Cv-GmtGF.js} +19 -19
  12. package/dist/cdn/{ManufactOAuthCallback-DEM8mhWD.js → ManufactOAuthCallback-B98kSYCj.js} +1 -1
  13. package/dist/cdn/MarkdownRenderer-DQflNTGo.js +3610 -0
  14. package/dist/cdn/{NotificationsTab-CWopTIzT.js → NotificationsTab-CeImSrhx.js} +13 -13
  15. package/dist/cdn/{OAuthCallback-k3oeLtIC.js → OAuthCallback-C4n2hqKU.js} +1 -1
  16. package/dist/cdn/PromptsTab-C84YLTSM.js +901 -0
  17. package/dist/cdn/{ResourcesTab-KfamsM6-.js → ResourcesTab-CCa5bIHE.js} +35 -55
  18. package/dist/cdn/{SamplingTab-vcufuK24.js → SamplingTab-Bt9z8yQ2.js} +35 -35
  19. package/dist/cdn/{ServerMetadataTab-DS0eiyyD.js → ServerMetadataTab-CvrKX8fz.js} +12 -12
  20. package/dist/cdn/{StatusIcon-BGXOEU2u.js → StatusIcon-D0-ARyOh.js} +6 -6
  21. package/dist/cdn/{ToolsTab-DRjcZnpu.js → ToolsTab-v9zgWmM6.js} +103 -137
  22. package/dist/cdn/{ViewPreview-B_onhcUB.js → ViewPreview-DsPwZAwO.js} +2 -2
  23. package/dist/cdn/{WidgetWrapper-D29YDxIu.js → WidgetWrapper-CwlpDv17.js} +529 -530
  24. package/dist/cdn/card-DgiYnSg-.js +41 -0
  25. package/dist/cdn/{checkbox-B4oUG6Rr.js → checkbox-By0FklhG.js} +6 -6
  26. package/dist/cdn/{dialog-Dnl-pZsY.js → dialog-BsDpuJd3.js} +151 -151
  27. package/dist/cdn/{dist-mRDqCgKU.js → dist-B0eL32Gb.js} +114 -113
  28. package/dist/cdn/{dist-DjXr_YO3.js → dist-DaMB0Su9.js} +1 -1
  29. package/dist/cdn/{index-browser-CVUwR-Bu.js → index-browser-QDjRGsPo.js} +1 -1
  30. package/dist/cdn/{input-BLxOA7V-.js → input-C2OBd4PJ.js} +4787 -2842
  31. package/dist/cdn/inspector.css +1 -1
  32. package/dist/cdn/inspector.js +7419 -7445
  33. package/dist/cdn/{label-CBvG613A.js → label-B9Jmm9be.js} +10 -10
  34. package/dist/cdn/{manufact-auth-0TVxpeTA.js → manufact-auth-BQMHhbLV.js} +142 -106
  35. package/dist/cdn/{not-found-BcNNsTjS.js → not-found-DEtSM_Wd.js} +7 -7
  36. package/dist/cdn/providerMeta-BQIfHuNL.js +379 -0
  37. package/dist/cdn/{react-BxO-uEDZ.js → react-Dn8PWXwP.js} +1 -1
  38. package/dist/cdn/{select-BZ_IoKxg.js → select-DDdiIPR2.js} +726 -726
  39. package/dist/cdn/{shared-uMiV6Fx1.js → shared-DaILIQPP.js} +29 -29
  40. package/dist/cdn/{popover-C_SSrXT0.js → sheet-Br_l2kry.js} +694 -622
  41. package/dist/cdn/{spinner-CWcJhIY_.js → spinner-jQtC7EBj.js} +5 -5
  42. package/dist/cdn/{switch-DtQOLb9R.js → switch-C3IyQuid.js} +104 -104
  43. package/dist/cdn/{tabs-subtle-C5cy35sY.js → tabs-subtle-CkdI6Mac.js} +147 -147
  44. package/dist/cdn/{telemetry-Ct6pVkM1.js → telemetry-DGoIGfIS.js} +3 -3
  45. package/dist/cdn/{textarea-Bj-CT7hC.js → textarea-DSbwcFVt.js} +6 -6
  46. package/dist/cdn/{useAriaLabelledBy-Bm9qHGK6.js → useAriaLabelledBy-DqAdnppm.js} +1 -1
  47. package/dist/cdn/{useCompositeItem-CNJ6MXdi.js → useCompositeItem-BRqEzYh-.js} +2 -2
  48. package/dist/cdn/{useConfig-CwxZ6Quj.js → useConfig-CTb6GZbt.js} +73 -46
  49. package/dist/cdn/{useViewHostProps-Dr6W2ooF.js → useViewHostProps-DIIlz3tJ.js} +1 -1
  50. package/dist/cli.js +26 -12
  51. package/dist/client/auth/manufact-auth.d.ts +3 -1
  52. package/dist/client/auth/manufact-auth.d.ts.map +1 -1
  53. package/dist/client/components/ChatTab.d.ts +1 -8
  54. package/dist/client/components/ChatTab.d.ts.map +1 -1
  55. package/dist/client/components/ResourcesTab.d.ts.map +1 -1
  56. package/dist/client/components/chat/ChatHeader.d.ts +7 -2
  57. package/dist/client/components/chat/ChatHeader.d.ts.map +1 -1
  58. package/dist/client/components/chat/ChatLandingForm.d.ts +4 -2
  59. package/dist/client/components/chat/ChatLandingForm.d.ts.map +1 -1
  60. package/dist/client/components/chat/ChatManagedNotice.d.ts +10 -0
  61. package/dist/client/components/chat/ChatManagedNotice.d.ts.map +1 -0
  62. package/dist/client/components/chat/ChatScrollTopFade.d.ts +7 -0
  63. package/dist/client/components/chat/ChatScrollTopFade.d.ts.map +1 -0
  64. package/dist/client/components/chat/ConfigurationDialog.d.ts +11 -9
  65. package/dist/client/components/chat/ConfigurationDialog.d.ts.map +1 -1
  66. package/dist/client/components/chat/ConfigureEmptyState.d.ts +1 -6
  67. package/dist/client/components/chat/ConfigureEmptyState.d.ts.map +1 -1
  68. package/dist/client/components/chat/StreamingAssistantContent.d.ts.map +1 -1
  69. package/dist/client/components/chat/chatModeStorage.d.ts +11 -0
  70. package/dist/client/components/chat/chatModeStorage.d.ts.map +1 -0
  71. package/dist/client/components/chat/managedChatNotice.d.ts +16 -0
  72. package/dist/client/components/chat/managedChatNotice.d.ts.map +1 -0
  73. package/dist/client/components/chat/providerMeta.d.ts +11 -0
  74. package/dist/client/components/chat/providerMeta.d.ts.map +1 -1
  75. package/dist/client/components/chat/useChatMessages.d.ts +7 -5
  76. package/dist/client/components/chat/useChatMessages.d.ts.map +1 -1
  77. package/dist/client/components/chat/useChatMessagesClientSide.d.ts +4 -6
  78. package/dist/client/components/chat/useChatMessagesClientSide.d.ts.map +1 -1
  79. package/dist/client/components/chat/useChatScrollToBottom.d.ts +1 -0
  80. package/dist/client/components/chat/useChatScrollToBottom.d.ts.map +1 -1
  81. package/dist/client/components/chat/useConfig.d.ts +1 -1
  82. package/dist/client/components/chat/useConfig.d.ts.map +1 -1
  83. package/dist/client/components/chat/useHostedChatMode.d.ts +1 -1
  84. package/dist/client/components/chat/useHostedChatMode.d.ts.map +1 -1
  85. package/dist/client/components/shared/MarkdownRenderer.d.ts +2 -1
  86. package/dist/client/components/shared/MarkdownRenderer.d.ts.map +1 -1
  87. package/dist/client/components/tools/useToolsTabNavigation.d.ts.map +1 -1
  88. package/dist/client/components/ui/MeshGradientCanvas.d.ts +13 -0
  89. package/dist/client/components/ui/MeshGradientCanvas.d.ts.map +1 -0
  90. package/dist/client/components/ui/chat-message.d.ts +1 -1
  91. package/dist/client/components/ui/chat-message.d.ts.map +1 -1
  92. package/dist/client/components/ui/file-thumbnail.d.ts.map +1 -1
  93. package/dist/client/components/ui/mesh-tab-background.d.ts +3 -1
  94. package/dist/client/components/ui/mesh-tab-background.d.ts.map +1 -1
  95. package/dist/client/context/InspectorContext.d.ts.map +1 -1
  96. package/dist/client/index.js +2577 -2165
  97. package/dist/client/telemetry/utils.d.ts.map +1 -1
  98. package/dist/server/asset-urls.d.ts +4 -0
  99. package/dist/server/asset-urls.d.ts.map +1 -1
  100. package/dist/server/asset-urls.js +7 -3
  101. package/dist/server/cdn-shell.d.ts.map +1 -1
  102. package/dist/server/cdn-shell.js +3 -3
  103. package/dist/server/{chunk-KBVKS4J5.js → chunk-H6ZCIKBS.js} +10 -0
  104. package/dist/server/{chunk-VDUV6LR6.js → chunk-K2DPKTIS.js} +15 -4
  105. package/dist/server/{chunk-Y2GBQOQW.js → chunk-LIM6NAUS.js} +1 -8
  106. package/dist/server/{chunk-K2V2SDQD.js → chunk-OWR2BIBW.js} +1 -1
  107. package/dist/server/{chunk-IXYK6ZOY.js → chunk-R6RQMIXL.js} +2 -2
  108. package/dist/server/{chunk-5B3SXGZP.js → chunk-UJLXHNQP.js} +1 -1
  109. package/dist/server/{chunk-6XWDZEFF.js → chunk-XCNS5CIW.js} +8 -3
  110. package/dist/server/cli.js +5 -5
  111. package/dist/server/create-dev-api-app.js +3 -3
  112. package/dist/server/dev-callback-redirect.d.ts +3 -0
  113. package/dist/server/dev-callback-redirect.d.ts.map +1 -0
  114. package/dist/server/dev-callback-redirect.js +18 -0
  115. package/dist/server/index.js +6 -6
  116. package/dist/server/middleware.js +6 -6
  117. package/dist/server/proxy/index.js +1 -1
  118. package/dist/server/proxy/mcp-proxy.d.ts +2 -0
  119. package/dist/server/proxy/mcp-proxy.d.ts.map +1 -1
  120. package/dist/server/proxy/mcp-proxy.js +3 -1
  121. package/dist/server/proxy-routes.js +2 -2
  122. package/dist/server/server.js +3 -3
  123. package/dist/server/version.js +1 -1
  124. package/dist/server/vite-dev-api-plugin.js +3 -3
  125. package/dist/web/assets/{AnimatePresence-CthXziG2.js → AnimatePresence-C5p0yiY1.js} +2 -2
  126. package/dist/web/assets/ChatTab-C2FtENBM.js +18 -0
  127. package/dist/web/assets/ConnectionSettingsTab-B2sUjytG.js +1 -0
  128. package/dist/web/assets/ElicitationTab-DwH08kDC.js +1 -0
  129. package/dist/web/assets/{FormContext-Cqc_A12u.js → FormContext-DH2caWKO.js} +1 -1
  130. package/dist/web/assets/ListTabHeader-R17w_JsB.js +1 -0
  131. package/dist/web/assets/{ManufactOAuthCallback-DCLbW-mz.js → ManufactOAuthCallback-Btu4B6u6.js} +1 -1
  132. package/dist/web/assets/MarkdownRenderer-DpIEt9wb.js +47 -0
  133. package/dist/web/assets/{NotificationsTab-JevzvJTg.js → NotificationsTab-CHB8mtSz.js} +1 -1
  134. package/dist/web/assets/{OAuthCallback-BjcRxLh5.js → OAuthCallback-DV4MgX4Z.js} +1 -1
  135. package/dist/web/assets/PromptsTab-0GIapoSs.js +15 -0
  136. package/dist/web/assets/ResourcesTab-N9xjsI_b.js +2 -0
  137. package/dist/web/assets/SamplingTab-Dw0vpi4t.js +1 -0
  138. package/dist/web/assets/ServerMetadataTab-D-eQpLBF.js +1 -0
  139. package/dist/web/assets/ToolsTab-BMrMJ5JV.js +8 -0
  140. package/dist/web/assets/ViewPreview-N_cpEO0W.js +1 -0
  141. package/dist/web/assets/WidgetWrapper-pDgNVq9y.js +34 -0
  142. package/dist/web/assets/checkbox-CrnXSMh2.js +1 -0
  143. package/dist/web/assets/dist-CeWSydFI.js +21 -0
  144. package/dist/web/assets/index-Cfuv_gb3.js +475 -0
  145. package/dist/web/assets/index-fBX3akc8.css +1 -0
  146. package/dist/web/assets/input-CLYhA7PK.js +1 -0
  147. package/dist/web/assets/{label-B5Q_Zr8M.js → label-Cdim77Jw.js} +1 -1
  148. package/dist/web/assets/select-CJ57-Bor.js +1 -0
  149. package/dist/web/assets/shared-B1GD9FMm.js +1 -0
  150. package/dist/web/assets/{tabs-subtle-AkJZvdxS.js → tabs-subtle-CG5cjC_N.js} +1 -1
  151. package/dist/web/assets/textarea-DLAmNVf_.js +1 -0
  152. package/dist/web/assets/useConfig-BTp15Lle.js +1 -0
  153. package/dist/web/assets/{useViewHostProps-DXAD1g7g.js → useViewHostProps-BQlaFC2Q.js} +1 -1
  154. package/dist/web/index.html +8 -9
  155. package/package.json +4 -11
  156. package/dist/cdn/ChatTab-D8uwCHAf.js +0 -13218
  157. package/dist/cdn/ConnectionSettingsTab-B97gPPJW.js +0 -145
  158. package/dist/cdn/PromptsTab-Cspfnl6n.js +0 -4400
  159. package/dist/cdn/bundle-mjs-B0nmHDtp.js +0 -1953
  160. package/dist/cdn/card-DqjqAq0o.js +0 -41
  161. package/dist/cdn/chunk-BO2N2NFS-Cy167e0X.js +0 -17500
  162. package/dist/cdn/highlighted-body-OFNGDK62-CoReNbTX.js +0 -36
  163. package/dist/cdn/mermaid-GHXKKRXX-DgVIbk-D.js +0 -2
  164. package/dist/cdn/pdf-CxFT9FER.js +0 -16291
  165. package/dist/cdn/sheet-CerCdhxz.js +0 -78
  166. package/dist/cdn/useHostedSession-BA39Aegc.js +0 -153
  167. package/dist/cdn/useMCPPrompts-D3_Hla_z.js +0 -104
  168. package/dist/client/components/chat/streamdown-code-slim.d.ts +0 -4
  169. package/dist/client/components/chat/streamdown-code-slim.d.ts.map +0 -1
  170. package/dist/web/assets/ChatTab-Cy8eyFYI.js +0 -460
  171. package/dist/web/assets/ConnectionSettingsTab-sDZGaUJn.js +0 -1
  172. package/dist/web/assets/ElicitationTab-wDKgU1qL.js +0 -1
  173. package/dist/web/assets/ListTabHeader-G-nQX18m.js +0 -1
  174. package/dist/web/assets/PromptsTab-DsQVOjKH.js +0 -61
  175. package/dist/web/assets/ResourcesTab-Bw8_p6M1.js +0 -2
  176. package/dist/web/assets/SamplingTab-BrcF1zJF.js +0 -1
  177. package/dist/web/assets/ServerMetadataTab-Bydeh1Po.js +0 -1
  178. package/dist/web/assets/ToolsTab-DJWF7Q_x.js +0 -8
  179. package/dist/web/assets/ViewPreview-jgeU7bY9.js +0 -1
  180. package/dist/web/assets/WidgetWrapper-B_vJU9uF.js +0 -34
  181. package/dist/web/assets/bundle-mjs-8puS6ou7.js +0 -1
  182. package/dist/web/assets/checkbox-BA-XURSj.js +0 -1
  183. package/dist/web/assets/chunk-BO2N2NFS-CGbd3eLY.js +0 -131
  184. package/dist/web/assets/dist-BcAQZluc.js +0 -21
  185. package/dist/web/assets/highlighted-body-OFNGDK62-BBJFbIMp.js +0 -1
  186. package/dist/web/assets/index-BjH-Qp85.css +0 -1
  187. package/dist/web/assets/index-D2UxaT9v.js +0 -475
  188. package/dist/web/assets/input-CjmxOFr6.js +0 -1
  189. package/dist/web/assets/mermaid-GHXKKRXX-B4MKVODA.js +0 -1
  190. package/dist/web/assets/pdf-CuwKm9zO.js +0 -54
  191. package/dist/web/assets/select-C0xlfLAa.js +0 -1
  192. package/dist/web/assets/shared-DQE60Op-.js +0 -1
  193. package/dist/web/assets/sheet-7TIkLdpr.js +0 -1
  194. package/dist/web/assets/textarea-Ci09-en6.js +0 -1
  195. package/dist/web/assets/useConfig-Qglo4xs1.js +0 -1
  196. package/dist/web/assets/useMCPPrompts-USLYc1I4.js +0 -1
@@ -1,4400 +0,0 @@
1
- import { s as e, t } from "./react-BIs9pQ3H.js";
2
- import { t as n } from "./jsx-runtime-CIxvMpEo.js";
3
- import { Pr as r, Rr as i, cr as a, f as o, lr as s, sr as c, t as l, ur as u } from "./input-BLxOA7V-.js";
4
- import { t as d } from "./label-CBvG613A.js";
5
- import { t as f } from "./AnimatePresence-B4HhIdgq.js";
6
- import { a as p, i as m, n as h, r as g, t as _ } from "./select-BZ_IoKxg.js";
7
- import { a as v, i as y, t as b } from "./browser-CbQIH4w2.js";
8
- import { n as x, t as S } from "./zap-Mb-pbw2X.js";
9
- import { t as C } from "./clock-CmUbSx_B.js";
10
- import { t as w } from "./JSONDisplay-D3RcyO9z.js";
11
- import { a as T, i as E, n as D, o as O, r as ee, s as te } from "./shared-uMiV6Fx1.js";
12
- import { t as ne } from "./history-Csw4rb44.js";
13
- import { t as k } from "./maximize-BALCV_ep.js";
14
- import { t as re } from "./message-square-BnxdpJxZ.js";
15
- import { n as ie, t as ae } from "./save-Tgil_AJZ.js";
16
- import { t as oe } from "./play-vuZ5PLnI.js";
17
- import { t as A } from "./trash-2-RwpJY5SL.js";
18
- import { t as j } from "./not-found-BcNNsTjS.js";
19
- import { t as se } from "./spinner-CWcJhIY_.js";
20
- import { n as M } from "./InspectorContext-DzXtgyTx.js";
21
- import { t as ce } from "./useMCPPrompts-D3_Hla_z.js";
22
- import { t as le } from "./textarea-Bj-CT7hC.js";
23
- import { t as ue } from "./checkbox-B4oUG6Rr.js";
24
- import { t as N } from "./ListTabHeader-8lULn-90.js";
25
- //#region src/client/components/prompts/PromptInputForm.tsx
26
- var P = /* @__PURE__ */ e(t(), 1), F = n();
27
- function de({ selectedPrompt: e, promptArgs: t, onArgChange: n }) {
28
- let r = e?.arguments || [];
29
- if (!(r.length > 0)) return /* @__PURE__ */ (0, F.jsx)("div", {
30
- className: "flex items-center justify-center h-32 text-gray-500 dark:text-gray-400 text-sm",
31
- children: "No arguments required"
32
- });
33
- let i = (e) => {
34
- let r = e.name, i = t[r], a = typeof i == "string" ? i : JSON.stringify(i);
35
- return e.type === "boolean" ? /* @__PURE__ */ (0, F.jsxs)("div", {
36
- className: "space-y-2",
37
- children: [/* @__PURE__ */ (0, F.jsxs)("div", { children: [/* @__PURE__ */ (0, F.jsxs)(d, {
38
- htmlFor: r,
39
- className: "text-sm font-medium",
40
- children: [r, e.required && /* @__PURE__ */ (0, F.jsx)("span", {
41
- className: "text-red-500 ml-1",
42
- children: "*"
43
- })]
44
- }), e.description && /* @__PURE__ */ (0, F.jsx)("p", {
45
- className: "mt-0.5 text-xs text-gray-500 dark:text-gray-400",
46
- children: e.description
47
- })] }), /* @__PURE__ */ (0, F.jsx)("input", {
48
- id: r,
49
- type: "checkbox",
50
- checked: !!i,
51
- onChange: (e) => n(r, e.target.checked),
52
- className: "rounded",
53
- "aria-label": `Toggle ${r}`
54
- })]
55
- }, r) : e.type === "number" ? /* @__PURE__ */ (0, F.jsxs)("div", {
56
- className: "space-y-2",
57
- children: [/* @__PURE__ */ (0, F.jsxs)("div", { children: [/* @__PURE__ */ (0, F.jsxs)(d, {
58
- htmlFor: r,
59
- className: "text-sm font-medium",
60
- children: [r, e.required && /* @__PURE__ */ (0, F.jsx)("span", {
61
- className: "text-red-500 ml-1",
62
- children: "*"
63
- })]
64
- }), e.description && /* @__PURE__ */ (0, F.jsx)("p", {
65
- className: "mt-0.5 text-xs text-gray-500 dark:text-gray-400",
66
- children: e.description
67
- })] }), /* @__PURE__ */ (0, F.jsx)(l, {
68
- id: r,
69
- type: "number",
70
- value: Number(i) || 0,
71
- onChange: (e) => n(r, Number(e.target.value)),
72
- placeholder: `Enter ${r}`
73
- })]
74
- }, r) : e.type === "array" || e.type === "object" ? /* @__PURE__ */ (0, F.jsxs)("div", {
75
- className: "space-y-2",
76
- children: [/* @__PURE__ */ (0, F.jsxs)("div", { children: [/* @__PURE__ */ (0, F.jsxs)(d, {
77
- htmlFor: r,
78
- className: "text-sm font-medium",
79
- children: [r, e.required && /* @__PURE__ */ (0, F.jsx)("span", {
80
- className: "text-red-500 ml-1",
81
- children: "*"
82
- })]
83
- }), e.description && /* @__PURE__ */ (0, F.jsx)("p", {
84
- className: "mt-0.5 text-xs text-gray-500 dark:text-gray-400",
85
- children: e.description
86
- })] }), /* @__PURE__ */ (0, F.jsx)(le, {
87
- id: r,
88
- value: a,
89
- onChange: (e) => {
90
- try {
91
- n(r, JSON.parse(e.target.value));
92
- } catch {
93
- n(r, e.target.value);
94
- }
95
- },
96
- placeholder: `Enter ${r} as JSON`,
97
- className: "font-mono text-sm min-h-[100px]"
98
- })]
99
- }, r) : /* @__PURE__ */ (0, F.jsxs)("div", {
100
- className: "space-y-2",
101
- children: [/* @__PURE__ */ (0, F.jsxs)("div", { children: [/* @__PURE__ */ (0, F.jsxs)(d, {
102
- htmlFor: r,
103
- className: "text-sm font-medium",
104
- children: [r, e.required && /* @__PURE__ */ (0, F.jsx)("span", {
105
- className: "text-red-500 ml-1",
106
- children: "*"
107
- })]
108
- }), e.description && /* @__PURE__ */ (0, F.jsx)("p", {
109
- className: "mt-0.5 text-xs text-gray-500 dark:text-gray-400",
110
- children: e.description
111
- })] }), /* @__PURE__ */ (0, F.jsx)(l, {
112
- id: r,
113
- "data-testid": `prompt-param-${r}`,
114
- value: a,
115
- onChange: (e) => n(r, e.target.value),
116
- placeholder: `Enter ${r}`
117
- })]
118
- }, r);
119
- };
120
- return /* @__PURE__ */ (0, F.jsx)("div", {
121
- className: "space-y-4",
122
- children: r.map((e) => i(e))
123
- });
124
- }
125
- //#endregion
126
- //#region src/client/components/prompts/PromptExecutionPanel.tsx
127
- function fe({ selectedPrompt: e, promptArgs: t, isExecuting: n, isConnected: r, onArgChange: o, onExecute: l, onSave: d }) {
128
- return (0, P.useEffect)(() => {
129
- let t = (t) => {
130
- (t.metaKey || t.ctrlKey) && t.key === "Enter" && e && !n && r && (t.preventDefault(), l());
131
- };
132
- return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
133
- }, [
134
- e,
135
- n,
136
- r,
137
- l
138
- ]), e ? /* @__PURE__ */ (0, F.jsxs)("div", {
139
- className: "flex flex-col h-full",
140
- children: [/* @__PURE__ */ (0, F.jsx)("div", {
141
- className: "flex-shrink-0 p-3 sm:p-6 pt-3 pb-4 pr-3",
142
- children: /* @__PURE__ */ (0, F.jsxs)("div", { children: [/* @__PURE__ */ (0, F.jsxs)("div", {
143
- className: "flex flex-row items-center justify-between mb-0 gap-2",
144
- children: [/* @__PURE__ */ (0, F.jsx)("h3", {
145
- className: "text-base sm:text-lg font-semibold",
146
- children: e.name
147
- }), /* @__PURE__ */ (0, F.jsxs)("div", {
148
- className: "flex gap-2 flex-shrink-0",
149
- children: [/* @__PURE__ */ (0, F.jsx)(c, {
150
- onClick: l,
151
- disabled: n || !r,
152
- size: "sm",
153
- className: a,
154
- "data-testid": "prompt-execute-button",
155
- children: n ? /* @__PURE__ */ (0, F.jsxs)(F.Fragment, { children: [/* @__PURE__ */ (0, F.jsx)(se, {}), /* @__PURE__ */ (0, F.jsx)("span", {
156
- className: "hidden sm:inline",
157
- children: "Executing..."
158
- })] }) : /* @__PURE__ */ (0, F.jsxs)(F.Fragment, { children: [
159
- /* @__PURE__ */ (0, F.jsx)(oe, {}),
160
- /* @__PURE__ */ (0, F.jsx)("span", {
161
- className: "hidden sm:inline",
162
- children: "Execute"
163
- }),
164
- /* @__PURE__ */ (0, F.jsx)("span", {
165
- className: s,
166
- children: "⌘↵"
167
- })
168
- ] })
169
- }), /* @__PURE__ */ (0, F.jsxs)(c, {
170
- variant: "outline",
171
- onClick: d,
172
- disabled: n,
173
- size: "sm",
174
- className: i(u, "gap-2"),
175
- children: [/* @__PURE__ */ (0, F.jsx)(ae, {}), /* @__PURE__ */ (0, F.jsx)("span", {
176
- className: "hidden sm:inline",
177
- children: "Save"
178
- })]
179
- })]
180
- })]
181
- }), e.description && /* @__PURE__ */ (0, F.jsx)("p", {
182
- className: "text-sm text-gray-600 dark:text-gray-400 leading-relaxed mt-2",
183
- children: e.description
184
- })] })
185
- }), /* @__PURE__ */ (0, F.jsx)("div", {
186
- className: "flex-1 overflow-y-auto px-3 sm:px-6 pb-4 pr-3",
187
- children: /* @__PURE__ */ (0, F.jsx)(de, {
188
- selectedPrompt: e,
189
- promptArgs: t,
190
- onArgChange: o
191
- })
192
- })]
193
- }) : /* @__PURE__ */ (0, F.jsxs)("div", {
194
- className: "flex flex-col items-center justify-center h-full p-4 text-center",
195
- children: [/* @__PURE__ */ (0, F.jsx)("p", {
196
- className: "text-gray-500 dark:text-gray-400 mb-2",
197
- children: "Select a prompt to get started"
198
- }), /* @__PURE__ */ (0, F.jsx)("p", {
199
- className: "text-xs text-gray-400 dark:text-gray-500",
200
- children: "Choose a prompt from the list to view its details and execute it"
201
- })]
202
- });
203
- }
204
- //#endregion
205
- //#region ../../node_modules/.pnpm/markdown-to-jsx@9.7.5_react@19.2.4/node_modules/markdown-to-jsx/dist/entities.browser.js
206
- var pe;
207
- function me(e) {
208
- if (!pe) if (typeof document < "u") pe = document.createElement("textarea");
209
- else return;
210
- var t = "&" + e + ";";
211
- pe.innerHTML = t;
212
- var n = pe.value;
213
- return n === t ? void 0 : n;
214
- }
215
- //#endregion
216
- //#region ../../node_modules/.pnpm/markdown-to-jsx@9.7.5_react@19.2.4/node_modules/markdown-to-jsx/dist/index.js
217
- var I = 32, L = 9, he = 13, R = 10, z = 96, ge = 126, _e = 91, ve = 94, B = 62, ye = 35, be = 36, xe = 37, V = 45, Se = 61, H = 92, Ce = 42, we = 95, Te = 60, Ee = 64, De = 93, U = 33, Oe = 38, ke = 58, Ae = 70, je = 102, Me = 104, Ne = 119, Pe = 116, Fe = 112, Ie = 115, Le = 160, Re = 12, ze = 44, Be = 59, Ve = 63, He = 46, W = 47, Ue = 39, We = 34, Ge = 43, Ke = 124, qe = 123, Je = 125, Ye = 40, Xe = 41, Ze = 30, Qe = 31, G = 48, K = 57, q = 65, J = 90, $e = 97, et = 122, tt = 128, nt = 32, Y = {
218
- blockQuote: 0,
219
- breakLine: 1,
220
- breakThematic: 2,
221
- codeBlock: 3,
222
- codeInline: 4,
223
- footnote: 5,
224
- footnoteReference: 6,
225
- frontmatter: 7,
226
- gfmTask: 8,
227
- heading: 9,
228
- htmlBlock: 10,
229
- htmlComment: 11,
230
- htmlSelfClosing: 12,
231
- image: 13,
232
- link: 14,
233
- orderedList: 15,
234
- paragraph: 16,
235
- ref: 17,
236
- refCollection: 18,
237
- table: 19,
238
- text: 20,
239
- textFormatted: 21,
240
- unorderedList: 22
241
- };
242
- function rt(e) {
243
- if (!gt(e, "---")) return null;
244
- let t = 3;
245
- for (; t < e.length && (e[t] === " " || e[t] === " ");) t++;
246
- if (t < e.length && e[t] === "\r" && t++, t >= e.length || e[t] !== "\n") return null;
247
- t++;
248
- let n = !1;
249
- for (; t < e.length;) {
250
- let r = t;
251
- for (; t < e.length && e[t] !== "\n" && e[t] !== "\r";) t++;
252
- if (t >= e.length) break;
253
- let i = t;
254
- if (e[t] === "\r" && t++, t < e.length && e[t] === "\n" && t++, gt(e, "---", r)) return {
255
- endPos: t,
256
- hasValidYaml: n
257
- };
258
- let a = e.indexOf(":", r);
259
- a !== -1 && a < i && (n = !0);
260
- }
261
- return null;
262
- }
263
- var it = /&([a-zA-Z0-9]+|#[0-9]{1,7}|#x[0-9a-fA-F]{1,6});/gi, at = {
264
- class: "className",
265
- for: "htmlFor",
266
- allowfullscreen: "allowFullScreen",
267
- allowtransparency: "allowTransparency",
268
- autocomplete: "autoComplete",
269
- autofocus: "autoFocus",
270
- autoplay: "autoPlay",
271
- cellpadding: "cellPadding",
272
- cellspacing: "cellSpacing",
273
- charset: "charSet",
274
- classid: "classId",
275
- colspan: "colSpan",
276
- contenteditable: "contentEditable",
277
- contextmenu: "contextMenu",
278
- crossorigin: "crossOrigin",
279
- enctype: "encType",
280
- formaction: "formAction",
281
- formenctype: "formEncType",
282
- formmethod: "formMethod",
283
- formnovalidate: "formNoValidate",
284
- formtarget: "formTarget",
285
- frameborder: "frameBorder",
286
- hreflang: "hrefLang",
287
- inputmode: "inputMode",
288
- keyparams: "keyParams",
289
- keytype: "keyType",
290
- marginheight: "marginHeight",
291
- marginwidth: "marginWidth",
292
- maxlength: "maxLength",
293
- mediagroup: "mediaGroup",
294
- minlength: "minLength",
295
- novalidate: "noValidate",
296
- radiogroup: "radioGroup",
297
- readonly: "readOnly",
298
- rowspan: "rowSpan",
299
- spellcheck: "spellCheck",
300
- srcdoc: "srcDoc",
301
- srclang: "srcLang",
302
- srcset: "srcSet",
303
- tabindex: "tabIndex",
304
- usemap: "useMap",
305
- viewbox: "viewBox"
306
- };
307
- function ot(e) {
308
- var t = {};
309
- for (var n in e) {
310
- var r = at[n.toLowerCase()];
311
- if (r) t[r] = e[n];
312
- else {
313
- var i = n.indexOf(":");
314
- i === -1 ? t[n] = e[n] : t[n.slice(0, i) + n[i + 1].toUpperCase() + n.slice(i + 2)] = e[n];
315
- }
316
- }
317
- return t;
318
- }
319
- var st = /(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s|^<(div|p|h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|td|th|dl|dt|dd|hr|address|article|aside|details|dialog|figure|figcaption|footer|form|header|main|menu|nav|section|summary|textarea|fieldset|legend|center|dir|hgroup|marquee|search|output|template)\b)/i;
320
- function ct(e) {
321
- return e.indexOf("&") === -1 ? e : e.replace(it, (e, t) => {
322
- var n = me(t);
323
- if (n) return n;
324
- if (t[0] === "#") {
325
- var r = t[1] === "x" || t[1] === "X" ? parseInt(t.slice(2), 16) : parseInt(t.slice(1), 10);
326
- return r === 0 || r >= 55296 && r <= 57343 || r > 1114111 ? "�" : r <= 65535 ? String.fromCharCode(r) : String.fromCharCode(55296 + (r - 65536 >> 10), 56320 + (r - 65536 & 1023));
327
- }
328
- return e;
329
- });
330
- }
331
- var lt = /(javascript|vbscript|data(?!:image)):/i;
332
- function ut(e) {
333
- if (lt.test(e)) return null;
334
- if (e.indexOf("%") === -1) return e;
335
- try {
336
- let t = decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g, "");
337
- if (lt.test(t)) return null;
338
- } catch {
339
- return null;
340
- }
341
- return e;
342
- }
343
- var dt = {}, ft, pt;
344
- for (ft = [
345
- 192,
346
- 193,
347
- 194,
348
- 195,
349
- 196,
350
- 197,
351
- 224,
352
- 225,
353
- 226,
354
- 227,
355
- 228,
356
- 229,
357
- 230,
358
- 198
359
- ], pt = 0; pt < ft.length; pt++) dt[ft[pt]] = "a";
360
- for (dt[231] = dt[199] = "c", dt[240] = dt[208] = "d", ft = [
361
- 200,
362
- 201,
363
- 202,
364
- 203,
365
- 233,
366
- 232,
367
- 234,
368
- 235
369
- ], pt = 0; pt < ft.length; pt++) dt[ft[pt]] = "e";
370
- for (ft = [
371
- 207,
372
- 239,
373
- 206,
374
- 238,
375
- 205,
376
- 237,
377
- 204,
378
- 236
379
- ], pt = 0; pt < ft.length; pt++) dt[ft[pt]] = "i";
380
- for (dt[209] = dt[241] = "n", ft = [
381
- 248,
382
- 216,
383
- 339,
384
- 338,
385
- 213,
386
- 245,
387
- 212,
388
- 244,
389
- 211,
390
- 243,
391
- 210,
392
- 242
393
- ], pt = 0; pt < ft.length; pt++) dt[ft[pt]] = "o";
394
- for (ft = [
395
- 220,
396
- 252,
397
- 219,
398
- 251,
399
- 218,
400
- 250,
401
- 217,
402
- 249
403
- ], pt = 0; pt < ft.length; pt++) dt[ft[pt]] = "u";
404
- dt[376] = dt[255] = dt[221] = dt[253] = "y";
405
- function mt(e) {
406
- return e < tt && (At[e] & (xt | St)) !== 0;
407
- }
408
- function ht(e) {
409
- for (var t = "", n = -1, r = 0; r < e.length; r++) {
410
- var i = e.charCodeAt(r);
411
- if (mt(i)) i >= q && i <= J ? (n >= 0 && (t += e.slice(n, r), n = -1), t += String.fromCharCode(i + nt)) : n < 0 && (n = r);
412
- else if (i === I || i === V) n >= 0 && (t += e.slice(n, r), n = -1), t += "-";
413
- else {
414
- n >= 0 && (t += e.slice(n, r), n = -1);
415
- var a = dt[i];
416
- a && (t += a);
417
- }
418
- }
419
- return n >= 0 && (t += e.slice(n)), t;
420
- }
421
- function gt(e, t, n) {
422
- return e.startsWith(t, n);
423
- }
424
- var _t = new Set([
425
- "area",
426
- "base",
427
- "br",
428
- "col",
429
- "embed",
430
- "hr",
431
- "img",
432
- "input",
433
- "link",
434
- "meta",
435
- "param",
436
- "source",
437
- "track",
438
- "wbr",
439
- "circle",
440
- "ellipse",
441
- "line",
442
- "path",
443
- "polygon",
444
- "polyline",
445
- "rect",
446
- "use",
447
- "stop",
448
- "animate",
449
- "set"
450
- ]);
451
- function vt(e) {
452
- let t = e.toLowerCase();
453
- if (_t.has(t)) return !0;
454
- let n = t.indexOf(":");
455
- return n === -1 ? !1 : (t = t.slice(n + 1), _t.has(t));
456
- }
457
- var yt = 1, bt = 2, xt = 4, St = 8, Ct = 16, wt = 32, Tt = 64, Et = 1, Dt = 2, Ot = 3, kt = 4, At = (function() {
458
- let e = new Uint8Array(128), t;
459
- for (e[L] = yt | wt, e[R] = yt | Ct, e[Re] = yt, e[he] = yt | Ct, e[I] = yt | wt, t = U; t <= W; t++) e[t] = bt;
460
- for (t = ke; t <= Ee; t++) e[t] = bt;
461
- for (t = _e; t <= z; t++) e[t] = bt;
462
- for (t = qe; t <= ge; t++) e[t] = bt;
463
- for (t = G; t <= K; t++) e[t] = St;
464
- for (t = q; t <= J; t++) e[t] = xt | Tt;
465
- for (t = $e; t <= et; t++) e[t] = xt;
466
- return e;
467
- })();
468
- (function() {
469
- let e = new Uint8Array(128);
470
- return e[H] = Dt, e[_e] = kt, e[Ce] = e[we] = e[ge] = e[Se] = Ot, e[z] = e[Te] = e[Ee] = e[De] = e[R] = e[I] = e[U] = Et, e[je] = e[Me] = e[Ne] = Et, e;
471
- })();
472
- var jt = [];
473
- function Mt(e) {
474
- var t = e.indexOf("\r"), n = e.indexOf("\0");
475
- if (t === -1 && n === -1) return e;
476
- var r = e.length;
477
- jt.length = 0;
478
- var i = 0, a = 0;
479
- for (a = t === -1 ? n : n === -1 || t < n ? t : n; a < r; a++) {
480
- var o = e.charCodeAt(a);
481
- o === he ? (i < a && jt.push(e.slice(i, a)), a + 1 < r && e.charCodeAt(a + 1) === R && a++, jt.push("\n"), i = a + 1) : o === 0 && (i < a && jt.push(e.slice(i, a)), jt.push("�"), i = a + 1);
482
- }
483
- return i < r && jt.push(e.slice(i)), jt.join("");
484
- }
485
- function Nt(e, t, n) {
486
- for (var r = e, i = t.split("."), a = 0; a < i.length && (r = r?.[i[a]], r !== void 0);) a++;
487
- return r || n;
488
- }
489
- function Pt(e) {
490
- for (var t = !1, n = 0; n < e.length; n++) {
491
- var r = e.charCodeAt(n);
492
- if (r <= I || r === We || r === xe || r === Te || r === B || r === _e || r === H || r === De || r === ve || r === z || r >= 123) {
493
- t = !0;
494
- break;
495
- }
496
- }
497
- if (!t) return e;
498
- for (var i = "", n = 0; n < e.length; n++) {
499
- var r = e.charCodeAt(n);
500
- if (r === xe && n + 2 < e.length) {
501
- var a = e.charCodeAt(n + 1), o = e.charCodeAt(n + 2);
502
- if ((a >= G && a <= K || a >= q && a <= Ae || a >= $e && a <= je) && (o >= G && o <= K || o >= q && o <= Ae || o >= $e && o <= je)) {
503
- i += e[n] + e[n + 1] + e[n + 2], n += 2;
504
- continue;
505
- }
506
- }
507
- i += encodeURI(e[n]);
508
- }
509
- return i;
510
- }
511
- function Ft(...e) {
512
- return e.filter(Boolean).join(" ");
513
- }
514
- var It = new Set([
515
- "title",
516
- "textarea",
517
- "style",
518
- "xmp",
519
- "iframe",
520
- "noembed",
521
- "noframes",
522
- "script",
523
- "plaintext"
524
- ]), Lt = /<(\/?)(title|textarea|style|xmp|iframe|noembed|noframes|script|plaintext)(\s|>|\/)/gi;
525
- function Rt(e) {
526
- return It.has(e.toLowerCase());
527
- }
528
- function zt(e) {
529
- return Lt.lastIndex = 0, Lt.test(e);
530
- }
531
- function Bt(e) {
532
- return Lt.lastIndex = 0, e.replace(Lt, function(e, t, n, r) {
533
- return "&lt;" + t + n + r;
534
- });
535
- }
536
- var Vt = /^<([a-zA-Z][a-zA-Z0-9-]*)\s[^>]*>/, Ht = /^<[A-Z]/, Ut = [
537
- "script",
538
- "pre",
539
- "style",
540
- "textarea"
541
- ], Wt = new Set(Ut), Gt = /<(?:pre|script|style|textarea)\b/i, Kt = new Set([
542
- "table",
543
- "thead",
544
- "tbody",
545
- "tfoot",
546
- "tr",
547
- "td",
548
- "th"
549
- ]), qt = new Uint8Array(128);
550
- (function() {
551
- for (var e = [
552
- z,
553
- Ce,
554
- we,
555
- ge,
556
- Se,
557
- _e,
558
- U,
559
- Te,
560
- H,
561
- Qe,
562
- Me,
563
- Ne,
564
- je
565
- ], t = 0; t < e.length; t++) qt[e[t]] = 1;
566
- })();
567
- var Jt = /([a-zA-Z_][a-zA-Z0-9_-]*)=(?:"([^"]*)"|'([^']*)')/g;
568
- function Yt(e) {
569
- return Wt.has(e);
570
- }
571
- function Xt(e) {
572
- return Gt.test(e);
573
- }
574
- function Zt(e, t, n) {
575
- for (var r = t, i = n; r < i && (e.charCodeAt(r) === I || e.charCodeAt(r) === L);) r++;
576
- if (r >= i) return !1;
577
- e.charCodeAt(r) === Ke && r++;
578
- for (var a = 0; r < i;) {
579
- for (; r < i && (e.charCodeAt(r) === I || e.charCodeAt(r) === L);) r++;
580
- if (r >= i) break;
581
- if (e.charCodeAt(r) === Ke && a > 0) {
582
- for (var o = r + 1; o < i && (e.charCodeAt(o) === I || e.charCodeAt(o) === L);) o++;
583
- if (o >= i) return !0;
584
- }
585
- if (e.charCodeAt(r) === ke && r++, r >= i || e.charCodeAt(r) !== V) return !1;
586
- for (; r < i && e.charCodeAt(r) === V;) r++;
587
- for (r < i && e.charCodeAt(r) === ke && r++, a++; r < i && (e.charCodeAt(r) === I || e.charCodeAt(r) === L);) r++;
588
- if (r < i) if (e.charCodeAt(r) === Ke) r++;
589
- else return !1;
590
- }
591
- return a > 0;
592
- }
593
- function Qt(e, t) {
594
- if (e.charCodeAt(t) !== Te) return null;
595
- let n = t + 1, r = e.length, i = !1;
596
- e.charCodeAt(n) === W && (n++, i = !0);
597
- let a = n, o = e.charCodeAt(n);
598
- if (!(o >= $e && o <= et || o >= q && o <= J)) return null;
599
- for (; n < r && (e.charCodeAt(n) >= $e && e.charCodeAt(n) <= et || e.charCodeAt(n) >= q && e.charCodeAt(n) <= J || e.charCodeAt(n) >= G && e.charCodeAt(n) <= K || e.charCodeAt(n) === V);) n++;
600
- let s = e.slice(a, n);
601
- if (!s) return null;
602
- let c = n;
603
- for (; n < r && (e.charCodeAt(n) === I || e.charCodeAt(n) === L || e.charCodeAt(n) === R);) n++;
604
- let l = e.slice(c, n);
605
- if (n === c && n < r) {
606
- var u = e.charCodeAt(n);
607
- if (u !== B && u !== W) return null;
608
- }
609
- let d = n, f = {}, p = !1;
610
- for (; n < r;) {
611
- let t = e.charCodeAt(n);
612
- if (t === B) {
613
- let t = e.slice(d, n);
614
- return {
615
- tag: s,
616
- attrs: f,
617
- selfClosing: !1,
618
- end: n + 1,
619
- rawAttrs: t,
620
- whitespaceBeforeAttrs: l,
621
- isClosing: i,
622
- hasSpaceBeforeSlash: p
623
- };
624
- }
625
- if (t === I || t === L || t === R) {
626
- n++;
627
- continue;
628
- }
629
- if (t === W && n + 1 < r && e.charCodeAt(n + 1) === B) {
630
- let t = e.slice(d, n);
631
- return p = n > d && e.charCodeAt(n - 1) === I, {
632
- tag: s,
633
- attrs: f,
634
- selfClosing: !0,
635
- end: n + 2,
636
- rawAttrs: t,
637
- whitespaceBeforeAttrs: l,
638
- isClosing: i,
639
- hasSpaceBeforeSlash: p
640
- };
641
- }
642
- var m = n, h = e.charCodeAt(n);
643
- if (!(h >= $e && h <= et || h >= q && h <= J || h === we || h === ke)) return null;
644
- for (n++; n < r;) {
645
- var g = e.charCodeAt(n);
646
- if (g >= $e && g <= et || g >= q && g <= J || g >= G && g <= K || g === we || g === He || g === ke || g === V) n++;
647
- else break;
648
- }
649
- for (var _ = e.slice(m, n); n < r && (e.charCodeAt(n) === I || e.charCodeAt(n) === L);) n++;
650
- if (e.charCodeAt(n) !== Se) {
651
- f[_] = "";
652
- continue;
653
- }
654
- for (n++; n < r && (e.charCodeAt(n) === I || e.charCodeAt(n) === L);) n++;
655
- var v = e.charCodeAt(n);
656
- if (v === We || v === Ue) {
657
- n++;
658
- for (var y = n; n < r && e.charCodeAt(n) !== v;) n++;
659
- if (n >= r) return null;
660
- if (f[_] = e.slice(y, n), n++, n < r) {
661
- var b = e.charCodeAt(n);
662
- if (b !== I && b !== L && b !== R && b !== B && b !== W) return null;
663
- }
664
- } else if (v === qe) {
665
- var x = 1, y = n;
666
- for (n++; n < r && x > 0;) {
667
- var g = e.charCodeAt(n);
668
- g === qe ? x++ : g === Je && x--, n++;
669
- }
670
- f[_] = e.slice(y, n);
671
- } else {
672
- for (var y = n; n < r;) {
673
- var S = e.charCodeAt(n);
674
- if (S === I || S === L || S === B || S === R || S === We || S === Ue || S === Se || S === Te || S === z) break;
675
- n++;
676
- }
677
- if (n === y) return null;
678
- f[_] = e.slice(y, n);
679
- }
680
- }
681
- return null;
682
- }
683
- function $t(e, t, n) {
684
- for (var r = 0, i = e.length, a = !1; r < i;) {
685
- for (var o = e.indexOf("\n", r), s = o < 0 ? i : o, c = r, l = 0; c < s && l < 4;) if (e.charCodeAt(c) === I) l++, c++;
686
- else if (e.charCodeAt(c) === L) l += 4, c++;
687
- else break;
688
- if (c >= s) {
689
- a = !1, r = o < 0 ? i : o + 1;
690
- continue;
691
- }
692
- if (l < 4) {
693
- var u = e.charCodeAt(c);
694
- if (u === z || u === ge) {
695
- for (var d = u, f = 0, p = c; p < s && e.charCodeAt(p) === d;) f++, p++;
696
- if (f >= 3) {
697
- a = !1;
698
- for (var m = o < 0 ? i : o + 1; m < i;) {
699
- for (var h = m, g = 0; h < i && g < 4;) {
700
- var _ = e.charCodeAt(h);
701
- if (_ === I) g++, h++;
702
- else if (_ === L) g += 4, h++;
703
- else break;
704
- }
705
- if (g < 4 && h < i && e.charCodeAt(h) === d) {
706
- for (var v = 0; h < i && e.charCodeAt(h) === d;) v++, h++;
707
- if (v >= f) {
708
- for (; h < i && (e.charCodeAt(h) === I || e.charCodeAt(h) === L);) h++;
709
- if (h >= i || e.charCodeAt(h) === R) {
710
- r = h >= i ? i : h + 1;
711
- break;
712
- }
713
- }
714
- }
715
- for (; m < i && e.charCodeAt(m) !== R;) m++;
716
- m < i && m++;
717
- }
718
- m >= i && (r = i);
719
- continue;
720
- }
721
- }
722
- }
723
- for (var y = c; y < s && e.charCodeAt(y) === B;) {
724
- y++, y < s && e.charCodeAt(y) === I && y++;
725
- for (var b = 0; y < s && b < 4;) if (e.charCodeAt(y) === I) b++, y++;
726
- else if (e.charCodeAt(y) === L) b += 4, y++;
727
- else break;
728
- if (b >= 4) break;
729
- a = !1;
730
- }
731
- if (!a && l < 4 && y < s && e.charCodeAt(y) === _e && !(y + 1 < i && e.charCodeAt(y + 1) === ve)) {
732
- var x = en(e, y, t);
733
- if (x) {
734
- r = x, a = !1;
735
- continue;
736
- }
737
- }
738
- var S = e.charCodeAt(c);
739
- if (S === ye && l < 4) a = !1;
740
- else if (l < 4 && (S === V || S === Ce || S === we)) {
741
- for (var C = c, w = 0; C < s;) {
742
- var T = e.charCodeAt(C);
743
- if (T === S) w++;
744
- else if (T !== I && T !== L) break;
745
- C++;
746
- }
747
- a = !(w >= 3 && C >= s);
748
- } else a = !0;
749
- r = o < 0 ? i : o + 1;
750
- }
751
- }
752
- function en(e, t, n) {
753
- let r = e.length;
754
- if (e.charCodeAt(t) !== _e) return null;
755
- let i = t + 1 < r && e.charCodeAt(t + 1) === ve, a = t + 1;
756
- for (; a < r;) {
757
- var o = e.charCodeAt(a);
758
- if (o === De) {
759
- a++;
760
- break;
761
- }
762
- if (o === _e) return null;
763
- o === H && a + 1 < r && a++, a++;
764
- }
765
- if (a > r || e.charCodeAt(a - 1) !== De) return null;
766
- let s = e.slice(t + 1, a - 1);
767
- if (s.length > 999) return null;
768
- let c = ln(s);
769
- if (!c || a >= r || e.charCodeAt(a) !== ke) return null;
770
- a++;
771
- let l = !1;
772
- for (; a < r;) {
773
- let t = e.charCodeAt(a);
774
- if (t === I || t === L) a++;
775
- else if (t === R && !l) l = !0, a++;
776
- else break;
777
- }
778
- if (i) {
779
- let t = e.indexOf("\n", a), i = t < 0 ? r : t;
780
- return n[c] = {
781
- target: e.slice(a, i).trim(),
782
- title: void 0
783
- }, t < 0 ? r : t + 1;
784
- }
785
- var u;
786
- if (a < r && e.charCodeAt(a) === Te) {
787
- a++;
788
- for (var d = a; a < r && e.charCodeAt(a) !== B && e.charCodeAt(a) !== R;) e.charCodeAt(a) === H && a + 1 < r && a++, a++;
789
- if (a >= r || e.charCodeAt(a) !== B) return null;
790
- u = e.slice(d, a), a++;
791
- for (var f = e.indexOf("\n", a), p = f < 0 ? r : f, m = a; m < p && (e.charCodeAt(m) === I || e.charCodeAt(m) === L);) m++;
792
- if (m < p) {
793
- if (m === a) return null;
794
- var h = e.charCodeAt(m);
795
- if (h !== We && h !== Ue && h !== Ye) return null;
796
- }
797
- } else {
798
- for (var d = a, g = 0; a < r;) {
799
- var o = e.charCodeAt(a);
800
- if (o === Ye) g++;
801
- else if (o === Xe) {
802
- if (g === 0) break;
803
- g--;
804
- } else {
805
- if (o === I || o === L || o === R) break;
806
- o === H && a + 1 < r && a++;
807
- }
808
- a++;
809
- }
810
- if (u = e.slice(d, a), !u) return null;
811
- }
812
- for (; a < r && (e.charCodeAt(a) === I || e.charCodeAt(a) === L);) a++;
813
- var _ = e.indexOf("\n", a), v = _ < 0 ? r : _, y, b = !1, x = a, S = a;
814
- if (a === v && a < r) for (S = a + 1; S < r && (e.charCodeAt(S) === I || e.charCodeAt(S) === L);) S++;
815
- if (S < r) {
816
- var C = e.charCodeAt(S);
817
- if (C === We || C === Ue || C === Ye) {
818
- for (var w = C === Ye ? 41 : C, T = S + 1, E = T; T < r;) {
819
- var D = e.charCodeAt(T);
820
- if (D === w) {
821
- for (var O = T + 1; O < r && (e.charCodeAt(O) === I || e.charCodeAt(O) === L);) O++;
822
- (O >= r || e.charCodeAt(O) === R) && (y = e.slice(E, T), b = !0, x = O < r ? O + 1 : r);
823
- break;
824
- }
825
- if (D === H && T + 1 < r) {
826
- T += 2;
827
- continue;
828
- }
829
- if (D === R && T + 1 < r && e.charCodeAt(T + 1) === R) break;
830
- T++;
831
- }
832
- if (!b && S === a) return null;
833
- }
834
- }
835
- if (b) return n[c] || (n[c] = {
836
- target: dn(u),
837
- title: y === void 0 ? y : ct(dn(y))
838
- }), x;
839
- for (; a < v && (e.charCodeAt(a) === I || e.charCodeAt(a) === L);) a++;
840
- return a < v ? null : (n[c] || (n[c] = {
841
- target: dn(u),
842
- title: y
843
- }), _ < 0 ? r : _ + 1);
844
- }
845
- var tn = 1, nn = 2, X = 4, rn = 8, an = 16, on = 32, sn = 64, Z = new Uint8Array(128);
846
- Z[I] = tn, Z[L] = tn, Z[R] = tn | nn, Z[he] = tn | nn, Z[ye] = on | X, Z[B] = on | X, Z[V] = on | sn | X, Z[Ge] = on | X, Z[Ce] = on | sn | X, Z[we] = on | sn | X, Z[z] = on | sn | X, Z[ge] = on | sn | X, Z[Te] = on | sn | X, Z[_e] = sn | X, Z[U] = sn | X, Z[Ke] = on | X;
847
- for (let e = G; e <= K; e++) Z[e] = an | on;
848
- for (let e = q; e <= J; e++) Z[e] = rn;
849
- for (let e = $e; e <= et; e++) Z[e] = rn;
850
- Z[H] = X, Z[De] = X, Z[Ye] = X, Z[Xe] = X, Z[ke] = X, Z[We] = X, Z[Ue] = X, Z[Oe] = X, Z[Se] = X, Z[be] = X, Z[xe] = X, Z[ze] = X, Z[He] = X, Z[W] = X, Z[Be] = X, Z[Ve] = X, Z[Ee] = X, Z[ve] = X, Z[qe] = X, Z[Je] = X;
851
- function cn(e) {
852
- if (e.indexOf("[") < 0 && e.indexOf("]") < 0) return !1;
853
- for (var t = 0; t < e.length; t++) {
854
- if (e.charCodeAt(t) === H) {
855
- t++;
856
- continue;
857
- }
858
- if (e.charCodeAt(t) === _e || e.charCodeAt(t) === De) return !0;
859
- }
860
- return !1;
861
- }
862
- function ln(e) {
863
- var t = e.replace(/\s+/g, " ").trim();
864
- return t.indexOf("ẞ") === -1 ? t.toLowerCase() : t.replace(/\u1E9E/g, "ss").toLowerCase();
865
- }
866
- function un(e) {
867
- return e < tt ? Z[e] : e === Le ? tn : 0;
868
- }
869
- function dn(e) {
870
- return e.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, "$1");
871
- }
872
- function fn(e, t) {
873
- var n = e.indexOf("\n", t);
874
- return n < 0 ? e.length : n;
875
- }
876
- function Q(e, t) {
877
- let n = fn(e, t);
878
- return n < e.length ? n + 1 : n;
879
- }
880
- function pn(e, t, n) {
881
- for (; t < n;) {
882
- let n = e.charCodeAt(t);
883
- if (n !== I && n !== L) break;
884
- t++;
885
- }
886
- return t;
887
- }
888
- function mn(e, t) {
889
- let n = Q(e, t);
890
- for (; n < e.length;) {
891
- let t = fn(e, n);
892
- if (vn(e, n, t)) return n;
893
- n = Q(e, n);
894
- }
895
- return e.length;
896
- }
897
- function hn(e, t, n, r) {
898
- let i = 0;
899
- for (; t + i < n && e.charCodeAt(t + i) === r;) i++;
900
- return i;
901
- }
902
- var $ = 0, gn = 0;
903
- function _n(e, t, n) {
904
- for ($ = 0, gn = 0; t + gn < n;) {
905
- let n = e.charCodeAt(t + gn);
906
- if (n === L) $ += 4 - $ % 4;
907
- else if (n === I) $++;
908
- else break;
909
- gn++;
910
- }
911
- }
912
- function vn(e, t, n) {
913
- return pn(e, t, n) >= n;
914
- }
915
- function yn(e, t, n, r) {
916
- let i = fn(e, t);
917
- if (_n(e, t, i), $ > 3) return null;
918
- let a = t + gn;
919
- if (e.charCodeAt(a) !== ye) return null;
920
- let o = hn(e, a, i, 35);
921
- if (o < 1 || o > 6 || (a += o, a < i && e.charCodeAt(a) !== I && e.charCodeAt(a) !== L)) return null;
922
- a = pn(e, a, i);
923
- for (var s = i; s > a && e.charCodeAt(s - 1) === I;) s--;
924
- for (var c = s; s > a && e.charCodeAt(s - 1) === ye;) s--;
925
- if (s < c) if (s === a || e.charCodeAt(s - 1) === I) for (; s > a && e.charCodeAt(s - 1) === I;) s--;
926
- else s = c;
927
- let l = e.slice(a, s), u = ur(l, 0, l.length, n, r), d = (r?.slugify || ht)(l);
928
- return {
929
- node: {
930
- type: Y.heading,
931
- level: o,
932
- children: u,
933
- id: d
934
- },
935
- end: Q(e, i)
936
- };
937
- }
938
- function bn(e, t) {
939
- let n = fn(e, t);
940
- if (_n(e, t, n), $ > 3) return null;
941
- let r = t + gn, i = e.charCodeAt(r);
942
- if (i !== V && i !== Ce && i !== we) return null;
943
- let a = 0;
944
- for (; r < n;) {
945
- let t = e.charCodeAt(r);
946
- if (t === i) a++;
947
- else if (t !== I && t !== L) return null;
948
- r++;
949
- }
950
- return a < 3 ? null : {
951
- node: { type: Y.breakThematic },
952
- end: Q(e, n)
953
- };
954
- }
955
- function xn(e, t, n) {
956
- let r = fn(e, t);
957
- if (_n(e, t, r), $ > 3) return null;
958
- let i = $, a = t + gn, o = e.charCodeAt(a);
959
- if (o !== z && o !== ge) return null;
960
- let s = hn(e, a, r, o);
961
- if (s < 3) return null;
962
- a += s;
963
- let c = pn(e, a, r), l = r;
964
- if (o === z) {
965
- for (let t = c; t < r; t++) if (e.charCodeAt(t) === z) return null;
966
- }
967
- for (; l > c && (e.charCodeAt(l - 1) === I || e.charCodeAt(l - 1) === L);) l--;
968
- let u = e.slice(c, l), d = "", f = "", p = u.indexOf(" ");
969
- p === -1 ? d = u : (d = u.slice(0, p), f = u.slice(p + 1).trim()), d = dn(d);
970
- var m = void 0;
971
- if (f) {
972
- Jt.lastIndex = 0;
973
- for (var h; (h = Jt.exec(f)) !== null;) m ||= {}, m[h[1]] = h[2] === void 0 ? h[3] : h[2];
974
- }
975
- let g = Q(e, r), _ = g, v = e.length;
976
- for (; _ < e.length;) {
977
- let t = fn(e, _);
978
- if (_n(e, _, t), $ < 4) {
979
- let n = _ + gn;
980
- var y = hn(e, n, t, o);
981
- if (y >= s && vn(e, n + y, t)) {
982
- v = Q(e, t);
983
- break;
984
- }
985
- }
986
- _ = Q(e, t);
987
- }
988
- var b;
989
- if (i === 0) b = _ > g && e.charCodeAt(_ - 1) === R ? e.slice(g, _ - 1) : e.slice(g, _);
990
- else {
991
- b = "";
992
- for (var x = g; x < _;) {
993
- var S = fn(e, x);
994
- _n(e, x, S);
995
- var C = Math.min(gn, i);
996
- b += e.slice(x + C, S) + "\n", x = Q(e, S);
997
- }
998
- b.length > 0 && b.charCodeAt(b.length - 1) === R && (b = b.slice(0, -1));
999
- }
1000
- return {
1001
- node: {
1002
- type: Y.codeBlock,
1003
- lang: d || void 0,
1004
- text: b,
1005
- infoString: f || void 0,
1006
- attrs: m
1007
- },
1008
- end: v
1009
- };
1010
- }
1011
- function Sn(e, t) {
1012
- if (_n(e, t, fn(e, t)), $ < 4) return null;
1013
- let n = "", r = t;
1014
- for (; r < e.length;) {
1015
- let t = fn(e, r);
1016
- if (_n(e, r, t), vn(e, r, t)) {
1017
- for (var i = 0, a = Q(e, t); a < e.length;) {
1018
- var o = fn(e, a);
1019
- if (vn(e, a, o)) {
1020
- i++, a = Q(e, o);
1021
- continue;
1022
- }
1023
- if (_n(e, a, o), $ >= 4) {
1024
- for (var s = 0; s <= i; s++) n += "\n";
1025
- r = a;
1026
- break;
1027
- }
1028
- break;
1029
- }
1030
- if (r !== a) break;
1031
- continue;
1032
- }
1033
- if ($ < 4) break;
1034
- let f = 0, p = 0;
1035
- var c = 0;
1036
- for (let n = r; n < t && p < 4; n++) {
1037
- if (e.charCodeAt(n) === L) {
1038
- var l = 4 - p % 4;
1039
- p + l > 4 && (c = p + l - 4), p += l;
1040
- } else p++;
1041
- f++;
1042
- }
1043
- var u = "";
1044
- if (c > 0) for (var d = 0; d < c; d++) u += " ";
1045
- u += e.slice(r + f, t), n += u + "\n", r = Q(e, t);
1046
- }
1047
- for (; n.length > 0 && n.charCodeAt(n.length - 1) === R;) n = n.slice(0, -1);
1048
- for (; n.length > 0 && n.charCodeAt(n.length - 1) === R;) n = n.slice(0, -1);
1049
- return n ? {
1050
- node: {
1051
- type: Y.codeBlock,
1052
- text: n
1053
- },
1054
- end: r
1055
- } : null;
1056
- }
1057
- function Cn(e, t, n, r) {
1058
- if (_n(e, t, fn(e, t)), $ > 3) return null;
1059
- let i = t + gn;
1060
- if (e.charCodeAt(i) !== B) return null;
1061
- let a = "", o = t, s, c = !1, l = !1, u = !1;
1062
- for (; o < e.length;) {
1063
- let t = fn(e, o);
1064
- _n(e, o, t);
1065
- let n = o + gn;
1066
- if (e.charCodeAt(n) === B) {
1067
- let r = n + 1;
1068
- var d = $ + 1, f = !1;
1069
- if (r < t) {
1070
- var p = e.charCodeAt(r);
1071
- p === I ? (r++, d++, f = !0) : p === L && (f = !0);
1072
- }
1073
- for (var m = "", h = !1, g = r; g < t; g++) if (e.charCodeAt(g) === L) {
1074
- h = !0;
1075
- break;
1076
- }
1077
- if (h) {
1078
- var _ = d;
1079
- if (f && r < t && e.charCodeAt(r) === L) {
1080
- for (var v = 4 - _ % 4, y = 0; y < v - 1; y++) m += " ";
1081
- _ += v, r++;
1082
- }
1083
- for (var b = r; b < t; b++) if (e.charCodeAt(b) === L) {
1084
- for (var x = 4 - _ % 4, S = 0; S < x; S++) m += " ";
1085
- _ += x;
1086
- } else m += e[b], _++;
1087
- } else m = e.slice(r, t);
1088
- if (!a && !s) {
1089
- let n = m.match(/^\[!([A-Za-z]+)\]\s*$/);
1090
- if (n) {
1091
- s = n[1].toUpperCase(), o = Q(e, t);
1092
- continue;
1093
- }
1094
- }
1095
- a += m + "\n";
1096
- var C = m.trimStart();
1097
- C.startsWith("```") || C.startsWith("~~~") ? u = !u : m.startsWith(" ") || m.startsWith(" ") ? u = !0 : C.length > 0 && !u && (u = !1), l = C.length > 0, o = Q(e, t);
1098
- } else if (a && !vn(e, o, t) && l) {
1099
- if ($ < 4) {
1100
- var w = o + gn, T = w < t ? e.charCodeAt(w) : 0;
1101
- if (T === ye || T === B || T === z || T === ge || T === Te || (T === V || T === Ce || T === we) && bn(e, o) || (T === V || T === Ce || T === Ge) && w + 1 < t && (e.charCodeAt(w + 1) === I || e.charCodeAt(w + 1) === L)) break;
1102
- if (T >= G && T <= K) {
1103
- for (var E = w; E < t && e.charCodeAt(E) >= G && e.charCodeAt(E) <= K;) E++;
1104
- if (E < t && (e.charCodeAt(E) === He || e.charCodeAt(E) === Xe)) break;
1105
- }
1106
- }
1107
- if (u) break;
1108
- a += e.slice(o, t) + "\n", c = !0, o = Q(e, t);
1109
- } else break;
1110
- }
1111
- if (!a && !s) return null;
1112
- var { inBlockQuote: D, f: O } = n;
1113
- n.inBlockQuote = !0, c && (n.f = !0);
1114
- let ee = fr(a || "", n, r);
1115
- n.inBlockQuote = D, n.f = O;
1116
- let te = {
1117
- type: Y.blockQuote,
1118
- children: ee
1119
- };
1120
- return s && (te.alert = s), {
1121
- node: te,
1122
- end: o
1123
- };
1124
- }
1125
- function wn(e, t, n) {
1126
- for (var r = 0, i = t; i < n; i++) e.charCodeAt(i) === L ? r += 4 - r % 4 : r++;
1127
- return r;
1128
- }
1129
- function Tn(e, t, n) {
1130
- if (_n(e, t, n), $ > 3) return null;
1131
- var r = t + gn;
1132
- if (r >= n) return null;
1133
- var i = e.charCodeAt(r), a = $, o = r;
1134
- if (i === V || i === Ce || i === Ge) {
1135
- if (o = r + 1, o < n && e.charCodeAt(o) !== I && e.charCodeAt(o) !== L && e.charCodeAt(o) !== R) return null;
1136
- } else if (i >= G && i <= K) {
1137
- for (var s = r; s < n && s - r < 9;) {
1138
- var c = e.charCodeAt(s);
1139
- if (c < G || c > K) break;
1140
- s++;
1141
- }
1142
- if (s > r && s < n) {
1143
- var l = e.charCodeAt(s);
1144
- if (l === He || l === Xe) {
1145
- if (o = s + 1, o < n && e.charCodeAt(o) !== I && e.charCodeAt(o) !== L && e.charCodeAt(o) !== R) return null;
1146
- } else return null;
1147
- } else return null;
1148
- } else return null;
1149
- var u = o, d = wn(e, t, o), f = 0, p = u, m = d;
1150
- if (u >= n) return {
1151
- ordered: i >= G && i <= K,
1152
- marker: i >= G && i <= K ? e[s] : e[r],
1153
- start: i >= G && i <= K ? parseInt(e.slice(r, s), 10) : void 0,
1154
- contentStart: u,
1155
- contentCol: d + 1,
1156
- markerCol: a,
1157
- isEmpty: !0
1158
- };
1159
- for (; p < n && (e.charCodeAt(p) === I || e.charCodeAt(p) === L);) {
1160
- if (e.charCodeAt(p) === L) {
1161
- var h = 4 - m % 4;
1162
- m += h;
1163
- } else m++;
1164
- p++, f++;
1165
- }
1166
- var g = p >= n, _ = m - d;
1167
- return g || _ > 4 ? (m = d + 1, p = u + 1, f = 1) : f === 0 && (m = d + 1, p = u, f = 1), {
1168
- ordered: i >= G && i <= K,
1169
- marker: i >= G && i <= K ? e[s] : e[r],
1170
- start: i >= G && i <= K ? parseInt(e.slice(r, s), 10) : void 0,
1171
- contentStart: p,
1172
- contentCol: m,
1173
- markerCol: a,
1174
- isEmpty: g
1175
- };
1176
- }
1177
- var En = 0;
1178
- function Dn(e, t, n, r) {
1179
- var i = 0, a = t;
1180
- for (En = 0; a < n && i < r;) {
1181
- var o = e.charCodeAt(a);
1182
- if (o === L) {
1183
- var s = 4 - i % 4;
1184
- if (i + s > r) {
1185
- En = i + s - r, a++, i = r;
1186
- break;
1187
- }
1188
- i += s;
1189
- } else if (o === I) i++;
1190
- else break;
1191
- a++;
1192
- }
1193
- return a;
1194
- }
1195
- function On(e, t, n, r) {
1196
- var i = fn(e, t), a = Tn(e, t, i);
1197
- if (!a) return null;
1198
- var o = [], s = t, c = a.contentCol, l = "", u = a.isEmpty, d = !1, f = !1;
1199
- if (!a.isEmpty) {
1200
- for (var p = !1, m = a.contentStart; m < i; m++) if (e.charCodeAt(m) === L) {
1201
- p = !0;
1202
- break;
1203
- }
1204
- if (p) {
1205
- var h = "", g = wn(e, t, a.contentStart), _ = g - a.contentCol;
1206
- if (_ > 0) for (var v = 0; v < _; v++) h += " ";
1207
- for (var y = a.contentStart; y < i; y++) if (e.charCodeAt(y) === L) {
1208
- for (var b = 4 - g % 4, x = 0; x < b; x++) h += " ";
1209
- g += b;
1210
- } else h += e[y], g++;
1211
- l = h + "\n";
1212
- } else l = e.slice(a.contentStart, i) + "\n";
1213
- }
1214
- for (s = Q(e, i); s < e.length;) {
1215
- var S = fn(e, s);
1216
- _n(e, s, S);
1217
- var C = e.charCodeAt(s + gn);
1218
- if ($ < c && (C === V || C === Ce || C === we) && $ <= 3 && bn(e, s)) break;
1219
- var w = Tn(e, s, S);
1220
- if (w && w.ordered === a.ordered && w.marker === a.marker && w.markerCol < c) {
1221
- o.push({
1222
- contentCol: c,
1223
- raw: l,
1224
- hasBlankAfter: d,
1225
- isEmpty: u
1226
- }), d && (f = !0), c = w.contentCol, u = w.isEmpty, d = !1, l = w.isEmpty ? "" : e.slice(w.contentStart, S) + "\n", s = Q(e, S);
1227
- continue;
1228
- }
1229
- if (vn(e, s, S)) {
1230
- l += "\n", s = Q(e, S);
1231
- for (var T = !1, E = 0; E < l.length; E++) {
1232
- var D = l.charCodeAt(E);
1233
- if (D !== R && D !== he && D !== I && D !== L) {
1234
- T = !0;
1235
- break;
1236
- }
1237
- }
1238
- if (u && !T) if (s < e.length) {
1239
- var O = fn(e, s), ee = Tn(e, s, O);
1240
- if (!ee || ee.ordered !== a.ordered || ee.marker !== a.marker) break;
1241
- d = !0;
1242
- } else break;
1243
- if (s < e.length) {
1244
- var te = fn(e, s);
1245
- _n(e, s, te);
1246
- var ne = e.charCodeAt(s + gn);
1247
- if ((ne === V || ne === Ce || ne === we) && $ <= 3 && bn(e, s)) break;
1248
- var k = Tn(e, s, te);
1249
- if (k && k.ordered === a.ordered && k.marker === a.marker && k.markerCol < c) {
1250
- d = !0;
1251
- continue;
1252
- }
1253
- if (!vn(e, s, te) && $ < c) break;
1254
- }
1255
- continue;
1256
- }
1257
- if ($ >= c) {
1258
- var re = Dn(e, s, S, c);
1259
- if (En > 0) {
1260
- for (var ie = "", ae = c, oe = 0; oe < En; oe++) ie += " ", ae++;
1261
- for (var A = re; A < S; A++) if (e.charCodeAt(A) === L) {
1262
- for (var j = 4 - ae % 4, se = 0; se < j; se++) ie += " ";
1263
- ae += j;
1264
- } else ie += e[A], ae++;
1265
- l += ie + "\n";
1266
- } else l += e.slice(re, S) + "\n";
1267
- s = Q(e, S);
1268
- continue;
1269
- }
1270
- for (var M = !1, ce = 0; ce < l.length; ce++) {
1271
- var le = l.charCodeAt(ce);
1272
- if (le !== R && le !== he && le !== I && le !== L) {
1273
- M = !0;
1274
- break;
1275
- }
1276
- }
1277
- if (!d && M && !u) {
1278
- var ue = s + gn, N = e.charCodeAt(ue);
1279
- if (!(N === ye || N === B || N === Te || N === z || N === ge || (N === V || N === Ce || N === we || N === Ge) && (bn(e, s) !== null || Tn(e, s, S) !== null) || N >= G && N <= K && Tn(e, s, S) !== null)) {
1280
- l += "" + e.slice(ue, S) + "\n", s = Q(e, S);
1281
- continue;
1282
- }
1283
- }
1284
- break;
1285
- }
1286
- if (o.push({
1287
- contentCol: c,
1288
- raw: l,
1289
- hasBlankAfter: d,
1290
- isEmpty: u
1291
- }), o.length === 0) return null;
1292
- var P = f;
1293
- if (!P) for (var F = 0; F < o.length; F++) {
1294
- if (o[F].hasBlankAfter && F < o.length - 1) {
1295
- P = !0;
1296
- break;
1297
- }
1298
- if (!o[F].isEmpty) {
1299
- for (var de = o[F].raw, fe = de.length, pe = 0, me = !1, ve = !1, be = !1, xe = !1, Se = 0, H = 0, Ee = -1; pe < fe;) {
1300
- var U = de.indexOf("\n", pe);
1301
- if (U < 0 && (U = fe), xe) {
1302
- _n(de, pe, U);
1303
- for (var Oe = de.slice(pe + gn, U), ke = 0; ke < Oe.length && Oe.charCodeAt(ke) === Se;) ke++;
1304
- ke >= H && Oe.slice(ke).trim() === "" && (xe = !1), pe = U < fe ? U + 1 : fe;
1305
- continue;
1306
- }
1307
- if (vn(de, pe, U)) {
1308
- Ee >= 0 ? be = !0 : me && (ve = !0), pe = U < fe ? U + 1 : fe;
1309
- continue;
1310
- }
1311
- if (_n(de, pe, U), Ee >= 0) {
1312
- if ($ >= Ee) {
1313
- pe = U < fe ? U + 1 : fe;
1314
- continue;
1315
- }
1316
- var Ae = Tn(de, pe, U);
1317
- if (Ae && Ae.markerCol < Ee && Ae.contentCol <= Ee) {
1318
- pe = U < fe ? U + 1 : fe;
1319
- continue;
1320
- }
1321
- if (Ae) {
1322
- pe = U < fe ? U + 1 : fe;
1323
- continue;
1324
- }
1325
- Ee = -1, be &&= (ve = !0, !1);
1326
- }
1327
- var je = de.slice(pe + gn, U), Me = je.charCodeAt(0);
1328
- if ((Me === z || Me === ge) && $ <= 3) {
1329
- for (var Ne = 0; Ne < je.length && je.charCodeAt(Ne) === Me;) Ne++;
1330
- if (Ne >= 3) {
1331
- if (ve && me) {
1332
- P = !0;
1333
- break;
1334
- }
1335
- xe = !0, Se = Me, H = Ne, me = !0, pe = U < fe ? U + 1 : fe;
1336
- continue;
1337
- }
1338
- }
1339
- var Pe = $ <= 3 ? Tn(de, pe, U) : null;
1340
- if (Pe && me) {
1341
- if (ve) {
1342
- P = !0;
1343
- break;
1344
- }
1345
- Ee = Pe.contentCol, be = !1, pe = U < fe ? U + 1 : fe, me = !0;
1346
- continue;
1347
- }
1348
- if (ve) {
1349
- P = !0;
1350
- break;
1351
- }
1352
- me = !0, pe = U < fe ? U + 1 : fe;
1353
- }
1354
- if (P) break;
1355
- }
1356
- }
1357
- for (var Fe = [], Ie = 0; Ie < o.length; Ie++) {
1358
- for (var Le = o[Ie], Re = Le.raw, ze = Re.length; ze > 0 && Re.charCodeAt(ze - 1) === R;) ze--;
1359
- var Be = ze < Re.length ? Re.slice(0, ze) : Re, Ve = null;
1360
- if (Be.length >= 3 && Be.charCodeAt(0) === _e) {
1361
- var He = Be[1];
1362
- (He === " " || He === "x" || He === "X") && Be.charCodeAt(2) === De && (Ve = {
1363
- type: Y.gfmTask,
1364
- completed: He === "x" || He === "X"
1365
- }, Be = Be.slice(3));
1366
- }
1367
- var W;
1368
- if (Le.isEmpty && Be.trim() === "") W = [];
1369
- else if (P) {
1370
- var Ue = n.inList;
1371
- n.inList = !0, W = fr(Be, n, r), n.inList = Ue;
1372
- } else {
1373
- var We = n.inList;
1374
- if (n.inList = !0, W = fr(Be, n, r), n.inList = We, W.length === 1 && W[0].type === Y.paragraph) W = W[0].children;
1375
- else {
1376
- for (var Ke = [], qe = 0; qe < W.length; qe++) if (W[qe].type === Y.paragraph) for (var Je = W[qe].children, Ye = 0; Ye < Je.length; Ye++) Ke.push(Je[Ye]);
1377
- else Ke.push(W[qe]);
1378
- W = Ke;
1379
- }
1380
- }
1381
- Ve ? Fe.push([
1382
- Ve,
1383
- {
1384
- type: Y.text,
1385
- text: " "
1386
- },
1387
- ...W
1388
- ]) : Fe.push(W);
1389
- }
1390
- return {
1391
- node: {
1392
- type: a.ordered ? Y.orderedList : Y.unorderedList,
1393
- start: a.ordered ? a.start : void 0,
1394
- items: Fe
1395
- },
1396
- end: s
1397
- };
1398
- }
1399
- var kn = new Set(/* @__PURE__ */ "address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul".split("."));
1400
- function An(e, t, n) {
1401
- let r = {};
1402
- for (let [o, s] of Object.entries(e)) {
1403
- let e = o, c = o.toLowerCase();
1404
- if (c === "style" && typeof s == "string") {
1405
- let t = {}, n = [], i = 0, a = 0;
1406
- for (let e = 0; e < s.length; e++) {
1407
- let t = s.charCodeAt(e);
1408
- t === Ye ? i++ : t === Xe ? i-- : t === Be && i === 0 && (n.push(s.slice(a, e)), a = e + 1);
1409
- }
1410
- a < s.length && n.push(s.slice(a));
1411
- let o = !1;
1412
- n.forEach((e) => {
1413
- let n = e.indexOf(":");
1414
- if (n === -1) return;
1415
- let r = e.slice(0, n).trim(), i = e.slice(n + 1).trim();
1416
- if (r && i) {
1417
- if (/url\s*\(\s*(javascript|vbscript|data:(?!image\/))/i.test(i)) {
1418
- o = !0;
1419
- return;
1420
- }
1421
- let e = r.indexOf("-") === -1 ? r : r.replace(/-([a-z])/g, (e, t) => t.toUpperCase());
1422
- t[e] = i;
1423
- }
1424
- }), !o && Object.keys(t).length > 0 && (r[e] = t);
1425
- } else if ((c === "href" || c === "src") && n?.sanitizer) {
1426
- let i = n.sanitizer(s, t, c);
1427
- i !== null && (r[e] = i);
1428
- } else if (s === "") r[e] = !0;
1429
- else if (s.length >= 2 && s.charCodeAt(0) === qe && s.charCodeAt(s.length - 1) === Je) {
1430
- var i = s.slice(1, -1);
1431
- if (i.length > 0) {
1432
- var a = i.charCodeAt(0);
1433
- if (a === _e || a === qe) try {
1434
- r[e] = JSON.parse(i);
1435
- continue;
1436
- } catch {}
1437
- }
1438
- if (i === "true") {
1439
- r[e] = !0;
1440
- continue;
1441
- }
1442
- if (i === "false") {
1443
- r[e] = !1;
1444
- continue;
1445
- }
1446
- if (n?.evalUnserializableExpressions) try {
1447
- r[e] = (0, eval)("(" + i + ")");
1448
- continue;
1449
- } catch {}
1450
- r[e] = i;
1451
- } else r[e] = s;
1452
- }
1453
- return r;
1454
- }
1455
- function jn(e, t, n) {
1456
- let r = t.length;
1457
- var i = t.charCodeAt(0);
1458
- i >= q && i <= J && (i += nt);
1459
- for (let o = n; o <= e.length - r; o++) {
1460
- var a = e.charCodeAt(o);
1461
- if (a >= q && a <= J && (a += nt), a !== i) continue;
1462
- let n = !0;
1463
- for (let i = 1; i < r; i++) {
1464
- let r = e.charCodeAt(o + i), a = t.charCodeAt(i);
1465
- if (r >= q && r <= J && (r += nt), a >= q && a <= J && (a += nt), r !== a) {
1466
- n = !1;
1467
- break;
1468
- }
1469
- }
1470
- if (n) return o;
1471
- }
1472
- return -1;
1473
- }
1474
- function Mn(e, t, n) {
1475
- let r = t.length;
1476
- var i = t.charCodeAt(0);
1477
- i >= q && i <= J && (i += nt);
1478
- for (let o = Math.min(n, e.length - r); o >= 0; o--) {
1479
- var a = e.charCodeAt(o);
1480
- if (a >= q && a <= J && (a += nt), a !== i) continue;
1481
- let n = !0;
1482
- for (let i = 1; i < r; i++) {
1483
- let r = e.charCodeAt(o + i), a = t.charCodeAt(i);
1484
- if (r >= q && r <= J && (r += nt), a >= q && a <= J && (a += nt), r !== a) {
1485
- n = !1;
1486
- break;
1487
- }
1488
- }
1489
- if (n) return o;
1490
- }
1491
- return -1;
1492
- }
1493
- var Nn = -1;
1494
- function Pn(e, t, n) {
1495
- let r = n.toLowerCase(), i = "<" + r, a = "</" + r, o = 1, s = t, c = e.length;
1496
- for (Nn = -1; s < c && o > 0;) {
1497
- let t = jn(e, i, s), n = jn(e, a, s);
1498
- if (n === -1) return -1;
1499
- if (t !== -1 && t < n) {
1500
- let n = Qt(e, t);
1501
- n ? (n.tag.toLowerCase() === r && !n.isClosing && !n.selfClosing && !vt(n.tag) && o++, s = n.end) : s = t + 1;
1502
- } else {
1503
- var l = n + a.length, u = l < c ? e.charCodeAt(l) : 62;
1504
- if ((u === B || u === I || u === L || u === R) && (o--, o === 0)) {
1505
- Nn = n;
1506
- let t = n + a.length;
1507
- for (; t < c && e.charCodeAt(t) !== B;) t++;
1508
- return t + 1;
1509
- }
1510
- s = n + 1;
1511
- }
1512
- }
1513
- return -1;
1514
- }
1515
- function Fn(e, t, n, r) {
1516
- if (r.ignoreHTMLBlocks || r.disableParsingRawHTML) return null;
1517
- var i = fn(e, t);
1518
- if (_n(e, t, i), $ > 3 && !n.inHTML) return null;
1519
- var a = t + gn;
1520
- if (e.charCodeAt(a) !== Te) return null;
1521
- var o = e.indexOf(">", a + 1);
1522
- if (o !== -1 && o < i) {
1523
- var s = e.slice(a + 1, o);
1524
- if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(s) || /^[^\s@]+@[^\s@]+$/.test(s)) return null;
1525
- }
1526
- var c = In(e, a);
1527
- if (c >= 1 && c <= 5) {
1528
- var l = e.length;
1529
- if (c === 1) {
1530
- for (var u = e.length, d = 0; d < Ut.length; d++) {
1531
- var f = jn(e, "</" + Ut[d] + ">", a);
1532
- f >= 0 && f < u && (u = f);
1533
- }
1534
- if (u < e.length) {
1535
- var p = e.indexOf(">", u);
1536
- l = p >= 0 ? Q(e, p + 1) : e.length;
1537
- }
1538
- } else {
1539
- var m = c === 2 ? "-->" : c === 3 ? "?>" : c === 4 ? ">" : "]]>", h = e.indexOf(m, a);
1540
- h >= 0 && (l = Q(e, h + m.length));
1541
- }
1542
- var g = e.slice(a, l);
1543
- if (c >= 2) return {
1544
- node: {
1545
- type: Y.htmlComment,
1546
- text: g,
1547
- raw: !0,
1548
- endPos: l
1549
- },
1550
- end: l
1551
- };
1552
- var _ = "div", v = g.match(/^<\/?([a-zA-Z][a-zA-Z0-9-]*)/);
1553
- v && (_ = v[1]);
1554
- var y = Qt(e, a), b = {}, x;
1555
- y && !y.isClosing && (b = An(y.attrs, _, r), x = y.whitespaceBeforeAttrs + y.rawAttrs);
1556
- var S = [], C = jn(g, "</" + _.toLowerCase(), 0), w = g, T = "";
1557
- if (y && y.isClosing) for (w = g.slice(y.end - a); w.length > 0 && w.charCodeAt(w.length - 1) === R;) w = w.slice(0, -1);
1558
- else if (y && !y.isClosing) {
1559
- var E = y.end - a;
1560
- if (C !== -1) for (w = g.slice(E), w.charCodeAt(0) === R && (w = w.slice(1)); w.length > 0 && w.charCodeAt(w.length - 1) === R;) w = w.slice(0, -1);
1561
- else for (w = g; w.length > 0 && w.charCodeAt(w.length - 1) === R;) w = w.slice(0, -1);
1562
- C !== -1 && (T = g.slice(E, C).trim());
1563
- }
1564
- var D = y ? y.isClosing : !1;
1565
- return {
1566
- node: {
1567
- type: Y.htmlBlock,
1568
- tag: _,
1569
- attrs: b,
1570
- e: x,
1571
- children: S,
1572
- a: w,
1573
- text: T,
1574
- d: !0,
1575
- b: D,
1576
- endPos: l,
1577
- canInterruptParagraph: !0
1578
- },
1579
- end: l
1580
- };
1581
- }
1582
- if (c === 6 || c === 7) {
1583
- var O = mn(e, t), ee = O < e.length ? O : e.length, te = e.slice(a, ee), ne = O < e.length ? Q(e, O) : e.length, k = Qt(e, a);
1584
- if (k) {
1585
- var re = k.tag, ie = re.toLowerCase();
1586
- if (k.isClosing) {
1587
- var ae = e.slice(k.end, ee);
1588
- return {
1589
- node: {
1590
- type: Y.htmlBlock,
1591
- tag: re,
1592
- attrs: {},
1593
- children: [],
1594
- a: ae,
1595
- text: ae,
1596
- d: !0,
1597
- b: !0,
1598
- endPos: ee,
1599
- canInterruptParagraph: c === 6
1600
- },
1601
- end: ne
1602
- };
1603
- }
1604
- var oe = n.c || 0, A = e.slice(a, ee), j = -1, se = -1;
1605
- if (!k.selfClosing && !vt(re) && oe < 10) {
1606
- for (var M = "</" + ie, ce = k.end - a, le = 1, ue = ce; ue < A.length && le > 0;) {
1607
- var N = jn(A, "<" + ie, ue), P = jn(A, M, ue);
1608
- if (P === -1) break;
1609
- if (N !== -1 && N < P) {
1610
- var F = N + ie.length + 1;
1611
- if (F < A.length) {
1612
- var de = A.charCodeAt(F);
1613
- (de === I || de === L || de === R || de === B || de === W) && le++;
1614
- }
1615
- ue = N + 1;
1616
- } else {
1617
- var fe = P + M.length;
1618
- if (fe < A.length) {
1619
- var pe = A.charCodeAt(fe);
1620
- if ((pe === B || pe === I || pe === L || pe === R) && (le--, le === 0)) {
1621
- j = P;
1622
- for (var me = fe; me < A.length && A.charCodeAt(me) !== B;) me++;
1623
- se = me + 1;
1624
- break;
1625
- }
1626
- } else if (le--, le === 0) {
1627
- j = P, se = A.length;
1628
- break;
1629
- }
1630
- ue = P + 1;
1631
- }
1632
- }
1633
- var he = !1;
1634
- if (j === -1 && c === 6 && !k.isClosing && !Kt.has(ie)) {
1635
- var z = e.slice(k.end), ge = jn(z, M, 0);
1636
- if (ge !== -1 && z.slice(0, ge).indexOf("\n\n") !== -1) {
1637
- for (var _e = k.end + ge, ve = _e + M.length; ve < e.length && e.charCodeAt(ve) !== B;) ve++;
1638
- if (ve < e.length && e.charCodeAt(ve) === B) {
1639
- var ye = ve + 1, be = fn(e, ye);
1640
- ee = be, ne = Q(e, be), A = e.slice(a, ee), te = e.slice(a, ee), j = _e - a, se = ye - a, he = !0;
1641
- }
1642
- }
1643
- }
1644
- }
1645
- var xe = k.rawAttrs.indexOf("\n") !== -1 || k.whitespaceBeforeAttrs.indexOf("\n") !== -1, V = !1;
1646
- j !== -1 && (V = A.slice(se).trim().length === 0);
1647
- var Se = !1, H = ee, Ce = ne;
1648
- if (j !== -1) {
1649
- var we = a + se, Ee = fn(e, we - 1);
1650
- if (we < Ee) {
1651
- for (var De = we; De < Ee && (e.charCodeAt(De) === I || e.charCodeAt(De) === L);) De++;
1652
- if (De < Ee && e.charCodeAt(De) === Te) {
1653
- var U = Qt(e, De);
1654
- U && !U.isClosing && (Se = !0, H = we, Ce = we, V = !0);
1655
- }
1656
- }
1657
- if (!Se) {
1658
- var Oe = Q(e, Ee);
1659
- if (Oe < ee) {
1660
- for (var ke = Oe; ke < ee && (e.charCodeAt(ke) === I || e.charCodeAt(ke) === L);) ke++;
1661
- ke < ee && e.charCodeAt(ke) === Te && Qt(e, ke) && (Se = !0, H = Ee, Ce = Oe, V = !0);
1662
- }
1663
- }
1664
- !Se && n.inHTML && (Se = !0, H = Ee, Ce = Q(e, Ee), V = e.slice(we, Ee).trim().length === 0);
1665
- }
1666
- var Ae = [], je = "";
1667
- if (j !== -1) {
1668
- je = A.slice(k.end - a, j);
1669
- var Me = je.trim();
1670
- if (Me) {
1671
- var { inline: Ne, inHTML: Pe, c: Fe } = n;
1672
- if (n.inHTML = !0, n.c = oe + 1, ie === "p") n.inline = !0, Ae = ur(Me, 0, Me.length, n, r);
1673
- else {
1674
- var Ie = je.indexOf("\n\n") !== -1, Le = /^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m.test(Me), Re = /^<([a-z][^ >/\n\r]*) ?([^>]*?)>/im.test(Me);
1675
- Ie || Le || n.inHTML && Re || Re ? (n.inline = !1, Ae = fr(je, n, r)) : (n.inline = !0, Ae = ur(Me, 0, Me.length, n, r));
1676
- }
1677
- n.inline = Ne, n.inHTML = Pe, n.c = Fe;
1678
- }
1679
- }
1680
- var ze = !1;
1681
- if (c === 6 && j !== -1 && !n.inHTML && !xe) {
1682
- var Be = je, Ve = /<[a-zA-Z][^>]*>/.test(Be), He = /\n\n/.test(Be) || /^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m.test(Be);
1683
- Ve && !He && (ze = !0);
1684
- }
1685
- if (n.inHTML || c === 7 || xe || !V || ze) {
1686
- var Ue;
1687
- if (j !== -1 && Se) {
1688
- var We = !1;
1689
- if (n.inHTML && se < A.length) {
1690
- for (var Ge = se; Ge < A.length && A.charCodeAt(Ge) !== R;) Ge++;
1691
- var Ke = A.slice(se, Ge).trim();
1692
- We = Ke.length > 1 && Ke.charCodeAt(0) === Te && Ke.charCodeAt(1) !== W;
1693
- }
1694
- Ue = We ? A.slice(k.end - a) : je;
1695
- } else (c === 7 || n.inHTML) && j !== -1 ? (Ue = A.slice(k.end - a), Ue.charCodeAt(0) === R && (Ue = Ue.slice(1))) : Se ? Ue = e.slice(a, H) : xe ? Ue = te : (Ue = A.slice(k.end - a), Ue.charCodeAt(0) === R && (Ue = Ue.slice(1)));
1696
- return {
1697
- node: {
1698
- type: Y.htmlBlock,
1699
- tag: re,
1700
- attrs: An(k.attrs, re, r),
1701
- e: k.whitespaceBeforeAttrs + k.rawAttrs,
1702
- children: Ae,
1703
- a: Ue,
1704
- text: Ue,
1705
- d: !0,
1706
- b: !1,
1707
- endPos: H,
1708
- canInterruptParagraph: c === 6
1709
- },
1710
- end: Ce
1711
- };
1712
- }
1713
- return {
1714
- node: {
1715
- type: Y.htmlBlock,
1716
- tag: re,
1717
- attrs: An(k.attrs, re, r),
1718
- e: k.whitespaceBeforeAttrs + k.rawAttrs,
1719
- children: Ae,
1720
- a: he ? "" : je,
1721
- text: je,
1722
- d: !1,
1723
- b: !1,
1724
- endPos: H,
1725
- canInterruptParagraph: c === 6
1726
- },
1727
- end: Ce
1728
- };
1729
- }
1730
- var qe = te.match(/^<(\/?)([a-zA-Z][a-zA-Z0-9-]*)/), Je = qe ? qe[2] : "div", Ye = qe ? qe[1] === "/" : !1, Xe = te;
1731
- if (Ye) {
1732
- var Ze = te.indexOf(">");
1733
- Ze !== -1 && (Xe = te.slice(Ze + 1));
1734
- }
1735
- return {
1736
- node: {
1737
- type: Y.htmlBlock,
1738
- tag: Je,
1739
- attrs: {},
1740
- children: [],
1741
- a: Xe,
1742
- text: Xe,
1743
- d: !0,
1744
- b: Ye,
1745
- endPos: ee,
1746
- canInterruptParagraph: c === 6
1747
- },
1748
- end: ne
1749
- };
1750
- }
1751
- var Qe = Qt(e, a);
1752
- if (!Qe) return null;
1753
- var G = Qe.tag, K = G.toLowerCase(), $e = G.charCodeAt(0), et = $e >= q && $e <= J;
1754
- if (!et && !kn.has(K) && !Wt.has(K) && !K.includes("-")) return null;
1755
- if (Qe.isClosing) return {
1756
- node: {
1757
- type: Y.htmlSelfClosing,
1758
- tag: G,
1759
- attrs: {},
1760
- endPos: Qe.end,
1761
- b: !0,
1762
- a: e.slice(a, Qe.end)
1763
- },
1764
- end: Qe.end
1765
- };
1766
- var tt = Pn(e, Qe.end, G), nt = [];
1767
- if (tt !== -1) {
1768
- var rt = Nn, it = e.slice(Qe.end, rt), at = it.trim();
1769
- if (at) {
1770
- var ot = it.indexOf("\n\n") !== -1, st = /^(\s{0,3}#[#\s]|\s{0,3}[-*+]\s|\s{0,3}\d+\.\s|\s{0,3}>\s|\s{0,3}```)/m.test(at), ct = /^<([a-z][^ >/\n\r]*) ?([^>]*?)>/im.test(at), lt = n.inline, ut = n.inHTML, dt = n.c;
1771
- n.inHTML = !0, n.c = (n.c || 0) + 1, ot || st || ct ? (n.inline = !1, nt = fr(it, n, r)) : (n.inline = !0, nt = ur(at, 0, at.length, n, r)), n.inline = lt, n.inHTML = ut, n.c = dt;
1772
- }
1773
- var ft = fn(e, tt), pt = e.slice(tt, ft).trim() ? tt : Q(e, tt), mt = et ? e.slice(a, tt) : e.slice(a, pt), ht = et ? tt : pt;
1774
- return {
1775
- node: {
1776
- type: Y.htmlBlock,
1777
- tag: G,
1778
- attrs: An(Qe.attrs, G, r),
1779
- e: Qe.whitespaceBeforeAttrs + Qe.rawAttrs,
1780
- children: nt,
1781
- a: mt,
1782
- text: et ? it : mt,
1783
- d: !0,
1784
- b: !1,
1785
- endPos: ht,
1786
- canInterruptParagraph: !1
1787
- },
1788
- end: pt
1789
- };
1790
- }
1791
- var gt = mn(e, Qe.end), _t = gt < e.length ? Q(e, gt) : gt, yt = e.slice(Qe.end, gt);
1792
- if (yt.trim()) {
1793
- var { inline: bt, inHTML: xt, c: St } = n;
1794
- n.inline = !1, n.inHTML = !0, n.c = (n.c || 0) + 1, nt = fr(yt, n, r), n.inline = bt, n.inHTML = xt, n.c = St;
1795
- }
1796
- var Ct = e.slice(Qe.end, gt);
1797
- return {
1798
- node: {
1799
- type: Y.htmlBlock,
1800
- tag: G,
1801
- attrs: An(Qe.attrs, G, r),
1802
- e: Qe.whitespaceBeforeAttrs + Qe.rawAttrs,
1803
- children: nt,
1804
- a: Ct,
1805
- text: yt,
1806
- d: !0,
1807
- b: !1,
1808
- endPos: gt,
1809
- canInterruptParagraph: !1
1810
- },
1811
- end: _t
1812
- };
1813
- }
1814
- function In(e, t) {
1815
- if (e.charCodeAt(t) !== Te) return 0;
1816
- var n = t + 1, r = e.length;
1817
- if (e.charCodeAt(n) === U && e.charCodeAt(n + 1) === V && e.charCodeAt(n + 2) === V) return 2;
1818
- if (e.charCodeAt(n) === Ve) return 3;
1819
- if (e.charCodeAt(n) === U) {
1820
- var i = e.charCodeAt(n + 1);
1821
- if (i >= q && i <= J) return 4;
1822
- if (e.slice(n + 1, n + 8) === "[CDATA[") return 5;
1823
- }
1824
- for (var a = e.charCodeAt(n) === W, o = a ? n + 1 : n, s = o; s < r;) {
1825
- var c = e.charCodeAt(s);
1826
- if (c >= q && c <= J || c >= $e && c <= et || c >= G && c <= K || c === V) s++;
1827
- else break;
1828
- }
1829
- if (s === o) return 0;
1830
- var l = e.slice(o, s);
1831
- if (Wt.has(l.toLowerCase())) {
1832
- if (a) return 0;
1833
- var u = e.charCodeAt(s);
1834
- return +(u === I || u === L || u === B || u === R || s >= r);
1835
- }
1836
- if (kn.has(l.toLowerCase())) {
1837
- if (a) {
1838
- for (var d = s; d < r && (e.charCodeAt(d) === I || e.charCodeAt(d) === L);) d++;
1839
- return d < r && e.charCodeAt(d) === B ? 6 : 0;
1840
- }
1841
- var f = s < r ? e.charCodeAt(s) : -1;
1842
- return f === I || f === L || f === B || f === R || f === W || f === -1 ? 6 : 0;
1843
- }
1844
- if (a) {
1845
- for (var p = s; p < r && (e.charCodeAt(p) === I || e.charCodeAt(p) === L);) p++;
1846
- if (p < r && e.charCodeAt(p) === B) {
1847
- var m = fn(e, t);
1848
- if (e.slice(p + 1, m).trim() === "") return 7;
1849
- }
1850
- } else {
1851
- var h = fn(e, t), g = Qt(e, t);
1852
- if (g && g.end <= h && e.slice(g.end, h).trim() === "") return 7;
1853
- }
1854
- return 0;
1855
- }
1856
- function Ln(e, t, n) {
1857
- for (var r = 0, i = e.length; r < i && (e.charCodeAt(r) === I || e.charCodeAt(r) === L);) r++;
1858
- for (; i > r && (e.charCodeAt(i - 1) === I || e.charCodeAt(i - 1) === L);) i--;
1859
- r < i && e.charCodeAt(r) === Ke && r++, i > r && e.charCodeAt(i - 1) === Ke && (i - 2 < r || e.charCodeAt(i - 2) !== H) && i--;
1860
- for (var a = [], o = r, s = !1, c = [], l = r; l < i;) {
1861
- var u = e.charCodeAt(l);
1862
- if (u === H && l + 1 < i) {
1863
- e.charCodeAt(l + 1) === Ke ? (s || (s = !0, c = []), c.push(e.slice(o, l)), c.push("|"), l += 2, o = l) : l += 2;
1864
- continue;
1865
- }
1866
- if (u === z) {
1867
- for (var d = 0; l < i && e.charCodeAt(l) === z;) d++, l++;
1868
- for (var f = !1; l < i && !f;) {
1869
- for (var p = 0; l < i && e.charCodeAt(l) === z;) p++, l++;
1870
- p === d ? f = !0 : p === 0 && l++;
1871
- }
1872
- continue;
1873
- }
1874
- if (u === Ke) {
1875
- var m = s ? (c.push(e.slice(o, l)), c.join("")) : e.slice(o, l);
1876
- a.push(m.trim()), l++, o = l, s = !1, c = [];
1877
- continue;
1878
- }
1879
- l++;
1880
- }
1881
- var h = s ? (c.push(e.slice(o, i)), c.join("")) : e.slice(o, i);
1882
- return a.push(h.trim()), a.map(function(e) {
1883
- var r = e.indexOf("\\|") === -1 ? e : e.replace(/\\\|/g, "|");
1884
- return ur(r, 0, r.length, t, n);
1885
- });
1886
- }
1887
- function Rn(e, t, n, r) {
1888
- let i = fn(e, t);
1889
- var a = e.indexOf("|", t);
1890
- if (a < 0 || a >= i) return null;
1891
- let o = Q(e, i);
1892
- if (o >= e.length) return null;
1893
- let s = fn(e, o);
1894
- if (!Zt(e, o, s)) return null;
1895
- let c = e.slice(t, i), l = e.slice(o, s);
1896
- for (var u = [], d = 0, f = l.length; d < f && (l.charCodeAt(d) === I || l.charCodeAt(d) === L);) d++;
1897
- for (d < f && l.charCodeAt(d) === Ke && d++; d < f;) {
1898
- for (; d < f && (l.charCodeAt(d) === I || l.charCodeAt(d) === L);) d++;
1899
- if (d >= f || l.charCodeAt(d) === Ke) break;
1900
- var p = l.charCodeAt(d) === ke;
1901
- for (p && d++; d < f && l.charCodeAt(d) === V;) d++;
1902
- var m = d < f && l.charCodeAt(d) === ke;
1903
- for (m && d++, u.push(p && m ? "center" : m ? "right" : p ? "left" : null); d < f && (l.charCodeAt(d) === I || l.charCodeAt(d) === L);) d++;
1904
- d < f && l.charCodeAt(d) === Ke && d++;
1905
- }
1906
- let h = Ln(c, n, r);
1907
- if (u.length !== h.length) return null;
1908
- let g = [], _ = Q(e, s);
1909
- for (; _ < e.length;) {
1910
- let t = fn(e, _), i = e.slice(_, t);
1911
- if (vn(e, _, t)) break;
1912
- if (_n(e, _, t), $ < 4) {
1913
- var v = e.charCodeAt(_ + gn);
1914
- if (v === B || v === ye || (v === V || v === Ce || v === we) && bn(e, _)) break;
1915
- if (v === z || v === ge) {
1916
- for (var y = _ + gn, b = 0; y < t && e.charCodeAt(y) === v;) b++, y++;
1917
- if (b >= 3) break;
1918
- }
1919
- }
1920
- g.push(Ln(i, n, r)), _ = Q(e, t);
1921
- }
1922
- if ((r.streaming || r.optimizeForStreaming) && g.length === 0) return null;
1923
- for (var x = h.length, S = 0; S < g.length; S++) if (g[S].length < x) for (; g[S].length < x;) g[S].push([]);
1924
- else g[S].length > x && (g[S].length = x);
1925
- return {
1926
- node: {
1927
- type: Y.table,
1928
- header: h,
1929
- cells: g,
1930
- align: u
1931
- },
1932
- end: _
1933
- };
1934
- }
1935
- function zn(e, t, n) {
1936
- if (_n(e, t, fn(e, t)), $ > 3) return null;
1937
- var r = t + gn;
1938
- if (e.charCodeAt(r) !== _e) return null;
1939
- if (r + 1 < e.length && e.charCodeAt(r + 1) === ve) return Bn(e, r, n) || null;
1940
- n.refs ||= {};
1941
- var i = en(e, r, n.refs);
1942
- return i === null ? null : {
1943
- node: { type: Y.refCollection },
1944
- end: i
1945
- };
1946
- }
1947
- function Bn(e, t, n) {
1948
- var r = e.length;
1949
- if (e.charCodeAt(t) !== _e || t + 1 >= r || e.charCodeAt(t + 1) !== ve) return null;
1950
- for (var i = t + 2, a = i; i < r && e.charCodeAt(i) !== De;) {
1951
- if (e.charCodeAt(i) === R) return null;
1952
- i++;
1953
- }
1954
- if (i >= r) return null;
1955
- var o = ("^" + e.slice(a, i)).toLowerCase();
1956
- if (i++, i >= r || e.charCodeAt(i) !== ke) return null;
1957
- for (i++; i < r && (e.charCodeAt(i) === I || e.charCodeAt(i) === L);) i++;
1958
- if (i < r && e.charCodeAt(i) === R) for (i++; i < r && (e.charCodeAt(i) === I || e.charCodeAt(i) === L);) i++;
1959
- var s = e.indexOf("\n", i);
1960
- s < 0 && (s = r);
1961
- for (var c = e.slice(i, s).trim(), l = s < r ? s + 1 : r; l < r;) {
1962
- var u = fn(e, l);
1963
- if (_n(e, l, u), $ >= 2 && !vn(e, l, u)) c += "\n" + e.slice(l, u), l = Q(e, u);
1964
- else if (vn(e, l, u)) {
1965
- var d = Q(e, u);
1966
- if (d < r && (_n(e, d, fn(e, d)), $ >= 2)) {
1967
- c += "\n", l = Q(e, u);
1968
- continue;
1969
- }
1970
- break;
1971
- } else break;
1972
- }
1973
- return n.refs[o] || (n.refs[o] = {
1974
- target: c,
1975
- title: void 0
1976
- }), {
1977
- node: { type: Y.footnote },
1978
- end: l
1979
- };
1980
- }
1981
- function Vn(e, t, n, r) {
1982
- let i = t, a = 0, o = 0, s = -1;
1983
- for (; i < e.length;) {
1984
- let t = s >= 0 ? s : fn(e, i);
1985
- if (s = -1, vn(e, i, t)) break;
1986
- if (_n(e, i, t), $ < 4 && o > 0 && !n.f) {
1987
- let n = e.charCodeAt(i + gn);
1988
- if (n === Se || n === V) {
1989
- let r = i + gn;
1990
- for (; r < t && e.charCodeAt(r) === n;) r++;
1991
- for (; r < t && (e.charCodeAt(r) === I || e.charCodeAt(r) === L);) r++;
1992
- if (r >= t) {
1993
- a = n === Se ? 1 : 2, i = Q(e, t);
1994
- break;
1995
- }
1996
- }
1997
- }
1998
- o = t;
1999
- let y = Q(e, t);
2000
- if (y < e.length) {
2001
- if (e.charCodeAt(y) === Ze) {
2002
- var c = fn(e, y);
2003
- i = Q(e, c), o = c;
2004
- continue;
2005
- }
2006
- let t = fn(e, y);
2007
- if (s = t, _n(e, y, t), $ < 4) {
2008
- let a = e.charCodeAt(y + gn);
2009
- if (a === B) {
2010
- i = y;
2011
- break;
2012
- }
2013
- if (a === ye && yn(e, y, n, r)) {
2014
- i = y;
2015
- break;
2016
- }
2017
- if (a === z || a === ge) {
2018
- for (var l = y + gn, u = 0; l < t && e.charCodeAt(l) === a;) u++, l++;
2019
- if (u >= 3) {
2020
- i = y;
2021
- break;
2022
- }
2023
- }
2024
- if (a === Te) {
2025
- var d = y + gn + 1, f = d < t ? e.charCodeAt(d) : 0, p = f === U || f === Ve;
2026
- if (!p && f === W) {
2027
- for (var m = d + 1, h = m; h < t && (e.charCodeAt(h) >= q && e.charCodeAt(h) <= J || e.charCodeAt(h) >= $e && e.charCodeAt(h) <= et || e.charCodeAt(h) >= G && e.charCodeAt(h) <= K || e.charCodeAt(h) === V);) h++;
2028
- h > m && (p = kn.has(e.slice(m, h).toLowerCase()));
2029
- } else if (!p) {
2030
- for (var g = d; g < t && (e.charCodeAt(g) >= q && e.charCodeAt(g) <= J || e.charCodeAt(g) >= $e && e.charCodeAt(g) <= et || e.charCodeAt(g) >= G && e.charCodeAt(g) <= K || e.charCodeAt(g) === V);) g++;
2031
- if (g > d) {
2032
- var _ = e.slice(d, g).toLowerCase();
2033
- p = kn.has(_) || Wt.has(_);
2034
- }
2035
- }
2036
- if (p && Fn(e, y, n, r)) {
2037
- i = y;
2038
- break;
2039
- }
2040
- }
2041
- if (a === V || a === Ce || a === Ge) {
2042
- let n = y + gn + 1;
2043
- if (n < t && (e.charCodeAt(n) === I || e.charCodeAt(n) === L) && pn(e, n, t) < t && !bn(e, y)) {
2044
- i = y;
2045
- break;
2046
- }
2047
- }
2048
- if (a >= G && a <= K) {
2049
- let n = y + gn;
2050
- for (; n < t && e.charCodeAt(n) >= G && e.charCodeAt(n) <= K;) n++;
2051
- if (n < t && (e.charCodeAt(n) === He || e.charCodeAt(n) === Xe) && n - (y + gn) === 1 && e.charCodeAt(y + gn) === 49) {
2052
- var v = n + 1;
2053
- if (v < t && (e.charCodeAt(v) === I || e.charCodeAt(v) === L) && pn(e, v, t) < t) {
2054
- i = y;
2055
- break;
2056
- }
2057
- }
2058
- }
2059
- if (a === Ke) {
2060
- let n = Q(e, t);
2061
- if (n < e.length && Zt(e, n, fn(e, n))) {
2062
- i = y;
2063
- break;
2064
- }
2065
- }
2066
- if ((a === V || a === Ce || a === we) && bn(e, y)) {
2067
- if (a !== V) {
2068
- i = y;
2069
- break;
2070
- }
2071
- let n = 0, r = y + gn;
2072
- for (; r < t && e.charCodeAt(r) === V;) n++, r++;
2073
- for (; r < t && (e.charCodeAt(r) === I || e.charCodeAt(r) === L);) r++;
2074
- if (r < t) {
2075
- i = y;
2076
- break;
2077
- }
2078
- }
2079
- }
2080
- }
2081
- i = Q(e, t);
2082
- }
2083
- for (var y = a ? o : i; y > t && (e.charCodeAt(y - 1) === R || e.charCodeAt(y - 1) === he || e.charCodeAt(y - 1) === I || e.charCodeAt(y - 1) === L);) y--;
2084
- for (var b = t; b < y && (e.charCodeAt(b) === I || e.charCodeAt(b) === L);) b++;
2085
- if (b >= y) return null;
2086
- for (var x = !1, S = b; S < y; S++) if (e.charCodeAt(S) === Ze) {
2087
- x = !0;
2088
- break;
2089
- }
2090
- var C = x ? e.slice(b, y).replace(/\u001E/g, "") : e.slice(b, y);
2091
- if (!C) return null;
2092
- let w = Hn(C, 0, C.length, n, r);
2093
- if (a) {
2094
- let e = (r?.slugify || ht)(C);
2095
- return {
2096
- node: {
2097
- type: Y.heading,
2098
- level: a,
2099
- children: w,
2100
- id: e
2101
- },
2102
- end: i
2103
- };
2104
- }
2105
- return {
2106
- node: {
2107
- type: Y.paragraph,
2108
- children: w
2109
- },
2110
- end: i
2111
- };
2112
- }
2113
- function Hn(e, t, n, r, i) {
2114
- var a = e.indexOf("\n", t);
2115
- if (a < 0 || a >= n) return ur(e, t, n, r, i);
2116
- for (var o = "", s = t, c = t; c < n;) {
2117
- var l = e.charCodeAt(c);
2118
- if (l === z) {
2119
- var u = Wn(e, c, n);
2120
- if (u > c) {
2121
- for (var d = !1, f = c; f < u; f++) if (e.charCodeAt(f) === R) {
2122
- d = !0;
2123
- break;
2124
- }
2125
- d && (o += e.slice(s, c), o += e.slice(c, u).replace(/\n/g, " "), s = u), c = u;
2126
- continue;
2127
- }
2128
- }
2129
- if (l === Te) {
2130
- var p = Gn(e, c, n);
2131
- if (p > c) {
2132
- c = p;
2133
- continue;
2134
- }
2135
- }
2136
- if (l === R) {
2137
- var m = !1, h = 0;
2138
- if (c > t && e.charCodeAt(c - 1) === H) m = !0, h = 1;
2139
- else {
2140
- for (var g = 0, _ = c - 1; _ >= t && e.charCodeAt(_) === I;) g++, _--;
2141
- g >= 2 && (m = !0, h = g);
2142
- }
2143
- for (m ? (o += e.slice(s, c - h), o += "") : o += e.slice(s, c + 1), c++; c < n && e.charCodeAt(c) === I;) c++;
2144
- s = c;
2145
- continue;
2146
- }
2147
- c++;
2148
- }
2149
- return s < n && (o += e.slice(s, n)), ur(o, 0, o.length, r, i);
2150
- }
2151
- function Un(e, t, n) {
2152
- if (e.charCodeAt(t) !== z) return null;
2153
- let r = hn(e, t, n, 96), i = t + r;
2154
- for (; i < n;) {
2155
- let a = e.indexOf("`", i);
2156
- if (a < 0 || a >= n) return null;
2157
- let o = hn(e, a, n, 96);
2158
- if (o === r) {
2159
- let n = e.slice(t + r, a);
2160
- return n = n.replace(/\n/g, " "), n.length > 0 && n[0] === " " && n[n.length - 1] === " " && n.trim().length > 0 && (n = n.slice(1, -1)), {
2161
- node: {
2162
- type: Y.codeInline,
2163
- text: n
2164
- },
2165
- end: a + o
2166
- };
2167
- }
2168
- i = a + o;
2169
- }
2170
- return null;
2171
- }
2172
- function Wn(e, t, n) {
2173
- if (e.charCodeAt(t) !== z) return t;
2174
- let r = hn(e, t, n, 96), i = t + r;
2175
- for (; i < n;) {
2176
- let a = e.indexOf("`", i);
2177
- if (a < 0 || a >= n) return t;
2178
- let o = hn(e, a, n, 96);
2179
- if (o === r) return a + o;
2180
- i = a + o;
2181
- }
2182
- return t;
2183
- }
2184
- function Gn(e, t, n) {
2185
- if (e.charCodeAt(t) !== Te) return t;
2186
- if (t + 1 < n && e.charCodeAt(t + 1) === W) {
2187
- let r = t + 2;
2188
- for (; r < n && e.charCodeAt(r) !== B;) r++;
2189
- return r < n ? r + 1 : t;
2190
- }
2191
- if (t + 3 < n && e.charCodeAt(t + 1) === U && e.charCodeAt(t + 2) === V && e.charCodeAt(t + 3) === V) {
2192
- let n = e.indexOf("-->", t + 4);
2193
- return n >= 0 ? n + 3 : t;
2194
- }
2195
- let r = t + 1, i = r;
2196
- for (; r < n;) {
2197
- let t = e.charCodeAt(r);
2198
- if (t >= q && t <= J || t >= $e && t <= et || t >= G && t <= K || t === V) r++;
2199
- else break;
2200
- }
2201
- if (r === i) return t;
2202
- let a = e.slice(i, r).toLowerCase(), o = !1;
2203
- for (; r < n;) {
2204
- let i = e.charCodeAt(r);
2205
- if (i === B) {
2206
- r++;
2207
- break;
2208
- }
2209
- if (i === W && r + 1 < n && e.charCodeAt(r + 1) === B) {
2210
- r += 2, o = !0;
2211
- break;
2212
- }
2213
- if (i === We || i === Ue) {
2214
- var s = i;
2215
- for (r++; r < n && e.charCodeAt(r) !== s;) r++;
2216
- r < n && r++;
2217
- continue;
2218
- }
2219
- if (i === R) return t;
2220
- r++;
2221
- }
2222
- if (o || vt(a)) return r;
2223
- let c = 1;
2224
- for (; r < n && c > 0;) if (e.charCodeAt(r) === Te) if (r + 1 < n && e.charCodeAt(r + 1) === W) {
2225
- let t = r + 2, i = t;
2226
- for (; i < n && (e.charCodeAt(i) >= q && e.charCodeAt(i) <= J || e.charCodeAt(i) >= $e && e.charCodeAt(i) <= et);) i++;
2227
- if (e.slice(t, i).toLowerCase() === a) {
2228
- for (; i < n && e.charCodeAt(i) !== B;) i++;
2229
- if (i < n && i++, c--, c === 0) return i;
2230
- }
2231
- r = i;
2232
- } else {
2233
- let t = r + 1, i = t;
2234
- for (; i < n && (e.charCodeAt(i) >= q && e.charCodeAt(i) <= J || e.charCodeAt(i) >= $e && e.charCodeAt(i) <= et);) i++;
2235
- e.slice(t, i).toLowerCase() === a && c++, r++;
2236
- }
2237
- else r++;
2238
- return r;
2239
- }
2240
- function Kn(e, t, n, r, i) {
2241
- if (e.charCodeAt(t) !== ge || t + 1 >= n || e.charCodeAt(t + 1) !== ge) return null;
2242
- let a = t + 2;
2243
- for (; a + 1 < n;) {
2244
- let o = e.charCodeAt(a);
2245
- if (o === z) {
2246
- let t = Wn(e, a, n);
2247
- if (t > a) {
2248
- a = t;
2249
- continue;
2250
- }
2251
- }
2252
- if (o === ge && e.charCodeAt(a + 1) === ge) {
2253
- let n = e.slice(t + 2, a), o = ur(n, 0, n.length, r, i);
2254
- return {
2255
- node: {
2256
- type: Y.textFormatted,
2257
- tag: "del",
2258
- children: o
2259
- },
2260
- end: a + 2
2261
- };
2262
- }
2263
- o === H && a + 1 < n && a++, a++;
2264
- }
2265
- return null;
2266
- }
2267
- function qn(e, t, n, r, i) {
2268
- if (e.charCodeAt(t) !== Se || t + 1 >= n || e.charCodeAt(t + 1) !== Se) return null;
2269
- let a = t + 2;
2270
- for (; a + 1 < n;) {
2271
- let o = e.charCodeAt(a);
2272
- if (o === z) {
2273
- let t = Wn(e, a, n);
2274
- if (t > a) {
2275
- a = t;
2276
- continue;
2277
- }
2278
- }
2279
- if (o === Se && e.charCodeAt(a + 1) === Se && a > t + 2) {
2280
- let n = e.slice(t + 2, a), o = ur(n, 0, n.length, r, i);
2281
- return {
2282
- node: {
2283
- type: Y.textFormatted,
2284
- tag: "mark",
2285
- children: o
2286
- },
2287
- end: a + 2
2288
- };
2289
- }
2290
- o === H && a + 1 < n && a++, a++;
2291
- }
2292
- return null;
2293
- }
2294
- var Jn = /[\p{P}\p{S}]/u;
2295
- function Yn(e, t, n) {
2296
- return e < tt ? !!(un(e) & X) : Jn.test(t[n]);
2297
- }
2298
- function Xn(e, t, n) {
2299
- return e < tt ? !!(un(e) & tn) : /\p{Zs}/u.test(t[n]);
2300
- }
2301
- function Zn(e, t, n) {
2302
- var r = e.charCodeAt(t);
2303
- if (r !== Ce && r !== we) return null;
2304
- var i = hn(e, t, n, r);
2305
- if (i === 0) return null;
2306
- var a = t > 0 ? e.charCodeAt(t - 1) : 32, o = t + i < n ? e.charCodeAt(t + i) : 32, s = Xn(a, e, t - 1), c = Xn(o, e, t + i), l = t > 0 ? Yn(a, e, t - 1) : !1, u = t + i < n ? Yn(o, e, t + i) : !1, d = !c && (!u || s || l), f = !s && (!l || c || u), p, m;
2307
- return r === Ce ? (p = d, m = f) : (p = d && (!f || l), m = f && (!d || u)), {
2308
- len: i,
2309
- canOpen: p,
2310
- canClose: m
2311
- };
2312
- }
2313
- function Qn(e, t, n, r) {
2314
- if (t.length !== 0) {
2315
- for (var i = [], a = 0; a < 12; a++) i[a] = -1;
2316
- for (var o = 0; o < t.length;) {
2317
- var s = t[o];
2318
- if (!s.active || !s.canClose) {
2319
- o++;
2320
- continue;
2321
- }
2322
- for (var c = (s.ch === Ce ? 0 : 1) * 6 + s.len % 3 * 2 + +!!s.canOpen, l = i[c] === void 0 ? -1 : i[c], u = -1, d = o - 1; d > l; d--) {
2323
- var f = t[d];
2324
- if (!(!f.active || f.ch !== s.ch || !f.canOpen) && !((s.canOpen || f.canClose) && (f.len + s.len) % 3 == 0 && f.len % 3 != 0)) {
2325
- u = d;
2326
- break;
2327
- }
2328
- }
2329
- if (u < 0) {
2330
- i[c] = o - 1, !s.canOpen && (s.active = !1), o++;
2331
- continue;
2332
- }
2333
- var p = t[u], m = p.len >= 2 && s.len >= 2, h = m ? 2 : 1;
2334
- p.len -= h, s.len -= h;
2335
- var g = e[p.idx], _ = e[s.idx];
2336
- g.text = g.text.slice(0, g.text.length - h), _.text = _.text.slice(h);
2337
- var v = p.idx + 1, y = s.idx, b = e.slice(v, y), x = {
2338
- type: Y.textFormatted,
2339
- tag: m ? "strong" : "em",
2340
- children: b
2341
- };
2342
- e.splice(v, y - v, x);
2343
- for (var S = y - v - 1, C = 0; C < t.length; C++) t[C].idx > p.idx && (t[C].idx -= S);
2344
- for (var w = u + 1; w < o; w++) t[w].active = !1;
2345
- if (p.len === 0 && (p.active = !1, g.text === "")) {
2346
- e.splice(p.idx, 1);
2347
- for (var T = 0; T < t.length; T++) t[T].idx > p.idx ? t[T].idx-- : t[T].idx === p.idx && (t[T].idx = -1);
2348
- }
2349
- if (s.len === 0) {
2350
- s.active = !1;
2351
- var E = s.idx;
2352
- if (_.text === "") {
2353
- e.splice(E, 1);
2354
- for (var D = 0; D < t.length; D++) t[D].idx > E ? t[D].idx-- : t[D].idx === E && (t[D].idx = -1);
2355
- }
2356
- } else continue;
2357
- o++;
2358
- }
2359
- for (var O = 0, ee = 0; ee < e.length; ee++) {
2360
- var te = e[ee];
2361
- if (te.type === Y.text) {
2362
- var ne = te;
2363
- if (ne.text === "") continue;
2364
- if (O > 0 && e[O - 1].type === Y.text) {
2365
- e[O - 1].text += ne.text;
2366
- continue;
2367
- }
2368
- }
2369
- e[O++] = te;
2370
- }
2371
- e.length = O;
2372
- }
2373
- }
2374
- function $n(e, t, n, r, i) {
2375
- let a = e.charCodeAt(t) === U, o = a ? t + 1 : t;
2376
- if (e.charCodeAt(o) !== _e) return null;
2377
- var s = e.indexOf("]", o + 1);
2378
- if (s < 0 || s >= n) return null;
2379
- for (var c = o + 1, l = 1; c < n && l > 0;) {
2380
- var u = e.charCodeAt(c);
2381
- if (u === H && c + 1 < n) {
2382
- c += 2;
2383
- continue;
2384
- }
2385
- if (u === z) {
2386
- var d = Wn(e, c, n);
2387
- if (d > c) {
2388
- c = d;
2389
- continue;
2390
- }
2391
- }
2392
- if (u === Te) {
2393
- var f = er(e, c, n);
2394
- if (f) {
2395
- c = f.end;
2396
- continue;
2397
- }
2398
- var p = Gn(e, c, n);
2399
- if (p > c) {
2400
- c = p;
2401
- continue;
2402
- }
2403
- }
2404
- u === _e ? l++ : u === De && l--, c++;
2405
- }
2406
- if (l !== 0) return null;
2407
- var m = c - 1, h = e.slice(o + 1, m), g = c < n ? e.charCodeAt(c) : 0, _ = !1;
2408
- if (g === Ye) {
2409
- var v = !0;
2410
- for (c++; c < n && (e.charCodeAt(c) === I || e.charCodeAt(c) === R);) c++;
2411
- var y = "", b = c;
2412
- if (c < n && e.charCodeAt(c) === Te) {
2413
- for (c++, b = c; b < n && e.charCodeAt(b) !== B;) {
2414
- if (e.charCodeAt(b) === H && b + 1 < n) {
2415
- b += 2;
2416
- continue;
2417
- }
2418
- if (e.charCodeAt(b) === R) {
2419
- v = !1;
2420
- break;
2421
- }
2422
- b++;
2423
- }
2424
- v && (b >= n || e.charCodeAt(b) !== B) && (v = !1), v && (y = e.slice(c, b), b++);
2425
- } else if (v) {
2426
- for (var x = 0; b < n;) {
2427
- var S = e.charCodeAt(b);
2428
- if (S === H && b + 1 < n) {
2429
- b += 2;
2430
- continue;
2431
- }
2432
- if (S === Ye) x++;
2433
- else if (S === Xe) {
2434
- if (x === 0) break;
2435
- x--;
2436
- } else if (S === I || S === R) break;
2437
- b++;
2438
- }
2439
- y = e.slice(c, b);
2440
- }
2441
- if (v) {
2442
- for (c = b; c < n && (e.charCodeAt(c) === I || e.charCodeAt(c) === R);) c++;
2443
- var C;
2444
- if (c < n) {
2445
- var w = e.charCodeAt(c);
2446
- if (w === We || w === Ue || w === Ye) {
2447
- var T = w === Ye ? 41 : w;
2448
- c++;
2449
- for (var E = c; c < n && e.charCodeAt(c) !== T;) e.charCodeAt(c) === H && c + 1 < n && c++, c++;
2450
- c >= n ? v = !1 : (C = e.slice(E, c), c++);
2451
- }
2452
- }
2453
- if (v) {
2454
- for (; c < n && (e.charCodeAt(c) === I || e.charCodeAt(c) === R);) c++;
2455
- (c >= n || e.charCodeAt(c) !== Xe) && (v = !1);
2456
- }
2457
- }
2458
- if (v) {
2459
- c++, y = dn(y), C !== void 0 && (C = ct(dn(C)));
2460
- var D = (i?.sanitizer || ut)(y, a ? "img" : "a", a ? "src" : "href") === null ? null : y;
2461
- if (a) {
2462
- var O = ar(ur(h, 0, h.length, r, i));
2463
- return {
2464
- node: {
2465
- type: Y.image,
2466
- target: D,
2467
- alt: O,
2468
- title: C
2469
- },
2470
- end: c
2471
- };
2472
- } else {
2473
- var ee = r.inAnchor;
2474
- r.inAnchor = !0;
2475
- var te = ee ? [{
2476
- type: Y.text,
2477
- text: h
2478
- }] : ur(h, 0, h.length, r, i);
2479
- return r.inAnchor = ee, !r.inAnchor && ir(te) ? null : {
2480
- node: {
2481
- type: Y.link,
2482
- target: D,
2483
- title: C,
2484
- children: te
2485
- },
2486
- end: c
2487
- };
2488
- }
2489
- } else c = m + 1, _ = !0;
2490
- }
2491
- var ne = "", k = c;
2492
- if (!_ && g === _e) {
2493
- var re = c + 1;
2494
- k = re;
2495
- for (var ie = !1; k < n && e.charCodeAt(k) !== De;) {
2496
- if (e.charCodeAt(k) === H && k + 1 < n) {
2497
- k += 2;
2498
- continue;
2499
- }
2500
- if (e.charCodeAt(k) === _e) {
2501
- ie = !0;
2502
- break;
2503
- }
2504
- k++;
2505
- }
2506
- if (ie || k >= n) return null;
2507
- var ae = e.slice(re, k);
2508
- if (ae.trim()) ne = ln(ae);
2509
- else {
2510
- if (cn(h)) return null;
2511
- ne = ln(h);
2512
- }
2513
- k += 1;
2514
- } else {
2515
- if (cn(h)) return null;
2516
- ne = ln(h);
2517
- }
2518
- var oe = r.refs[ne];
2519
- if (!oe) return null;
2520
- if (a) return {
2521
- node: {
2522
- type: Y.image,
2523
- target: oe.target,
2524
- alt: ar(ur(h, 0, h.length, r, i)),
2525
- title: oe.title
2526
- },
2527
- end: k
2528
- };
2529
- var A = r.inAnchor;
2530
- r.inAnchor = !0;
2531
- var te = A ? [{
2532
- type: Y.text,
2533
- text: h
2534
- }] : ur(h, 0, h.length, r, i);
2535
- return r.inAnchor = A, !r.inAnchor && ir(te) ? null : {
2536
- node: {
2537
- type: Y.link,
2538
- target: oe.target,
2539
- title: oe.title,
2540
- children: te
2541
- },
2542
- end: k
2543
- };
2544
- }
2545
- function er(e, t, n) {
2546
- if (e.charCodeAt(t) !== Te) return null;
2547
- for (var r = t + 1; r < n;) {
2548
- var i = e.charCodeAt(r);
2549
- if (i === B) break;
2550
- if (i === I || i === R || i === he || i === Te) return null;
2551
- r++;
2552
- }
2553
- if (r >= n || e.charCodeAt(r) !== B) return null;
2554
- var a = e.slice(t + 1, r);
2555
- return a.match(/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^\x00-\x20]*)$/) ? {
2556
- node: {
2557
- type: Y.link,
2558
- target: a,
2559
- children: [{
2560
- type: Y.text,
2561
- text: a
2562
- }]
2563
- },
2564
- end: r + 1
2565
- } : a.indexOf("@") !== -1 && /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a) ? {
2566
- node: {
2567
- type: Y.link,
2568
- target: "mailto:" + a,
2569
- children: [{
2570
- type: Y.text,
2571
- text: a
2572
- }]
2573
- },
2574
- end: r + 1
2575
- } : null;
2576
- }
2577
- function tr(e, t, n, r) {
2578
- if (e.charCodeAt(t) !== _e || t + 1 >= n || e.charCodeAt(t + 1) !== ve) return null;
2579
- let i = t + 2;
2580
- for (; i < n && e.charCodeAt(i) !== De && e.charCodeAt(i) !== R;) i++;
2581
- if (i >= n || e.charCodeAt(i) !== De) return null;
2582
- let a = e.slice(t + 2, i);
2583
- return a ? {
2584
- node: {
2585
- type: Y.footnoteReference,
2586
- target: "#" + ht(a),
2587
- text: a
2588
- },
2589
- end: i + 1
2590
- } : null;
2591
- }
2592
- function nr(e, t, n, r) {
2593
- if (r.disableBareUrls) return null;
2594
- var i = "", a = !1, o = e.charCodeAt(t);
2595
- if (o === Me || o === 72 ? t + 8 <= n && e.charCodeAt(t + 1) === Pe && e.charCodeAt(t + 2) === Pe && e.charCodeAt(t + 3) === Fe && (e.charCodeAt(t + 4) === Ie && e.charCodeAt(t + 5) === ke && e.charCodeAt(t + 6) === W && e.charCodeAt(t + 7) === W ? i = "https://" : e.charCodeAt(t + 4) === ke && e.charCodeAt(t + 5) === W && e.charCodeAt(t + 6) === W && (i = "http://")) : o === je || o === 70 ? t + 6 <= n && e.charCodeAt(t + 1) === Pe && e.charCodeAt(t + 2) === Fe && e.charCodeAt(t + 3) === ke && e.charCodeAt(t + 4) === W && e.charCodeAt(t + 5) === W && (i = "ftp://") : (o === Ne || o === 87) && t + 4 <= n && e.charCodeAt(t + 1) === Ne && e.charCodeAt(t + 2) === Ne && e.charCodeAt(t + 3) === He && (i = "www.", a = !0), !i) return null;
2596
- let s = t + i.length;
2597
- for (; s < n;) {
2598
- let t = e.charCodeAt(s);
2599
- if (t === I || t === R || t === L || t === he || t === Te || t === B) break;
2600
- s++;
2601
- }
2602
- for (var c = 0, l = 0, u = t; u < s; u++) {
2603
- var d = e.charCodeAt(u);
2604
- d === Ye ? c++ : d === Xe && l++;
2605
- }
2606
- let f = s;
2607
- for (; f > t + i.length;) {
2608
- let n = e.charCodeAt(f - 1);
2609
- if (n === He || n === ze || n === ke || n === U || n === Ve || n === Xe) {
2610
- if (n === Xe) {
2611
- if (c >= l) break;
2612
- l--;
2613
- }
2614
- f--;
2615
- } else if (n === Be) {
2616
- for (var p = f - 2; p > t && (e.charCodeAt(p) >= q && e.charCodeAt(p) <= J || e.charCodeAt(p) >= $e && e.charCodeAt(p) <= et || e.charCodeAt(p) >= G && e.charCodeAt(p) <= K);) p--;
2617
- p >= t && e.charCodeAt(p) === Oe ? f = p : f--;
2618
- } else break;
2619
- }
2620
- if (f <= t + i.length) return null;
2621
- var m = t + (a ? 4 : i.length), h = e.indexOf("/", m);
2622
- if ((h < 0 || h > f) && (h = f), a && e.indexOf(".", m) === -1) return null;
2623
- for (var g = -1, _ = -1, v = h - 1; v >= m; v--) if (e.charCodeAt(v) === He) if (g < 0) g = v;
2624
- else {
2625
- _ = v;
2626
- break;
2627
- }
2628
- for (var v = _ >= 0 ? _ + 1 : m; v < h; v++) if (e.charCodeAt(v) === we) return null;
2629
- var y = e.slice(t, f), b = a ? "http://" + y : y;
2630
- return {
2631
- node: {
2632
- type: Y.link,
2633
- target: b,
2634
- children: [{
2635
- type: Y.text,
2636
- text: y
2637
- }]
2638
- },
2639
- end: f
2640
- };
2641
- }
2642
- function rr(e, t, n, r) {
2643
- if (r.disableBareUrls) return null;
2644
- for (var i = t, a = i; i < n;) {
2645
- var o = e.charCodeAt(i);
2646
- if (o >= q && o <= J || o >= $e && o <= et || o >= G && o <= K || o === He || o === U || o === ye || o === 36 || o === xe || o === Oe || o === Ue || o === Ce || o === Ge || o === W || o === Se || o === Ve || o === ve || o === we || o === z || o === qe || o === Ke || o === Je || o === ge || o === V) i++;
2647
- else break;
2648
- }
2649
- if (i === a || i >= n || e.charCodeAt(i) !== Ee) return null;
2650
- i++;
2651
- for (var s = i, c = -1, l = i; i < n;) {
2652
- var o = e.charCodeAt(i);
2653
- if (o >= q && o <= J || o >= $e && o <= et || o >= G && o <= K) i++;
2654
- else if ((o === V || o === we) && i > s) i++;
2655
- else if (o === He) {
2656
- if (i === s) break;
2657
- var u = e.charCodeAt(i - 1);
2658
- if (u === V || u === we || i - l > 63) break;
2659
- if (i + 1 < n) {
2660
- var d = e.charCodeAt(i + 1);
2661
- if (d >= q && d <= J || d >= $e && d <= et || d >= G && d <= K) c = i, l = i + 1, i++;
2662
- else break;
2663
- } else break;
2664
- } else break;
2665
- }
2666
- if (i - l > 63 || c < 0) return null;
2667
- var f = e.charCodeAt(i - 1);
2668
- if (!(f >= q && f <= J || f >= $e && f <= et || f >= G && f <= K) || i <= c + 1) return null;
2669
- for (var p = -1, m = c - 1; m >= s; m--) if (e.charCodeAt(m) === He) {
2670
- p = m;
2671
- break;
2672
- }
2673
- for (var m = p >= 0 ? p + 1 : s; m < i; m++) if (e.charCodeAt(m) === we) return null;
2674
- var h = e.slice(t, i);
2675
- return {
2676
- node: {
2677
- type: Y.link,
2678
- target: "mailto:" + h,
2679
- children: [{
2680
- type: Y.text,
2681
- text: h
2682
- }]
2683
- },
2684
- end: i
2685
- };
2686
- }
2687
- function ir(e) {
2688
- for (var t = 0; t < e.length; t++) if (e[t].type === Y.link || "children" in e[t] && Array.isArray(e[t].children) && ir(e[t].children)) return !0;
2689
- return !1;
2690
- }
2691
- function ar(e) {
2692
- for (var t = "", n = 0; n < e.length; n++) {
2693
- var r = e[n];
2694
- r.type === Y.text ? t += r.text : r.type === Y.breakLine ? t += " " : r.type === Y.codeInline ? t += r.text : "children" in r && Array.isArray(r.children) ? t += ar(r.children) : r.type === Y.image ? t += r.alt || "" : r.type === Y.link && (t += ar(r.children));
2695
- }
2696
- return t;
2697
- }
2698
- function or(e) {
2699
- let t = e.includes("&") ? ct(e) : e;
2700
- return {
2701
- type: Y.text,
2702
- text: t
2703
- };
2704
- }
2705
- function sr(e, t, n, r, i) {
2706
- if (e.charCodeAt(t) !== Te) return null;
2707
- var a = t + 1;
2708
- if (a >= n) return null;
2709
- var o = e.charCodeAt(a);
2710
- if (o === U && a + 1 < n && e.charCodeAt(a + 1) === V && a + 2 < n && e.charCodeAt(a + 2) === V) {
2711
- var s = a + 3;
2712
- if (s < n && e.charCodeAt(s) === B) return {
2713
- node: {
2714
- type: Y.htmlComment,
2715
- text: "",
2716
- endsWithGreaterThan: !0
2717
- },
2718
- end: s + 1
2719
- };
2720
- if (s + 1 < n && e.charCodeAt(s) === V && e.charCodeAt(s + 1) === B) return {
2721
- node: {
2722
- type: Y.htmlComment,
2723
- text: "-",
2724
- endsWithGreaterThan: !0
2725
- },
2726
- end: s + 2
2727
- };
2728
- var c = e.indexOf("-->", s);
2729
- return c !== -1 && c <= n - 3 ? {
2730
- node: {
2731
- type: Y.htmlComment,
2732
- text: e.slice(t + 4, c)
2733
- },
2734
- end: c + 3
2735
- } : null;
2736
- }
2737
- if (o === Ve) {
2738
- var l = e.indexOf("?>", a + 1);
2739
- return l !== -1 && l < n ? {
2740
- node: {
2741
- type: Y.htmlSelfClosing,
2742
- tag: "?",
2743
- attrs: {},
2744
- a: e.slice(t, l + 2)
2745
- },
2746
- end: l + 2
2747
- } : null;
2748
- }
2749
- if (o === U && a + 1 < n) {
2750
- var u = e.charCodeAt(a + 1);
2751
- if (u === _e && e.slice(a + 1, a + 8) === "[CDATA[") {
2752
- var d = e.indexOf("]]>", a + 8);
2753
- return d !== -1 && d < n ? {
2754
- node: {
2755
- type: Y.htmlSelfClosing,
2756
- tag: "![CDATA[",
2757
- attrs: {},
2758
- a: e.slice(t, d + 3)
2759
- },
2760
- end: d + 3
2761
- } : null;
2762
- }
2763
- if (u >= q && u <= J) {
2764
- var f = e.indexOf(">", a + 2);
2765
- return f !== -1 && f < n ? {
2766
- node: {
2767
- type: Y.htmlSelfClosing,
2768
- tag: "!" + e.slice(a + 1, f),
2769
- attrs: {},
2770
- a: e.slice(t, f + 1)
2771
- },
2772
- end: f + 1
2773
- } : null;
2774
- }
2775
- }
2776
- if (o === W) {
2777
- var p = a + 1;
2778
- if (p >= n) return null;
2779
- var m = e.charCodeAt(p);
2780
- if (!(m >= q && m <= J || m >= $e && m <= et)) return null;
2781
- for (p++; p < n;) {
2782
- var h = e.charCodeAt(p);
2783
- if (h >= q && h <= J || h >= $e && h <= et || h >= G && h <= K || h === V) p++;
2784
- else break;
2785
- }
2786
- for (; p < n && (e.charCodeAt(p) === I || e.charCodeAt(p) === L || e.charCodeAt(p) === R);) p++;
2787
- if (p < n && e.charCodeAt(p) === B) {
2788
- var g = e.slice(a + 1, p).trim();
2789
- return {
2790
- node: {
2791
- type: Y.htmlSelfClosing,
2792
- tag: g,
2793
- attrs: {},
2794
- a: e.slice(t, p + 1),
2795
- b: !0
2796
- },
2797
- end: p + 1
2798
- };
2799
- }
2800
- return null;
2801
- }
2802
- if (!(o >= q && o <= J || o >= $e && o <= et)) return null;
2803
- var _ = Qt(e, t);
2804
- if (!_) return null;
2805
- var v = _.tag, y = v.toLowerCase();
2806
- if (_.selfClosing || vt(v)) return {
2807
- node: {
2808
- type: Y.htmlSelfClosing,
2809
- tag: v,
2810
- attrs: An(_.attrs, v, i),
2811
- a: e.slice(t, _.end)
2812
- },
2813
- end: _.end
2814
- };
2815
- var b = Wt.has(y), x = Pn(e.slice(0, n), _.end, v);
2816
- if (x === -1) return {
2817
- node: {
2818
- type: Y.htmlSelfClosing,
2819
- tag: v,
2820
- attrs: An(_.attrs, v, i),
2821
- a: e.slice(t, _.end)
2822
- },
2823
- end: _.end
2824
- };
2825
- var S = Mn(e, "</" + y, x), C = e.slice(_.end, S), w = [];
2826
- if (b) C.trim() && (w = [{
2827
- type: Y.text,
2828
- text: C
2829
- }]);
2830
- else {
2831
- var T = C.trim();
2832
- if (T) {
2833
- var { inAnchor: E, inline: D } = r;
2834
- y === "a" && (r.inAnchor = !0), T.indexOf("\n\n") !== -1 || /^#{1,6}\s/.test(T) ? (r.inline = !1, w = fr(T, r, i)) : w = ur(T, 0, T.length, r, i), r.inAnchor = E, r.inline = D;
2835
- }
2836
- }
2837
- return {
2838
- node: {
2839
- type: Y.htmlBlock,
2840
- tag: v,
2841
- attrs: An(_.attrs, v, i),
2842
- e: _.rawAttrs,
2843
- children: w,
2844
- text: C,
2845
- d: !1
2846
- },
2847
- end: x
2848
- };
2849
- }
2850
- var cr = 200, lr = 0;
2851
- function ur(e, t, n, r, i) {
2852
- if (lr++, lr > cr) return lr--, [{
2853
- type: Y.text,
2854
- text: e.slice(t, n)
2855
- }];
2856
- let a = r;
2857
- if (i.streaming || i.optimizeForStreaming) {
2858
- let r = function(e, t) {
2859
- for (var n = 1, r = t + 1; r < e.length; r++) {
2860
- var i = e.charCodeAt(r);
2861
- if (i === _e) n++;
2862
- else if (i === De && (n--, n === 0)) return r;
2863
- }
2864
- return -1;
2865
- }, i = e.slice(t, n), a = i;
2866
- for (var o = 0, s = 0, c = 0, l = 0, u = 0, d = -1, f = -1, p = -1, m = -1, h = -1, g = 0; g < i.length; g++) {
2867
- var _ = i.charCodeAt(g);
2868
- _ === Ce ? g + 1 < i.length && i.charCodeAt(g + 1) === Ce ? (o++, d = g, g++) : (s++, f = g) : _ === we ? g + 1 < i.length && i.charCodeAt(g + 1) === we ? (c++, p = g, g++) : (l++, m = g) : _ === ge && g + 1 < i.length && i.charCodeAt(g + 1) === ge && (u++, h = g, g++);
2869
- }
2870
- var v = [];
2871
- u % 2 == 1 && h >= 0 && v.push([h, 2]), c % 2 == 1 && p >= 0 && v.push([p, 2]), l % 2 == 1 && m >= 0 && v.push([m, 1]), o % 2 == 1 && d >= 0 && v.push([d, 2]), s % 2 == 1 && f >= 0 && v.push([f, 1]), v.sort(function(e, t) {
2872
- return t[0] - e[0];
2873
- });
2874
- for (var y = 0; y < v.length; y++) {
2875
- var b = v[y][0], x = v[y][1];
2876
- i = i.slice(0, b) + i.slice(b + x);
2877
- }
2878
- let j = 0, se = -1;
2879
- for (let e = 0; e < i.length; e++) i.charCodeAt(e) === z && (j++, se = e);
2880
- if (j % 2 == 1 && se !== -1) {
2881
- let e = !1, t = -1, n = 0;
2882
- for (; n < i.length;) i.charCodeAt(n) === z && (e ? (e = !1, t = -1) : (t = n, e = !0)), n++;
2883
- e && t !== -1 && (i = i.slice(0, t));
2884
- }
2885
- for (var S = !0; S;) {
2886
- S = !1;
2887
- for (var C = -1, w = -1, T = -1, E = !1, D = 0; D < i.length; D++) if (i.charCodeAt(D) === _e && (D === 0 || i.charCodeAt(D - 1) !== H)) {
2888
- var O = D > 0 && i.charCodeAt(D - 1) === U, ee = O ? D - 1 : D, te = r(i, D);
2889
- if (te === -1) C = ee, E = O, w = D + 1, T = i.length;
2890
- else {
2891
- var ne = te + 1;
2892
- if (ne >= i.length) C = ee, E = O, w = D + 1, T = te;
2893
- else if (i.charCodeAt(ne) === Ye) {
2894
- var k = i.indexOf(")", ne + 1);
2895
- k === -1 ? (C = ee, E = O, w = D + 1, T = te, D = i.length) : D = k;
2896
- } else if (i.charCodeAt(ne) === _e) {
2897
- var re = i.indexOf("]", ne + 1);
2898
- re === -1 ? (C = ee, E = O, w = D + 1, T = te, D = i.length) : D = re;
2899
- } else D = te;
2900
- }
2901
- }
2902
- if (C >= 0) {
2903
- var ie = E ? "" : i.slice(w, T);
2904
- i = i.slice(0, C) + ie, S = !0;
2905
- }
2906
- }
2907
- let M = i.match(/<([A-Z][A-Za-z0-9]*)(?:\s[^>]*)?>([^<]*)$/);
2908
- if (M && M.index !== void 0) {
2909
- for (var ae = !1, oe = 0, A = 0; A < M.index; A++) i.charCodeAt(A) === z && oe++;
2910
- if (ae = oe % 2 == 1, !ae) {
2911
- let e = M[1];
2912
- jn(i, "</" + e, 0) === -1 && (i = i.replace(/<[A-Z][A-Za-z0-9]*(?:\s[^>]*)?>([^<]*)$/, "$1"));
2913
- }
2914
- }
2915
- i !== a && (e = e.slice(0, t) + i, n = t + i.length);
2916
- }
2917
- let j = [];
2918
- var se = [];
2919
- let M = t;
2920
- var ce = i.disableAutoLink || i.disableBareUrls || a.inAnchor ? -1 : e.indexOf("@", t);
2921
- for (ce >= n && (ce = -1); t < n;) {
2922
- let r = e.charCodeAt(t), o = null;
2923
- if (r === z) {
2924
- if (o = Un(e, t, n), !o) {
2925
- var le = hn(e, t, n, z);
2926
- t += le - 1;
2927
- }
2928
- } else if (r === Ce || r === we) {
2929
- var ue = Zn(e, t, n);
2930
- if (ue) {
2931
- if (ue.canOpen || ue.canClose) {
2932
- t > M && j.push(or(e.slice(M, t)));
2933
- var N = or(e.slice(t, t + ue.len));
2934
- se.push({
2935
- idx: j.length,
2936
- ch: r,
2937
- len: ue.len,
2938
- canOpen: ue.canOpen,
2939
- canClose: ue.canClose,
2940
- active: !0
2941
- }), j.push(N), t += ue.len, M = t;
2942
- continue;
2943
- }
2944
- t += ue.len - 1;
2945
- }
2946
- } else r === ge ? o = Kn(e, t, n, a, i) : r === Se ? o = qn(e, t, n, a, i) : r === _e ? (t + 1 < n && e.charCodeAt(t + 1) === ve && (o = tr(e, t, n, a)), o ||= $n(e, t, n, a, i)) : r === U && t + 1 < n && e.charCodeAt(t + 1) === _e ? o = $n(e, t, n, a, i) : r === Te ? (o = er(e, t, n), !o && !i.disableParsingRawHTML && !i.ignoreHTMLBlocks && (o = sr(e, t, n, a, i))) : (r === Me || r === Ne || r === je) && !a.inAnchor && !i.disableAutoLink && (t === 0 || e.charCodeAt(t - 1) !== Te) && (o = nr(e, t, n, i));
2947
- if (!o && ce >= 0 && ce - t <= 64 && !a.inAnchor && !i.disableAutoLink && !i.disableBareUrls && (r >= q && r <= J || r >= $e && r <= et || r >= G && r <= K) && (o = rr(e, t, n, i), !o && t >= ce && (ce = e.indexOf("@", t + 1), ce >= n && (ce = -1))), r === Qe) {
2948
- t > M && j.push(or(e.slice(M, t))), j.push({ type: Y.breakLine }), t++, M = t;
2949
- continue;
2950
- }
2951
- if (o) t > M && j.push(or(e.slice(M, t))), j.push(o.node), t = o.end, M = t;
2952
- else {
2953
- if (r === H && t + 1 < n && un(e.charCodeAt(t + 1)) & X) {
2954
- t > M && j.push(or(e.slice(M, t))), j.push(or(e[t + 1])), t += 2, M = t;
2955
- continue;
2956
- }
2957
- if (t++, ce < 0 || ce - t > 64) for (; t < n;) {
2958
- var P = e.charCodeAt(t);
2959
- if (P < tt && !qt[P]) t++;
2960
- else break;
2961
- }
2962
- }
2963
- }
2964
- if (n > M) {
2965
- let t = e.slice(M, n);
2966
- (i.streaming || i.optimizeForStreaming) && (t = t.replace(/\*\*([^*]+)$/, "$1"), t.match(/\*[^*]+$/) && (t = t.replace(/\*([^*]+)$/, "$1")), t = t.replace(/__([^_]+)$/, "$1"), t.match(/_[^_]+$/) && (t = t.replace(/_([^_]+)$/, "$1")), t = t.replace(/~~([^~]+)$/, "$1"), t = t.replace(/\[([^\]]+)$/, "$1"), t = t.replace(/\[([^\]]+)\]\([^)]*$/, "$1")), t && j.push(or(t));
2967
- }
2968
- return se.length > 0 && Qn(j, se, r, i), lr--, j;
2969
- }
2970
- var dr = 500;
2971
- function fr(e, t, n) {
2972
- var r = t.g || 0;
2973
- if (r > dr) return [{
2974
- type: Y.text,
2975
- text: e
2976
- }];
2977
- if (t.g = r + 1, n.streaming || n.optimizeForStreaming) {
2978
- var i = e.length;
2979
- i > 0 && e.charCodeAt(i - 1) === R && i--;
2980
- for (var a = i; a > 0 && e.charCodeAt(a - 1) !== R;) a--;
2981
- if (a > 0 && e.charCodeAt(a) === Ke) {
2982
- for (var o = !0, s = a; s < i; s++) {
2983
- var c = e.charCodeAt(s);
2984
- if (c !== I && c !== L && c !== V && c !== ke && c !== Ke) {
2985
- o = !1;
2986
- break;
2987
- }
2988
- }
2989
- if (o) {
2990
- for (var l = a - 1; l > 0 && e.charCodeAt(l - 1) !== R;) l--;
2991
- e.charCodeAt(l) === Ke && (e = e.slice(0, l).trimEnd());
2992
- }
2993
- }
2994
- var u = e.trim(), d = u.lastIndexOf("\n"), f = d === -1 ? u : u.slice(d + 1);
2995
- if (f.length > 0 && f.charCodeAt(0) === Ke) {
2996
- for (var p = !1, m = !1, h = 1; h < f.length; h++) {
2997
- var g = f.charCodeAt(h);
2998
- g === Ke && (p = !0), g === V && (m = !0);
2999
- }
3000
- p && m && (e = d === -1 ? "" : e.slice(0, e.lastIndexOf(f)).trimEnd());
3001
- }
3002
- for (var _ = -1, v = -1, y = -1, b = e.length - 1; b >= 0; b--) if (e.charCodeAt(b) === Te) {
3003
- var x = b + 1 < e.length ? e.charCodeAt(b + 1) : 0;
3004
- if (x >= q && x <= J || x >= $e && x <= et) {
3005
- for (var S = b + 2; S < e.length;) {
3006
- var C = e.charCodeAt(S);
3007
- if (C >= q && C <= J || C >= $e && C <= et || C >= G && C <= K) S++;
3008
- else break;
3009
- }
3010
- for (var w = S; w < e.length && e.charCodeAt(w) !== B;) w++;
3011
- if (w < e.length) {
3012
- for (var T = !1, E = w + 1; E < e.length; E++) if (e.charCodeAt(E) === Te) {
3013
- T = !0;
3014
- break;
3015
- }
3016
- T || (_ = b, v = S, y = w + 1);
3017
- }
3018
- }
3019
- break;
3020
- }
3021
- if (_ >= 0) {
3022
- for (var D = 0, O = 0; O < _; O++) e.charCodeAt(O) === z && D++;
3023
- if (D % 2 == 0) {
3024
- var ee = e.slice(_ + 1, v);
3025
- jn(e, "</" + ee, 0) === -1 && (e = e.slice(0, _) + e.slice(y));
3026
- }
3027
- }
3028
- var te = e.length;
3029
- if (te > 0) {
3030
- for (var ne = e.lastIndexOf("\n"), k = ne === -1 ? 0 : ne + 1, re = te, ie = k, ae = 0; ie < re && e.charCodeAt(ie) === I && ae < 3;) ie++, ae++;
3031
- if (ie < re) {
3032
- var oe = e.charCodeAt(ie), A = !1;
3033
- if (oe === Ce || oe === V || oe === Ge) {
3034
- var j = ie + 1;
3035
- if (j >= re || e.charCodeAt(j) === I || e.charCodeAt(j) === L) {
3036
- for (var se = j; se < re && (e.charCodeAt(se) === I || e.charCodeAt(se) === L);) se++;
3037
- se >= re && (A = !0);
3038
- }
3039
- } else if (oe >= G && oe <= K) {
3040
- for (var M = ie; M < re && e.charCodeAt(M) >= G && e.charCodeAt(M) <= K;) M++;
3041
- if (M < re && (e.charCodeAt(M) === He || e.charCodeAt(M) === Xe)) {
3042
- var ce = M + 1;
3043
- if (ce >= re || e.charCodeAt(ce) === I || e.charCodeAt(ce) === L) {
3044
- for (var le = ce; le < re && (e.charCodeAt(le) === I || e.charCodeAt(le) === L);) le++;
3045
- le >= re && (A = !0);
3046
- }
3047
- }
3048
- }
3049
- A && (e = e.slice(0, k).trimEnd());
3050
- }
3051
- }
3052
- }
3053
- if (t.inline) return ur(e, 0, e.length, t, n);
3054
- let ue = [], N = 0, P = e.length;
3055
- if (N === 0 && e.startsWith("---")) {
3056
- let t = rt(e);
3057
- if (t && t.hasValidYaml) {
3058
- if (n.preserveFrontmatter !== !1) {
3059
- let n = e.slice(0, t.endPos).trimEnd();
3060
- ue.push({
3061
- type: Y.frontmatter,
3062
- text: n
3063
- });
3064
- }
3065
- N = t.endPos;
3066
- }
3067
- }
3068
- for (; N < P;) {
3069
- for (var F = e.indexOf("\n", N), de = F < 0 ? P : F; N < P && vn(e, N, de);) N = de < P ? de + 1 : de, N < P && (F = e.indexOf("\n", N), de = F < 0 ? P : F);
3070
- if (N >= P) break;
3071
- e.charCodeAt(N), _n(e, N, de);
3072
- let r = null;
3073
- if (e.charCodeAt(N) !== Ze && $ >= 4 && !t.inHTML) r = Sn(e, N);
3074
- else if (e.charCodeAt(N) !== Ze) {
3075
- let i = N + gn, a = e.charCodeAt(i);
3076
- a === ye ? r = yn(e, N, t, n) : a === B ? r = Cn(e, N, t, n) : a === z || a === ge ? r = xn(e, N, t) : a === V || a === Ce || a === we ? (r = bn(e, N), !r && (r = On(e, N, t, n))) : a === Ge || a >= G && a <= K ? r = On(e, N, t, n) : a === Te ? r = Fn(e, N, t, n) : a === Ke ? r = Rn(e, N, t, n) : a === _e && (r = zn(e, N, t));
3077
- }
3078
- if (!r) {
3079
- for (var fe = !1, pe = N; pe < de; pe++) if (e.charCodeAt(pe) === Ke) {
3080
- fe = !0;
3081
- break;
3082
- }
3083
- fe && (r = Rn(e, N, t, n));
3084
- }
3085
- if (r ||= Vn(e, N, t, n), r) r.node.type !== Y.refCollection && ue.push(r.node), N = r.end;
3086
- else {
3087
- var me = e.indexOf("\n", N);
3088
- N = me < 0 ? P : me + 1;
3089
- }
3090
- }
3091
- return t.g = r, ue;
3092
- }
3093
- function pr(e, t, n, r) {
3094
- var i = Qt(e, t);
3095
- return i ? {
3096
- tagName: i.tag,
3097
- tagLower: i.tag.toLowerCase(),
3098
- attrs: i.rawAttrs,
3099
- whitespaceBeforeAttrs: i.whitespaceBeforeAttrs,
3100
- isSelfClosing: i.selfClosing,
3101
- hasSpaceBeforeSlash: i.hasSpaceBeforeSlash,
3102
- isClosing: i.isClosing,
3103
- hasNewline: i.whitespaceBeforeAttrs.includes("\n") || i.rawAttrs.includes("\n"),
3104
- endPos: i.end
3105
- } : null;
3106
- }
3107
- function mr(e, t, n) {
3108
- lr = 0, e = Mt(e), !t.refs && (t.refs = {}), $t(e, t.refs, n);
3109
- let r = fr(e, t, n);
3110
- return t.refs && Object.keys(t.refs).length > 0 ? [{
3111
- type: Y.refCollection,
3112
- refs: t.refs
3113
- }, ...r] : r;
3114
- }
3115
- var hr = /^\n+/, gr;
3116
- try {
3117
- gr = P.createElement("div").$$typeof;
3118
- } catch {
3119
- gr = Symbol.for("react.transitional.element");
3120
- }
3121
- function _r(e, t, n) {
3122
- return {
3123
- $$typeof: gr,
3124
- type: e,
3125
- key: n == null ? null : "" + n,
3126
- ref: null,
3127
- props: t
3128
- };
3129
- }
3130
- var vr = typeof P.createContext < "u" ? P.createContext(void 0) : void 0;
3131
- function yr(e, t, n, r, i, a, o, s) {
3132
- switch (e.type) {
3133
- case Y.blockQuote: {
3134
- let i = { key: n.key };
3135
- return e.alert && (i.className = "markdown-alert-" + a(e.alert.toLowerCase(), ht), e.children.unshift({
3136
- attrs: {},
3137
- children: [{
3138
- type: Y.text,
3139
- text: e.alert
3140
- }],
3141
- d: !0,
3142
- type: Y.htmlBlock,
3143
- tag: "header"
3144
- })), r("blockquote", i, t(e.children, n));
3145
- }
3146
- case Y.breakLine: return r("br", { key: n.key });
3147
- case Y.breakThematic: return r("hr", { key: n.key });
3148
- case Y.frontmatter: return s.preserveFrontmatter ? r("pre", { key: n.key }, e.text) : null;
3149
- case Y.codeBlock:
3150
- let m = e.lang ? ct(e.lang) : "";
3151
- return r("pre", { key: n.key }, r("code", {
3152
- ...ot(e.attrs || {}),
3153
- className: m ? `language-${m} lang-${m}` : ""
3154
- }, e.text));
3155
- case Y.codeInline: return r("code", { key: n.key }, e.text);
3156
- case Y.footnoteReference: return r("a", {
3157
- key: n.key,
3158
- href: i(e.target, "a", "href") || void 0
3159
- }, r("sup", { key: n.key }, e.text));
3160
- case Y.gfmTask: return r("input", {
3161
- checked: e.completed,
3162
- key: n.key,
3163
- readOnly: !0,
3164
- type: "checkbox"
3165
- });
3166
- case Y.heading: return r(`h${e.level}`, {
3167
- id: e.id,
3168
- key: n.key
3169
- }, t(e.children, n));
3170
- case Y.htmlBlock: {
3171
- let m = e;
3172
- if (s.tagfilter && Rt(m.tag)) {
3173
- var c = "";
3174
- if (m.attrs) for (var l in m.attrs) {
3175
- var u = m.attrs[l];
3176
- u === !0 ? c += " " + l : u != null && u !== !1 && (c += " " + l + "=\"" + String(u) + "\"");
3177
- }
3178
- return r("span", { key: n.key }, "<" + m.tag + c + ">");
3179
- }
3180
- if (m.a && m.d) {
3181
- let c = function(e) {
3182
- if ((e.type === Y.htmlSelfClosing || e.type === Y.htmlBlock) && e.b) return [];
3183
- if (e.type === Y.paragraph) {
3184
- let t = e.children;
3185
- return t ? t.flatMap(c) : [];
3186
- }
3187
- return e.type === Y.text ? e.text?.trim() ? [e] : [] : e.type === Y.htmlBlock && e.children ? [{
3188
- ...e,
3189
- children: e.children?.flatMap(c)
3190
- }] : [e];
3191
- }, l = function(e) {
3192
- for (var t = 0; t < e.length; t++) e[t].type === Y.htmlBlock && (e[t].d = !1), "children" in e[t] && e[t].children && l(e[t].children);
3193
- }, u = function(e, t) {
3194
- for (var n = 0; n < e.length; n++) {
3195
- var r = e[n];
3196
- if (r.type === Y.paragraph && r.children) for (var i = r.children, a = 0; a < i.length; a++) {
3197
- var o = i[a];
3198
- if (o.type === Y.htmlSelfClosing && o.b && o.tag.toLowerCase() === t) {
3199
- var s = e.slice(0, n);
3200
- a > 0 && s.push({
3201
- type: Y.paragraph,
3202
- children: i.slice(0, a)
3203
- });
3204
- var c = [];
3205
- if (a + 1 < i.length) {
3206
- var l = i.slice(a + 1);
3207
- l = l.filter(function(e) {
3208
- return !(e.type === Y.htmlSelfClosing && e.b);
3209
- }), l.length > 0 && (c = l);
3210
- }
3211
- return c = c.concat(e.slice(n + 1)), {
3212
- found: !0,
3213
- beforeClose: s,
3214
- afterClose: c
3215
- };
3216
- }
3217
- }
3218
- if ((r.type === Y.htmlSelfClosing || r.type === Y.htmlBlock) && r.b && r.tag.toLowerCase() === t) return {
3219
- found: !0,
3220
- beforeClose: e.slice(0, n),
3221
- afterClose: e.slice(n + 1)
3222
- };
3223
- }
3224
- return {
3225
- found: !1,
3226
- beforeClose: e,
3227
- afterClose: []
3228
- };
3229
- }, h = m.tag.toLowerCase(), g = Yt(h), _ = m.children && m.children.length > 0, v = /<[a-z][^>]{0,100}>/i.test(m.a);
3230
- if (g) {
3231
- let t = m.a.replace(RegExp("\\s*</" + h + ">\\s*$", "i"), "");
3232
- return s.tagfilter && (t = Bt(t)), v ? r(e.tag, {
3233
- key: n.key,
3234
- ...ot(e.attrs || {}),
3235
- dangerouslySetInnerHTML: { __html: t }
3236
- }) : r(e.tag, {
3237
- key: n.key,
3238
- ...ot(e.attrs || {})
3239
- }, t);
3240
- }
3241
- let y = RegExp(`^<${m.tag}(\\s|>)`, "i").test(m.a);
3242
- if (_ && !y && s.tagfilter && zt(m.a)) return r(e.tag, {
3243
- key: n.key,
3244
- ...ot(e.attrs || {})
3245
- }, t(m.children, n));
3246
- if (Xt(m.a)) {
3247
- let t = s.tagfilter ? Bt(m.a) : m.a;
3248
- return r(e.tag, {
3249
- key: n.key,
3250
- ...ot(e.attrs || {}),
3251
- dangerouslySetInnerHTML: { __html: t }
3252
- });
3253
- }
3254
- let b = {
3255
- slugify: (e) => a(e, ht),
3256
- sanitizer: i,
3257
- tagfilter: !0
3258
- }, x = m.a.replace(/>\s+</g, "><").replace(/\n+/g, " ").trim();
3259
- if (RegExp(`^<${m.tag}(\\s[^>]*)?>(\\s*</${m.tag}>)?$`, "i").test(x)) return m.children && m.children.length > 0 ? r(e.tag, {
3260
- key: n.key,
3261
- ...ot(e.attrs || {})
3262
- }, t(m.children, n)) : r(e.tag, {
3263
- key: n.key,
3264
- ...ot(e.attrs || {})
3265
- });
3266
- let S = mr(x, {
3267
- inline: !1,
3268
- refs: o,
3269
- inHTML: !1
3270
- }, b);
3271
- l(S);
3272
- let C = m.tag.toLowerCase(), w = "</" + C + ">", T = RegExp(`^<${m.tag}(\\s|>)`, "i").test(x), E = x.toLowerCase().trimEnd().endsWith(w), D = T && E;
3273
- if (D && _) return r(e.tag, {
3274
- key: n.key,
3275
- ...ot(e.attrs || {})
3276
- }, t(m.children, n));
3277
- if (D) return t(S.flatMap(c), n);
3278
- var d = u(S, C);
3279
- if (d.found && d.afterClose.length > 0) {
3280
- var f = d.beforeClose.flatMap(c), p = d.afterClose.flatMap(c);
3281
- return _r(P.Fragment, { children: [r(e.tag, {
3282
- key: n.key,
3283
- ...ot(e.attrs || {})
3284
- }, t(f, n)), t(p, n)] }, null);
3285
- }
3286
- return r(e.tag, {
3287
- key: n.key,
3288
- ...ot(e.attrs || {})
3289
- }, t(S.flatMap(c), n));
3290
- }
3291
- return r(e.tag, {
3292
- key: n.key,
3293
- ...ot(e.attrs || {})
3294
- }, e.children ? t(e.children, n) : "");
3295
- }
3296
- case Y.htmlSelfClosing: {
3297
- let t = e;
3298
- if (s.tagfilter && Rt(t.tag)) {
3299
- var c = "";
3300
- if (t.attrs) for (var l in t.attrs) {
3301
- var u = t.attrs[l];
3302
- u === !0 ? c += " " + l : u != null && u !== !1 && (c += " " + l + "=\"" + String(u) + "\"");
3303
- }
3304
- return r("span", { key: n.key }, "<" + t.tag + c + " />");
3305
- }
3306
- return r(e.tag, {
3307
- key: n.key,
3308
- ...ot(e.attrs || {})
3309
- });
3310
- }
3311
- case Y.image: {
3312
- let t = e.target == null ? null : i(e.target, "img", "src");
3313
- return r("img", {
3314
- key: n.key,
3315
- alt: e.alt && e.alt.length > 0 ? e.alt : void 0,
3316
- title: e.title || void 0,
3317
- src: t || void 0
3318
- });
3319
- }
3320
- case Y.link: {
3321
- let i = { key: n.key };
3322
- return e.target != null && (i.href = Pt(e.target)), e.title && (i.title = e.title), r("a", i, t(e.children, n));
3323
- }
3324
- case Y.table: {
3325
- let i = e;
3326
- return r("table", { key: n.key }, r("thead", null, r("tr", null, i.header.map(function(e, a) {
3327
- return r("th", {
3328
- key: a,
3329
- style: i.align[a] == null ? {} : { textAlign: i.align[a] }
3330
- }, t(e, n));
3331
- }))), r("tbody", null, i.cells.map(function(e, a) {
3332
- return r("tr", { key: a }, e.map(function(e, a) {
3333
- return r("td", {
3334
- key: a,
3335
- style: i.align[a] == null ? {} : { textAlign: i.align[a] }
3336
- }, t(e, n));
3337
- }));
3338
- })));
3339
- }
3340
- case Y.text: return e.text;
3341
- case Y.textFormatted: return r(e.tag, { key: n.key }, t(e.children, n));
3342
- case Y.orderedList:
3343
- case Y.unorderedList: return r(e.type === Y.orderedList ? "ol" : "ul", {
3344
- key: n.key,
3345
- start: e.type === Y.orderedList ? e.start : void 0
3346
- }, e.items.map(function(e, i) {
3347
- return r("li", { key: i }, t(e, n));
3348
- }));
3349
- case Y.paragraph: return r("p", { key: n.key }, t(e.children, n));
3350
- case Y.ref: return null;
3351
- default: return null;
3352
- }
3353
- }
3354
- var br = (e, t, n, r, i, a) => {
3355
- var o = (e) => e.map(function(e) {
3356
- return "text" in e ? e.text : "";
3357
- }), s = (c, l = {}) => {
3358
- var u = (l.renderDepth || 0) + 1;
3359
- if (u > 2500) return o(c);
3360
- l.renderDepth = u;
3361
- for (var d = l.key, f = [], p = !1, m = 0; m < c.length; m++) {
3362
- l.key = m;
3363
- var h = e ? e(yr.bind(null, c[m], s, l, t, n, r, i, a), c[m], s, l) : yr(c[m], s, l, t, n, r, i, a), g = typeof h == "string";
3364
- if (g && p) f[f.length - 1] += h;
3365
- else if (h !== null) if (Array.isArray(h)) for (var _ = 0; _ < h.length; _++) f.push(h[_]);
3366
- else f.push(h);
3367
- p = g;
3368
- }
3369
- return l.key = d, l.renderDepth = u - 1, f;
3370
- };
3371
- return s;
3372
- }, xr = (e, t) => {
3373
- let n = Nt(t, e, void 0);
3374
- return n ? typeof n == "function" || typeof n == "object" && "render" in n ? n : Nt(t, `${e}.component`, e) : e;
3375
- };
3376
- function Sr(e, t) {
3377
- let n = { ...t || {} };
3378
- n.overrides = n.overrides || {};
3379
- let r = n.slugify || ht, i = n.sanitizer || ut, a = n.createElement, o = n.overrides && Object.keys(n.overrides).length > 0, s = (e) => Cr(e, {
3380
- ...n,
3381
- wrapper: null
3382
- });
3383
- function c(e, t, ...r) {
3384
- var i = t || {};
3385
- for (var c in i) {
3386
- var l = i[c];
3387
- if (typeof l == "string" && l.length > 0 && l.charCodeAt(0) === Te && (Vt.test(l) || Ht.test(l) || pr(l, 0))) {
3388
- var u = s(l.trim());
3389
- i[c] = c === "innerHTML" && Array.isArray(u) ? u[0] : u;
3390
- }
3391
- }
3392
- var d = e;
3393
- if (o) {
3394
- var f = Nt(n.overrides, e + ".props", {});
3395
- d = xr(e, n.overrides), i = {
3396
- ...i,
3397
- ...f,
3398
- className: Ft(i.className, f.className) || void 0
3399
- };
3400
- }
3401
- if (!a) {
3402
- var p = i.key;
3403
- return p != null && delete i.key, r.length === 1 ? i.children = r[0] : r.length > 1 && (i.children = r), _r(d, i, p);
3404
- }
3405
- return a(d, i, ...r);
3406
- }
3407
- let l = {
3408
- ...n,
3409
- slugify: (e) => r(e, ht),
3410
- sanitizer: i,
3411
- tagfilter: n.tagfilter !== !1
3412
- }, u = e[0] && e[0].type === Y.refCollection ? e[0].refs : {}, d = br(n.renderRule, c, i, r, u, n), f = d(e, {
3413
- inline: n.forceInline,
3414
- refs: u
3415
- }), p = [];
3416
- for (let e in u) e.charCodeAt(0) === ve && p.push({
3417
- identifier: e,
3418
- footnote: u[e].target
3419
- });
3420
- if (p.length && f.push(c("footer", { key: "footer" }, p.map(function(e) {
3421
- let t = e.identifier.charCodeAt(0) === ve ? e.identifier.slice(1) : e.identifier, n = mr(e.footnote, {
3422
- inline: !0,
3423
- refs: u
3424
- }, l);
3425
- return c("div", {
3426
- id: r(t, ht),
3427
- key: e.identifier
3428
- }, t + ": ", d(n, {
3429
- inline: !0,
3430
- refs: u
3431
- }));
3432
- }))), n.wrapper === null) return f;
3433
- let m = n.wrapper || (n.forceInline ? "span" : "div"), h;
3434
- if (f.length > 1 || n.forceWrapper) h = f;
3435
- else return f.length === 1 ? f[0] : null;
3436
- var g = n.wrapperProps ? { ...n.wrapperProps } : {};
3437
- return g.children = h, _r(m, g, "outer");
3438
- }
3439
- function Cr(e = "", t = {}) {
3440
- let n = { ...t || {} };
3441
- n.overrides = n.overrides || {};
3442
- let r = n.slugify || ht, i = n.sanitizer || ut;
3443
- function a(e) {
3444
- let t = n.forceInline || !n.forceBlock && !st.test(e), a = {
3445
- ...n,
3446
- slugify: (e) => r(e, ht),
3447
- sanitizer: i,
3448
- tagfilter: n.tagfilter !== !1
3449
- };
3450
- t || $t(e, o, a);
3451
- let s = e;
3452
- if (!t) {
3453
- let e = s.length;
3454
- for (; e > 0 && (s[e - 1] === "\n" || s[e - 1] === "\r");) e--;
3455
- s = s.slice(0, e), s = `${s.replace(hr, "")}
3456
-
3457
- `;
3458
- }
3459
- if (n.optimizeForStreaming) {
3460
- let e = s.lastIndexOf("<");
3461
- e !== -1 && s.slice(e).indexOf(">") === -1 && (s = s.slice(0, e));
3462
- }
3463
- return Sr(mr(t ? e : s, {
3464
- inline: t,
3465
- refs: o
3466
- }, a), {
3467
- ...a,
3468
- forceInline: t
3469
- });
3470
- }
3471
- let o = {};
3472
- return a(e);
3473
- }
3474
- var wr = ({ children: e, options: t, ...n }) => {
3475
- if (!(typeof P.useContext < "u")) {
3476
- let r = {
3477
- ...t,
3478
- overrides: { ...t?.overrides },
3479
- wrapperProps: {
3480
- ...t?.wrapperProps,
3481
- ...n
3482
- }
3483
- };
3484
- return Cr(e ?? "", r);
3485
- }
3486
- let r = P.useContext(vr), i = P.useMemo(() => ({
3487
- ...r,
3488
- ...t,
3489
- overrides: {
3490
- ...r?.overrides,
3491
- ...t?.overrides
3492
- },
3493
- wrapperProps: {
3494
- ...r?.wrapperProps,
3495
- ...t?.wrapperProps,
3496
- ...n
3497
- }
3498
- }), [
3499
- r,
3500
- t,
3501
- n
3502
- ]), a = e ?? "";
3503
- return P.useMemo(() => Cr(a, i), [a, i]);
3504
- }, Tr = P.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ (0, F.jsx)("div", {
3505
- className: "relative w-full overflow-auto",
3506
- children: /* @__PURE__ */ (0, F.jsx)("table", {
3507
- ref: n,
3508
- className: i("w-full caption-bottom text-sm", e),
3509
- ...t
3510
- })
3511
- }));
3512
- Tr.displayName = "Table";
3513
- var Er = P.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ (0, F.jsx)("thead", {
3514
- ref: n,
3515
- className: i("[&_tr]:border-b", e),
3516
- ...t
3517
- }));
3518
- Er.displayName = "TableHeader";
3519
- var Dr = P.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ (0, F.jsx)("tbody", {
3520
- ref: n,
3521
- className: i("[&_tr:last-child]:border-0", e),
3522
- ...t
3523
- }));
3524
- Dr.displayName = "TableBody";
3525
- var Or = P.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ (0, F.jsx)("tr", {
3526
- ref: n,
3527
- className: i("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", e),
3528
- ...t
3529
- }));
3530
- Or.displayName = "TableRow";
3531
- var kr = P.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ (0, F.jsx)("th", {
3532
- ref: n,
3533
- className: i("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0", e),
3534
- ...t
3535
- }));
3536
- kr.displayName = "TableHead";
3537
- var Ar = P.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ (0, F.jsx)("td", {
3538
- ref: n,
3539
- className: i("p-4 align-middle [&:has([role=checkbox])]:pr-0", e),
3540
- ...t
3541
- }));
3542
- Ar.displayName = "TableCell";
3543
- //#endregion
3544
- //#region src/client/components/shared/MarkdownRenderer.tsx
3545
- function jr({ children: e, className: t }) {
3546
- let n = "text";
3547
- if (t) {
3548
- let e = t.match(/(?:lang(?:uage)?-)(\w+)/);
3549
- n = e ? e[1] : t.replace(/^(lang-|language-)\s*/, "").trim();
3550
- }
3551
- let [r, i] = (0, P.useState)(!1), a = String(e).trim();
3552
- return /* @__PURE__ */ (0, F.jsxs)("div", {
3553
- className: "my-4 relative group/code bg-muted rounded-md p-0",
3554
- children: [/* @__PURE__ */ (0, F.jsxs)("div", {
3555
- className: "flex items-center justify-between mb-2 absolute top-0 left-0 w-full",
3556
- children: [/* @__PURE__ */ (0, F.jsx)("div", {
3557
- className: "text-[10px] font-mono text-muted-foreground/50 bg-transparent px-2 py-0 rounded",
3558
- children: n
3559
- }), /* @__PURE__ */ (0, F.jsx)("button", {
3560
- className: "opacity-0 group-hover/code:opacity-100 transition-opacity text-muted-foreground hover:text-foreground text-xs flex items-center gap-1 px-2 py-1 rounded hover:bg-muted",
3561
- onClick: async () => {
3562
- await b(a), i(!0), setTimeout(() => i(!1), 2e3);
3563
- },
3564
- title: "Copy code",
3565
- children: r ? /* @__PURE__ */ (0, F.jsx)(v, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, F.jsx)(y, { className: "h-3.5 w-3.5" })
3566
- })]
3567
- }), /* @__PURE__ */ (0, F.jsx)("pre", {
3568
- className: "text-sm m-0 p-4 pt-8 rounded-lg font-mono overflow-x-auto",
3569
- style: { background: "var(--muted)" },
3570
- children: /* @__PURE__ */ (0, F.jsx)("code", { children: a })
3571
- })]
3572
- });
3573
- }
3574
- function Mr({ children: e }) {
3575
- return /* @__PURE__ */ (0, F.jsx)("code", {
3576
- className: "bg-muted px-1.5 py-0.5 rounded text-sm font-mono",
3577
- children: e
3578
- });
3579
- }
3580
- function Nr({ children: e, className: t }) {
3581
- return t ? /* @__PURE__ */ (0, F.jsx)(jr, {
3582
- className: t,
3583
- children: e
3584
- }) : /* @__PURE__ */ (0, F.jsx)(Mr, { children: e });
3585
- }
3586
- function Pr({ children: e }) {
3587
- if (typeof e == "string") {
3588
- let t = e.match(/^\[([ xX])\]\s*(.*)/);
3589
- if (t) {
3590
- let e = t[1].toLowerCase() === "x", n = t[2];
3591
- return /* @__PURE__ */ (0, F.jsxs)("li", {
3592
- className: "text-foreground flex items-center gap-2",
3593
- children: [/* @__PURE__ */ (0, F.jsx)(ue, {
3594
- checked: e,
3595
- disabled: !0
3596
- }), /* @__PURE__ */ (0, F.jsx)("span", { children: n })]
3597
- });
3598
- }
3599
- }
3600
- if (Array.isArray(e) && e.length > 0) {
3601
- let t = e[0];
3602
- if (typeof t == "string") {
3603
- let n = t.match(/^\[([ xX])\]\s*(.*)/);
3604
- if (n) {
3605
- let t = n[1].toLowerCase() === "x", r = n[2];
3606
- return /* @__PURE__ */ (0, F.jsxs)("li", {
3607
- className: "text-foreground flex items-center gap-2",
3608
- children: [/* @__PURE__ */ (0, F.jsx)(ue, {
3609
- checked: t,
3610
- disabled: !0
3611
- }), /* @__PURE__ */ (0, F.jsxs)("span", { children: [r, e.slice(1)] })]
3612
- });
3613
- }
3614
- }
3615
- }
3616
- return /* @__PURE__ */ (0, F.jsx)("li", {
3617
- className: "text-foreground",
3618
- children: e
3619
- });
3620
- }
3621
- function Fr({ content: e }) {
3622
- return /* @__PURE__ */ (0, F.jsx)(wr, {
3623
- options: { overrides: {
3624
- code: Nr,
3625
- pre: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)(F.Fragment, { children: e }),
3626
- h1: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("h1", {
3627
- className: "text-xl font-bold text-foreground mb-2 mt-4",
3628
- children: e
3629
- }),
3630
- h2: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("h2", {
3631
- className: "text-lg font-bold text-foreground mb-2 mt-4",
3632
- children: e
3633
- }),
3634
- h3: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("h3", {
3635
- className: "text-base font-bold text-foreground mb-2 mt-4",
3636
- children: e
3637
- }),
3638
- h4: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("h4", {
3639
- className: "text-sm font-bold text-foreground mb-2 mt-4",
3640
- children: e
3641
- }),
3642
- h5: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("h5", {
3643
- className: "text-sm font-bold text-foreground mb-2 mt-4",
3644
- children: e
3645
- }),
3646
- h6: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("h6", {
3647
- className: "text-sm font-bold text-foreground mb-2 mt-4",
3648
- children: e
3649
- }),
3650
- p: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("p", {
3651
- className: "text-foreground mb-2 leading-relaxed",
3652
- children: e
3653
- }),
3654
- ul: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("ul", {
3655
- className: "list-disc list-outside pl-6 mb-3 space-y-1",
3656
- children: e
3657
- }),
3658
- ol: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("ol", {
3659
- className: "list-decimal list-outside pl-6 mb-3 space-y-1",
3660
- children: e
3661
- }),
3662
- li: Pr,
3663
- table: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("div", {
3664
- className: "my-4",
3665
- children: /* @__PURE__ */ (0, F.jsx)(Tr, { children: e })
3666
- }),
3667
- thead: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)(Er, { children: e }),
3668
- tbody: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)(Dr, { children: e }),
3669
- tr: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)(Or, { children: e }),
3670
- th: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)(kr, { children: e }),
3671
- td: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)(Ar, { children: e }),
3672
- blockquote: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("blockquote", {
3673
- className: "border-l-4 border-muted-foreground pl-4 italic text-muted-foreground mb-3",
3674
- children: e
3675
- }),
3676
- a: ({ children: e, href: t }) => /* @__PURE__ */ (0, F.jsx)("a", {
3677
- href: t,
3678
- className: "text-primary hover:underline",
3679
- target: "_blank",
3680
- rel: "noopener noreferrer",
3681
- children: e
3682
- }),
3683
- strong: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("strong", {
3684
- className: "font-semibold text-foreground",
3685
- children: e
3686
- }),
3687
- em: ({ children: e }) => /* @__PURE__ */ (0, F.jsx)("em", {
3688
- className: "italic text-foreground",
3689
- children: e
3690
- }),
3691
- img: ({ src: e, alt: t }) => /* @__PURE__ */ (0, F.jsx)("img", {
3692
- src: e,
3693
- alt: t || "",
3694
- className: "max-w-full max-h-[500px] object-contain rounded-lg my-4 border border-border",
3695
- loading: "lazy"
3696
- }),
3697
- hr: () => /* @__PURE__ */ (0, F.jsx)("hr", { className: "my-4 border-t border-border" })
3698
- } },
3699
- children: e
3700
- });
3701
- }
3702
- //#endregion
3703
- //#region src/client/components/prompts/PromptMessageCard.tsx
3704
- function Ir(e) {
3705
- switch (e) {
3706
- case "system": return "default";
3707
- case "user": return "outline";
3708
- case "assistant": return "secondary";
3709
- default: return "outline";
3710
- }
3711
- }
3712
- function Lr(e) {
3713
- return e.charAt(0).toUpperCase() + e.slice(1);
3714
- }
3715
- function Rr(e) {
3716
- return typeof e == "string" ? e : e.text ? e.text : e.type === "resource" && e.resource?.text ? e.resource.text : e.type === "image" ? `[Image: ${e.mimeType || "unknown type"}]` : JSON.stringify(e, null, 2);
3717
- }
3718
- function zr({ message: e, index: t }) {
3719
- let [n, i] = (0, P.useState)(!1);
3720
- return /* @__PURE__ */ (0, F.jsxs)("div", {
3721
- className: "border border-border rounded-lg overflow-hidden bg-white dark:bg-zinc-900",
3722
- children: [/* @__PURE__ */ (0, F.jsxs)("div", {
3723
- className: "flex items-center justify-between px-4 py-2 bg-muted/30 border-b border-border",
3724
- children: [/* @__PURE__ */ (0, F.jsx)(r, {
3725
- variant: Ir(e.role),
3726
- children: Lr(e.role)
3727
- }), /* @__PURE__ */ (0, F.jsx)(c, {
3728
- variant: "ghost",
3729
- size: "sm",
3730
- onClick: async () => {
3731
- await b(Rr(e.content)), i(!0), setTimeout(() => i(!1), 2e3);
3732
- },
3733
- className: "h-6 px-2",
3734
- title: "Copy message content",
3735
- children: n ? /* @__PURE__ */ (0, F.jsx)(v, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, F.jsx)(y, { className: "h-3.5 w-3.5" })
3736
- })]
3737
- }), /* @__PURE__ */ (0, F.jsx)("div", {
3738
- className: "px-4 py-3",
3739
- "data-testid": `prompt-message-content-${t}`,
3740
- children: (() => {
3741
- let t = e.content;
3742
- return typeof t == "string" ? /* @__PURE__ */ (0, F.jsx)(Fr, { content: t }) : t.type === "text" && t.text ? /* @__PURE__ */ (0, F.jsx)(Fr, { content: t.text }) : t.type === "image" ? /* @__PURE__ */ (0, F.jsxs)("div", {
3743
- className: "flex items-center gap-2 text-sm text-muted-foreground",
3744
- children: [/* @__PURE__ */ (0, F.jsxs)("span", {
3745
- className: "font-mono bg-muted px-2 py-1 rounded",
3746
- children: ["Image: ", t.mimeType || "unknown type"]
3747
- }), t.data && /* @__PURE__ */ (0, F.jsx)("img", {
3748
- src: `data:${t.mimeType};base64,${t.data}`,
3749
- alt: "Prompt image",
3750
- className: "max-w-full max-h-[300px] object-contain rounded-lg border border-border mt-2"
3751
- })]
3752
- }) : t.type === "resource" && t.resource ? /* @__PURE__ */ (0, F.jsxs)("div", {
3753
- className: "space-y-2",
3754
- children: [/* @__PURE__ */ (0, F.jsxs)("div", {
3755
- className: "flex items-center gap-2 text-sm",
3756
- children: [/* @__PURE__ */ (0, F.jsx)("span", {
3757
- className: "text-muted-foreground font-medium",
3758
- children: "Resource:"
3759
- }), /* @__PURE__ */ (0, F.jsx)("code", {
3760
- className: "bg-muted px-2 py-0.5 rounded text-xs font-mono",
3761
- children: t.resource.uri
3762
- })]
3763
- }), t.resource.text && /* @__PURE__ */ (0, F.jsx)("div", {
3764
- className: "mt-2",
3765
- children: /* @__PURE__ */ (0, F.jsx)(Fr, { content: t.resource.text })
3766
- })]
3767
- }) : /* @__PURE__ */ (0, F.jsx)("pre", {
3768
- className: "bg-muted p-3 rounded-lg text-sm overflow-x-auto",
3769
- children: /* @__PURE__ */ (0, F.jsx)("code", { children: JSON.stringify(t, null, 2) })
3770
- });
3771
- })()
3772
- })]
3773
- });
3774
- }
3775
- //#endregion
3776
- //#region src/client/components/prompts/PromptResultDisplay.tsx
3777
- function Br(e) {
3778
- let t = Date.now() - e, n = Math.floor(t / 1e3), r = Math.floor(n / 60), i = Math.floor(r / 60), a = Math.floor(i / 24);
3779
- return n < 10 ? "now" : n < 60 ? `${n}s ago` : r < 60 ? `${r}m ago` : i < 24 ? `${i}h ago` : `${a}d ago`;
3780
- }
3781
- function Vr(e) {
3782
- return "isError" in e && !e.isError ? null : "error" in e && e.error ? String(e.error) : "isError" in e && e.isError ? "An error occurred" : null;
3783
- }
3784
- function Hr({ results: e, copiedResult: t, previewMode: n = !0, onCopy: r, onDelete: i, onFullscreen: a, onTogglePreview: o, onMaximize: s, isMaximized: l = !1 }) {
3785
- let [u, d] = (0, P.useState)(0), [f, b] = (0, P.useState)(""), [x, C] = (0, P.useState)(!0), T = e[0], E = T ? e.filter((e) => e.promptName === T.promptName) : [], D = E[u] || E[0], O = e.findIndex((e) => e === D);
3786
- if ((0, P.useEffect)(() => {
3787
- E.length > 0 && u >= E.length && d(0);
3788
- }, [E.length, u]), (0, P.useEffect)(() => {
3789
- let e = () => {
3790
- D && b(Br(D.timestamp));
3791
- };
3792
- e();
3793
- let t = setInterval(e, 1e3);
3794
- return () => clearInterval(t);
3795
- }, [D]), e.length === 0) return /* @__PURE__ */ (0, F.jsx)("div", {
3796
- className: "flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",
3797
- children: /* @__PURE__ */ (0, F.jsx)("div", {
3798
- className: "flex-1 overflow-y-auto h-full",
3799
- children: /* @__PURE__ */ (0, F.jsx)("div", {
3800
- className: "flex items-center justify-center h-full",
3801
- children: /* @__PURE__ */ (0, F.jsx)("div", {
3802
- className: "text-center",
3803
- children: /* @__PURE__ */ (0, F.jsx)(j, {
3804
- vertical: !0,
3805
- noBorder: !0,
3806
- message: "No Results yet"
3807
- })
3808
- })
3809
- })
3810
- })
3811
- });
3812
- let ee = D.error || Vr(D.result), te = "messages" in D.result && Array.isArray(D.result.messages);
3813
- return /* @__PURE__ */ (0, F.jsx)("div", {
3814
- className: "flex flex-col h-full bg-white dark:bg-black border-t dark:border-zinc-700",
3815
- children: /* @__PURE__ */ (0, F.jsx)("div", {
3816
- className: "flex-1 overflow-y-auto h-full",
3817
- children: /* @__PURE__ */ (0, F.jsxs)("div", {
3818
- className: "space-y-0 flex-1 h-full flex flex-col",
3819
- children: [/* @__PURE__ */ (0, F.jsxs)("div", {
3820
- className: "flex items-center gap-2 px-4 pt-2 border-b border-gray-200 dark:border-zinc-600 pb-2",
3821
- children: [
3822
- /* @__PURE__ */ (0, F.jsx)("h3", {
3823
- className: "text-sm font-medium hidden sm:block",
3824
- children: "Response"
3825
- }),
3826
- D.duration !== void 0 && /* @__PURE__ */ (0, F.jsxs)("div", {
3827
- className: "hidden sm:flex items-center gap-1",
3828
- children: [/* @__PURE__ */ (0, F.jsx)(S, { className: "h-3 w-3 text-gray-400" }), /* @__PURE__ */ (0, F.jsxs)("span", {
3829
- className: "text-xs text-gray-500 dark:text-gray-400",
3830
- children: [D.duration, "ms"]
3831
- })]
3832
- }),
3833
- te && /* @__PURE__ */ (0, F.jsx)("div", {
3834
- className: "flex items-center gap-4 sm:ml-4",
3835
- children: /* @__PURE__ */ (0, F.jsxs)("div", {
3836
- className: "flex items-center gap-2",
3837
- children: [
3838
- /* @__PURE__ */ (0, F.jsx)("button", {
3839
- onClick: () => C(!0),
3840
- className: `text-xs font-medium ${x ? "text-black dark:text-white" : "text-zinc-500 dark:text-zinc-400"}`,
3841
- children: "Formatted"
3842
- }),
3843
- /* @__PURE__ */ (0, F.jsx)("span", {
3844
- className: "text-xs text-zinc-400",
3845
- children: "|"
3846
- }),
3847
- /* @__PURE__ */ (0, F.jsx)("button", {
3848
- onClick: () => C(!1),
3849
- className: `text-xs font-medium ${x ? "text-zinc-500 dark:text-zinc-400" : "text-black dark:text-white"}`,
3850
- children: "Raw"
3851
- })
3852
- ]
3853
- })
3854
- }),
3855
- /* @__PURE__ */ (0, F.jsxs)("div", {
3856
- className: "ml-auto flex items-center gap-1",
3857
- children: [
3858
- E.length > 1 && /* @__PURE__ */ (0, F.jsxs)("div", {
3859
- className: "flex items-center gap-2 mr-2",
3860
- children: [/* @__PURE__ */ (0, F.jsx)(ne, { className: "h-3 w-3 text-gray-400" }), /* @__PURE__ */ (0, F.jsxs)(_, {
3861
- value: u.toString(),
3862
- onValueChange: (e) => d(parseInt(e)),
3863
- children: [/* @__PURE__ */ (0, F.jsx)(m, {
3864
- className: "h-7 w-[120px] text-xs",
3865
- children: /* @__PURE__ */ (0, F.jsx)(p, {})
3866
- }), /* @__PURE__ */ (0, F.jsx)(h, { children: E.map((e, t) => /* @__PURE__ */ (0, F.jsx)(g, {
3867
- value: t.toString(),
3868
- children: t === 0 ? "Latest" : `${t + 1} call ago`
3869
- }, t)) })]
3870
- })]
3871
- }),
3872
- /* @__PURE__ */ (0, F.jsx)("span", {
3873
- className: "text-xs text-gray-500 dark:text-gray-400 mr-2",
3874
- children: f
3875
- }),
3876
- /* @__PURE__ */ (0, F.jsx)(c, {
3877
- variant: "ghost",
3878
- size: "sm",
3879
- onClick: () => r(O, D.result),
3880
- className: "h-7 w-7 p-0",
3881
- title: "Copy result",
3882
- children: t === O ? /* @__PURE__ */ (0, F.jsx)(v, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, F.jsx)(y, { className: "h-4 w-4" })
3883
- }),
3884
- i && /* @__PURE__ */ (0, F.jsx)(c, {
3885
- variant: "ghost",
3886
- size: "sm",
3887
- onClick: () => i(O),
3888
- className: "h-7 w-7 p-0",
3889
- title: "Delete result",
3890
- children: /* @__PURE__ */ (0, F.jsx)(A, { className: "h-4 w-4" })
3891
- }),
3892
- a && /* @__PURE__ */ (0, F.jsx)(c, {
3893
- variant: "ghost",
3894
- size: "sm",
3895
- onClick: () => a(O),
3896
- className: "h-7 w-7 p-0 sm:hidden",
3897
- title: "Fullscreen",
3898
- children: /* @__PURE__ */ (0, F.jsx)(k, { className: "h-4 w-4" })
3899
- }),
3900
- s && /* @__PURE__ */ (0, F.jsx)(c, {
3901
- variant: "ghost",
3902
- size: "sm",
3903
- onClick: s,
3904
- className: "h-7 w-7 p-0 hidden sm:flex",
3905
- title: l ? "Restore" : "Maximize",
3906
- children: l ? /* @__PURE__ */ (0, F.jsx)(ie, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, F.jsx)(k, { className: "h-4 w-4" })
3907
- })
3908
- ]
3909
- })
3910
- ]
3911
- }), /* @__PURE__ */ (0, F.jsx)("div", {
3912
- className: "flex-1 overflow-y-auto p-4",
3913
- children: ee ? /* @__PURE__ */ (0, F.jsxs)("div", {
3914
- className: "bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",
3915
- children: [/* @__PURE__ */ (0, F.jsx)("p", {
3916
- className: "text-red-800 dark:text-red-300 font-medium",
3917
- children: "Error:"
3918
- }), /* @__PURE__ */ (0, F.jsx)("p", {
3919
- className: "text-red-700 dark:text-red-400 text-sm",
3920
- children: ee
3921
- })]
3922
- }) : x && te ? /* @__PURE__ */ (0, F.jsx)("div", {
3923
- className: "space-y-3",
3924
- children: ("messages" in D.result ? D.result.messages : []).map((e, t) => /* @__PURE__ */ (0, F.jsx)(zr, {
3925
- message: e,
3926
- index: t
3927
- }, t))
3928
- }) : /* @__PURE__ */ (0, F.jsx)(w, {
3929
- data: D.result,
3930
- filename: `prompt-result-${D.promptName}-${Date.now()}.json`
3931
- })
3932
- })]
3933
- })
3934
- })
3935
- });
3936
- }
3937
- //#endregion
3938
- //#region src/client/components/prompts/PromptsList.tsx
3939
- function Ur({ prompts: e, selectedPrompt: t, onPromptSelect: n, focusedIndex: i }) {
3940
- return e.length === 0 ? /* @__PURE__ */ (0, F.jsxs)("div", {
3941
- className: "flex flex-1 flex-col items-center justify-center p-4 text-center",
3942
- children: [/* @__PURE__ */ (0, F.jsx)(re, { className: "h-12 w-12 text-gray-400 dark:text-gray-600 mb-3" }), /* @__PURE__ */ (0, F.jsx)("p", {
3943
- className: "text-gray-500 dark:text-gray-400",
3944
- children: "No prompts available"
3945
- })]
3946
- }) : /* @__PURE__ */ (0, F.jsx)("div", { children: e.map((e, a) => /* @__PURE__ */ (0, F.jsx)(ee, {
3947
- id: `prompt-${e.name}`,
3948
- "data-testid": `prompt-item-${e.name}`,
3949
- isSelected: t?.name === e.name,
3950
- isFocused: i === a,
3951
- title: e.name,
3952
- description: e.description,
3953
- metadata: e.arguments && e.arguments.length > 0 && /* @__PURE__ */ (0, F.jsxs)(r, {
3954
- variant: "outline",
3955
- className: "text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",
3956
- children: [e.arguments.length, " args"]
3957
- }),
3958
- onClick: () => n(e)
3959
- }, e.name)) });
3960
- }
3961
- //#endregion
3962
- //#region src/client/components/prompts/SavedPromptsList.tsx
3963
- function Wr({ savedPrompts: e, selectedPrompt: t, onLoadPrompt: n, onDeletePrompt: r, focusedIndex: i }) {
3964
- return e.length === 0 ? /* @__PURE__ */ (0, F.jsxs)("div", {
3965
- className: "flex flex-1 flex-col items-center justify-center p-4 text-center",
3966
- children: [
3967
- /* @__PURE__ */ (0, F.jsx)(C, { className: "h-12 w-12 text-gray-400 dark:text-gray-600 mb-3" }),
3968
- /* @__PURE__ */ (0, F.jsx)("p", {
3969
- className: "text-gray-500 dark:text-gray-400",
3970
- children: "No history"
3971
- }),
3972
- /* @__PURE__ */ (0, F.jsx)("p", {
3973
- className: "text-sm text-gray-400 dark:text-gray-500 mt-1",
3974
- children: "Prompts you execute will appear here"
3975
- })
3976
- ]
3977
- }) : /* @__PURE__ */ (0, F.jsx)("div", { children: e.map((e, r) => /* @__PURE__ */ (0, F.jsx)(ee, {
3978
- id: `saved-prompt-${e.id}`,
3979
- isSelected: t?.id === e.id,
3980
- isFocused: i === r,
3981
- title: e.name,
3982
- description: `${e.promptName} - ${new Date(e.savedAt).toLocaleString()}`,
3983
- onClick: () => n(e)
3984
- }, e.id)) });
3985
- }
3986
- //#endregion
3987
- //#region src/client/components/PromptsTab.tsx
3988
- var Gr = "mcp-inspector-saved-prompts";
3989
- function Kr({ ref: e, prompts: t, callPrompt: n, serverId: r, isConnected: i, refreshPrompts: a }) {
3990
- let [s, l] = (0, P.useState)(!1), [u, d] = (0, P.useState)(null), { selectedPromptName: p, setSelectedPromptName: m } = M(), [h, g] = (0, P.useState)(null), [_, v] = (0, P.useState)("prompts"), [y, S] = (0, P.useState)([]), [w, ee] = (0, P.useState)(!1), [ne, k] = (0, P.useState)(""), [ie, ae] = (0, P.useState)(!1), [oe, A] = (0, P.useState)(-1), j = (0, P.useRef)(null), [se, le] = (0, P.useState)(!1), [ue, de] = (0, P.useState)("list"), [pe, me] = (0, P.useState)(!1), { filteredPrompts: I, selectedPrompt: L, setSelectedPrompt: he, results: R, handleDeleteResult: z, promptArgs: ge, setPromptArgs: _e, isExecuting: ve, handlePromptSelect: B, handleArgChange: ye, executeSelectedPrompt: be, searchQuery: xe, setSearchQuery: V } = ce({
3991
- prompts: t,
3992
- callPrompt: n,
3993
- serverId: r
3994
- }), Se = te(), H = te();
3995
- (0, P.useEffect)(() => {
3996
- let e = () => {
3997
- le(window.innerWidth < 1024);
3998
- };
3999
- return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
4000
- }, []), (0, P.useEffect)(() => {
4001
- de(L ? "detail" : "list");
4002
- }, [L]), (0, P.useEffect)(() => {
4003
- se && R.length > 0 && !ve && de("response");
4004
- }, [
4005
- R,
4006
- ve,
4007
- se
4008
- ]), (0, P.useImperativeHandle)(e, () => ({
4009
- focusSearch: () => {
4010
- ae(!0), setTimeout(() => {
4011
- j.current && j.current.focus();
4012
- }, 0);
4013
- },
4014
- blurSearch: () => {
4015
- V(""), ae(!1), j.current && j.current.blur();
4016
- }
4017
- })), (0, P.useEffect)(() => {
4018
- try {
4019
- let e = localStorage.getItem(Gr);
4020
- e && S(JSON.parse(e));
4021
- } catch (e) {
4022
- console.error("[PromptsTab] Failed to load saved prompts:", e);
4023
- }
4024
- }, []);
4025
- let Ce = (0, P.useCallback)((e) => {
4026
- try {
4027
- localStorage.setItem(Gr, JSON.stringify(e));
4028
- } catch (e) {
4029
- console.error("[PromptsTab] Failed to save prompts:", e);
4030
- }
4031
- }, []);
4032
- (0, P.useEffect)(() => {
4033
- ie && j.current && j.current.focus();
4034
- }, [ie]);
4035
- let we = (0, P.useCallback)(() => {
4036
- xe.trim() || ae(!1);
4037
- }, [xe]), Te = (0, P.useCallback)(async () => {
4038
- if (a) {
4039
- l(!0);
4040
- try {
4041
- await a();
4042
- } finally {
4043
- l(!1);
4044
- }
4045
- }
4046
- }, [a]), Ee = (0, P.useCallback)((e) => {
4047
- let n = t.find((t) => t.name === e.promptName);
4048
- n && (he(n), _e(e.args), d(e));
4049
- }, [
4050
- t,
4051
- he,
4052
- _e
4053
- ]);
4054
- (0, P.useEffect)(() => {
4055
- A(-1);
4056
- }, [xe, _]), (0, P.useEffect)(() => {
4057
- let e = (e) => {
4058
- let t = e.target;
4059
- if (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.contentEditable === "true" || e.metaKey || e.ctrlKey || e.altKey) return;
4060
- let n = _ === "prompts" ? I : y;
4061
- if (e.key === "ArrowDown") e.preventDefault(), A((e) => {
4062
- let t = e + 1;
4063
- return t >= n.length ? 0 : t;
4064
- });
4065
- else if (e.key === "ArrowUp") e.preventDefault(), A((e) => {
4066
- let t = e - 1;
4067
- return t < 0 ? n.length - 1 : t;
4068
- });
4069
- else if (e.key === "Enter" && oe >= 0) if (e.preventDefault(), _ === "prompts") {
4070
- let e = I[oe];
4071
- e && B(e);
4072
- } else {
4073
- let e = y[oe];
4074
- e && Ee(e);
4075
- }
4076
- };
4077
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
4078
- }, [
4079
- oe,
4080
- I,
4081
- y,
4082
- _,
4083
- B,
4084
- Ee
4085
- ]), (0, P.useEffect)(() => {
4086
- if (oe >= 0) {
4087
- let e = _ === "prompts" ? `prompt-${I[oe]?.name}` : `saved-prompt-${y[oe]?.id}`, t = document.getElementById(e);
4088
- t && t.scrollIntoView({
4089
- behavior: "smooth",
4090
- block: "nearest"
4091
- });
4092
- }
4093
- }, [
4094
- oe,
4095
- I,
4096
- y,
4097
- _
4098
- ]), (0, P.useEffect)(() => {
4099
- if (console.warn("[PromptsTab] Auto-selection effect triggered:", {
4100
- selectedPromptName: p,
4101
- promptsCount: t.length,
4102
- currentSelectedPrompt: L?.name
4103
- }), p && t.length > 0) {
4104
- let e = t.find((e) => e.name === p);
4105
- if (console.warn("[PromptsTab] Prompt lookup result:", {
4106
- selectedPromptName: p,
4107
- promptFound: !!e,
4108
- promptName: e?.name,
4109
- shouldSelect: e && L?.name !== e.name
4110
- }), e && L?.name !== e.name) {
4111
- console.warn("[PromptsTab] Selecting prompt:", e.name), m(null);
4112
- let t = setTimeout(() => {
4113
- B(e);
4114
- let t = document.getElementById(`prompt-${e.name}`);
4115
- t && (console.warn("[PromptsTab] Scrolling to prompt element"), t.scrollIntoView({
4116
- behavior: "smooth",
4117
- block: "nearest"
4118
- }));
4119
- }, 100);
4120
- return () => clearTimeout(t);
4121
- }
4122
- }
4123
- }, [
4124
- p,
4125
- t,
4126
- L,
4127
- B,
4128
- m
4129
- ]);
4130
- let De = (0, P.useCallback)(async (e, t) => {
4131
- try {
4132
- await b(JSON.stringify(t, null, 2)), g(e), setTimeout(() => g(null), 2e3);
4133
- } catch (e) {
4134
- console.error("[PromptsTab] Failed to copy result:", e);
4135
- }
4136
- }, []), U = (0, P.useCallback)((e) => {
4137
- if (se) de("response");
4138
- else {
4139
- let t = R[e];
4140
- if (t) {
4141
- let e = window.open("", "_blank", "width=800,height=600");
4142
- if (e) {
4143
- let n = t.result;
4144
- e.document.write(`
4145
- <html>
4146
- <head>
4147
- <title>${t.promptName} Result</title>
4148
- <style>
4149
- body { font-family: monospace; padding: 20px; background: #1e1e1e; color: #d4d4d4; }
4150
- pre { white-space: pre-wrap; word-wrap: break-word; }
4151
- </style>
4152
- </head>
4153
- <body>
4154
- <h2>${t.promptName}</h2>
4155
- <pre>${JSON.stringify(n, null, 2)}</pre>
4156
- </body>
4157
- </html>
4158
- `), e.document.close();
4159
- }
4160
- }
4161
- }
4162
- }, [se, R]), Oe = (0, P.useCallback)(() => {
4163
- pe ? (Se.current && Se.current.expand(), H.current && H.current.expand(), me(!1)) : (Se.current && Se.current.collapse(), H.current && H.current.collapse(), me(!0));
4164
- }, [
4165
- pe,
4166
- Se,
4167
- H
4168
- ]), ke = (0, P.useCallback)(() => {
4169
- L && (k(""), ee(!0));
4170
- }, [L]), Ae = (0, P.useCallback)((e) => {
4171
- Ce(y.filter((t) => t.id !== e)), u?.id === e && d(null);
4172
- }, [
4173
- y,
4174
- Ce,
4175
- u
4176
- ]);
4177
- return se ? /* @__PURE__ */ (0, F.jsxs)("div", {
4178
- className: "h-full flex flex-col overflow-hidden relative bg-background",
4179
- children: [ue !== "list" && /* @__PURE__ */ (0, F.jsxs)("div", {
4180
- className: "flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",
4181
- children: [/* @__PURE__ */ (0, F.jsx)(c, {
4182
- variant: "ghost",
4183
- size: "sm",
4184
- onClick: () => {
4185
- ue === "response" ? de("detail") : (he(null), de("list"));
4186
- },
4187
- className: "p-0 h-8 w-8",
4188
- children: /* @__PURE__ */ (0, F.jsx)(x, { className: "h-4 w-4" })
4189
- }), /* @__PURE__ */ (0, F.jsxs)("div", {
4190
- className: "flex items-center text-sm font-medium",
4191
- children: [
4192
- /* @__PURE__ */ (0, F.jsx)("button", {
4193
- onClick: () => {
4194
- he(null), de("list");
4195
- },
4196
- className: "text-muted-foreground hover:text-foreground hover:underline cursor-pointer",
4197
- children: "Prompts"
4198
- }),
4199
- ue === "detail" && /* @__PURE__ */ (0, F.jsxs)(F.Fragment, { children: [/* @__PURE__ */ (0, F.jsx)("span", {
4200
- className: "mx-2 text-muted-foreground",
4201
- children: "/"
4202
- }), /* @__PURE__ */ (0, F.jsx)("button", {
4203
- onClick: () => {
4204
- de("response");
4205
- },
4206
- className: ue === "detail" ? "text-foreground hover:underline" : ue === "response" ? "text-muted-foreground hover:text-foreground hover:underline cursor-pointer" : "text-muted-foreground",
4207
- children: "Execute"
4208
- })] }),
4209
- ue === "response" && /* @__PURE__ */ (0, F.jsxs)(F.Fragment, { children: [/* @__PURE__ */ (0, F.jsx)("span", {
4210
- className: "mx-2 text-muted-foreground",
4211
- children: "/"
4212
- }), /* @__PURE__ */ (0, F.jsx)("span", {
4213
- className: "text-foreground",
4214
- children: "Response"
4215
- })] })
4216
- ]
4217
- })]
4218
- }), /* @__PURE__ */ (0, F.jsx)("div", {
4219
- className: "flex-1 relative overflow-hidden",
4220
- children: /* @__PURE__ */ (0, F.jsxs)(f, {
4221
- initial: !1,
4222
- mode: "popLayout",
4223
- children: [
4224
- ue === "list" && /* @__PURE__ */ (0, F.jsx)(o.div, {
4225
- initial: { x: "-100%" },
4226
- animate: { x: 0 },
4227
- exit: { x: "-100%" },
4228
- transition: {
4229
- type: "spring",
4230
- stiffness: 300,
4231
- damping: 30
4232
- },
4233
- className: "absolute inset-0 flex flex-col bg-background z-0",
4234
- children: /* @__PURE__ */ (0, F.jsx)(D, { children: (e) => /* @__PURE__ */ (0, F.jsxs)(F.Fragment, { children: [/* @__PURE__ */ (0, F.jsx)(N, {
4235
- isScrolled: e,
4236
- activeTab: _,
4237
- isSearchExpanded: ie,
4238
- searchQuery: xe,
4239
- primaryTabName: "prompts",
4240
- secondaryTabName: "saved",
4241
- primaryTabTitle: "Prompts",
4242
- secondaryTabTitle: "History",
4243
- primaryCount: I.length,
4244
- secondaryCount: y.length,
4245
- primaryIcon: re,
4246
- secondaryIcon: C,
4247
- searchPlaceholder: "Search prompts...",
4248
- onSearchExpand: () => ae(!0),
4249
- onSearchChange: V,
4250
- onSearchBlur: we,
4251
- onTabSwitch: () => v(_ === "prompts" ? "saved" : "prompts"),
4252
- searchInputRef: j,
4253
- onRefresh: a ? Te : void 0,
4254
- isRefreshing: s
4255
- }), _ === "prompts" ? /* @__PURE__ */ (0, F.jsx)(Ur, {
4256
- prompts: I,
4257
- selectedPrompt: L,
4258
- onPromptSelect: B,
4259
- focusedIndex: oe
4260
- }) : /* @__PURE__ */ (0, F.jsx)(Wr, {
4261
- savedPrompts: y,
4262
- selectedPrompt: u,
4263
- onLoadPrompt: Ee,
4264
- onDeletePrompt: Ae,
4265
- focusedIndex: oe
4266
- })] }) })
4267
- }, "list"),
4268
- ue === "detail" && /* @__PURE__ */ (0, F.jsx)(o.div, {
4269
- initial: { x: "100%" },
4270
- animate: { x: 0 },
4271
- exit: { x: "-100%" },
4272
- transition: {
4273
- type: "spring",
4274
- stiffness: 300,
4275
- damping: 30
4276
- },
4277
- className: "absolute inset-0 bg-background z-10",
4278
- children: /* @__PURE__ */ (0, F.jsx)(fe, {
4279
- selectedPrompt: L,
4280
- promptArgs: ge,
4281
- isExecuting: ve,
4282
- isConnected: i,
4283
- onArgChange: ye,
4284
- onExecute: be,
4285
- onSave: ke
4286
- })
4287
- }, "detail"),
4288
- ue === "response" && /* @__PURE__ */ (0, F.jsx)(o.div, {
4289
- initial: { x: "100%" },
4290
- animate: { x: 0 },
4291
- exit: { x: "100%" },
4292
- transition: {
4293
- type: "spring",
4294
- stiffness: 300,
4295
- damping: 30
4296
- },
4297
- className: "absolute inset-0 bg-background z-20",
4298
- children: /* @__PURE__ */ (0, F.jsx)(Hr, {
4299
- results: R,
4300
- copiedResult: h,
4301
- onCopy: De,
4302
- onDelete: z,
4303
- onFullscreen: U
4304
- })
4305
- }, "response")
4306
- ]
4307
- })
4308
- })]
4309
- }) : /* @__PURE__ */ (0, F.jsxs)(O, {
4310
- orientation: "horizontal",
4311
- className: "h-full",
4312
- children: [
4313
- /* @__PURE__ */ (0, F.jsx)(T, {
4314
- id: "left-panel",
4315
- panelRef: Se,
4316
- defaultSize: "33%",
4317
- collapsible: !0,
4318
- className: "flex flex-col h-full relative",
4319
- children: /* @__PURE__ */ (0, F.jsx)("div", {
4320
- className: "flex h-full flex-col overflow-hidden border-r dark:border-zinc-700",
4321
- children: /* @__PURE__ */ (0, F.jsx)(D, { children: (e) => /* @__PURE__ */ (0, F.jsxs)(F.Fragment, { children: [/* @__PURE__ */ (0, F.jsx)(N, {
4322
- isScrolled: e,
4323
- activeTab: _,
4324
- isSearchExpanded: ie,
4325
- searchQuery: xe,
4326
- primaryTabName: "prompts",
4327
- secondaryTabName: "saved",
4328
- primaryTabTitle: "Prompts",
4329
- secondaryTabTitle: "History",
4330
- primaryCount: I.length,
4331
- secondaryCount: y.length,
4332
- primaryIcon: re,
4333
- secondaryIcon: C,
4334
- searchPlaceholder: "Search prompts...",
4335
- onSearchExpand: () => ae(!0),
4336
- onSearchChange: V,
4337
- onSearchBlur: we,
4338
- onTabSwitch: () => v(_ === "prompts" ? "saved" : "prompts"),
4339
- searchInputRef: j,
4340
- onRefresh: a ? Te : void 0,
4341
- isRefreshing: s
4342
- }), _ === "prompts" ? /* @__PURE__ */ (0, F.jsx)(Ur, {
4343
- prompts: I,
4344
- selectedPrompt: L,
4345
- onPromptSelect: B,
4346
- focusedIndex: oe
4347
- }) : /* @__PURE__ */ (0, F.jsx)(Wr, {
4348
- savedPrompts: y,
4349
- selectedPrompt: u,
4350
- onLoadPrompt: Ee,
4351
- onDeletePrompt: Ae,
4352
- focusedIndex: oe
4353
- })] }) })
4354
- })
4355
- }),
4356
- /* @__PURE__ */ (0, F.jsx)(E, { withHandle: !0 }),
4357
- /* @__PURE__ */ (0, F.jsx)(T, {
4358
- defaultSize: "67%",
4359
- children: /* @__PURE__ */ (0, F.jsxs)(O, {
4360
- orientation: "vertical",
4361
- children: [
4362
- /* @__PURE__ */ (0, F.jsx)(T, {
4363
- panelRef: H,
4364
- defaultSize: "40%",
4365
- collapsible: !0,
4366
- children: /* @__PURE__ */ (0, F.jsx)(fe, {
4367
- selectedPrompt: L,
4368
- promptArgs: ge,
4369
- isExecuting: ve,
4370
- isConnected: i,
4371
- onArgChange: ye,
4372
- onExecute: be,
4373
- onSave: ke
4374
- })
4375
- }),
4376
- /* @__PURE__ */ (0, F.jsx)(E, { withHandle: !0 }),
4377
- /* @__PURE__ */ (0, F.jsx)(T, {
4378
- defaultSize: "60%",
4379
- children: /* @__PURE__ */ (0, F.jsx)("div", {
4380
- className: "flex flex-col h-full",
4381
- children: /* @__PURE__ */ (0, F.jsx)(Hr, {
4382
- results: R,
4383
- copiedResult: h,
4384
- onCopy: De,
4385
- onDelete: z,
4386
- onFullscreen: U,
4387
- onMaximize: Oe,
4388
- isMaximized: pe
4389
- })
4390
- })
4391
- })
4392
- ]
4393
- })
4394
- })
4395
- ]
4396
- });
4397
- }
4398
- Kr.displayName = "PromptsTab";
4399
- //#endregion
4400
- export { Kr as PromptsTab };