@gui-chat-plugin/markdown 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # @gui-chat-plugin/markdown
2
+
3
+ [![npm version](https://badge.fury.io/js/%40gui-chat-plugin%2Fmarkdown.svg)](https://www.npmjs.com/package/@gui-chat-plugin/markdown)
4
+
5
+ Markdown document display plugin for GUI Chat applications. Create and display rich documents with markdown formatting and embedded images.
6
+
7
+ ## Features
8
+
9
+ - Markdown rendering with full syntax support
10
+ - Embedded image generation via placeholders
11
+ - Download markdown as file
12
+ - Edit markdown source inline
13
+ - Responsive document layout
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ yarn add @gui-chat-plugin/markdown
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### Vue Integration
24
+
25
+ ```typescript
26
+ // In src/tools/index.ts
27
+ import MarkdownPlugin from "@gui-chat-plugin/markdown/vue";
28
+
29
+ const pluginList = [
30
+ // ... other plugins
31
+ MarkdownPlugin,
32
+ ];
33
+
34
+ // In src/main.ts
35
+ import "@gui-chat-plugin/markdown/style.css";
36
+ ```
37
+
38
+ ### Core-only Usage
39
+
40
+ ```typescript
41
+ import { executeMarkdown, TOOL_DEFINITION } from "@gui-chat-plugin/markdown";
42
+
43
+ // Create a markdown document
44
+ const result = await executeMarkdown(context, {
45
+ title: "My Document",
46
+ markdown: "# Hello World\n\nThis is **bold** text.",
47
+ });
48
+ ```
49
+
50
+ ## API
51
+
52
+ ### MarkdownArgs
53
+
54
+ ```typescript
55
+ interface MarkdownArgs {
56
+ title: string; // Document title
57
+ markdown: string; // Markdown content
58
+ }
59
+ ```
60
+
61
+ ### MarkdownToolData
62
+
63
+ ```typescript
64
+ interface MarkdownToolData {
65
+ markdown: string;
66
+ pdfPath?: string; // Optional PDF path if generated
67
+ }
68
+ ```
69
+
70
+ ### Embedded Images
71
+
72
+ To include generated images in your markdown, use the placeholder syntax:
73
+
74
+ ```markdown
75
+ ![Detailed image prompt](__too_be_replaced_image_path__)
76
+ ```
77
+
78
+ The plugin will automatically generate images and replace placeholders with actual URLs.
79
+
80
+ ## Development
81
+
82
+ ```bash
83
+ # Install dependencies
84
+ yarn install
85
+
86
+ # Run demo
87
+ yarn dev
88
+
89
+ # Build
90
+ yarn build
91
+
92
+ # Lint
93
+ yarn lint
94
+ ```
95
+
96
+ ## Test Prompts
97
+
98
+ Try these prompts to test the plugin:
99
+
100
+ 1. "Create a markdown document explaining the basics of machine learning"
101
+ 2. "Write a getting started guide for Git in markdown format"
102
+ 3. "Generate a project documentation template in markdown"
103
+
104
+ ## License
105
+
106
+ MIT
@@ -0,0 +1,21 @@
1
+ export declare const TOOL_NAME = "presentDocument";
2
+ export declare const TOOL_DEFINITION: {
3
+ type: "function";
4
+ name: string;
5
+ description: string;
6
+ parameters: {
7
+ type: "object";
8
+ properties: {
9
+ title: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ markdown: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ };
18
+ required: string[];
19
+ };
20
+ };
21
+ //# sourceMappingURL=definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/core/definition.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,oBAAoB,CAAC;AAE3C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAmB3B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export type { MarkdownToolData, MarkdownArgs, MarkdownResult } from "./types";
2
+ export { TOOL_NAME, TOOL_DEFINITION } from "./definition";
3
+ export { pluginCore, presentDocument, executeMarkdown } from "./plugin";
4
+ export { samples } from "./samples";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ToolContext, ToolPluginCore } from "gui-chat-protocol";
2
+ import type { MarkdownArgs, MarkdownToolData, MarkdownResult } from "./types";
3
+ import { TOOL_NAME, TOOL_DEFINITION } from "./definition";
4
+ export declare const presentDocument: (context: ToolContext, args: MarkdownArgs) => Promise<MarkdownResult>;
5
+ export declare const pluginCore: ToolPluginCore<MarkdownToolData, unknown, MarkdownArgs>;
6
+ export { TOOL_NAME, TOOL_DEFINITION };
7
+ export declare const executeMarkdown: (context: ToolContext, args: MarkdownArgs) => Promise<MarkdownResult>;
8
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/core/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE1D,eAAO,MAAM,eAAe,GAC1B,SAAS,WAAW,EACpB,MAAM,YAAY,KACjB,OAAO,CAAC,cAAc,CAqFxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,CAQ9E,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;AACtC,eAAO,MAAM,eAAe,YApGjB,WAAW,QACd,YAAY,KACjB,OAAO,CAAC,cAAc,CAkGqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolSample } from "gui-chat-protocol";
2
+ export declare const samples: ToolSample[];
3
+ //# sourceMappingURL=samples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"samples.d.ts","sourceRoot":"","sources":["../../src/core/samples.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,OAAO,EAAE,UAAU,EAsC/B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ export interface MarkdownToolData {
3
+ markdown: string;
4
+ pdfPath?: string;
5
+ }
6
+ export interface MarkdownArgs {
7
+ title: string;
8
+ markdown: string;
9
+ }
10
+ export type MarkdownResult = ToolResult<MarkdownToolData>;
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC"}
package/dist/core.cjs ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k="presentDocument",b={type:"function",name:k,description:"Display a document in markdown format.",parameters:{type:"object",properties:{title:{type:"string",description:"Title for the document"},markdown:{type:"string",description:"The markdown content to display. Describe embedded images in the following format: ![Detailed image prompt](__too_be_replaced_image_path__). IMPORTANT: For embedded images, you MUST use the EXACT placeholder path '__too_be_replaced_image_path__'."}},required:["title","markdown"]}},d=async(e,c)=>{var p,u;let{markdown:a}=c;const{title:s}=c;if(!a||a.trim()==="")throw new Error("Markdown content is required but was not provided");const l=/!\[([^\]]+)\]\(\/?__too_be_replaced_image_path__\)/g,g=[...a.matchAll(l)];if(g.length>0&&((p=e.app)!=null&&p.generateImageWithBackend)&&((u=e.app)!=null&&u.saveImages)){const h=crypto.randomUUID(),r={},_=e.app.loadBlankImageBase64?await e.app.loadBlankImageBase64():"",I=g.map(async(o,i)=>{const n=`${o[1]}. Use the last image as the output dimension.`,m=`image_${i}`;try{const t=await e.app.generateImageWithBackend(n,_?[_]:[],e);t.success&&t.imageData&&(r[m]=`data:image/png;base64,${t.imageData}`)}catch(t){console.error(`Failed to generate image for prompt: ${n}`,t)}});if(await Promise.all(I),Object.keys(r).length>0)try{const o=await e.app.saveImages({uuid:h,images:r});if(o.imageUrls){const i=o.imageUrls;let n=0;a=a.replace(l,(m,t)=>{const y=`image_${n}`,w=i[y];return n++,w?`![${t}](${w})`:m})}}catch(o){console.error("Failed to save images:",o)}return{message:`Created markdown document: ${s}`,title:s,data:{markdown:a},uuid:h,instructions:"Acknowledge that the document has been created and is displayed to the user."}}return{message:`Created markdown document: ${s}`,title:s,data:{markdown:a},instructions:"Acknowledge that the document has been created and is displayed to the user."}},T={toolDefinition:b,execute:d,generatingMessage:"Creating document...",waitingMessage:"Tell the user that the document was created, will be presented to the user shortly.",isEnabled:()=>!0,backends:["imageGen"]},D=d,O=[{name:"Basic Markdown",args:{title:"Sample Document",markdown:`# Hello World
2
+
3
+ This is a **bold** text and this is *italic*.
4
+
5
+ ## Features
6
+ - Item 1
7
+ - Item 2
8
+ - Item 3
9
+
10
+ ### Code Example
11
+ \`\`\`javascript
12
+ const greeting = "Hello!";
13
+ console.log(greeting);
14
+ \`\`\`
15
+ `}},{name:"Table Example",args:{title:"Data Table",markdown:`# Product List
16
+
17
+ | Name | Price | Stock |
18
+ |------|-------|-------|
19
+ | Apple | $1.00 | 50 |
20
+ | Banana | $0.50 | 100 |
21
+ | Orange | $0.75 | 30 |
22
+
23
+ > Note: Prices are subject to change.
24
+ `}}];exports.TOOL_DEFINITION=b;exports.TOOL_NAME=k;exports.executeMarkdown=D;exports.pluginCore=T;exports.presentDocument=d;exports.samples=O;
package/dist/core.js ADDED
@@ -0,0 +1,121 @@
1
+ const I = "presentDocument", y = {
2
+ type: "function",
3
+ name: I,
4
+ description: "Display a document in markdown format.",
5
+ parameters: {
6
+ type: "object",
7
+ properties: {
8
+ title: {
9
+ type: "string",
10
+ description: "Title for the document"
11
+ },
12
+ markdown: {
13
+ type: "string",
14
+ description: "The markdown content to display. Describe embedded images in the following format: ![Detailed image prompt](__too_be_replaced_image_path__). IMPORTANT: For embedded images, you MUST use the EXACT placeholder path '__too_be_replaced_image_path__'."
15
+ }
16
+ },
17
+ required: ["title", "markdown"]
18
+ }
19
+ }, w = async (e, d) => {
20
+ var g, p;
21
+ let { markdown: a } = d;
22
+ const { title: s } = d;
23
+ if (!a || a.trim() === "")
24
+ throw new Error("Markdown content is required but was not provided");
25
+ const c = /!\[([^\]]+)\]\(\/?__too_be_replaced_image_path__\)/g, l = [...a.matchAll(c)];
26
+ if (l.length > 0 && ((g = e.app) != null && g.generateImageWithBackend) && ((p = e.app) != null && p.saveImages)) {
27
+ const u = crypto.randomUUID(), r = {}, h = e.app.loadBlankImageBase64 ? await e.app.loadBlankImageBase64() : "", k = l.map(async (o, i) => {
28
+ const n = `${o[1]}. Use the last image as the output dimension.`, m = `image_${i}`;
29
+ try {
30
+ const t = await e.app.generateImageWithBackend(
31
+ n,
32
+ h ? [h] : [],
33
+ e
34
+ );
35
+ t.success && t.imageData && (r[m] = `data:image/png;base64,${t.imageData}`);
36
+ } catch (t) {
37
+ console.error(`Failed to generate image for prompt: ${n}`, t);
38
+ }
39
+ });
40
+ if (await Promise.all(k), Object.keys(r).length > 0)
41
+ try {
42
+ const o = await e.app.saveImages({ uuid: u, images: r });
43
+ if (o.imageUrls) {
44
+ const i = o.imageUrls;
45
+ let n = 0;
46
+ a = a.replace(c, (m, t) => {
47
+ const b = `image_${n}`, _ = i[b];
48
+ return n++, _ ? `![${t}](${_})` : m;
49
+ });
50
+ }
51
+ } catch (o) {
52
+ console.error("Failed to save images:", o);
53
+ }
54
+ return {
55
+ message: `Created markdown document: ${s}`,
56
+ title: s,
57
+ data: { markdown: a },
58
+ uuid: u,
59
+ instructions: "Acknowledge that the document has been created and is displayed to the user."
60
+ };
61
+ }
62
+ return {
63
+ message: `Created markdown document: ${s}`,
64
+ title: s,
65
+ data: { markdown: a },
66
+ instructions: "Acknowledge that the document has been created and is displayed to the user."
67
+ };
68
+ }, T = {
69
+ toolDefinition: y,
70
+ execute: w,
71
+ generatingMessage: "Creating document...",
72
+ waitingMessage: "Tell the user that the document was created, will be presented to the user shortly.",
73
+ isEnabled: () => !0,
74
+ backends: ["imageGen"]
75
+ }, f = w, D = [
76
+ {
77
+ name: "Basic Markdown",
78
+ args: {
79
+ title: "Sample Document",
80
+ markdown: `# Hello World
81
+
82
+ This is a **bold** text and this is *italic*.
83
+
84
+ ## Features
85
+ - Item 1
86
+ - Item 2
87
+ - Item 3
88
+
89
+ ### Code Example
90
+ \`\`\`javascript
91
+ const greeting = "Hello!";
92
+ console.log(greeting);
93
+ \`\`\`
94
+ `
95
+ }
96
+ },
97
+ {
98
+ name: "Table Example",
99
+ args: {
100
+ title: "Data Table",
101
+ markdown: `# Product List
102
+
103
+ | Name | Price | Stock |
104
+ |------|-------|-------|
105
+ | Apple | $1.00 | 50 |
106
+ | Banana | $0.50 | 100 |
107
+ | Orange | $0.75 | 30 |
108
+
109
+ > Note: Prices are subject to change.
110
+ `
111
+ }
112
+ }
113
+ ];
114
+ export {
115
+ y as TOOL_DEFINITION,
116
+ I as TOOL_NAME,
117
+ f as executeMarkdown,
118
+ T as pluginCore,
119
+ w as presentDocument,
120
+ D as samples
121
+ };
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./core.cjs");exports.TOOL_DEFINITION=e.TOOL_DEFINITION;exports.TOOL_NAME=e.TOOL_NAME;exports.executeMarkdown=e.executeMarkdown;exports.pluginCore=e.pluginCore;exports.presentDocument=e.presentDocument;exports.samples=e.samples;
@@ -0,0 +1,2 @@
1
+ export * from "./core/index";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ import { TOOL_DEFINITION as r, TOOL_NAME as O, executeMarkdown as n, pluginCore as p, presentDocument as t, samples as m } from "./core.js";
2
+ export {
3
+ r as TOOL_DEFINITION,
4
+ O as TOOL_NAME,
5
+ n as executeMarkdown,
6
+ p as pluginCore,
7
+ t as presentDocument,
8
+ m as samples
9
+ };
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ /*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-600:oklch(57.7% .245 27.325);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-800:oklch(43.2% .095 166.913);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-600:oklch(55.8% .288 302.321);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-800:oklch(27.8% .033 256.848);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-medium:500;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.m-0{margin:calc(var(--spacing)*0)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.block{display:block}.flex{display:flex}.inline{display:inline}.min-h-full{min-height:100%}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.max-w-none{max-width:none}.flex-shrink{flex-shrink:1}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-y{resize:vertical}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-x-auto{overflow-x:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-emerald-200{border-color:var(--color-emerald-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-white{background-color:var(--color-white)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-8{padding:calc(var(--spacing)*8)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.whitespace-pre-wrap{white-space:pre-wrap}.text-emerald-800{color:var(--color-emerald-800)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-800{color:var(--color-gray-800)}.text-indigo-700{color:var(--color-indigo-700)}.text-purple-600{color:var(--color-purple-600)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){.hover\:border-indigo-300:hover{border-color:var(--color-indigo-300)}.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-\[3px\]:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500\/10:focus{--tw-ring-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.focus\:ring-indigo-500\/10:focus{--tw-ring-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}.markdown-container[data-v-7bea9557]{width:100%;height:100%;display:flex;flex-direction:column;background:#fff}.markdown-content-wrapper[data-v-7bea9557]{flex:1;overflow-y:auto;min-height:0}.header-row[data-v-7bea9557]{display:flex;align-items:center;justify-content:space-between;margin-bottom:1em}.document-title[data-v-7bea9557]{font-size:2em;margin:0}.button-group[data-v-7bea9557]{display:flex;gap:.5em}.download-btn[data-v-7bea9557]{padding:.5em 1em;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:.9em;display:flex;align-items:center;gap:.5em}.download-btn-green[data-v-7bea9557]{background-color:#4caf50}.download-btn .material-icons[data-v-7bea9557]{font-size:1.2em}.markdown-content[data-v-7bea9557] h1{font-size:2rem;font-weight:700;margin-top:1em;margin-bottom:.5em}.markdown-content[data-v-7bea9557] h2{font-size:1.75rem;font-weight:700;margin-top:1em;margin-bottom:.5em}.markdown-content[data-v-7bea9557] h3{font-size:1.5rem;font-weight:700;margin-top:1em;margin-bottom:.5em}.markdown-content[data-v-7bea9557] h4{font-size:1.25rem;font-weight:700;margin-top:1em;margin-bottom:.5em}.markdown-content[data-v-7bea9557] h5{font-size:1.125rem;font-weight:700;margin-top:1em;margin-bottom:.5em}.markdown-content[data-v-7bea9557] h6{font-size:1rem;font-weight:700;margin-top:1em;margin-bottom:.5em}.markdown-source[data-v-7bea9557]{padding:.5rem;background:#f5f5f5;border-top:1px solid #e0e0e0;font-family:monospace;font-size:.85rem;flex-shrink:0}.markdown-source summary[data-v-7bea9557]{cursor:pointer;-webkit-user-select:none;user-select:none;padding:.5rem;background:#e8e8e8;border-radius:4px;font-weight:500;color:#333}.markdown-source[open] summary[data-v-7bea9557]{margin-bottom:.5rem}.markdown-source summary[data-v-7bea9557]:hover{background:#d8d8d8}.markdown-editor[data-v-7bea9557]{width:100%;height:40vh;padding:1rem;background:#fff;border:1px solid #ccc;border-radius:4px;color:#333;font-family:Courier New,monospace;font-size:.9rem;resize:vertical;margin-bottom:.5rem;line-height:1.5}.markdown-editor[data-v-7bea9557]:focus{outline:none;border-color:#4caf50;box-shadow:0 0 0 2px #4caf501a}.apply-btn[data-v-7bea9557]{padding:.5rem 1rem;background:#4caf50;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:.9rem;transition:background .2s;font-weight:500}.apply-btn[data-v-7bea9557]:hover{background:#45a049}.apply-btn[data-v-7bea9557]:active{background:#3d8b40}.apply-btn[data-v-7bea9557]:disabled{background:#ccc;color:#666;cursor:not-allowed;opacity:.6}.apply-btn[data-v-7bea9557]:disabled:hover{background:#ccc}
@@ -0,0 +1,8 @@
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ import type { MarkdownToolData } from "../core/types";
3
+ type __VLS_Props = {
4
+ result: ToolResult<MarkdownToolData>;
5
+ };
6
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ export default _default;
8
+ //# sourceMappingURL=Preview.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Preview.vue.d.ts","sourceRoot":"","sources":["../../src/vue/Preview.vue"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;CACtC,CAAC;;AAqEF,wBAMG"}
@@ -0,0 +1,12 @@
1
+ import type { ToolResult } from "gui-chat-protocol";
2
+ import type { MarkdownToolData } from "../core/types";
3
+ type __VLS_Props = {
4
+ selectedResult: ToolResult<MarkdownToolData>;
5
+ };
6
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ updateResult: (result: ToolResult<MarkdownToolData, unknown>) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onUpdateResult?: ((result: ToolResult<MarkdownToolData, unknown>) => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ export default _default;
12
+ //# sourceMappingURL=View.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"View.vue.d.ts","sourceRoot":"","sources":["../../src/vue/View.vue"],"names":[],"mappings":"AA2TA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;CAC9C,CAAC;;;;;;AA8NF,wBAOG"}
@@ -0,0 +1,17 @@
1
+ import "../style.css";
2
+ import type { ToolPlugin } from "gui-chat-protocol/vue";
3
+ import type { MarkdownToolData, MarkdownArgs } from "../core/types";
4
+ import View from "./View.vue";
5
+ import Preview from "./Preview.vue";
6
+ export declare const TOOL_NAME = "presentDocument";
7
+ export declare const SYSTEM_PROMPT = "Use the presentDocument tool to create structured documents with text and embedded images. This tool is ideal for:\n- Guides, tutorials, and how-to content (\"create a guide about...\", \"explain how to...\")\n- Educational content (lessons, explanations, timelines, concept visualizations)\n- Reports and presentations (business reports, data analysis, infographics)\n- Articles and blog posts with illustrations\n- Documentation with diagrams or screenshots\n- Recipes with step-by-step photos\n- Travel guides with location images\n- Product presentations or lookbooks\n- Any content that combines written information with supporting visuals\n\nIMPORTANT: Use this tool instead of just generating standalone images when the user wants informational or educational content with visuals. This creates a cohesive document with formatted text (markdown) AND images embedded at appropriate locations. For example, if asked to \"create a guide about photosynthesis with a diagram\", use presentDocument to create a full guide with explanatory text and the diagram embedded, rather than just generating the diagram image alone.\n\nFormat embedded images as: ![Detailed image prompt](__too_be_replaced_image_path__)";
8
+ export declare const plugin: ToolPlugin<MarkdownToolData, unknown, MarkdownArgs>;
9
+ export type { MarkdownToolData, MarkdownArgs, MarkdownResult } from "../core/types";
10
+ export { TOOL_DEFINITION, executeMarkdown, pluginCore, } from "../core/plugin";
11
+ export { samples } from "../core/samples";
12
+ export { View, Preview };
13
+ declare const _default: {
14
+ plugin: ToolPlugin<MarkdownToolData, unknown, MarkdownArgs, import("gui-chat-protocol/vue").InputHandler, Record<string, unknown>>;
15
+ };
16
+ export default _default;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGpE,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,OAAO,MAAM,eAAe,CAAC;AAEpC,eAAO,MAAM,SAAS,oBAAoB,CAAC;AAE3C,eAAO,MAAM,aAAa,+rCAa0D,CAAC;AAErF,eAAO,MAAM,MAAM,EAAE,UAAU,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,CAMtE,CAAC;AAEF,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpF,OAAO,EACL,eAAe,EACf,eAAe,EACf,UAAU,GACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;;;AAEzB,wBAA0B"}
package/dist/vue.cjs ADDED
@@ -0,0 +1,69 @@
1
+ "use strict";var _e=Object.defineProperty;var Te=(n,e,t)=>e in n?_e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var m=(n,e,t)=>Te(n,typeof e!="symbol"?e+"":e,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const _=require("./core.cjs"),d=require("vue");function Q(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var $=Q();function pe(n){$=n}var E={exec:()=>null};function f(n,e=""){let t=typeof n=="string"?n:n.source;const r={replace:(s,i)=>{let c=typeof i=="string"?i:i.source;return c=c.replace(w.caret,"$1"),t=t.replace(s,c),r},getRegex:()=>new RegExp(t,e)};return r}var w={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i")},ze=/^(?:[ \t]*(?:\n|$))+/,Ae=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ee=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,C=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ce=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,U=/(?:[*+-]|\d{1,9}[.)])/,he=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ue=f(he).replace(/bull/g,U).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Le=f(he).replace(/bull/g,U).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),F=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Pe=/^[^\n]+/,X=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ie=f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",X).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Be=f(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,U).getRegex(),M="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",W=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ne=f("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",W).replace("tag",M).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),de=f(F).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",M).getRegex(),Me=f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",de).getRegex(),Y={blockquote:Me,code:Ae,def:Ie,fences:Ee,heading:Ce,hr:C,html:Ne,lheading:ue,list:Be,newline:ze,paragraph:de,table:E,text:Pe},ie=f("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",M).getRegex(),qe={...Y,lheading:Le,table:ie,paragraph:f(F).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ie).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",M).getRegex()},De={...Y,html:f(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",W).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:E,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(F).replace("hr",C).replace("heading",` *#{1,6} *[^
2
+ ]`).replace("lheading",ue).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Oe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ze=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ge=/^( {2,}|\\)\n(?!\s*$)/,Ve=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,q=/[\p{P}\p{S}]/u,J=/[\s\p{P}\p{S}]/u,fe=/[^\s\p{P}\p{S}]/u,je=f(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,J).getRegex(),ke=/(?!~)[\p{P}\p{S}]/u,Ge=/(?!~)[\s\p{P}\p{S}]/u,He=/(?:[^\s\p{P}\p{S}]|~)/u,Qe=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,me=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Ue=f(me,"u").replace(/punct/g,q).getRegex(),Fe=f(me,"u").replace(/punct/g,ke).getRegex(),be="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Xe=f(be,"gu").replace(/notPunctSpace/g,fe).replace(/punctSpace/g,J).replace(/punct/g,q).getRegex(),We=f(be,"gu").replace(/notPunctSpace/g,He).replace(/punctSpace/g,Ge).replace(/punct/g,ke).getRegex(),Ye=f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,fe).replace(/punctSpace/g,J).replace(/punct/g,q).getRegex(),Je=f(/\\(punct)/,"gu").replace(/punct/g,q).getRegex(),Ke=f(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[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])?)+(?![-_])/).getRegex(),et=f(W).replace("(?:-->|$)","-->").getRegex(),tt=f("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",et).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),I=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,nt=f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",I).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xe=f(/^!?\[(label)\]\[(ref)\]/).replace("label",I).replace("ref",X).getRegex(),we=f(/^!?\[(ref)\](?:\[\])?/).replace("ref",X).getRegex(),rt=f("reflink|nolink(?!\\()","g").replace("reflink",xe).replace("nolink",we).getRegex(),K={_backpedal:E,anyPunctuation:Je,autolink:Ke,blockSkip:Qe,br:ge,code:Ze,del:E,emStrongLDelim:Ue,emStrongRDelimAst:Xe,emStrongRDelimUnd:Ye,escape:Oe,link:nt,nolink:we,punctuation:je,reflink:xe,reflinkSearch:rt,tag:tt,text:Ve,url:E},st={...K,link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",I).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",I).getRegex()},V={...K,emStrongRDelimAst:We,emStrongLDelim:Fe,url:f(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},it={...V,br:f(ge).replace("{2,}","*").getRegex(),text:f(V.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},L={normal:Y,gfm:qe,pedantic:De},z={normal:K,gfm:V,breaks:it,pedantic:st},lt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},le=n=>lt[n];function y(n,e){if(e){if(w.escapeTest.test(n))return n.replace(w.escapeReplace,le)}else if(w.escapeTestNoEncode.test(n))return n.replace(w.escapeReplaceNoEncode,le);return n}function ae(n){try{n=encodeURI(n).replace(w.percentDecode,"%")}catch{return null}return n}function oe(n,e){var i;const t=n.replace(w.findPipe,(c,l,p)=>{let a=!1,o=l;for(;--o>=0&&p[o]==="\\";)a=!a;return a?"|":" |"}),r=t.split(w.splitPipe);let s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(w.slashPipe,"|");return r}function A(n,e,t){const r=n.length;if(r===0)return"";let s=0;for(;s<r&&n.charAt(r-s-1)===e;)s++;return n.slice(0,r-s)}function at(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])t++;else if(n[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function ce(n,e,t,r,s){const i=e.href,c=e.title||null,l=n[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;const p={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:c,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,p}function ot(n,e,t){const r=n.match(t.other.indentCodeCompensation);if(r===null)return e;const s=r[1];return e.split(`
3
+ `).map(i=>{const c=i.match(t.other.beginningSpace);if(c===null)return i;const[l]=c;return l.length>=s.length?i.slice(s.length):i}).join(`
4
+ `)}var B=class{constructor(n){m(this,"options");m(this,"rules");m(this,"lexer");this.options=n||$}space(n){const e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){const e=this.rules.block.code.exec(n);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:A(t,`
5
+ `)}}}fences(n){const e=this.rules.block.fences.exec(n);if(e){const t=e[0],r=ot(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(n){const e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){const r=A(t,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(t=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){const e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:A(e[0],`
6
+ `)}}blockquote(n){const e=this.rules.block.blockquote.exec(n);if(e){let t=A(e[0],`
7
+ `).split(`
8
+ `),r="",s="";const i=[];for(;t.length>0;){let c=!1;const l=[];let p;for(p=0;p<t.length;p++)if(this.rules.other.blockquoteStart.test(t[p]))l.push(t[p]),c=!0;else if(!c)l.push(t[p]);else break;t=t.slice(p);const a=l.join(`
9
+ `),o=a.replace(this.rules.other.blockquoteSetextReplace,`
10
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
11
+ ${a}`:a,s=s?`${s}
12
+ ${o}`:o;const u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(o,i,!0),this.lexer.state.top=u,t.length===0)break;const h=i.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){const b=h,g=b.raw+`
13
+ `+t.join(`
14
+ `),x=this.blockquote(g);i[i.length-1]=x,r=r.substring(0,r.length-b.raw.length)+x.raw,s=s.substring(0,s.length-b.text.length)+x.text;break}else if((h==null?void 0:h.type)==="list"){const b=h,g=b.raw+`
15
+ `+t.join(`
16
+ `),x=this.list(g);i[i.length-1]=x,r=r.substring(0,r.length-h.raw.length)+x.raw,s=s.substring(0,s.length-b.raw.length)+x.raw,t=g.substring(i.at(-1).raw.length).split(`
17
+ `);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim();const r=t.length>1,s={type:"list",raw:"",ordered:r,start:r?+t.slice(0,-1):"",loose:!1,items:[]};t=r?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=r?t:"[*+-]");const i=this.rules.other.listItemRegex(t);let c=!1;for(;n;){let p=!1,a="",o="";if(!(e=i.exec(n))||this.rules.block.hr.test(n))break;a=e[0],n=n.substring(a.length);let u=e[2].split(`
18
+ `,1)[0].replace(this.rules.other.listReplaceTabs,D=>" ".repeat(3*D.length)),h=n.split(`
19
+ `,1)[0],b=!u.trim(),g=0;if(this.options.pedantic?(g=2,o=u.trimStart()):b?g=e[1].length+1:(g=e[2].search(this.rules.other.nonSpaceChar),g=g>4?1:g,o=u.slice(g),g+=e[1].length),b&&this.rules.other.blankLine.test(h)&&(a+=h+`
20
+ `,n=n.substring(h.length+1),p=!0),!p){const D=this.rules.other.nextBulletRegex(g),ne=this.rules.other.hrRegex(g),re=this.rules.other.fencesBeginRegex(g),se=this.rules.other.headingBeginRegex(g),$e=this.rules.other.htmlBeginRegex(g);for(;n;){const O=n.split(`
21
+ `,1)[0];let T;if(h=O,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),T=h):T=h.replace(this.rules.other.tabCharGlobal," "),re.test(h)||se.test(h)||$e.test(h)||D.test(h)||ne.test(h))break;if(T.search(this.rules.other.nonSpaceChar)>=g||!h.trim())o+=`
22
+ `+T.slice(g);else{if(b||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||re.test(u)||se.test(u)||ne.test(u))break;o+=`
23
+ `+h}!b&&!h.trim()&&(b=!0),a+=O+`
24
+ `,n=n.substring(O.length+1),u=T.slice(g)}}s.loose||(c?s.loose=!0:this.rules.other.doubleBlankLine.test(a)&&(c=!0));let x=null,te;this.options.gfm&&(x=this.rules.other.listIsTask.exec(o),x&&(te=x[0]!=="[ ] ",o=o.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:a,task:!!x,checked:te,loose:!1,text:o,tokens:[]}),s.raw+=a}const l=s.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let p=0;p<s.items.length;p++)if(this.lexer.state.top=!1,s.items[p].tokens=this.lexer.blockTokens(s.items[p].text,[]),!s.loose){const a=s.items[p].tokens.filter(u=>u.type==="space"),o=a.length>0&&a.some(u=>this.rules.other.anyLine.test(u.raw));s.loose=o}if(s.loose)for(let p=0;p<s.items.length;p++)s.items[p].loose=!0;return s}}html(n){const e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){const e=this.rules.block.def.exec(n);if(e){const t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:s}}}table(n){var c;const e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const t=oe(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(c=e[3])!=null&&c.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
25
+ `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(const l of r)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<t.length;l++)i.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:i.align[l]});for(const l of s)i.rows.push(oe(l,i.header.length).map((p,a)=>({text:p,tokens:this.lexer.inline(p),header:!1,align:i.align[a]})));return i}}lheading(n){const e=this.rules.block.lheading.exec(n);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(n){const e=this.rules.block.paragraph.exec(n);if(e){const t=e[1].charAt(e[1].length-1)===`
26
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){const e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){const e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){const e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){const e=this.rules.inline.link.exec(n);if(e){const t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;const i=A(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{const i=at(e[2],"()");if(i===-2)return;if(i>-1){const l=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),ce(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){const r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){const i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return ce(t,s,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!r||r[3]&&t.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!t||this.rules.inline.punctuation.exec(t)){const i=[...r[0]].length-1;let c,l,p=i,a=0;const o=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(o.lastIndex=0,e=e.slice(-1*n.length+i);(r=o.exec(e))!=null;){if(c=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!c)continue;if(l=[...c].length,r[3]||r[4]){p+=l;continue}else if((r[5]||r[6])&&i%3&&!((i+l)%3)){a+=l;continue}if(p-=l,p>0)continue;l=Math.min(l,l+p+a);const u=[...r[0]][0].length,h=n.slice(0,i+r.index+u+l);if(Math.min(i,l)%2){const g=h.slice(1,-1);return{type:"em",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}const b=h.slice(2,-2);return{type:"strong",raw:h,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(n){const e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){const e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n){const e=this.rules.inline.del.exec(n);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){const e=this.rules.inline.autolink.exec(n);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let i;do i=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(i!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){const e=this.rules.inline.text.exec(n);if(e){const t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},v=class j{constructor(e){m(this,"tokens");m(this,"options");m(this,"state");m(this,"tokenizer");m(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||$,this.options.tokenizer=this.options.tokenizer||new B,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:w,block:L.normal,inline:z.normal};this.options.pedantic?(t.block=L.pedantic,t.inline=z.pedantic):this.options.gfm&&(t.block=L.gfm,this.options.breaks?t.inline=z.breaks:t.inline=z.gfm),this.tokenizer.rules=t}static get rules(){return{block:L,inline:z}}static lex(e,t){return new j(t).lex(e)}static lexInline(e,t){return new j(t).inlineTokens(e)}lex(e){e=e.replace(w.carriageReturn,`
27
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){var s,i,c;for(this.options.pedantic&&(e=e.replace(w.tabCharGlobal," ").replace(w.spaceLine,""));e;){let l;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(a=>(l=a.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.space(e)){e=e.substring(l.raw.length);const a=t.at(-1);l.raw.length===1&&a!==void 0?a.raw+=`
28
+ `:t.push(l);continue}if(l=this.tokenizer.code(e)){e=e.substring(l.raw.length);const a=t.at(-1);(a==null?void 0:a.type)==="paragraph"||(a==null?void 0:a.type)==="text"?(a.raw+=`
29
+ `+l.raw,a.text+=`
30
+ `+l.text,this.inlineQueue.at(-1).src=a.text):t.push(l);continue}if(l=this.tokenizer.fences(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.heading(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.hr(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.blockquote(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.list(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.html(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.def(e)){e=e.substring(l.raw.length);const a=t.at(-1);(a==null?void 0:a.type)==="paragraph"||(a==null?void 0:a.type)==="text"?(a.raw+=`
31
+ `+l.raw,a.text+=`
32
+ `+l.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title});continue}if(l=this.tokenizer.table(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.lheading(e)){e=e.substring(l.raw.length),t.push(l);continue}let p=e;if((c=this.options.extensions)!=null&&c.startBlock){let a=1/0;const o=e.slice(1);let u;this.options.extensions.startBlock.forEach(h=>{u=h.call({lexer:this},o),typeof u=="number"&&u>=0&&(a=Math.min(a,u))}),a<1/0&&a>=0&&(p=e.substring(0,a+1))}if(this.state.top&&(l=this.tokenizer.paragraph(p))){const a=t.at(-1);r&&(a==null?void 0:a.type)==="paragraph"?(a.raw+=`
33
+ `+l.raw,a.text+=`
34
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(l),r=p.length!==e.length,e=e.substring(l.raw.length);continue}if(l=this.tokenizer.text(e)){e=e.substring(l.raw.length);const a=t.at(-1);(a==null?void 0:a.type)==="text"?(a.raw+=`
35
+ `+l.raw,a.text+=`
36
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(l);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var l,p,a;let r=e,s=null;if(this.tokens.links){const o=Object.keys(this.tokens.links);if(o.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)o.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,c="";for(;e;){i||(c=""),i=!1;let o;if((p=(l=this.options.extensions)==null?void 0:l.inline)!=null&&p.some(h=>(o=h.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);const h=t.at(-1);o.type==="text"&&(h==null?void 0:h.type)==="text"?(h.raw+=o.raw,h.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,r,c)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let u=e;if((a=this.options.extensions)!=null&&a.startInline){let h=1/0;const b=e.slice(1);let g;this.options.extensions.startInline.forEach(x=>{g=x.call({lexer:this},b),typeof g=="number"&&g>=0&&(h=Math.min(h,g))}),h<1/0&&h>=0&&(u=e.substring(0,h+1))}if(o=this.tokenizer.inlineText(u)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(c=o.raw.slice(-1)),i=!0;const h=t.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=o.raw,h.text+=o.text):t.push(o);continue}if(e){const h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return t}},N=class{constructor(n){m(this,"options");m(this,"parser");this.options=n||$}space(n){return""}code({text:n,lang:e,escaped:t}){var i;const r=(i=(e||"").match(w.notSpaceStart))==null?void 0:i[0],s=n.replace(w.endingNewline,"")+`
37
+ `;return r?'<pre><code class="language-'+y(r)+'">'+(t?s:y(s,!0))+`</code></pre>
38
+ `:"<pre><code>"+(t?s:y(s,!0))+`</code></pre>
39
+ `}blockquote({tokens:n}){return`<blockquote>
40
+ ${this.parser.parse(n)}</blockquote>
41
+ `}html({text:n}){return n}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
42
+ `}hr(n){return`<hr>
43
+ `}list(n){const e=n.ordered,t=n.start;let r="";for(let c=0;c<n.items.length;c++){const l=n.items[c];r+=this.listitem(l)}const s=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+s+i+`>
44
+ `+r+"</"+s+`>
45
+ `}listitem(n){var t;let e="";if(n.task){const r=this.checkbox({checked:!!n.checked});n.loose?((t=n.tokens[0])==null?void 0:t.type)==="paragraph"?(n.tokens[0].text=r+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&n.tokens[0].tokens[0].type==="text"&&(n.tokens[0].tokens[0].text=r+" "+y(n.tokens[0].tokens[0].text),n.tokens[0].tokens[0].escaped=!0)):n.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):e+=r+" "}return e+=this.parser.parse(n.tokens,!!n.loose),`<li>${e}</li>
46
+ `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
47
+ `}table(n){let e="",t="";for(let s=0;s<n.header.length;s++)t+=this.tablecell(n.header[s]);e+=this.tablerow({text:t});let r="";for(let s=0;s<n.rows.length;s++){const i=n.rows[s];t="";for(let c=0;c<i.length;c++)t+=this.tablecell(i[c]);r+=this.tablerow({text:t})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
48
+ <thead>
49
+ `+e+`</thead>
50
+ `+r+`</table>
51
+ `}tablerow({text:n}){return`<tr>
52
+ ${n}</tr>
53
+ `}tablecell(n){const e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
54
+ `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${y(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){const r=this.parser.parseInline(t),s=ae(n);if(s===null)return r;n=s;let i='<a href="'+n+'"';return e&&(i+=' title="'+y(e)+'"'),i+=">"+r+"</a>",i}image({href:n,title:e,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));const s=ae(n);if(s===null)return y(t);n=s;let i=`<img src="${n}" alt="${t}"`;return e&&(i+=` title="${y(e)}"`),i+=">",i}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:y(n.text)}},ee=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}},R=class G{constructor(e){m(this,"options");m(this,"renderer");m(this,"textRenderer");this.options=e||$,this.options.renderer=this.options.renderer||new N,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ee}static parse(e,t){return new G(t).parse(e)}static parseInline(e,t){return new G(t).parseInline(e)}parse(e,t=!0){var s,i;let r="";for(let c=0;c<e.length;c++){const l=e[c];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[l.type]){const a=l,o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){r+=o||"";continue}}const p=l;switch(p.type){case"space":{r+=this.renderer.space(p);continue}case"hr":{r+=this.renderer.hr(p);continue}case"heading":{r+=this.renderer.heading(p);continue}case"code":{r+=this.renderer.code(p);continue}case"table":{r+=this.renderer.table(p);continue}case"blockquote":{r+=this.renderer.blockquote(p);continue}case"list":{r+=this.renderer.list(p);continue}case"html":{r+=this.renderer.html(p);continue}case"paragraph":{r+=this.renderer.paragraph(p);continue}case"text":{let a=p,o=this.renderer.text(a);for(;c+1<e.length&&e[c+1].type==="text";)a=e[++c],o+=`
55
+ `+this.renderer.text(a);t?r+=this.renderer.paragraph({type:"paragraph",raw:o,text:o,tokens:[{type:"text",raw:o,text:o,escaped:!0}]}):r+=o;continue}default:{const a='Token with "'+p.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,t=this.renderer){var s,i;let r="";for(let c=0;c<e.length;c++){const l=e[c];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[l.type]){const a=this.options.extensions.renderers[l.type].call({parser:this},l);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=a||"";continue}}const p=l;switch(p.type){case"escape":{r+=t.text(p);break}case"html":{r+=t.html(p);break}case"link":{r+=t.link(p);break}case"image":{r+=t.image(p);break}case"strong":{r+=t.strong(p);break}case"em":{r+=t.em(p);break}case"codespan":{r+=t.codespan(p);break}case"br":{r+=t.br(p);break}case"del":{r+=t.del(p);break}case"text":{r+=t.text(p);break}default:{const a='Token with "'+p.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Z,P=(Z=class{constructor(n){m(this,"options");m(this,"block");this.options=n||$}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}provideLexer(){return this.block?v.lex:v.lexInline}provideParser(){return this.block?R.parse:R.parseInline}},m(Z,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Z),ct=class{constructor(...n){m(this,"defaults",Q());m(this,"options",this.setOptions);m(this,"parse",this.parseMarkdown(!0));m(this,"parseInline",this.parseMarkdown(!1));m(this,"Parser",R);m(this,"Renderer",N);m(this,"TextRenderer",ee);m(this,"Lexer",v);m(this,"Tokenizer",B);m(this,"Hooks",P);this.use(...n)}walkTokens(n,e){var r,s;let t=[];for(const i of n)switch(t=t.concat(e.call(this,i)),i.type){case"table":{const c=i;for(const l of c.header)t=t.concat(this.walkTokens(l.tokens,e));for(const l of c.rows)for(const p of l)t=t.concat(this.walkTokens(p.tokens,e));break}case"list":{const c=i;t=t.concat(this.walkTokens(c.items,e));break}default:{const c=i;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[c.type]?this.defaults.extensions.childTokens[c.type].forEach(l=>{const p=c[l].flat(1/0);t=t.concat(this.walkTokens(p,e))}):c.tokens&&(t=t.concat(this.walkTokens(c.tokens,e)))}}return t}use(...n){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{const r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const i=e.renderers[s.name];i?e.renderers[s.name]=function(...c){let l=s.renderer.apply(this,c);return l===!1&&(l=i.apply(this,c)),l}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),t.renderer){const s=this.defaults.renderer||new N(this.defaults);for(const i in t.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const c=i,l=t.renderer[c],p=s[c];s[c]=(...a)=>{let o=l.apply(s,a);return o===!1&&(o=p.apply(s,a)),o||""}}r.renderer=s}if(t.tokenizer){const s=this.defaults.tokenizer||new B(this.defaults);for(const i in t.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const c=i,l=t.tokenizer[c],p=s[c];s[c]=(...a)=>{let o=l.apply(s,a);return o===!1&&(o=p.apply(s,a)),o}}r.tokenizer=s}if(t.hooks){const s=this.defaults.hooks||new P;for(const i in t.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const c=i,l=t.hooks[c],p=s[c];P.passThroughHooks.has(i)?s[c]=a=>{if(this.defaults.async)return Promise.resolve(l.call(s,a)).then(u=>p.call(s,u));const o=l.call(s,a);return p.call(s,o)}:s[c]=(...a)=>{let o=l.apply(s,a);return o===!1&&(o=p.apply(s,a)),o}}r.hooks=s}if(t.walkTokens){const s=this.defaults.walkTokens,i=t.walkTokens;r.walkTokens=function(c){let l=[];return l.push(i.call(this,c)),s&&(l=l.concat(s.call(this,c))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return v.lex(n,e??this.defaults)}parser(n,e){return R.parse(n,e??this.defaults)}parseMarkdown(n){return(t,r)=>{const s={...r},i={...this.defaults,...s},c=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return c(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=n);const l=i.hooks?i.hooks.provideLexer():n?v.lex:v.lexInline,p=i.hooks?i.hooks.provideParser():n?R.parse:R.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(a=>l(a,i)).then(a=>i.hooks?i.hooks.processAllTokens(a):a).then(a=>i.walkTokens?Promise.all(this.walkTokens(a,i.walkTokens)).then(()=>a):a).then(a=>p(a,i)).then(a=>i.hooks?i.hooks.postprocess(a):a).catch(c);try{i.hooks&&(t=i.hooks.preprocess(t));let a=l(t,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let o=p(a,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(a){return c(a)}}}onError(n,e){return t=>{if(t.message+=`
56
+ Please report this to https://github.com/markedjs/marked.`,n){const r="<p>An error occurred:</p><pre>"+y(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},S=new ct;function k(n,e){return S.parse(n,e)}k.options=k.setOptions=function(n){return S.setOptions(n),k.defaults=S.defaults,pe(k.defaults),k};k.getDefaults=Q;k.defaults=$;k.use=function(...n){return S.use(...n),k.defaults=S.defaults,pe(k.defaults),k};k.walkTokens=function(n,e){return S.walkTokens(n,e)};k.parseInline=S.parseInline;k.Parser=R;k.parser=R.parse;k.Renderer=N;k.TextRenderer=ee;k.Lexer=v;k.lexer=v.lex;k.Tokenizer=B;k.Hooks=P;k.parse=k;k.options;k.setOptions;k.use;k.walkTokens;k.parseInline;R.parse;v.lex;const pt={class:"markdown-container"},ht={key:0,class:"min-h-full p-8 flex items-center justify-center"},ut={class:"markdown-content-wrapper"},dt={class:"p-4"},gt={class:"header-row"},ft={class:"document-title"},kt=["innerHTML"],mt={class:"markdown-source"},bt=["disabled"],xt=d.defineComponent({__name:"View",props:{selectedResult:{}},emits:["updateResult"],setup(n,{emit:e}){var a;const t=n,r=e,s=d.ref(((a=t.selectedResult.data)==null?void 0:a.markdown)||""),i=d.computed(()=>{var o;return s.value!==((o=t.selectedResult.data)==null?void 0:o.markdown)}),c=d.computed(()=>{var o;return(o=t.selectedResult.data)!=null&&o.markdown?k(t.selectedResult.data.markdown):(console.error("No markdown data in result:",t.selectedResult),"")});d.watch(()=>{var o,u;return(u=(o=t.selectedResult)==null?void 0:o.viewState)==null?void 0:u.scrollToAnchor},o=>{o&&d.nextTick(()=>{const u=document.getElementById(o);u?u.scrollIntoView({behavior:"smooth",block:"start"}):console.warn(`Anchor element with id "${o}" not found`)})});const l=()=>{var g,x;if(!((x=(g=t.selectedResult)==null?void 0:g.data)!=null&&x.markdown))return;const o=new Blob([t.selectedResult.data.markdown],{type:"text/markdown"}),u=URL.createObjectURL(o),h=document.createElement("a");h.href=u;const b=t.selectedResult.title?`${t.selectedResult.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`:"document.md";h.download=b,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(u)};function p(){const o={...t.selectedResult,data:{...t.selectedResult.data,markdown:s.value,pdfPath:void 0}};r("updateResult",o)}return d.watch(()=>{var o;return(o=t.selectedResult.data)==null?void 0:o.markdown},o=>{s.value=o||""}),(o,u)=>{var h;return d.openBlock(),d.createElementBlock("div",pt,[(h=n.selectedResult.data)!=null&&h.markdown?(d.openBlock(),d.createElementBlock(d.Fragment,{key:1},[d.createElementVNode("div",ut,[d.createElementVNode("div",dt,[d.createElementVNode("div",gt,[d.createElementVNode("h1",ft,d.toDisplayString(n.selectedResult.title||"Document"),1),d.createElementVNode("div",{class:"button-group"},[d.createElementVNode("button",{onClick:l,class:"download-btn download-btn-green"},[...u[2]||(u[2]=[d.createElementVNode("span",{class:"material-icons"},"download",-1),d.createTextVNode(" MD ",-1)])])])]),d.createElementVNode("div",{class:"markdown-content prose prose-slate max-w-none",innerHTML:c.value},null,8,kt)])]),d.createElementVNode("details",mt,[u[3]||(u[3]=d.createElementVNode("summary",null,"Edit Markdown Source",-1)),d.withDirectives(d.createElementVNode("textarea",{"onUpdate:modelValue":u[0]||(u[0]=b=>s.value=b),class:"markdown-editor",spellcheck:"false"},null,512),[[d.vModelText,s.value]]),d.createElementVNode("button",{onClick:p,class:"apply-btn",disabled:!i.value}," Apply Changes ",8,bt)])],64)):(d.openBlock(),d.createElementBlock("div",ht,[...u[1]||(u[1]=[d.createElementVNode("div",{class:"text-gray-500"},"No markdown content available",-1)])]))])}}}),wt=(n,e)=>{const t=n.__vccOpts||n;for(const[r,s]of e)t[r]=s;return t},ye=wt(xt,[["__scopeId","data-v-7bea9557"]]),yt={class:"text-center p-4 bg-purple-100 rounded"},vt={class:"text-sm text-gray-800 mt-1 font-medium truncate"},ve=d.defineComponent({__name:"Preview",props:{result:{}},setup(n){const e=n,t=d.computed(()=>{var r;if(e.result.title)return e.result.title;if((r=e.result.data)!=null&&r.markdown){const s=e.result.data.markdown.match(/^#\s+(.+)$/m);if(s)return s[1]}return"Markdown Document"});return(r,s)=>(d.openBlock(),d.createElementBlock("div",yt,[s[0]||(s[0]=d.createElementVNode("div",{class:"text-purple-600 font-medium"},"Document",-1)),d.createElementVNode("div",vt,d.toDisplayString(t.value),1)]))}}),H="presentDocument",Re=`Use the ${H} tool to create structured documents with text and embedded images. This tool is ideal for:
57
+ - Guides, tutorials, and how-to content ("create a guide about...", "explain how to...")
58
+ - Educational content (lessons, explanations, timelines, concept visualizations)
59
+ - Reports and presentations (business reports, data analysis, infographics)
60
+ - Articles and blog posts with illustrations
61
+ - Documentation with diagrams or screenshots
62
+ - Recipes with step-by-step photos
63
+ - Travel guides with location images
64
+ - Product presentations or lookbooks
65
+ - Any content that combines written information with supporting visuals
66
+
67
+ IMPORTANT: Use this tool instead of just generating standalone images when the user wants informational or educational content with visuals. This creates a cohesive document with formatted text (markdown) AND images embedded at appropriate locations. For example, if asked to "create a guide about photosynthesis with a diagram", use ${H} to create a full guide with explanatory text and the diagram embedded, rather than just generating the diagram image alone.
68
+
69
+ Format embedded images as: ![Detailed image prompt](__too_be_replaced_image_path__)`,Se={..._.pluginCore,viewComponent:ye,previewComponent:ve,samples:_.samples,systemPrompt:Re},Rt={plugin:Se};exports.TOOL_DEFINITION=_.TOOL_DEFINITION;exports.executeMarkdown=_.executeMarkdown;exports.pluginCore=_.pluginCore;exports.samples=_.samples;exports.Preview=ve;exports.SYSTEM_PROMPT=Re;exports.TOOL_NAME=H;exports.View=ye;exports.default=Rt;exports.plugin=Se;