azettl commited on
Commit
d4fb3aa
·
verified ·
1 Parent(s): dd63f59

Upload folder using huggingface_hub

Browse files
.gitignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .eggs/
2
+ dist/
3
+ *.pyc
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+ __tmp/*
8
+ *.pyi
9
+ .mypycache
10
+ .ruff_cache
11
+ node_modules
12
+ backend/**/templates/
README.md CHANGED
@@ -1,12 +1,476 @@
1
  ---
2
- title: Gradio Consilium Roundtable
3
- emoji:
4
- colorFrom: purple
 
 
 
 
 
5
  colorTo: yellow
6
  sdk: gradio
7
- sdk_version: 5.33.0
8
- app_file: app.py
9
  pinned: false
 
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ tags:
3
+ - gradio-custom-component
4
+ - custom-component-track
5
+ - roundtable
6
+ - consilium
7
+ title: gradio_consilium_roundtable
8
+ short_description: The roundtable for artificial minds
9
+ colorFrom: blue
10
  colorTo: yellow
11
  sdk: gradio
 
 
12
  pinned: false
13
+ app_file: space.py
14
+ emoji: 🏆
15
  ---
16
 
17
+ # `gradio_consilium_roundtable`
18
+ <a href="https://pypi.org/project/gradio_consilium_roundtable/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_consilium_roundtable"></a>
19
+
20
+ The roundtable for artificial minds
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install gradio_consilium_roundtable
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ```python
31
+ import gradio as gr
32
+ from gradio_consilium_roundtable import consilium_roundtable
33
+ import json
34
+
35
+ def simulate_discussion():
36
+ """Simulate a live AI discussion with custom avatar images"""
37
+
38
+ # Define avatar images (you can replace these URLs with actual image URLs)
39
+ avatar_images = {
40
+ "QwQ-32B": "https://cdn-avatars.huggingface.co/v1/production/uploads/620760a26e3b7210c2ff1943/-s1gyJfvbE1RgO5iBeNOi.png",
41
+ "DeepSeek-R1": "https://logosandtypes.com/wp-content/uploads/2025/02/deepseek.svg",
42
+ "Mistral Large": "https://logosandtypes.com/wp-content/uploads/2025/02/mistral-ai.svg",
43
+ "Claude": "https://claude.ai/favicon.ico",
44
+ # Web Search Agent will use emoji fallback (no image provided)
45
+ }
46
+
47
+ # Initial state - everyone ready
48
+ initial_state = {
49
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
50
+ "messages": [],
51
+ "currentSpeaker": None,
52
+ "thinking": [],
53
+ "showBubbles": [],
54
+ "avatarImages": avatar_images
55
+ }
56
+
57
+ states = [
58
+ # 1. QwQ-32B starts thinking
59
+ {
60
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
61
+ "messages": [],
62
+ "currentSpeaker": None,
63
+ "thinking": ["QwQ-32B"],
64
+ "showBubbles": [],
65
+ "avatarImages": avatar_images
66
+ },
67
+
68
+ # 2. DeepSeek-R1 and Search start thinking - QwQ-32B's bubble should stay visible
69
+ {
70
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
71
+ "messages": [
72
+ {"speaker": "QwQ-32B", "text": "This is a very long response that should demonstrate the scrolling functionality. I'm going to explain multiple points in detail.\n\n**Key Analysis Points:**\n- First consideration: market dynamics\n- Second factor: technical feasibility\n- Third aspect: resource allocation\n\nWe need to evaluate each of these systematically."}
73
+ ],
74
+ "currentSpeaker": None,
75
+ "thinking": ["DeepSeek-R1", "Web Search Agent"],
76
+ "showBubbles": ["QwQ-32B"],
77
+ "avatarImages": avatar_images
78
+ },
79
+
80
+ # 3. DeepSeek-R1 responds - both QwQ-32B and DeepSeek-R1 bubbles visible
81
+ {
82
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
83
+ "messages": [
84
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis:\n\n**Key Points:**\n- Market dynamics are shifting rapidly\n- Technical feasibility looks promising\n- Resource allocation needs careful planning\n\n`Implementation roadmap` should include phased rollout."},
85
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation, QwQ-32B! I'd like to add some **quantitative analysis** to your reasoning:\n\n> Statistical models suggest a 73% success probability\n\nLet me run some deeper calculations..."}
86
+ ],
87
+ "currentSpeaker": "DeepSeek-R1",
88
+ "thinking": [],
89
+ "showBubbles": ["QwQ-32B"],
90
+ "avatarImages": avatar_images
91
+ },
92
+
93
+ # 4. Multiple models thinking - previous responses stay visible
94
+ {
95
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
96
+ "messages": [
97
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
98
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."}
99
+ ],
100
+ "currentSpeaker": None,
101
+ "thinking": ["Mistral Large", "Claude"],
102
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
103
+ "avatarImages": avatar_images
104
+ },
105
+
106
+ # 5. Search agent responds with data - all previous responses visible
107
+ {
108
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
109
+ "messages": [
110
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
111
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."},
112
+ {"speaker": "Web Search Agent", "text": "📊 **Recent Market Data:**\n\n- Industry growth: +23% YoY\n- Competition analysis: 5 major players\n- Consumer sentiment: 87% positive\n\nSources: MarketWatch, TechCrunch, Industry Reports"}
113
+ ],
114
+ "currentSpeaker": "Web Search Agent",
115
+ "thinking": [],
116
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
117
+ "avatarImages": avatar_images
118
+ },
119
+
120
+ # 6. Claude joins the discussion
121
+ {
122
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
123
+ "messages": [
124
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
125
+ {"speaker": "DeepSeek-R1", "text": "Statistical models suggest a 73% success probability based on current market conditions."},
126
+ {"speaker": "Web Search Agent", "text": "📊 Industry growth: +23% YoY, Competition: 5 major players, Consumer sentiment: 87% positive"},
127
+ {"speaker": "Claude", "text": "Great insights everyone! Let me synthesize this information:\n\n🎯 **Strategic Recommendation:**\nBased on the quantitative analysis and market data, I suggest a **phased approach** with risk mitigation strategies built in."}
128
+ ],
129
+ "currentSpeaker": "Claude",
130
+ "thinking": [],
131
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent"],
132
+ "avatarImages": avatar_images
133
+ },
134
+
135
+ # 7. Final consensus with Mistral Large
136
+ {
137
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
138
+ "messages": [
139
+ {"speaker": "QwQ-32B", "text": "Strategic analysis complete with key considerations outlined."},
140
+ {"speaker": "DeepSeek-R1", "text": "Statistical validation: 73% success probability confirmed."},
141
+ {"speaker": "Web Search Agent", "text": "Market data supports positive outlook: +23% growth, 87% sentiment."},
142
+ {"speaker": "Claude", "text": "Phased approach recommended with integrated risk mitigation."},
143
+ {"speaker": "Mistral Large", "text": "🏆 **CONSENSUS ACHIEVED**\n\nAll analyses converge on a **GO decision** with the following framework:\n\n✅ Phased implementation\n✅ 73% success probability\n✅ Strong market fundamentals\n✅ Risk mitigation protocols"}
144
+ ],
145
+ "currentSpeaker": "Mistral Large",
146
+ "thinking": [],
147
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent", "Claude"],
148
+ "avatarImages": avatar_images
149
+ }
150
+ ]
151
+
152
+ return initial_state, states
153
+
154
+ def update_discussion_state(state_index, states):
155
+ """Get the next state in the discussion"""
156
+ if state_index >= len(states):
157
+ state_index = 0
158
+ return states[state_index], state_index + 1
159
+
160
+ # Initialize the discussion
161
+ initial_state, discussion_states = simulate_discussion()
162
+
163
+ with gr.Blocks() as demo:
164
+ gr.Markdown("# 🎭 Consilium Roundtable Demo")
165
+ gr.Markdown("**Watch the AI discussion unfold!** Click 'Next State' to see different phases of the discussion. 📼 Demo Video: https://youtu.be/oyYlf1BfuU8")
166
+
167
+ # State management
168
+ state_counter = gr.State(0)
169
+
170
+ # The roundtable component
171
+ roundtable = consilium_roundtable(
172
+ label="AI Discussion Roundtable",
173
+ show_label=True,
174
+ label_icon="https://huggingface.co/front/assets/huggingface_logo-noborder.svg",
175
+ value=initial_state
176
+ )
177
+
178
+ with gr.Row():
179
+ next_btn = gr.Button("▶️ Next Discussion State", variant="primary")
180
+ reset_btn = gr.Button("🔄 Reset Discussion", variant="secondary")
181
+
182
+ # Status display
183
+ with gr.Row():
184
+ status_display = gr.Markdown("**Status:** Discussion ready to begin")
185
+
186
+ def next_state(current_counter):
187
+ new_state, new_counter = update_discussion_state(current_counter, discussion_states)
188
+
189
+ # Convert to proper JSON string
190
+ json_state = json.dumps(new_state)
191
+
192
+ # Create status message
193
+ thinking_list = new_state.get("thinking", [])
194
+ current_speaker = new_state.get("currentSpeaker")
195
+
196
+ if thinking_list:
197
+ status = f"**Status:** {', '.join(thinking_list)} {'is' if len(thinking_list) == 1 else 'are'} thinking..."
198
+ elif current_speaker:
199
+ status = f"**Status:** {current_speaker} is responding..."
200
+ else:
201
+ status = "**Status:** Discussion in progress..."
202
+
203
+ return json_state, new_counter, status
204
+
205
+ def reset_discussion():
206
+ json_state = json.dumps(initial_state)
207
+ return json_state, 0, "**Status:** Discussion reset - ready to begin"
208
+
209
+ next_btn.click(
210
+ next_state,
211
+ inputs=[state_counter],
212
+ outputs=[roundtable, state_counter, status_display]
213
+ )
214
+
215
+ reset_btn.click(
216
+ reset_discussion,
217
+ outputs=[roundtable, state_counter, status_display]
218
+ )
219
+
220
+ if __name__ == "__main__":
221
+ demo.launch()
222
+ ```
223
+
224
+ ## `consilium_roundtable`
225
+
226
+ ### Initialization
227
+
228
+ <table>
229
+ <thead>
230
+ <tr>
231
+ <th align="left">name</th>
232
+ <th align="left" style="width: 25%;">type</th>
233
+ <th align="left">default</th>
234
+ <th align="left">description</th>
235
+ </tr>
236
+ </thead>
237
+ <tbody>
238
+ <tr>
239
+ <td align="left"><code>value</code></td>
240
+ <td align="left" style="width: 25%;">
241
+
242
+ ```python
243
+ str | Callable | None
244
+ ```
245
+
246
+ </td>
247
+ <td align="left"><code>None</code></td>
248
+ <td align="left">JSON string containing the discussion state with participants, messages, current speaker, thinking states, and avatar images. If a function is provided, it will be called each time the app loads to set the initial value.</td>
249
+ </tr>
250
+
251
+ <tr>
252
+ <td align="left"><code>placeholder</code></td>
253
+ <td align="left" style="width: 25%;">
254
+
255
+ ```python
256
+ str | None
257
+ ```
258
+
259
+ </td>
260
+ <td align="left"><code>None</code></td>
261
+ <td align="left">Not used in this component (roundtable displays participants instead).</td>
262
+ </tr>
263
+
264
+ <tr>
265
+ <td align="left"><code>label</code></td>
266
+ <td align="left" style="width: 25%;">
267
+
268
+ ```python
269
+ str | I18nData | None
270
+ ```
271
+
272
+ </td>
273
+ <td align="left"><code>None</code></td>
274
+ <td align="left">The label for this component, displayed above the roundtable.</td>
275
+ </tr>
276
+
277
+ <tr>
278
+ <td align="left"><code>label_icon</code></td>
279
+ <td align="left" style="width: 25%;">
280
+
281
+ ```python
282
+ str | None
283
+ ```
284
+
285
+ </td>
286
+ <td align="left"><code>"🎭"</code></td>
287
+ <td align="left">Icon displayed next to the label. Can be an emoji (default: "🎭") or a URL to an image. Set to None to disable.</td>
288
+ </tr>
289
+
290
+ <tr>
291
+ <td align="left"><code>every</code></td>
292
+ <td align="left" style="width: 25%;">
293
+
294
+ ```python
295
+ Timer | float | None
296
+ ```
297
+
298
+ </td>
299
+ <td align="left"><code>None</code></td>
300
+ <td align="left">Continuously calls `value` to recalculate it if `value` is a function (useful for live discussion updates).</td>
301
+ </tr>
302
+
303
+ <tr>
304
+ <td align="left"><code>inputs</code></td>
305
+ <td align="left" style="width: 25%;">
306
+
307
+ ```python
308
+ Component | Sequence[Component] | set[Component] | None
309
+ ```
310
+
311
+ </td>
312
+ <td align="left"><code>None</code></td>
313
+ <td align="left">Components that are used as inputs to calculate `value` if `value` is a function.</td>
314
+ </tr>
315
+
316
+ <tr>
317
+ <td align="left"><code>show_label</code></td>
318
+ <td align="left" style="width: 25%;">
319
+
320
+ ```python
321
+ bool | None
322
+ ```
323
+
324
+ </td>
325
+ <td align="left"><code>None</code></td>
326
+ <td align="left">If True, will display the label above the roundtable.</td>
327
+ </tr>
328
+
329
+ <tr>
330
+ <td align="left"><code>scale</code></td>
331
+ <td align="left" style="width: 25%;">
332
+
333
+ ```python
334
+ int | None
335
+ ```
336
+
337
+ </td>
338
+ <td align="left"><code>None</code></td>
339
+ <td align="left">Relative size compared to adjacent components in a Row or Blocks layout.</td>
340
+ </tr>
341
+
342
+ <tr>
343
+ <td align="left"><code>min_width</code></td>
344
+ <td align="left" style="width: 25%;">
345
+
346
+ ```python
347
+ int
348
+ ```
349
+
350
+ </td>
351
+ <td align="left"><code>600</code></td>
352
+ <td align="left">Minimum pixel width for the component (default 600px for proper roundtable display).</td>
353
+ </tr>
354
+
355
+ <tr>
356
+ <td align="left"><code>visible</code></td>
357
+ <td align="left" style="width: 25%;">
358
+
359
+ ```python
360
+ bool
361
+ ```
362
+
363
+ </td>
364
+ <td align="left"><code>True</code></td>
365
+ <td align="left">If False, component will be hidden.</td>
366
+ </tr>
367
+
368
+ <tr>
369
+ <td align="left"><code>rtl</code></td>
370
+ <td align="left" style="width: 25%;">
371
+
372
+ ```python
373
+ bool
374
+ ```
375
+
376
+ </td>
377
+ <td align="left"><code>False</code></td>
378
+ <td align="left">Not used in this component.</td>
379
+ </tr>
380
+
381
+ <tr>
382
+ <td align="left"><code>elem_id</code></td>
383
+ <td align="left" style="width: 25%;">
384
+
385
+ ```python
386
+ str | None
387
+ ```
388
+
389
+ </td>
390
+ <td align="left"><code>None</code></td>
391
+ <td align="left">An optional string assigned as the id of this component in the HTML DOM.</td>
392
+ </tr>
393
+
394
+ <tr>
395
+ <td align="left"><code>elem_classes</code></td>
396
+ <td align="left" style="width: 25%;">
397
+
398
+ ```python
399
+ list[str] | str | None
400
+ ```
401
+
402
+ </td>
403
+ <td align="left"><code>None</code></td>
404
+ <td align="left">Optional list of CSS classes assigned to this component.</td>
405
+ </tr>
406
+
407
+ <tr>
408
+ <td align="left"><code>render</code></td>
409
+ <td align="left" style="width: 25%;">
410
+
411
+ ```python
412
+ bool
413
+ ```
414
+
415
+ </td>
416
+ <td align="left"><code>True</code></td>
417
+ <td align="left">If False, component will not be rendered in the Blocks context initially.</td>
418
+ </tr>
419
+
420
+ <tr>
421
+ <td align="left"><code>key</code></td>
422
+ <td align="left" style="width: 25%;">
423
+
424
+ ```python
425
+ int | str | tuple[int | str, ...] | None
426
+ ```
427
+
428
+ </td>
429
+ <td align="left"><code>None</code></td>
430
+ <td align="left">For gr.render() - components with the same key are treated as the same component across re-renders.</td>
431
+ </tr>
432
+
433
+ <tr>
434
+ <td align="left"><code>preserved_by_key</code></td>
435
+ <td align="left" style="width: 25%;">
436
+
437
+ ```python
438
+ list[str] | str | None
439
+ ```
440
+
441
+ </td>
442
+ <td align="left"><code>"value"</code></td>
443
+ <td align="left">Parameters preserved across re-renders when using keys.</td>
444
+ </tr>
445
+ </tbody></table>
446
+
447
+
448
+ ### Events
449
+
450
+ | name | description |
451
+ |:-----|:------------|
452
+ | `change` | Triggered when the value of the consilium_roundtable changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. |
453
+ | `input` | This listener is triggered when the user changes the value of the consilium_roundtable. |
454
+ | `submit` | This listener is triggered when the user presses the Enter key while the consilium_roundtable is focused. |
455
+
456
+
457
+
458
+ ### User function
459
+
460
+ The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
461
+
462
+ - When used as an Input, the component only impacts the input signature of the user function.
463
+ - When used as an output, the component only impacts the return signature of the user function.
464
+
465
+ The code snippet below is accurate in cases where the component is used as both an input and an output.
466
+
467
+ - **As output:** Is passed, passes the JSON string value for processing.
468
+ - **As input:** Should return, discussion state as dict or JSON string containing:.
469
+
470
+ ```python
471
+ def predict(
472
+ value: str | None
473
+ ) -> Any:
474
+ return value
475
+ ```
476
+
__init__.py ADDED
File without changes
app.py ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio_consilium_roundtable import consilium_roundtable
3
+ import json
4
+
5
+ def simulate_discussion():
6
+ """Simulate a live AI discussion with custom avatar images"""
7
+
8
+ # Define avatar images (you can replace these URLs with actual image URLs)
9
+ avatar_images = {
10
+ "QwQ-32B": "https://cdn-avatars.huggingface.co/v1/production/uploads/620760a26e3b7210c2ff1943/-s1gyJfvbE1RgO5iBeNOi.png",
11
+ "DeepSeek-R1": "https://logosandtypes.com/wp-content/uploads/2025/02/deepseek.svg",
12
+ "Mistral Large": "https://logosandtypes.com/wp-content/uploads/2025/02/mistral-ai.svg",
13
+ "Claude": "https://claude.ai/favicon.ico",
14
+ # Web Search Agent will use emoji fallback (no image provided)
15
+ }
16
+
17
+ # Initial state - everyone ready
18
+ initial_state = {
19
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
20
+ "messages": [],
21
+ "currentSpeaker": None,
22
+ "thinking": [],
23
+ "showBubbles": [],
24
+ "avatarImages": avatar_images
25
+ }
26
+
27
+ states = [
28
+ # 1. QwQ-32B starts thinking
29
+ {
30
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
31
+ "messages": [],
32
+ "currentSpeaker": None,
33
+ "thinking": ["QwQ-32B"],
34
+ "showBubbles": [],
35
+ "avatarImages": avatar_images
36
+ },
37
+
38
+ # 2. DeepSeek-R1 and Search start thinking - QwQ-32B's bubble should stay visible
39
+ {
40
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
41
+ "messages": [
42
+ {"speaker": "QwQ-32B", "text": "This is a very long response that should demonstrate the scrolling functionality. I'm going to explain multiple points in detail.\n\n**Key Analysis Points:**\n- First consideration: market dynamics\n- Second factor: technical feasibility\n- Third aspect: resource allocation\n\nWe need to evaluate each of these systematically."}
43
+ ],
44
+ "currentSpeaker": None,
45
+ "thinking": ["DeepSeek-R1", "Web Search Agent"],
46
+ "showBubbles": ["QwQ-32B"],
47
+ "avatarImages": avatar_images
48
+ },
49
+
50
+ # 3. DeepSeek-R1 responds - both QwQ-32B and DeepSeek-R1 bubbles visible
51
+ {
52
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
53
+ "messages": [
54
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis:\n\n**Key Points:**\n- Market dynamics are shifting rapidly\n- Technical feasibility looks promising\n- Resource allocation needs careful planning\n\n`Implementation roadmap` should include phased rollout."},
55
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation, QwQ-32B! I'd like to add some **quantitative analysis** to your reasoning:\n\n> Statistical models suggest a 73% success probability\n\nLet me run some deeper calculations..."}
56
+ ],
57
+ "currentSpeaker": "DeepSeek-R1",
58
+ "thinking": [],
59
+ "showBubbles": ["QwQ-32B"],
60
+ "avatarImages": avatar_images
61
+ },
62
+
63
+ # 4. Multiple models thinking - previous responses stay visible
64
+ {
65
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
66
+ "messages": [
67
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
68
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."}
69
+ ],
70
+ "currentSpeaker": None,
71
+ "thinking": ["Mistral Large", "Claude"],
72
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
73
+ "avatarImages": avatar_images
74
+ },
75
+
76
+ # 5. Search agent responds with data - all previous responses visible
77
+ {
78
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
79
+ "messages": [
80
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
81
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."},
82
+ {"speaker": "Web Search Agent", "text": "📊 **Recent Market Data:**\n\n- Industry growth: +23% YoY\n- Competition analysis: 5 major players\n- Consumer sentiment: 87% positive\n\nSources: MarketWatch, TechCrunch, Industry Reports"}
83
+ ],
84
+ "currentSpeaker": "Web Search Agent",
85
+ "thinking": [],
86
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
87
+ "avatarImages": avatar_images
88
+ },
89
+
90
+ # 6. Claude joins the discussion
91
+ {
92
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
93
+ "messages": [
94
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
95
+ {"speaker": "DeepSeek-R1", "text": "Statistical models suggest a 73% success probability based on current market conditions."},
96
+ {"speaker": "Web Search Agent", "text": "📊 Industry growth: +23% YoY, Competition: 5 major players, Consumer sentiment: 87% positive"},
97
+ {"speaker": "Claude", "text": "Great insights everyone! Let me synthesize this information:\n\n🎯 **Strategic Recommendation:**\nBased on the quantitative analysis and market data, I suggest a **phased approach** with risk mitigation strategies built in."}
98
+ ],
99
+ "currentSpeaker": "Claude",
100
+ "thinking": [],
101
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent"],
102
+ "avatarImages": avatar_images
103
+ },
104
+
105
+ # 7. Final consensus with Mistral Large
106
+ {
107
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
108
+ "messages": [
109
+ {"speaker": "QwQ-32B", "text": "Strategic analysis complete with key considerations outlined."},
110
+ {"speaker": "DeepSeek-R1", "text": "Statistical validation: 73% success probability confirmed."},
111
+ {"speaker": "Web Search Agent", "text": "Market data supports positive outlook: +23% growth, 87% sentiment."},
112
+ {"speaker": "Claude", "text": "Phased approach recommended with integrated risk mitigation."},
113
+ {"speaker": "Mistral Large", "text": "🏆 **CONSENSUS ACHIEVED**\n\nAll analyses converge on a **GO decision** with the following framework:\n\n✅ Phased implementation\n✅ 73% success probability\n✅ Strong market fundamentals\n✅ Risk mitigation protocols"}
114
+ ],
115
+ "currentSpeaker": "Mistral Large",
116
+ "thinking": [],
117
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent", "Claude"],
118
+ "avatarImages": avatar_images
119
+ }
120
+ ]
121
+
122
+ return initial_state, states
123
+
124
+ def update_discussion_state(state_index, states):
125
+ """Get the next state in the discussion"""
126
+ if state_index >= len(states):
127
+ state_index = 0
128
+ return states[state_index], state_index + 1
129
+
130
+ # Initialize the discussion
131
+ initial_state, discussion_states = simulate_discussion()
132
+
133
+ with gr.Blocks() as demo:
134
+ gr.Markdown("# 🎭 Consilium Roundtable Demo")
135
+ gr.Markdown("**Watch the AI discussion unfold!** Click 'Next State' to see different phases of the discussion. 📼 Demo Video: https://youtu.be/oyYlf1BfuU8")
136
+
137
+ # State management
138
+ state_counter = gr.State(0)
139
+
140
+ # The roundtable component
141
+ roundtable = consilium_roundtable(
142
+ label="AI Discussion Roundtable",
143
+ show_label=True,
144
+ label_icon="https://huggingface.co/front/assets/huggingface_logo-noborder.svg",
145
+ value=initial_state
146
+ )
147
+
148
+ with gr.Row():
149
+ next_btn = gr.Button("▶️ Next Discussion State", variant="primary")
150
+ reset_btn = gr.Button("🔄 Reset Discussion", variant="secondary")
151
+
152
+ # Status display
153
+ with gr.Row():
154
+ status_display = gr.Markdown("**Status:** Discussion ready to begin")
155
+
156
+ def next_state(current_counter):
157
+ new_state, new_counter = update_discussion_state(current_counter, discussion_states)
158
+
159
+ # Convert to proper JSON string
160
+ json_state = json.dumps(new_state)
161
+
162
+ # Create status message
163
+ thinking_list = new_state.get("thinking", [])
164
+ current_speaker = new_state.get("currentSpeaker")
165
+
166
+ if thinking_list:
167
+ status = f"**Status:** {', '.join(thinking_list)} {'is' if len(thinking_list) == 1 else 'are'} thinking..."
168
+ elif current_speaker:
169
+ status = f"**Status:** {current_speaker} is responding..."
170
+ else:
171
+ status = "**Status:** Discussion in progress..."
172
+
173
+ return json_state, new_counter, status
174
+
175
+ def reset_discussion():
176
+ json_state = json.dumps(initial_state)
177
+ return json_state, 0, "**Status:** Discussion reset - ready to begin"
178
+
179
+ next_btn.click(
180
+ next_state,
181
+ inputs=[state_counter],
182
+ outputs=[roundtable, state_counter, status_display]
183
+ )
184
+
185
+ reset_btn.click(
186
+ reset_discussion,
187
+ outputs=[roundtable, state_counter, status_display]
188
+ )
189
+
190
+ if __name__ == "__main__":
191
+ demo.launch()
css.css ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ html {
2
+ font-family: Inter;
3
+ font-size: 16px;
4
+ font-weight: 400;
5
+ line-height: 1.5;
6
+ -webkit-text-size-adjust: 100%;
7
+ background: #fff;
8
+ color: #323232;
9
+ -webkit-font-smoothing: antialiased;
10
+ -moz-osx-font-smoothing: grayscale;
11
+ text-rendering: optimizeLegibility;
12
+ }
13
+
14
+ :root {
15
+ --space: 1;
16
+ --vspace: calc(var(--space) * 1rem);
17
+ --vspace-0: calc(3 * var(--space) * 1rem);
18
+ --vspace-1: calc(2 * var(--space) * 1rem);
19
+ --vspace-2: calc(1.5 * var(--space) * 1rem);
20
+ --vspace-3: calc(0.5 * var(--space) * 1rem);
21
+ }
22
+
23
+ .app {
24
+ max-width: 748px !important;
25
+ }
26
+
27
+ .prose p {
28
+ margin: var(--vspace) 0;
29
+ line-height: var(--vspace * 2);
30
+ font-size: 1rem;
31
+ }
32
+
33
+ code {
34
+ font-family: "Inconsolata", sans-serif;
35
+ font-size: 16px;
36
+ }
37
+
38
+ h1,
39
+ h1 code {
40
+ font-weight: 400;
41
+ line-height: calc(2.5 / var(--space) * var(--vspace));
42
+ }
43
+
44
+ h1 code {
45
+ background: none;
46
+ border: none;
47
+ letter-spacing: 0.05em;
48
+ padding-bottom: 5px;
49
+ position: relative;
50
+ padding: 0;
51
+ }
52
+
53
+ h2 {
54
+ margin: var(--vspace-1) 0 var(--vspace-2) 0;
55
+ line-height: 1em;
56
+ }
57
+
58
+ h3,
59
+ h3 code {
60
+ margin: var(--vspace-1) 0 var(--vspace-2) 0;
61
+ line-height: 1em;
62
+ }
63
+
64
+ h4,
65
+ h5,
66
+ h6 {
67
+ margin: var(--vspace-3) 0 var(--vspace-3) 0;
68
+ line-height: var(--vspace);
69
+ }
70
+
71
+ .bigtitle,
72
+ h1,
73
+ h1 code {
74
+ font-size: calc(8px * 4.5);
75
+ word-break: break-word;
76
+ }
77
+
78
+ .title,
79
+ h2,
80
+ h2 code {
81
+ font-size: calc(8px * 3.375);
82
+ font-weight: lighter;
83
+ word-break: break-word;
84
+ border: none;
85
+ background: none;
86
+ }
87
+
88
+ .subheading1,
89
+ h3,
90
+ h3 code {
91
+ font-size: calc(8px * 1.8);
92
+ font-weight: 600;
93
+ border: none;
94
+ background: none;
95
+ letter-spacing: 0.1em;
96
+ text-transform: uppercase;
97
+ }
98
+
99
+ h2 code {
100
+ padding: 0;
101
+ position: relative;
102
+ letter-spacing: 0.05em;
103
+ }
104
+
105
+ blockquote {
106
+ font-size: calc(8px * 1.1667);
107
+ font-style: italic;
108
+ line-height: calc(1.1667 * var(--vspace));
109
+ margin: var(--vspace-2) var(--vspace-2);
110
+ }
111
+
112
+ .subheading2,
113
+ h4 {
114
+ font-size: calc(8px * 1.4292);
115
+ text-transform: uppercase;
116
+ font-weight: 600;
117
+ }
118
+
119
+ .subheading3,
120
+ h5 {
121
+ font-size: calc(8px * 1.2917);
122
+ line-height: calc(1.2917 * var(--vspace));
123
+
124
+ font-weight: lighter;
125
+ text-transform: uppercase;
126
+ letter-spacing: 0.15em;
127
+ }
128
+
129
+ h6 {
130
+ font-size: calc(8px * 1.1667);
131
+ font-size: 1.1667em;
132
+ font-weight: normal;
133
+ font-style: italic;
134
+ font-family: "le-monde-livre-classic-byol", serif !important;
135
+ letter-spacing: 0px !important;
136
+ }
137
+
138
+ #start .md > *:first-child {
139
+ margin-top: 0;
140
+ }
141
+
142
+ h2 + h3 {
143
+ margin-top: 0;
144
+ }
145
+
146
+ .md hr {
147
+ border: none;
148
+ border-top: 1px solid var(--block-border-color);
149
+ margin: var(--vspace-2) 0 var(--vspace-2) 0;
150
+ }
151
+ .prose ul {
152
+ margin: var(--vspace-2) 0 var(--vspace-1) 0;
153
+ }
154
+
155
+ .gap {
156
+ gap: 0;
157
+ }
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio_consilium_roundtable
space.py ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from app import demo as app
4
+ import os
5
+
6
+ _docs = {'consilium_roundtable': {'description': 'Creates a visual roundtable component for AI consensus discussions.\n\nDisplays AI participants as avatars positioned around an oval table\nwith animated speech bubbles, thinking states, and real-time discussion updates.\nPerfect for multi-AI collaboration, decision-making processes, and consensus building.\n\nSupports custom avatar images with emoji fallbacks for enhanced visual representation.', 'members': {'__init__': {'value': {'type': 'str | Callable | None', 'default': 'None', 'description': 'JSON string containing the discussion state with participants, messages, current speaker, thinking states, and avatar images. If a function is provided, it will be called each time the app loads to set the initial value.'}, 'placeholder': {'type': 'str | None', 'default': 'None', 'description': 'Not used in this component (roundtable displays participants instead).'}, 'label': {'type': 'str | I18nData | None', 'default': 'None', 'description': 'The label for this component, displayed above the roundtable.'}, 'label_icon': {'type': 'str | None', 'default': '"🎭"', 'description': 'Icon displayed next to the label. Can be an emoji (default: "🎭") or a URL to an image. Set to None to disable.'}, 'every': {'type': 'Timer | float | None', 'default': 'None', 'description': 'Continuously calls `value` to recalculate it if `value` is a function (useful for live discussion updates).'}, 'inputs': {'type': 'Component | Sequence[Component] | set[Component] | None', 'default': 'None', 'description': 'Components that are used as inputs to calculate `value` if `value` is a function.'}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'If True, will display the label above the roundtable.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'Relative size compared to adjacent components in a Row or Blocks layout.'}, 'min_width': {'type': 'int', 'default': '600', 'description': 'Minimum pixel width for the component (default 600px for proper roundtable display).'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'rtl': {'type': 'bool', 'default': 'False', 'description': 'Not used in this component.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string assigned as the id of this component in the HTML DOM.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'Optional list of CSS classes assigned to this component.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not be rendered in the Blocks context initially.'}, 'key': {'type': 'int | str | tuple[int | str, ...] | None', 'default': 'None', 'description': 'For gr.render() - components with the same key are treated as the same component across re-renders.'}, 'preserved_by_key': {'type': 'list[str] | str | None', 'default': '"value"', 'description': 'Parameters preserved across re-renders when using keys.'}}, 'postprocess': {'value': {'type': 'Any', 'description': 'Discussion state as dict or JSON string containing:'}}, 'preprocess': {'return': {'type': 'str | None', 'description': 'Passes the JSON string value for processing.'}, 'value': None}}, 'events': {'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the consilium_roundtable changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input.'}, 'input': {'type': None, 'default': None, 'description': 'This listener is triggered when the user changes the value of the consilium_roundtable.'}, 'submit': {'type': None, 'default': None, 'description': 'This listener is triggered when the user presses the Enter key while the consilium_roundtable is focused.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'consilium_roundtable': []}}}
7
+
8
+ abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
+
10
+ with gr.Blocks(
11
+ css=abs_path,
12
+ theme=gr.themes.Default(
13
+ font_mono=[
14
+ gr.themes.GoogleFont("Inconsolata"),
15
+ "monospace",
16
+ ],
17
+ ),
18
+ ) as demo:
19
+ gr.Markdown(
20
+ """
21
+ # `gradio_consilium_roundtable`
22
+
23
+ <div style="display: flex; gap: 7px;">
24
+ <a href="https://pypi.org/project/gradio_consilium_roundtable/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_consilium_roundtable"></a>
25
+ </div>
26
+
27
+ The roundtable for artificial minds
28
+ """, elem_classes=["md-custom"], header_links=True)
29
+ app.render()
30
+ gr.Markdown(
31
+ """
32
+ ## Installation
33
+
34
+ ```bash
35
+ pip install gradio_consilium_roundtable
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```python
41
+ import gradio as gr
42
+ from gradio_consilium_roundtable import consilium_roundtable
43
+ import json
44
+
45
+ def simulate_discussion():
46
+ \"\"\"Simulate a live AI discussion with custom avatar images\"\"\"
47
+
48
+ # Define avatar images (you can replace these URLs with actual image URLs)
49
+ avatar_images = {
50
+ "QwQ-32B": "https://cdn-avatars.huggingface.co/v1/production/uploads/620760a26e3b7210c2ff1943/-s1gyJfvbE1RgO5iBeNOi.png",
51
+ "DeepSeek-R1": "https://logosandtypes.com/wp-content/uploads/2025/02/deepseek.svg",
52
+ "Mistral Large": "https://logosandtypes.com/wp-content/uploads/2025/02/mistral-ai.svg",
53
+ "Claude": "https://claude.ai/favicon.ico",
54
+ # Web Search Agent will use emoji fallback (no image provided)
55
+ }
56
+
57
+ # Initial state - everyone ready
58
+ initial_state = {
59
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
60
+ "messages": [],
61
+ "currentSpeaker": None,
62
+ "thinking": [],
63
+ "showBubbles": [],
64
+ "avatarImages": avatar_images
65
+ }
66
+
67
+ states = [
68
+ # 1. QwQ-32B starts thinking
69
+ {
70
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
71
+ "messages": [],
72
+ "currentSpeaker": None,
73
+ "thinking": ["QwQ-32B"],
74
+ "showBubbles": [],
75
+ "avatarImages": avatar_images
76
+ },
77
+
78
+ # 2. DeepSeek-R1 and Search start thinking - QwQ-32B's bubble should stay visible
79
+ {
80
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
81
+ "messages": [
82
+ {"speaker": "QwQ-32B", "text": "This is a very long response that should demonstrate the scrolling functionality. I'm going to explain multiple points in detail.\n\n**Key Analysis Points:**\n- First consideration: market dynamics\n- Second factor: technical feasibility\n- Third aspect: resource allocation\n\nWe need to evaluate each of these systematically."}
83
+ ],
84
+ "currentSpeaker": None,
85
+ "thinking": ["DeepSeek-R1", "Web Search Agent"],
86
+ "showBubbles": ["QwQ-32B"],
87
+ "avatarImages": avatar_images
88
+ },
89
+
90
+ # 3. DeepSeek-R1 responds - both QwQ-32B and DeepSeek-R1 bubbles visible
91
+ {
92
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
93
+ "messages": [
94
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis:\n\n**Key Points:**\n- Market dynamics are shifting rapidly\n- Technical feasibility looks promising\n- Resource allocation needs careful planning\n\n`Implementation roadmap` should include phased rollout."},
95
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation, QwQ-32B! I'd like to add some **quantitative analysis** to your reasoning:\n\n> Statistical models suggest a 73% success probability\n\nLet me run some deeper calculations..."}
96
+ ],
97
+ "currentSpeaker": "DeepSeek-R1",
98
+ "thinking": [],
99
+ "showBubbles": ["QwQ-32B"],
100
+ "avatarImages": avatar_images
101
+ },
102
+
103
+ # 4. Multiple models thinking - previous responses stay visible
104
+ {
105
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
106
+ "messages": [
107
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
108
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."}
109
+ ],
110
+ "currentSpeaker": None,
111
+ "thinking": ["Mistral Large", "Claude"],
112
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
113
+ "avatarImages": avatar_images
114
+ },
115
+
116
+ # 5. Search agent responds with data - all previous responses visible
117
+ {
118
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
119
+ "messages": [
120
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
121
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."},
122
+ {"speaker": "Web Search Agent", "text": "📊 **Recent Market Data:**\n\n- Industry growth: +23% YoY\n- Competition analysis: 5 major players\n- Consumer sentiment: 87% positive\n\nSources: MarketWatch, TechCrunch, Industry Reports"}
123
+ ],
124
+ "currentSpeaker": "Web Search Agent",
125
+ "thinking": [],
126
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
127
+ "avatarImages": avatar_images
128
+ },
129
+
130
+ # 6. Claude joins the discussion
131
+ {
132
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
133
+ "messages": [
134
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
135
+ {"speaker": "DeepSeek-R1", "text": "Statistical models suggest a 73% success probability based on current market conditions."},
136
+ {"speaker": "Web Search Agent", "text": "📊 Industry growth: +23% YoY, Competition: 5 major players, Consumer sentiment: 87% positive"},
137
+ {"speaker": "Claude", "text": "Great insights everyone! Let me synthesize this information:\n\n🎯 **Strategic Recommendation:**\nBased on the quantitative analysis and market data, I suggest a **phased approach** with risk mitigation strategies built in."}
138
+ ],
139
+ "currentSpeaker": "Claude",
140
+ "thinking": [],
141
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent"],
142
+ "avatarImages": avatar_images
143
+ },
144
+
145
+ # 7. Final consensus with Mistral Large
146
+ {
147
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
148
+ "messages": [
149
+ {"speaker": "QwQ-32B", "text": "Strategic analysis complete with key considerations outlined."},
150
+ {"speaker": "DeepSeek-R1", "text": "Statistical validation: 73% success probability confirmed."},
151
+ {"speaker": "Web Search Agent", "text": "Market data supports positive outlook: +23% growth, 87% sentiment."},
152
+ {"speaker": "Claude", "text": "Phased approach recommended with integrated risk mitigation."},
153
+ {"speaker": "Mistral Large", "text": "🏆 **CONSENSUS ACHIEVED**\n\nAll analyses converge on a **GO decision** with the following framework:\n\n✅ Phased implementation\n✅ 73% success probability\n✅ Strong market fundamentals\n✅ Risk mitigation protocols"}
154
+ ],
155
+ "currentSpeaker": "Mistral Large",
156
+ "thinking": [],
157
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent", "Claude"],
158
+ "avatarImages": avatar_images
159
+ }
160
+ ]
161
+
162
+ return initial_state, states
163
+
164
+ def update_discussion_state(state_index, states):
165
+ \"\"\"Get the next state in the discussion\"\"\"
166
+ if state_index >= len(states):
167
+ state_index = 0
168
+ return states[state_index], state_index + 1
169
+
170
+ # Initialize the discussion
171
+ initial_state, discussion_states = simulate_discussion()
172
+
173
+ with gr.Blocks() as demo:
174
+ gr.Markdown("# 🎭 Consilium Roundtable Demo")
175
+ gr.Markdown("**Watch the AI discussion unfold!** Click 'Next State' to see different phases of the discussion. 📼 Demo Video: https://youtu.be/oyYlf1BfuU8")
176
+
177
+ # State management
178
+ state_counter = gr.State(0)
179
+
180
+ # The roundtable component
181
+ roundtable = consilium_roundtable(
182
+ label="AI Discussion Roundtable",
183
+ show_label=True,
184
+ label_icon="https://huggingface.co/front/assets/huggingface_logo-noborder.svg",
185
+ value=initial_state
186
+ )
187
+
188
+ with gr.Row():
189
+ next_btn = gr.Button("▶️ Next Discussion State", variant="primary")
190
+ reset_btn = gr.Button("🔄 Reset Discussion", variant="secondary")
191
+
192
+ # Status display
193
+ with gr.Row():
194
+ status_display = gr.Markdown("**Status:** Discussion ready to begin")
195
+
196
+ def next_state(current_counter):
197
+ new_state, new_counter = update_discussion_state(current_counter, discussion_states)
198
+
199
+ # Convert to proper JSON string
200
+ json_state = json.dumps(new_state)
201
+
202
+ # Create status message
203
+ thinking_list = new_state.get("thinking", [])
204
+ current_speaker = new_state.get("currentSpeaker")
205
+
206
+ if thinking_list:
207
+ status = f"**Status:** {', '.join(thinking_list)} {'is' if len(thinking_list) == 1 else 'are'} thinking..."
208
+ elif current_speaker:
209
+ status = f"**Status:** {current_speaker} is responding..."
210
+ else:
211
+ status = "**Status:** Discussion in progress..."
212
+
213
+ return json_state, new_counter, status
214
+
215
+ def reset_discussion():
216
+ json_state = json.dumps(initial_state)
217
+ return json_state, 0, "**Status:** Discussion reset - ready to begin"
218
+
219
+ next_btn.click(
220
+ next_state,
221
+ inputs=[state_counter],
222
+ outputs=[roundtable, state_counter, status_display]
223
+ )
224
+
225
+ reset_btn.click(
226
+ reset_discussion,
227
+ outputs=[roundtable, state_counter, status_display]
228
+ )
229
+
230
+ if __name__ == "__main__":
231
+ demo.launch()
232
+ ```
233
+ """, elem_classes=["md-custom"], header_links=True)
234
+
235
+
236
+ gr.Markdown("""
237
+ ## `consilium_roundtable`
238
+
239
+ ### Initialization
240
+ """, elem_classes=["md-custom"], header_links=True)
241
+
242
+ gr.ParamViewer(value=_docs["consilium_roundtable"]["members"]["__init__"], linkify=[])
243
+
244
+
245
+ gr.Markdown("### Events")
246
+ gr.ParamViewer(value=_docs["consilium_roundtable"]["events"], linkify=['Event'])
247
+
248
+
249
+
250
+
251
+ gr.Markdown("""
252
+
253
+ ### User function
254
+
255
+ The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
256
+
257
+ - When used as an Input, the component only impacts the input signature of the user function.
258
+ - When used as an output, the component only impacts the return signature of the user function.
259
+
260
+ The code snippet below is accurate in cases where the component is used as both an input and an output.
261
+
262
+ - **As input:** Is passed, passes the JSON string value for processing.
263
+ - **As output:** Should return, discussion state as dict or JSON string containing:.
264
+
265
+ ```python
266
+ def predict(
267
+ value: str | None
268
+ ) -> Any:
269
+ return value
270
+ ```
271
+ """, elem_classes=["md-custom", "consilium_roundtable-user-fn"], header_links=True)
272
+
273
+
274
+
275
+
276
+ demo.load(None, js=r"""function() {
277
+ const refs = {};
278
+ const user_fn_refs = {
279
+ consilium_roundtable: [], };
280
+ requestAnimationFrame(() => {
281
+
282
+ Object.entries(user_fn_refs).forEach(([key, refs]) => {
283
+ if (refs.length > 0) {
284
+ const el = document.querySelector(`.${key}-user-fn`);
285
+ if (!el) return;
286
+ refs.forEach(ref => {
287
+ el.innerHTML = el.innerHTML.replace(
288
+ new RegExp("\\b"+ref+"\\b", "g"),
289
+ `<a href="#h-${ref.toLowerCase()}">${ref}</a>`
290
+ );
291
+ })
292
+ }
293
+ })
294
+
295
+ Object.entries(refs).forEach(([key, refs]) => {
296
+ if (refs.length > 0) {
297
+ const el = document.querySelector(`.${key}`);
298
+ if (!el) return;
299
+ refs.forEach(ref => {
300
+ el.innerHTML = el.innerHTML.replace(
301
+ new RegExp("\\b"+ref+"\\b", "g"),
302
+ `<a href="#h-${ref.toLowerCase()}">${ref}</a>`
303
+ );
304
+ })
305
+ }
306
+ })
307
+ })
308
+ }
309
+
310
+ """)
311
+
312
+ demo.launch()
src/.gitattributes ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
src/.gitignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .eggs/
2
+ dist/
3
+ *.pyc
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+ __tmp/*
8
+ *.pyi
9
+ .mypycache
10
+ .ruff_cache
11
+ node_modules
12
+ backend/**/templates/
src/README.md ADDED
@@ -0,0 +1,476 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - gradio-custom-component
4
+ - custom-component-track
5
+ - roundtable
6
+ - consilium
7
+ title: gradio_consilium_roundtable
8
+ short_description: The roundtable for artificial minds
9
+ colorFrom: blue
10
+ colorTo: yellow
11
+ sdk: gradio
12
+ pinned: false
13
+ app_file: space.py
14
+ emoji: 🏆
15
+ ---
16
+
17
+ # `gradio_consilium_roundtable`
18
+ <a href="https://pypi.org/project/gradio_consilium_roundtable/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_consilium_roundtable"></a>
19
+
20
+ The roundtable for artificial minds
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install gradio_consilium_roundtable
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ```python
31
+ import gradio as gr
32
+ from gradio_consilium_roundtable import consilium_roundtable
33
+ import json
34
+
35
+ def simulate_discussion():
36
+ """Simulate a live AI discussion with custom avatar images"""
37
+
38
+ # Define avatar images (you can replace these URLs with actual image URLs)
39
+ avatar_images = {
40
+ "QwQ-32B": "https://cdn-avatars.huggingface.co/v1/production/uploads/620760a26e3b7210c2ff1943/-s1gyJfvbE1RgO5iBeNOi.png",
41
+ "DeepSeek-R1": "https://logosandtypes.com/wp-content/uploads/2025/02/deepseek.svg",
42
+ "Mistral Large": "https://logosandtypes.com/wp-content/uploads/2025/02/mistral-ai.svg",
43
+ "Claude": "https://claude.ai/favicon.ico",
44
+ # Web Search Agent will use emoji fallback (no image provided)
45
+ }
46
+
47
+ # Initial state - everyone ready
48
+ initial_state = {
49
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
50
+ "messages": [],
51
+ "currentSpeaker": None,
52
+ "thinking": [],
53
+ "showBubbles": [],
54
+ "avatarImages": avatar_images
55
+ }
56
+
57
+ states = [
58
+ # 1. QwQ-32B starts thinking
59
+ {
60
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
61
+ "messages": [],
62
+ "currentSpeaker": None,
63
+ "thinking": ["QwQ-32B"],
64
+ "showBubbles": [],
65
+ "avatarImages": avatar_images
66
+ },
67
+
68
+ # 2. DeepSeek-R1 and Search start thinking - QwQ-32B's bubble should stay visible
69
+ {
70
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
71
+ "messages": [
72
+ {"speaker": "QwQ-32B", "text": "This is a very long response that should demonstrate the scrolling functionality. I'm going to explain multiple points in detail.\n\n**Key Analysis Points:**\n- First consideration: market dynamics\n- Second factor: technical feasibility\n- Third aspect: resource allocation\n\nWe need to evaluate each of these systematically."}
73
+ ],
74
+ "currentSpeaker": None,
75
+ "thinking": ["DeepSeek-R1", "Web Search Agent"],
76
+ "showBubbles": ["QwQ-32B"],
77
+ "avatarImages": avatar_images
78
+ },
79
+
80
+ # 3. DeepSeek-R1 responds - both QwQ-32B and DeepSeek-R1 bubbles visible
81
+ {
82
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
83
+ "messages": [
84
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis:\n\n**Key Points:**\n- Market dynamics are shifting rapidly\n- Technical feasibility looks promising\n- Resource allocation needs careful planning\n\n`Implementation roadmap` should include phased rollout."},
85
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation, QwQ-32B! I'd like to add some **quantitative analysis** to your reasoning:\n\n> Statistical models suggest a 73% success probability\n\nLet me run some deeper calculations..."}
86
+ ],
87
+ "currentSpeaker": "DeepSeek-R1",
88
+ "thinking": [],
89
+ "showBubbles": ["QwQ-32B"],
90
+ "avatarImages": avatar_images
91
+ },
92
+
93
+ # 4. Multiple models thinking - previous responses stay visible
94
+ {
95
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
96
+ "messages": [
97
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
98
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."}
99
+ ],
100
+ "currentSpeaker": None,
101
+ "thinking": ["Mistral Large", "Claude"],
102
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
103
+ "avatarImages": avatar_images
104
+ },
105
+
106
+ # 5. Search agent responds with data - all previous responses visible
107
+ {
108
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
109
+ "messages": [
110
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
111
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."},
112
+ {"speaker": "Web Search Agent", "text": "📊 **Recent Market Data:**\n\n- Industry growth: +23% YoY\n- Competition analysis: 5 major players\n- Consumer sentiment: 87% positive\n\nSources: MarketWatch, TechCrunch, Industry Reports"}
113
+ ],
114
+ "currentSpeaker": "Web Search Agent",
115
+ "thinking": [],
116
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
117
+ "avatarImages": avatar_images
118
+ },
119
+
120
+ # 6. Claude joins the discussion
121
+ {
122
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
123
+ "messages": [
124
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
125
+ {"speaker": "DeepSeek-R1", "text": "Statistical models suggest a 73% success probability based on current market conditions."},
126
+ {"speaker": "Web Search Agent", "text": "📊 Industry growth: +23% YoY, Competition: 5 major players, Consumer sentiment: 87% positive"},
127
+ {"speaker": "Claude", "text": "Great insights everyone! Let me synthesize this information:\n\n🎯 **Strategic Recommendation:**\nBased on the quantitative analysis and market data, I suggest a **phased approach** with risk mitigation strategies built in."}
128
+ ],
129
+ "currentSpeaker": "Claude",
130
+ "thinking": [],
131
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent"],
132
+ "avatarImages": avatar_images
133
+ },
134
+
135
+ # 7. Final consensus with Mistral Large
136
+ {
137
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
138
+ "messages": [
139
+ {"speaker": "QwQ-32B", "text": "Strategic analysis complete with key considerations outlined."},
140
+ {"speaker": "DeepSeek-R1", "text": "Statistical validation: 73% success probability confirmed."},
141
+ {"speaker": "Web Search Agent", "text": "Market data supports positive outlook: +23% growth, 87% sentiment."},
142
+ {"speaker": "Claude", "text": "Phased approach recommended with integrated risk mitigation."},
143
+ {"speaker": "Mistral Large", "text": "🏆 **CONSENSUS ACHIEVED**\n\nAll analyses converge on a **GO decision** with the following framework:\n\n✅ Phased implementation\n✅ 73% success probability\n✅ Strong market fundamentals\n✅ Risk mitigation protocols"}
144
+ ],
145
+ "currentSpeaker": "Mistral Large",
146
+ "thinking": [],
147
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent", "Claude"],
148
+ "avatarImages": avatar_images
149
+ }
150
+ ]
151
+
152
+ return initial_state, states
153
+
154
+ def update_discussion_state(state_index, states):
155
+ """Get the next state in the discussion"""
156
+ if state_index >= len(states):
157
+ state_index = 0
158
+ return states[state_index], state_index + 1
159
+
160
+ # Initialize the discussion
161
+ initial_state, discussion_states = simulate_discussion()
162
+
163
+ with gr.Blocks() as demo:
164
+ gr.Markdown("# 🎭 Consilium Roundtable Demo")
165
+ gr.Markdown("**Watch the AI discussion unfold!** Click 'Next State' to see different phases of the discussion. 📼 Demo Video: https://youtu.be/oyYlf1BfuU8")
166
+
167
+ # State management
168
+ state_counter = gr.State(0)
169
+
170
+ # The roundtable component
171
+ roundtable = consilium_roundtable(
172
+ label="AI Discussion Roundtable",
173
+ show_label=True,
174
+ label_icon="https://huggingface.co/front/assets/huggingface_logo-noborder.svg",
175
+ value=initial_state
176
+ )
177
+
178
+ with gr.Row():
179
+ next_btn = gr.Button("▶️ Next Discussion State", variant="primary")
180
+ reset_btn = gr.Button("🔄 Reset Discussion", variant="secondary")
181
+
182
+ # Status display
183
+ with gr.Row():
184
+ status_display = gr.Markdown("**Status:** Discussion ready to begin")
185
+
186
+ def next_state(current_counter):
187
+ new_state, new_counter = update_discussion_state(current_counter, discussion_states)
188
+
189
+ # Convert to proper JSON string
190
+ json_state = json.dumps(new_state)
191
+
192
+ # Create status message
193
+ thinking_list = new_state.get("thinking", [])
194
+ current_speaker = new_state.get("currentSpeaker")
195
+
196
+ if thinking_list:
197
+ status = f"**Status:** {', '.join(thinking_list)} {'is' if len(thinking_list) == 1 else 'are'} thinking..."
198
+ elif current_speaker:
199
+ status = f"**Status:** {current_speaker} is responding..."
200
+ else:
201
+ status = "**Status:** Discussion in progress..."
202
+
203
+ return json_state, new_counter, status
204
+
205
+ def reset_discussion():
206
+ json_state = json.dumps(initial_state)
207
+ return json_state, 0, "**Status:** Discussion reset - ready to begin"
208
+
209
+ next_btn.click(
210
+ next_state,
211
+ inputs=[state_counter],
212
+ outputs=[roundtable, state_counter, status_display]
213
+ )
214
+
215
+ reset_btn.click(
216
+ reset_discussion,
217
+ outputs=[roundtable, state_counter, status_display]
218
+ )
219
+
220
+ if __name__ == "__main__":
221
+ demo.launch()
222
+ ```
223
+
224
+ ## `consilium_roundtable`
225
+
226
+ ### Initialization
227
+
228
+ <table>
229
+ <thead>
230
+ <tr>
231
+ <th align="left">name</th>
232
+ <th align="left" style="width: 25%;">type</th>
233
+ <th align="left">default</th>
234
+ <th align="left">description</th>
235
+ </tr>
236
+ </thead>
237
+ <tbody>
238
+ <tr>
239
+ <td align="left"><code>value</code></td>
240
+ <td align="left" style="width: 25%;">
241
+
242
+ ```python
243
+ str | Callable | None
244
+ ```
245
+
246
+ </td>
247
+ <td align="left"><code>None</code></td>
248
+ <td align="left">JSON string containing the discussion state with participants, messages, current speaker, thinking states, and avatar images. If a function is provided, it will be called each time the app loads to set the initial value.</td>
249
+ </tr>
250
+
251
+ <tr>
252
+ <td align="left"><code>placeholder</code></td>
253
+ <td align="left" style="width: 25%;">
254
+
255
+ ```python
256
+ str | None
257
+ ```
258
+
259
+ </td>
260
+ <td align="left"><code>None</code></td>
261
+ <td align="left">Not used in this component (roundtable displays participants instead).</td>
262
+ </tr>
263
+
264
+ <tr>
265
+ <td align="left"><code>label</code></td>
266
+ <td align="left" style="width: 25%;">
267
+
268
+ ```python
269
+ str | I18nData | None
270
+ ```
271
+
272
+ </td>
273
+ <td align="left"><code>None</code></td>
274
+ <td align="left">The label for this component, displayed above the roundtable.</td>
275
+ </tr>
276
+
277
+ <tr>
278
+ <td align="left"><code>label_icon</code></td>
279
+ <td align="left" style="width: 25%;">
280
+
281
+ ```python
282
+ str | None
283
+ ```
284
+
285
+ </td>
286
+ <td align="left"><code>"🎭"</code></td>
287
+ <td align="left">Icon displayed next to the label. Can be an emoji (default: "🎭") or a URL to an image. Set to None to disable.</td>
288
+ </tr>
289
+
290
+ <tr>
291
+ <td align="left"><code>every</code></td>
292
+ <td align="left" style="width: 25%;">
293
+
294
+ ```python
295
+ Timer | float | None
296
+ ```
297
+
298
+ </td>
299
+ <td align="left"><code>None</code></td>
300
+ <td align="left">Continuously calls `value` to recalculate it if `value` is a function (useful for live discussion updates).</td>
301
+ </tr>
302
+
303
+ <tr>
304
+ <td align="left"><code>inputs</code></td>
305
+ <td align="left" style="width: 25%;">
306
+
307
+ ```python
308
+ Component | Sequence[Component] | set[Component] | None
309
+ ```
310
+
311
+ </td>
312
+ <td align="left"><code>None</code></td>
313
+ <td align="left">Components that are used as inputs to calculate `value` if `value` is a function.</td>
314
+ </tr>
315
+
316
+ <tr>
317
+ <td align="left"><code>show_label</code></td>
318
+ <td align="left" style="width: 25%;">
319
+
320
+ ```python
321
+ bool | None
322
+ ```
323
+
324
+ </td>
325
+ <td align="left"><code>None</code></td>
326
+ <td align="left">If True, will display the label above the roundtable.</td>
327
+ </tr>
328
+
329
+ <tr>
330
+ <td align="left"><code>scale</code></td>
331
+ <td align="left" style="width: 25%;">
332
+
333
+ ```python
334
+ int | None
335
+ ```
336
+
337
+ </td>
338
+ <td align="left"><code>None</code></td>
339
+ <td align="left">Relative size compared to adjacent components in a Row or Blocks layout.</td>
340
+ </tr>
341
+
342
+ <tr>
343
+ <td align="left"><code>min_width</code></td>
344
+ <td align="left" style="width: 25%;">
345
+
346
+ ```python
347
+ int
348
+ ```
349
+
350
+ </td>
351
+ <td align="left"><code>600</code></td>
352
+ <td align="left">Minimum pixel width for the component (default 600px for proper roundtable display).</td>
353
+ </tr>
354
+
355
+ <tr>
356
+ <td align="left"><code>visible</code></td>
357
+ <td align="left" style="width: 25%;">
358
+
359
+ ```python
360
+ bool
361
+ ```
362
+
363
+ </td>
364
+ <td align="left"><code>True</code></td>
365
+ <td align="left">If False, component will be hidden.</td>
366
+ </tr>
367
+
368
+ <tr>
369
+ <td align="left"><code>rtl</code></td>
370
+ <td align="left" style="width: 25%;">
371
+
372
+ ```python
373
+ bool
374
+ ```
375
+
376
+ </td>
377
+ <td align="left"><code>False</code></td>
378
+ <td align="left">Not used in this component.</td>
379
+ </tr>
380
+
381
+ <tr>
382
+ <td align="left"><code>elem_id</code></td>
383
+ <td align="left" style="width: 25%;">
384
+
385
+ ```python
386
+ str | None
387
+ ```
388
+
389
+ </td>
390
+ <td align="left"><code>None</code></td>
391
+ <td align="left">An optional string assigned as the id of this component in the HTML DOM.</td>
392
+ </tr>
393
+
394
+ <tr>
395
+ <td align="left"><code>elem_classes</code></td>
396
+ <td align="left" style="width: 25%;">
397
+
398
+ ```python
399
+ list[str] | str | None
400
+ ```
401
+
402
+ </td>
403
+ <td align="left"><code>None</code></td>
404
+ <td align="left">Optional list of CSS classes assigned to this component.</td>
405
+ </tr>
406
+
407
+ <tr>
408
+ <td align="left"><code>render</code></td>
409
+ <td align="left" style="width: 25%;">
410
+
411
+ ```python
412
+ bool
413
+ ```
414
+
415
+ </td>
416
+ <td align="left"><code>True</code></td>
417
+ <td align="left">If False, component will not be rendered in the Blocks context initially.</td>
418
+ </tr>
419
+
420
+ <tr>
421
+ <td align="left"><code>key</code></td>
422
+ <td align="left" style="width: 25%;">
423
+
424
+ ```python
425
+ int | str | tuple[int | str, ...] | None
426
+ ```
427
+
428
+ </td>
429
+ <td align="left"><code>None</code></td>
430
+ <td align="left">For gr.render() - components with the same key are treated as the same component across re-renders.</td>
431
+ </tr>
432
+
433
+ <tr>
434
+ <td align="left"><code>preserved_by_key</code></td>
435
+ <td align="left" style="width: 25%;">
436
+
437
+ ```python
438
+ list[str] | str | None
439
+ ```
440
+
441
+ </td>
442
+ <td align="left"><code>"value"</code></td>
443
+ <td align="left">Parameters preserved across re-renders when using keys.</td>
444
+ </tr>
445
+ </tbody></table>
446
+
447
+
448
+ ### Events
449
+
450
+ | name | description |
451
+ |:-----|:------------|
452
+ | `change` | Triggered when the value of the consilium_roundtable changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. |
453
+ | `input` | This listener is triggered when the user changes the value of the consilium_roundtable. |
454
+ | `submit` | This listener is triggered when the user presses the Enter key while the consilium_roundtable is focused. |
455
+
456
+
457
+
458
+ ### User function
459
+
460
+ The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
461
+
462
+ - When used as an Input, the component only impacts the input signature of the user function.
463
+ - When used as an output, the component only impacts the return signature of the user function.
464
+
465
+ The code snippet below is accurate in cases where the component is used as both an input and an output.
466
+
467
+ - **As output:** Is passed, passes the JSON string value for processing.
468
+ - **As input:** Should return, discussion state as dict or JSON string containing:.
469
+
470
+ ```python
471
+ def predict(
472
+ value: str | None
473
+ ) -> Any:
474
+ return value
475
+ ```
476
+
src/backend/gradio_consilium_roundtable/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+
2
+ from .consilium_roundtable import consilium_roundtable
3
+
4
+ __all__ = ['consilium_roundtable']
src/backend/gradio_consilium_roundtable/consilium_roundtable.py ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Callable, Sequence
4
+ from typing import TYPE_CHECKING, Any
5
+ import json
6
+
7
+ from gradio.components.base import Component, FormComponent
8
+ from gradio.events import Events
9
+ from gradio.i18n import I18nData
10
+
11
+ if TYPE_CHECKING:
12
+ from gradio.components import Timer
13
+
14
+
15
+ class consilium_roundtable(FormComponent):
16
+ """
17
+ Creates a visual roundtable component for AI consensus discussions.
18
+
19
+ Displays AI participants as avatars positioned around an oval table
20
+ with animated speech bubbles, thinking states, and real-time discussion updates.
21
+ Perfect for multi-AI collaboration, decision-making processes, and consensus building.
22
+
23
+ Supports custom avatar images with emoji fallbacks for enhanced visual representation.
24
+ """
25
+
26
+ EVENTS = [
27
+ Events.change,
28
+ Events.input,
29
+ Events.submit,
30
+ ]
31
+
32
+ def __init__(
33
+ self,
34
+ value: str | Callable | None = None,
35
+ *,
36
+ placeholder: str | None = None,
37
+ label: str | I18nData | None = None,
38
+ label_icon: str | None = "🎭",
39
+ every: Timer | float | None = None,
40
+ inputs: Component | Sequence[Component] | set[Component] | None = None,
41
+ show_label: bool | None = None,
42
+ scale: int | None = None,
43
+ min_width: int = 600,
44
+ visible: bool = True,
45
+ rtl: bool = False,
46
+ elem_id: str | None = None,
47
+ elem_classes: list[str] | str | None = None,
48
+ render: bool = True,
49
+ key: int | str | tuple[int | str, ...] | None = None,
50
+ preserved_by_key: list[str] | str | None = "value",
51
+ ):
52
+ """
53
+ Parameters:
54
+ value: JSON string containing the discussion state with participants, messages, current speaker, thinking states, and avatar images. If a function is provided, it will be called each time the app loads to set the initial value.
55
+ placeholder: Not used in this component (roundtable displays participants instead).
56
+ label: The label for this component, displayed above the roundtable.
57
+ label_icon: Icon displayed next to the label. Can be an emoji (default: "🎭") or a URL to an image. Set to None to disable.
58
+ every: Continuously calls `value` to recalculate it if `value` is a function (useful for live discussion updates).
59
+ inputs: Components that are used as inputs to calculate `value` if `value` is a function.
60
+ show_label: If True, will display the label above the roundtable.
61
+ scale: Relative size compared to adjacent components in a Row or Blocks layout.
62
+ min_width: Minimum pixel width for the component (default 600px for proper roundtable display).
63
+ visible: If False, component will be hidden.
64
+ rtl: Not used in this component.
65
+ elem_id: An optional string assigned as the id of this component in the HTML DOM.
66
+ elem_classes: Optional list of CSS classes assigned to this component.
67
+ render: If False, component will not be rendered in the Blocks context initially.
68
+ key: For gr.render() - components with the same key are treated as the same component across re-renders.
69
+ preserved_by_key: Parameters preserved across re-renders when using keys.
70
+ """
71
+ self.placeholder = placeholder
72
+ self.rtl = rtl
73
+ self.label_icon = label_icon
74
+ super().__init__(
75
+ label=label,
76
+ every=every,
77
+ inputs=inputs,
78
+ show_label=show_label,
79
+ scale=scale,
80
+ min_width=min_width,
81
+ visible=visible,
82
+ elem_id=elem_id,
83
+ elem_classes=elem_classes,
84
+ value=value,
85
+ render=render,
86
+ key=key,
87
+ preserved_by_key=preserved_by_key,
88
+ )
89
+
90
+ def preprocess(self, payload: str | None) -> str | None:
91
+ """
92
+ Parameters:
93
+ payload: JSON string from the frontend containing user interactions or state changes.
94
+ Returns:
95
+ Passes the JSON string value for processing.
96
+ """
97
+ return None if payload is None else str(payload)
98
+
99
+ def postprocess(self, value: Any) -> str:
100
+ """
101
+ Convert discussion state to proper JSON string for frontend.
102
+
103
+ Parameters:
104
+ value: Discussion state as dict or JSON string containing:
105
+ - participants: List of AI model names (e.g., ["Claude", "GPT-4", "Mistral"])
106
+ - messages: List of message objects with speaker and text
107
+ - currentSpeaker: Name of currently speaking participant (or null)
108
+ - thinking: List of participants currently in thinking state
109
+ - showBubbles: List of participants whose bubbles should remain visible
110
+ - avatarImages: Dict mapping participant names to image URLs (optional)
111
+
112
+ Returns:
113
+ Clean JSON string for frontend consumption.
114
+ """
115
+ if value is None:
116
+ return json.dumps({
117
+ "participants": [],
118
+ "messages": [],
119
+ "currentSpeaker": None,
120
+ "thinking": [],
121
+ "showBubbles": [],
122
+ "avatarImages": {}
123
+ })
124
+
125
+ if isinstance(value, dict):
126
+ # Ensure all required fields are present
127
+ processed_value = {
128
+ "participants": value.get("participants", []),
129
+ "messages": value.get("messages", []),
130
+ "currentSpeaker": value.get("currentSpeaker"),
131
+ "thinking": value.get("thinking", []),
132
+ "showBubbles": value.get("showBubbles", []),
133
+ "avatarImages": value.get("avatarImages", {})
134
+ }
135
+ return json.dumps(processed_value)
136
+ elif isinstance(value, str):
137
+ try:
138
+ parsed = json.loads(value)
139
+ # Ensure avatarImages field exists
140
+ if "avatarImages" not in parsed:
141
+ parsed["avatarImages"] = {}
142
+ return json.dumps(parsed)
143
+ except json.JSONDecodeError:
144
+ return json.dumps({
145
+ "participants": [],
146
+ "messages": [],
147
+ "currentSpeaker": None,
148
+ "thinking": [],
149
+ "showBubbles": [],
150
+ "avatarImages": {}
151
+ })
152
+
153
+ return json.dumps(value)
154
+
155
+ def api_info(self) -> dict[str, Any]:
156
+ return {
157
+ "type": "string",
158
+ "description": "JSON string containing AI discussion state with optional avatar images",
159
+ "example": json.dumps({
160
+ "participants": ["Claude", "GPT-4"],
161
+ "messages": [{"speaker": "Claude", "text": "Hello"}],
162
+ "currentSpeaker": "Claude",
163
+ "thinking": [],
164
+ "showBubbles": [],
165
+ "avatarImages": {
166
+ "Claude": "https://example.com/claude-avatar.png",
167
+ "GPT-4": "https://example.com/gpt4-avatar.png"
168
+ }
169
+ })
170
+ }
171
+
172
+ def example_payload(self) -> Any:
173
+ return json.dumps({
174
+ "participants": ["Claude", "GPT-4", "Mistral"],
175
+ "messages": [
176
+ {"speaker": "Claude", "text": "I think we should consider multiple perspectives on this issue."},
177
+ {"speaker": "GPT-4", "text": "That's a solid foundation. Let me add some analysis..."}
178
+ ],
179
+ "currentSpeaker": "GPT-4",
180
+ "thinking": ["Mistral"],
181
+ "showBubbles": ["Claude"],
182
+ "avatarImages": {
183
+ "Claude": "https://example.com/claude.png",
184
+ "GPT-4": "https://example.com/gpt4.png"
185
+ }
186
+ })
187
+
188
+ def example_value(self) -> Any:
189
+ return json.dumps({
190
+ "participants": ["Claude", "GPT-4", "Mistral", "Gemini", "Search"],
191
+ "messages": [
192
+ {"speaker": "Claude", "text": "Welcome to the Consilium roundtable discussion!"},
193
+ {"speaker": "Search", "text": "I've gathered relevant data for our analysis."}
194
+ ],
195
+ "currentSpeaker": None,
196
+ "thinking": ["GPT-4", "Mistral"],
197
+ "showBubbles": ["Claude"],
198
+ "avatarImages": {
199
+ "Claude": "https://example.com/claude-avatar.jpg",
200
+ "Gemini": "https://example.com/gemini-avatar.png"
201
+ }
202
+ })
src/backend/gradio_consilium_roundtable/templates/component/index.js ADDED
@@ -0,0 +1,2117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var st = Object.defineProperty;
2
+ var ve = (r) => {
3
+ throw TypeError(r);
4
+ };
5
+ var it = (r, e, t) => e in r ? st(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
6
+ var x = (r, e, t) => it(r, typeof e != "symbol" ? e + "" : e, t), lt = (r, e, t) => e.has(r) || ve("Cannot " + t);
7
+ var Te = (r, e, t) => e.has(r) ? ve("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t);
8
+ var ee = (r, e, t) => (lt(r, e, "access private method"), t);
9
+ function fe() {
10
+ return {
11
+ async: !1,
12
+ breaks: !1,
13
+ extensions: null,
14
+ gfm: !0,
15
+ hooks: null,
16
+ pedantic: !1,
17
+ renderer: null,
18
+ silent: !1,
19
+ tokenizer: null,
20
+ walkTokens: null
21
+ };
22
+ }
23
+ let O = fe();
24
+ function qe(r) {
25
+ O = r;
26
+ }
27
+ const De = /[&<>"']/, rt = new RegExp(De.source, "g"), Ze = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, ot = new RegExp(Ze.source, "g"), at = {
28
+ "&": "&amp;",
29
+ "<": "&lt;",
30
+ ">": "&gt;",
31
+ '"': "&quot;",
32
+ "'": "&#39;"
33
+ }, ze = (r) => at[r];
34
+ function C(r, e) {
35
+ if (e) {
36
+ if (De.test(r))
37
+ return r.replace(rt, ze);
38
+ } else if (Ze.test(r))
39
+ return r.replace(ot, ze);
40
+ return r;
41
+ }
42
+ const ct = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
43
+ function ht(r) {
44
+ return r.replace(ct, (e, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : ""));
45
+ }
46
+ const ut = /(^|[^\[])\^/g;
47
+ function w(r, e) {
48
+ let t = typeof r == "string" ? r : r.source;
49
+ e = e || "";
50
+ const n = {
51
+ replace: (i, l) => {
52
+ let s = typeof l == "string" ? l : l.source;
53
+ return s = s.replace(ut, "$1"), t = t.replace(i, s), n;
54
+ },
55
+ getRegex: () => new RegExp(t, e)
56
+ };
57
+ return n;
58
+ }
59
+ function Ie(r) {
60
+ try {
61
+ r = encodeURI(r).replace(/%25/g, "%");
62
+ } catch {
63
+ return null;
64
+ }
65
+ return r;
66
+ }
67
+ const F = { exec: () => null };
68
+ function Re(r, e) {
69
+ const t = r.replace(/\|/g, (l, s, o) => {
70
+ let a = !1, u = s;
71
+ for (; --u >= 0 && o[u] === "\\"; )
72
+ a = !a;
73
+ return a ? "|" : " |";
74
+ }), n = t.split(/ \|/);
75
+ let i = 0;
76
+ if (n[0].trim() || n.shift(), n.length > 0 && !n[n.length - 1].trim() && n.pop(), e)
77
+ if (n.length > e)
78
+ n.splice(e);
79
+ else
80
+ for (; n.length < e; )
81
+ n.push("");
82
+ for (; i < n.length; i++)
83
+ n[i] = n[i].trim().replace(/\\\|/g, "|");
84
+ return n;
85
+ }
86
+ function te(r, e, t) {
87
+ const n = r.length;
88
+ if (n === 0)
89
+ return "";
90
+ let i = 0;
91
+ for (; i < n && r.charAt(n - i - 1) === e; )
92
+ i++;
93
+ return r.slice(0, n - i);
94
+ }
95
+ function pt(r, e) {
96
+ if (r.indexOf(e[1]) === -1)
97
+ return -1;
98
+ let t = 0;
99
+ for (let n = 0; n < r.length; n++)
100
+ if (r[n] === "\\")
101
+ n++;
102
+ else if (r[n] === e[0])
103
+ t++;
104
+ else if (r[n] === e[1] && (t--, t < 0))
105
+ return n;
106
+ return -1;
107
+ }
108
+ function Se(r, e, t, n) {
109
+ const i = e.href, l = e.title ? C(e.title) : null, s = r[1].replace(/\\([\[\]])/g, "$1");
110
+ if (r[0].charAt(0) !== "!") {
111
+ n.state.inLink = !0;
112
+ const o = {
113
+ type: "link",
114
+ raw: t,
115
+ href: i,
116
+ title: l,
117
+ text: s,
118
+ tokens: n.inlineTokens(s)
119
+ };
120
+ return n.state.inLink = !1, o;
121
+ }
122
+ return {
123
+ type: "image",
124
+ raw: t,
125
+ href: i,
126
+ title: l,
127
+ text: C(s)
128
+ };
129
+ }
130
+ function ft(r, e) {
131
+ const t = r.match(/^(\s+)(?:```)/);
132
+ if (t === null)
133
+ return e;
134
+ const n = t[1];
135
+ return e.split(`
136
+ `).map((i) => {
137
+ const l = i.match(/^\s+/);
138
+ if (l === null)
139
+ return i;
140
+ const [s] = l;
141
+ return s.length >= n.length ? i.slice(n.length) : i;
142
+ }).join(`
143
+ `);
144
+ }
145
+ class se {
146
+ // set by the lexer
147
+ constructor(e) {
148
+ x(this, "options");
149
+ x(this, "rules");
150
+ // set by the lexer
151
+ x(this, "lexer");
152
+ this.options = e || O;
153
+ }
154
+ space(e) {
155
+ const t = this.rules.block.newline.exec(e);
156
+ if (t && t[0].length > 0)
157
+ return {
158
+ type: "space",
159
+ raw: t[0]
160
+ };
161
+ }
162
+ code(e) {
163
+ const t = this.rules.block.code.exec(e);
164
+ if (t) {
165
+ const n = t[0].replace(/^ {1,4}/gm, "");
166
+ return {
167
+ type: "code",
168
+ raw: t[0],
169
+ codeBlockStyle: "indented",
170
+ text: this.options.pedantic ? n : te(n, `
171
+ `)
172
+ };
173
+ }
174
+ }
175
+ fences(e) {
176
+ const t = this.rules.block.fences.exec(e);
177
+ if (t) {
178
+ const n = t[0], i = ft(n, t[3] || "");
179
+ return {
180
+ type: "code",
181
+ raw: n,
182
+ lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
183
+ text: i
184
+ };
185
+ }
186
+ }
187
+ heading(e) {
188
+ const t = this.rules.block.heading.exec(e);
189
+ if (t) {
190
+ let n = t[2].trim();
191
+ if (/#$/.test(n)) {
192
+ const i = te(n, "#");
193
+ (this.options.pedantic || !i || / $/.test(i)) && (n = i.trim());
194
+ }
195
+ return {
196
+ type: "heading",
197
+ raw: t[0],
198
+ depth: t[1].length,
199
+ text: n,
200
+ tokens: this.lexer.inline(n)
201
+ };
202
+ }
203
+ }
204
+ hr(e) {
205
+ const t = this.rules.block.hr.exec(e);
206
+ if (t)
207
+ return {
208
+ type: "hr",
209
+ raw: t[0]
210
+ };
211
+ }
212
+ blockquote(e) {
213
+ const t = this.rules.block.blockquote.exec(e);
214
+ if (t) {
215
+ let n = t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
216
+ $1`);
217
+ n = te(n.replace(/^ *>[ \t]?/gm, ""), `
218
+ `);
219
+ const i = this.lexer.state.top;
220
+ this.lexer.state.top = !0;
221
+ const l = this.lexer.blockTokens(n);
222
+ return this.lexer.state.top = i, {
223
+ type: "blockquote",
224
+ raw: t[0],
225
+ tokens: l,
226
+ text: n
227
+ };
228
+ }
229
+ }
230
+ list(e) {
231
+ let t = this.rules.block.list.exec(e);
232
+ if (t) {
233
+ let n = t[1].trim();
234
+ const i = n.length > 1, l = {
235
+ type: "list",
236
+ raw: "",
237
+ ordered: i,
238
+ start: i ? +n.slice(0, -1) : "",
239
+ loose: !1,
240
+ items: []
241
+ };
242
+ n = i ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = i ? n : "[*+-]");
243
+ const s = new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);
244
+ let o = "", a = "", u = !1;
245
+ for (; e; ) {
246
+ let c = !1;
247
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e))
248
+ break;
249
+ o = t[0], e = e.substring(o.length);
250
+ let h = t[2].split(`
251
+ `, 1)[0].replace(/^\t+/, ($) => " ".repeat(3 * $.length)), p = e.split(`
252
+ `, 1)[0], g = 0;
253
+ this.options.pedantic ? (g = 2, a = h.trimStart()) : (g = t[2].search(/[^ ]/), g = g > 4 ? 1 : g, a = h.slice(g), g += t[1].length);
254
+ let _ = !1;
255
+ if (!h && /^ *$/.test(p) && (o += p + `
256
+ `, e = e.substring(p.length + 1), c = !0), !c) {
257
+ const $ = new RegExp(`^ {0,${Math.min(3, g - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), T = new RegExp(`^ {0,${Math.min(3, g - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), d = new RegExp(`^ {0,${Math.min(3, g - 1)}}(?:\`\`\`|~~~)`), m = new RegExp(`^ {0,${Math.min(3, g - 1)}}#`);
258
+ for (; e; ) {
259
+ const R = e.split(`
260
+ `, 1)[0];
261
+ if (p = R, this.options.pedantic && (p = p.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), d.test(p) || m.test(p) || $.test(p) || T.test(e))
262
+ break;
263
+ if (p.search(/[^ ]/) >= g || !p.trim())
264
+ a += `
265
+ ` + p.slice(g);
266
+ else {
267
+ if (_ || h.search(/[^ ]/) >= 4 || d.test(h) || m.test(h) || T.test(h))
268
+ break;
269
+ a += `
270
+ ` + p;
271
+ }
272
+ !_ && !p.trim() && (_ = !0), o += R + `
273
+ `, e = e.substring(R.length + 1), h = p.slice(g);
274
+ }
275
+ }
276
+ l.loose || (u ? l.loose = !0 : /\n *\n *$/.test(o) && (u = !0));
277
+ let y = null, z;
278
+ this.options.gfm && (y = /^\[[ xX]\] /.exec(a), y && (z = y[0] !== "[ ] ", a = a.replace(/^\[[ xX]\] +/, ""))), l.items.push({
279
+ type: "list_item",
280
+ raw: o,
281
+ task: !!y,
282
+ checked: z,
283
+ loose: !1,
284
+ text: a,
285
+ tokens: []
286
+ }), l.raw += o;
287
+ }
288
+ l.items[l.items.length - 1].raw = o.trimEnd(), l.items[l.items.length - 1].text = a.trimEnd(), l.raw = l.raw.trimEnd();
289
+ for (let c = 0; c < l.items.length; c++)
290
+ if (this.lexer.state.top = !1, l.items[c].tokens = this.lexer.blockTokens(l.items[c].text, []), !l.loose) {
291
+ const h = l.items[c].tokens.filter((g) => g.type === "space"), p = h.length > 0 && h.some((g) => /\n.*\n/.test(g.raw));
292
+ l.loose = p;
293
+ }
294
+ if (l.loose)
295
+ for (let c = 0; c < l.items.length; c++)
296
+ l.items[c].loose = !0;
297
+ return l;
298
+ }
299
+ }
300
+ html(e) {
301
+ const t = this.rules.block.html.exec(e);
302
+ if (t)
303
+ return {
304
+ type: "html",
305
+ block: !0,
306
+ raw: t[0],
307
+ pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
308
+ text: t[0]
309
+ };
310
+ }
311
+ def(e) {
312
+ const t = this.rules.block.def.exec(e);
313
+ if (t) {
314
+ const n = t[1].toLowerCase().replace(/\s+/g, " "), i = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", l = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
315
+ return {
316
+ type: "def",
317
+ tag: n,
318
+ raw: t[0],
319
+ href: i,
320
+ title: l
321
+ };
322
+ }
323
+ }
324
+ table(e) {
325
+ const t = this.rules.block.table.exec(e);
326
+ if (!t || !/[:|]/.test(t[2]))
327
+ return;
328
+ const n = Re(t[1]), i = t[2].replace(/^\||\| *$/g, "").split("|"), l = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
329
+ `) : [], s = {
330
+ type: "table",
331
+ raw: t[0],
332
+ header: [],
333
+ align: [],
334
+ rows: []
335
+ };
336
+ if (n.length === i.length) {
337
+ for (const o of i)
338
+ /^ *-+: *$/.test(o) ? s.align.push("right") : /^ *:-+: *$/.test(o) ? s.align.push("center") : /^ *:-+ *$/.test(o) ? s.align.push("left") : s.align.push(null);
339
+ for (const o of n)
340
+ s.header.push({
341
+ text: o,
342
+ tokens: this.lexer.inline(o)
343
+ });
344
+ for (const o of l)
345
+ s.rows.push(Re(o, s.header.length).map((a) => ({
346
+ text: a,
347
+ tokens: this.lexer.inline(a)
348
+ })));
349
+ return s;
350
+ }
351
+ }
352
+ lheading(e) {
353
+ const t = this.rules.block.lheading.exec(e);
354
+ if (t)
355
+ return {
356
+ type: "heading",
357
+ raw: t[0],
358
+ depth: t[2].charAt(0) === "=" ? 1 : 2,
359
+ text: t[1],
360
+ tokens: this.lexer.inline(t[1])
361
+ };
362
+ }
363
+ paragraph(e) {
364
+ const t = this.rules.block.paragraph.exec(e);
365
+ if (t) {
366
+ const n = t[1].charAt(t[1].length - 1) === `
367
+ ` ? t[1].slice(0, -1) : t[1];
368
+ return {
369
+ type: "paragraph",
370
+ raw: t[0],
371
+ text: n,
372
+ tokens: this.lexer.inline(n)
373
+ };
374
+ }
375
+ }
376
+ text(e) {
377
+ const t = this.rules.block.text.exec(e);
378
+ if (t)
379
+ return {
380
+ type: "text",
381
+ raw: t[0],
382
+ text: t[0],
383
+ tokens: this.lexer.inline(t[0])
384
+ };
385
+ }
386
+ escape(e) {
387
+ const t = this.rules.inline.escape.exec(e);
388
+ if (t)
389
+ return {
390
+ type: "escape",
391
+ raw: t[0],
392
+ text: C(t[1])
393
+ };
394
+ }
395
+ tag(e) {
396
+ const t = this.rules.inline.tag.exec(e);
397
+ if (t)
398
+ return !this.lexer.state.inLink && /^<a /i.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
399
+ type: "html",
400
+ raw: t[0],
401
+ inLink: this.lexer.state.inLink,
402
+ inRawBlock: this.lexer.state.inRawBlock,
403
+ block: !1,
404
+ text: t[0]
405
+ };
406
+ }
407
+ link(e) {
408
+ const t = this.rules.inline.link.exec(e);
409
+ if (t) {
410
+ const n = t[2].trim();
411
+ if (!this.options.pedantic && /^</.test(n)) {
412
+ if (!/>$/.test(n))
413
+ return;
414
+ const s = te(n.slice(0, -1), "\\");
415
+ if ((n.length - s.length) % 2 === 0)
416
+ return;
417
+ } else {
418
+ const s = pt(t[2], "()");
419
+ if (s > -1) {
420
+ const a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
421
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, a).trim(), t[3] = "";
422
+ }
423
+ }
424
+ let i = t[2], l = "";
425
+ if (this.options.pedantic) {
426
+ const s = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);
427
+ s && (i = s[1], l = s[3]);
428
+ } else
429
+ l = t[3] ? t[3].slice(1, -1) : "";
430
+ return i = i.trim(), /^</.test(i) && (this.options.pedantic && !/>$/.test(n) ? i = i.slice(1) : i = i.slice(1, -1)), Se(t, {
431
+ href: i && i.replace(this.rules.inline.anyPunctuation, "$1"),
432
+ title: l && l.replace(this.rules.inline.anyPunctuation, "$1")
433
+ }, t[0], this.lexer);
434
+ }
435
+ }
436
+ reflink(e, t) {
437
+ let n;
438
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
439
+ const i = (n[2] || n[1]).replace(/\s+/g, " "), l = t[i.toLowerCase()];
440
+ if (!l) {
441
+ const s = n[0].charAt(0);
442
+ return {
443
+ type: "text",
444
+ raw: s,
445
+ text: s
446
+ };
447
+ }
448
+ return Se(n, l, n[0], this.lexer);
449
+ }
450
+ }
451
+ emStrong(e, t, n = "") {
452
+ let i = this.rules.inline.emStrongLDelim.exec(e);
453
+ if (!i || i[3] && n.match(/[\p{L}\p{N}]/u))
454
+ return;
455
+ if (!(i[1] || i[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
456
+ const s = [...i[0]].length - 1;
457
+ let o, a, u = s, c = 0;
458
+ const h = i[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
459
+ for (h.lastIndex = 0, t = t.slice(-1 * e.length + s); (i = h.exec(t)) != null; ) {
460
+ if (o = i[1] || i[2] || i[3] || i[4] || i[5] || i[6], !o)
461
+ continue;
462
+ if (a = [...o].length, i[3] || i[4]) {
463
+ u += a;
464
+ continue;
465
+ } else if ((i[5] || i[6]) && s % 3 && !((s + a) % 3)) {
466
+ c += a;
467
+ continue;
468
+ }
469
+ if (u -= a, u > 0)
470
+ continue;
471
+ a = Math.min(a, a + u + c);
472
+ const p = [...i[0]][0].length, g = e.slice(0, s + i.index + p + a);
473
+ if (Math.min(s, a) % 2) {
474
+ const y = g.slice(1, -1);
475
+ return {
476
+ type: "em",
477
+ raw: g,
478
+ text: y,
479
+ tokens: this.lexer.inlineTokens(y)
480
+ };
481
+ }
482
+ const _ = g.slice(2, -2);
483
+ return {
484
+ type: "strong",
485
+ raw: g,
486
+ text: _,
487
+ tokens: this.lexer.inlineTokens(_)
488
+ };
489
+ }
490
+ }
491
+ }
492
+ codespan(e) {
493
+ const t = this.rules.inline.code.exec(e);
494
+ if (t) {
495
+ let n = t[2].replace(/\n/g, " ");
496
+ const i = /[^ ]/.test(n), l = /^ /.test(n) && / $/.test(n);
497
+ return i && l && (n = n.substring(1, n.length - 1)), n = C(n, !0), {
498
+ type: "codespan",
499
+ raw: t[0],
500
+ text: n
501
+ };
502
+ }
503
+ }
504
+ br(e) {
505
+ const t = this.rules.inline.br.exec(e);
506
+ if (t)
507
+ return {
508
+ type: "br",
509
+ raw: t[0]
510
+ };
511
+ }
512
+ del(e) {
513
+ const t = this.rules.inline.del.exec(e);
514
+ if (t)
515
+ return {
516
+ type: "del",
517
+ raw: t[0],
518
+ text: t[2],
519
+ tokens: this.lexer.inlineTokens(t[2])
520
+ };
521
+ }
522
+ autolink(e) {
523
+ const t = this.rules.inline.autolink.exec(e);
524
+ if (t) {
525
+ let n, i;
526
+ return t[2] === "@" ? (n = C(t[1]), i = "mailto:" + n) : (n = C(t[1]), i = n), {
527
+ type: "link",
528
+ raw: t[0],
529
+ text: n,
530
+ href: i,
531
+ tokens: [
532
+ {
533
+ type: "text",
534
+ raw: n,
535
+ text: n
536
+ }
537
+ ]
538
+ };
539
+ }
540
+ }
541
+ url(e) {
542
+ var n;
543
+ let t;
544
+ if (t = this.rules.inline.url.exec(e)) {
545
+ let i, l;
546
+ if (t[2] === "@")
547
+ i = C(t[0]), l = "mailto:" + i;
548
+ else {
549
+ let s;
550
+ do
551
+ s = t[0], t[0] = ((n = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : n[0]) ?? "";
552
+ while (s !== t[0]);
553
+ i = C(t[0]), t[1] === "www." ? l = "http://" + t[0] : l = t[0];
554
+ }
555
+ return {
556
+ type: "link",
557
+ raw: t[0],
558
+ text: i,
559
+ href: l,
560
+ tokens: [
561
+ {
562
+ type: "text",
563
+ raw: i,
564
+ text: i
565
+ }
566
+ ]
567
+ };
568
+ }
569
+ }
570
+ inlineText(e) {
571
+ const t = this.rules.inline.text.exec(e);
572
+ if (t) {
573
+ let n;
574
+ return this.lexer.state.inRawBlock ? n = t[0] : n = C(t[0]), {
575
+ type: "text",
576
+ raw: t[0],
577
+ text: n
578
+ };
579
+ }
580
+ }
581
+ }
582
+ const gt = /^(?: *(?:\n|$))+/, dt = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, kt = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, U = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, mt = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Oe = /(?:[*+-]|\d{1,9}[.)])/, je = w(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, Oe).replace(/blockCode/g, / {4}/).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/).getRegex(), ge = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, bt = /^[^\n]+/, de = /(?!\s*\])(?:\\.|[^\[\]\\])+/, wt = w(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", de).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), xt = w(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Oe).getRegex(), oe = "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", ke = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, _t = w("^ {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", ke).replace("tag", oe).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Qe = w(ge).replace("hr", U).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", oe).getRegex(), yt = w(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Qe).getRegex(), me = {
583
+ blockquote: yt,
584
+ code: dt,
585
+ def: wt,
586
+ fences: kt,
587
+ heading: mt,
588
+ hr: U,
589
+ html: _t,
590
+ lheading: je,
591
+ list: xt,
592
+ newline: gt,
593
+ paragraph: Qe,
594
+ table: F,
595
+ text: bt
596
+ }, Ae = w("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", U).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\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", oe).getRegex(), vt = {
597
+ ...me,
598
+ table: Ae,
599
+ paragraph: w(ge).replace("hr", U).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Ae).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", oe).getRegex()
600
+ }, Tt = {
601
+ ...me,
602
+ html: w(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ke).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(),
603
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
604
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
605
+ fences: F,
606
+ // fences not supported
607
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
608
+ paragraph: w(ge).replace("hr", U).replace("heading", ` *#{1,6} *[^
609
+ ]`).replace("lheading", je).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
610
+ }, Ve = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, zt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Ne = /^( {2,}|\\)\n(?!\s*$)/, It = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, W = "\\p{P}\\p{S}", Rt = w(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, W).getRegex(), St = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g, At = w(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, W).getRegex(), Et = w("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, W).getRegex(), Lt = w("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, W).getRegex(), Ct = w(/\\([punct])/, "gu").replace(/punct/g, W).getRegex(), $t = w(/^<(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(), Bt = w(ke).replace("(?:-->|$)", "-->").getRegex(), Mt = w("^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", Bt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), ie = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Pt = w(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", ie).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), He = w(/^!?\[(label)\]\[(ref)\]/).replace("label", ie).replace("ref", de).getRegex(), Fe = w(/^!?\[(ref)\](?:\[\])?/).replace("ref", de).getRegex(), qt = w("reflink|nolink(?!\\()", "g").replace("reflink", He).replace("nolink", Fe).getRegex(), be = {
611
+ _backpedal: F,
612
+ // only used for GFM url
613
+ anyPunctuation: Ct,
614
+ autolink: $t,
615
+ blockSkip: St,
616
+ br: Ne,
617
+ code: zt,
618
+ del: F,
619
+ emStrongLDelim: At,
620
+ emStrongRDelimAst: Et,
621
+ emStrongRDelimUnd: Lt,
622
+ escape: Ve,
623
+ link: Pt,
624
+ nolink: Fe,
625
+ punctuation: Rt,
626
+ reflink: He,
627
+ reflinkSearch: qt,
628
+ tag: Mt,
629
+ text: It,
630
+ url: F
631
+ }, Dt = {
632
+ ...be,
633
+ link: w(/^!?\[(label)\]\((.*?)\)/).replace("label", ie).getRegex(),
634
+ reflink: w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", ie).getRegex()
635
+ }, ue = {
636
+ ...be,
637
+ escape: w(Ve).replace("])", "~|])").getRegex(),
638
+ url: w(/^((?: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(),
639
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
640
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
641
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
642
+ }, Zt = {
643
+ ...ue,
644
+ br: w(Ne).replace("{2,}", "*").getRegex(),
645
+ text: w(ue.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
646
+ }, ne = {
647
+ normal: me,
648
+ gfm: vt,
649
+ pedantic: Tt
650
+ }, H = {
651
+ normal: be,
652
+ gfm: ue,
653
+ breaks: Zt,
654
+ pedantic: Dt
655
+ };
656
+ class M {
657
+ constructor(e) {
658
+ x(this, "tokens");
659
+ x(this, "options");
660
+ x(this, "state");
661
+ x(this, "tokenizer");
662
+ x(this, "inlineQueue");
663
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || O, this.options.tokenizer = this.options.tokenizer || new se(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
664
+ inLink: !1,
665
+ inRawBlock: !1,
666
+ top: !0
667
+ };
668
+ const t = {
669
+ block: ne.normal,
670
+ inline: H.normal
671
+ };
672
+ this.options.pedantic ? (t.block = ne.pedantic, t.inline = H.pedantic) : this.options.gfm && (t.block = ne.gfm, this.options.breaks ? t.inline = H.breaks : t.inline = H.gfm), this.tokenizer.rules = t;
673
+ }
674
+ /**
675
+ * Expose Rules
676
+ */
677
+ static get rules() {
678
+ return {
679
+ block: ne,
680
+ inline: H
681
+ };
682
+ }
683
+ /**
684
+ * Static Lex Method
685
+ */
686
+ static lex(e, t) {
687
+ return new M(t).lex(e);
688
+ }
689
+ /**
690
+ * Static Lex Inline Method
691
+ */
692
+ static lexInline(e, t) {
693
+ return new M(t).inlineTokens(e);
694
+ }
695
+ /**
696
+ * Preprocessing
697
+ */
698
+ lex(e) {
699
+ e = e.replace(/\r\n|\r/g, `
700
+ `), this.blockTokens(e, this.tokens);
701
+ for (let t = 0; t < this.inlineQueue.length; t++) {
702
+ const n = this.inlineQueue[t];
703
+ this.inlineTokens(n.src, n.tokens);
704
+ }
705
+ return this.inlineQueue = [], this.tokens;
706
+ }
707
+ blockTokens(e, t = []) {
708
+ this.options.pedantic ? e = e.replace(/\t/g, " ").replace(/^ +$/gm, "") : e = e.replace(/^( *)(\t+)/gm, (o, a, u) => a + " ".repeat(u.length));
709
+ let n, i, l, s;
710
+ for (; e; )
711
+ if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((o) => (n = o.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
712
+ if (n = this.tokenizer.space(e)) {
713
+ e = e.substring(n.raw.length), n.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += `
714
+ ` : t.push(n);
715
+ continue;
716
+ }
717
+ if (n = this.tokenizer.code(e)) {
718
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
719
+ ` + n.raw, i.text += `
720
+ ` + n.text, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
721
+ continue;
722
+ }
723
+ if (n = this.tokenizer.fences(e)) {
724
+ e = e.substring(n.raw.length), t.push(n);
725
+ continue;
726
+ }
727
+ if (n = this.tokenizer.heading(e)) {
728
+ e = e.substring(n.raw.length), t.push(n);
729
+ continue;
730
+ }
731
+ if (n = this.tokenizer.hr(e)) {
732
+ e = e.substring(n.raw.length), t.push(n);
733
+ continue;
734
+ }
735
+ if (n = this.tokenizer.blockquote(e)) {
736
+ e = e.substring(n.raw.length), t.push(n);
737
+ continue;
738
+ }
739
+ if (n = this.tokenizer.list(e)) {
740
+ e = e.substring(n.raw.length), t.push(n);
741
+ continue;
742
+ }
743
+ if (n = this.tokenizer.html(e)) {
744
+ e = e.substring(n.raw.length), t.push(n);
745
+ continue;
746
+ }
747
+ if (n = this.tokenizer.def(e)) {
748
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
749
+ ` + n.raw, i.text += `
750
+ ` + n.raw, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : this.tokens.links[n.tag] || (this.tokens.links[n.tag] = {
751
+ href: n.href,
752
+ title: n.title
753
+ });
754
+ continue;
755
+ }
756
+ if (n = this.tokenizer.table(e)) {
757
+ e = e.substring(n.raw.length), t.push(n);
758
+ continue;
759
+ }
760
+ if (n = this.tokenizer.lheading(e)) {
761
+ e = e.substring(n.raw.length), t.push(n);
762
+ continue;
763
+ }
764
+ if (l = e, this.options.extensions && this.options.extensions.startBlock) {
765
+ let o = 1 / 0;
766
+ const a = e.slice(1);
767
+ let u;
768
+ this.options.extensions.startBlock.forEach((c) => {
769
+ u = c.call({ lexer: this }, a), typeof u == "number" && u >= 0 && (o = Math.min(o, u));
770
+ }), o < 1 / 0 && o >= 0 && (l = e.substring(0, o + 1));
771
+ }
772
+ if (this.state.top && (n = this.tokenizer.paragraph(l))) {
773
+ i = t[t.length - 1], s && i.type === "paragraph" ? (i.raw += `
774
+ ` + n.raw, i.text += `
775
+ ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n), s = l.length !== e.length, e = e.substring(n.raw.length);
776
+ continue;
777
+ }
778
+ if (n = this.tokenizer.text(e)) {
779
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && i.type === "text" ? (i.raw += `
780
+ ` + n.raw, i.text += `
781
+ ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
782
+ continue;
783
+ }
784
+ if (e) {
785
+ const o = "Infinite loop on byte: " + e.charCodeAt(0);
786
+ if (this.options.silent) {
787
+ console.error(o);
788
+ break;
789
+ } else
790
+ throw new Error(o);
791
+ }
792
+ }
793
+ return this.state.top = !0, t;
794
+ }
795
+ inline(e, t = []) {
796
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
797
+ }
798
+ /**
799
+ * Lexing/Compiling
800
+ */
801
+ inlineTokens(e, t = []) {
802
+ let n, i, l, s = e, o, a, u;
803
+ if (this.tokens.links) {
804
+ const c = Object.keys(this.tokens.links);
805
+ if (c.length > 0)
806
+ for (; (o = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; )
807
+ c.includes(o[0].slice(o[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
808
+ }
809
+ for (; (o = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; )
810
+ s = s.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
811
+ for (; (o = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; )
812
+ s = s.slice(0, o.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
813
+ for (; e; )
814
+ if (a || (u = ""), a = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((c) => (n = c.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
815
+ if (n = this.tokenizer.escape(e)) {
816
+ e = e.substring(n.raw.length), t.push(n);
817
+ continue;
818
+ }
819
+ if (n = this.tokenizer.tag(e)) {
820
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
821
+ continue;
822
+ }
823
+ if (n = this.tokenizer.link(e)) {
824
+ e = e.substring(n.raw.length), t.push(n);
825
+ continue;
826
+ }
827
+ if (n = this.tokenizer.reflink(e, this.tokens.links)) {
828
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
829
+ continue;
830
+ }
831
+ if (n = this.tokenizer.emStrong(e, s, u)) {
832
+ e = e.substring(n.raw.length), t.push(n);
833
+ continue;
834
+ }
835
+ if (n = this.tokenizer.codespan(e)) {
836
+ e = e.substring(n.raw.length), t.push(n);
837
+ continue;
838
+ }
839
+ if (n = this.tokenizer.br(e)) {
840
+ e = e.substring(n.raw.length), t.push(n);
841
+ continue;
842
+ }
843
+ if (n = this.tokenizer.del(e)) {
844
+ e = e.substring(n.raw.length), t.push(n);
845
+ continue;
846
+ }
847
+ if (n = this.tokenizer.autolink(e)) {
848
+ e = e.substring(n.raw.length), t.push(n);
849
+ continue;
850
+ }
851
+ if (!this.state.inLink && (n = this.tokenizer.url(e))) {
852
+ e = e.substring(n.raw.length), t.push(n);
853
+ continue;
854
+ }
855
+ if (l = e, this.options.extensions && this.options.extensions.startInline) {
856
+ let c = 1 / 0;
857
+ const h = e.slice(1);
858
+ let p;
859
+ this.options.extensions.startInline.forEach((g) => {
860
+ p = g.call({ lexer: this }, h), typeof p == "number" && p >= 0 && (c = Math.min(c, p));
861
+ }), c < 1 / 0 && c >= 0 && (l = e.substring(0, c + 1));
862
+ }
863
+ if (n = this.tokenizer.inlineText(l)) {
864
+ e = e.substring(n.raw.length), n.raw.slice(-1) !== "_" && (u = n.raw.slice(-1)), a = !0, i = t[t.length - 1], i && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
865
+ continue;
866
+ }
867
+ if (e) {
868
+ const c = "Infinite loop on byte: " + e.charCodeAt(0);
869
+ if (this.options.silent) {
870
+ console.error(c);
871
+ break;
872
+ } else
873
+ throw new Error(c);
874
+ }
875
+ }
876
+ return t;
877
+ }
878
+ }
879
+ class le {
880
+ constructor(e) {
881
+ x(this, "options");
882
+ this.options = e || O;
883
+ }
884
+ code(e, t, n) {
885
+ var l;
886
+ const i = (l = (t || "").match(/^\S*/)) == null ? void 0 : l[0];
887
+ return e = e.replace(/\n$/, "") + `
888
+ `, i ? '<pre><code class="language-' + C(i) + '">' + (n ? e : C(e, !0)) + `</code></pre>
889
+ ` : "<pre><code>" + (n ? e : C(e, !0)) + `</code></pre>
890
+ `;
891
+ }
892
+ blockquote(e) {
893
+ return `<blockquote>
894
+ ${e}</blockquote>
895
+ `;
896
+ }
897
+ html(e, t) {
898
+ return e;
899
+ }
900
+ heading(e, t, n) {
901
+ return `<h${t}>${e}</h${t}>
902
+ `;
903
+ }
904
+ hr() {
905
+ return `<hr>
906
+ `;
907
+ }
908
+ list(e, t, n) {
909
+ const i = t ? "ol" : "ul", l = t && n !== 1 ? ' start="' + n + '"' : "";
910
+ return "<" + i + l + `>
911
+ ` + e + "</" + i + `>
912
+ `;
913
+ }
914
+ listitem(e, t, n) {
915
+ return `<li>${e}</li>
916
+ `;
917
+ }
918
+ checkbox(e) {
919
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
920
+ }
921
+ paragraph(e) {
922
+ return `<p>${e}</p>
923
+ `;
924
+ }
925
+ table(e, t) {
926
+ return t && (t = `<tbody>${t}</tbody>`), `<table>
927
+ <thead>
928
+ ` + e + `</thead>
929
+ ` + t + `</table>
930
+ `;
931
+ }
932
+ tablerow(e) {
933
+ return `<tr>
934
+ ${e}</tr>
935
+ `;
936
+ }
937
+ tablecell(e, t) {
938
+ const n = t.header ? "th" : "td";
939
+ return (t.align ? `<${n} align="${t.align}">` : `<${n}>`) + e + `</${n}>
940
+ `;
941
+ }
942
+ /**
943
+ * span level renderer
944
+ */
945
+ strong(e) {
946
+ return `<strong>${e}</strong>`;
947
+ }
948
+ em(e) {
949
+ return `<em>${e}</em>`;
950
+ }
951
+ codespan(e) {
952
+ return `<code>${e}</code>`;
953
+ }
954
+ br() {
955
+ return "<br>";
956
+ }
957
+ del(e) {
958
+ return `<del>${e}</del>`;
959
+ }
960
+ link(e, t, n) {
961
+ const i = Ie(e);
962
+ if (i === null)
963
+ return n;
964
+ e = i;
965
+ let l = '<a href="' + e + '"';
966
+ return t && (l += ' title="' + t + '"'), l += ">" + n + "</a>", l;
967
+ }
968
+ image(e, t, n) {
969
+ const i = Ie(e);
970
+ if (i === null)
971
+ return n;
972
+ e = i;
973
+ let l = `<img src="${e}" alt="${n}"`;
974
+ return t && (l += ` title="${t}"`), l += ">", l;
975
+ }
976
+ text(e) {
977
+ return e;
978
+ }
979
+ }
980
+ class we {
981
+ // no need for block level renderers
982
+ strong(e) {
983
+ return e;
984
+ }
985
+ em(e) {
986
+ return e;
987
+ }
988
+ codespan(e) {
989
+ return e;
990
+ }
991
+ del(e) {
992
+ return e;
993
+ }
994
+ html(e) {
995
+ return e;
996
+ }
997
+ text(e) {
998
+ return e;
999
+ }
1000
+ link(e, t, n) {
1001
+ return "" + n;
1002
+ }
1003
+ image(e, t, n) {
1004
+ return "" + n;
1005
+ }
1006
+ br() {
1007
+ return "";
1008
+ }
1009
+ }
1010
+ class P {
1011
+ constructor(e) {
1012
+ x(this, "options");
1013
+ x(this, "renderer");
1014
+ x(this, "textRenderer");
1015
+ this.options = e || O, this.options.renderer = this.options.renderer || new le(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new we();
1016
+ }
1017
+ /**
1018
+ * Static Parse Method
1019
+ */
1020
+ static parse(e, t) {
1021
+ return new P(t).parse(e);
1022
+ }
1023
+ /**
1024
+ * Static Parse Inline Method
1025
+ */
1026
+ static parseInline(e, t) {
1027
+ return new P(t).parseInline(e);
1028
+ }
1029
+ /**
1030
+ * Parse Loop
1031
+ */
1032
+ parse(e, t = !0) {
1033
+ let n = "";
1034
+ for (let i = 0; i < e.length; i++) {
1035
+ const l = e[i];
1036
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[l.type]) {
1037
+ const s = l, o = this.options.extensions.renderers[s.type].call({ parser: this }, s);
1038
+ if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(s.type)) {
1039
+ n += o || "";
1040
+ continue;
1041
+ }
1042
+ }
1043
+ switch (l.type) {
1044
+ case "space":
1045
+ continue;
1046
+ case "hr": {
1047
+ n += this.renderer.hr();
1048
+ continue;
1049
+ }
1050
+ case "heading": {
1051
+ const s = l;
1052
+ n += this.renderer.heading(this.parseInline(s.tokens), s.depth, ht(this.parseInline(s.tokens, this.textRenderer)));
1053
+ continue;
1054
+ }
1055
+ case "code": {
1056
+ const s = l;
1057
+ n += this.renderer.code(s.text, s.lang, !!s.escaped);
1058
+ continue;
1059
+ }
1060
+ case "table": {
1061
+ const s = l;
1062
+ let o = "", a = "";
1063
+ for (let c = 0; c < s.header.length; c++)
1064
+ a += this.renderer.tablecell(this.parseInline(s.header[c].tokens), { header: !0, align: s.align[c] });
1065
+ o += this.renderer.tablerow(a);
1066
+ let u = "";
1067
+ for (let c = 0; c < s.rows.length; c++) {
1068
+ const h = s.rows[c];
1069
+ a = "";
1070
+ for (let p = 0; p < h.length; p++)
1071
+ a += this.renderer.tablecell(this.parseInline(h[p].tokens), { header: !1, align: s.align[p] });
1072
+ u += this.renderer.tablerow(a);
1073
+ }
1074
+ n += this.renderer.table(o, u);
1075
+ continue;
1076
+ }
1077
+ case "blockquote": {
1078
+ const s = l, o = this.parse(s.tokens);
1079
+ n += this.renderer.blockquote(o);
1080
+ continue;
1081
+ }
1082
+ case "list": {
1083
+ const s = l, o = s.ordered, a = s.start, u = s.loose;
1084
+ let c = "";
1085
+ for (let h = 0; h < s.items.length; h++) {
1086
+ const p = s.items[h], g = p.checked, _ = p.task;
1087
+ let y = "";
1088
+ if (p.task) {
1089
+ const z = this.renderer.checkbox(!!g);
1090
+ u ? p.tokens.length > 0 && p.tokens[0].type === "paragraph" ? (p.tokens[0].text = z + " " + p.tokens[0].text, p.tokens[0].tokens && p.tokens[0].tokens.length > 0 && p.tokens[0].tokens[0].type === "text" && (p.tokens[0].tokens[0].text = z + " " + p.tokens[0].tokens[0].text)) : p.tokens.unshift({
1091
+ type: "text",
1092
+ text: z + " "
1093
+ }) : y += z + " ";
1094
+ }
1095
+ y += this.parse(p.tokens, u), c += this.renderer.listitem(y, _, !!g);
1096
+ }
1097
+ n += this.renderer.list(c, o, a);
1098
+ continue;
1099
+ }
1100
+ case "html": {
1101
+ const s = l;
1102
+ n += this.renderer.html(s.text, s.block);
1103
+ continue;
1104
+ }
1105
+ case "paragraph": {
1106
+ const s = l;
1107
+ n += this.renderer.paragraph(this.parseInline(s.tokens));
1108
+ continue;
1109
+ }
1110
+ case "text": {
1111
+ let s = l, o = s.tokens ? this.parseInline(s.tokens) : s.text;
1112
+ for (; i + 1 < e.length && e[i + 1].type === "text"; )
1113
+ s = e[++i], o += `
1114
+ ` + (s.tokens ? this.parseInline(s.tokens) : s.text);
1115
+ n += t ? this.renderer.paragraph(o) : o;
1116
+ continue;
1117
+ }
1118
+ default: {
1119
+ const s = 'Token with "' + l.type + '" type was not found.';
1120
+ if (this.options.silent)
1121
+ return console.error(s), "";
1122
+ throw new Error(s);
1123
+ }
1124
+ }
1125
+ }
1126
+ return n;
1127
+ }
1128
+ /**
1129
+ * Parse Inline Tokens
1130
+ */
1131
+ parseInline(e, t) {
1132
+ t = t || this.renderer;
1133
+ let n = "";
1134
+ for (let i = 0; i < e.length; i++) {
1135
+ const l = e[i];
1136
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[l.type]) {
1137
+ const s = this.options.extensions.renderers[l.type].call({ parser: this }, l);
1138
+ if (s !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
1139
+ n += s || "";
1140
+ continue;
1141
+ }
1142
+ }
1143
+ switch (l.type) {
1144
+ case "escape": {
1145
+ const s = l;
1146
+ n += t.text(s.text);
1147
+ break;
1148
+ }
1149
+ case "html": {
1150
+ const s = l;
1151
+ n += t.html(s.text);
1152
+ break;
1153
+ }
1154
+ case "link": {
1155
+ const s = l;
1156
+ n += t.link(s.href, s.title, this.parseInline(s.tokens, t));
1157
+ break;
1158
+ }
1159
+ case "image": {
1160
+ const s = l;
1161
+ n += t.image(s.href, s.title, s.text);
1162
+ break;
1163
+ }
1164
+ case "strong": {
1165
+ const s = l;
1166
+ n += t.strong(this.parseInline(s.tokens, t));
1167
+ break;
1168
+ }
1169
+ case "em": {
1170
+ const s = l;
1171
+ n += t.em(this.parseInline(s.tokens, t));
1172
+ break;
1173
+ }
1174
+ case "codespan": {
1175
+ const s = l;
1176
+ n += t.codespan(s.text);
1177
+ break;
1178
+ }
1179
+ case "br": {
1180
+ n += t.br();
1181
+ break;
1182
+ }
1183
+ case "del": {
1184
+ const s = l;
1185
+ n += t.del(this.parseInline(s.tokens, t));
1186
+ break;
1187
+ }
1188
+ case "text": {
1189
+ const s = l;
1190
+ n += t.text(s.text);
1191
+ break;
1192
+ }
1193
+ default: {
1194
+ const s = 'Token with "' + l.type + '" type was not found.';
1195
+ if (this.options.silent)
1196
+ return console.error(s), "";
1197
+ throw new Error(s);
1198
+ }
1199
+ }
1200
+ }
1201
+ return n;
1202
+ }
1203
+ }
1204
+ class G {
1205
+ constructor(e) {
1206
+ x(this, "options");
1207
+ this.options = e || O;
1208
+ }
1209
+ /**
1210
+ * Process markdown before marked
1211
+ */
1212
+ preprocess(e) {
1213
+ return e;
1214
+ }
1215
+ /**
1216
+ * Process HTML after marked is finished
1217
+ */
1218
+ postprocess(e) {
1219
+ return e;
1220
+ }
1221
+ /**
1222
+ * Process all tokens before walk tokens
1223
+ */
1224
+ processAllTokens(e) {
1225
+ return e;
1226
+ }
1227
+ }
1228
+ x(G, "passThroughHooks", /* @__PURE__ */ new Set([
1229
+ "preprocess",
1230
+ "postprocess",
1231
+ "processAllTokens"
1232
+ ]));
1233
+ var Z, pe, Ge;
1234
+ class Ot {
1235
+ constructor(...e) {
1236
+ Te(this, Z);
1237
+ x(this, "defaults", fe());
1238
+ x(this, "options", this.setOptions);
1239
+ x(this, "parse", ee(this, Z, pe).call(this, M.lex, P.parse));
1240
+ x(this, "parseInline", ee(this, Z, pe).call(this, M.lexInline, P.parseInline));
1241
+ x(this, "Parser", P);
1242
+ x(this, "Renderer", le);
1243
+ x(this, "TextRenderer", we);
1244
+ x(this, "Lexer", M);
1245
+ x(this, "Tokenizer", se);
1246
+ x(this, "Hooks", G);
1247
+ this.use(...e);
1248
+ }
1249
+ /**
1250
+ * Run callback for every token
1251
+ */
1252
+ walkTokens(e, t) {
1253
+ var i, l;
1254
+ let n = [];
1255
+ for (const s of e)
1256
+ switch (n = n.concat(t.call(this, s)), s.type) {
1257
+ case "table": {
1258
+ const o = s;
1259
+ for (const a of o.header)
1260
+ n = n.concat(this.walkTokens(a.tokens, t));
1261
+ for (const a of o.rows)
1262
+ for (const u of a)
1263
+ n = n.concat(this.walkTokens(u.tokens, t));
1264
+ break;
1265
+ }
1266
+ case "list": {
1267
+ const o = s;
1268
+ n = n.concat(this.walkTokens(o.items, t));
1269
+ break;
1270
+ }
1271
+ default: {
1272
+ const o = s;
1273
+ (l = (i = this.defaults.extensions) == null ? void 0 : i.childTokens) != null && l[o.type] ? this.defaults.extensions.childTokens[o.type].forEach((a) => {
1274
+ const u = o[a].flat(1 / 0);
1275
+ n = n.concat(this.walkTokens(u, t));
1276
+ }) : o.tokens && (n = n.concat(this.walkTokens(o.tokens, t)));
1277
+ }
1278
+ }
1279
+ return n;
1280
+ }
1281
+ use(...e) {
1282
+ const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1283
+ return e.forEach((n) => {
1284
+ const i = { ...n };
1285
+ if (i.async = this.defaults.async || i.async || !1, n.extensions && (n.extensions.forEach((l) => {
1286
+ if (!l.name)
1287
+ throw new Error("extension name required");
1288
+ if ("renderer" in l) {
1289
+ const s = t.renderers[l.name];
1290
+ s ? t.renderers[l.name] = function(...o) {
1291
+ let a = l.renderer.apply(this, o);
1292
+ return a === !1 && (a = s.apply(this, o)), a;
1293
+ } : t.renderers[l.name] = l.renderer;
1294
+ }
1295
+ if ("tokenizer" in l) {
1296
+ if (!l.level || l.level !== "block" && l.level !== "inline")
1297
+ throw new Error("extension level must be 'block' or 'inline'");
1298
+ const s = t[l.level];
1299
+ s ? s.unshift(l.tokenizer) : t[l.level] = [l.tokenizer], l.start && (l.level === "block" ? t.startBlock ? t.startBlock.push(l.start) : t.startBlock = [l.start] : l.level === "inline" && (t.startInline ? t.startInline.push(l.start) : t.startInline = [l.start]));
1300
+ }
1301
+ "childTokens" in l && l.childTokens && (t.childTokens[l.name] = l.childTokens);
1302
+ }), i.extensions = t), n.renderer) {
1303
+ const l = this.defaults.renderer || new le(this.defaults);
1304
+ for (const s in n.renderer) {
1305
+ if (!(s in l))
1306
+ throw new Error(`renderer '${s}' does not exist`);
1307
+ if (s === "options")
1308
+ continue;
1309
+ const o = s, a = n.renderer[o], u = l[o];
1310
+ l[o] = (...c) => {
1311
+ let h = a.apply(l, c);
1312
+ return h === !1 && (h = u.apply(l, c)), h || "";
1313
+ };
1314
+ }
1315
+ i.renderer = l;
1316
+ }
1317
+ if (n.tokenizer) {
1318
+ const l = this.defaults.tokenizer || new se(this.defaults);
1319
+ for (const s in n.tokenizer) {
1320
+ if (!(s in l))
1321
+ throw new Error(`tokenizer '${s}' does not exist`);
1322
+ if (["options", "rules", "lexer"].includes(s))
1323
+ continue;
1324
+ const o = s, a = n.tokenizer[o], u = l[o];
1325
+ l[o] = (...c) => {
1326
+ let h = a.apply(l, c);
1327
+ return h === !1 && (h = u.apply(l, c)), h;
1328
+ };
1329
+ }
1330
+ i.tokenizer = l;
1331
+ }
1332
+ if (n.hooks) {
1333
+ const l = this.defaults.hooks || new G();
1334
+ for (const s in n.hooks) {
1335
+ if (!(s in l))
1336
+ throw new Error(`hook '${s}' does not exist`);
1337
+ if (s === "options")
1338
+ continue;
1339
+ const o = s, a = n.hooks[o], u = l[o];
1340
+ G.passThroughHooks.has(s) ? l[o] = (c) => {
1341
+ if (this.defaults.async)
1342
+ return Promise.resolve(a.call(l, c)).then((p) => u.call(l, p));
1343
+ const h = a.call(l, c);
1344
+ return u.call(l, h);
1345
+ } : l[o] = (...c) => {
1346
+ let h = a.apply(l, c);
1347
+ return h === !1 && (h = u.apply(l, c)), h;
1348
+ };
1349
+ }
1350
+ i.hooks = l;
1351
+ }
1352
+ if (n.walkTokens) {
1353
+ const l = this.defaults.walkTokens, s = n.walkTokens;
1354
+ i.walkTokens = function(o) {
1355
+ let a = [];
1356
+ return a.push(s.call(this, o)), l && (a = a.concat(l.call(this, o))), a;
1357
+ };
1358
+ }
1359
+ this.defaults = { ...this.defaults, ...i };
1360
+ }), this;
1361
+ }
1362
+ setOptions(e) {
1363
+ return this.defaults = { ...this.defaults, ...e }, this;
1364
+ }
1365
+ lexer(e, t) {
1366
+ return M.lex(e, t ?? this.defaults);
1367
+ }
1368
+ parser(e, t) {
1369
+ return P.parse(e, t ?? this.defaults);
1370
+ }
1371
+ }
1372
+ Z = new WeakSet(), pe = function(e, t) {
1373
+ return (n, i) => {
1374
+ const l = { ...i }, s = { ...this.defaults, ...l };
1375
+ this.defaults.async === !0 && l.async === !1 && (s.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), s.async = !0);
1376
+ const o = ee(this, Z, Ge).call(this, !!s.silent, !!s.async);
1377
+ if (typeof n > "u" || n === null)
1378
+ return o(new Error("marked(): input parameter is undefined or null"));
1379
+ if (typeof n != "string")
1380
+ return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1381
+ if (s.hooks && (s.hooks.options = s), s.async)
1382
+ return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then((a) => e(a, s)).then((a) => s.hooks ? s.hooks.processAllTokens(a) : a).then((a) => s.walkTokens ? Promise.all(this.walkTokens(a, s.walkTokens)).then(() => a) : a).then((a) => t(a, s)).then((a) => s.hooks ? s.hooks.postprocess(a) : a).catch(o);
1383
+ try {
1384
+ s.hooks && (n = s.hooks.preprocess(n));
1385
+ let a = e(n, s);
1386
+ s.hooks && (a = s.hooks.processAllTokens(a)), s.walkTokens && this.walkTokens(a, s.walkTokens);
1387
+ let u = t(a, s);
1388
+ return s.hooks && (u = s.hooks.postprocess(u)), u;
1389
+ } catch (a) {
1390
+ return o(a);
1391
+ }
1392
+ };
1393
+ }, Ge = function(e, t) {
1394
+ return (n) => {
1395
+ if (n.message += `
1396
+ Please report this to https://github.com/markedjs/marked.`, e) {
1397
+ const i = "<p>An error occurred:</p><pre>" + C(n.message + "", !0) + "</pre>";
1398
+ return t ? Promise.resolve(i) : i;
1399
+ }
1400
+ if (t)
1401
+ return Promise.reject(n);
1402
+ throw n;
1403
+ };
1404
+ };
1405
+ const D = new Ot();
1406
+ function b(r, e) {
1407
+ return D.parse(r, e);
1408
+ }
1409
+ b.options = b.setOptions = function(r) {
1410
+ return D.setOptions(r), b.defaults = D.defaults, qe(b.defaults), b;
1411
+ };
1412
+ b.getDefaults = fe;
1413
+ b.defaults = O;
1414
+ b.use = function(...r) {
1415
+ return D.use(...r), b.defaults = D.defaults, qe(b.defaults), b;
1416
+ };
1417
+ b.walkTokens = function(r, e) {
1418
+ return D.walkTokens(r, e);
1419
+ };
1420
+ b.parseInline = D.parseInline;
1421
+ b.Parser = P;
1422
+ b.parser = P.parse;
1423
+ b.Renderer = le;
1424
+ b.TextRenderer = we;
1425
+ b.Lexer = M;
1426
+ b.lexer = M.lex;
1427
+ b.Tokenizer = se;
1428
+ b.Hooks = G;
1429
+ b.parse = b;
1430
+ b.options;
1431
+ b.setOptions;
1432
+ b.use;
1433
+ b.walkTokens;
1434
+ b.parseInline;
1435
+ P.parse;
1436
+ M.lex;
1437
+ const {
1438
+ HtmlTagHydration: jt,
1439
+ SvelteComponent: Qt,
1440
+ append_hydration: I,
1441
+ attr: k,
1442
+ children: L,
1443
+ claim_element: S,
1444
+ claim_html_tag: Vt,
1445
+ claim_space: V,
1446
+ claim_text: ae,
1447
+ destroy_each: Nt,
1448
+ detach: v,
1449
+ element: A,
1450
+ ensure_array_like: Ee,
1451
+ init: Ht,
1452
+ insert_hydration: q,
1453
+ listen: Ue,
1454
+ noop: Le,
1455
+ null_to_empty: Ce,
1456
+ safe_not_equal: Ft,
1457
+ set_data: ce,
1458
+ set_style: j,
1459
+ space: N,
1460
+ src_url_equal: re,
1461
+ text: he,
1462
+ toggle_class: B
1463
+ } = window.__gradio__svelte__internal;
1464
+ function $e(r, e, t) {
1465
+ const n = r.slice();
1466
+ return n[31] = e[t], n[33] = t, n;
1467
+ }
1468
+ function Be(r) {
1469
+ let e, t, n, i = (
1470
+ /*label_icon*/
1471
+ r[0] && Me(r)
1472
+ );
1473
+ return {
1474
+ c() {
1475
+ e = A("label"), i && i.c(), t = N(), n = he(
1476
+ /*label*/
1477
+ r[3]
1478
+ ), this.h();
1479
+ },
1480
+ l(l) {
1481
+ e = S(l, "LABEL", { class: !0, for: !0 });
1482
+ var s = L(e);
1483
+ i && i.l(s), t = V(s), n = ae(
1484
+ s,
1485
+ /*label*/
1486
+ r[3]
1487
+ ), s.forEach(v), this.h();
1488
+ },
1489
+ h() {
1490
+ k(e, "class", "block-title svelte-h3uhc0"), k(e, "for", "consilium-roundtable");
1491
+ },
1492
+ m(l, s) {
1493
+ q(l, e, s), i && i.m(e, null), I(e, t), I(e, n);
1494
+ },
1495
+ p(l, s) {
1496
+ /*label_icon*/
1497
+ l[0] ? i ? i.p(l, s) : (i = Me(l), i.c(), i.m(e, t)) : i && (i.d(1), i = null), s[0] & /*label*/
1498
+ 8 && ce(
1499
+ n,
1500
+ /*label*/
1501
+ l[3]
1502
+ );
1503
+ },
1504
+ d(l) {
1505
+ l && v(e), i && i.d();
1506
+ }
1507
+ };
1508
+ }
1509
+ function Me(r) {
1510
+ let e, t;
1511
+ function n(s, o) {
1512
+ return o[0] & /*label_icon*/
1513
+ 1 && (t = null), t == null && (t = !!Yt(
1514
+ /*label_icon*/
1515
+ s[0]
1516
+ )), t ? Ut : Gt;
1517
+ }
1518
+ let i = n(r, [-1, -1]), l = i(r);
1519
+ return {
1520
+ c() {
1521
+ e = A("div"), l.c(), this.h();
1522
+ },
1523
+ l(s) {
1524
+ e = S(s, "DIV", { class: !0 });
1525
+ var o = L(e);
1526
+ l.l(o), o.forEach(v), this.h();
1527
+ },
1528
+ h() {
1529
+ k(e, "class", "label-icon-container svelte-h3uhc0");
1530
+ },
1531
+ m(s, o) {
1532
+ q(s, e, o), l.m(e, null);
1533
+ },
1534
+ p(s, o) {
1535
+ i === (i = n(s, o)) && l ? l.p(s, o) : (l.d(1), l = i(s), l && (l.c(), l.m(e, null)));
1536
+ },
1537
+ d(s) {
1538
+ s && v(e), l.d();
1539
+ }
1540
+ };
1541
+ }
1542
+ function Gt(r) {
1543
+ let e, t;
1544
+ return {
1545
+ c() {
1546
+ e = A("span"), t = he(
1547
+ /*label_icon*/
1548
+ r[0]
1549
+ ), this.h();
1550
+ },
1551
+ l(n) {
1552
+ e = S(n, "SPAN", { class: !0 });
1553
+ var i = L(e);
1554
+ t = ae(
1555
+ i,
1556
+ /*label_icon*/
1557
+ r[0]
1558
+ ), i.forEach(v), this.h();
1559
+ },
1560
+ h() {
1561
+ k(e, "class", "label-icon-emoji svelte-h3uhc0");
1562
+ },
1563
+ m(n, i) {
1564
+ q(n, e, i), I(e, t);
1565
+ },
1566
+ p(n, i) {
1567
+ i[0] & /*label_icon*/
1568
+ 1 && ce(
1569
+ t,
1570
+ /*label_icon*/
1571
+ n[0]
1572
+ );
1573
+ },
1574
+ d(n) {
1575
+ n && v(e);
1576
+ }
1577
+ };
1578
+ }
1579
+ function Ut(r) {
1580
+ let e, t, n, i;
1581
+ return {
1582
+ c() {
1583
+ e = A("img"), this.h();
1584
+ },
1585
+ l(l) {
1586
+ e = S(l, "IMG", { src: !0, alt: !0, class: !0 }), this.h();
1587
+ },
1588
+ h() {
1589
+ re(e.src, t = /*label_icon*/
1590
+ r[0]) || k(e, "src", t), k(e, "alt", "Label Icon"), k(e, "class", "label-icon-image svelte-h3uhc0");
1591
+ },
1592
+ m(l, s) {
1593
+ q(l, e, s), n || (i = Ue(
1594
+ e,
1595
+ "error",
1596
+ /*handleLabelIconError*/
1597
+ r[19]
1598
+ ), n = !0);
1599
+ },
1600
+ p(l, s) {
1601
+ s[0] & /*label_icon*/
1602
+ 1 && !re(e.src, t = /*label_icon*/
1603
+ l[0]) && k(e, "src", t);
1604
+ },
1605
+ d(l) {
1606
+ l && v(e), n = !1, i();
1607
+ }
1608
+ };
1609
+ }
1610
+ function Wt(r) {
1611
+ let e, t = (
1612
+ /*getEmoji*/
1613
+ r[12](
1614
+ /*participant*/
1615
+ r[31]
1616
+ ) + ""
1617
+ ), n;
1618
+ return {
1619
+ c() {
1620
+ e = A("span"), n = he(t), this.h();
1621
+ },
1622
+ l(i) {
1623
+ e = S(i, "SPAN", { class: !0 });
1624
+ var l = L(e);
1625
+ n = ae(l, t), l.forEach(v), this.h();
1626
+ },
1627
+ h() {
1628
+ k(e, "class", "avatar-emoji svelte-h3uhc0");
1629
+ },
1630
+ m(i, l) {
1631
+ q(i, e, l), I(e, n);
1632
+ },
1633
+ p(i, l) {
1634
+ l[0] & /*participants*/
1635
+ 32 && t !== (t = /*getEmoji*/
1636
+ i[12](
1637
+ /*participant*/
1638
+ i[31]
1639
+ ) + "") && ce(n, t);
1640
+ },
1641
+ d(i) {
1642
+ i && v(e);
1643
+ }
1644
+ };
1645
+ }
1646
+ function Xt(r) {
1647
+ let e, t, n, i, l;
1648
+ function s(...o) {
1649
+ return (
1650
+ /*error_handler*/
1651
+ r[25](
1652
+ /*participant*/
1653
+ r[31],
1654
+ ...o
1655
+ )
1656
+ );
1657
+ }
1658
+ return {
1659
+ c() {
1660
+ e = A("img"), this.h();
1661
+ },
1662
+ l(o) {
1663
+ e = S(o, "IMG", { src: !0, alt: !0, class: !0 }), this.h();
1664
+ },
1665
+ h() {
1666
+ re(e.src, t = /*getAvatarImageUrl*/
1667
+ r[13](
1668
+ /*participant*/
1669
+ r[31]
1670
+ )) || k(e, "src", t), k(e, "alt", n = /*participant*/
1671
+ r[31]), k(e, "class", "avatar-image svelte-h3uhc0");
1672
+ },
1673
+ m(o, a) {
1674
+ q(o, e, a), i || (l = Ue(e, "error", s), i = !0);
1675
+ },
1676
+ p(o, a) {
1677
+ r = o, a[0] & /*participants*/
1678
+ 32 && !re(e.src, t = /*getAvatarImageUrl*/
1679
+ r[13](
1680
+ /*participant*/
1681
+ r[31]
1682
+ )) && k(e, "src", t), a[0] & /*participants*/
1683
+ 32 && n !== (n = /*participant*/
1684
+ r[31]) && k(e, "alt", n);
1685
+ },
1686
+ d(o) {
1687
+ o && v(e), i = !1, l();
1688
+ }
1689
+ };
1690
+ }
1691
+ function Pe(r) {
1692
+ let e, t, n, i, l = (
1693
+ /*renderMarkdown*/
1694
+ r[11](
1695
+ /*getLatestMessage*/
1696
+ r[15](
1697
+ /*participant*/
1698
+ r[31]
1699
+ )
1700
+ ) + ""
1701
+ ), s, o, a, u, c, h, p, g = (
1702
+ /*participant*/
1703
+ r[31] + ""
1704
+ ), _, y;
1705
+ function z(d, m) {
1706
+ return m[0] & /*participants*/
1707
+ 32 && (c = null), c == null && (c = !!/*hasCustomImage*/
1708
+ d[14](
1709
+ /*participant*/
1710
+ d[31]
1711
+ )), c ? Xt : Wt;
1712
+ }
1713
+ let $ = z(r, [-1, -1]), T = $(r);
1714
+ return {
1715
+ c() {
1716
+ e = A("div"), t = A("div"), n = A("div"), i = new jt(!1), s = N(), o = A("div"), a = N(), u = A("div"), T.c(), h = N(), p = A("div"), _ = he(g), y = N(), this.h();
1717
+ },
1718
+ l(d) {
1719
+ e = S(d, "DIV", { class: !0, style: !0 });
1720
+ var m = L(e);
1721
+ t = S(m, "DIV", { class: !0 });
1722
+ var R = L(t);
1723
+ n = S(R, "DIV", { class: !0 });
1724
+ var X = L(n);
1725
+ i = Vt(X, !1), X.forEach(v), s = V(R), o = S(R, "DIV", { class: !0 }), L(o).forEach(v), R.forEach(v), a = V(m), u = S(m, "DIV", { class: !0, role: !0, tabindex: !0 });
1726
+ var J = L(u);
1727
+ T.l(J), J.forEach(v), h = V(m), p = S(m, "DIV", { class: !0 });
1728
+ var Y = L(p);
1729
+ _ = ae(Y, g), Y.forEach(v), y = V(m), m.forEach(v), this.h();
1730
+ },
1731
+ h() {
1732
+ i.a = null, k(n, "class", "bubble-content svelte-h3uhc0"), k(o, "class", "bubble-arrow svelte-h3uhc0"), k(t, "class", "speech-bubble svelte-h3uhc0"), B(
1733
+ t,
1734
+ "visible",
1735
+ /*isBubbleVisible*/
1736
+ r[16](
1737
+ /*participant*/
1738
+ r[31]
1739
+ )
1740
+ ), k(u, "class", "avatar svelte-h3uhc0"), k(u, "role", "button"), k(u, "tabindex", "0"), B(
1741
+ u,
1742
+ "speaking",
1743
+ /*isAvatarActive*/
1744
+ r[17](
1745
+ /*participant*/
1746
+ r[31]
1747
+ )
1748
+ ), B(
1749
+ u,
1750
+ "thinking",
1751
+ /*thinking*/
1752
+ r[7].includes(
1753
+ /*participant*/
1754
+ r[31]
1755
+ )
1756
+ ), B(
1757
+ u,
1758
+ "responding",
1759
+ /*currentSpeaker*/
1760
+ r[6] === /*participant*/
1761
+ r[31]
1762
+ ), B(
1763
+ u,
1764
+ "has-image",
1765
+ /*hasCustomImage*/
1766
+ r[14](
1767
+ /*participant*/
1768
+ r[31]
1769
+ )
1770
+ ), k(p, "class", "participant-name svelte-h3uhc0"), k(e, "class", "participant-seat svelte-h3uhc0"), j(e, "left", Q(
1771
+ /*index*/
1772
+ r[33],
1773
+ /*participants*/
1774
+ r[5].length
1775
+ ).left), j(e, "top", Q(
1776
+ /*index*/
1777
+ r[33],
1778
+ /*participants*/
1779
+ r[5].length
1780
+ ).top), j(e, "transform", Q(
1781
+ /*index*/
1782
+ r[33],
1783
+ /*participants*/
1784
+ r[5].length
1785
+ ).transform);
1786
+ },
1787
+ m(d, m) {
1788
+ q(d, e, m), I(e, t), I(t, n), i.m(l, n), I(t, s), I(t, o), I(e, a), I(e, u), T.m(u, null), I(e, h), I(e, p), I(p, _), I(e, y);
1789
+ },
1790
+ p(d, m) {
1791
+ m[0] & /*participants*/
1792
+ 32 && l !== (l = /*renderMarkdown*/
1793
+ d[11](
1794
+ /*getLatestMessage*/
1795
+ d[15](
1796
+ /*participant*/
1797
+ d[31]
1798
+ )
1799
+ ) + "") && i.p(l), m[0] & /*isBubbleVisible, participants*/
1800
+ 65568 && B(
1801
+ t,
1802
+ "visible",
1803
+ /*isBubbleVisible*/
1804
+ d[16](
1805
+ /*participant*/
1806
+ d[31]
1807
+ )
1808
+ ), $ === ($ = z(d, m)) && T ? T.p(d, m) : (T.d(1), T = $(d), T && (T.c(), T.m(u, null))), m[0] & /*isAvatarActive, participants*/
1809
+ 131104 && B(
1810
+ u,
1811
+ "speaking",
1812
+ /*isAvatarActive*/
1813
+ d[17](
1814
+ /*participant*/
1815
+ d[31]
1816
+ )
1817
+ ), m[0] & /*thinking, participants*/
1818
+ 160 && B(
1819
+ u,
1820
+ "thinking",
1821
+ /*thinking*/
1822
+ d[7].includes(
1823
+ /*participant*/
1824
+ d[31]
1825
+ )
1826
+ ), m[0] & /*currentSpeaker, participants*/
1827
+ 96 && B(
1828
+ u,
1829
+ "responding",
1830
+ /*currentSpeaker*/
1831
+ d[6] === /*participant*/
1832
+ d[31]
1833
+ ), m[0] & /*hasCustomImage, participants*/
1834
+ 16416 && B(
1835
+ u,
1836
+ "has-image",
1837
+ /*hasCustomImage*/
1838
+ d[14](
1839
+ /*participant*/
1840
+ d[31]
1841
+ )
1842
+ ), m[0] & /*participants*/
1843
+ 32 && g !== (g = /*participant*/
1844
+ d[31] + "") && ce(_, g), m[0] & /*participants*/
1845
+ 32 && j(e, "left", Q(
1846
+ /*index*/
1847
+ d[33],
1848
+ /*participants*/
1849
+ d[5].length
1850
+ ).left), m[0] & /*participants*/
1851
+ 32 && j(e, "top", Q(
1852
+ /*index*/
1853
+ d[33],
1854
+ /*participants*/
1855
+ d[5].length
1856
+ ).top), m[0] & /*participants*/
1857
+ 32 && j(e, "transform", Q(
1858
+ /*index*/
1859
+ d[33],
1860
+ /*participants*/
1861
+ d[5].length
1862
+ ).transform);
1863
+ },
1864
+ d(d) {
1865
+ d && v(e), T.d();
1866
+ }
1867
+ };
1868
+ }
1869
+ function Jt(r) {
1870
+ let e, t, n, i, l, s, o, a = (
1871
+ /*show_label*/
1872
+ r[4] && /*label*/
1873
+ r[3] && Be(r)
1874
+ ), u = Ee(
1875
+ /*participants*/
1876
+ r[5]
1877
+ ), c = [];
1878
+ for (let h = 0; h < u.length; h += 1)
1879
+ c[h] = Pe($e(r, u, h));
1880
+ return {
1881
+ c() {
1882
+ e = A("div"), t = A("div"), n = A("div"), a && a.c(), i = N(), l = A("div");
1883
+ for (let h = 0; h < c.length; h += 1)
1884
+ c[h].c();
1885
+ this.h();
1886
+ },
1887
+ l(h) {
1888
+ e = S(h, "DIV", { class: !0, id: !0, style: !0 });
1889
+ var p = L(e);
1890
+ t = S(p, "DIV", { class: !0, id: !0 });
1891
+ var g = L(t);
1892
+ n = S(g, "DIV", { class: !0 });
1893
+ var _ = L(n);
1894
+ a && a.l(_), _.forEach(v), i = V(g), l = S(g, "DIV", { class: !0 });
1895
+ var y = L(l);
1896
+ for (let z = 0; z < c.length; z += 1)
1897
+ c[z].l(y);
1898
+ y.forEach(v), g.forEach(v), p.forEach(v), this.h();
1899
+ },
1900
+ h() {
1901
+ k(n, "class", "table-center svelte-h3uhc0"), k(l, "class", "participants-circle"), k(t, "class", "consilium-container svelte-h3uhc0"), k(t, "id", "consilium-roundtable"), k(e, "class", s = Ce(
1902
+ /*containerClasses*/
1903
+ r[10]
1904
+ ) + " svelte-h3uhc0"), k(
1905
+ e,
1906
+ "id",
1907
+ /*elem_id*/
1908
+ r[1]
1909
+ ), k(e, "style", o = /*containerStyle*/
1910
+ r[9] + "; " + /*minWidthStyle*/
1911
+ r[8]), B(e, "hidden", !/*visible*/
1912
+ r[2]);
1913
+ },
1914
+ m(h, p) {
1915
+ q(h, e, p), I(e, t), I(t, n), a && a.m(n, null), I(t, i), I(t, l);
1916
+ for (let g = 0; g < c.length; g += 1)
1917
+ c[g] && c[g].m(l, null);
1918
+ },
1919
+ p(h, p) {
1920
+ if (/*show_label*/
1921
+ h[4] && /*label*/
1922
+ h[3] ? a ? a.p(h, p) : (a = Be(h), a.c(), a.m(n, null)) : a && (a.d(1), a = null), p[0] & /*participants, isAvatarActive, thinking, currentSpeaker, hasCustomImage, getAvatarImageUrl, handleImageError, getEmoji, isBubbleVisible, renderMarkdown, getLatestMessage*/
1923
+ 522464) {
1924
+ u = Ee(
1925
+ /*participants*/
1926
+ h[5]
1927
+ );
1928
+ let g;
1929
+ for (g = 0; g < u.length; g += 1) {
1930
+ const _ = $e(h, u, g);
1931
+ c[g] ? c[g].p(_, p) : (c[g] = Pe(_), c[g].c(), c[g].m(l, null));
1932
+ }
1933
+ for (; g < c.length; g += 1)
1934
+ c[g].d(1);
1935
+ c.length = u.length;
1936
+ }
1937
+ p[0] & /*containerClasses*/
1938
+ 1024 && s !== (s = Ce(
1939
+ /*containerClasses*/
1940
+ h[10]
1941
+ ) + " svelte-h3uhc0") && k(e, "class", s), p[0] & /*elem_id*/
1942
+ 2 && k(
1943
+ e,
1944
+ "id",
1945
+ /*elem_id*/
1946
+ h[1]
1947
+ ), p[0] & /*containerStyle, minWidthStyle*/
1948
+ 768 && o !== (o = /*containerStyle*/
1949
+ h[9] + "; " + /*minWidthStyle*/
1950
+ h[8]) && k(e, "style", o), p[0] & /*containerClasses, visible*/
1951
+ 1028 && B(e, "hidden", !/*visible*/
1952
+ h[2]);
1953
+ },
1954
+ i: Le,
1955
+ o: Le,
1956
+ d(h) {
1957
+ h && v(e), a && a.d(), Nt(c, h);
1958
+ }
1959
+ };
1960
+ }
1961
+ function Q(r, e) {
1962
+ const n = (360 / e * r - 90) * (Math.PI / 180), i = 260, l = 180, s = Math.cos(n) * i, o = Math.sin(n) * l;
1963
+ return {
1964
+ left: `calc(50% + ${s}px)`,
1965
+ top: `calc(50% + ${o}px)`,
1966
+ transform: "translate(-50%, -50%)"
1967
+ };
1968
+ }
1969
+ function Yt(r) {
1970
+ return r ? r.startsWith("http://") || r.startsWith("https://") || r.startsWith("data:") : !1;
1971
+ }
1972
+ function Kt(r, e, t) {
1973
+ let n, i, l, { gradio: s } = e, { elem_id: o = "" } = e, { elem_classes: a = [] } = e, { visible: u = !0 } = e, { value: c = "{}" } = e, { label: h = "Consilium Roundtable" } = e, { label_icon: p = "🎭" } = e, { show_label: g = !0 } = e, { scale: _ = null } = e, { min_width: y = void 0 } = e, z = [], $ = [], T = null, d = [], m = [], R = {};
1974
+ function X() {
1975
+ try {
1976
+ const f = JSON.parse(c);
1977
+ t(5, z = f.participants || []), $ = f.messages || [], t(6, T = f.currentSpeaker || null), t(7, d = f.thinking || []), m = f.showBubbles || [], R = f.avatarImages || {}, console.log("Clean JSON parsed:", {
1978
+ participants: z,
1979
+ messages: $,
1980
+ currentSpeaker: T,
1981
+ thinking: d,
1982
+ showBubbles: m,
1983
+ avatarImages: R
1984
+ });
1985
+ } catch (f) {
1986
+ console.error("Invalid JSON:", c, f);
1987
+ }
1988
+ }
1989
+ function J(f) {
1990
+ if (!f) return f;
1991
+ try {
1992
+ return b.setOptions({
1993
+ breaks: !0,
1994
+ // Convert line breaks to <br>
1995
+ gfm: !0,
1996
+ // GitHub flavored markdown
1997
+ sanitize: !1,
1998
+ // Allow HTML (safe since we control input)
1999
+ smartypants: !1
2000
+ // Don't convert quotes/dashes
2001
+ }), f.includes(`
2002
+ `) ? b.parse(f) : b.parseInline(f);
2003
+ } catch (E) {
2004
+ return console.error("Markdown parsing error:", E), f;
2005
+ }
2006
+ }
2007
+ const Y = {
2008
+ Anthropic: "🤖",
2009
+ Claude: "🤖",
2010
+ Search: "🔍",
2011
+ "Web Search Agent": "🔍",
2012
+ OpenAI: "🧠",
2013
+ "GPT-4": "🧠",
2014
+ Google: "💎",
2015
+ Gemini: "💎",
2016
+ "QwQ-32B": "😊",
2017
+ "DeepSeek-R1": "🔮",
2018
+ Mistral: "🐱",
2019
+ "Mistral Large": "🐱",
2020
+ "Meta-Llama-3.1-8B": "🦙"
2021
+ };
2022
+ function We(f) {
2023
+ return Y[f] || "🤖";
2024
+ }
2025
+ function Xe(f) {
2026
+ return R[f] || null;
2027
+ }
2028
+ function Je(f) {
2029
+ return R[f] && R[f].trim() !== "";
2030
+ }
2031
+ function Ye(f) {
2032
+ if (d.includes(f))
2033
+ return `${f} is thinking...`;
2034
+ if (T === f)
2035
+ return `${f} is responding...`;
2036
+ const E = $.filter((K) => K.speaker === f);
2037
+ return E.length === 0 ? `${f} is ready to discuss...` : E[E.length - 1].text || `${f} responded`;
2038
+ }
2039
+ function Ke(f) {
2040
+ const E = d.includes(f), K = T === f, _e = m.includes(f), ye = E || K || _e;
2041
+ return console.log(`${f} bubble visible:`, ye, { isThinking: E, isSpeaking: K, shouldShow: _e }), ye;
2042
+ }
2043
+ function et(f) {
2044
+ return d.includes(f) || T === f;
2045
+ }
2046
+ function xe(f, E) {
2047
+ console.warn(`Failed to load avatar image for ${E}, falling back to emoji`), R = Object.assign(Object.assign({}, R), { [E]: null });
2048
+ }
2049
+ function tt(f) {
2050
+ console.warn("Failed to load label icon image, falling back to default emoji"), t(0, p = null);
2051
+ }
2052
+ const nt = (f, E) => xe(E, f);
2053
+ return r.$$set = (f) => {
2054
+ "gradio" in f && t(20, s = f.gradio), "elem_id" in f && t(1, o = f.elem_id), "elem_classes" in f && t(21, a = f.elem_classes), "visible" in f && t(2, u = f.visible), "value" in f && t(22, c = f.value), "label" in f && t(3, h = f.label), "label_icon" in f && t(0, p = f.label_icon), "show_label" in f && t(4, g = f.show_label), "scale" in f && t(23, _ = f.scale), "min_width" in f && t(24, y = f.min_width);
2055
+ }, r.$$.update = () => {
2056
+ r.$$.dirty[0] & /*elem_classes*/
2057
+ 2097152 && t(10, n = `wrapper ${a.join(" ")}`), r.$$.dirty[0] & /*scale*/
2058
+ 8388608 && t(9, i = _ ? `--scale: ${_}` : ""), r.$$.dirty[0] & /*min_width*/
2059
+ 16777216 && t(8, l = y ? `min-width: ${y}px` : ""), r.$$.dirty[0] & /*value*/
2060
+ 4194304 && X();
2061
+ }, [
2062
+ p,
2063
+ o,
2064
+ u,
2065
+ h,
2066
+ g,
2067
+ z,
2068
+ T,
2069
+ d,
2070
+ l,
2071
+ i,
2072
+ n,
2073
+ J,
2074
+ We,
2075
+ Xe,
2076
+ Je,
2077
+ Ye,
2078
+ Ke,
2079
+ et,
2080
+ xe,
2081
+ tt,
2082
+ s,
2083
+ a,
2084
+ c,
2085
+ _,
2086
+ y,
2087
+ nt
2088
+ ];
2089
+ }
2090
+ class tn extends Qt {
2091
+ constructor(e) {
2092
+ super(), Ht(
2093
+ this,
2094
+ e,
2095
+ Kt,
2096
+ Jt,
2097
+ Ft,
2098
+ {
2099
+ gradio: 20,
2100
+ elem_id: 1,
2101
+ elem_classes: 21,
2102
+ visible: 2,
2103
+ value: 22,
2104
+ label: 3,
2105
+ label_icon: 0,
2106
+ show_label: 4,
2107
+ scale: 23,
2108
+ min_width: 24
2109
+ },
2110
+ null,
2111
+ [-1, -1]
2112
+ );
2113
+ }
2114
+ }
2115
+ export {
2116
+ tn as default
2117
+ };
src/backend/gradio_consilium_roundtable/templates/component/style.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .hidden.svelte-h3uhc0{display:none}.block-title.svelte-h3uhc0{padding:10px;font-weight:700;color:gold;display:flex;flex-wrap:wrap;justify-content:center;text-shadow:0 2px 4px rgba(0,0,0,.8)}.label-icon-container.svelte-h3uhc0{width:24px;height:24px}.label-icon-emoji.svelte-h3uhc0{font-size:1.2rem;line-height:1}.label-icon-image.svelte-h3uhc0{width:24px;height:24px;object-fit:contain;border-radius:4px}.wrapper.svelte-h3uhc0{width:600px;height:600px;position:relative}.consilium-container.svelte-h3uhc0{top:150px;position:relative;width:450px;height:300px;margin:20px auto;border-radius:50%;background:linear-gradient(135deg,#0f5132,#198754);border:8px solid #8b4513;box-shadow:0 8px 32px #0006,inset 0 0 20px #0003}.table-center.svelte-h3uhc0{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;background:#0000004d;border-radius:50%;width:140px;height:100px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px solid #8b4513;box-shadow:inset 0 0 10px #00000080}.participant-seat.svelte-h3uhc0{position:absolute;display:flex;flex-direction:column;align-items:center}.avatar.svelte-h3uhc0{width:60px;height:60px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:1.4rem;background:linear-gradient(145deg,#fff,#e6e6e6);border:3px solid #8b4513;box-shadow:0 6px 15px #0000004d,inset 0 2px 5px #ffffff80;margin-bottom:8px;transition:all .3s ease;position:relative;z-index:10;overflow:hidden}.avatar.has-image.svelte-h3uhc0{background:#f8f9fa;padding:2px}.avatar-image.svelte-h3uhc0{width:100%;height:100%;object-fit:cover;border-radius:50%}.avatar-emoji.svelte-h3uhc0{font-size:1.4rem;line-height:1}.avatar.thinking.svelte-h3uhc0{border-color:#ff6b35;animation:svelte-h3uhc0-thinking-pulse 1.5s infinite}.avatar.responding.svelte-h3uhc0{border-color:gold;animation:svelte-h3uhc0-speaking-glow 1s infinite}.avatar.speaking.svelte-h3uhc0{border-color:gold}.participant-name.svelte-h3uhc0{font-size:.75rem;font-weight:700;color:gold;text-shadow:0 2px 4px rgba(0,0,0,.8);text-align:center;white-space:nowrap;background:#0000004d;padding:2px 8px;border-radius:10px;border:1px solid #8b4513}.speech-bubble.svelte-h3uhc0{position:absolute;bottom:90px;left:50%;transform:translate(-50%) translateY(20px);background:#fff;border-radius:15px;padding:10px 14px;box-shadow:0 8px 25px #0000004d;z-index:20;opacity:0;transition:all .4s ease;pointer-events:none;border:2px solid #8b4513;min-width:180px;max-width:300px;word-wrap:break-word;white-space:normal}.speech-bubble.visible.svelte-h3uhc0{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.bubble-content.svelte-h3uhc0{font-size:.8rem;color:#333;line-height:1.4;text-align:left;max-height:100px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#8b4513 #f0f0f0}.bubble-content.svelte-h3uhc0::-webkit-scrollbar{width:6px}.bubble-content.svelte-h3uhc0::-webkit-scrollbar-track{background:#f0f0f0;border-radius:3px}.bubble-content.svelte-h3uhc0::-webkit-scrollbar-thumb{background:#8b4513;border-radius:3px}.bubble-content.svelte-h3uhc0::-webkit-scrollbar-thumb:hover{background:#654321}.bubble-arrow.svelte-h3uhc0{position:absolute;bottom:-10px;left:50%;transform:translate(-50%);width:0;height:0;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid white}.bubble-arrow.svelte-h3uhc0:before{content:"";position:absolute;bottom:2px;left:50%;transform:translate(-50%);width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid #8b4513}@keyframes svelte-h3uhc0-thinking-pulse{0%,to{transform:scale(1);box-shadow:0 6px 15px #0000004d,0 0 15px #ff6b3566}50%{transform:scale(1.03);box-shadow:0 8px 20px #0006,0 0 25px #ff6b3599}}@keyframes svelte-h3uhc0-speaking-glow{0%,to{box-shadow:0 6px 15px #0000004d,0 0 20px #ffd70080}50%{box-shadow:0 8px 20px #0006,0 0 30px #ffd700cc}}
src/backend/gradio_consilium_roundtable/templates/example/index.js ADDED
@@ -0,0 +1,2186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var st = Object.defineProperty;
2
+ var ve = (r) => {
3
+ throw TypeError(r);
4
+ };
5
+ var it = (r, e, t) => e in r ? st(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
6
+ var _ = (r, e, t) => it(r, typeof e != "symbol" ? e + "" : e, t), lt = (r, e, t) => e.has(r) || ve("Cannot " + t);
7
+ var Te = (r, e, t) => e.has(r) ? ve("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t);
8
+ var ee = (r, e, t) => (lt(r, e, "access private method"), t);
9
+ function fe() {
10
+ return {
11
+ async: !1,
12
+ breaks: !1,
13
+ extensions: null,
14
+ gfm: !0,
15
+ hooks: null,
16
+ pedantic: !1,
17
+ renderer: null,
18
+ silent: !1,
19
+ tokenizer: null,
20
+ walkTokens: null
21
+ };
22
+ }
23
+ let O = fe();
24
+ function Be(r) {
25
+ O = r;
26
+ }
27
+ const De = /[&<>"']/, rt = new RegExp(De.source, "g"), Ze = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, ot = new RegExp(Ze.source, "g"), at = {
28
+ "&": "&amp;",
29
+ "<": "&lt;",
30
+ ">": "&gt;",
31
+ '"': "&quot;",
32
+ "'": "&#39;"
33
+ }, ze = (r) => at[r];
34
+ function C(r, e) {
35
+ if (e) {
36
+ if (De.test(r))
37
+ return r.replace(rt, ze);
38
+ } else if (Ze.test(r))
39
+ return r.replace(ot, ze);
40
+ return r;
41
+ }
42
+ const ct = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
43
+ function ht(r) {
44
+ return r.replace(ct, (e, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : ""));
45
+ }
46
+ const ut = /(^|[^\[])\^/g;
47
+ function w(r, e) {
48
+ let t = typeof r == "string" ? r : r.source;
49
+ e = e || "";
50
+ const n = {
51
+ replace: (i, l) => {
52
+ let s = typeof l == "string" ? l : l.source;
53
+ return s = s.replace(ut, "$1"), t = t.replace(i, s), n;
54
+ },
55
+ getRegex: () => new RegExp(t, e)
56
+ };
57
+ return n;
58
+ }
59
+ function Ie(r) {
60
+ try {
61
+ r = encodeURI(r).replace(/%25/g, "%");
62
+ } catch {
63
+ return null;
64
+ }
65
+ return r;
66
+ }
67
+ const F = { exec: () => null };
68
+ function Re(r, e) {
69
+ const t = r.replace(/\|/g, (l, s, o) => {
70
+ let a = !1, u = s;
71
+ for (; --u >= 0 && o[u] === "\\"; )
72
+ a = !a;
73
+ return a ? "|" : " |";
74
+ }), n = t.split(/ \|/);
75
+ let i = 0;
76
+ if (n[0].trim() || n.shift(), n.length > 0 && !n[n.length - 1].trim() && n.pop(), e)
77
+ if (n.length > e)
78
+ n.splice(e);
79
+ else
80
+ for (; n.length < e; )
81
+ n.push("");
82
+ for (; i < n.length; i++)
83
+ n[i] = n[i].trim().replace(/\\\|/g, "|");
84
+ return n;
85
+ }
86
+ function te(r, e, t) {
87
+ const n = r.length;
88
+ if (n === 0)
89
+ return "";
90
+ let i = 0;
91
+ for (; i < n && r.charAt(n - i - 1) === e; )
92
+ i++;
93
+ return r.slice(0, n - i);
94
+ }
95
+ function pt(r, e) {
96
+ if (r.indexOf(e[1]) === -1)
97
+ return -1;
98
+ let t = 0;
99
+ for (let n = 0; n < r.length; n++)
100
+ if (r[n] === "\\")
101
+ n++;
102
+ else if (r[n] === e[0])
103
+ t++;
104
+ else if (r[n] === e[1] && (t--, t < 0))
105
+ return n;
106
+ return -1;
107
+ }
108
+ function Se(r, e, t, n) {
109
+ const i = e.href, l = e.title ? C(e.title) : null, s = r[1].replace(/\\([\[\]])/g, "$1");
110
+ if (r[0].charAt(0) !== "!") {
111
+ n.state.inLink = !0;
112
+ const o = {
113
+ type: "link",
114
+ raw: t,
115
+ href: i,
116
+ title: l,
117
+ text: s,
118
+ tokens: n.inlineTokens(s)
119
+ };
120
+ return n.state.inLink = !1, o;
121
+ }
122
+ return {
123
+ type: "image",
124
+ raw: t,
125
+ href: i,
126
+ title: l,
127
+ text: C(s)
128
+ };
129
+ }
130
+ function ft(r, e) {
131
+ const t = r.match(/^(\s+)(?:```)/);
132
+ if (t === null)
133
+ return e;
134
+ const n = t[1];
135
+ return e.split(`
136
+ `).map((i) => {
137
+ const l = i.match(/^\s+/);
138
+ if (l === null)
139
+ return i;
140
+ const [s] = l;
141
+ return s.length >= n.length ? i.slice(n.length) : i;
142
+ }).join(`
143
+ `);
144
+ }
145
+ class se {
146
+ // set by the lexer
147
+ constructor(e) {
148
+ _(this, "options");
149
+ _(this, "rules");
150
+ // set by the lexer
151
+ _(this, "lexer");
152
+ this.options = e || O;
153
+ }
154
+ space(e) {
155
+ const t = this.rules.block.newline.exec(e);
156
+ if (t && t[0].length > 0)
157
+ return {
158
+ type: "space",
159
+ raw: t[0]
160
+ };
161
+ }
162
+ code(e) {
163
+ const t = this.rules.block.code.exec(e);
164
+ if (t) {
165
+ const n = t[0].replace(/^ {1,4}/gm, "");
166
+ return {
167
+ type: "code",
168
+ raw: t[0],
169
+ codeBlockStyle: "indented",
170
+ text: this.options.pedantic ? n : te(n, `
171
+ `)
172
+ };
173
+ }
174
+ }
175
+ fences(e) {
176
+ const t = this.rules.block.fences.exec(e);
177
+ if (t) {
178
+ const n = t[0], i = ft(n, t[3] || "");
179
+ return {
180
+ type: "code",
181
+ raw: n,
182
+ lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
183
+ text: i
184
+ };
185
+ }
186
+ }
187
+ heading(e) {
188
+ const t = this.rules.block.heading.exec(e);
189
+ if (t) {
190
+ let n = t[2].trim();
191
+ if (/#$/.test(n)) {
192
+ const i = te(n, "#");
193
+ (this.options.pedantic || !i || / $/.test(i)) && (n = i.trim());
194
+ }
195
+ return {
196
+ type: "heading",
197
+ raw: t[0],
198
+ depth: t[1].length,
199
+ text: n,
200
+ tokens: this.lexer.inline(n)
201
+ };
202
+ }
203
+ }
204
+ hr(e) {
205
+ const t = this.rules.block.hr.exec(e);
206
+ if (t)
207
+ return {
208
+ type: "hr",
209
+ raw: t[0]
210
+ };
211
+ }
212
+ blockquote(e) {
213
+ const t = this.rules.block.blockquote.exec(e);
214
+ if (t) {
215
+ let n = t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
216
+ $1`);
217
+ n = te(n.replace(/^ *>[ \t]?/gm, ""), `
218
+ `);
219
+ const i = this.lexer.state.top;
220
+ this.lexer.state.top = !0;
221
+ const l = this.lexer.blockTokens(n);
222
+ return this.lexer.state.top = i, {
223
+ type: "blockquote",
224
+ raw: t[0],
225
+ tokens: l,
226
+ text: n
227
+ };
228
+ }
229
+ }
230
+ list(e) {
231
+ let t = this.rules.block.list.exec(e);
232
+ if (t) {
233
+ let n = t[1].trim();
234
+ const i = n.length > 1, l = {
235
+ type: "list",
236
+ raw: "",
237
+ ordered: i,
238
+ start: i ? +n.slice(0, -1) : "",
239
+ loose: !1,
240
+ items: []
241
+ };
242
+ n = i ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = i ? n : "[*+-]");
243
+ const s = new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);
244
+ let o = "", a = "", u = !1;
245
+ for (; e; ) {
246
+ let c = !1;
247
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e))
248
+ break;
249
+ o = t[0], e = e.substring(o.length);
250
+ let h = t[2].split(`
251
+ `, 1)[0].replace(/^\t+/, (L) => " ".repeat(3 * L.length)), p = e.split(`
252
+ `, 1)[0], g = 0;
253
+ this.options.pedantic ? (g = 2, a = h.trimStart()) : (g = t[2].search(/[^ ]/), g = g > 4 ? 1 : g, a = h.slice(g), g += t[1].length);
254
+ let x = !1;
255
+ if (!h && /^ *$/.test(p) && (o += p + `
256
+ `, e = e.substring(p.length + 1), c = !0), !c) {
257
+ const L = new RegExp(`^ {0,${Math.min(3, g - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), T = new RegExp(`^ {0,${Math.min(3, g - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), d = new RegExp(`^ {0,${Math.min(3, g - 1)}}(?:\`\`\`|~~~)`), m = new RegExp(`^ {0,${Math.min(3, g - 1)}}#`);
258
+ for (; e; ) {
259
+ const R = e.split(`
260
+ `, 1)[0];
261
+ if (p = R, this.options.pedantic && (p = p.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), d.test(p) || m.test(p) || L.test(p) || T.test(e))
262
+ break;
263
+ if (p.search(/[^ ]/) >= g || !p.trim())
264
+ a += `
265
+ ` + p.slice(g);
266
+ else {
267
+ if (x || h.search(/[^ ]/) >= 4 || d.test(h) || m.test(h) || T.test(h))
268
+ break;
269
+ a += `
270
+ ` + p;
271
+ }
272
+ !x && !p.trim() && (x = !0), o += R + `
273
+ `, e = e.substring(R.length + 1), h = p.slice(g);
274
+ }
275
+ }
276
+ l.loose || (u ? l.loose = !0 : /\n *\n *$/.test(o) && (u = !0));
277
+ let y = null, z;
278
+ this.options.gfm && (y = /^\[[ xX]\] /.exec(a), y && (z = y[0] !== "[ ] ", a = a.replace(/^\[[ xX]\] +/, ""))), l.items.push({
279
+ type: "list_item",
280
+ raw: o,
281
+ task: !!y,
282
+ checked: z,
283
+ loose: !1,
284
+ text: a,
285
+ tokens: []
286
+ }), l.raw += o;
287
+ }
288
+ l.items[l.items.length - 1].raw = o.trimEnd(), l.items[l.items.length - 1].text = a.trimEnd(), l.raw = l.raw.trimEnd();
289
+ for (let c = 0; c < l.items.length; c++)
290
+ if (this.lexer.state.top = !1, l.items[c].tokens = this.lexer.blockTokens(l.items[c].text, []), !l.loose) {
291
+ const h = l.items[c].tokens.filter((g) => g.type === "space"), p = h.length > 0 && h.some((g) => /\n.*\n/.test(g.raw));
292
+ l.loose = p;
293
+ }
294
+ if (l.loose)
295
+ for (let c = 0; c < l.items.length; c++)
296
+ l.items[c].loose = !0;
297
+ return l;
298
+ }
299
+ }
300
+ html(e) {
301
+ const t = this.rules.block.html.exec(e);
302
+ if (t)
303
+ return {
304
+ type: "html",
305
+ block: !0,
306
+ raw: t[0],
307
+ pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
308
+ text: t[0]
309
+ };
310
+ }
311
+ def(e) {
312
+ const t = this.rules.block.def.exec(e);
313
+ if (t) {
314
+ const n = t[1].toLowerCase().replace(/\s+/g, " "), i = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", l = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
315
+ return {
316
+ type: "def",
317
+ tag: n,
318
+ raw: t[0],
319
+ href: i,
320
+ title: l
321
+ };
322
+ }
323
+ }
324
+ table(e) {
325
+ const t = this.rules.block.table.exec(e);
326
+ if (!t || !/[:|]/.test(t[2]))
327
+ return;
328
+ const n = Re(t[1]), i = t[2].replace(/^\||\| *$/g, "").split("|"), l = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
329
+ `) : [], s = {
330
+ type: "table",
331
+ raw: t[0],
332
+ header: [],
333
+ align: [],
334
+ rows: []
335
+ };
336
+ if (n.length === i.length) {
337
+ for (const o of i)
338
+ /^ *-+: *$/.test(o) ? s.align.push("right") : /^ *:-+: *$/.test(o) ? s.align.push("center") : /^ *:-+ *$/.test(o) ? s.align.push("left") : s.align.push(null);
339
+ for (const o of n)
340
+ s.header.push({
341
+ text: o,
342
+ tokens: this.lexer.inline(o)
343
+ });
344
+ for (const o of l)
345
+ s.rows.push(Re(o, s.header.length).map((a) => ({
346
+ text: a,
347
+ tokens: this.lexer.inline(a)
348
+ })));
349
+ return s;
350
+ }
351
+ }
352
+ lheading(e) {
353
+ const t = this.rules.block.lheading.exec(e);
354
+ if (t)
355
+ return {
356
+ type: "heading",
357
+ raw: t[0],
358
+ depth: t[2].charAt(0) === "=" ? 1 : 2,
359
+ text: t[1],
360
+ tokens: this.lexer.inline(t[1])
361
+ };
362
+ }
363
+ paragraph(e) {
364
+ const t = this.rules.block.paragraph.exec(e);
365
+ if (t) {
366
+ const n = t[1].charAt(t[1].length - 1) === `
367
+ ` ? t[1].slice(0, -1) : t[1];
368
+ return {
369
+ type: "paragraph",
370
+ raw: t[0],
371
+ text: n,
372
+ tokens: this.lexer.inline(n)
373
+ };
374
+ }
375
+ }
376
+ text(e) {
377
+ const t = this.rules.block.text.exec(e);
378
+ if (t)
379
+ return {
380
+ type: "text",
381
+ raw: t[0],
382
+ text: t[0],
383
+ tokens: this.lexer.inline(t[0])
384
+ };
385
+ }
386
+ escape(e) {
387
+ const t = this.rules.inline.escape.exec(e);
388
+ if (t)
389
+ return {
390
+ type: "escape",
391
+ raw: t[0],
392
+ text: C(t[1])
393
+ };
394
+ }
395
+ tag(e) {
396
+ const t = this.rules.inline.tag.exec(e);
397
+ if (t)
398
+ return !this.lexer.state.inLink && /^<a /i.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
399
+ type: "html",
400
+ raw: t[0],
401
+ inLink: this.lexer.state.inLink,
402
+ inRawBlock: this.lexer.state.inRawBlock,
403
+ block: !1,
404
+ text: t[0]
405
+ };
406
+ }
407
+ link(e) {
408
+ const t = this.rules.inline.link.exec(e);
409
+ if (t) {
410
+ const n = t[2].trim();
411
+ if (!this.options.pedantic && /^</.test(n)) {
412
+ if (!/>$/.test(n))
413
+ return;
414
+ const s = te(n.slice(0, -1), "\\");
415
+ if ((n.length - s.length) % 2 === 0)
416
+ return;
417
+ } else {
418
+ const s = pt(t[2], "()");
419
+ if (s > -1) {
420
+ const a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
421
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, a).trim(), t[3] = "";
422
+ }
423
+ }
424
+ let i = t[2], l = "";
425
+ if (this.options.pedantic) {
426
+ const s = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);
427
+ s && (i = s[1], l = s[3]);
428
+ } else
429
+ l = t[3] ? t[3].slice(1, -1) : "";
430
+ return i = i.trim(), /^</.test(i) && (this.options.pedantic && !/>$/.test(n) ? i = i.slice(1) : i = i.slice(1, -1)), Se(t, {
431
+ href: i && i.replace(this.rules.inline.anyPunctuation, "$1"),
432
+ title: l && l.replace(this.rules.inline.anyPunctuation, "$1")
433
+ }, t[0], this.lexer);
434
+ }
435
+ }
436
+ reflink(e, t) {
437
+ let n;
438
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
439
+ const i = (n[2] || n[1]).replace(/\s+/g, " "), l = t[i.toLowerCase()];
440
+ if (!l) {
441
+ const s = n[0].charAt(0);
442
+ return {
443
+ type: "text",
444
+ raw: s,
445
+ text: s
446
+ };
447
+ }
448
+ return Se(n, l, n[0], this.lexer);
449
+ }
450
+ }
451
+ emStrong(e, t, n = "") {
452
+ let i = this.rules.inline.emStrongLDelim.exec(e);
453
+ if (!i || i[3] && n.match(/[\p{L}\p{N}]/u))
454
+ return;
455
+ if (!(i[1] || i[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
456
+ const s = [...i[0]].length - 1;
457
+ let o, a, u = s, c = 0;
458
+ const h = i[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
459
+ for (h.lastIndex = 0, t = t.slice(-1 * e.length + s); (i = h.exec(t)) != null; ) {
460
+ if (o = i[1] || i[2] || i[3] || i[4] || i[5] || i[6], !o)
461
+ continue;
462
+ if (a = [...o].length, i[3] || i[4]) {
463
+ u += a;
464
+ continue;
465
+ } else if ((i[5] || i[6]) && s % 3 && !((s + a) % 3)) {
466
+ c += a;
467
+ continue;
468
+ }
469
+ if (u -= a, u > 0)
470
+ continue;
471
+ a = Math.min(a, a + u + c);
472
+ const p = [...i[0]][0].length, g = e.slice(0, s + i.index + p + a);
473
+ if (Math.min(s, a) % 2) {
474
+ const y = g.slice(1, -1);
475
+ return {
476
+ type: "em",
477
+ raw: g,
478
+ text: y,
479
+ tokens: this.lexer.inlineTokens(y)
480
+ };
481
+ }
482
+ const x = g.slice(2, -2);
483
+ return {
484
+ type: "strong",
485
+ raw: g,
486
+ text: x,
487
+ tokens: this.lexer.inlineTokens(x)
488
+ };
489
+ }
490
+ }
491
+ }
492
+ codespan(e) {
493
+ const t = this.rules.inline.code.exec(e);
494
+ if (t) {
495
+ let n = t[2].replace(/\n/g, " ");
496
+ const i = /[^ ]/.test(n), l = /^ /.test(n) && / $/.test(n);
497
+ return i && l && (n = n.substring(1, n.length - 1)), n = C(n, !0), {
498
+ type: "codespan",
499
+ raw: t[0],
500
+ text: n
501
+ };
502
+ }
503
+ }
504
+ br(e) {
505
+ const t = this.rules.inline.br.exec(e);
506
+ if (t)
507
+ return {
508
+ type: "br",
509
+ raw: t[0]
510
+ };
511
+ }
512
+ del(e) {
513
+ const t = this.rules.inline.del.exec(e);
514
+ if (t)
515
+ return {
516
+ type: "del",
517
+ raw: t[0],
518
+ text: t[2],
519
+ tokens: this.lexer.inlineTokens(t[2])
520
+ };
521
+ }
522
+ autolink(e) {
523
+ const t = this.rules.inline.autolink.exec(e);
524
+ if (t) {
525
+ let n, i;
526
+ return t[2] === "@" ? (n = C(t[1]), i = "mailto:" + n) : (n = C(t[1]), i = n), {
527
+ type: "link",
528
+ raw: t[0],
529
+ text: n,
530
+ href: i,
531
+ tokens: [
532
+ {
533
+ type: "text",
534
+ raw: n,
535
+ text: n
536
+ }
537
+ ]
538
+ };
539
+ }
540
+ }
541
+ url(e) {
542
+ var n;
543
+ let t;
544
+ if (t = this.rules.inline.url.exec(e)) {
545
+ let i, l;
546
+ if (t[2] === "@")
547
+ i = C(t[0]), l = "mailto:" + i;
548
+ else {
549
+ let s;
550
+ do
551
+ s = t[0], t[0] = ((n = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : n[0]) ?? "";
552
+ while (s !== t[0]);
553
+ i = C(t[0]), t[1] === "www." ? l = "http://" + t[0] : l = t[0];
554
+ }
555
+ return {
556
+ type: "link",
557
+ raw: t[0],
558
+ text: i,
559
+ href: l,
560
+ tokens: [
561
+ {
562
+ type: "text",
563
+ raw: i,
564
+ text: i
565
+ }
566
+ ]
567
+ };
568
+ }
569
+ }
570
+ inlineText(e) {
571
+ const t = this.rules.inline.text.exec(e);
572
+ if (t) {
573
+ let n;
574
+ return this.lexer.state.inRawBlock ? n = t[0] : n = C(t[0]), {
575
+ type: "text",
576
+ raw: t[0],
577
+ text: n
578
+ };
579
+ }
580
+ }
581
+ }
582
+ const gt = /^(?: *(?:\n|$))+/, dt = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, kt = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, W = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, mt = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Oe = /(?:[*+-]|\d{1,9}[.)])/, je = w(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, Oe).replace(/blockCode/g, / {4}/).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/).getRegex(), ge = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, bt = /^[^\n]+/, de = /(?!\s*\])(?:\\.|[^\[\]\\])+/, wt = w(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", de).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), _t = w(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Oe).getRegex(), oe = "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", ke = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, xt = w("^ {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", ke).replace("tag", oe).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Qe = w(ge).replace("hr", W).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", oe).getRegex(), yt = w(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Qe).getRegex(), me = {
583
+ blockquote: yt,
584
+ code: dt,
585
+ def: wt,
586
+ fences: kt,
587
+ heading: mt,
588
+ hr: W,
589
+ html: xt,
590
+ lheading: je,
591
+ list: _t,
592
+ newline: gt,
593
+ paragraph: Qe,
594
+ table: F,
595
+ text: bt
596
+ }, Ae = w("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", W).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\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", oe).getRegex(), vt = {
597
+ ...me,
598
+ table: Ae,
599
+ paragraph: w(ge).replace("hr", W).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Ae).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", oe).getRegex()
600
+ }, Tt = {
601
+ ...me,
602
+ html: w(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ke).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(),
603
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
604
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
605
+ fences: F,
606
+ // fences not supported
607
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
608
+ paragraph: w(ge).replace("hr", W).replace("heading", ` *#{1,6} *[^
609
+ ]`).replace("lheading", je).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
610
+ }, Ne = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, zt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Ve = /^( {2,}|\\)\n(?!\s*$)/, It = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, U = "\\p{P}\\p{S}", Rt = w(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, U).getRegex(), St = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g, At = w(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, U).getRegex(), Et = w("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, U).getRegex(), $t = w("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, U).getRegex(), Ct = w(/\\([punct])/, "gu").replace(/punct/g, U).getRegex(), Lt = w(/^<(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(), Mt = w(ke).replace("(?:-->|$)", "-->").getRegex(), Pt = w("^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", Mt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), ie = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, qt = w(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", ie).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), He = w(/^!?\[(label)\]\[(ref)\]/).replace("label", ie).replace("ref", de).getRegex(), Fe = w(/^!?\[(ref)\](?:\[\])?/).replace("ref", de).getRegex(), Bt = w("reflink|nolink(?!\\()", "g").replace("reflink", He).replace("nolink", Fe).getRegex(), be = {
611
+ _backpedal: F,
612
+ // only used for GFM url
613
+ anyPunctuation: Ct,
614
+ autolink: Lt,
615
+ blockSkip: St,
616
+ br: Ve,
617
+ code: zt,
618
+ del: F,
619
+ emStrongLDelim: At,
620
+ emStrongRDelimAst: Et,
621
+ emStrongRDelimUnd: $t,
622
+ escape: Ne,
623
+ link: qt,
624
+ nolink: Fe,
625
+ punctuation: Rt,
626
+ reflink: He,
627
+ reflinkSearch: Bt,
628
+ tag: Pt,
629
+ text: It,
630
+ url: F
631
+ }, Dt = {
632
+ ...be,
633
+ link: w(/^!?\[(label)\]\((.*?)\)/).replace("label", ie).getRegex(),
634
+ reflink: w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", ie).getRegex()
635
+ }, ue = {
636
+ ...be,
637
+ escape: w(Ne).replace("])", "~|])").getRegex(),
638
+ url: w(/^((?: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(),
639
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
640
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
641
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
642
+ }, Zt = {
643
+ ...ue,
644
+ br: w(Ve).replace("{2,}", "*").getRegex(),
645
+ text: w(ue.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
646
+ }, ne = {
647
+ normal: me,
648
+ gfm: vt,
649
+ pedantic: Tt
650
+ }, H = {
651
+ normal: be,
652
+ gfm: ue,
653
+ breaks: Zt,
654
+ pedantic: Dt
655
+ };
656
+ class P {
657
+ constructor(e) {
658
+ _(this, "tokens");
659
+ _(this, "options");
660
+ _(this, "state");
661
+ _(this, "tokenizer");
662
+ _(this, "inlineQueue");
663
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || O, this.options.tokenizer = this.options.tokenizer || new se(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
664
+ inLink: !1,
665
+ inRawBlock: !1,
666
+ top: !0
667
+ };
668
+ const t = {
669
+ block: ne.normal,
670
+ inline: H.normal
671
+ };
672
+ this.options.pedantic ? (t.block = ne.pedantic, t.inline = H.pedantic) : this.options.gfm && (t.block = ne.gfm, this.options.breaks ? t.inline = H.breaks : t.inline = H.gfm), this.tokenizer.rules = t;
673
+ }
674
+ /**
675
+ * Expose Rules
676
+ */
677
+ static get rules() {
678
+ return {
679
+ block: ne,
680
+ inline: H
681
+ };
682
+ }
683
+ /**
684
+ * Static Lex Method
685
+ */
686
+ static lex(e, t) {
687
+ return new P(t).lex(e);
688
+ }
689
+ /**
690
+ * Static Lex Inline Method
691
+ */
692
+ static lexInline(e, t) {
693
+ return new P(t).inlineTokens(e);
694
+ }
695
+ /**
696
+ * Preprocessing
697
+ */
698
+ lex(e) {
699
+ e = e.replace(/\r\n|\r/g, `
700
+ `), this.blockTokens(e, this.tokens);
701
+ for (let t = 0; t < this.inlineQueue.length; t++) {
702
+ const n = this.inlineQueue[t];
703
+ this.inlineTokens(n.src, n.tokens);
704
+ }
705
+ return this.inlineQueue = [], this.tokens;
706
+ }
707
+ blockTokens(e, t = []) {
708
+ this.options.pedantic ? e = e.replace(/\t/g, " ").replace(/^ +$/gm, "") : e = e.replace(/^( *)(\t+)/gm, (o, a, u) => a + " ".repeat(u.length));
709
+ let n, i, l, s;
710
+ for (; e; )
711
+ if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((o) => (n = o.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
712
+ if (n = this.tokenizer.space(e)) {
713
+ e = e.substring(n.raw.length), n.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += `
714
+ ` : t.push(n);
715
+ continue;
716
+ }
717
+ if (n = this.tokenizer.code(e)) {
718
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
719
+ ` + n.raw, i.text += `
720
+ ` + n.text, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
721
+ continue;
722
+ }
723
+ if (n = this.tokenizer.fences(e)) {
724
+ e = e.substring(n.raw.length), t.push(n);
725
+ continue;
726
+ }
727
+ if (n = this.tokenizer.heading(e)) {
728
+ e = e.substring(n.raw.length), t.push(n);
729
+ continue;
730
+ }
731
+ if (n = this.tokenizer.hr(e)) {
732
+ e = e.substring(n.raw.length), t.push(n);
733
+ continue;
734
+ }
735
+ if (n = this.tokenizer.blockquote(e)) {
736
+ e = e.substring(n.raw.length), t.push(n);
737
+ continue;
738
+ }
739
+ if (n = this.tokenizer.list(e)) {
740
+ e = e.substring(n.raw.length), t.push(n);
741
+ continue;
742
+ }
743
+ if (n = this.tokenizer.html(e)) {
744
+ e = e.substring(n.raw.length), t.push(n);
745
+ continue;
746
+ }
747
+ if (n = this.tokenizer.def(e)) {
748
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
749
+ ` + n.raw, i.text += `
750
+ ` + n.raw, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : this.tokens.links[n.tag] || (this.tokens.links[n.tag] = {
751
+ href: n.href,
752
+ title: n.title
753
+ });
754
+ continue;
755
+ }
756
+ if (n = this.tokenizer.table(e)) {
757
+ e = e.substring(n.raw.length), t.push(n);
758
+ continue;
759
+ }
760
+ if (n = this.tokenizer.lheading(e)) {
761
+ e = e.substring(n.raw.length), t.push(n);
762
+ continue;
763
+ }
764
+ if (l = e, this.options.extensions && this.options.extensions.startBlock) {
765
+ let o = 1 / 0;
766
+ const a = e.slice(1);
767
+ let u;
768
+ this.options.extensions.startBlock.forEach((c) => {
769
+ u = c.call({ lexer: this }, a), typeof u == "number" && u >= 0 && (o = Math.min(o, u));
770
+ }), o < 1 / 0 && o >= 0 && (l = e.substring(0, o + 1));
771
+ }
772
+ if (this.state.top && (n = this.tokenizer.paragraph(l))) {
773
+ i = t[t.length - 1], s && i.type === "paragraph" ? (i.raw += `
774
+ ` + n.raw, i.text += `
775
+ ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n), s = l.length !== e.length, e = e.substring(n.raw.length);
776
+ continue;
777
+ }
778
+ if (n = this.tokenizer.text(e)) {
779
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && i.type === "text" ? (i.raw += `
780
+ ` + n.raw, i.text += `
781
+ ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
782
+ continue;
783
+ }
784
+ if (e) {
785
+ const o = "Infinite loop on byte: " + e.charCodeAt(0);
786
+ if (this.options.silent) {
787
+ console.error(o);
788
+ break;
789
+ } else
790
+ throw new Error(o);
791
+ }
792
+ }
793
+ return this.state.top = !0, t;
794
+ }
795
+ inline(e, t = []) {
796
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
797
+ }
798
+ /**
799
+ * Lexing/Compiling
800
+ */
801
+ inlineTokens(e, t = []) {
802
+ let n, i, l, s = e, o, a, u;
803
+ if (this.tokens.links) {
804
+ const c = Object.keys(this.tokens.links);
805
+ if (c.length > 0)
806
+ for (; (o = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; )
807
+ c.includes(o[0].slice(o[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
808
+ }
809
+ for (; (o = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; )
810
+ s = s.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
811
+ for (; (o = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; )
812
+ s = s.slice(0, o.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
813
+ for (; e; )
814
+ if (a || (u = ""), a = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((c) => (n = c.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
815
+ if (n = this.tokenizer.escape(e)) {
816
+ e = e.substring(n.raw.length), t.push(n);
817
+ continue;
818
+ }
819
+ if (n = this.tokenizer.tag(e)) {
820
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
821
+ continue;
822
+ }
823
+ if (n = this.tokenizer.link(e)) {
824
+ e = e.substring(n.raw.length), t.push(n);
825
+ continue;
826
+ }
827
+ if (n = this.tokenizer.reflink(e, this.tokens.links)) {
828
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
829
+ continue;
830
+ }
831
+ if (n = this.tokenizer.emStrong(e, s, u)) {
832
+ e = e.substring(n.raw.length), t.push(n);
833
+ continue;
834
+ }
835
+ if (n = this.tokenizer.codespan(e)) {
836
+ e = e.substring(n.raw.length), t.push(n);
837
+ continue;
838
+ }
839
+ if (n = this.tokenizer.br(e)) {
840
+ e = e.substring(n.raw.length), t.push(n);
841
+ continue;
842
+ }
843
+ if (n = this.tokenizer.del(e)) {
844
+ e = e.substring(n.raw.length), t.push(n);
845
+ continue;
846
+ }
847
+ if (n = this.tokenizer.autolink(e)) {
848
+ e = e.substring(n.raw.length), t.push(n);
849
+ continue;
850
+ }
851
+ if (!this.state.inLink && (n = this.tokenizer.url(e))) {
852
+ e = e.substring(n.raw.length), t.push(n);
853
+ continue;
854
+ }
855
+ if (l = e, this.options.extensions && this.options.extensions.startInline) {
856
+ let c = 1 / 0;
857
+ const h = e.slice(1);
858
+ let p;
859
+ this.options.extensions.startInline.forEach((g) => {
860
+ p = g.call({ lexer: this }, h), typeof p == "number" && p >= 0 && (c = Math.min(c, p));
861
+ }), c < 1 / 0 && c >= 0 && (l = e.substring(0, c + 1));
862
+ }
863
+ if (n = this.tokenizer.inlineText(l)) {
864
+ e = e.substring(n.raw.length), n.raw.slice(-1) !== "_" && (u = n.raw.slice(-1)), a = !0, i = t[t.length - 1], i && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
865
+ continue;
866
+ }
867
+ if (e) {
868
+ const c = "Infinite loop on byte: " + e.charCodeAt(0);
869
+ if (this.options.silent) {
870
+ console.error(c);
871
+ break;
872
+ } else
873
+ throw new Error(c);
874
+ }
875
+ }
876
+ return t;
877
+ }
878
+ }
879
+ class le {
880
+ constructor(e) {
881
+ _(this, "options");
882
+ this.options = e || O;
883
+ }
884
+ code(e, t, n) {
885
+ var l;
886
+ const i = (l = (t || "").match(/^\S*/)) == null ? void 0 : l[0];
887
+ return e = e.replace(/\n$/, "") + `
888
+ `, i ? '<pre><code class="language-' + C(i) + '">' + (n ? e : C(e, !0)) + `</code></pre>
889
+ ` : "<pre><code>" + (n ? e : C(e, !0)) + `</code></pre>
890
+ `;
891
+ }
892
+ blockquote(e) {
893
+ return `<blockquote>
894
+ ${e}</blockquote>
895
+ `;
896
+ }
897
+ html(e, t) {
898
+ return e;
899
+ }
900
+ heading(e, t, n) {
901
+ return `<h${t}>${e}</h${t}>
902
+ `;
903
+ }
904
+ hr() {
905
+ return `<hr>
906
+ `;
907
+ }
908
+ list(e, t, n) {
909
+ const i = t ? "ol" : "ul", l = t && n !== 1 ? ' start="' + n + '"' : "";
910
+ return "<" + i + l + `>
911
+ ` + e + "</" + i + `>
912
+ `;
913
+ }
914
+ listitem(e, t, n) {
915
+ return `<li>${e}</li>
916
+ `;
917
+ }
918
+ checkbox(e) {
919
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
920
+ }
921
+ paragraph(e) {
922
+ return `<p>${e}</p>
923
+ `;
924
+ }
925
+ table(e, t) {
926
+ return t && (t = `<tbody>${t}</tbody>`), `<table>
927
+ <thead>
928
+ ` + e + `</thead>
929
+ ` + t + `</table>
930
+ `;
931
+ }
932
+ tablerow(e) {
933
+ return `<tr>
934
+ ${e}</tr>
935
+ `;
936
+ }
937
+ tablecell(e, t) {
938
+ const n = t.header ? "th" : "td";
939
+ return (t.align ? `<${n} align="${t.align}">` : `<${n}>`) + e + `</${n}>
940
+ `;
941
+ }
942
+ /**
943
+ * span level renderer
944
+ */
945
+ strong(e) {
946
+ return `<strong>${e}</strong>`;
947
+ }
948
+ em(e) {
949
+ return `<em>${e}</em>`;
950
+ }
951
+ codespan(e) {
952
+ return `<code>${e}</code>`;
953
+ }
954
+ br() {
955
+ return "<br>";
956
+ }
957
+ del(e) {
958
+ return `<del>${e}</del>`;
959
+ }
960
+ link(e, t, n) {
961
+ const i = Ie(e);
962
+ if (i === null)
963
+ return n;
964
+ e = i;
965
+ let l = '<a href="' + e + '"';
966
+ return t && (l += ' title="' + t + '"'), l += ">" + n + "</a>", l;
967
+ }
968
+ image(e, t, n) {
969
+ const i = Ie(e);
970
+ if (i === null)
971
+ return n;
972
+ e = i;
973
+ let l = `<img src="${e}" alt="${n}"`;
974
+ return t && (l += ` title="${t}"`), l += ">", l;
975
+ }
976
+ text(e) {
977
+ return e;
978
+ }
979
+ }
980
+ class we {
981
+ // no need for block level renderers
982
+ strong(e) {
983
+ return e;
984
+ }
985
+ em(e) {
986
+ return e;
987
+ }
988
+ codespan(e) {
989
+ return e;
990
+ }
991
+ del(e) {
992
+ return e;
993
+ }
994
+ html(e) {
995
+ return e;
996
+ }
997
+ text(e) {
998
+ return e;
999
+ }
1000
+ link(e, t, n) {
1001
+ return "" + n;
1002
+ }
1003
+ image(e, t, n) {
1004
+ return "" + n;
1005
+ }
1006
+ br() {
1007
+ return "";
1008
+ }
1009
+ }
1010
+ class q {
1011
+ constructor(e) {
1012
+ _(this, "options");
1013
+ _(this, "renderer");
1014
+ _(this, "textRenderer");
1015
+ this.options = e || O, this.options.renderer = this.options.renderer || new le(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new we();
1016
+ }
1017
+ /**
1018
+ * Static Parse Method
1019
+ */
1020
+ static parse(e, t) {
1021
+ return new q(t).parse(e);
1022
+ }
1023
+ /**
1024
+ * Static Parse Inline Method
1025
+ */
1026
+ static parseInline(e, t) {
1027
+ return new q(t).parseInline(e);
1028
+ }
1029
+ /**
1030
+ * Parse Loop
1031
+ */
1032
+ parse(e, t = !0) {
1033
+ let n = "";
1034
+ for (let i = 0; i < e.length; i++) {
1035
+ const l = e[i];
1036
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[l.type]) {
1037
+ const s = l, o = this.options.extensions.renderers[s.type].call({ parser: this }, s);
1038
+ if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(s.type)) {
1039
+ n += o || "";
1040
+ continue;
1041
+ }
1042
+ }
1043
+ switch (l.type) {
1044
+ case "space":
1045
+ continue;
1046
+ case "hr": {
1047
+ n += this.renderer.hr();
1048
+ continue;
1049
+ }
1050
+ case "heading": {
1051
+ const s = l;
1052
+ n += this.renderer.heading(this.parseInline(s.tokens), s.depth, ht(this.parseInline(s.tokens, this.textRenderer)));
1053
+ continue;
1054
+ }
1055
+ case "code": {
1056
+ const s = l;
1057
+ n += this.renderer.code(s.text, s.lang, !!s.escaped);
1058
+ continue;
1059
+ }
1060
+ case "table": {
1061
+ const s = l;
1062
+ let o = "", a = "";
1063
+ for (let c = 0; c < s.header.length; c++)
1064
+ a += this.renderer.tablecell(this.parseInline(s.header[c].tokens), { header: !0, align: s.align[c] });
1065
+ o += this.renderer.tablerow(a);
1066
+ let u = "";
1067
+ for (let c = 0; c < s.rows.length; c++) {
1068
+ const h = s.rows[c];
1069
+ a = "";
1070
+ for (let p = 0; p < h.length; p++)
1071
+ a += this.renderer.tablecell(this.parseInline(h[p].tokens), { header: !1, align: s.align[p] });
1072
+ u += this.renderer.tablerow(a);
1073
+ }
1074
+ n += this.renderer.table(o, u);
1075
+ continue;
1076
+ }
1077
+ case "blockquote": {
1078
+ const s = l, o = this.parse(s.tokens);
1079
+ n += this.renderer.blockquote(o);
1080
+ continue;
1081
+ }
1082
+ case "list": {
1083
+ const s = l, o = s.ordered, a = s.start, u = s.loose;
1084
+ let c = "";
1085
+ for (let h = 0; h < s.items.length; h++) {
1086
+ const p = s.items[h], g = p.checked, x = p.task;
1087
+ let y = "";
1088
+ if (p.task) {
1089
+ const z = this.renderer.checkbox(!!g);
1090
+ u ? p.tokens.length > 0 && p.tokens[0].type === "paragraph" ? (p.tokens[0].text = z + " " + p.tokens[0].text, p.tokens[0].tokens && p.tokens[0].tokens.length > 0 && p.tokens[0].tokens[0].type === "text" && (p.tokens[0].tokens[0].text = z + " " + p.tokens[0].tokens[0].text)) : p.tokens.unshift({
1091
+ type: "text",
1092
+ text: z + " "
1093
+ }) : y += z + " ";
1094
+ }
1095
+ y += this.parse(p.tokens, u), c += this.renderer.listitem(y, x, !!g);
1096
+ }
1097
+ n += this.renderer.list(c, o, a);
1098
+ continue;
1099
+ }
1100
+ case "html": {
1101
+ const s = l;
1102
+ n += this.renderer.html(s.text, s.block);
1103
+ continue;
1104
+ }
1105
+ case "paragraph": {
1106
+ const s = l;
1107
+ n += this.renderer.paragraph(this.parseInline(s.tokens));
1108
+ continue;
1109
+ }
1110
+ case "text": {
1111
+ let s = l, o = s.tokens ? this.parseInline(s.tokens) : s.text;
1112
+ for (; i + 1 < e.length && e[i + 1].type === "text"; )
1113
+ s = e[++i], o += `
1114
+ ` + (s.tokens ? this.parseInline(s.tokens) : s.text);
1115
+ n += t ? this.renderer.paragraph(o) : o;
1116
+ continue;
1117
+ }
1118
+ default: {
1119
+ const s = 'Token with "' + l.type + '" type was not found.';
1120
+ if (this.options.silent)
1121
+ return console.error(s), "";
1122
+ throw new Error(s);
1123
+ }
1124
+ }
1125
+ }
1126
+ return n;
1127
+ }
1128
+ /**
1129
+ * Parse Inline Tokens
1130
+ */
1131
+ parseInline(e, t) {
1132
+ t = t || this.renderer;
1133
+ let n = "";
1134
+ for (let i = 0; i < e.length; i++) {
1135
+ const l = e[i];
1136
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[l.type]) {
1137
+ const s = this.options.extensions.renderers[l.type].call({ parser: this }, l);
1138
+ if (s !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
1139
+ n += s || "";
1140
+ continue;
1141
+ }
1142
+ }
1143
+ switch (l.type) {
1144
+ case "escape": {
1145
+ const s = l;
1146
+ n += t.text(s.text);
1147
+ break;
1148
+ }
1149
+ case "html": {
1150
+ const s = l;
1151
+ n += t.html(s.text);
1152
+ break;
1153
+ }
1154
+ case "link": {
1155
+ const s = l;
1156
+ n += t.link(s.href, s.title, this.parseInline(s.tokens, t));
1157
+ break;
1158
+ }
1159
+ case "image": {
1160
+ const s = l;
1161
+ n += t.image(s.href, s.title, s.text);
1162
+ break;
1163
+ }
1164
+ case "strong": {
1165
+ const s = l;
1166
+ n += t.strong(this.parseInline(s.tokens, t));
1167
+ break;
1168
+ }
1169
+ case "em": {
1170
+ const s = l;
1171
+ n += t.em(this.parseInline(s.tokens, t));
1172
+ break;
1173
+ }
1174
+ case "codespan": {
1175
+ const s = l;
1176
+ n += t.codespan(s.text);
1177
+ break;
1178
+ }
1179
+ case "br": {
1180
+ n += t.br();
1181
+ break;
1182
+ }
1183
+ case "del": {
1184
+ const s = l;
1185
+ n += t.del(this.parseInline(s.tokens, t));
1186
+ break;
1187
+ }
1188
+ case "text": {
1189
+ const s = l;
1190
+ n += t.text(s.text);
1191
+ break;
1192
+ }
1193
+ default: {
1194
+ const s = 'Token with "' + l.type + '" type was not found.';
1195
+ if (this.options.silent)
1196
+ return console.error(s), "";
1197
+ throw new Error(s);
1198
+ }
1199
+ }
1200
+ }
1201
+ return n;
1202
+ }
1203
+ }
1204
+ class G {
1205
+ constructor(e) {
1206
+ _(this, "options");
1207
+ this.options = e || O;
1208
+ }
1209
+ /**
1210
+ * Process markdown before marked
1211
+ */
1212
+ preprocess(e) {
1213
+ return e;
1214
+ }
1215
+ /**
1216
+ * Process HTML after marked is finished
1217
+ */
1218
+ postprocess(e) {
1219
+ return e;
1220
+ }
1221
+ /**
1222
+ * Process all tokens before walk tokens
1223
+ */
1224
+ processAllTokens(e) {
1225
+ return e;
1226
+ }
1227
+ }
1228
+ _(G, "passThroughHooks", /* @__PURE__ */ new Set([
1229
+ "preprocess",
1230
+ "postprocess",
1231
+ "processAllTokens"
1232
+ ]));
1233
+ var Z, pe, Ge;
1234
+ class Ot {
1235
+ constructor(...e) {
1236
+ Te(this, Z);
1237
+ _(this, "defaults", fe());
1238
+ _(this, "options", this.setOptions);
1239
+ _(this, "parse", ee(this, Z, pe).call(this, P.lex, q.parse));
1240
+ _(this, "parseInline", ee(this, Z, pe).call(this, P.lexInline, q.parseInline));
1241
+ _(this, "Parser", q);
1242
+ _(this, "Renderer", le);
1243
+ _(this, "TextRenderer", we);
1244
+ _(this, "Lexer", P);
1245
+ _(this, "Tokenizer", se);
1246
+ _(this, "Hooks", G);
1247
+ this.use(...e);
1248
+ }
1249
+ /**
1250
+ * Run callback for every token
1251
+ */
1252
+ walkTokens(e, t) {
1253
+ var i, l;
1254
+ let n = [];
1255
+ for (const s of e)
1256
+ switch (n = n.concat(t.call(this, s)), s.type) {
1257
+ case "table": {
1258
+ const o = s;
1259
+ for (const a of o.header)
1260
+ n = n.concat(this.walkTokens(a.tokens, t));
1261
+ for (const a of o.rows)
1262
+ for (const u of a)
1263
+ n = n.concat(this.walkTokens(u.tokens, t));
1264
+ break;
1265
+ }
1266
+ case "list": {
1267
+ const o = s;
1268
+ n = n.concat(this.walkTokens(o.items, t));
1269
+ break;
1270
+ }
1271
+ default: {
1272
+ const o = s;
1273
+ (l = (i = this.defaults.extensions) == null ? void 0 : i.childTokens) != null && l[o.type] ? this.defaults.extensions.childTokens[o.type].forEach((a) => {
1274
+ const u = o[a].flat(1 / 0);
1275
+ n = n.concat(this.walkTokens(u, t));
1276
+ }) : o.tokens && (n = n.concat(this.walkTokens(o.tokens, t)));
1277
+ }
1278
+ }
1279
+ return n;
1280
+ }
1281
+ use(...e) {
1282
+ const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1283
+ return e.forEach((n) => {
1284
+ const i = { ...n };
1285
+ if (i.async = this.defaults.async || i.async || !1, n.extensions && (n.extensions.forEach((l) => {
1286
+ if (!l.name)
1287
+ throw new Error("extension name required");
1288
+ if ("renderer" in l) {
1289
+ const s = t.renderers[l.name];
1290
+ s ? t.renderers[l.name] = function(...o) {
1291
+ let a = l.renderer.apply(this, o);
1292
+ return a === !1 && (a = s.apply(this, o)), a;
1293
+ } : t.renderers[l.name] = l.renderer;
1294
+ }
1295
+ if ("tokenizer" in l) {
1296
+ if (!l.level || l.level !== "block" && l.level !== "inline")
1297
+ throw new Error("extension level must be 'block' or 'inline'");
1298
+ const s = t[l.level];
1299
+ s ? s.unshift(l.tokenizer) : t[l.level] = [l.tokenizer], l.start && (l.level === "block" ? t.startBlock ? t.startBlock.push(l.start) : t.startBlock = [l.start] : l.level === "inline" && (t.startInline ? t.startInline.push(l.start) : t.startInline = [l.start]));
1300
+ }
1301
+ "childTokens" in l && l.childTokens && (t.childTokens[l.name] = l.childTokens);
1302
+ }), i.extensions = t), n.renderer) {
1303
+ const l = this.defaults.renderer || new le(this.defaults);
1304
+ for (const s in n.renderer) {
1305
+ if (!(s in l))
1306
+ throw new Error(`renderer '${s}' does not exist`);
1307
+ if (s === "options")
1308
+ continue;
1309
+ const o = s, a = n.renderer[o], u = l[o];
1310
+ l[o] = (...c) => {
1311
+ let h = a.apply(l, c);
1312
+ return h === !1 && (h = u.apply(l, c)), h || "";
1313
+ };
1314
+ }
1315
+ i.renderer = l;
1316
+ }
1317
+ if (n.tokenizer) {
1318
+ const l = this.defaults.tokenizer || new se(this.defaults);
1319
+ for (const s in n.tokenizer) {
1320
+ if (!(s in l))
1321
+ throw new Error(`tokenizer '${s}' does not exist`);
1322
+ if (["options", "rules", "lexer"].includes(s))
1323
+ continue;
1324
+ const o = s, a = n.tokenizer[o], u = l[o];
1325
+ l[o] = (...c) => {
1326
+ let h = a.apply(l, c);
1327
+ return h === !1 && (h = u.apply(l, c)), h;
1328
+ };
1329
+ }
1330
+ i.tokenizer = l;
1331
+ }
1332
+ if (n.hooks) {
1333
+ const l = this.defaults.hooks || new G();
1334
+ for (const s in n.hooks) {
1335
+ if (!(s in l))
1336
+ throw new Error(`hook '${s}' does not exist`);
1337
+ if (s === "options")
1338
+ continue;
1339
+ const o = s, a = n.hooks[o], u = l[o];
1340
+ G.passThroughHooks.has(s) ? l[o] = (c) => {
1341
+ if (this.defaults.async)
1342
+ return Promise.resolve(a.call(l, c)).then((p) => u.call(l, p));
1343
+ const h = a.call(l, c);
1344
+ return u.call(l, h);
1345
+ } : l[o] = (...c) => {
1346
+ let h = a.apply(l, c);
1347
+ return h === !1 && (h = u.apply(l, c)), h;
1348
+ };
1349
+ }
1350
+ i.hooks = l;
1351
+ }
1352
+ if (n.walkTokens) {
1353
+ const l = this.defaults.walkTokens, s = n.walkTokens;
1354
+ i.walkTokens = function(o) {
1355
+ let a = [];
1356
+ return a.push(s.call(this, o)), l && (a = a.concat(l.call(this, o))), a;
1357
+ };
1358
+ }
1359
+ this.defaults = { ...this.defaults, ...i };
1360
+ }), this;
1361
+ }
1362
+ setOptions(e) {
1363
+ return this.defaults = { ...this.defaults, ...e }, this;
1364
+ }
1365
+ lexer(e, t) {
1366
+ return P.lex(e, t ?? this.defaults);
1367
+ }
1368
+ parser(e, t) {
1369
+ return q.parse(e, t ?? this.defaults);
1370
+ }
1371
+ }
1372
+ Z = new WeakSet(), pe = function(e, t) {
1373
+ return (n, i) => {
1374
+ const l = { ...i }, s = { ...this.defaults, ...l };
1375
+ this.defaults.async === !0 && l.async === !1 && (s.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), s.async = !0);
1376
+ const o = ee(this, Z, Ge).call(this, !!s.silent, !!s.async);
1377
+ if (typeof n > "u" || n === null)
1378
+ return o(new Error("marked(): input parameter is undefined or null"));
1379
+ if (typeof n != "string")
1380
+ return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1381
+ if (s.hooks && (s.hooks.options = s), s.async)
1382
+ return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then((a) => e(a, s)).then((a) => s.hooks ? s.hooks.processAllTokens(a) : a).then((a) => s.walkTokens ? Promise.all(this.walkTokens(a, s.walkTokens)).then(() => a) : a).then((a) => t(a, s)).then((a) => s.hooks ? s.hooks.postprocess(a) : a).catch(o);
1383
+ try {
1384
+ s.hooks && (n = s.hooks.preprocess(n));
1385
+ let a = e(n, s);
1386
+ s.hooks && (a = s.hooks.processAllTokens(a)), s.walkTokens && this.walkTokens(a, s.walkTokens);
1387
+ let u = t(a, s);
1388
+ return s.hooks && (u = s.hooks.postprocess(u)), u;
1389
+ } catch (a) {
1390
+ return o(a);
1391
+ }
1392
+ };
1393
+ }, Ge = function(e, t) {
1394
+ return (n) => {
1395
+ if (n.message += `
1396
+ Please report this to https://github.com/markedjs/marked.`, e) {
1397
+ const i = "<p>An error occurred:</p><pre>" + C(n.message + "", !0) + "</pre>";
1398
+ return t ? Promise.resolve(i) : i;
1399
+ }
1400
+ if (t)
1401
+ return Promise.reject(n);
1402
+ throw n;
1403
+ };
1404
+ };
1405
+ const D = new Ot();
1406
+ function b(r, e) {
1407
+ return D.parse(r, e);
1408
+ }
1409
+ b.options = b.setOptions = function(r) {
1410
+ return D.setOptions(r), b.defaults = D.defaults, Be(b.defaults), b;
1411
+ };
1412
+ b.getDefaults = fe;
1413
+ b.defaults = O;
1414
+ b.use = function(...r) {
1415
+ return D.use(...r), b.defaults = D.defaults, Be(b.defaults), b;
1416
+ };
1417
+ b.walkTokens = function(r, e) {
1418
+ return D.walkTokens(r, e);
1419
+ };
1420
+ b.parseInline = D.parseInline;
1421
+ b.Parser = q;
1422
+ b.parser = q.parse;
1423
+ b.Renderer = le;
1424
+ b.TextRenderer = we;
1425
+ b.Lexer = P;
1426
+ b.lexer = P.lex;
1427
+ b.Tokenizer = se;
1428
+ b.Hooks = G;
1429
+ b.parse = b;
1430
+ b.options;
1431
+ b.setOptions;
1432
+ b.use;
1433
+ b.walkTokens;
1434
+ b.parseInline;
1435
+ q.parse;
1436
+ P.lex;
1437
+ const {
1438
+ HtmlTagHydration: jt,
1439
+ SvelteComponent: Qt,
1440
+ append_hydration: I,
1441
+ attr: k,
1442
+ children: $,
1443
+ claim_element: S,
1444
+ claim_html_tag: Nt,
1445
+ claim_space: N,
1446
+ claim_text: ae,
1447
+ destroy_each: Vt,
1448
+ detach: v,
1449
+ element: A,
1450
+ ensure_array_like: Ee,
1451
+ init: Ht,
1452
+ insert_hydration: B,
1453
+ listen: We,
1454
+ noop: $e,
1455
+ null_to_empty: Ce,
1456
+ safe_not_equal: Ft,
1457
+ set_data: ce,
1458
+ set_style: j,
1459
+ space: V,
1460
+ src_url_equal: re,
1461
+ text: he,
1462
+ toggle_class: M
1463
+ } = window.__gradio__svelte__internal;
1464
+ function Le(r, e, t) {
1465
+ const n = r.slice();
1466
+ return n[31] = e[t], n[33] = t, n;
1467
+ }
1468
+ function Me(r) {
1469
+ let e, t, n, i = (
1470
+ /*label_icon*/
1471
+ r[0] && Pe(r)
1472
+ );
1473
+ return {
1474
+ c() {
1475
+ e = A("label"), i && i.c(), t = V(), n = he(
1476
+ /*label*/
1477
+ r[3]
1478
+ ), this.h();
1479
+ },
1480
+ l(l) {
1481
+ e = S(l, "LABEL", { class: !0, for: !0 });
1482
+ var s = $(e);
1483
+ i && i.l(s), t = N(s), n = ae(
1484
+ s,
1485
+ /*label*/
1486
+ r[3]
1487
+ ), s.forEach(v), this.h();
1488
+ },
1489
+ h() {
1490
+ k(e, "class", "block-title svelte-h3uhc0"), k(e, "for", "consilium-roundtable");
1491
+ },
1492
+ m(l, s) {
1493
+ B(l, e, s), i && i.m(e, null), I(e, t), I(e, n);
1494
+ },
1495
+ p(l, s) {
1496
+ /*label_icon*/
1497
+ l[0] ? i ? i.p(l, s) : (i = Pe(l), i.c(), i.m(e, t)) : i && (i.d(1), i = null), s[0] & /*label*/
1498
+ 8 && ce(
1499
+ n,
1500
+ /*label*/
1501
+ l[3]
1502
+ );
1503
+ },
1504
+ d(l) {
1505
+ l && v(e), i && i.d();
1506
+ }
1507
+ };
1508
+ }
1509
+ function Pe(r) {
1510
+ let e, t;
1511
+ function n(s, o) {
1512
+ return o[0] & /*label_icon*/
1513
+ 1 && (t = null), t == null && (t = !!Yt(
1514
+ /*label_icon*/
1515
+ s[0]
1516
+ )), t ? Wt : Gt;
1517
+ }
1518
+ let i = n(r, [-1, -1]), l = i(r);
1519
+ return {
1520
+ c() {
1521
+ e = A("div"), l.c(), this.h();
1522
+ },
1523
+ l(s) {
1524
+ e = S(s, "DIV", { class: !0 });
1525
+ var o = $(e);
1526
+ l.l(o), o.forEach(v), this.h();
1527
+ },
1528
+ h() {
1529
+ k(e, "class", "label-icon-container svelte-h3uhc0");
1530
+ },
1531
+ m(s, o) {
1532
+ B(s, e, o), l.m(e, null);
1533
+ },
1534
+ p(s, o) {
1535
+ i === (i = n(s, o)) && l ? l.p(s, o) : (l.d(1), l = i(s), l && (l.c(), l.m(e, null)));
1536
+ },
1537
+ d(s) {
1538
+ s && v(e), l.d();
1539
+ }
1540
+ };
1541
+ }
1542
+ function Gt(r) {
1543
+ let e, t;
1544
+ return {
1545
+ c() {
1546
+ e = A("span"), t = he(
1547
+ /*label_icon*/
1548
+ r[0]
1549
+ ), this.h();
1550
+ },
1551
+ l(n) {
1552
+ e = S(n, "SPAN", { class: !0 });
1553
+ var i = $(e);
1554
+ t = ae(
1555
+ i,
1556
+ /*label_icon*/
1557
+ r[0]
1558
+ ), i.forEach(v), this.h();
1559
+ },
1560
+ h() {
1561
+ k(e, "class", "label-icon-emoji svelte-h3uhc0");
1562
+ },
1563
+ m(n, i) {
1564
+ B(n, e, i), I(e, t);
1565
+ },
1566
+ p(n, i) {
1567
+ i[0] & /*label_icon*/
1568
+ 1 && ce(
1569
+ t,
1570
+ /*label_icon*/
1571
+ n[0]
1572
+ );
1573
+ },
1574
+ d(n) {
1575
+ n && v(e);
1576
+ }
1577
+ };
1578
+ }
1579
+ function Wt(r) {
1580
+ let e, t, n, i;
1581
+ return {
1582
+ c() {
1583
+ e = A("img"), this.h();
1584
+ },
1585
+ l(l) {
1586
+ e = S(l, "IMG", { src: !0, alt: !0, class: !0 }), this.h();
1587
+ },
1588
+ h() {
1589
+ re(e.src, t = /*label_icon*/
1590
+ r[0]) || k(e, "src", t), k(e, "alt", "Label Icon"), k(e, "class", "label-icon-image svelte-h3uhc0");
1591
+ },
1592
+ m(l, s) {
1593
+ B(l, e, s), n || (i = We(
1594
+ e,
1595
+ "error",
1596
+ /*handleLabelIconError*/
1597
+ r[19]
1598
+ ), n = !0);
1599
+ },
1600
+ p(l, s) {
1601
+ s[0] & /*label_icon*/
1602
+ 1 && !re(e.src, t = /*label_icon*/
1603
+ l[0]) && k(e, "src", t);
1604
+ },
1605
+ d(l) {
1606
+ l && v(e), n = !1, i();
1607
+ }
1608
+ };
1609
+ }
1610
+ function Ut(r) {
1611
+ let e, t = (
1612
+ /*getEmoji*/
1613
+ r[12](
1614
+ /*participant*/
1615
+ r[31]
1616
+ ) + ""
1617
+ ), n;
1618
+ return {
1619
+ c() {
1620
+ e = A("span"), n = he(t), this.h();
1621
+ },
1622
+ l(i) {
1623
+ e = S(i, "SPAN", { class: !0 });
1624
+ var l = $(e);
1625
+ n = ae(l, t), l.forEach(v), this.h();
1626
+ },
1627
+ h() {
1628
+ k(e, "class", "avatar-emoji svelte-h3uhc0");
1629
+ },
1630
+ m(i, l) {
1631
+ B(i, e, l), I(e, n);
1632
+ },
1633
+ p(i, l) {
1634
+ l[0] & /*participants*/
1635
+ 32 && t !== (t = /*getEmoji*/
1636
+ i[12](
1637
+ /*participant*/
1638
+ i[31]
1639
+ ) + "") && ce(n, t);
1640
+ },
1641
+ d(i) {
1642
+ i && v(e);
1643
+ }
1644
+ };
1645
+ }
1646
+ function Jt(r) {
1647
+ let e, t, n, i, l;
1648
+ function s(...o) {
1649
+ return (
1650
+ /*error_handler*/
1651
+ r[25](
1652
+ /*participant*/
1653
+ r[31],
1654
+ ...o
1655
+ )
1656
+ );
1657
+ }
1658
+ return {
1659
+ c() {
1660
+ e = A("img"), this.h();
1661
+ },
1662
+ l(o) {
1663
+ e = S(o, "IMG", { src: !0, alt: !0, class: !0 }), this.h();
1664
+ },
1665
+ h() {
1666
+ re(e.src, t = /*getAvatarImageUrl*/
1667
+ r[13](
1668
+ /*participant*/
1669
+ r[31]
1670
+ )) || k(e, "src", t), k(e, "alt", n = /*participant*/
1671
+ r[31]), k(e, "class", "avatar-image svelte-h3uhc0");
1672
+ },
1673
+ m(o, a) {
1674
+ B(o, e, a), i || (l = We(e, "error", s), i = !0);
1675
+ },
1676
+ p(o, a) {
1677
+ r = o, a[0] & /*participants*/
1678
+ 32 && !re(e.src, t = /*getAvatarImageUrl*/
1679
+ r[13](
1680
+ /*participant*/
1681
+ r[31]
1682
+ )) && k(e, "src", t), a[0] & /*participants*/
1683
+ 32 && n !== (n = /*participant*/
1684
+ r[31]) && k(e, "alt", n);
1685
+ },
1686
+ d(o) {
1687
+ o && v(e), i = !1, l();
1688
+ }
1689
+ };
1690
+ }
1691
+ function qe(r) {
1692
+ let e, t, n, i, l = (
1693
+ /*renderMarkdown*/
1694
+ r[11](
1695
+ /*getLatestMessage*/
1696
+ r[15](
1697
+ /*participant*/
1698
+ r[31]
1699
+ )
1700
+ ) + ""
1701
+ ), s, o, a, u, c, h, p, g = (
1702
+ /*participant*/
1703
+ r[31] + ""
1704
+ ), x, y;
1705
+ function z(d, m) {
1706
+ return m[0] & /*participants*/
1707
+ 32 && (c = null), c == null && (c = !!/*hasCustomImage*/
1708
+ d[14](
1709
+ /*participant*/
1710
+ d[31]
1711
+ )), c ? Jt : Ut;
1712
+ }
1713
+ let L = z(r, [-1, -1]), T = L(r);
1714
+ return {
1715
+ c() {
1716
+ e = A("div"), t = A("div"), n = A("div"), i = new jt(!1), s = V(), o = A("div"), a = V(), u = A("div"), T.c(), h = V(), p = A("div"), x = he(g), y = V(), this.h();
1717
+ },
1718
+ l(d) {
1719
+ e = S(d, "DIV", { class: !0, style: !0 });
1720
+ var m = $(e);
1721
+ t = S(m, "DIV", { class: !0 });
1722
+ var R = $(t);
1723
+ n = S(R, "DIV", { class: !0 });
1724
+ var J = $(n);
1725
+ i = Nt(J, !1), J.forEach(v), s = N(R), o = S(R, "DIV", { class: !0 }), $(o).forEach(v), R.forEach(v), a = N(m), u = S(m, "DIV", { class: !0, role: !0, tabindex: !0 });
1726
+ var X = $(u);
1727
+ T.l(X), X.forEach(v), h = N(m), p = S(m, "DIV", { class: !0 });
1728
+ var Y = $(p);
1729
+ x = ae(Y, g), Y.forEach(v), y = N(m), m.forEach(v), this.h();
1730
+ },
1731
+ h() {
1732
+ i.a = null, k(n, "class", "bubble-content svelte-h3uhc0"), k(o, "class", "bubble-arrow svelte-h3uhc0"), k(t, "class", "speech-bubble svelte-h3uhc0"), M(
1733
+ t,
1734
+ "visible",
1735
+ /*isBubbleVisible*/
1736
+ r[16](
1737
+ /*participant*/
1738
+ r[31]
1739
+ )
1740
+ ), k(u, "class", "avatar svelte-h3uhc0"), k(u, "role", "button"), k(u, "tabindex", "0"), M(
1741
+ u,
1742
+ "speaking",
1743
+ /*isAvatarActive*/
1744
+ r[17](
1745
+ /*participant*/
1746
+ r[31]
1747
+ )
1748
+ ), M(
1749
+ u,
1750
+ "thinking",
1751
+ /*thinking*/
1752
+ r[7].includes(
1753
+ /*participant*/
1754
+ r[31]
1755
+ )
1756
+ ), M(
1757
+ u,
1758
+ "responding",
1759
+ /*currentSpeaker*/
1760
+ r[6] === /*participant*/
1761
+ r[31]
1762
+ ), M(
1763
+ u,
1764
+ "has-image",
1765
+ /*hasCustomImage*/
1766
+ r[14](
1767
+ /*participant*/
1768
+ r[31]
1769
+ )
1770
+ ), k(p, "class", "participant-name svelte-h3uhc0"), k(e, "class", "participant-seat svelte-h3uhc0"), j(e, "left", Q(
1771
+ /*index*/
1772
+ r[33],
1773
+ /*participants*/
1774
+ r[5].length
1775
+ ).left), j(e, "top", Q(
1776
+ /*index*/
1777
+ r[33],
1778
+ /*participants*/
1779
+ r[5].length
1780
+ ).top), j(e, "transform", Q(
1781
+ /*index*/
1782
+ r[33],
1783
+ /*participants*/
1784
+ r[5].length
1785
+ ).transform);
1786
+ },
1787
+ m(d, m) {
1788
+ B(d, e, m), I(e, t), I(t, n), i.m(l, n), I(t, s), I(t, o), I(e, a), I(e, u), T.m(u, null), I(e, h), I(e, p), I(p, x), I(e, y);
1789
+ },
1790
+ p(d, m) {
1791
+ m[0] & /*participants*/
1792
+ 32 && l !== (l = /*renderMarkdown*/
1793
+ d[11](
1794
+ /*getLatestMessage*/
1795
+ d[15](
1796
+ /*participant*/
1797
+ d[31]
1798
+ )
1799
+ ) + "") && i.p(l), m[0] & /*isBubbleVisible, participants*/
1800
+ 65568 && M(
1801
+ t,
1802
+ "visible",
1803
+ /*isBubbleVisible*/
1804
+ d[16](
1805
+ /*participant*/
1806
+ d[31]
1807
+ )
1808
+ ), L === (L = z(d, m)) && T ? T.p(d, m) : (T.d(1), T = L(d), T && (T.c(), T.m(u, null))), m[0] & /*isAvatarActive, participants*/
1809
+ 131104 && M(
1810
+ u,
1811
+ "speaking",
1812
+ /*isAvatarActive*/
1813
+ d[17](
1814
+ /*participant*/
1815
+ d[31]
1816
+ )
1817
+ ), m[0] & /*thinking, participants*/
1818
+ 160 && M(
1819
+ u,
1820
+ "thinking",
1821
+ /*thinking*/
1822
+ d[7].includes(
1823
+ /*participant*/
1824
+ d[31]
1825
+ )
1826
+ ), m[0] & /*currentSpeaker, participants*/
1827
+ 96 && M(
1828
+ u,
1829
+ "responding",
1830
+ /*currentSpeaker*/
1831
+ d[6] === /*participant*/
1832
+ d[31]
1833
+ ), m[0] & /*hasCustomImage, participants*/
1834
+ 16416 && M(
1835
+ u,
1836
+ "has-image",
1837
+ /*hasCustomImage*/
1838
+ d[14](
1839
+ /*participant*/
1840
+ d[31]
1841
+ )
1842
+ ), m[0] & /*participants*/
1843
+ 32 && g !== (g = /*participant*/
1844
+ d[31] + "") && ce(x, g), m[0] & /*participants*/
1845
+ 32 && j(e, "left", Q(
1846
+ /*index*/
1847
+ d[33],
1848
+ /*participants*/
1849
+ d[5].length
1850
+ ).left), m[0] & /*participants*/
1851
+ 32 && j(e, "top", Q(
1852
+ /*index*/
1853
+ d[33],
1854
+ /*participants*/
1855
+ d[5].length
1856
+ ).top), m[0] & /*participants*/
1857
+ 32 && j(e, "transform", Q(
1858
+ /*index*/
1859
+ d[33],
1860
+ /*participants*/
1861
+ d[5].length
1862
+ ).transform);
1863
+ },
1864
+ d(d) {
1865
+ d && v(e), T.d();
1866
+ }
1867
+ };
1868
+ }
1869
+ function Xt(r) {
1870
+ let e, t, n, i, l, s, o, a = (
1871
+ /*show_label*/
1872
+ r[4] && /*label*/
1873
+ r[3] && Me(r)
1874
+ ), u = Ee(
1875
+ /*participants*/
1876
+ r[5]
1877
+ ), c = [];
1878
+ for (let h = 0; h < u.length; h += 1)
1879
+ c[h] = qe(Le(r, u, h));
1880
+ return {
1881
+ c() {
1882
+ e = A("div"), t = A("div"), n = A("div"), a && a.c(), i = V(), l = A("div");
1883
+ for (let h = 0; h < c.length; h += 1)
1884
+ c[h].c();
1885
+ this.h();
1886
+ },
1887
+ l(h) {
1888
+ e = S(h, "DIV", { class: !0, id: !0, style: !0 });
1889
+ var p = $(e);
1890
+ t = S(p, "DIV", { class: !0, id: !0 });
1891
+ var g = $(t);
1892
+ n = S(g, "DIV", { class: !0 });
1893
+ var x = $(n);
1894
+ a && a.l(x), x.forEach(v), i = N(g), l = S(g, "DIV", { class: !0 });
1895
+ var y = $(l);
1896
+ for (let z = 0; z < c.length; z += 1)
1897
+ c[z].l(y);
1898
+ y.forEach(v), g.forEach(v), p.forEach(v), this.h();
1899
+ },
1900
+ h() {
1901
+ k(n, "class", "table-center svelte-h3uhc0"), k(l, "class", "participants-circle"), k(t, "class", "consilium-container svelte-h3uhc0"), k(t, "id", "consilium-roundtable"), k(e, "class", s = Ce(
1902
+ /*containerClasses*/
1903
+ r[10]
1904
+ ) + " svelte-h3uhc0"), k(
1905
+ e,
1906
+ "id",
1907
+ /*elem_id*/
1908
+ r[1]
1909
+ ), k(e, "style", o = /*containerStyle*/
1910
+ r[9] + "; " + /*minWidthStyle*/
1911
+ r[8]), M(e, "hidden", !/*visible*/
1912
+ r[2]);
1913
+ },
1914
+ m(h, p) {
1915
+ B(h, e, p), I(e, t), I(t, n), a && a.m(n, null), I(t, i), I(t, l);
1916
+ for (let g = 0; g < c.length; g += 1)
1917
+ c[g] && c[g].m(l, null);
1918
+ },
1919
+ p(h, p) {
1920
+ if (/*show_label*/
1921
+ h[4] && /*label*/
1922
+ h[3] ? a ? a.p(h, p) : (a = Me(h), a.c(), a.m(n, null)) : a && (a.d(1), a = null), p[0] & /*participants, isAvatarActive, thinking, currentSpeaker, hasCustomImage, getAvatarImageUrl, handleImageError, getEmoji, isBubbleVisible, renderMarkdown, getLatestMessage*/
1923
+ 522464) {
1924
+ u = Ee(
1925
+ /*participants*/
1926
+ h[5]
1927
+ );
1928
+ let g;
1929
+ for (g = 0; g < u.length; g += 1) {
1930
+ const x = Le(h, u, g);
1931
+ c[g] ? c[g].p(x, p) : (c[g] = qe(x), c[g].c(), c[g].m(l, null));
1932
+ }
1933
+ for (; g < c.length; g += 1)
1934
+ c[g].d(1);
1935
+ c.length = u.length;
1936
+ }
1937
+ p[0] & /*containerClasses*/
1938
+ 1024 && s !== (s = Ce(
1939
+ /*containerClasses*/
1940
+ h[10]
1941
+ ) + " svelte-h3uhc0") && k(e, "class", s), p[0] & /*elem_id*/
1942
+ 2 && k(
1943
+ e,
1944
+ "id",
1945
+ /*elem_id*/
1946
+ h[1]
1947
+ ), p[0] & /*containerStyle, minWidthStyle*/
1948
+ 768 && o !== (o = /*containerStyle*/
1949
+ h[9] + "; " + /*minWidthStyle*/
1950
+ h[8]) && k(e, "style", o), p[0] & /*containerClasses, visible*/
1951
+ 1028 && M(e, "hidden", !/*visible*/
1952
+ h[2]);
1953
+ },
1954
+ i: $e,
1955
+ o: $e,
1956
+ d(h) {
1957
+ h && v(e), a && a.d(), Vt(c, h);
1958
+ }
1959
+ };
1960
+ }
1961
+ function Q(r, e) {
1962
+ const n = (360 / e * r - 90) * (Math.PI / 180), i = 260, l = 180, s = Math.cos(n) * i, o = Math.sin(n) * l;
1963
+ return {
1964
+ left: `calc(50% + ${s}px)`,
1965
+ top: `calc(50% + ${o}px)`,
1966
+ transform: "translate(-50%, -50%)"
1967
+ };
1968
+ }
1969
+ function Yt(r) {
1970
+ return r ? r.startsWith("http://") || r.startsWith("https://") || r.startsWith("data:") : !1;
1971
+ }
1972
+ function Kt(r, e, t) {
1973
+ let n, i, l, { gradio: s } = e, { elem_id: o = "" } = e, { elem_classes: a = [] } = e, { visible: u = !0 } = e, { value: c = "{}" } = e, { label: h = "Consilium Roundtable" } = e, { label_icon: p = "🎭" } = e, { show_label: g = !0 } = e, { scale: x = null } = e, { min_width: y = void 0 } = e, z = [], L = [], T = null, d = [], m = [], R = {};
1974
+ function J() {
1975
+ try {
1976
+ const f = JSON.parse(c);
1977
+ t(5, z = f.participants || []), L = f.messages || [], t(6, T = f.currentSpeaker || null), t(7, d = f.thinking || []), m = f.showBubbles || [], R = f.avatarImages || {}, console.log("Clean JSON parsed:", {
1978
+ participants: z,
1979
+ messages: L,
1980
+ currentSpeaker: T,
1981
+ thinking: d,
1982
+ showBubbles: m,
1983
+ avatarImages: R
1984
+ });
1985
+ } catch (f) {
1986
+ console.error("Invalid JSON:", c, f);
1987
+ }
1988
+ }
1989
+ function X(f) {
1990
+ if (!f) return f;
1991
+ try {
1992
+ return b.setOptions({
1993
+ breaks: !0,
1994
+ // Convert line breaks to <br>
1995
+ gfm: !0,
1996
+ // GitHub flavored markdown
1997
+ sanitize: !1,
1998
+ // Allow HTML (safe since we control input)
1999
+ smartypants: !1
2000
+ // Don't convert quotes/dashes
2001
+ }), f.includes(`
2002
+ `) ? b.parse(f) : b.parseInline(f);
2003
+ } catch (E) {
2004
+ return console.error("Markdown parsing error:", E), f;
2005
+ }
2006
+ }
2007
+ const Y = {
2008
+ Anthropic: "🤖",
2009
+ Claude: "🤖",
2010
+ Search: "🔍",
2011
+ "Web Search Agent": "🔍",
2012
+ OpenAI: "🧠",
2013
+ "GPT-4": "🧠",
2014
+ Google: "💎",
2015
+ Gemini: "💎",
2016
+ "QwQ-32B": "😊",
2017
+ "DeepSeek-R1": "🔮",
2018
+ Mistral: "🐱",
2019
+ "Mistral Large": "🐱",
2020
+ "Meta-Llama-3.1-8B": "🦙"
2021
+ };
2022
+ function Ue(f) {
2023
+ return Y[f] || "🤖";
2024
+ }
2025
+ function Je(f) {
2026
+ return R[f] || null;
2027
+ }
2028
+ function Xe(f) {
2029
+ return R[f] && R[f].trim() !== "";
2030
+ }
2031
+ function Ye(f) {
2032
+ if (d.includes(f))
2033
+ return `${f} is thinking...`;
2034
+ if (T === f)
2035
+ return `${f} is responding...`;
2036
+ const E = L.filter((K) => K.speaker === f);
2037
+ return E.length === 0 ? `${f} is ready to discuss...` : E[E.length - 1].text || `${f} responded`;
2038
+ }
2039
+ function Ke(f) {
2040
+ const E = d.includes(f), K = T === f, xe = m.includes(f), ye = E || K || xe;
2041
+ return console.log(`${f} bubble visible:`, ye, { isThinking: E, isSpeaking: K, shouldShow: xe }), ye;
2042
+ }
2043
+ function et(f) {
2044
+ return d.includes(f) || T === f;
2045
+ }
2046
+ function _e(f, E) {
2047
+ console.warn(`Failed to load avatar image for ${E}, falling back to emoji`), R = Object.assign(Object.assign({}, R), { [E]: null });
2048
+ }
2049
+ function tt(f) {
2050
+ console.warn("Failed to load label icon image, falling back to default emoji"), t(0, p = null);
2051
+ }
2052
+ const nt = (f, E) => _e(E, f);
2053
+ return r.$$set = (f) => {
2054
+ "gradio" in f && t(20, s = f.gradio), "elem_id" in f && t(1, o = f.elem_id), "elem_classes" in f && t(21, a = f.elem_classes), "visible" in f && t(2, u = f.visible), "value" in f && t(22, c = f.value), "label" in f && t(3, h = f.label), "label_icon" in f && t(0, p = f.label_icon), "show_label" in f && t(4, g = f.show_label), "scale" in f && t(23, x = f.scale), "min_width" in f && t(24, y = f.min_width);
2055
+ }, r.$$.update = () => {
2056
+ r.$$.dirty[0] & /*elem_classes*/
2057
+ 2097152 && t(10, n = `wrapper ${a.join(" ")}`), r.$$.dirty[0] & /*scale*/
2058
+ 8388608 && t(9, i = x ? `--scale: ${x}` : ""), r.$$.dirty[0] & /*min_width*/
2059
+ 16777216 && t(8, l = y ? `min-width: ${y}px` : ""), r.$$.dirty[0] & /*value*/
2060
+ 4194304 && J();
2061
+ }, [
2062
+ p,
2063
+ o,
2064
+ u,
2065
+ h,
2066
+ g,
2067
+ z,
2068
+ T,
2069
+ d,
2070
+ l,
2071
+ i,
2072
+ n,
2073
+ X,
2074
+ Ue,
2075
+ Je,
2076
+ Xe,
2077
+ Ye,
2078
+ Ke,
2079
+ et,
2080
+ _e,
2081
+ tt,
2082
+ s,
2083
+ a,
2084
+ c,
2085
+ x,
2086
+ y,
2087
+ nt
2088
+ ];
2089
+ }
2090
+ class en extends Qt {
2091
+ constructor(e) {
2092
+ super(), Ht(
2093
+ this,
2094
+ e,
2095
+ Kt,
2096
+ Xt,
2097
+ Ft,
2098
+ {
2099
+ gradio: 20,
2100
+ elem_id: 1,
2101
+ elem_classes: 21,
2102
+ visible: 2,
2103
+ value: 22,
2104
+ label: 3,
2105
+ label_icon: 0,
2106
+ show_label: 4,
2107
+ scale: 23,
2108
+ min_width: 24
2109
+ },
2110
+ null,
2111
+ [-1, -1]
2112
+ );
2113
+ }
2114
+ }
2115
+ const {
2116
+ SvelteComponent: tn,
2117
+ claim_component: nn,
2118
+ create_component: sn,
2119
+ destroy_component: ln,
2120
+ init: rn,
2121
+ mount_component: on,
2122
+ noop: an,
2123
+ safe_not_equal: cn,
2124
+ transition_in: hn,
2125
+ transition_out: un
2126
+ } = window.__gradio__svelte__internal, { onMount: dn } = window.__gradio__svelte__internal;
2127
+ function pn(r) {
2128
+ let e, t;
2129
+ return e = new en({
2130
+ props: {
2131
+ value: (
2132
+ /*value*/
2133
+ r[0]
2134
+ ),
2135
+ label: "Example Roundtable",
2136
+ visible: !0,
2137
+ elem_id: "example",
2138
+ elem_classes: [],
2139
+ scale: null,
2140
+ min_width: 600,
2141
+ gradio: {},
2142
+ show_label: !0
2143
+ }
2144
+ }), {
2145
+ c() {
2146
+ sn(e.$$.fragment);
2147
+ },
2148
+ l(n) {
2149
+ nn(e.$$.fragment, n);
2150
+ },
2151
+ m(n, i) {
2152
+ on(e, n, i), t = !0;
2153
+ },
2154
+ p: an,
2155
+ i(n) {
2156
+ t || (hn(e.$$.fragment, n), t = !0);
2157
+ },
2158
+ o(n) {
2159
+ un(e.$$.fragment, n), t = !1;
2160
+ },
2161
+ d(n) {
2162
+ ln(e, n);
2163
+ }
2164
+ };
2165
+ }
2166
+ function fn(r) {
2167
+ return [JSON.stringify({
2168
+ participants: ["Claude", "GPT-4", "Mistral"],
2169
+ messages: [
2170
+ {
2171
+ speaker: "Claude",
2172
+ text: "Welcome to the roundtable!"
2173
+ }
2174
+ ],
2175
+ currentSpeaker: "Claude",
2176
+ thinking: []
2177
+ })];
2178
+ }
2179
+ class kn extends tn {
2180
+ constructor(e) {
2181
+ super(), rn(this, e, fn, pn, cn, {});
2182
+ }
2183
+ }
2184
+ export {
2185
+ kn as default
2186
+ };
src/backend/gradio_consilium_roundtable/templates/example/style.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .hidden.svelte-h3uhc0{display:none}.block-title.svelte-h3uhc0{padding:10px;font-weight:700;color:gold;display:flex;flex-wrap:wrap;justify-content:center;text-shadow:0 2px 4px rgba(0,0,0,.8)}.label-icon-container.svelte-h3uhc0{width:24px;height:24px}.label-icon-emoji.svelte-h3uhc0{font-size:1.2rem;line-height:1}.label-icon-image.svelte-h3uhc0{width:24px;height:24px;object-fit:contain;border-radius:4px}.wrapper.svelte-h3uhc0{width:600px;height:600px;position:relative}.consilium-container.svelte-h3uhc0{top:150px;position:relative;width:450px;height:300px;margin:20px auto;border-radius:50%;background:linear-gradient(135deg,#0f5132,#198754);border:8px solid #8b4513;box-shadow:0 8px 32px #0006,inset 0 0 20px #0003}.table-center.svelte-h3uhc0{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;background:#0000004d;border-radius:50%;width:140px;height:100px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px solid #8b4513;box-shadow:inset 0 0 10px #00000080}.participant-seat.svelte-h3uhc0{position:absolute;display:flex;flex-direction:column;align-items:center}.avatar.svelte-h3uhc0{width:60px;height:60px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:1.4rem;background:linear-gradient(145deg,#fff,#e6e6e6);border:3px solid #8b4513;box-shadow:0 6px 15px #0000004d,inset 0 2px 5px #ffffff80;margin-bottom:8px;transition:all .3s ease;position:relative;z-index:10;overflow:hidden}.avatar.has-image.svelte-h3uhc0{background:#f8f9fa;padding:2px}.avatar-image.svelte-h3uhc0{width:100%;height:100%;object-fit:cover;border-radius:50%}.avatar-emoji.svelte-h3uhc0{font-size:1.4rem;line-height:1}.avatar.thinking.svelte-h3uhc0{border-color:#ff6b35;animation:svelte-h3uhc0-thinking-pulse 1.5s infinite}.avatar.responding.svelte-h3uhc0{border-color:gold;animation:svelte-h3uhc0-speaking-glow 1s infinite}.avatar.speaking.svelte-h3uhc0{border-color:gold}.participant-name.svelte-h3uhc0{font-size:.75rem;font-weight:700;color:gold;text-shadow:0 2px 4px rgba(0,0,0,.8);text-align:center;white-space:nowrap;background:#0000004d;padding:2px 8px;border-radius:10px;border:1px solid #8b4513}.speech-bubble.svelte-h3uhc0{position:absolute;bottom:90px;left:50%;transform:translate(-50%) translateY(20px);background:#fff;border-radius:15px;padding:10px 14px;box-shadow:0 8px 25px #0000004d;z-index:20;opacity:0;transition:all .4s ease;pointer-events:none;border:2px solid #8b4513;min-width:180px;max-width:300px;word-wrap:break-word;white-space:normal}.speech-bubble.visible.svelte-h3uhc0{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.bubble-content.svelte-h3uhc0{font-size:.8rem;color:#333;line-height:1.4;text-align:left;max-height:100px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#8b4513 #f0f0f0}.bubble-content.svelte-h3uhc0::-webkit-scrollbar{width:6px}.bubble-content.svelte-h3uhc0::-webkit-scrollbar-track{background:#f0f0f0;border-radius:3px}.bubble-content.svelte-h3uhc0::-webkit-scrollbar-thumb{background:#8b4513;border-radius:3px}.bubble-content.svelte-h3uhc0::-webkit-scrollbar-thumb:hover{background:#654321}.bubble-arrow.svelte-h3uhc0{position:absolute;bottom:-10px;left:50%;transform:translate(-50%);width:0;height:0;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid white}.bubble-arrow.svelte-h3uhc0:before{content:"";position:absolute;bottom:2px;left:50%;transform:translate(-50%);width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid #8b4513}@keyframes svelte-h3uhc0-thinking-pulse{0%,to{transform:scale(1);box-shadow:0 6px 15px #0000004d,0 0 15px #ff6b3566}50%{transform:scale(1.03);box-shadow:0 8px 20px #0006,0 0 25px #ff6b3599}}@keyframes svelte-h3uhc0-speaking-glow{0%,to{box-shadow:0 6px 15px #0000004d,0 0 20px #ffd70080}50%{box-shadow:0 8px 20px #0006,0 0 30px #ffd700cc}}
src/demo/__init__.py ADDED
File without changes
src/demo/app.py ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio_consilium_roundtable import consilium_roundtable
3
+ import json
4
+
5
+ def simulate_discussion():
6
+ """Simulate a live AI discussion with custom avatar images"""
7
+
8
+ # Define avatar images (you can replace these URLs with actual image URLs)
9
+ avatar_images = {
10
+ "QwQ-32B": "https://cdn-avatars.huggingface.co/v1/production/uploads/620760a26e3b7210c2ff1943/-s1gyJfvbE1RgO5iBeNOi.png",
11
+ "DeepSeek-R1": "https://logosandtypes.com/wp-content/uploads/2025/02/deepseek.svg",
12
+ "Mistral Large": "https://logosandtypes.com/wp-content/uploads/2025/02/mistral-ai.svg",
13
+ "Claude": "https://claude.ai/favicon.ico",
14
+ # Web Search Agent will use emoji fallback (no image provided)
15
+ }
16
+
17
+ # Initial state - everyone ready
18
+ initial_state = {
19
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
20
+ "messages": [],
21
+ "currentSpeaker": None,
22
+ "thinking": [],
23
+ "showBubbles": [],
24
+ "avatarImages": avatar_images
25
+ }
26
+
27
+ states = [
28
+ # 1. QwQ-32B starts thinking
29
+ {
30
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
31
+ "messages": [],
32
+ "currentSpeaker": None,
33
+ "thinking": ["QwQ-32B"],
34
+ "showBubbles": [],
35
+ "avatarImages": avatar_images
36
+ },
37
+
38
+ # 2. DeepSeek-R1 and Search start thinking - QwQ-32B's bubble should stay visible
39
+ {
40
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
41
+ "messages": [
42
+ {"speaker": "QwQ-32B", "text": "This is a very long response that should demonstrate the scrolling functionality. I'm going to explain multiple points in detail.\n\n**Key Analysis Points:**\n- First consideration: market dynamics\n- Second factor: technical feasibility\n- Third aspect: resource allocation\n\nWe need to evaluate each of these systematically."}
43
+ ],
44
+ "currentSpeaker": None,
45
+ "thinking": ["DeepSeek-R1", "Web Search Agent"],
46
+ "showBubbles": ["QwQ-32B"],
47
+ "avatarImages": avatar_images
48
+ },
49
+
50
+ # 3. DeepSeek-R1 responds - both QwQ-32B and DeepSeek-R1 bubbles visible
51
+ {
52
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
53
+ "messages": [
54
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis:\n\n**Key Points:**\n- Market dynamics are shifting rapidly\n- Technical feasibility looks promising\n- Resource allocation needs careful planning\n\n`Implementation roadmap` should include phased rollout."},
55
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation, QwQ-32B! I'd like to add some **quantitative analysis** to your reasoning:\n\n> Statistical models suggest a 73% success probability\n\nLet me run some deeper calculations..."}
56
+ ],
57
+ "currentSpeaker": "DeepSeek-R1",
58
+ "thinking": [],
59
+ "showBubbles": ["QwQ-32B"],
60
+ "avatarImages": avatar_images
61
+ },
62
+
63
+ # 4. Multiple models thinking - previous responses stay visible
64
+ {
65
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
66
+ "messages": [
67
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
68
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."}
69
+ ],
70
+ "currentSpeaker": None,
71
+ "thinking": ["Mistral Large", "Claude"],
72
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
73
+ "avatarImages": avatar_images
74
+ },
75
+
76
+ # 5. Search agent responds with data - all previous responses visible
77
+ {
78
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
79
+ "messages": [
80
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
81
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."},
82
+ {"speaker": "Web Search Agent", "text": "📊 **Recent Market Data:**\n\n- Industry growth: +23% YoY\n- Competition analysis: 5 major players\n- Consumer sentiment: 87% positive\n\nSources: MarketWatch, TechCrunch, Industry Reports"}
83
+ ],
84
+ "currentSpeaker": "Web Search Agent",
85
+ "thinking": [],
86
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
87
+ "avatarImages": avatar_images
88
+ },
89
+
90
+ # 6. Claude joins the discussion
91
+ {
92
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
93
+ "messages": [
94
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
95
+ {"speaker": "DeepSeek-R1", "text": "Statistical models suggest a 73% success probability based on current market conditions."},
96
+ {"speaker": "Web Search Agent", "text": "📊 Industry growth: +23% YoY, Competition: 5 major players, Consumer sentiment: 87% positive"},
97
+ {"speaker": "Claude", "text": "Great insights everyone! Let me synthesize this information:\n\n🎯 **Strategic Recommendation:**\nBased on the quantitative analysis and market data, I suggest a **phased approach** with risk mitigation strategies built in."}
98
+ ],
99
+ "currentSpeaker": "Claude",
100
+ "thinking": [],
101
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent"],
102
+ "avatarImages": avatar_images
103
+ },
104
+
105
+ # 7. Final consensus with Mistral Large
106
+ {
107
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
108
+ "messages": [
109
+ {"speaker": "QwQ-32B", "text": "Strategic analysis complete with key considerations outlined."},
110
+ {"speaker": "DeepSeek-R1", "text": "Statistical validation: 73% success probability confirmed."},
111
+ {"speaker": "Web Search Agent", "text": "Market data supports positive outlook: +23% growth, 87% sentiment."},
112
+ {"speaker": "Claude", "text": "Phased approach recommended with integrated risk mitigation."},
113
+ {"speaker": "Mistral Large", "text": "🏆 **CONSENSUS ACHIEVED**\n\nAll analyses converge on a **GO decision** with the following framework:\n\n✅ Phased implementation\n✅ 73% success probability\n✅ Strong market fundamentals\n✅ Risk mitigation protocols"}
114
+ ],
115
+ "currentSpeaker": "Mistral Large",
116
+ "thinking": [],
117
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent", "Claude"],
118
+ "avatarImages": avatar_images
119
+ }
120
+ ]
121
+
122
+ return initial_state, states
123
+
124
+ def update_discussion_state(state_index, states):
125
+ """Get the next state in the discussion"""
126
+ if state_index >= len(states):
127
+ state_index = 0
128
+ return states[state_index], state_index + 1
129
+
130
+ # Initialize the discussion
131
+ initial_state, discussion_states = simulate_discussion()
132
+
133
+ with gr.Blocks() as demo:
134
+ gr.Markdown("# 🎭 Consilium Roundtable Demo")
135
+ gr.Markdown("**Watch the AI discussion unfold!** Click 'Next State' to see different phases of the discussion. 📼 Demo Video: https://youtu.be/oyYlf1BfuU8")
136
+
137
+ # State management
138
+ state_counter = gr.State(0)
139
+
140
+ # The roundtable component
141
+ roundtable = consilium_roundtable(
142
+ label="AI Discussion Roundtable",
143
+ show_label=True,
144
+ label_icon="https://huggingface.co/front/assets/huggingface_logo-noborder.svg",
145
+ value=initial_state
146
+ )
147
+
148
+ with gr.Row():
149
+ next_btn = gr.Button("▶️ Next Discussion State", variant="primary")
150
+ reset_btn = gr.Button("🔄 Reset Discussion", variant="secondary")
151
+
152
+ # Status display
153
+ with gr.Row():
154
+ status_display = gr.Markdown("**Status:** Discussion ready to begin")
155
+
156
+ def next_state(current_counter):
157
+ new_state, new_counter = update_discussion_state(current_counter, discussion_states)
158
+
159
+ # Convert to proper JSON string
160
+ json_state = json.dumps(new_state)
161
+
162
+ # Create status message
163
+ thinking_list = new_state.get("thinking", [])
164
+ current_speaker = new_state.get("currentSpeaker")
165
+
166
+ if thinking_list:
167
+ status = f"**Status:** {', '.join(thinking_list)} {'is' if len(thinking_list) == 1 else 'are'} thinking..."
168
+ elif current_speaker:
169
+ status = f"**Status:** {current_speaker} is responding..."
170
+ else:
171
+ status = "**Status:** Discussion in progress..."
172
+
173
+ return json_state, new_counter, status
174
+
175
+ def reset_discussion():
176
+ json_state = json.dumps(initial_state)
177
+ return json_state, 0, "**Status:** Discussion reset - ready to begin"
178
+
179
+ next_btn.click(
180
+ next_state,
181
+ inputs=[state_counter],
182
+ outputs=[roundtable, state_counter, status_display]
183
+ )
184
+
185
+ reset_btn.click(
186
+ reset_discussion,
187
+ outputs=[roundtable, state_counter, status_display]
188
+ )
189
+
190
+ if __name__ == "__main__":
191
+ demo.launch()
src/demo/css.css ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ html {
2
+ font-family: Inter;
3
+ font-size: 16px;
4
+ font-weight: 400;
5
+ line-height: 1.5;
6
+ -webkit-text-size-adjust: 100%;
7
+ background: #fff;
8
+ color: #323232;
9
+ -webkit-font-smoothing: antialiased;
10
+ -moz-osx-font-smoothing: grayscale;
11
+ text-rendering: optimizeLegibility;
12
+ }
13
+
14
+ :root {
15
+ --space: 1;
16
+ --vspace: calc(var(--space) * 1rem);
17
+ --vspace-0: calc(3 * var(--space) * 1rem);
18
+ --vspace-1: calc(2 * var(--space) * 1rem);
19
+ --vspace-2: calc(1.5 * var(--space) * 1rem);
20
+ --vspace-3: calc(0.5 * var(--space) * 1rem);
21
+ }
22
+
23
+ .app {
24
+ max-width: 748px !important;
25
+ }
26
+
27
+ .prose p {
28
+ margin: var(--vspace) 0;
29
+ line-height: var(--vspace * 2);
30
+ font-size: 1rem;
31
+ }
32
+
33
+ code {
34
+ font-family: "Inconsolata", sans-serif;
35
+ font-size: 16px;
36
+ }
37
+
38
+ h1,
39
+ h1 code {
40
+ font-weight: 400;
41
+ line-height: calc(2.5 / var(--space) * var(--vspace));
42
+ }
43
+
44
+ h1 code {
45
+ background: none;
46
+ border: none;
47
+ letter-spacing: 0.05em;
48
+ padding-bottom: 5px;
49
+ position: relative;
50
+ padding: 0;
51
+ }
52
+
53
+ h2 {
54
+ margin: var(--vspace-1) 0 var(--vspace-2) 0;
55
+ line-height: 1em;
56
+ }
57
+
58
+ h3,
59
+ h3 code {
60
+ margin: var(--vspace-1) 0 var(--vspace-2) 0;
61
+ line-height: 1em;
62
+ }
63
+
64
+ h4,
65
+ h5,
66
+ h6 {
67
+ margin: var(--vspace-3) 0 var(--vspace-3) 0;
68
+ line-height: var(--vspace);
69
+ }
70
+
71
+ .bigtitle,
72
+ h1,
73
+ h1 code {
74
+ font-size: calc(8px * 4.5);
75
+ word-break: break-word;
76
+ }
77
+
78
+ .title,
79
+ h2,
80
+ h2 code {
81
+ font-size: calc(8px * 3.375);
82
+ font-weight: lighter;
83
+ word-break: break-word;
84
+ border: none;
85
+ background: none;
86
+ }
87
+
88
+ .subheading1,
89
+ h3,
90
+ h3 code {
91
+ font-size: calc(8px * 1.8);
92
+ font-weight: 600;
93
+ border: none;
94
+ background: none;
95
+ letter-spacing: 0.1em;
96
+ text-transform: uppercase;
97
+ }
98
+
99
+ h2 code {
100
+ padding: 0;
101
+ position: relative;
102
+ letter-spacing: 0.05em;
103
+ }
104
+
105
+ blockquote {
106
+ font-size: calc(8px * 1.1667);
107
+ font-style: italic;
108
+ line-height: calc(1.1667 * var(--vspace));
109
+ margin: var(--vspace-2) var(--vspace-2);
110
+ }
111
+
112
+ .subheading2,
113
+ h4 {
114
+ font-size: calc(8px * 1.4292);
115
+ text-transform: uppercase;
116
+ font-weight: 600;
117
+ }
118
+
119
+ .subheading3,
120
+ h5 {
121
+ font-size: calc(8px * 1.2917);
122
+ line-height: calc(1.2917 * var(--vspace));
123
+
124
+ font-weight: lighter;
125
+ text-transform: uppercase;
126
+ letter-spacing: 0.15em;
127
+ }
128
+
129
+ h6 {
130
+ font-size: calc(8px * 1.1667);
131
+ font-size: 1.1667em;
132
+ font-weight: normal;
133
+ font-style: italic;
134
+ font-family: "le-monde-livre-classic-byol", serif !important;
135
+ letter-spacing: 0px !important;
136
+ }
137
+
138
+ #start .md > *:first-child {
139
+ margin-top: 0;
140
+ }
141
+
142
+ h2 + h3 {
143
+ margin-top: 0;
144
+ }
145
+
146
+ .md hr {
147
+ border: none;
148
+ border-top: 1px solid var(--block-border-color);
149
+ margin: var(--vspace-2) 0 var(--vspace-2) 0;
150
+ }
151
+ .prose ul {
152
+ margin: var(--vspace-2) 0 var(--vspace-1) 0;
153
+ }
154
+
155
+ .gap {
156
+ gap: 0;
157
+ }
src/demo/requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio_consilium_roundtable
src/demo/space.py ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from app import demo as app
4
+ import os
5
+
6
+ _docs = {'consilium_roundtable': {'description': 'Creates a visual roundtable component for AI consensus discussions.\n\nDisplays AI participants as avatars positioned around an oval table\nwith animated speech bubbles, thinking states, and real-time discussion updates.\nPerfect for multi-AI collaboration, decision-making processes, and consensus building.\n\nSupports custom avatar images with emoji fallbacks for enhanced visual representation.', 'members': {'__init__': {'value': {'type': 'str | Callable | None', 'default': 'None', 'description': 'JSON string containing the discussion state with participants, messages, current speaker, thinking states, and avatar images. If a function is provided, it will be called each time the app loads to set the initial value.'}, 'placeholder': {'type': 'str | None', 'default': 'None', 'description': 'Not used in this component (roundtable displays participants instead).'}, 'label': {'type': 'str | I18nData | None', 'default': 'None', 'description': 'The label for this component, displayed above the roundtable.'}, 'label_icon': {'type': 'str | None', 'default': '"🎭"', 'description': 'Icon displayed next to the label. Can be an emoji (default: "🎭") or a URL to an image. Set to None to disable.'}, 'every': {'type': 'Timer | float | None', 'default': 'None', 'description': 'Continuously calls `value` to recalculate it if `value` is a function (useful for live discussion updates).'}, 'inputs': {'type': 'Component | Sequence[Component] | set[Component] | None', 'default': 'None', 'description': 'Components that are used as inputs to calculate `value` if `value` is a function.'}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'If True, will display the label above the roundtable.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'Relative size compared to adjacent components in a Row or Blocks layout.'}, 'min_width': {'type': 'int', 'default': '600', 'description': 'Minimum pixel width for the component (default 600px for proper roundtable display).'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'rtl': {'type': 'bool', 'default': 'False', 'description': 'Not used in this component.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string assigned as the id of this component in the HTML DOM.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'Optional list of CSS classes assigned to this component.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not be rendered in the Blocks context initially.'}, 'key': {'type': 'int | str | tuple[int | str, ...] | None', 'default': 'None', 'description': 'For gr.render() - components with the same key are treated as the same component across re-renders.'}, 'preserved_by_key': {'type': 'list[str] | str | None', 'default': '"value"', 'description': 'Parameters preserved across re-renders when using keys.'}}, 'postprocess': {'value': {'type': 'Any', 'description': 'Discussion state as dict or JSON string containing:'}}, 'preprocess': {'return': {'type': 'str | None', 'description': 'Passes the JSON string value for processing.'}, 'value': None}}, 'events': {'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the consilium_roundtable changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input.'}, 'input': {'type': None, 'default': None, 'description': 'This listener is triggered when the user changes the value of the consilium_roundtable.'}, 'submit': {'type': None, 'default': None, 'description': 'This listener is triggered when the user presses the Enter key while the consilium_roundtable is focused.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'consilium_roundtable': []}}}
7
+
8
+ abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
+
10
+ with gr.Blocks(
11
+ css=abs_path,
12
+ theme=gr.themes.Default(
13
+ font_mono=[
14
+ gr.themes.GoogleFont("Inconsolata"),
15
+ "monospace",
16
+ ],
17
+ ),
18
+ ) as demo:
19
+ gr.Markdown(
20
+ """
21
+ # `gradio_consilium_roundtable`
22
+
23
+ <div style="display: flex; gap: 7px;">
24
+ <a href="https://pypi.org/project/gradio_consilium_roundtable/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_consilium_roundtable"></a>
25
+ </div>
26
+
27
+ The roundtable for artificial minds
28
+ """, elem_classes=["md-custom"], header_links=True)
29
+ app.render()
30
+ gr.Markdown(
31
+ """
32
+ ## Installation
33
+
34
+ ```bash
35
+ pip install gradio_consilium_roundtable
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```python
41
+ import gradio as gr
42
+ from gradio_consilium_roundtable import consilium_roundtable
43
+ import json
44
+
45
+ def simulate_discussion():
46
+ \"\"\"Simulate a live AI discussion with custom avatar images\"\"\"
47
+
48
+ # Define avatar images (you can replace these URLs with actual image URLs)
49
+ avatar_images = {
50
+ "QwQ-32B": "https://cdn-avatars.huggingface.co/v1/production/uploads/620760a26e3b7210c2ff1943/-s1gyJfvbE1RgO5iBeNOi.png",
51
+ "DeepSeek-R1": "https://logosandtypes.com/wp-content/uploads/2025/02/deepseek.svg",
52
+ "Mistral Large": "https://logosandtypes.com/wp-content/uploads/2025/02/mistral-ai.svg",
53
+ "Claude": "https://claude.ai/favicon.ico",
54
+ # Web Search Agent will use emoji fallback (no image provided)
55
+ }
56
+
57
+ # Initial state - everyone ready
58
+ initial_state = {
59
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
60
+ "messages": [],
61
+ "currentSpeaker": None,
62
+ "thinking": [],
63
+ "showBubbles": [],
64
+ "avatarImages": avatar_images
65
+ }
66
+
67
+ states = [
68
+ # 1. QwQ-32B starts thinking
69
+ {
70
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
71
+ "messages": [],
72
+ "currentSpeaker": None,
73
+ "thinking": ["QwQ-32B"],
74
+ "showBubbles": [],
75
+ "avatarImages": avatar_images
76
+ },
77
+
78
+ # 2. DeepSeek-R1 and Search start thinking - QwQ-32B's bubble should stay visible
79
+ {
80
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
81
+ "messages": [
82
+ {"speaker": "QwQ-32B", "text": "This is a very long response that should demonstrate the scrolling functionality. I'm going to explain multiple points in detail.\n\n**Key Analysis Points:**\n- First consideration: market dynamics\n- Second factor: technical feasibility\n- Third aspect: resource allocation\n\nWe need to evaluate each of these systematically."}
83
+ ],
84
+ "currentSpeaker": None,
85
+ "thinking": ["DeepSeek-R1", "Web Search Agent"],
86
+ "showBubbles": ["QwQ-32B"],
87
+ "avatarImages": avatar_images
88
+ },
89
+
90
+ # 3. DeepSeek-R1 responds - both QwQ-32B and DeepSeek-R1 bubbles visible
91
+ {
92
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
93
+ "messages": [
94
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis:\n\n**Key Points:**\n- Market dynamics are shifting rapidly\n- Technical feasibility looks promising\n- Resource allocation needs careful planning\n\n`Implementation roadmap` should include phased rollout."},
95
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation, QwQ-32B! I'd like to add some **quantitative analysis** to your reasoning:\n\n> Statistical models suggest a 73% success probability\n\nLet me run some deeper calculations..."}
96
+ ],
97
+ "currentSpeaker": "DeepSeek-R1",
98
+ "thinking": [],
99
+ "showBubbles": ["QwQ-32B"],
100
+ "avatarImages": avatar_images
101
+ },
102
+
103
+ # 4. Multiple models thinking - previous responses stay visible
104
+ {
105
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
106
+ "messages": [
107
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
108
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."}
109
+ ],
110
+ "currentSpeaker": None,
111
+ "thinking": ["Mistral Large", "Claude"],
112
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
113
+ "avatarImages": avatar_images
114
+ },
115
+
116
+ # 5. Search agent responds with data - all previous responses visible
117
+ {
118
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
119
+ "messages": [
120
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
121
+ {"speaker": "DeepSeek-R1", "text": "Excellent foundation! Statistical models suggest a 73% success probability based on current market conditions."},
122
+ {"speaker": "Web Search Agent", "text": "📊 **Recent Market Data:**\n\n- Industry growth: +23% YoY\n- Competition analysis: 5 major players\n- Consumer sentiment: 87% positive\n\nSources: MarketWatch, TechCrunch, Industry Reports"}
123
+ ],
124
+ "currentSpeaker": "Web Search Agent",
125
+ "thinking": [],
126
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1"],
127
+ "avatarImages": avatar_images
128
+ },
129
+
130
+ # 6. Claude joins the discussion
131
+ {
132
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
133
+ "messages": [
134
+ {"speaker": "QwQ-32B", "text": "Here's my detailed analysis with key considerations for our strategic approach."},
135
+ {"speaker": "DeepSeek-R1", "text": "Statistical models suggest a 73% success probability based on current market conditions."},
136
+ {"speaker": "Web Search Agent", "text": "📊 Industry growth: +23% YoY, Competition: 5 major players, Consumer sentiment: 87% positive"},
137
+ {"speaker": "Claude", "text": "Great insights everyone! Let me synthesize this information:\n\n🎯 **Strategic Recommendation:**\nBased on the quantitative analysis and market data, I suggest a **phased approach** with risk mitigation strategies built in."}
138
+ ],
139
+ "currentSpeaker": "Claude",
140
+ "thinking": [],
141
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent"],
142
+ "avatarImages": avatar_images
143
+ },
144
+
145
+ # 7. Final consensus with Mistral Large
146
+ {
147
+ "participants": ["QwQ-32B", "DeepSeek-R1", "Mistral Large", "Claude", "Web Search Agent"],
148
+ "messages": [
149
+ {"speaker": "QwQ-32B", "text": "Strategic analysis complete with key considerations outlined."},
150
+ {"speaker": "DeepSeek-R1", "text": "Statistical validation: 73% success probability confirmed."},
151
+ {"speaker": "Web Search Agent", "text": "Market data supports positive outlook: +23% growth, 87% sentiment."},
152
+ {"speaker": "Claude", "text": "Phased approach recommended with integrated risk mitigation."},
153
+ {"speaker": "Mistral Large", "text": "🏆 **CONSENSUS ACHIEVED**\n\nAll analyses converge on a **GO decision** with the following framework:\n\n✅ Phased implementation\n✅ 73% success probability\n✅ Strong market fundamentals\n✅ Risk mitigation protocols"}
154
+ ],
155
+ "currentSpeaker": "Mistral Large",
156
+ "thinking": [],
157
+ "showBubbles": ["QwQ-32B", "DeepSeek-R1", "Web Search Agent", "Claude"],
158
+ "avatarImages": avatar_images
159
+ }
160
+ ]
161
+
162
+ return initial_state, states
163
+
164
+ def update_discussion_state(state_index, states):
165
+ \"\"\"Get the next state in the discussion\"\"\"
166
+ if state_index >= len(states):
167
+ state_index = 0
168
+ return states[state_index], state_index + 1
169
+
170
+ # Initialize the discussion
171
+ initial_state, discussion_states = simulate_discussion()
172
+
173
+ with gr.Blocks() as demo:
174
+ gr.Markdown("# 🎭 Consilium Roundtable Demo")
175
+ gr.Markdown("**Watch the AI discussion unfold!** Click 'Next State' to see different phases of the discussion. 📼 Demo Video: https://youtu.be/oyYlf1BfuU8")
176
+
177
+ # State management
178
+ state_counter = gr.State(0)
179
+
180
+ # The roundtable component
181
+ roundtable = consilium_roundtable(
182
+ label="AI Discussion Roundtable",
183
+ show_label=True,
184
+ label_icon="https://huggingface.co/front/assets/huggingface_logo-noborder.svg",
185
+ value=initial_state
186
+ )
187
+
188
+ with gr.Row():
189
+ next_btn = gr.Button("▶️ Next Discussion State", variant="primary")
190
+ reset_btn = gr.Button("🔄 Reset Discussion", variant="secondary")
191
+
192
+ # Status display
193
+ with gr.Row():
194
+ status_display = gr.Markdown("**Status:** Discussion ready to begin")
195
+
196
+ def next_state(current_counter):
197
+ new_state, new_counter = update_discussion_state(current_counter, discussion_states)
198
+
199
+ # Convert to proper JSON string
200
+ json_state = json.dumps(new_state)
201
+
202
+ # Create status message
203
+ thinking_list = new_state.get("thinking", [])
204
+ current_speaker = new_state.get("currentSpeaker")
205
+
206
+ if thinking_list:
207
+ status = f"**Status:** {', '.join(thinking_list)} {'is' if len(thinking_list) == 1 else 'are'} thinking..."
208
+ elif current_speaker:
209
+ status = f"**Status:** {current_speaker} is responding..."
210
+ else:
211
+ status = "**Status:** Discussion in progress..."
212
+
213
+ return json_state, new_counter, status
214
+
215
+ def reset_discussion():
216
+ json_state = json.dumps(initial_state)
217
+ return json_state, 0, "**Status:** Discussion reset - ready to begin"
218
+
219
+ next_btn.click(
220
+ next_state,
221
+ inputs=[state_counter],
222
+ outputs=[roundtable, state_counter, status_display]
223
+ )
224
+
225
+ reset_btn.click(
226
+ reset_discussion,
227
+ outputs=[roundtable, state_counter, status_display]
228
+ )
229
+
230
+ if __name__ == "__main__":
231
+ demo.launch()
232
+ ```
233
+ """, elem_classes=["md-custom"], header_links=True)
234
+
235
+
236
+ gr.Markdown("""
237
+ ## `consilium_roundtable`
238
+
239
+ ### Initialization
240
+ """, elem_classes=["md-custom"], header_links=True)
241
+
242
+ gr.ParamViewer(value=_docs["consilium_roundtable"]["members"]["__init__"], linkify=[])
243
+
244
+
245
+ gr.Markdown("### Events")
246
+ gr.ParamViewer(value=_docs["consilium_roundtable"]["events"], linkify=['Event'])
247
+
248
+
249
+
250
+
251
+ gr.Markdown("""
252
+
253
+ ### User function
254
+
255
+ The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
256
+
257
+ - When used as an Input, the component only impacts the input signature of the user function.
258
+ - When used as an output, the component only impacts the return signature of the user function.
259
+
260
+ The code snippet below is accurate in cases where the component is used as both an input and an output.
261
+
262
+ - **As input:** Is passed, passes the JSON string value for processing.
263
+ - **As output:** Should return, discussion state as dict or JSON string containing:.
264
+
265
+ ```python
266
+ def predict(
267
+ value: str | None
268
+ ) -> Any:
269
+ return value
270
+ ```
271
+ """, elem_classes=["md-custom", "consilium_roundtable-user-fn"], header_links=True)
272
+
273
+
274
+
275
+
276
+ demo.load(None, js=r"""function() {
277
+ const refs = {};
278
+ const user_fn_refs = {
279
+ consilium_roundtable: [], };
280
+ requestAnimationFrame(() => {
281
+
282
+ Object.entries(user_fn_refs).forEach(([key, refs]) => {
283
+ if (refs.length > 0) {
284
+ const el = document.querySelector(`.${key}-user-fn`);
285
+ if (!el) return;
286
+ refs.forEach(ref => {
287
+ el.innerHTML = el.innerHTML.replace(
288
+ new RegExp("\\b"+ref+"\\b", "g"),
289
+ `<a href="#h-${ref.toLowerCase()}">${ref}</a>`
290
+ );
291
+ })
292
+ }
293
+ })
294
+
295
+ Object.entries(refs).forEach(([key, refs]) => {
296
+ if (refs.length > 0) {
297
+ const el = document.querySelector(`.${key}`);
298
+ if (!el) return;
299
+ refs.forEach(ref => {
300
+ el.innerHTML = el.innerHTML.replace(
301
+ new RegExp("\\b"+ref+"\\b", "g"),
302
+ `<a href="#h-${ref.toLowerCase()}">${ref}</a>`
303
+ );
304
+ })
305
+ }
306
+ })
307
+ })
308
+ }
309
+
310
+ """)
311
+
312
+ demo.launch()
src/frontend/Example.svelte ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { onMount } from "svelte";
3
+ import Index from "./Index.svelte";
4
+
5
+ let value = JSON.stringify({
6
+ "participants": ["Claude", "GPT-4", "Mistral"],
7
+ "messages": [
8
+ {"speaker": "Claude", "text": "Welcome to the roundtable!"}
9
+ ],
10
+ "currentSpeaker": "Claude",
11
+ "thinking": []
12
+ });
13
+ </script>
14
+
15
+ <Index
16
+ {value}
17
+ label="Example Roundtable"
18
+ visible={true}
19
+ elem_id="example"
20
+ elem_classes={[]}
21
+ scale={null}
22
+ min_width={600}
23
+ gradio={{}}
24
+ show_label={true}
25
+ />
src/frontend/Index.svelte ADDED
@@ -0,0 +1,470 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { marked } from 'marked';
3
+
4
+ export let gradio: any;
5
+ export let elem_id: string = "";
6
+ export let elem_classes: string[] = [];
7
+ export let visible: boolean = true;
8
+ export let value: string = "{}";
9
+ export let label: string = "Consilium Roundtable";
10
+ export let label_icon: string | null = "🎭";
11
+ export let show_label: boolean = true;
12
+ export let scale: number | null = null;
13
+ export let min_width: number | undefined = undefined;
14
+
15
+ $: containerClasses = `wrapper ${elem_classes.join(' ')}`;
16
+ $: containerStyle = scale ? `--scale: ${scale}` : '';
17
+ $: minWidthStyle = min_width ? `min-width: ${min_width}px` : '';
18
+
19
+ let participants = [];
20
+ let messages = [];
21
+ let currentSpeaker = null;
22
+ let thinking = [];
23
+ let showBubbles = [];
24
+ let avatarImages = {};
25
+
26
+ function updateFromValue() {
27
+ try {
28
+ const parsedValue = JSON.parse(value);
29
+
30
+ participants = parsedValue.participants || [];
31
+ messages = parsedValue.messages || [];
32
+ currentSpeaker = parsedValue.currentSpeaker || null;
33
+ thinking = parsedValue.thinking || [];
34
+ showBubbles = parsedValue.showBubbles || [];
35
+ avatarImages = parsedValue.avatarImages || {};
36
+
37
+ console.log("Clean JSON parsed:", {participants, messages, currentSpeaker, thinking, showBubbles, avatarImages});
38
+ } catch (e) {
39
+ console.error("Invalid JSON:", value, e);
40
+ }
41
+ }
42
+
43
+ function renderMarkdown(text: string): string {
44
+ if (!text) return text;
45
+
46
+ try {
47
+ // Configure marked for inline rendering
48
+ marked.setOptions({
49
+ breaks: true, // Convert line breaks to <br>
50
+ gfm: true, // GitHub flavored markdown
51
+ sanitize: false, // Allow HTML (safe since we control input)
52
+ smartypants: false // Don't convert quotes/dashes
53
+ });
54
+
55
+ // For single lines, parse as inline; for multi-line, parse as block
56
+ const hasMultipleLines = text.includes('\n');
57
+
58
+ if (hasMultipleLines) {
59
+ return marked.parse(text);
60
+ } else {
61
+ return marked.parseInline(text);
62
+ }
63
+ } catch (error) {
64
+ console.error('Markdown parsing error:', error);
65
+ return text; // Fallback to plain text
66
+ }
67
+ }
68
+
69
+ $: value, updateFromValue();
70
+
71
+ const avatarEmojis = {
72
+ "Anthropic": "🤖",
73
+ "Claude": "🤖",
74
+ "Search": "🔍",
75
+ "Web Search Agent": "🔍",
76
+ "OpenAI": "🧠",
77
+ "GPT-4": "🧠",
78
+ "Google": "💎",
79
+ "Gemini": "💎",
80
+ "QwQ-32B": "😊",
81
+ "DeepSeek-R1": "🔮",
82
+ "Mistral": "🐱",
83
+ "Mistral Large": "🐱",
84
+ "Meta-Llama-3.1-8B": "🦙"
85
+ };
86
+
87
+ function getEmoji(name: string) {
88
+ return avatarEmojis[name] || "🤖";
89
+ }
90
+
91
+ function getAvatarImageUrl(name: string) {
92
+ return avatarImages[name] || null;
93
+ }
94
+
95
+ function hasCustomImage(name: string) {
96
+ return avatarImages[name] && avatarImages[name].trim() !== '';
97
+ }
98
+
99
+ function getLatestMessage(speaker: string) {
100
+ if (thinking.includes(speaker)) {
101
+ return `${speaker} is thinking...`;
102
+ }
103
+ if (currentSpeaker === speaker) {
104
+ return `${speaker} is responding...`;
105
+ }
106
+
107
+ const speakerMessages = messages.filter(m => m.speaker === speaker);
108
+ if (speakerMessages.length === 0) {
109
+ return `${speaker} is ready to discuss...`;
110
+ }
111
+ return speakerMessages[speakerMessages.length - 1].text || `${speaker} responded`;
112
+ }
113
+
114
+ function isBubbleVisible(speaker: string) {
115
+ const isThinking = thinking.includes(speaker);
116
+ const isSpeaking = currentSpeaker === speaker;
117
+ const shouldShow = showBubbles.includes(speaker);
118
+ const visible = isThinking || isSpeaking || shouldShow;
119
+
120
+ console.log(`${speaker} bubble visible:`, visible, {isThinking, isSpeaking, shouldShow});
121
+ return visible;
122
+ }
123
+
124
+ function isAvatarActive(speaker: string) {
125
+ return thinking.includes(speaker) || currentSpeaker === speaker;
126
+ }
127
+
128
+ function getPosition(index: number, total: number) {
129
+ const angle = (360 / total) * index;
130
+ const radians = (angle - 90) * (Math.PI / 180);
131
+
132
+ const radiusX = 260;
133
+ const radiusY = 180;
134
+
135
+ const x = Math.cos(radians) * radiusX;
136
+ const y = Math.sin(radians) * radiusY;
137
+
138
+ return {
139
+ left: `calc(50% + ${x}px)`,
140
+ top: `calc(50% + ${y}px)`,
141
+ transform: 'translate(-50%, -50%)'
142
+ };
143
+ }
144
+
145
+ function handleImageError(event: Event, participant: string) {
146
+ console.warn(`Failed to load avatar image for ${participant}, falling back to emoji`);
147
+ // Hide the image and show emoji by removing the image URL
148
+ avatarImages = {...avatarImages, [participant]: null};
149
+ }
150
+
151
+ function handleLabelIconError(event: Event) {
152
+ console.warn('Failed to load label icon image, falling back to default emoji');
153
+ // Set to null to trigger emoji fallback
154
+ label_icon = null;
155
+ }
156
+
157
+ function isImageUrl(str: string | null): boolean {
158
+ if (!str) return false;
159
+ return str.startsWith('http://') || str.startsWith('https://') || str.startsWith('data:');
160
+ }
161
+ </script>
162
+
163
+ <div
164
+ class={containerClasses}
165
+ class:hidden={!visible}
166
+ id={elem_id}
167
+ style="{containerStyle}; {minWidthStyle}"
168
+ >
169
+ <div class="consilium-container" id="consilium-roundtable">
170
+ <div class="table-center">
171
+ {#if show_label && label}
172
+ <label class="block-title" for="consilium-roundtable">
173
+ {#if label_icon}
174
+ <div class="label-icon-container">
175
+ {#if isImageUrl(label_icon)}
176
+ <img
177
+ src={label_icon}
178
+ alt="Label Icon"
179
+ class="label-icon-image"
180
+ on:error={handleLabelIconError}
181
+ />
182
+ {:else}
183
+ <span class="label-icon-emoji">{label_icon}</span>
184
+ {/if}
185
+ </div>
186
+ {/if}
187
+ {label}
188
+ </label>
189
+ {/if}
190
+ </div>
191
+
192
+ <div class="participants-circle">
193
+ {#each participants as participant, index}
194
+ <div
195
+ class="participant-seat"
196
+ style="left: {getPosition(index, participants.length).left}; top: {getPosition(index, participants.length).top}; transform: {getPosition(index, participants.length).transform};"
197
+ >
198
+ <div class="speech-bubble" class:visible={isBubbleVisible(participant)}>
199
+ <div class="bubble-content">{@html renderMarkdown(getLatestMessage(participant))}</div>
200
+ <div class="bubble-arrow"></div>
201
+ </div>
202
+
203
+ <div
204
+ class="avatar"
205
+ class:speaking={isAvatarActive(participant)}
206
+ class:thinking={thinking.includes(participant)}
207
+ class:responding={currentSpeaker === participant}
208
+ class:has-image={hasCustomImage(participant)}
209
+ role="button"
210
+ tabindex="0"
211
+ >
212
+ {#if hasCustomImage(participant)}
213
+ <img
214
+ src={getAvatarImageUrl(participant)}
215
+ alt={participant}
216
+ class="avatar-image"
217
+ on:error={(event) => handleImageError(event, participant)}
218
+ />
219
+ {:else}
220
+ <span class="avatar-emoji">{getEmoji(participant)}</span>
221
+ {/if}
222
+ </div>
223
+ <div class="participant-name">{participant}</div>
224
+ </div>
225
+ {/each}
226
+ </div>
227
+ </div>
228
+ </div>
229
+
230
+ <style>
231
+ .hidden {
232
+ display: none;
233
+ }
234
+
235
+ .block-title {
236
+ padding: 10px;
237
+ font-weight: bold;
238
+ color: #ffd700;
239
+ display: flex;
240
+ flex-wrap: wrap;
241
+ justify-content: center;
242
+ text-shadow: 0 2px 4px rgba(0,0,0,0.8);
243
+ }
244
+
245
+ .label-icon-container {
246
+ width: 24px;
247
+ height: 24px;
248
+ }
249
+
250
+ .label-icon-emoji {
251
+ font-size: 1.2rem;
252
+ line-height: 1;
253
+ }
254
+
255
+ .label-icon-image {
256
+ width: 24px;
257
+ height: 24px;
258
+ object-fit: contain;
259
+ border-radius: 4px;
260
+ }
261
+
262
+ .wrapper {
263
+ width: 600px;
264
+ height: 600px;
265
+ position: relative;
266
+ }
267
+
268
+ .consilium-container {
269
+ top: 150px;
270
+ position: relative;
271
+ width: 450px;
272
+ height: 300px;
273
+ margin: 20px auto;
274
+ border-radius: 50%;
275
+ background: linear-gradient(135deg, #0f5132, #198754);
276
+ border: 8px solid #8b4513;
277
+ box-shadow:
278
+ 0 8px 32px rgba(0,0,0,0.4),
279
+ inset 0 0 20px rgba(0,0,0,0.2);
280
+ }
281
+
282
+ .table-center {
283
+ position: absolute;
284
+ top: 50%;
285
+ left: 50%;
286
+ transform: translate(-50%, -50%);
287
+ text-align: center;
288
+ background: rgba(0,0,0,0.3);
289
+ border-radius: 50%;
290
+ width: 140px;
291
+ height: 100px;
292
+ display: flex;
293
+ flex-direction: column;
294
+ align-items: center;
295
+ justify-content: center;
296
+ border: 2px solid #8b4513;
297
+ box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
298
+ }
299
+
300
+ .participant-seat {
301
+ position: absolute;
302
+ display: flex;
303
+ flex-direction: column;
304
+ align-items: center;
305
+ }
306
+
307
+ .avatar {
308
+ width: 60px;
309
+ height: 60px;
310
+ border-radius: 50%;
311
+ display: flex;
312
+ align-items: center;
313
+ justify-content: center;
314
+ font-size: 1.4rem;
315
+ background: linear-gradient(145deg, #ffffff, #e6e6e6);
316
+ border: 3px solid #8b4513;
317
+ box-shadow:
318
+ 0 6px 15px rgba(0,0,0,0.3),
319
+ inset 0 2px 5px rgba(255,255,255,0.5);
320
+ margin-bottom: 8px;
321
+ transition: all 0.3s ease;
322
+ position: relative;
323
+ z-index: 10;
324
+ overflow: hidden;
325
+ }
326
+
327
+ .avatar.has-image {
328
+ background: #f8f9fa;
329
+ padding: 2px;
330
+ }
331
+
332
+ .avatar-image {
333
+ width: 100%;
334
+ height: 100%;
335
+ object-fit: cover;
336
+ border-radius: 50%;
337
+ }
338
+
339
+ .avatar-emoji {
340
+ font-size: 1.4rem;
341
+ line-height: 1;
342
+ }
343
+
344
+ .avatar.thinking {
345
+ border-color: #ff6b35;
346
+ animation: thinking-pulse 1.5s infinite;
347
+ }
348
+
349
+ .avatar.responding {
350
+ border-color: #ffd700;
351
+ animation: speaking-glow 1s infinite;
352
+ }
353
+
354
+ .avatar.speaking {
355
+ border-color: #ffd700;
356
+ }
357
+
358
+ .participant-name {
359
+ font-size: 0.75rem;
360
+ font-weight: bold;
361
+ color: #ffd700;
362
+ text-shadow: 0 2px 4px rgba(0,0,0,0.8);
363
+ text-align: center;
364
+ white-space: nowrap;
365
+ background: rgba(0,0,0,0.3);
366
+ padding: 2px 8px;
367
+ border-radius: 10px;
368
+ border: 1px solid #8b4513;
369
+ }
370
+
371
+ .speech-bubble {
372
+ position: absolute;
373
+ bottom: 90px;
374
+ left: 50%;
375
+ transform: translateX(-50%) translateY(20px);
376
+ background: white;
377
+ border-radius: 15px;
378
+ padding: 10px 14px;
379
+ box-shadow: 0 8px 25px rgba(0,0,0,0.3);
380
+ z-index: 20;
381
+ opacity: 0;
382
+ transition: all 0.4s ease;
383
+ pointer-events: none;
384
+ border: 2px solid #8b4513;
385
+ min-width: 180px;
386
+ max-width: 300px;
387
+ word-wrap: break-word;
388
+ white-space: normal;
389
+ }
390
+
391
+ .speech-bubble.visible {
392
+ opacity: 1;
393
+ transform: translateX(-50%) translateY(0);
394
+ pointer-events: auto;
395
+ }
396
+
397
+ .bubble-content {
398
+ font-size: 0.8rem;
399
+ color: #333;
400
+ line-height: 1.4;
401
+ text-align: left;
402
+ max-height: 100px;
403
+ overflow-y: auto;
404
+ scrollbar-width: thin;
405
+ scrollbar-color: #8b4513 #f0f0f0;
406
+ }
407
+
408
+ .bubble-content::-webkit-scrollbar {
409
+ width: 6px;
410
+ }
411
+
412
+ .bubble-content::-webkit-scrollbar-track {
413
+ background: #f0f0f0;
414
+ border-radius: 3px;
415
+ }
416
+
417
+ .bubble-content::-webkit-scrollbar-thumb {
418
+ background: #8b4513;
419
+ border-radius: 3px;
420
+ }
421
+
422
+ .bubble-content::-webkit-scrollbar-thumb:hover {
423
+ background: #654321;
424
+ }
425
+
426
+ .bubble-arrow {
427
+ position: absolute;
428
+ bottom: -10px;
429
+ left: 50%;
430
+ transform: translateX(-50%);
431
+ width: 0;
432
+ height: 0;
433
+ border-left: 10px solid transparent;
434
+ border-right: 10px solid transparent;
435
+ border-top: 10px solid white;
436
+ }
437
+
438
+ .bubble-arrow::before {
439
+ content: '';
440
+ position: absolute;
441
+ bottom: 2px;
442
+ left: 50%;
443
+ transform: translateX(-50%);
444
+ width: 0;
445
+ height: 0;
446
+ border-left: 12px solid transparent;
447
+ border-right: 12px solid transparent;
448
+ border-top: 12px solid #8b4513;
449
+ }
450
+
451
+ @keyframes thinking-pulse {
452
+ 0%, 100% {
453
+ transform: scale(1);
454
+ box-shadow: 0 6px 15px rgba(0,0,0,0.3), 0 0 15px rgba(255, 107, 53, 0.4);
455
+ }
456
+ 50% {
457
+ transform: scale(1.03);
458
+ box-shadow: 0 8px 20px rgba(0,0,0,0.4), 0 0 25px rgba(255, 107, 53, 0.6);
459
+ }
460
+ }
461
+
462
+ @keyframes speaking-glow {
463
+ 0%, 100% {
464
+ box-shadow: 0 6px 15px rgba(0,0,0,0.3), 0 0 20px rgba(255, 215, 0, 0.5);
465
+ }
466
+ 50% {
467
+ box-shadow: 0 8px 20px rgba(0,0,0,0.4), 0 0 30px rgba(255, 215, 0, 0.8);
468
+ }
469
+ }
470
+ </style>
src/frontend/gradio.config.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ export default {
2
+ plugins: [],
3
+ svelte: {
4
+ preprocess: [],
5
+ },
6
+ build: {
7
+ target: "modules",
8
+ },
9
+ };
src/frontend/package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
src/frontend/package.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "gradio_consilium_roundtable",
3
+ "version": "0.3.22",
4
+ "description": "Gradio UI packages",
5
+ "type": "module",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "private": false,
9
+ "main_changeset": true,
10
+ "exports": {
11
+ ".": {
12
+ "gradio": "./Index.svelte",
13
+ "svelte": "./dist/Index.svelte",
14
+ "types": "./dist/Index.svelte.d.ts"
15
+ },
16
+ "./example": {
17
+ "gradio": "./Example.svelte",
18
+ "svelte": "./dist/Example.svelte",
19
+ "types": "./dist/Example.svelte.d.ts"
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "dependencies": {
24
+ "@gradio/atoms": "0.16.1",
25
+ "@gradio/icons": "0.12.0",
26
+ "@gradio/statustracker": "0.10.12",
27
+ "@gradio/utils": "0.10.2"
28
+ },
29
+ "devDependencies": {
30
+ "@gradio/preview": "0.13.0"
31
+ },
32
+ "peerDependencies": {
33
+ "svelte": "^4.0.0"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/gradio-app/gradio.git",
38
+ "directory": "js/simpletextbox"
39
+ }
40
+ }
src/frontend/tsconfig.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "verbatimModuleSyntax": true,
4
+ "moduleResolution": "node",
5
+ "target": "es2017",
6
+ "lib": ["es2017", "dom"],
7
+ "allowJs": true,
8
+ "checkJs": false,
9
+ "strict": false,
10
+ "skipLibCheck": true
11
+ },
12
+ "include": ["**/*.ts", "**/*.svelte"]
13
+ }
src/gradio_consilium_roundtable/templates/component/index.js ADDED
@@ -0,0 +1,1880 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var Xe = Object.defineProperty;
2
+ var we = (o) => {
3
+ throw TypeError(o);
4
+ };
5
+ var Je = (o, e, t) => e in o ? Xe(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
6
+ var _ = (o, e, t) => Je(o, typeof e != "symbol" ? e + "" : e, t), We = (o, e, t) => e.has(o) || we("Cannot " + t);
7
+ var xe = (o, e, t) => e.has(o) ? we("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t);
8
+ var W = (o, e, t) => (We(o, e, "access private method"), t);
9
+ function ce() {
10
+ return {
11
+ async: !1,
12
+ breaks: !1,
13
+ extensions: null,
14
+ gfm: !0,
15
+ hooks: null,
16
+ pedantic: !1,
17
+ renderer: null,
18
+ silent: !1,
19
+ tokenizer: null,
20
+ walkTokens: null
21
+ };
22
+ }
23
+ let D = ce();
24
+ function Le(o) {
25
+ D = o;
26
+ }
27
+ const Me = /[&<>"']/, Ye = new RegExp(Me.source, "g"), $e = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, Ke = new RegExp($e.source, "g"), et = {
28
+ "&": "&amp;",
29
+ "<": "&lt;",
30
+ ">": "&gt;",
31
+ '"': "&quot;",
32
+ "'": "&#39;"
33
+ }, _e = (o) => et[o];
34
+ function R(o, e) {
35
+ if (e) {
36
+ if (Me.test(o))
37
+ return o.replace(Ye, _e);
38
+ } else if ($e.test(o))
39
+ return o.replace(Ke, _e);
40
+ return o;
41
+ }
42
+ const tt = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
43
+ function nt(o) {
44
+ return o.replace(tt, (e, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : ""));
45
+ }
46
+ const st = /(^|[^\[])\^/g;
47
+ function w(o, e) {
48
+ let t = typeof o == "string" ? o : o.source;
49
+ e = e || "";
50
+ const n = {
51
+ replace: (i, l) => {
52
+ let s = typeof l == "string" ? l : l.source;
53
+ return s = s.replace(st, "$1"), t = t.replace(i, s), n;
54
+ },
55
+ getRegex: () => new RegExp(t, e)
56
+ };
57
+ return n;
58
+ }
59
+ function ye(o) {
60
+ try {
61
+ o = encodeURI(o).replace(/%25/g, "%");
62
+ } catch {
63
+ return null;
64
+ }
65
+ return o;
66
+ }
67
+ const H = { exec: () => null };
68
+ function Te(o, e) {
69
+ const t = o.replace(/\|/g, (l, s, r) => {
70
+ let a = !1, p = s;
71
+ for (; --p >= 0 && r[p] === "\\"; )
72
+ a = !a;
73
+ return a ? "|" : " |";
74
+ }), n = t.split(/ \|/);
75
+ let i = 0;
76
+ if (n[0].trim() || n.shift(), n.length > 0 && !n[n.length - 1].trim() && n.pop(), e)
77
+ if (n.length > e)
78
+ n.splice(e);
79
+ else
80
+ for (; n.length < e; )
81
+ n.push("");
82
+ for (; i < n.length; i++)
83
+ n[i] = n[i].trim().replace(/\\\|/g, "|");
84
+ return n;
85
+ }
86
+ function Y(o, e, t) {
87
+ const n = o.length;
88
+ if (n === 0)
89
+ return "";
90
+ let i = 0;
91
+ for (; i < n && o.charAt(n - i - 1) === e; )
92
+ i++;
93
+ return o.slice(0, n - i);
94
+ }
95
+ function it(o, e) {
96
+ if (o.indexOf(e[1]) === -1)
97
+ return -1;
98
+ let t = 0;
99
+ for (let n = 0; n < o.length; n++)
100
+ if (o[n] === "\\")
101
+ n++;
102
+ else if (o[n] === e[0])
103
+ t++;
104
+ else if (o[n] === e[1] && (t--, t < 0))
105
+ return n;
106
+ return -1;
107
+ }
108
+ function ve(o, e, t, n) {
109
+ const i = e.href, l = e.title ? R(e.title) : null, s = o[1].replace(/\\([\[\]])/g, "$1");
110
+ if (o[0].charAt(0) !== "!") {
111
+ n.state.inLink = !0;
112
+ const r = {
113
+ type: "link",
114
+ raw: t,
115
+ href: i,
116
+ title: l,
117
+ text: s,
118
+ tokens: n.inlineTokens(s)
119
+ };
120
+ return n.state.inLink = !1, r;
121
+ }
122
+ return {
123
+ type: "image",
124
+ raw: t,
125
+ href: i,
126
+ title: l,
127
+ text: R(s)
128
+ };
129
+ }
130
+ function lt(o, e) {
131
+ const t = o.match(/^(\s+)(?:```)/);
132
+ if (t === null)
133
+ return e;
134
+ const n = t[1];
135
+ return e.split(`
136
+ `).map((i) => {
137
+ const l = i.match(/^\s+/);
138
+ if (l === null)
139
+ return i;
140
+ const [s] = l;
141
+ return s.length >= n.length ? i.slice(n.length) : i;
142
+ }).join(`
143
+ `);
144
+ }
145
+ class ee {
146
+ // set by the lexer
147
+ constructor(e) {
148
+ _(this, "options");
149
+ _(this, "rules");
150
+ // set by the lexer
151
+ _(this, "lexer");
152
+ this.options = e || D;
153
+ }
154
+ space(e) {
155
+ const t = this.rules.block.newline.exec(e);
156
+ if (t && t[0].length > 0)
157
+ return {
158
+ type: "space",
159
+ raw: t[0]
160
+ };
161
+ }
162
+ code(e) {
163
+ const t = this.rules.block.code.exec(e);
164
+ if (t) {
165
+ const n = t[0].replace(/^ {1,4}/gm, "");
166
+ return {
167
+ type: "code",
168
+ raw: t[0],
169
+ codeBlockStyle: "indented",
170
+ text: this.options.pedantic ? n : Y(n, `
171
+ `)
172
+ };
173
+ }
174
+ }
175
+ fences(e) {
176
+ const t = this.rules.block.fences.exec(e);
177
+ if (t) {
178
+ const n = t[0], i = lt(n, t[3] || "");
179
+ return {
180
+ type: "code",
181
+ raw: n,
182
+ lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
183
+ text: i
184
+ };
185
+ }
186
+ }
187
+ heading(e) {
188
+ const t = this.rules.block.heading.exec(e);
189
+ if (t) {
190
+ let n = t[2].trim();
191
+ if (/#$/.test(n)) {
192
+ const i = Y(n, "#");
193
+ (this.options.pedantic || !i || / $/.test(i)) && (n = i.trim());
194
+ }
195
+ return {
196
+ type: "heading",
197
+ raw: t[0],
198
+ depth: t[1].length,
199
+ text: n,
200
+ tokens: this.lexer.inline(n)
201
+ };
202
+ }
203
+ }
204
+ hr(e) {
205
+ const t = this.rules.block.hr.exec(e);
206
+ if (t)
207
+ return {
208
+ type: "hr",
209
+ raw: t[0]
210
+ };
211
+ }
212
+ blockquote(e) {
213
+ const t = this.rules.block.blockquote.exec(e);
214
+ if (t) {
215
+ let n = t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
216
+ $1`);
217
+ n = Y(n.replace(/^ *>[ \t]?/gm, ""), `
218
+ `);
219
+ const i = this.lexer.state.top;
220
+ this.lexer.state.top = !0;
221
+ const l = this.lexer.blockTokens(n);
222
+ return this.lexer.state.top = i, {
223
+ type: "blockquote",
224
+ raw: t[0],
225
+ tokens: l,
226
+ text: n
227
+ };
228
+ }
229
+ }
230
+ list(e) {
231
+ let t = this.rules.block.list.exec(e);
232
+ if (t) {
233
+ let n = t[1].trim();
234
+ const i = n.length > 1, l = {
235
+ type: "list",
236
+ raw: "",
237
+ ordered: i,
238
+ start: i ? +n.slice(0, -1) : "",
239
+ loose: !1,
240
+ items: []
241
+ };
242
+ n = i ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = i ? n : "[*+-]");
243
+ const s = new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);
244
+ let r = "", a = "", p = !1;
245
+ for (; e; ) {
246
+ let c = !1;
247
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e))
248
+ break;
249
+ r = t[0], e = e.substring(r.length);
250
+ let g = t[2].split(`
251
+ `, 1)[0].replace(/^\t+/, (k) => " ".repeat(3 * k.length)), h = e.split(`
252
+ `, 1)[0], u = 0;
253
+ this.options.pedantic ? (u = 2, a = g.trimStart()) : (u = t[2].search(/[^ ]/), u = u > 4 ? 1 : u, a = g.slice(u), u += t[1].length);
254
+ let b = !1;
255
+ if (!g && /^ *$/.test(h) && (r += h + `
256
+ `, e = e.substring(h.length + 1), c = !0), !c) {
257
+ const k = new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), x = new RegExp(`^ {0,${Math.min(3, u - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), z = new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:\`\`\`|~~~)`), S = new RegExp(`^ {0,${Math.min(3, u - 1)}}#`);
258
+ for (; e; ) {
259
+ const C = e.split(`
260
+ `, 1)[0];
261
+ if (h = C, this.options.pedantic && (h = h.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), z.test(h) || S.test(h) || k.test(h) || x.test(e))
262
+ break;
263
+ if (h.search(/[^ ]/) >= u || !h.trim())
264
+ a += `
265
+ ` + h.slice(u);
266
+ else {
267
+ if (b || g.search(/[^ ]/) >= 4 || z.test(g) || S.test(g) || x.test(g))
268
+ break;
269
+ a += `
270
+ ` + h;
271
+ }
272
+ !b && !h.trim() && (b = !0), r += C + `
273
+ `, e = e.substring(C.length + 1), g = h.slice(u);
274
+ }
275
+ }
276
+ l.loose || (p ? l.loose = !0 : /\n *\n *$/.test(r) && (p = !0));
277
+ let d = null, y;
278
+ this.options.gfm && (d = /^\[[ xX]\] /.exec(a), d && (y = d[0] !== "[ ] ", a = a.replace(/^\[[ xX]\] +/, ""))), l.items.push({
279
+ type: "list_item",
280
+ raw: r,
281
+ task: !!d,
282
+ checked: y,
283
+ loose: !1,
284
+ text: a,
285
+ tokens: []
286
+ }), l.raw += r;
287
+ }
288
+ l.items[l.items.length - 1].raw = r.trimEnd(), l.items[l.items.length - 1].text = a.trimEnd(), l.raw = l.raw.trimEnd();
289
+ for (let c = 0; c < l.items.length; c++)
290
+ if (this.lexer.state.top = !1, l.items[c].tokens = this.lexer.blockTokens(l.items[c].text, []), !l.loose) {
291
+ const g = l.items[c].tokens.filter((u) => u.type === "space"), h = g.length > 0 && g.some((u) => /\n.*\n/.test(u.raw));
292
+ l.loose = h;
293
+ }
294
+ if (l.loose)
295
+ for (let c = 0; c < l.items.length; c++)
296
+ l.items[c].loose = !0;
297
+ return l;
298
+ }
299
+ }
300
+ html(e) {
301
+ const t = this.rules.block.html.exec(e);
302
+ if (t)
303
+ return {
304
+ type: "html",
305
+ block: !0,
306
+ raw: t[0],
307
+ pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
308
+ text: t[0]
309
+ };
310
+ }
311
+ def(e) {
312
+ const t = this.rules.block.def.exec(e);
313
+ if (t) {
314
+ const n = t[1].toLowerCase().replace(/\s+/g, " "), i = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", l = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
315
+ return {
316
+ type: "def",
317
+ tag: n,
318
+ raw: t[0],
319
+ href: i,
320
+ title: l
321
+ };
322
+ }
323
+ }
324
+ table(e) {
325
+ const t = this.rules.block.table.exec(e);
326
+ if (!t || !/[:|]/.test(t[2]))
327
+ return;
328
+ const n = Te(t[1]), i = t[2].replace(/^\||\| *$/g, "").split("|"), l = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
329
+ `) : [], s = {
330
+ type: "table",
331
+ raw: t[0],
332
+ header: [],
333
+ align: [],
334
+ rows: []
335
+ };
336
+ if (n.length === i.length) {
337
+ for (const r of i)
338
+ /^ *-+: *$/.test(r) ? s.align.push("right") : /^ *:-+: *$/.test(r) ? s.align.push("center") : /^ *:-+ *$/.test(r) ? s.align.push("left") : s.align.push(null);
339
+ for (const r of n)
340
+ s.header.push({
341
+ text: r,
342
+ tokens: this.lexer.inline(r)
343
+ });
344
+ for (const r of l)
345
+ s.rows.push(Te(r, s.header.length).map((a) => ({
346
+ text: a,
347
+ tokens: this.lexer.inline(a)
348
+ })));
349
+ return s;
350
+ }
351
+ }
352
+ lheading(e) {
353
+ const t = this.rules.block.lheading.exec(e);
354
+ if (t)
355
+ return {
356
+ type: "heading",
357
+ raw: t[0],
358
+ depth: t[2].charAt(0) === "=" ? 1 : 2,
359
+ text: t[1],
360
+ tokens: this.lexer.inline(t[1])
361
+ };
362
+ }
363
+ paragraph(e) {
364
+ const t = this.rules.block.paragraph.exec(e);
365
+ if (t) {
366
+ const n = t[1].charAt(t[1].length - 1) === `
367
+ ` ? t[1].slice(0, -1) : t[1];
368
+ return {
369
+ type: "paragraph",
370
+ raw: t[0],
371
+ text: n,
372
+ tokens: this.lexer.inline(n)
373
+ };
374
+ }
375
+ }
376
+ text(e) {
377
+ const t = this.rules.block.text.exec(e);
378
+ if (t)
379
+ return {
380
+ type: "text",
381
+ raw: t[0],
382
+ text: t[0],
383
+ tokens: this.lexer.inline(t[0])
384
+ };
385
+ }
386
+ escape(e) {
387
+ const t = this.rules.inline.escape.exec(e);
388
+ if (t)
389
+ return {
390
+ type: "escape",
391
+ raw: t[0],
392
+ text: R(t[1])
393
+ };
394
+ }
395
+ tag(e) {
396
+ const t = this.rules.inline.tag.exec(e);
397
+ if (t)
398
+ return !this.lexer.state.inLink && /^<a /i.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
399
+ type: "html",
400
+ raw: t[0],
401
+ inLink: this.lexer.state.inLink,
402
+ inRawBlock: this.lexer.state.inRawBlock,
403
+ block: !1,
404
+ text: t[0]
405
+ };
406
+ }
407
+ link(e) {
408
+ const t = this.rules.inline.link.exec(e);
409
+ if (t) {
410
+ const n = t[2].trim();
411
+ if (!this.options.pedantic && /^</.test(n)) {
412
+ if (!/>$/.test(n))
413
+ return;
414
+ const s = Y(n.slice(0, -1), "\\");
415
+ if ((n.length - s.length) % 2 === 0)
416
+ return;
417
+ } else {
418
+ const s = it(t[2], "()");
419
+ if (s > -1) {
420
+ const a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
421
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, a).trim(), t[3] = "";
422
+ }
423
+ }
424
+ let i = t[2], l = "";
425
+ if (this.options.pedantic) {
426
+ const s = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);
427
+ s && (i = s[1], l = s[3]);
428
+ } else
429
+ l = t[3] ? t[3].slice(1, -1) : "";
430
+ return i = i.trim(), /^</.test(i) && (this.options.pedantic && !/>$/.test(n) ? i = i.slice(1) : i = i.slice(1, -1)), ve(t, {
431
+ href: i && i.replace(this.rules.inline.anyPunctuation, "$1"),
432
+ title: l && l.replace(this.rules.inline.anyPunctuation, "$1")
433
+ }, t[0], this.lexer);
434
+ }
435
+ }
436
+ reflink(e, t) {
437
+ let n;
438
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
439
+ const i = (n[2] || n[1]).replace(/\s+/g, " "), l = t[i.toLowerCase()];
440
+ if (!l) {
441
+ const s = n[0].charAt(0);
442
+ return {
443
+ type: "text",
444
+ raw: s,
445
+ text: s
446
+ };
447
+ }
448
+ return ve(n, l, n[0], this.lexer);
449
+ }
450
+ }
451
+ emStrong(e, t, n = "") {
452
+ let i = this.rules.inline.emStrongLDelim.exec(e);
453
+ if (!i || i[3] && n.match(/[\p{L}\p{N}]/u))
454
+ return;
455
+ if (!(i[1] || i[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
456
+ const s = [...i[0]].length - 1;
457
+ let r, a, p = s, c = 0;
458
+ const g = i[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
459
+ for (g.lastIndex = 0, t = t.slice(-1 * e.length + s); (i = g.exec(t)) != null; ) {
460
+ if (r = i[1] || i[2] || i[3] || i[4] || i[5] || i[6], !r)
461
+ continue;
462
+ if (a = [...r].length, i[3] || i[4]) {
463
+ p += a;
464
+ continue;
465
+ } else if ((i[5] || i[6]) && s % 3 && !((s + a) % 3)) {
466
+ c += a;
467
+ continue;
468
+ }
469
+ if (p -= a, p > 0)
470
+ continue;
471
+ a = Math.min(a, a + p + c);
472
+ const h = [...i[0]][0].length, u = e.slice(0, s + i.index + h + a);
473
+ if (Math.min(s, a) % 2) {
474
+ const d = u.slice(1, -1);
475
+ return {
476
+ type: "em",
477
+ raw: u,
478
+ text: d,
479
+ tokens: this.lexer.inlineTokens(d)
480
+ };
481
+ }
482
+ const b = u.slice(2, -2);
483
+ return {
484
+ type: "strong",
485
+ raw: u,
486
+ text: b,
487
+ tokens: this.lexer.inlineTokens(b)
488
+ };
489
+ }
490
+ }
491
+ }
492
+ codespan(e) {
493
+ const t = this.rules.inline.code.exec(e);
494
+ if (t) {
495
+ let n = t[2].replace(/\n/g, " ");
496
+ const i = /[^ ]/.test(n), l = /^ /.test(n) && / $/.test(n);
497
+ return i && l && (n = n.substring(1, n.length - 1)), n = R(n, !0), {
498
+ type: "codespan",
499
+ raw: t[0],
500
+ text: n
501
+ };
502
+ }
503
+ }
504
+ br(e) {
505
+ const t = this.rules.inline.br.exec(e);
506
+ if (t)
507
+ return {
508
+ type: "br",
509
+ raw: t[0]
510
+ };
511
+ }
512
+ del(e) {
513
+ const t = this.rules.inline.del.exec(e);
514
+ if (t)
515
+ return {
516
+ type: "del",
517
+ raw: t[0],
518
+ text: t[2],
519
+ tokens: this.lexer.inlineTokens(t[2])
520
+ };
521
+ }
522
+ autolink(e) {
523
+ const t = this.rules.inline.autolink.exec(e);
524
+ if (t) {
525
+ let n, i;
526
+ return t[2] === "@" ? (n = R(t[1]), i = "mailto:" + n) : (n = R(t[1]), i = n), {
527
+ type: "link",
528
+ raw: t[0],
529
+ text: n,
530
+ href: i,
531
+ tokens: [
532
+ {
533
+ type: "text",
534
+ raw: n,
535
+ text: n
536
+ }
537
+ ]
538
+ };
539
+ }
540
+ }
541
+ url(e) {
542
+ var n;
543
+ let t;
544
+ if (t = this.rules.inline.url.exec(e)) {
545
+ let i, l;
546
+ if (t[2] === "@")
547
+ i = R(t[0]), l = "mailto:" + i;
548
+ else {
549
+ let s;
550
+ do
551
+ s = t[0], t[0] = ((n = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : n[0]) ?? "";
552
+ while (s !== t[0]);
553
+ i = R(t[0]), t[1] === "www." ? l = "http://" + t[0] : l = t[0];
554
+ }
555
+ return {
556
+ type: "link",
557
+ raw: t[0],
558
+ text: i,
559
+ href: l,
560
+ tokens: [
561
+ {
562
+ type: "text",
563
+ raw: i,
564
+ text: i
565
+ }
566
+ ]
567
+ };
568
+ }
569
+ }
570
+ inlineText(e) {
571
+ const t = this.rules.inline.text.exec(e);
572
+ if (t) {
573
+ let n;
574
+ return this.lexer.state.inRawBlock ? n = t[0] : n = R(t[0]), {
575
+ type: "text",
576
+ raw: t[0],
577
+ text: n
578
+ };
579
+ }
580
+ }
581
+ }
582
+ const rt = /^(?: *(?:\n|$))+/, ot = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, at = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, U = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ct = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Be = /(?:[*+-]|\d{1,9}[.)])/, Pe = w(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, Be).replace(/blockCode/g, / {4}/).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/).getRegex(), he = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ht = /^[^\n]+/, ue = /(?!\s*\])(?:\\.|[^\[\]\\])+/, ut = w(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", ue).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), pt = w(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Be).getRegex(), se = "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", pe = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ft = w("^ {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", pe).replace("tag", se).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), qe = w(he).replace("hr", U).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", se).getRegex(), gt = w(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", qe).getRegex(), fe = {
583
+ blockquote: gt,
584
+ code: ot,
585
+ def: ut,
586
+ fences: at,
587
+ heading: ct,
588
+ hr: U,
589
+ html: ft,
590
+ lheading: Pe,
591
+ list: pt,
592
+ newline: rt,
593
+ paragraph: qe,
594
+ table: H,
595
+ text: ht
596
+ }, ze = w("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", U).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\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", se).getRegex(), dt = {
597
+ ...fe,
598
+ table: ze,
599
+ paragraph: w(he).replace("hr", U).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ze).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", se).getRegex()
600
+ }, kt = {
601
+ ...fe,
602
+ html: w(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", pe).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(),
603
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
604
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
605
+ fences: H,
606
+ // fences not supported
607
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
608
+ paragraph: w(he).replace("hr", U).replace("heading", ` *#{1,6} *[^
609
+ ]`).replace("lheading", Pe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
610
+ }, Ze = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, bt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, De = /^( {2,}|\\)\n(?!\s*$)/, mt = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, G = "\\p{P}\\p{S}", wt = w(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, G).getRegex(), xt = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g, _t = w(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, G).getRegex(), yt = w("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, G).getRegex(), Tt = w("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, G).getRegex(), vt = w(/\\([punct])/, "gu").replace(/punct/g, G).getRegex(), zt = w(/^<(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(), Rt = w(pe).replace("(?:-->|$)", "-->").getRegex(), It = w("^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", Rt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), te = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, St = w(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", te).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Oe = w(/^!?\[(label)\]\[(ref)\]/).replace("label", te).replace("ref", ue).getRegex(), Qe = w(/^!?\[(ref)\](?:\[\])?/).replace("ref", ue).getRegex(), At = w("reflink|nolink(?!\\()", "g").replace("reflink", Oe).replace("nolink", Qe).getRegex(), ge = {
611
+ _backpedal: H,
612
+ // only used for GFM url
613
+ anyPunctuation: vt,
614
+ autolink: zt,
615
+ blockSkip: xt,
616
+ br: De,
617
+ code: bt,
618
+ del: H,
619
+ emStrongLDelim: _t,
620
+ emStrongRDelimAst: yt,
621
+ emStrongRDelimUnd: Tt,
622
+ escape: Ze,
623
+ link: St,
624
+ nolink: Qe,
625
+ punctuation: wt,
626
+ reflink: Oe,
627
+ reflinkSearch: At,
628
+ tag: It,
629
+ text: mt,
630
+ url: H
631
+ }, Et = {
632
+ ...ge,
633
+ link: w(/^!?\[(label)\]\((.*?)\)/).replace("label", te).getRegex(),
634
+ reflink: w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", te).getRegex()
635
+ }, ie = {
636
+ ...ge,
637
+ escape: w(Ze).replace("])", "~|])").getRegex(),
638
+ url: w(/^((?: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(),
639
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
640
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
641
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
642
+ }, Ct = {
643
+ ...ie,
644
+ br: w(De).replace("{2,}", "*").getRegex(),
645
+ text: w(ie.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
646
+ }, K = {
647
+ normal: fe,
648
+ gfm: dt,
649
+ pedantic: kt
650
+ }, N = {
651
+ normal: ge,
652
+ gfm: ie,
653
+ breaks: Ct,
654
+ pedantic: Et
655
+ };
656
+ class $ {
657
+ constructor(e) {
658
+ _(this, "tokens");
659
+ _(this, "options");
660
+ _(this, "state");
661
+ _(this, "tokenizer");
662
+ _(this, "inlineQueue");
663
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || D, this.options.tokenizer = this.options.tokenizer || new ee(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
664
+ inLink: !1,
665
+ inRawBlock: !1,
666
+ top: !0
667
+ };
668
+ const t = {
669
+ block: K.normal,
670
+ inline: N.normal
671
+ };
672
+ this.options.pedantic ? (t.block = K.pedantic, t.inline = N.pedantic) : this.options.gfm && (t.block = K.gfm, this.options.breaks ? t.inline = N.breaks : t.inline = N.gfm), this.tokenizer.rules = t;
673
+ }
674
+ /**
675
+ * Expose Rules
676
+ */
677
+ static get rules() {
678
+ return {
679
+ block: K,
680
+ inline: N
681
+ };
682
+ }
683
+ /**
684
+ * Static Lex Method
685
+ */
686
+ static lex(e, t) {
687
+ return new $(t).lex(e);
688
+ }
689
+ /**
690
+ * Static Lex Inline Method
691
+ */
692
+ static lexInline(e, t) {
693
+ return new $(t).inlineTokens(e);
694
+ }
695
+ /**
696
+ * Preprocessing
697
+ */
698
+ lex(e) {
699
+ e = e.replace(/\r\n|\r/g, `
700
+ `), this.blockTokens(e, this.tokens);
701
+ for (let t = 0; t < this.inlineQueue.length; t++) {
702
+ const n = this.inlineQueue[t];
703
+ this.inlineTokens(n.src, n.tokens);
704
+ }
705
+ return this.inlineQueue = [], this.tokens;
706
+ }
707
+ blockTokens(e, t = []) {
708
+ this.options.pedantic ? e = e.replace(/\t/g, " ").replace(/^ +$/gm, "") : e = e.replace(/^( *)(\t+)/gm, (r, a, p) => a + " ".repeat(p.length));
709
+ let n, i, l, s;
710
+ for (; e; )
711
+ if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((r) => (n = r.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
712
+ if (n = this.tokenizer.space(e)) {
713
+ e = e.substring(n.raw.length), n.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += `
714
+ ` : t.push(n);
715
+ continue;
716
+ }
717
+ if (n = this.tokenizer.code(e)) {
718
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
719
+ ` + n.raw, i.text += `
720
+ ` + n.text, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
721
+ continue;
722
+ }
723
+ if (n = this.tokenizer.fences(e)) {
724
+ e = e.substring(n.raw.length), t.push(n);
725
+ continue;
726
+ }
727
+ if (n = this.tokenizer.heading(e)) {
728
+ e = e.substring(n.raw.length), t.push(n);
729
+ continue;
730
+ }
731
+ if (n = this.tokenizer.hr(e)) {
732
+ e = e.substring(n.raw.length), t.push(n);
733
+ continue;
734
+ }
735
+ if (n = this.tokenizer.blockquote(e)) {
736
+ e = e.substring(n.raw.length), t.push(n);
737
+ continue;
738
+ }
739
+ if (n = this.tokenizer.list(e)) {
740
+ e = e.substring(n.raw.length), t.push(n);
741
+ continue;
742
+ }
743
+ if (n = this.tokenizer.html(e)) {
744
+ e = e.substring(n.raw.length), t.push(n);
745
+ continue;
746
+ }
747
+ if (n = this.tokenizer.def(e)) {
748
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
749
+ ` + n.raw, i.text += `
750
+ ` + n.raw, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : this.tokens.links[n.tag] || (this.tokens.links[n.tag] = {
751
+ href: n.href,
752
+ title: n.title
753
+ });
754
+ continue;
755
+ }
756
+ if (n = this.tokenizer.table(e)) {
757
+ e = e.substring(n.raw.length), t.push(n);
758
+ continue;
759
+ }
760
+ if (n = this.tokenizer.lheading(e)) {
761
+ e = e.substring(n.raw.length), t.push(n);
762
+ continue;
763
+ }
764
+ if (l = e, this.options.extensions && this.options.extensions.startBlock) {
765
+ let r = 1 / 0;
766
+ const a = e.slice(1);
767
+ let p;
768
+ this.options.extensions.startBlock.forEach((c) => {
769
+ p = c.call({ lexer: this }, a), typeof p == "number" && p >= 0 && (r = Math.min(r, p));
770
+ }), r < 1 / 0 && r >= 0 && (l = e.substring(0, r + 1));
771
+ }
772
+ if (this.state.top && (n = this.tokenizer.paragraph(l))) {
773
+ i = t[t.length - 1], s && i.type === "paragraph" ? (i.raw += `
774
+ ` + n.raw, i.text += `
775
+ ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n), s = l.length !== e.length, e = e.substring(n.raw.length);
776
+ continue;
777
+ }
778
+ if (n = this.tokenizer.text(e)) {
779
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && i.type === "text" ? (i.raw += `
780
+ ` + n.raw, i.text += `
781
+ ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
782
+ continue;
783
+ }
784
+ if (e) {
785
+ const r = "Infinite loop on byte: " + e.charCodeAt(0);
786
+ if (this.options.silent) {
787
+ console.error(r);
788
+ break;
789
+ } else
790
+ throw new Error(r);
791
+ }
792
+ }
793
+ return this.state.top = !0, t;
794
+ }
795
+ inline(e, t = []) {
796
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
797
+ }
798
+ /**
799
+ * Lexing/Compiling
800
+ */
801
+ inlineTokens(e, t = []) {
802
+ let n, i, l, s = e, r, a, p;
803
+ if (this.tokens.links) {
804
+ const c = Object.keys(this.tokens.links);
805
+ if (c.length > 0)
806
+ for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; )
807
+ c.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
808
+ }
809
+ for (; (r = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; )
810
+ s = s.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
811
+ for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; )
812
+ s = s.slice(0, r.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
813
+ for (; e; )
814
+ if (a || (p = ""), a = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((c) => (n = c.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
815
+ if (n = this.tokenizer.escape(e)) {
816
+ e = e.substring(n.raw.length), t.push(n);
817
+ continue;
818
+ }
819
+ if (n = this.tokenizer.tag(e)) {
820
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
821
+ continue;
822
+ }
823
+ if (n = this.tokenizer.link(e)) {
824
+ e = e.substring(n.raw.length), t.push(n);
825
+ continue;
826
+ }
827
+ if (n = this.tokenizer.reflink(e, this.tokens.links)) {
828
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
829
+ continue;
830
+ }
831
+ if (n = this.tokenizer.emStrong(e, s, p)) {
832
+ e = e.substring(n.raw.length), t.push(n);
833
+ continue;
834
+ }
835
+ if (n = this.tokenizer.codespan(e)) {
836
+ e = e.substring(n.raw.length), t.push(n);
837
+ continue;
838
+ }
839
+ if (n = this.tokenizer.br(e)) {
840
+ e = e.substring(n.raw.length), t.push(n);
841
+ continue;
842
+ }
843
+ if (n = this.tokenizer.del(e)) {
844
+ e = e.substring(n.raw.length), t.push(n);
845
+ continue;
846
+ }
847
+ if (n = this.tokenizer.autolink(e)) {
848
+ e = e.substring(n.raw.length), t.push(n);
849
+ continue;
850
+ }
851
+ if (!this.state.inLink && (n = this.tokenizer.url(e))) {
852
+ e = e.substring(n.raw.length), t.push(n);
853
+ continue;
854
+ }
855
+ if (l = e, this.options.extensions && this.options.extensions.startInline) {
856
+ let c = 1 / 0;
857
+ const g = e.slice(1);
858
+ let h;
859
+ this.options.extensions.startInline.forEach((u) => {
860
+ h = u.call({ lexer: this }, g), typeof h == "number" && h >= 0 && (c = Math.min(c, h));
861
+ }), c < 1 / 0 && c >= 0 && (l = e.substring(0, c + 1));
862
+ }
863
+ if (n = this.tokenizer.inlineText(l)) {
864
+ e = e.substring(n.raw.length), n.raw.slice(-1) !== "_" && (p = n.raw.slice(-1)), a = !0, i = t[t.length - 1], i && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
865
+ continue;
866
+ }
867
+ if (e) {
868
+ const c = "Infinite loop on byte: " + e.charCodeAt(0);
869
+ if (this.options.silent) {
870
+ console.error(c);
871
+ break;
872
+ } else
873
+ throw new Error(c);
874
+ }
875
+ }
876
+ return t;
877
+ }
878
+ }
879
+ class ne {
880
+ constructor(e) {
881
+ _(this, "options");
882
+ this.options = e || D;
883
+ }
884
+ code(e, t, n) {
885
+ var l;
886
+ const i = (l = (t || "").match(/^\S*/)) == null ? void 0 : l[0];
887
+ return e = e.replace(/\n$/, "") + `
888
+ `, i ? '<pre><code class="language-' + R(i) + '">' + (n ? e : R(e, !0)) + `</code></pre>
889
+ ` : "<pre><code>" + (n ? e : R(e, !0)) + `</code></pre>
890
+ `;
891
+ }
892
+ blockquote(e) {
893
+ return `<blockquote>
894
+ ${e}</blockquote>
895
+ `;
896
+ }
897
+ html(e, t) {
898
+ return e;
899
+ }
900
+ heading(e, t, n) {
901
+ return `<h${t}>${e}</h${t}>
902
+ `;
903
+ }
904
+ hr() {
905
+ return `<hr>
906
+ `;
907
+ }
908
+ list(e, t, n) {
909
+ const i = t ? "ol" : "ul", l = t && n !== 1 ? ' start="' + n + '"' : "";
910
+ return "<" + i + l + `>
911
+ ` + e + "</" + i + `>
912
+ `;
913
+ }
914
+ listitem(e, t, n) {
915
+ return `<li>${e}</li>
916
+ `;
917
+ }
918
+ checkbox(e) {
919
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
920
+ }
921
+ paragraph(e) {
922
+ return `<p>${e}</p>
923
+ `;
924
+ }
925
+ table(e, t) {
926
+ return t && (t = `<tbody>${t}</tbody>`), `<table>
927
+ <thead>
928
+ ` + e + `</thead>
929
+ ` + t + `</table>
930
+ `;
931
+ }
932
+ tablerow(e) {
933
+ return `<tr>
934
+ ${e}</tr>
935
+ `;
936
+ }
937
+ tablecell(e, t) {
938
+ const n = t.header ? "th" : "td";
939
+ return (t.align ? `<${n} align="${t.align}">` : `<${n}>`) + e + `</${n}>
940
+ `;
941
+ }
942
+ /**
943
+ * span level renderer
944
+ */
945
+ strong(e) {
946
+ return `<strong>${e}</strong>`;
947
+ }
948
+ em(e) {
949
+ return `<em>${e}</em>`;
950
+ }
951
+ codespan(e) {
952
+ return `<code>${e}</code>`;
953
+ }
954
+ br() {
955
+ return "<br>";
956
+ }
957
+ del(e) {
958
+ return `<del>${e}</del>`;
959
+ }
960
+ link(e, t, n) {
961
+ const i = ye(e);
962
+ if (i === null)
963
+ return n;
964
+ e = i;
965
+ let l = '<a href="' + e + '"';
966
+ return t && (l += ' title="' + t + '"'), l += ">" + n + "</a>", l;
967
+ }
968
+ image(e, t, n) {
969
+ const i = ye(e);
970
+ if (i === null)
971
+ return n;
972
+ e = i;
973
+ let l = `<img src="${e}" alt="${n}"`;
974
+ return t && (l += ` title="${t}"`), l += ">", l;
975
+ }
976
+ text(e) {
977
+ return e;
978
+ }
979
+ }
980
+ class de {
981
+ // no need for block level renderers
982
+ strong(e) {
983
+ return e;
984
+ }
985
+ em(e) {
986
+ return e;
987
+ }
988
+ codespan(e) {
989
+ return e;
990
+ }
991
+ del(e) {
992
+ return e;
993
+ }
994
+ html(e) {
995
+ return e;
996
+ }
997
+ text(e) {
998
+ return e;
999
+ }
1000
+ link(e, t, n) {
1001
+ return "" + n;
1002
+ }
1003
+ image(e, t, n) {
1004
+ return "" + n;
1005
+ }
1006
+ br() {
1007
+ return "";
1008
+ }
1009
+ }
1010
+ class B {
1011
+ constructor(e) {
1012
+ _(this, "options");
1013
+ _(this, "renderer");
1014
+ _(this, "textRenderer");
1015
+ this.options = e || D, this.options.renderer = this.options.renderer || new ne(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new de();
1016
+ }
1017
+ /**
1018
+ * Static Parse Method
1019
+ */
1020
+ static parse(e, t) {
1021
+ return new B(t).parse(e);
1022
+ }
1023
+ /**
1024
+ * Static Parse Inline Method
1025
+ */
1026
+ static parseInline(e, t) {
1027
+ return new B(t).parseInline(e);
1028
+ }
1029
+ /**
1030
+ * Parse Loop
1031
+ */
1032
+ parse(e, t = !0) {
1033
+ let n = "";
1034
+ for (let i = 0; i < e.length; i++) {
1035
+ const l = e[i];
1036
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[l.type]) {
1037
+ const s = l, r = this.options.extensions.renderers[s.type].call({ parser: this }, s);
1038
+ if (r !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(s.type)) {
1039
+ n += r || "";
1040
+ continue;
1041
+ }
1042
+ }
1043
+ switch (l.type) {
1044
+ case "space":
1045
+ continue;
1046
+ case "hr": {
1047
+ n += this.renderer.hr();
1048
+ continue;
1049
+ }
1050
+ case "heading": {
1051
+ const s = l;
1052
+ n += this.renderer.heading(this.parseInline(s.tokens), s.depth, nt(this.parseInline(s.tokens, this.textRenderer)));
1053
+ continue;
1054
+ }
1055
+ case "code": {
1056
+ const s = l;
1057
+ n += this.renderer.code(s.text, s.lang, !!s.escaped);
1058
+ continue;
1059
+ }
1060
+ case "table": {
1061
+ const s = l;
1062
+ let r = "", a = "";
1063
+ for (let c = 0; c < s.header.length; c++)
1064
+ a += this.renderer.tablecell(this.parseInline(s.header[c].tokens), { header: !0, align: s.align[c] });
1065
+ r += this.renderer.tablerow(a);
1066
+ let p = "";
1067
+ for (let c = 0; c < s.rows.length; c++) {
1068
+ const g = s.rows[c];
1069
+ a = "";
1070
+ for (let h = 0; h < g.length; h++)
1071
+ a += this.renderer.tablecell(this.parseInline(g[h].tokens), { header: !1, align: s.align[h] });
1072
+ p += this.renderer.tablerow(a);
1073
+ }
1074
+ n += this.renderer.table(r, p);
1075
+ continue;
1076
+ }
1077
+ case "blockquote": {
1078
+ const s = l, r = this.parse(s.tokens);
1079
+ n += this.renderer.blockquote(r);
1080
+ continue;
1081
+ }
1082
+ case "list": {
1083
+ const s = l, r = s.ordered, a = s.start, p = s.loose;
1084
+ let c = "";
1085
+ for (let g = 0; g < s.items.length; g++) {
1086
+ const h = s.items[g], u = h.checked, b = h.task;
1087
+ let d = "";
1088
+ if (h.task) {
1089
+ const y = this.renderer.checkbox(!!u);
1090
+ p ? h.tokens.length > 0 && h.tokens[0].type === "paragraph" ? (h.tokens[0].text = y + " " + h.tokens[0].text, h.tokens[0].tokens && h.tokens[0].tokens.length > 0 && h.tokens[0].tokens[0].type === "text" && (h.tokens[0].tokens[0].text = y + " " + h.tokens[0].tokens[0].text)) : h.tokens.unshift({
1091
+ type: "text",
1092
+ text: y + " "
1093
+ }) : d += y + " ";
1094
+ }
1095
+ d += this.parse(h.tokens, p), c += this.renderer.listitem(d, b, !!u);
1096
+ }
1097
+ n += this.renderer.list(c, r, a);
1098
+ continue;
1099
+ }
1100
+ case "html": {
1101
+ const s = l;
1102
+ n += this.renderer.html(s.text, s.block);
1103
+ continue;
1104
+ }
1105
+ case "paragraph": {
1106
+ const s = l;
1107
+ n += this.renderer.paragraph(this.parseInline(s.tokens));
1108
+ continue;
1109
+ }
1110
+ case "text": {
1111
+ let s = l, r = s.tokens ? this.parseInline(s.tokens) : s.text;
1112
+ for (; i + 1 < e.length && e[i + 1].type === "text"; )
1113
+ s = e[++i], r += `
1114
+ ` + (s.tokens ? this.parseInline(s.tokens) : s.text);
1115
+ n += t ? this.renderer.paragraph(r) : r;
1116
+ continue;
1117
+ }
1118
+ default: {
1119
+ const s = 'Token with "' + l.type + '" type was not found.';
1120
+ if (this.options.silent)
1121
+ return console.error(s), "";
1122
+ throw new Error(s);
1123
+ }
1124
+ }
1125
+ }
1126
+ return n;
1127
+ }
1128
+ /**
1129
+ * Parse Inline Tokens
1130
+ */
1131
+ parseInline(e, t) {
1132
+ t = t || this.renderer;
1133
+ let n = "";
1134
+ for (let i = 0; i < e.length; i++) {
1135
+ const l = e[i];
1136
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[l.type]) {
1137
+ const s = this.options.extensions.renderers[l.type].call({ parser: this }, l);
1138
+ if (s !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
1139
+ n += s || "";
1140
+ continue;
1141
+ }
1142
+ }
1143
+ switch (l.type) {
1144
+ case "escape": {
1145
+ const s = l;
1146
+ n += t.text(s.text);
1147
+ break;
1148
+ }
1149
+ case "html": {
1150
+ const s = l;
1151
+ n += t.html(s.text);
1152
+ break;
1153
+ }
1154
+ case "link": {
1155
+ const s = l;
1156
+ n += t.link(s.href, s.title, this.parseInline(s.tokens, t));
1157
+ break;
1158
+ }
1159
+ case "image": {
1160
+ const s = l;
1161
+ n += t.image(s.href, s.title, s.text);
1162
+ break;
1163
+ }
1164
+ case "strong": {
1165
+ const s = l;
1166
+ n += t.strong(this.parseInline(s.tokens, t));
1167
+ break;
1168
+ }
1169
+ case "em": {
1170
+ const s = l;
1171
+ n += t.em(this.parseInline(s.tokens, t));
1172
+ break;
1173
+ }
1174
+ case "codespan": {
1175
+ const s = l;
1176
+ n += t.codespan(s.text);
1177
+ break;
1178
+ }
1179
+ case "br": {
1180
+ n += t.br();
1181
+ break;
1182
+ }
1183
+ case "del": {
1184
+ const s = l;
1185
+ n += t.del(this.parseInline(s.tokens, t));
1186
+ break;
1187
+ }
1188
+ case "text": {
1189
+ const s = l;
1190
+ n += t.text(s.text);
1191
+ break;
1192
+ }
1193
+ default: {
1194
+ const s = 'Token with "' + l.type + '" type was not found.';
1195
+ if (this.options.silent)
1196
+ return console.error(s), "";
1197
+ throw new Error(s);
1198
+ }
1199
+ }
1200
+ }
1201
+ return n;
1202
+ }
1203
+ }
1204
+ class F {
1205
+ constructor(e) {
1206
+ _(this, "options");
1207
+ this.options = e || D;
1208
+ }
1209
+ /**
1210
+ * Process markdown before marked
1211
+ */
1212
+ preprocess(e) {
1213
+ return e;
1214
+ }
1215
+ /**
1216
+ * Process HTML after marked is finished
1217
+ */
1218
+ postprocess(e) {
1219
+ return e;
1220
+ }
1221
+ /**
1222
+ * Process all tokens before walk tokens
1223
+ */
1224
+ processAllTokens(e) {
1225
+ return e;
1226
+ }
1227
+ }
1228
+ _(F, "passThroughHooks", /* @__PURE__ */ new Set([
1229
+ "preprocess",
1230
+ "postprocess",
1231
+ "processAllTokens"
1232
+ ]));
1233
+ var Z, le, je;
1234
+ class Lt {
1235
+ constructor(...e) {
1236
+ xe(this, Z);
1237
+ _(this, "defaults", ce());
1238
+ _(this, "options", this.setOptions);
1239
+ _(this, "parse", W(this, Z, le).call(this, $.lex, B.parse));
1240
+ _(this, "parseInline", W(this, Z, le).call(this, $.lexInline, B.parseInline));
1241
+ _(this, "Parser", B);
1242
+ _(this, "Renderer", ne);
1243
+ _(this, "TextRenderer", de);
1244
+ _(this, "Lexer", $);
1245
+ _(this, "Tokenizer", ee);
1246
+ _(this, "Hooks", F);
1247
+ this.use(...e);
1248
+ }
1249
+ /**
1250
+ * Run callback for every token
1251
+ */
1252
+ walkTokens(e, t) {
1253
+ var i, l;
1254
+ let n = [];
1255
+ for (const s of e)
1256
+ switch (n = n.concat(t.call(this, s)), s.type) {
1257
+ case "table": {
1258
+ const r = s;
1259
+ for (const a of r.header)
1260
+ n = n.concat(this.walkTokens(a.tokens, t));
1261
+ for (const a of r.rows)
1262
+ for (const p of a)
1263
+ n = n.concat(this.walkTokens(p.tokens, t));
1264
+ break;
1265
+ }
1266
+ case "list": {
1267
+ const r = s;
1268
+ n = n.concat(this.walkTokens(r.items, t));
1269
+ break;
1270
+ }
1271
+ default: {
1272
+ const r = s;
1273
+ (l = (i = this.defaults.extensions) == null ? void 0 : i.childTokens) != null && l[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((a) => {
1274
+ const p = r[a].flat(1 / 0);
1275
+ n = n.concat(this.walkTokens(p, t));
1276
+ }) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, t)));
1277
+ }
1278
+ }
1279
+ return n;
1280
+ }
1281
+ use(...e) {
1282
+ const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1283
+ return e.forEach((n) => {
1284
+ const i = { ...n };
1285
+ if (i.async = this.defaults.async || i.async || !1, n.extensions && (n.extensions.forEach((l) => {
1286
+ if (!l.name)
1287
+ throw new Error("extension name required");
1288
+ if ("renderer" in l) {
1289
+ const s = t.renderers[l.name];
1290
+ s ? t.renderers[l.name] = function(...r) {
1291
+ let a = l.renderer.apply(this, r);
1292
+ return a === !1 && (a = s.apply(this, r)), a;
1293
+ } : t.renderers[l.name] = l.renderer;
1294
+ }
1295
+ if ("tokenizer" in l) {
1296
+ if (!l.level || l.level !== "block" && l.level !== "inline")
1297
+ throw new Error("extension level must be 'block' or 'inline'");
1298
+ const s = t[l.level];
1299
+ s ? s.unshift(l.tokenizer) : t[l.level] = [l.tokenizer], l.start && (l.level === "block" ? t.startBlock ? t.startBlock.push(l.start) : t.startBlock = [l.start] : l.level === "inline" && (t.startInline ? t.startInline.push(l.start) : t.startInline = [l.start]));
1300
+ }
1301
+ "childTokens" in l && l.childTokens && (t.childTokens[l.name] = l.childTokens);
1302
+ }), i.extensions = t), n.renderer) {
1303
+ const l = this.defaults.renderer || new ne(this.defaults);
1304
+ for (const s in n.renderer) {
1305
+ if (!(s in l))
1306
+ throw new Error(`renderer '${s}' does not exist`);
1307
+ if (s === "options")
1308
+ continue;
1309
+ const r = s, a = n.renderer[r], p = l[r];
1310
+ l[r] = (...c) => {
1311
+ let g = a.apply(l, c);
1312
+ return g === !1 && (g = p.apply(l, c)), g || "";
1313
+ };
1314
+ }
1315
+ i.renderer = l;
1316
+ }
1317
+ if (n.tokenizer) {
1318
+ const l = this.defaults.tokenizer || new ee(this.defaults);
1319
+ for (const s in n.tokenizer) {
1320
+ if (!(s in l))
1321
+ throw new Error(`tokenizer '${s}' does not exist`);
1322
+ if (["options", "rules", "lexer"].includes(s))
1323
+ continue;
1324
+ const r = s, a = n.tokenizer[r], p = l[r];
1325
+ l[r] = (...c) => {
1326
+ let g = a.apply(l, c);
1327
+ return g === !1 && (g = p.apply(l, c)), g;
1328
+ };
1329
+ }
1330
+ i.tokenizer = l;
1331
+ }
1332
+ if (n.hooks) {
1333
+ const l = this.defaults.hooks || new F();
1334
+ for (const s in n.hooks) {
1335
+ if (!(s in l))
1336
+ throw new Error(`hook '${s}' does not exist`);
1337
+ if (s === "options")
1338
+ continue;
1339
+ const r = s, a = n.hooks[r], p = l[r];
1340
+ F.passThroughHooks.has(s) ? l[r] = (c) => {
1341
+ if (this.defaults.async)
1342
+ return Promise.resolve(a.call(l, c)).then((h) => p.call(l, h));
1343
+ const g = a.call(l, c);
1344
+ return p.call(l, g);
1345
+ } : l[r] = (...c) => {
1346
+ let g = a.apply(l, c);
1347
+ return g === !1 && (g = p.apply(l, c)), g;
1348
+ };
1349
+ }
1350
+ i.hooks = l;
1351
+ }
1352
+ if (n.walkTokens) {
1353
+ const l = this.defaults.walkTokens, s = n.walkTokens;
1354
+ i.walkTokens = function(r) {
1355
+ let a = [];
1356
+ return a.push(s.call(this, r)), l && (a = a.concat(l.call(this, r))), a;
1357
+ };
1358
+ }
1359
+ this.defaults = { ...this.defaults, ...i };
1360
+ }), this;
1361
+ }
1362
+ setOptions(e) {
1363
+ return this.defaults = { ...this.defaults, ...e }, this;
1364
+ }
1365
+ lexer(e, t) {
1366
+ return $.lex(e, t ?? this.defaults);
1367
+ }
1368
+ parser(e, t) {
1369
+ return B.parse(e, t ?? this.defaults);
1370
+ }
1371
+ }
1372
+ Z = new WeakSet(), le = function(e, t) {
1373
+ return (n, i) => {
1374
+ const l = { ...i }, s = { ...this.defaults, ...l };
1375
+ this.defaults.async === !0 && l.async === !1 && (s.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), s.async = !0);
1376
+ const r = W(this, Z, je).call(this, !!s.silent, !!s.async);
1377
+ if (typeof n > "u" || n === null)
1378
+ return r(new Error("marked(): input parameter is undefined or null"));
1379
+ if (typeof n != "string")
1380
+ return r(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1381
+ if (s.hooks && (s.hooks.options = s), s.async)
1382
+ return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then((a) => e(a, s)).then((a) => s.hooks ? s.hooks.processAllTokens(a) : a).then((a) => s.walkTokens ? Promise.all(this.walkTokens(a, s.walkTokens)).then(() => a) : a).then((a) => t(a, s)).then((a) => s.hooks ? s.hooks.postprocess(a) : a).catch(r);
1383
+ try {
1384
+ s.hooks && (n = s.hooks.preprocess(n));
1385
+ let a = e(n, s);
1386
+ s.hooks && (a = s.hooks.processAllTokens(a)), s.walkTokens && this.walkTokens(a, s.walkTokens);
1387
+ let p = t(a, s);
1388
+ return s.hooks && (p = s.hooks.postprocess(p)), p;
1389
+ } catch (a) {
1390
+ return r(a);
1391
+ }
1392
+ };
1393
+ }, je = function(e, t) {
1394
+ return (n) => {
1395
+ if (n.message += `
1396
+ Please report this to https://github.com/markedjs/marked.`, e) {
1397
+ const i = "<p>An error occurred:</p><pre>" + R(n.message + "", !0) + "</pre>";
1398
+ return t ? Promise.resolve(i) : i;
1399
+ }
1400
+ if (t)
1401
+ return Promise.reject(n);
1402
+ throw n;
1403
+ };
1404
+ };
1405
+ const q = new Lt();
1406
+ function m(o, e) {
1407
+ return q.parse(o, e);
1408
+ }
1409
+ m.options = m.setOptions = function(o) {
1410
+ return q.setOptions(o), m.defaults = q.defaults, Le(m.defaults), m;
1411
+ };
1412
+ m.getDefaults = ce;
1413
+ m.defaults = D;
1414
+ m.use = function(...o) {
1415
+ return q.use(...o), m.defaults = q.defaults, Le(m.defaults), m;
1416
+ };
1417
+ m.walkTokens = function(o, e) {
1418
+ return q.walkTokens(o, e);
1419
+ };
1420
+ m.parseInline = q.parseInline;
1421
+ m.Parser = B;
1422
+ m.parser = B.parse;
1423
+ m.Renderer = ne;
1424
+ m.TextRenderer = de;
1425
+ m.Lexer = $;
1426
+ m.lexer = $.lex;
1427
+ m.Tokenizer = ee;
1428
+ m.Hooks = F;
1429
+ m.parse = m;
1430
+ m.options;
1431
+ m.setOptions;
1432
+ m.use;
1433
+ m.walkTokens;
1434
+ m.parseInline;
1435
+ B.parse;
1436
+ $.lex;
1437
+ const {
1438
+ HtmlTagHydration: Mt,
1439
+ SvelteComponent: $t,
1440
+ append_hydration: v,
1441
+ attr: T,
1442
+ children: M,
1443
+ claim_element: A,
1444
+ claim_html_tag: Bt,
1445
+ claim_space: j,
1446
+ claim_text: re,
1447
+ destroy_each: Pt,
1448
+ detach: I,
1449
+ element: E,
1450
+ ensure_array_like: Re,
1451
+ get_svelte_dataset: qt,
1452
+ init: Zt,
1453
+ insert_hydration: ke,
1454
+ noop: Ie,
1455
+ null_to_empty: Se,
1456
+ safe_not_equal: Dt,
1457
+ set_data: oe,
1458
+ set_style: O,
1459
+ space: V,
1460
+ text: ae,
1461
+ toggle_class: L
1462
+ } = window.__gradio__svelte__internal;
1463
+ function Ae(o, e, t) {
1464
+ const n = o.slice();
1465
+ return n[27] = e[t], n[29] = t, n;
1466
+ }
1467
+ function Ee(o) {
1468
+ let e, t;
1469
+ return {
1470
+ c() {
1471
+ e = E("label"), t = ae(
1472
+ /*label*/
1473
+ o[2]
1474
+ ), this.h();
1475
+ },
1476
+ l(n) {
1477
+ e = A(n, "LABEL", { class: !0, for: !0 });
1478
+ var i = M(e);
1479
+ t = re(
1480
+ i,
1481
+ /*label*/
1482
+ o[2]
1483
+ ), i.forEach(I), this.h();
1484
+ },
1485
+ h() {
1486
+ T(e, "class", "block-title svelte-1eo2cb7"), T(e, "for", "consilium-roundtable");
1487
+ },
1488
+ m(n, i) {
1489
+ ke(n, e, i), v(e, t);
1490
+ },
1491
+ p(n, i) {
1492
+ i & /*label*/
1493
+ 4 && oe(
1494
+ t,
1495
+ /*label*/
1496
+ n[2]
1497
+ );
1498
+ },
1499
+ d(n) {
1500
+ n && I(e);
1501
+ }
1502
+ };
1503
+ }
1504
+ function Ce(o) {
1505
+ let e, t, n, i, l = (
1506
+ /*renderMarkdown*/
1507
+ o[10](
1508
+ /*getLatestMessage*/
1509
+ o[12](
1510
+ /*participant*/
1511
+ o[27]
1512
+ )
1513
+ ) + ""
1514
+ ), s, r, a, p, c = (
1515
+ /*getEmoji*/
1516
+ o[11](
1517
+ /*participant*/
1518
+ o[27]
1519
+ ) + ""
1520
+ ), g, h, u, b = (
1521
+ /*participant*/
1522
+ o[27] + ""
1523
+ ), d, y;
1524
+ return {
1525
+ c() {
1526
+ e = E("div"), t = E("div"), n = E("div"), i = new Mt(!1), s = V(), r = E("div"), a = V(), p = E("div"), g = ae(c), h = V(), u = E("div"), d = ae(b), y = V(), this.h();
1527
+ },
1528
+ l(k) {
1529
+ e = A(k, "DIV", { class: !0, style: !0 });
1530
+ var x = M(e);
1531
+ t = A(x, "DIV", { class: !0 });
1532
+ var z = M(t);
1533
+ n = A(z, "DIV", { class: !0 });
1534
+ var S = M(n);
1535
+ i = Bt(S, !1), S.forEach(I), s = j(z), r = A(z, "DIV", { class: !0 }), M(r).forEach(I), z.forEach(I), a = j(x), p = A(x, "DIV", { class: !0, role: !0, tabindex: !0 });
1536
+ var C = M(p);
1537
+ g = re(C, c), C.forEach(I), h = j(x), u = A(x, "DIV", { class: !0 });
1538
+ var X = M(u);
1539
+ d = re(X, b), X.forEach(I), y = j(x), x.forEach(I), this.h();
1540
+ },
1541
+ h() {
1542
+ i.a = null, T(n, "class", "bubble-content svelte-1eo2cb7"), T(r, "class", "bubble-arrow svelte-1eo2cb7"), T(t, "class", "speech-bubble svelte-1eo2cb7"), L(
1543
+ t,
1544
+ "visible",
1545
+ /*isBubbleVisible*/
1546
+ o[13](
1547
+ /*participant*/
1548
+ o[27]
1549
+ )
1550
+ ), T(p, "class", "avatar svelte-1eo2cb7"), T(p, "role", "button"), T(p, "tabindex", "0"), L(
1551
+ p,
1552
+ "speaking",
1553
+ /*isAvatarActive*/
1554
+ o[14](
1555
+ /*participant*/
1556
+ o[27]
1557
+ )
1558
+ ), L(
1559
+ p,
1560
+ "thinking",
1561
+ /*thinking*/
1562
+ o[6].includes(
1563
+ /*participant*/
1564
+ o[27]
1565
+ )
1566
+ ), L(
1567
+ p,
1568
+ "responding",
1569
+ /*currentSpeaker*/
1570
+ o[5] === /*participant*/
1571
+ o[27]
1572
+ ), T(u, "class", "participant-name svelte-1eo2cb7"), T(e, "class", "participant-seat svelte-1eo2cb7"), O(e, "left", Q(
1573
+ /*index*/
1574
+ o[29],
1575
+ /*participants*/
1576
+ o[4].length
1577
+ ).left), O(e, "top", Q(
1578
+ /*index*/
1579
+ o[29],
1580
+ /*participants*/
1581
+ o[4].length
1582
+ ).top), O(e, "transform", Q(
1583
+ /*index*/
1584
+ o[29],
1585
+ /*participants*/
1586
+ o[4].length
1587
+ ).transform);
1588
+ },
1589
+ m(k, x) {
1590
+ ke(k, e, x), v(e, t), v(t, n), i.m(l, n), v(t, s), v(t, r), v(e, a), v(e, p), v(p, g), v(e, h), v(e, u), v(u, d), v(e, y);
1591
+ },
1592
+ p(k, x) {
1593
+ x & /*participants*/
1594
+ 16 && l !== (l = /*renderMarkdown*/
1595
+ k[10](
1596
+ /*getLatestMessage*/
1597
+ k[12](
1598
+ /*participant*/
1599
+ k[27]
1600
+ )
1601
+ ) + "") && i.p(l), x & /*isBubbleVisible, participants*/
1602
+ 8208 && L(
1603
+ t,
1604
+ "visible",
1605
+ /*isBubbleVisible*/
1606
+ k[13](
1607
+ /*participant*/
1608
+ k[27]
1609
+ )
1610
+ ), x & /*participants*/
1611
+ 16 && c !== (c = /*getEmoji*/
1612
+ k[11](
1613
+ /*participant*/
1614
+ k[27]
1615
+ ) + "") && oe(g, c), x & /*isAvatarActive, participants*/
1616
+ 16400 && L(
1617
+ p,
1618
+ "speaking",
1619
+ /*isAvatarActive*/
1620
+ k[14](
1621
+ /*participant*/
1622
+ k[27]
1623
+ )
1624
+ ), x & /*thinking, participants*/
1625
+ 80 && L(
1626
+ p,
1627
+ "thinking",
1628
+ /*thinking*/
1629
+ k[6].includes(
1630
+ /*participant*/
1631
+ k[27]
1632
+ )
1633
+ ), x & /*currentSpeaker, participants*/
1634
+ 48 && L(
1635
+ p,
1636
+ "responding",
1637
+ /*currentSpeaker*/
1638
+ k[5] === /*participant*/
1639
+ k[27]
1640
+ ), x & /*participants*/
1641
+ 16 && b !== (b = /*participant*/
1642
+ k[27] + "") && oe(d, b), x & /*participants*/
1643
+ 16 && O(e, "left", Q(
1644
+ /*index*/
1645
+ k[29],
1646
+ /*participants*/
1647
+ k[4].length
1648
+ ).left), x & /*participants*/
1649
+ 16 && O(e, "top", Q(
1650
+ /*index*/
1651
+ k[29],
1652
+ /*participants*/
1653
+ k[4].length
1654
+ ).top), x & /*participants*/
1655
+ 16 && O(e, "transform", Q(
1656
+ /*index*/
1657
+ k[29],
1658
+ /*participants*/
1659
+ k[4].length
1660
+ ).transform);
1661
+ },
1662
+ d(k) {
1663
+ k && I(e);
1664
+ }
1665
+ };
1666
+ }
1667
+ function Ot(o) {
1668
+ let e, t, n, i, l = '<div class="consensus-flame svelte-1eo2cb7">🎭</div> <div class="table-label svelte-1eo2cb7">CONSILIUM</div>', s, r, a, p, c = (
1669
+ /*show_label*/
1670
+ o[3] && /*label*/
1671
+ o[2] && Ee(o)
1672
+ ), g = Re(
1673
+ /*participants*/
1674
+ o[4]
1675
+ ), h = [];
1676
+ for (let u = 0; u < g.length; u += 1)
1677
+ h[u] = Ce(Ae(o, g, u));
1678
+ return {
1679
+ c() {
1680
+ e = E("div"), c && c.c(), t = V(), n = E("div"), i = E("div"), i.innerHTML = l, s = V(), r = E("div");
1681
+ for (let u = 0; u < h.length; u += 1)
1682
+ h[u].c();
1683
+ this.h();
1684
+ },
1685
+ l(u) {
1686
+ e = A(u, "DIV", { class: !0, id: !0, style: !0 });
1687
+ var b = M(e);
1688
+ c && c.l(b), t = j(b), n = A(b, "DIV", { class: !0, id: !0 });
1689
+ var d = M(n);
1690
+ i = A(d, "DIV", { class: !0, "data-svelte-h": !0 }), qt(i) !== "svelte-fj2hkt" && (i.innerHTML = l), s = j(d), r = A(d, "DIV", { class: !0 });
1691
+ var y = M(r);
1692
+ for (let k = 0; k < h.length; k += 1)
1693
+ h[k].l(y);
1694
+ y.forEach(I), d.forEach(I), b.forEach(I), this.h();
1695
+ },
1696
+ h() {
1697
+ T(i, "class", "table-center svelte-1eo2cb7"), T(r, "class", "participants-circle"), T(n, "class", "consilium-container svelte-1eo2cb7"), T(n, "id", "consilium-roundtable"), T(e, "class", a = Se(
1698
+ /*containerClasses*/
1699
+ o[9]
1700
+ ) + " svelte-1eo2cb7"), T(
1701
+ e,
1702
+ "id",
1703
+ /*elem_id*/
1704
+ o[0]
1705
+ ), T(e, "style", p = /*containerStyle*/
1706
+ o[8] + "; " + /*minWidthStyle*/
1707
+ o[7]), L(e, "hidden", !/*visible*/
1708
+ o[1]);
1709
+ },
1710
+ m(u, b) {
1711
+ ke(u, e, b), c && c.m(e, null), v(e, t), v(e, n), v(n, i), v(n, s), v(n, r);
1712
+ for (let d = 0; d < h.length; d += 1)
1713
+ h[d] && h[d].m(r, null);
1714
+ },
1715
+ p(u, [b]) {
1716
+ if (/*show_label*/
1717
+ u[3] && /*label*/
1718
+ u[2] ? c ? c.p(u, b) : (c = Ee(u), c.c(), c.m(e, t)) : c && (c.d(1), c = null), b & /*getPosition, participants, isAvatarActive, thinking, currentSpeaker, getEmoji, isBubbleVisible, renderMarkdown, getLatestMessage*/
1719
+ 31856) {
1720
+ g = Re(
1721
+ /*participants*/
1722
+ u[4]
1723
+ );
1724
+ let d;
1725
+ for (d = 0; d < g.length; d += 1) {
1726
+ const y = Ae(u, g, d);
1727
+ h[d] ? h[d].p(y, b) : (h[d] = Ce(y), h[d].c(), h[d].m(r, null));
1728
+ }
1729
+ for (; d < h.length; d += 1)
1730
+ h[d].d(1);
1731
+ h.length = g.length;
1732
+ }
1733
+ b & /*containerClasses*/
1734
+ 512 && a !== (a = Se(
1735
+ /*containerClasses*/
1736
+ u[9]
1737
+ ) + " svelte-1eo2cb7") && T(e, "class", a), b & /*elem_id*/
1738
+ 1 && T(
1739
+ e,
1740
+ "id",
1741
+ /*elem_id*/
1742
+ u[0]
1743
+ ), b & /*containerStyle, minWidthStyle*/
1744
+ 384 && p !== (p = /*containerStyle*/
1745
+ u[8] + "; " + /*minWidthStyle*/
1746
+ u[7]) && T(e, "style", p), b & /*containerClasses, visible*/
1747
+ 514 && L(e, "hidden", !/*visible*/
1748
+ u[1]);
1749
+ },
1750
+ i: Ie,
1751
+ o: Ie,
1752
+ d(u) {
1753
+ u && I(e), c && c.d(), Pt(h, u);
1754
+ }
1755
+ };
1756
+ }
1757
+ function Q(o, e) {
1758
+ const n = (360 / e * o - 90) * (Math.PI / 180), i = 260, l = 180, s = Math.cos(n) * i, r = Math.sin(n) * l;
1759
+ return {
1760
+ left: `calc(50% + ${s}px)`,
1761
+ top: `calc(50% + ${r}px)`,
1762
+ transform: "translate(-50%, -50%)"
1763
+ };
1764
+ }
1765
+ function Qt(o, e, t) {
1766
+ let n, i, l, { gradio: s } = e, { elem_id: r = "" } = e, { elem_classes: a = [] } = e, { visible: p = !0 } = e, { value: c = "{}" } = e, { label: g = "Consilium Roundtable" } = e, { show_label: h = !0 } = e, { scale: u = null } = e, { min_width: b = void 0 } = e, { loading_status: d } = e, { interactive: y = !0 } = e, k = [], x = [], z = null, S = [], C = [];
1767
+ function X() {
1768
+ try {
1769
+ const f = JSON.parse(c);
1770
+ t(4, k = f.participants || []), x = f.messages || [], t(5, z = f.currentSpeaker || null), t(6, S = f.thinking || []), C = f.showBubbles || [], console.log("Clean JSON parsed:", {
1771
+ participants: k,
1772
+ messages: x,
1773
+ currentSpeaker: z,
1774
+ thinking: S,
1775
+ showBubbles: C
1776
+ });
1777
+ } catch (f) {
1778
+ console.error("Invalid JSON:", c, f);
1779
+ }
1780
+ }
1781
+ function Ve(f) {
1782
+ if (!f) return f;
1783
+ try {
1784
+ return m.setOptions({
1785
+ breaks: !0,
1786
+ // Convert line breaks to <br>
1787
+ gfm: !0,
1788
+ // GitHub flavored markdown
1789
+ sanitize: !1,
1790
+ // Allow HTML (safe since we control input)
1791
+ smartypants: !1
1792
+ // Don't convert quotes/dashes
1793
+ }), f.includes(`
1794
+ `) ? m.parse(f) : m.parseInline(f);
1795
+ } catch (P) {
1796
+ return console.error("Markdown parsing error:", P), f;
1797
+ }
1798
+ }
1799
+ const Ne = {
1800
+ Claude: "🤖",
1801
+ "GPT-4": "🧠",
1802
+ Mistral: "🦾",
1803
+ Gemini: "💎",
1804
+ Search: "🔍",
1805
+ OpenAI: "🧠",
1806
+ Anthropic: "🤖",
1807
+ Google: "💎"
1808
+ };
1809
+ function He(f) {
1810
+ return Ne[f] || "🤖";
1811
+ }
1812
+ function Fe(f) {
1813
+ if (S.includes(f))
1814
+ return `${f} is thinking...`;
1815
+ if (z === f)
1816
+ return `${f} is responding...`;
1817
+ const P = x.filter((J) => J.speaker === f);
1818
+ return P.length === 0 ? `${f} is ready to discuss...` : P[P.length - 1].text || `${f} responded`;
1819
+ }
1820
+ function Ue(f) {
1821
+ const P = S.includes(f), J = z === f, be = C.includes(f), me = P || J || be;
1822
+ return console.log(`${f} bubble visible:`, me, { isThinking: P, isSpeaking: J, shouldShow: be }), me;
1823
+ }
1824
+ function Ge(f) {
1825
+ return S.includes(f) || z === f;
1826
+ }
1827
+ return o.$$set = (f) => {
1828
+ "gradio" in f && t(15, s = f.gradio), "elem_id" in f && t(0, r = f.elem_id), "elem_classes" in f && t(16, a = f.elem_classes), "visible" in f && t(1, p = f.visible), "value" in f && t(17, c = f.value), "label" in f && t(2, g = f.label), "show_label" in f && t(3, h = f.show_label), "scale" in f && t(18, u = f.scale), "min_width" in f && t(19, b = f.min_width), "loading_status" in f && t(20, d = f.loading_status), "interactive" in f && t(21, y = f.interactive);
1829
+ }, o.$$.update = () => {
1830
+ o.$$.dirty & /*elem_classes*/
1831
+ 65536 && t(9, n = `wrapper ${a.join(" ")}`), o.$$.dirty & /*scale*/
1832
+ 262144 && t(8, i = u ? `--scale: ${u}` : ""), o.$$.dirty & /*min_width*/
1833
+ 524288 && t(7, l = b ? `min-width: ${b}px` : ""), o.$$.dirty & /*interactive*/
1834
+ 2097152, o.$$.dirty & /*value*/
1835
+ 131072 && X();
1836
+ }, [
1837
+ r,
1838
+ p,
1839
+ g,
1840
+ h,
1841
+ k,
1842
+ z,
1843
+ S,
1844
+ l,
1845
+ i,
1846
+ n,
1847
+ Ve,
1848
+ He,
1849
+ Fe,
1850
+ Ue,
1851
+ Ge,
1852
+ s,
1853
+ a,
1854
+ c,
1855
+ u,
1856
+ b,
1857
+ d,
1858
+ y
1859
+ ];
1860
+ }
1861
+ class Vt extends $t {
1862
+ constructor(e) {
1863
+ super(), Zt(this, e, Qt, Ot, Dt, {
1864
+ gradio: 15,
1865
+ elem_id: 0,
1866
+ elem_classes: 16,
1867
+ visible: 1,
1868
+ value: 17,
1869
+ label: 2,
1870
+ show_label: 3,
1871
+ scale: 18,
1872
+ min_width: 19,
1873
+ loading_status: 20,
1874
+ interactive: 21
1875
+ });
1876
+ }
1877
+ }
1878
+ export {
1879
+ Vt as default
1880
+ };
src/gradio_consilium_roundtable/templates/component/style.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .hidden.svelte-1eo2cb7{display:none}.block-title.svelte-1eo2cb7{display:block;margin-bottom:10px;padding:10px;font-weight:700;color:gold}.wrapper.svelte-1eo2cb7{width:600px;height:600px;position:relative}.consilium-container.svelte-1eo2cb7{top:150px;position:relative;width:450px;height:300px;margin:20px auto;border-radius:50%;background:linear-gradient(135deg,#0f5132,#198754);border:8px solid #8b4513;box-shadow:0 8px 32px #0006,inset 0 0 20px #0003}.table-center.svelte-1eo2cb7{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;background:#0000004d;border-radius:50%;width:140px;height:100px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px solid #8b4513;box-shadow:inset 0 0 10px #00000080}.consensus-flame.svelte-1eo2cb7{font-size:2rem;margin-bottom:5px}.table-label.svelte-1eo2cb7{color:gold;font-size:.7rem;font-weight:700;letter-spacing:2px;text-shadow:0 2px 4px rgba(0,0,0,.8)}.participant-seat.svelte-1eo2cb7{position:absolute}.avatar.svelte-1eo2cb7{width:60px;height:60px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:1.4rem;background:linear-gradient(145deg,#fff,#e6e6e6);border:3px solid #8b4513;box-shadow:0 6px 15px #0000004d,inset 0 2px 5px #ffffff80;margin-bottom:8px;cursor:pointer;transition:all .3s ease;position:relative;z-index:10}.avatar.svelte-1eo2cb7:hover{transform:scale(1.05);box-shadow:0 8px 20px #0006,inset 0 2px 5px #ffffff80}.avatar.thinking.svelte-1eo2cb7{border-color:#ff6b35;animation:svelte-1eo2cb7-thinking-pulse 1.5s infinite}.avatar.responding.svelte-1eo2cb7{border-color:gold;animation:svelte-1eo2cb7-speaking-glow 1s infinite}.avatar.speaking.svelte-1eo2cb7{border-color:gold}.participant-name.svelte-1eo2cb7{font-size:.75rem;font-weight:700;color:gold;text-shadow:0 2px 4px rgba(0,0,0,.8);text-align:center;white-space:nowrap;background:#0000004d;padding:2px 8px;border-radius:10px;border:1px solid #8b4513}.speech-bubble.svelte-1eo2cb7{position:absolute;bottom:85px;left:50%;transform:translate(-50%) translateY(20px);background:#fff;border-radius:15px;padding:10px 14px;box-shadow:0 8px 25px #0000004d;z-index:20;opacity:0;transition:all .4s ease;pointer-events:none;border:2px solid #8b4513;min-width:180px;max-width:300px;word-wrap:break-word;white-space:normal}.speech-bubble.visible.svelte-1eo2cb7{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.bubble-content.svelte-1eo2cb7{font-size:.8rem;color:#333;line-height:1.4;text-align:left;max-height:100px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#8b4513 #f0f0f0}.bubble-content.svelte-1eo2cb7::-webkit-scrollbar{width:6px}.bubble-content.svelte-1eo2cb7::-webkit-scrollbar-track{background:#f0f0f0;border-radius:3px}.bubble-content.svelte-1eo2cb7::-webkit-scrollbar-thumb{background:#8b4513;border-radius:3px}.bubble-content.svelte-1eo2cb7::-webkit-scrollbar-thumb:hover{background:#654321}.bubble-arrow.svelte-1eo2cb7{position:absolute;bottom:-10px;left:50%;transform:translate(-50%);width:0;height:0;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid white}.bubble-arrow.svelte-1eo2cb7:before{content:"";position:absolute;bottom:2px;left:50%;transform:translate(-50%);width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid #8b4513}@keyframes svelte-1eo2cb7-thinking-pulse{0%,to{transform:scale(1);box-shadow:0 6px 15px #0000004d,0 0 15px #ff6b3566}50%{transform:scale(1.03);box-shadow:0 8px 20px #0006,0 0 25px #ff6b3599}}@keyframes svelte-1eo2cb7-speaking-glow{0%,to{box-shadow:0 6px 15px #0000004d,0 0 20px #ffd70080}50%{box-shadow:0 8px 20px #0006,0 0 30px #ffd700cc}}
src/gradio_consilium_roundtable/templates/example/index.js ADDED
@@ -0,0 +1,1951 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var Je = Object.defineProperty;
2
+ var we = (r) => {
3
+ throw TypeError(r);
4
+ };
5
+ var We = (r, e, t) => e in r ? Je(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
6
+ var _ = (r, e, t) => We(r, typeof e != "symbol" ? e + "" : e, t), Xe = (r, e, t) => e.has(r) || we("Cannot " + t);
7
+ var xe = (r, e, t) => e.has(r) ? we("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t);
8
+ var X = (r, e, t) => (Xe(r, e, "access private method"), t);
9
+ function ce() {
10
+ return {
11
+ async: !1,
12
+ breaks: !1,
13
+ extensions: null,
14
+ gfm: !0,
15
+ hooks: null,
16
+ pedantic: !1,
17
+ renderer: null,
18
+ silent: !1,
19
+ tokenizer: null,
20
+ walkTokens: null
21
+ };
22
+ }
23
+ let D = ce();
24
+ function $e(r) {
25
+ D = r;
26
+ }
27
+ const Le = /[&<>"']/, Ye = new RegExp(Le.source, "g"), Me = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, Ke = new RegExp(Me.source, "g"), et = {
28
+ "&": "&amp;",
29
+ "<": "&lt;",
30
+ ">": "&gt;",
31
+ '"': "&quot;",
32
+ "'": "&#39;"
33
+ }, _e = (r) => et[r];
34
+ function R(r, e) {
35
+ if (e) {
36
+ if (Le.test(r))
37
+ return r.replace(Ye, _e);
38
+ } else if (Me.test(r))
39
+ return r.replace(Ke, _e);
40
+ return r;
41
+ }
42
+ const tt = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
43
+ function nt(r) {
44
+ return r.replace(tt, (e, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : ""));
45
+ }
46
+ const st = /(^|[^\[])\^/g;
47
+ function w(r, e) {
48
+ let t = typeof r == "string" ? r : r.source;
49
+ e = e || "";
50
+ const n = {
51
+ replace: (i, l) => {
52
+ let s = typeof l == "string" ? l : l.source;
53
+ return s = s.replace(st, "$1"), t = t.replace(i, s), n;
54
+ },
55
+ getRegex: () => new RegExp(t, e)
56
+ };
57
+ return n;
58
+ }
59
+ function ye(r) {
60
+ try {
61
+ r = encodeURI(r).replace(/%25/g, "%");
62
+ } catch {
63
+ return null;
64
+ }
65
+ return r;
66
+ }
67
+ const H = { exec: () => null };
68
+ function ve(r, e) {
69
+ const t = r.replace(/\|/g, (l, s, o) => {
70
+ let a = !1, p = s;
71
+ for (; --p >= 0 && o[p] === "\\"; )
72
+ a = !a;
73
+ return a ? "|" : " |";
74
+ }), n = t.split(/ \|/);
75
+ let i = 0;
76
+ if (n[0].trim() || n.shift(), n.length > 0 && !n[n.length - 1].trim() && n.pop(), e)
77
+ if (n.length > e)
78
+ n.splice(e);
79
+ else
80
+ for (; n.length < e; )
81
+ n.push("");
82
+ for (; i < n.length; i++)
83
+ n[i] = n[i].trim().replace(/\\\|/g, "|");
84
+ return n;
85
+ }
86
+ function Y(r, e, t) {
87
+ const n = r.length;
88
+ if (n === 0)
89
+ return "";
90
+ let i = 0;
91
+ for (; i < n && r.charAt(n - i - 1) === e; )
92
+ i++;
93
+ return r.slice(0, n - i);
94
+ }
95
+ function it(r, e) {
96
+ if (r.indexOf(e[1]) === -1)
97
+ return -1;
98
+ let t = 0;
99
+ for (let n = 0; n < r.length; n++)
100
+ if (r[n] === "\\")
101
+ n++;
102
+ else if (r[n] === e[0])
103
+ t++;
104
+ else if (r[n] === e[1] && (t--, t < 0))
105
+ return n;
106
+ return -1;
107
+ }
108
+ function Te(r, e, t, n) {
109
+ const i = e.href, l = e.title ? R(e.title) : null, s = r[1].replace(/\\([\[\]])/g, "$1");
110
+ if (r[0].charAt(0) !== "!") {
111
+ n.state.inLink = !0;
112
+ const o = {
113
+ type: "link",
114
+ raw: t,
115
+ href: i,
116
+ title: l,
117
+ text: s,
118
+ tokens: n.inlineTokens(s)
119
+ };
120
+ return n.state.inLink = !1, o;
121
+ }
122
+ return {
123
+ type: "image",
124
+ raw: t,
125
+ href: i,
126
+ title: l,
127
+ text: R(s)
128
+ };
129
+ }
130
+ function lt(r, e) {
131
+ const t = r.match(/^(\s+)(?:```)/);
132
+ if (t === null)
133
+ return e;
134
+ const n = t[1];
135
+ return e.split(`
136
+ `).map((i) => {
137
+ const l = i.match(/^\s+/);
138
+ if (l === null)
139
+ return i;
140
+ const [s] = l;
141
+ return s.length >= n.length ? i.slice(n.length) : i;
142
+ }).join(`
143
+ `);
144
+ }
145
+ class ee {
146
+ // set by the lexer
147
+ constructor(e) {
148
+ _(this, "options");
149
+ _(this, "rules");
150
+ // set by the lexer
151
+ _(this, "lexer");
152
+ this.options = e || D;
153
+ }
154
+ space(e) {
155
+ const t = this.rules.block.newline.exec(e);
156
+ if (t && t[0].length > 0)
157
+ return {
158
+ type: "space",
159
+ raw: t[0]
160
+ };
161
+ }
162
+ code(e) {
163
+ const t = this.rules.block.code.exec(e);
164
+ if (t) {
165
+ const n = t[0].replace(/^ {1,4}/gm, "");
166
+ return {
167
+ type: "code",
168
+ raw: t[0],
169
+ codeBlockStyle: "indented",
170
+ text: this.options.pedantic ? n : Y(n, `
171
+ `)
172
+ };
173
+ }
174
+ }
175
+ fences(e) {
176
+ const t = this.rules.block.fences.exec(e);
177
+ if (t) {
178
+ const n = t[0], i = lt(n, t[3] || "");
179
+ return {
180
+ type: "code",
181
+ raw: n,
182
+ lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
183
+ text: i
184
+ };
185
+ }
186
+ }
187
+ heading(e) {
188
+ const t = this.rules.block.heading.exec(e);
189
+ if (t) {
190
+ let n = t[2].trim();
191
+ if (/#$/.test(n)) {
192
+ const i = Y(n, "#");
193
+ (this.options.pedantic || !i || / $/.test(i)) && (n = i.trim());
194
+ }
195
+ return {
196
+ type: "heading",
197
+ raw: t[0],
198
+ depth: t[1].length,
199
+ text: n,
200
+ tokens: this.lexer.inline(n)
201
+ };
202
+ }
203
+ }
204
+ hr(e) {
205
+ const t = this.rules.block.hr.exec(e);
206
+ if (t)
207
+ return {
208
+ type: "hr",
209
+ raw: t[0]
210
+ };
211
+ }
212
+ blockquote(e) {
213
+ const t = this.rules.block.blockquote.exec(e);
214
+ if (t) {
215
+ let n = t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, `
216
+ $1`);
217
+ n = Y(n.replace(/^ *>[ \t]?/gm, ""), `
218
+ `);
219
+ const i = this.lexer.state.top;
220
+ this.lexer.state.top = !0;
221
+ const l = this.lexer.blockTokens(n);
222
+ return this.lexer.state.top = i, {
223
+ type: "blockquote",
224
+ raw: t[0],
225
+ tokens: l,
226
+ text: n
227
+ };
228
+ }
229
+ }
230
+ list(e) {
231
+ let t = this.rules.block.list.exec(e);
232
+ if (t) {
233
+ let n = t[1].trim();
234
+ const i = n.length > 1, l = {
235
+ type: "list",
236
+ raw: "",
237
+ ordered: i,
238
+ start: i ? +n.slice(0, -1) : "",
239
+ loose: !1,
240
+ items: []
241
+ };
242
+ n = i ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = i ? n : "[*+-]");
243
+ const s = new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);
244
+ let o = "", a = "", p = !1;
245
+ for (; e; ) {
246
+ let c = !1;
247
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e))
248
+ break;
249
+ o = t[0], e = e.substring(o.length);
250
+ let g = t[2].split(`
251
+ `, 1)[0].replace(/^\t+/, (k) => " ".repeat(3 * k.length)), h = e.split(`
252
+ `, 1)[0], u = 0;
253
+ this.options.pedantic ? (u = 2, a = g.trimStart()) : (u = t[2].search(/[^ ]/), u = u > 4 ? 1 : u, a = g.slice(u), u += t[1].length);
254
+ let b = !1;
255
+ if (!g && /^ *$/.test(h) && (o += h + `
256
+ `, e = e.substring(h.length + 1), c = !0), !c) {
257
+ const k = new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), x = new RegExp(`^ {0,${Math.min(3, u - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), z = new RegExp(`^ {0,${Math.min(3, u - 1)}}(?:\`\`\`|~~~)`), S = new RegExp(`^ {0,${Math.min(3, u - 1)}}#`);
258
+ for (; e; ) {
259
+ const C = e.split(`
260
+ `, 1)[0];
261
+ if (h = C, this.options.pedantic && (h = h.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), z.test(h) || S.test(h) || k.test(h) || x.test(e))
262
+ break;
263
+ if (h.search(/[^ ]/) >= u || !h.trim())
264
+ a += `
265
+ ` + h.slice(u);
266
+ else {
267
+ if (b || g.search(/[^ ]/) >= 4 || z.test(g) || S.test(g) || x.test(g))
268
+ break;
269
+ a += `
270
+ ` + h;
271
+ }
272
+ !b && !h.trim() && (b = !0), o += C + `
273
+ `, e = e.substring(C.length + 1), g = h.slice(u);
274
+ }
275
+ }
276
+ l.loose || (p ? l.loose = !0 : /\n *\n *$/.test(o) && (p = !0));
277
+ let d = null, y;
278
+ this.options.gfm && (d = /^\[[ xX]\] /.exec(a), d && (y = d[0] !== "[ ] ", a = a.replace(/^\[[ xX]\] +/, ""))), l.items.push({
279
+ type: "list_item",
280
+ raw: o,
281
+ task: !!d,
282
+ checked: y,
283
+ loose: !1,
284
+ text: a,
285
+ tokens: []
286
+ }), l.raw += o;
287
+ }
288
+ l.items[l.items.length - 1].raw = o.trimEnd(), l.items[l.items.length - 1].text = a.trimEnd(), l.raw = l.raw.trimEnd();
289
+ for (let c = 0; c < l.items.length; c++)
290
+ if (this.lexer.state.top = !1, l.items[c].tokens = this.lexer.blockTokens(l.items[c].text, []), !l.loose) {
291
+ const g = l.items[c].tokens.filter((u) => u.type === "space"), h = g.length > 0 && g.some((u) => /\n.*\n/.test(u.raw));
292
+ l.loose = h;
293
+ }
294
+ if (l.loose)
295
+ for (let c = 0; c < l.items.length; c++)
296
+ l.items[c].loose = !0;
297
+ return l;
298
+ }
299
+ }
300
+ html(e) {
301
+ const t = this.rules.block.html.exec(e);
302
+ if (t)
303
+ return {
304
+ type: "html",
305
+ block: !0,
306
+ raw: t[0],
307
+ pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
308
+ text: t[0]
309
+ };
310
+ }
311
+ def(e) {
312
+ const t = this.rules.block.def.exec(e);
313
+ if (t) {
314
+ const n = t[1].toLowerCase().replace(/\s+/g, " "), i = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", l = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
315
+ return {
316
+ type: "def",
317
+ tag: n,
318
+ raw: t[0],
319
+ href: i,
320
+ title: l
321
+ };
322
+ }
323
+ }
324
+ table(e) {
325
+ const t = this.rules.block.table.exec(e);
326
+ if (!t || !/[:|]/.test(t[2]))
327
+ return;
328
+ const n = ve(t[1]), i = t[2].replace(/^\||\| *$/g, "").split("|"), l = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
329
+ `) : [], s = {
330
+ type: "table",
331
+ raw: t[0],
332
+ header: [],
333
+ align: [],
334
+ rows: []
335
+ };
336
+ if (n.length === i.length) {
337
+ for (const o of i)
338
+ /^ *-+: *$/.test(o) ? s.align.push("right") : /^ *:-+: *$/.test(o) ? s.align.push("center") : /^ *:-+ *$/.test(o) ? s.align.push("left") : s.align.push(null);
339
+ for (const o of n)
340
+ s.header.push({
341
+ text: o,
342
+ tokens: this.lexer.inline(o)
343
+ });
344
+ for (const o of l)
345
+ s.rows.push(ve(o, s.header.length).map((a) => ({
346
+ text: a,
347
+ tokens: this.lexer.inline(a)
348
+ })));
349
+ return s;
350
+ }
351
+ }
352
+ lheading(e) {
353
+ const t = this.rules.block.lheading.exec(e);
354
+ if (t)
355
+ return {
356
+ type: "heading",
357
+ raw: t[0],
358
+ depth: t[2].charAt(0) === "=" ? 1 : 2,
359
+ text: t[1],
360
+ tokens: this.lexer.inline(t[1])
361
+ };
362
+ }
363
+ paragraph(e) {
364
+ const t = this.rules.block.paragraph.exec(e);
365
+ if (t) {
366
+ const n = t[1].charAt(t[1].length - 1) === `
367
+ ` ? t[1].slice(0, -1) : t[1];
368
+ return {
369
+ type: "paragraph",
370
+ raw: t[0],
371
+ text: n,
372
+ tokens: this.lexer.inline(n)
373
+ };
374
+ }
375
+ }
376
+ text(e) {
377
+ const t = this.rules.block.text.exec(e);
378
+ if (t)
379
+ return {
380
+ type: "text",
381
+ raw: t[0],
382
+ text: t[0],
383
+ tokens: this.lexer.inline(t[0])
384
+ };
385
+ }
386
+ escape(e) {
387
+ const t = this.rules.inline.escape.exec(e);
388
+ if (t)
389
+ return {
390
+ type: "escape",
391
+ raw: t[0],
392
+ text: R(t[1])
393
+ };
394
+ }
395
+ tag(e) {
396
+ const t = this.rules.inline.tag.exec(e);
397
+ if (t)
398
+ return !this.lexer.state.inLink && /^<a /i.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
399
+ type: "html",
400
+ raw: t[0],
401
+ inLink: this.lexer.state.inLink,
402
+ inRawBlock: this.lexer.state.inRawBlock,
403
+ block: !1,
404
+ text: t[0]
405
+ };
406
+ }
407
+ link(e) {
408
+ const t = this.rules.inline.link.exec(e);
409
+ if (t) {
410
+ const n = t[2].trim();
411
+ if (!this.options.pedantic && /^</.test(n)) {
412
+ if (!/>$/.test(n))
413
+ return;
414
+ const s = Y(n.slice(0, -1), "\\");
415
+ if ((n.length - s.length) % 2 === 0)
416
+ return;
417
+ } else {
418
+ const s = it(t[2], "()");
419
+ if (s > -1) {
420
+ const a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
421
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, a).trim(), t[3] = "";
422
+ }
423
+ }
424
+ let i = t[2], l = "";
425
+ if (this.options.pedantic) {
426
+ const s = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);
427
+ s && (i = s[1], l = s[3]);
428
+ } else
429
+ l = t[3] ? t[3].slice(1, -1) : "";
430
+ return i = i.trim(), /^</.test(i) && (this.options.pedantic && !/>$/.test(n) ? i = i.slice(1) : i = i.slice(1, -1)), Te(t, {
431
+ href: i && i.replace(this.rules.inline.anyPunctuation, "$1"),
432
+ title: l && l.replace(this.rules.inline.anyPunctuation, "$1")
433
+ }, t[0], this.lexer);
434
+ }
435
+ }
436
+ reflink(e, t) {
437
+ let n;
438
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
439
+ const i = (n[2] || n[1]).replace(/\s+/g, " "), l = t[i.toLowerCase()];
440
+ if (!l) {
441
+ const s = n[0].charAt(0);
442
+ return {
443
+ type: "text",
444
+ raw: s,
445
+ text: s
446
+ };
447
+ }
448
+ return Te(n, l, n[0], this.lexer);
449
+ }
450
+ }
451
+ emStrong(e, t, n = "") {
452
+ let i = this.rules.inline.emStrongLDelim.exec(e);
453
+ if (!i || i[3] && n.match(/[\p{L}\p{N}]/u))
454
+ return;
455
+ if (!(i[1] || i[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
456
+ const s = [...i[0]].length - 1;
457
+ let o, a, p = s, c = 0;
458
+ const g = i[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
459
+ for (g.lastIndex = 0, t = t.slice(-1 * e.length + s); (i = g.exec(t)) != null; ) {
460
+ if (o = i[1] || i[2] || i[3] || i[4] || i[5] || i[6], !o)
461
+ continue;
462
+ if (a = [...o].length, i[3] || i[4]) {
463
+ p += a;
464
+ continue;
465
+ } else if ((i[5] || i[6]) && s % 3 && !((s + a) % 3)) {
466
+ c += a;
467
+ continue;
468
+ }
469
+ if (p -= a, p > 0)
470
+ continue;
471
+ a = Math.min(a, a + p + c);
472
+ const h = [...i[0]][0].length, u = e.slice(0, s + i.index + h + a);
473
+ if (Math.min(s, a) % 2) {
474
+ const d = u.slice(1, -1);
475
+ return {
476
+ type: "em",
477
+ raw: u,
478
+ text: d,
479
+ tokens: this.lexer.inlineTokens(d)
480
+ };
481
+ }
482
+ const b = u.slice(2, -2);
483
+ return {
484
+ type: "strong",
485
+ raw: u,
486
+ text: b,
487
+ tokens: this.lexer.inlineTokens(b)
488
+ };
489
+ }
490
+ }
491
+ }
492
+ codespan(e) {
493
+ const t = this.rules.inline.code.exec(e);
494
+ if (t) {
495
+ let n = t[2].replace(/\n/g, " ");
496
+ const i = /[^ ]/.test(n), l = /^ /.test(n) && / $/.test(n);
497
+ return i && l && (n = n.substring(1, n.length - 1)), n = R(n, !0), {
498
+ type: "codespan",
499
+ raw: t[0],
500
+ text: n
501
+ };
502
+ }
503
+ }
504
+ br(e) {
505
+ const t = this.rules.inline.br.exec(e);
506
+ if (t)
507
+ return {
508
+ type: "br",
509
+ raw: t[0]
510
+ };
511
+ }
512
+ del(e) {
513
+ const t = this.rules.inline.del.exec(e);
514
+ if (t)
515
+ return {
516
+ type: "del",
517
+ raw: t[0],
518
+ text: t[2],
519
+ tokens: this.lexer.inlineTokens(t[2])
520
+ };
521
+ }
522
+ autolink(e) {
523
+ const t = this.rules.inline.autolink.exec(e);
524
+ if (t) {
525
+ let n, i;
526
+ return t[2] === "@" ? (n = R(t[1]), i = "mailto:" + n) : (n = R(t[1]), i = n), {
527
+ type: "link",
528
+ raw: t[0],
529
+ text: n,
530
+ href: i,
531
+ tokens: [
532
+ {
533
+ type: "text",
534
+ raw: n,
535
+ text: n
536
+ }
537
+ ]
538
+ };
539
+ }
540
+ }
541
+ url(e) {
542
+ var n;
543
+ let t;
544
+ if (t = this.rules.inline.url.exec(e)) {
545
+ let i, l;
546
+ if (t[2] === "@")
547
+ i = R(t[0]), l = "mailto:" + i;
548
+ else {
549
+ let s;
550
+ do
551
+ s = t[0], t[0] = ((n = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : n[0]) ?? "";
552
+ while (s !== t[0]);
553
+ i = R(t[0]), t[1] === "www." ? l = "http://" + t[0] : l = t[0];
554
+ }
555
+ return {
556
+ type: "link",
557
+ raw: t[0],
558
+ text: i,
559
+ href: l,
560
+ tokens: [
561
+ {
562
+ type: "text",
563
+ raw: i,
564
+ text: i
565
+ }
566
+ ]
567
+ };
568
+ }
569
+ }
570
+ inlineText(e) {
571
+ const t = this.rules.inline.text.exec(e);
572
+ if (t) {
573
+ let n;
574
+ return this.lexer.state.inRawBlock ? n = t[0] : n = R(t[0]), {
575
+ type: "text",
576
+ raw: t[0],
577
+ text: n
578
+ };
579
+ }
580
+ }
581
+ }
582
+ const rt = /^(?: *(?:\n|$))+/, ot = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, at = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, G = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ct = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, qe = /(?:[*+-]|\d{1,9}[.)])/, Pe = w(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, qe).replace(/blockCode/g, / {4}/).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/).getRegex(), he = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, ht = /^[^\n]+/, ue = /(?!\s*\])(?:\\.|[^\[\]\\])+/, ut = w(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", ue).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), pt = w(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, qe).getRegex(), se = "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", pe = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ft = w("^ {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", pe).replace("tag", se).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Be = w(he).replace("hr", G).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", se).getRegex(), gt = w(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Be).getRegex(), fe = {
583
+ blockquote: gt,
584
+ code: ot,
585
+ def: ut,
586
+ fences: at,
587
+ heading: ct,
588
+ hr: G,
589
+ html: ft,
590
+ lheading: Pe,
591
+ list: pt,
592
+ newline: rt,
593
+ paragraph: Be,
594
+ table: H,
595
+ text: ht
596
+ }, ze = w("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\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", se).getRegex(), dt = {
597
+ ...fe,
598
+ table: ze,
599
+ paragraph: w(he).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ze).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", se).getRegex()
600
+ }, kt = {
601
+ ...fe,
602
+ html: w(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", pe).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(),
603
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
604
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
605
+ fences: H,
606
+ // fences not supported
607
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
608
+ paragraph: w(he).replace("hr", G).replace("heading", ` *#{1,6} *[^
609
+ ]`).replace("lheading", Pe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
610
+ }, Ze = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, bt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, De = /^( {2,}|\\)\n(?!\s*$)/, mt = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, U = "\\p{P}\\p{S}", wt = w(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, U).getRegex(), xt = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g, _t = w(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, U).getRegex(), yt = w("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, U).getRegex(), vt = w("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, U).getRegex(), Tt = w(/\\([punct])/, "gu").replace(/punct/g, U).getRegex(), zt = w(/^<(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(), Rt = w(pe).replace("(?:-->|$)", "-->").getRegex(), It = w("^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", Rt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), te = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, St = w(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", te).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Oe = w(/^!?\[(label)\]\[(ref)\]/).replace("label", te).replace("ref", ue).getRegex(), Qe = w(/^!?\[(ref)\](?:\[\])?/).replace("ref", ue).getRegex(), At = w("reflink|nolink(?!\\()", "g").replace("reflink", Oe).replace("nolink", Qe).getRegex(), ge = {
611
+ _backpedal: H,
612
+ // only used for GFM url
613
+ anyPunctuation: Tt,
614
+ autolink: zt,
615
+ blockSkip: xt,
616
+ br: De,
617
+ code: bt,
618
+ del: H,
619
+ emStrongLDelim: _t,
620
+ emStrongRDelimAst: yt,
621
+ emStrongRDelimUnd: vt,
622
+ escape: Ze,
623
+ link: St,
624
+ nolink: Qe,
625
+ punctuation: wt,
626
+ reflink: Oe,
627
+ reflinkSearch: At,
628
+ tag: It,
629
+ text: mt,
630
+ url: H
631
+ }, Et = {
632
+ ...ge,
633
+ link: w(/^!?\[(label)\]\((.*?)\)/).replace("label", te).getRegex(),
634
+ reflink: w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", te).getRegex()
635
+ }, ie = {
636
+ ...ge,
637
+ escape: w(Ze).replace("])", "~|])").getRegex(),
638
+ url: w(/^((?: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(),
639
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
640
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
641
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
642
+ }, Ct = {
643
+ ...ie,
644
+ br: w(De).replace("{2,}", "*").getRegex(),
645
+ text: w(ie.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
646
+ }, K = {
647
+ normal: fe,
648
+ gfm: dt,
649
+ pedantic: kt
650
+ }, V = {
651
+ normal: ge,
652
+ gfm: ie,
653
+ breaks: Ct,
654
+ pedantic: Et
655
+ };
656
+ class M {
657
+ constructor(e) {
658
+ _(this, "tokens");
659
+ _(this, "options");
660
+ _(this, "state");
661
+ _(this, "tokenizer");
662
+ _(this, "inlineQueue");
663
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || D, this.options.tokenizer = this.options.tokenizer || new ee(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
664
+ inLink: !1,
665
+ inRawBlock: !1,
666
+ top: !0
667
+ };
668
+ const t = {
669
+ block: K.normal,
670
+ inline: V.normal
671
+ };
672
+ this.options.pedantic ? (t.block = K.pedantic, t.inline = V.pedantic) : this.options.gfm && (t.block = K.gfm, this.options.breaks ? t.inline = V.breaks : t.inline = V.gfm), this.tokenizer.rules = t;
673
+ }
674
+ /**
675
+ * Expose Rules
676
+ */
677
+ static get rules() {
678
+ return {
679
+ block: K,
680
+ inline: V
681
+ };
682
+ }
683
+ /**
684
+ * Static Lex Method
685
+ */
686
+ static lex(e, t) {
687
+ return new M(t).lex(e);
688
+ }
689
+ /**
690
+ * Static Lex Inline Method
691
+ */
692
+ static lexInline(e, t) {
693
+ return new M(t).inlineTokens(e);
694
+ }
695
+ /**
696
+ * Preprocessing
697
+ */
698
+ lex(e) {
699
+ e = e.replace(/\r\n|\r/g, `
700
+ `), this.blockTokens(e, this.tokens);
701
+ for (let t = 0; t < this.inlineQueue.length; t++) {
702
+ const n = this.inlineQueue[t];
703
+ this.inlineTokens(n.src, n.tokens);
704
+ }
705
+ return this.inlineQueue = [], this.tokens;
706
+ }
707
+ blockTokens(e, t = []) {
708
+ this.options.pedantic ? e = e.replace(/\t/g, " ").replace(/^ +$/gm, "") : e = e.replace(/^( *)(\t+)/gm, (o, a, p) => a + " ".repeat(p.length));
709
+ let n, i, l, s;
710
+ for (; e; )
711
+ if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((o) => (n = o.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
712
+ if (n = this.tokenizer.space(e)) {
713
+ e = e.substring(n.raw.length), n.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += `
714
+ ` : t.push(n);
715
+ continue;
716
+ }
717
+ if (n = this.tokenizer.code(e)) {
718
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
719
+ ` + n.raw, i.text += `
720
+ ` + n.text, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
721
+ continue;
722
+ }
723
+ if (n = this.tokenizer.fences(e)) {
724
+ e = e.substring(n.raw.length), t.push(n);
725
+ continue;
726
+ }
727
+ if (n = this.tokenizer.heading(e)) {
728
+ e = e.substring(n.raw.length), t.push(n);
729
+ continue;
730
+ }
731
+ if (n = this.tokenizer.hr(e)) {
732
+ e = e.substring(n.raw.length), t.push(n);
733
+ continue;
734
+ }
735
+ if (n = this.tokenizer.blockquote(e)) {
736
+ e = e.substring(n.raw.length), t.push(n);
737
+ continue;
738
+ }
739
+ if (n = this.tokenizer.list(e)) {
740
+ e = e.substring(n.raw.length), t.push(n);
741
+ continue;
742
+ }
743
+ if (n = this.tokenizer.html(e)) {
744
+ e = e.substring(n.raw.length), t.push(n);
745
+ continue;
746
+ }
747
+ if (n = this.tokenizer.def(e)) {
748
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
749
+ ` + n.raw, i.text += `
750
+ ` + n.raw, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : this.tokens.links[n.tag] || (this.tokens.links[n.tag] = {
751
+ href: n.href,
752
+ title: n.title
753
+ });
754
+ continue;
755
+ }
756
+ if (n = this.tokenizer.table(e)) {
757
+ e = e.substring(n.raw.length), t.push(n);
758
+ continue;
759
+ }
760
+ if (n = this.tokenizer.lheading(e)) {
761
+ e = e.substring(n.raw.length), t.push(n);
762
+ continue;
763
+ }
764
+ if (l = e, this.options.extensions && this.options.extensions.startBlock) {
765
+ let o = 1 / 0;
766
+ const a = e.slice(1);
767
+ let p;
768
+ this.options.extensions.startBlock.forEach((c) => {
769
+ p = c.call({ lexer: this }, a), typeof p == "number" && p >= 0 && (o = Math.min(o, p));
770
+ }), o < 1 / 0 && o >= 0 && (l = e.substring(0, o + 1));
771
+ }
772
+ if (this.state.top && (n = this.tokenizer.paragraph(l))) {
773
+ i = t[t.length - 1], s && i.type === "paragraph" ? (i.raw += `
774
+ ` + n.raw, i.text += `
775
+ ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n), s = l.length !== e.length, e = e.substring(n.raw.length);
776
+ continue;
777
+ }
778
+ if (n = this.tokenizer.text(e)) {
779
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && i.type === "text" ? (i.raw += `
780
+ ` + n.raw, i.text += `
781
+ ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
782
+ continue;
783
+ }
784
+ if (e) {
785
+ const o = "Infinite loop on byte: " + e.charCodeAt(0);
786
+ if (this.options.silent) {
787
+ console.error(o);
788
+ break;
789
+ } else
790
+ throw new Error(o);
791
+ }
792
+ }
793
+ return this.state.top = !0, t;
794
+ }
795
+ inline(e, t = []) {
796
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
797
+ }
798
+ /**
799
+ * Lexing/Compiling
800
+ */
801
+ inlineTokens(e, t = []) {
802
+ let n, i, l, s = e, o, a, p;
803
+ if (this.tokens.links) {
804
+ const c = Object.keys(this.tokens.links);
805
+ if (c.length > 0)
806
+ for (; (o = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; )
807
+ c.includes(o[0].slice(o[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
808
+ }
809
+ for (; (o = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; )
810
+ s = s.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
811
+ for (; (o = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; )
812
+ s = s.slice(0, o.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
813
+ for (; e; )
814
+ if (a || (p = ""), a = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((c) => (n = c.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
815
+ if (n = this.tokenizer.escape(e)) {
816
+ e = e.substring(n.raw.length), t.push(n);
817
+ continue;
818
+ }
819
+ if (n = this.tokenizer.tag(e)) {
820
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
821
+ continue;
822
+ }
823
+ if (n = this.tokenizer.link(e)) {
824
+ e = e.substring(n.raw.length), t.push(n);
825
+ continue;
826
+ }
827
+ if (n = this.tokenizer.reflink(e, this.tokens.links)) {
828
+ e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
829
+ continue;
830
+ }
831
+ if (n = this.tokenizer.emStrong(e, s, p)) {
832
+ e = e.substring(n.raw.length), t.push(n);
833
+ continue;
834
+ }
835
+ if (n = this.tokenizer.codespan(e)) {
836
+ e = e.substring(n.raw.length), t.push(n);
837
+ continue;
838
+ }
839
+ if (n = this.tokenizer.br(e)) {
840
+ e = e.substring(n.raw.length), t.push(n);
841
+ continue;
842
+ }
843
+ if (n = this.tokenizer.del(e)) {
844
+ e = e.substring(n.raw.length), t.push(n);
845
+ continue;
846
+ }
847
+ if (n = this.tokenizer.autolink(e)) {
848
+ e = e.substring(n.raw.length), t.push(n);
849
+ continue;
850
+ }
851
+ if (!this.state.inLink && (n = this.tokenizer.url(e))) {
852
+ e = e.substring(n.raw.length), t.push(n);
853
+ continue;
854
+ }
855
+ if (l = e, this.options.extensions && this.options.extensions.startInline) {
856
+ let c = 1 / 0;
857
+ const g = e.slice(1);
858
+ let h;
859
+ this.options.extensions.startInline.forEach((u) => {
860
+ h = u.call({ lexer: this }, g), typeof h == "number" && h >= 0 && (c = Math.min(c, h));
861
+ }), c < 1 / 0 && c >= 0 && (l = e.substring(0, c + 1));
862
+ }
863
+ if (n = this.tokenizer.inlineText(l)) {
864
+ e = e.substring(n.raw.length), n.raw.slice(-1) !== "_" && (p = n.raw.slice(-1)), a = !0, i = t[t.length - 1], i && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
865
+ continue;
866
+ }
867
+ if (e) {
868
+ const c = "Infinite loop on byte: " + e.charCodeAt(0);
869
+ if (this.options.silent) {
870
+ console.error(c);
871
+ break;
872
+ } else
873
+ throw new Error(c);
874
+ }
875
+ }
876
+ return t;
877
+ }
878
+ }
879
+ class ne {
880
+ constructor(e) {
881
+ _(this, "options");
882
+ this.options = e || D;
883
+ }
884
+ code(e, t, n) {
885
+ var l;
886
+ const i = (l = (t || "").match(/^\S*/)) == null ? void 0 : l[0];
887
+ return e = e.replace(/\n$/, "") + `
888
+ `, i ? '<pre><code class="language-' + R(i) + '">' + (n ? e : R(e, !0)) + `</code></pre>
889
+ ` : "<pre><code>" + (n ? e : R(e, !0)) + `</code></pre>
890
+ `;
891
+ }
892
+ blockquote(e) {
893
+ return `<blockquote>
894
+ ${e}</blockquote>
895
+ `;
896
+ }
897
+ html(e, t) {
898
+ return e;
899
+ }
900
+ heading(e, t, n) {
901
+ return `<h${t}>${e}</h${t}>
902
+ `;
903
+ }
904
+ hr() {
905
+ return `<hr>
906
+ `;
907
+ }
908
+ list(e, t, n) {
909
+ const i = t ? "ol" : "ul", l = t && n !== 1 ? ' start="' + n + '"' : "";
910
+ return "<" + i + l + `>
911
+ ` + e + "</" + i + `>
912
+ `;
913
+ }
914
+ listitem(e, t, n) {
915
+ return `<li>${e}</li>
916
+ `;
917
+ }
918
+ checkbox(e) {
919
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
920
+ }
921
+ paragraph(e) {
922
+ return `<p>${e}</p>
923
+ `;
924
+ }
925
+ table(e, t) {
926
+ return t && (t = `<tbody>${t}</tbody>`), `<table>
927
+ <thead>
928
+ ` + e + `</thead>
929
+ ` + t + `</table>
930
+ `;
931
+ }
932
+ tablerow(e) {
933
+ return `<tr>
934
+ ${e}</tr>
935
+ `;
936
+ }
937
+ tablecell(e, t) {
938
+ const n = t.header ? "th" : "td";
939
+ return (t.align ? `<${n} align="${t.align}">` : `<${n}>`) + e + `</${n}>
940
+ `;
941
+ }
942
+ /**
943
+ * span level renderer
944
+ */
945
+ strong(e) {
946
+ return `<strong>${e}</strong>`;
947
+ }
948
+ em(e) {
949
+ return `<em>${e}</em>`;
950
+ }
951
+ codespan(e) {
952
+ return `<code>${e}</code>`;
953
+ }
954
+ br() {
955
+ return "<br>";
956
+ }
957
+ del(e) {
958
+ return `<del>${e}</del>`;
959
+ }
960
+ link(e, t, n) {
961
+ const i = ye(e);
962
+ if (i === null)
963
+ return n;
964
+ e = i;
965
+ let l = '<a href="' + e + '"';
966
+ return t && (l += ' title="' + t + '"'), l += ">" + n + "</a>", l;
967
+ }
968
+ image(e, t, n) {
969
+ const i = ye(e);
970
+ if (i === null)
971
+ return n;
972
+ e = i;
973
+ let l = `<img src="${e}" alt="${n}"`;
974
+ return t && (l += ` title="${t}"`), l += ">", l;
975
+ }
976
+ text(e) {
977
+ return e;
978
+ }
979
+ }
980
+ class de {
981
+ // no need for block level renderers
982
+ strong(e) {
983
+ return e;
984
+ }
985
+ em(e) {
986
+ return e;
987
+ }
988
+ codespan(e) {
989
+ return e;
990
+ }
991
+ del(e) {
992
+ return e;
993
+ }
994
+ html(e) {
995
+ return e;
996
+ }
997
+ text(e) {
998
+ return e;
999
+ }
1000
+ link(e, t, n) {
1001
+ return "" + n;
1002
+ }
1003
+ image(e, t, n) {
1004
+ return "" + n;
1005
+ }
1006
+ br() {
1007
+ return "";
1008
+ }
1009
+ }
1010
+ class q {
1011
+ constructor(e) {
1012
+ _(this, "options");
1013
+ _(this, "renderer");
1014
+ _(this, "textRenderer");
1015
+ this.options = e || D, this.options.renderer = this.options.renderer || new ne(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new de();
1016
+ }
1017
+ /**
1018
+ * Static Parse Method
1019
+ */
1020
+ static parse(e, t) {
1021
+ return new q(t).parse(e);
1022
+ }
1023
+ /**
1024
+ * Static Parse Inline Method
1025
+ */
1026
+ static parseInline(e, t) {
1027
+ return new q(t).parseInline(e);
1028
+ }
1029
+ /**
1030
+ * Parse Loop
1031
+ */
1032
+ parse(e, t = !0) {
1033
+ let n = "";
1034
+ for (let i = 0; i < e.length; i++) {
1035
+ const l = e[i];
1036
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[l.type]) {
1037
+ const s = l, o = this.options.extensions.renderers[s.type].call({ parser: this }, s);
1038
+ if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(s.type)) {
1039
+ n += o || "";
1040
+ continue;
1041
+ }
1042
+ }
1043
+ switch (l.type) {
1044
+ case "space":
1045
+ continue;
1046
+ case "hr": {
1047
+ n += this.renderer.hr();
1048
+ continue;
1049
+ }
1050
+ case "heading": {
1051
+ const s = l;
1052
+ n += this.renderer.heading(this.parseInline(s.tokens), s.depth, nt(this.parseInline(s.tokens, this.textRenderer)));
1053
+ continue;
1054
+ }
1055
+ case "code": {
1056
+ const s = l;
1057
+ n += this.renderer.code(s.text, s.lang, !!s.escaped);
1058
+ continue;
1059
+ }
1060
+ case "table": {
1061
+ const s = l;
1062
+ let o = "", a = "";
1063
+ for (let c = 0; c < s.header.length; c++)
1064
+ a += this.renderer.tablecell(this.parseInline(s.header[c].tokens), { header: !0, align: s.align[c] });
1065
+ o += this.renderer.tablerow(a);
1066
+ let p = "";
1067
+ for (let c = 0; c < s.rows.length; c++) {
1068
+ const g = s.rows[c];
1069
+ a = "";
1070
+ for (let h = 0; h < g.length; h++)
1071
+ a += this.renderer.tablecell(this.parseInline(g[h].tokens), { header: !1, align: s.align[h] });
1072
+ p += this.renderer.tablerow(a);
1073
+ }
1074
+ n += this.renderer.table(o, p);
1075
+ continue;
1076
+ }
1077
+ case "blockquote": {
1078
+ const s = l, o = this.parse(s.tokens);
1079
+ n += this.renderer.blockquote(o);
1080
+ continue;
1081
+ }
1082
+ case "list": {
1083
+ const s = l, o = s.ordered, a = s.start, p = s.loose;
1084
+ let c = "";
1085
+ for (let g = 0; g < s.items.length; g++) {
1086
+ const h = s.items[g], u = h.checked, b = h.task;
1087
+ let d = "";
1088
+ if (h.task) {
1089
+ const y = this.renderer.checkbox(!!u);
1090
+ p ? h.tokens.length > 0 && h.tokens[0].type === "paragraph" ? (h.tokens[0].text = y + " " + h.tokens[0].text, h.tokens[0].tokens && h.tokens[0].tokens.length > 0 && h.tokens[0].tokens[0].type === "text" && (h.tokens[0].tokens[0].text = y + " " + h.tokens[0].tokens[0].text)) : h.tokens.unshift({
1091
+ type: "text",
1092
+ text: y + " "
1093
+ }) : d += y + " ";
1094
+ }
1095
+ d += this.parse(h.tokens, p), c += this.renderer.listitem(d, b, !!u);
1096
+ }
1097
+ n += this.renderer.list(c, o, a);
1098
+ continue;
1099
+ }
1100
+ case "html": {
1101
+ const s = l;
1102
+ n += this.renderer.html(s.text, s.block);
1103
+ continue;
1104
+ }
1105
+ case "paragraph": {
1106
+ const s = l;
1107
+ n += this.renderer.paragraph(this.parseInline(s.tokens));
1108
+ continue;
1109
+ }
1110
+ case "text": {
1111
+ let s = l, o = s.tokens ? this.parseInline(s.tokens) : s.text;
1112
+ for (; i + 1 < e.length && e[i + 1].type === "text"; )
1113
+ s = e[++i], o += `
1114
+ ` + (s.tokens ? this.parseInline(s.tokens) : s.text);
1115
+ n += t ? this.renderer.paragraph(o) : o;
1116
+ continue;
1117
+ }
1118
+ default: {
1119
+ const s = 'Token with "' + l.type + '" type was not found.';
1120
+ if (this.options.silent)
1121
+ return console.error(s), "";
1122
+ throw new Error(s);
1123
+ }
1124
+ }
1125
+ }
1126
+ return n;
1127
+ }
1128
+ /**
1129
+ * Parse Inline Tokens
1130
+ */
1131
+ parseInline(e, t) {
1132
+ t = t || this.renderer;
1133
+ let n = "";
1134
+ for (let i = 0; i < e.length; i++) {
1135
+ const l = e[i];
1136
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[l.type]) {
1137
+ const s = this.options.extensions.renderers[l.type].call({ parser: this }, l);
1138
+ if (s !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
1139
+ n += s || "";
1140
+ continue;
1141
+ }
1142
+ }
1143
+ switch (l.type) {
1144
+ case "escape": {
1145
+ const s = l;
1146
+ n += t.text(s.text);
1147
+ break;
1148
+ }
1149
+ case "html": {
1150
+ const s = l;
1151
+ n += t.html(s.text);
1152
+ break;
1153
+ }
1154
+ case "link": {
1155
+ const s = l;
1156
+ n += t.link(s.href, s.title, this.parseInline(s.tokens, t));
1157
+ break;
1158
+ }
1159
+ case "image": {
1160
+ const s = l;
1161
+ n += t.image(s.href, s.title, s.text);
1162
+ break;
1163
+ }
1164
+ case "strong": {
1165
+ const s = l;
1166
+ n += t.strong(this.parseInline(s.tokens, t));
1167
+ break;
1168
+ }
1169
+ case "em": {
1170
+ const s = l;
1171
+ n += t.em(this.parseInline(s.tokens, t));
1172
+ break;
1173
+ }
1174
+ case "codespan": {
1175
+ const s = l;
1176
+ n += t.codespan(s.text);
1177
+ break;
1178
+ }
1179
+ case "br": {
1180
+ n += t.br();
1181
+ break;
1182
+ }
1183
+ case "del": {
1184
+ const s = l;
1185
+ n += t.del(this.parseInline(s.tokens, t));
1186
+ break;
1187
+ }
1188
+ case "text": {
1189
+ const s = l;
1190
+ n += t.text(s.text);
1191
+ break;
1192
+ }
1193
+ default: {
1194
+ const s = 'Token with "' + l.type + '" type was not found.';
1195
+ if (this.options.silent)
1196
+ return console.error(s), "";
1197
+ throw new Error(s);
1198
+ }
1199
+ }
1200
+ }
1201
+ return n;
1202
+ }
1203
+ }
1204
+ class F {
1205
+ constructor(e) {
1206
+ _(this, "options");
1207
+ this.options = e || D;
1208
+ }
1209
+ /**
1210
+ * Process markdown before marked
1211
+ */
1212
+ preprocess(e) {
1213
+ return e;
1214
+ }
1215
+ /**
1216
+ * Process HTML after marked is finished
1217
+ */
1218
+ postprocess(e) {
1219
+ return e;
1220
+ }
1221
+ /**
1222
+ * Process all tokens before walk tokens
1223
+ */
1224
+ processAllTokens(e) {
1225
+ return e;
1226
+ }
1227
+ }
1228
+ _(F, "passThroughHooks", /* @__PURE__ */ new Set([
1229
+ "preprocess",
1230
+ "postprocess",
1231
+ "processAllTokens"
1232
+ ]));
1233
+ var Z, le, je;
1234
+ class $t {
1235
+ constructor(...e) {
1236
+ xe(this, Z);
1237
+ _(this, "defaults", ce());
1238
+ _(this, "options", this.setOptions);
1239
+ _(this, "parse", X(this, Z, le).call(this, M.lex, q.parse));
1240
+ _(this, "parseInline", X(this, Z, le).call(this, M.lexInline, q.parseInline));
1241
+ _(this, "Parser", q);
1242
+ _(this, "Renderer", ne);
1243
+ _(this, "TextRenderer", de);
1244
+ _(this, "Lexer", M);
1245
+ _(this, "Tokenizer", ee);
1246
+ _(this, "Hooks", F);
1247
+ this.use(...e);
1248
+ }
1249
+ /**
1250
+ * Run callback for every token
1251
+ */
1252
+ walkTokens(e, t) {
1253
+ var i, l;
1254
+ let n = [];
1255
+ for (const s of e)
1256
+ switch (n = n.concat(t.call(this, s)), s.type) {
1257
+ case "table": {
1258
+ const o = s;
1259
+ for (const a of o.header)
1260
+ n = n.concat(this.walkTokens(a.tokens, t));
1261
+ for (const a of o.rows)
1262
+ for (const p of a)
1263
+ n = n.concat(this.walkTokens(p.tokens, t));
1264
+ break;
1265
+ }
1266
+ case "list": {
1267
+ const o = s;
1268
+ n = n.concat(this.walkTokens(o.items, t));
1269
+ break;
1270
+ }
1271
+ default: {
1272
+ const o = s;
1273
+ (l = (i = this.defaults.extensions) == null ? void 0 : i.childTokens) != null && l[o.type] ? this.defaults.extensions.childTokens[o.type].forEach((a) => {
1274
+ const p = o[a].flat(1 / 0);
1275
+ n = n.concat(this.walkTokens(p, t));
1276
+ }) : o.tokens && (n = n.concat(this.walkTokens(o.tokens, t)));
1277
+ }
1278
+ }
1279
+ return n;
1280
+ }
1281
+ use(...e) {
1282
+ const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1283
+ return e.forEach((n) => {
1284
+ const i = { ...n };
1285
+ if (i.async = this.defaults.async || i.async || !1, n.extensions && (n.extensions.forEach((l) => {
1286
+ if (!l.name)
1287
+ throw new Error("extension name required");
1288
+ if ("renderer" in l) {
1289
+ const s = t.renderers[l.name];
1290
+ s ? t.renderers[l.name] = function(...o) {
1291
+ let a = l.renderer.apply(this, o);
1292
+ return a === !1 && (a = s.apply(this, o)), a;
1293
+ } : t.renderers[l.name] = l.renderer;
1294
+ }
1295
+ if ("tokenizer" in l) {
1296
+ if (!l.level || l.level !== "block" && l.level !== "inline")
1297
+ throw new Error("extension level must be 'block' or 'inline'");
1298
+ const s = t[l.level];
1299
+ s ? s.unshift(l.tokenizer) : t[l.level] = [l.tokenizer], l.start && (l.level === "block" ? t.startBlock ? t.startBlock.push(l.start) : t.startBlock = [l.start] : l.level === "inline" && (t.startInline ? t.startInline.push(l.start) : t.startInline = [l.start]));
1300
+ }
1301
+ "childTokens" in l && l.childTokens && (t.childTokens[l.name] = l.childTokens);
1302
+ }), i.extensions = t), n.renderer) {
1303
+ const l = this.defaults.renderer || new ne(this.defaults);
1304
+ for (const s in n.renderer) {
1305
+ if (!(s in l))
1306
+ throw new Error(`renderer '${s}' does not exist`);
1307
+ if (s === "options")
1308
+ continue;
1309
+ const o = s, a = n.renderer[o], p = l[o];
1310
+ l[o] = (...c) => {
1311
+ let g = a.apply(l, c);
1312
+ return g === !1 && (g = p.apply(l, c)), g || "";
1313
+ };
1314
+ }
1315
+ i.renderer = l;
1316
+ }
1317
+ if (n.tokenizer) {
1318
+ const l = this.defaults.tokenizer || new ee(this.defaults);
1319
+ for (const s in n.tokenizer) {
1320
+ if (!(s in l))
1321
+ throw new Error(`tokenizer '${s}' does not exist`);
1322
+ if (["options", "rules", "lexer"].includes(s))
1323
+ continue;
1324
+ const o = s, a = n.tokenizer[o], p = l[o];
1325
+ l[o] = (...c) => {
1326
+ let g = a.apply(l, c);
1327
+ return g === !1 && (g = p.apply(l, c)), g;
1328
+ };
1329
+ }
1330
+ i.tokenizer = l;
1331
+ }
1332
+ if (n.hooks) {
1333
+ const l = this.defaults.hooks || new F();
1334
+ for (const s in n.hooks) {
1335
+ if (!(s in l))
1336
+ throw new Error(`hook '${s}' does not exist`);
1337
+ if (s === "options")
1338
+ continue;
1339
+ const o = s, a = n.hooks[o], p = l[o];
1340
+ F.passThroughHooks.has(s) ? l[o] = (c) => {
1341
+ if (this.defaults.async)
1342
+ return Promise.resolve(a.call(l, c)).then((h) => p.call(l, h));
1343
+ const g = a.call(l, c);
1344
+ return p.call(l, g);
1345
+ } : l[o] = (...c) => {
1346
+ let g = a.apply(l, c);
1347
+ return g === !1 && (g = p.apply(l, c)), g;
1348
+ };
1349
+ }
1350
+ i.hooks = l;
1351
+ }
1352
+ if (n.walkTokens) {
1353
+ const l = this.defaults.walkTokens, s = n.walkTokens;
1354
+ i.walkTokens = function(o) {
1355
+ let a = [];
1356
+ return a.push(s.call(this, o)), l && (a = a.concat(l.call(this, o))), a;
1357
+ };
1358
+ }
1359
+ this.defaults = { ...this.defaults, ...i };
1360
+ }), this;
1361
+ }
1362
+ setOptions(e) {
1363
+ return this.defaults = { ...this.defaults, ...e }, this;
1364
+ }
1365
+ lexer(e, t) {
1366
+ return M.lex(e, t ?? this.defaults);
1367
+ }
1368
+ parser(e, t) {
1369
+ return q.parse(e, t ?? this.defaults);
1370
+ }
1371
+ }
1372
+ Z = new WeakSet(), le = function(e, t) {
1373
+ return (n, i) => {
1374
+ const l = { ...i }, s = { ...this.defaults, ...l };
1375
+ this.defaults.async === !0 && l.async === !1 && (s.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), s.async = !0);
1376
+ const o = X(this, Z, je).call(this, !!s.silent, !!s.async);
1377
+ if (typeof n > "u" || n === null)
1378
+ return o(new Error("marked(): input parameter is undefined or null"));
1379
+ if (typeof n != "string")
1380
+ return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1381
+ if (s.hooks && (s.hooks.options = s), s.async)
1382
+ return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then((a) => e(a, s)).then((a) => s.hooks ? s.hooks.processAllTokens(a) : a).then((a) => s.walkTokens ? Promise.all(this.walkTokens(a, s.walkTokens)).then(() => a) : a).then((a) => t(a, s)).then((a) => s.hooks ? s.hooks.postprocess(a) : a).catch(o);
1383
+ try {
1384
+ s.hooks && (n = s.hooks.preprocess(n));
1385
+ let a = e(n, s);
1386
+ s.hooks && (a = s.hooks.processAllTokens(a)), s.walkTokens && this.walkTokens(a, s.walkTokens);
1387
+ let p = t(a, s);
1388
+ return s.hooks && (p = s.hooks.postprocess(p)), p;
1389
+ } catch (a) {
1390
+ return o(a);
1391
+ }
1392
+ };
1393
+ }, je = function(e, t) {
1394
+ return (n) => {
1395
+ if (n.message += `
1396
+ Please report this to https://github.com/markedjs/marked.`, e) {
1397
+ const i = "<p>An error occurred:</p><pre>" + R(n.message + "", !0) + "</pre>";
1398
+ return t ? Promise.resolve(i) : i;
1399
+ }
1400
+ if (t)
1401
+ return Promise.reject(n);
1402
+ throw n;
1403
+ };
1404
+ };
1405
+ const B = new $t();
1406
+ function m(r, e) {
1407
+ return B.parse(r, e);
1408
+ }
1409
+ m.options = m.setOptions = function(r) {
1410
+ return B.setOptions(r), m.defaults = B.defaults, $e(m.defaults), m;
1411
+ };
1412
+ m.getDefaults = ce;
1413
+ m.defaults = D;
1414
+ m.use = function(...r) {
1415
+ return B.use(...r), m.defaults = B.defaults, $e(m.defaults), m;
1416
+ };
1417
+ m.walkTokens = function(r, e) {
1418
+ return B.walkTokens(r, e);
1419
+ };
1420
+ m.parseInline = B.parseInline;
1421
+ m.Parser = q;
1422
+ m.parser = q.parse;
1423
+ m.Renderer = ne;
1424
+ m.TextRenderer = de;
1425
+ m.Lexer = M;
1426
+ m.lexer = M.lex;
1427
+ m.Tokenizer = ee;
1428
+ m.Hooks = F;
1429
+ m.parse = m;
1430
+ m.options;
1431
+ m.setOptions;
1432
+ m.use;
1433
+ m.walkTokens;
1434
+ m.parseInline;
1435
+ q.parse;
1436
+ M.lex;
1437
+ const {
1438
+ HtmlTagHydration: Lt,
1439
+ SvelteComponent: Mt,
1440
+ append_hydration: T,
1441
+ attr: v,
1442
+ children: L,
1443
+ claim_element: A,
1444
+ claim_html_tag: qt,
1445
+ claim_space: j,
1446
+ claim_text: re,
1447
+ destroy_each: Pt,
1448
+ detach: I,
1449
+ element: E,
1450
+ ensure_array_like: Re,
1451
+ get_svelte_dataset: Bt,
1452
+ init: Zt,
1453
+ insert_hydration: ke,
1454
+ noop: Ie,
1455
+ null_to_empty: Se,
1456
+ safe_not_equal: Dt,
1457
+ set_data: oe,
1458
+ set_style: O,
1459
+ space: N,
1460
+ text: ae,
1461
+ toggle_class: $
1462
+ } = window.__gradio__svelte__internal;
1463
+ function Ae(r, e, t) {
1464
+ const n = r.slice();
1465
+ return n[27] = e[t], n[29] = t, n;
1466
+ }
1467
+ function Ee(r) {
1468
+ let e, t;
1469
+ return {
1470
+ c() {
1471
+ e = E("label"), t = ae(
1472
+ /*label*/
1473
+ r[2]
1474
+ ), this.h();
1475
+ },
1476
+ l(n) {
1477
+ e = A(n, "LABEL", { class: !0, for: !0 });
1478
+ var i = L(e);
1479
+ t = re(
1480
+ i,
1481
+ /*label*/
1482
+ r[2]
1483
+ ), i.forEach(I), this.h();
1484
+ },
1485
+ h() {
1486
+ v(e, "class", "block-title svelte-1eo2cb7"), v(e, "for", "consilium-roundtable");
1487
+ },
1488
+ m(n, i) {
1489
+ ke(n, e, i), T(e, t);
1490
+ },
1491
+ p(n, i) {
1492
+ i & /*label*/
1493
+ 4 && oe(
1494
+ t,
1495
+ /*label*/
1496
+ n[2]
1497
+ );
1498
+ },
1499
+ d(n) {
1500
+ n && I(e);
1501
+ }
1502
+ };
1503
+ }
1504
+ function Ce(r) {
1505
+ let e, t, n, i, l = (
1506
+ /*renderMarkdown*/
1507
+ r[10](
1508
+ /*getLatestMessage*/
1509
+ r[12](
1510
+ /*participant*/
1511
+ r[27]
1512
+ )
1513
+ ) + ""
1514
+ ), s, o, a, p, c = (
1515
+ /*getEmoji*/
1516
+ r[11](
1517
+ /*participant*/
1518
+ r[27]
1519
+ ) + ""
1520
+ ), g, h, u, b = (
1521
+ /*participant*/
1522
+ r[27] + ""
1523
+ ), d, y;
1524
+ return {
1525
+ c() {
1526
+ e = E("div"), t = E("div"), n = E("div"), i = new Lt(!1), s = N(), o = E("div"), a = N(), p = E("div"), g = ae(c), h = N(), u = E("div"), d = ae(b), y = N(), this.h();
1527
+ },
1528
+ l(k) {
1529
+ e = A(k, "DIV", { class: !0, style: !0 });
1530
+ var x = L(e);
1531
+ t = A(x, "DIV", { class: !0 });
1532
+ var z = L(t);
1533
+ n = A(z, "DIV", { class: !0 });
1534
+ var S = L(n);
1535
+ i = qt(S, !1), S.forEach(I), s = j(z), o = A(z, "DIV", { class: !0 }), L(o).forEach(I), z.forEach(I), a = j(x), p = A(x, "DIV", { class: !0, role: !0, tabindex: !0 });
1536
+ var C = L(p);
1537
+ g = re(C, c), C.forEach(I), h = j(x), u = A(x, "DIV", { class: !0 });
1538
+ var J = L(u);
1539
+ d = re(J, b), J.forEach(I), y = j(x), x.forEach(I), this.h();
1540
+ },
1541
+ h() {
1542
+ i.a = null, v(n, "class", "bubble-content svelte-1eo2cb7"), v(o, "class", "bubble-arrow svelte-1eo2cb7"), v(t, "class", "speech-bubble svelte-1eo2cb7"), $(
1543
+ t,
1544
+ "visible",
1545
+ /*isBubbleVisible*/
1546
+ r[13](
1547
+ /*participant*/
1548
+ r[27]
1549
+ )
1550
+ ), v(p, "class", "avatar svelte-1eo2cb7"), v(p, "role", "button"), v(p, "tabindex", "0"), $(
1551
+ p,
1552
+ "speaking",
1553
+ /*isAvatarActive*/
1554
+ r[14](
1555
+ /*participant*/
1556
+ r[27]
1557
+ )
1558
+ ), $(
1559
+ p,
1560
+ "thinking",
1561
+ /*thinking*/
1562
+ r[6].includes(
1563
+ /*participant*/
1564
+ r[27]
1565
+ )
1566
+ ), $(
1567
+ p,
1568
+ "responding",
1569
+ /*currentSpeaker*/
1570
+ r[5] === /*participant*/
1571
+ r[27]
1572
+ ), v(u, "class", "participant-name svelte-1eo2cb7"), v(e, "class", "participant-seat svelte-1eo2cb7"), O(e, "left", Q(
1573
+ /*index*/
1574
+ r[29],
1575
+ /*participants*/
1576
+ r[4].length
1577
+ ).left), O(e, "top", Q(
1578
+ /*index*/
1579
+ r[29],
1580
+ /*participants*/
1581
+ r[4].length
1582
+ ).top), O(e, "transform", Q(
1583
+ /*index*/
1584
+ r[29],
1585
+ /*participants*/
1586
+ r[4].length
1587
+ ).transform);
1588
+ },
1589
+ m(k, x) {
1590
+ ke(k, e, x), T(e, t), T(t, n), i.m(l, n), T(t, s), T(t, o), T(e, a), T(e, p), T(p, g), T(e, h), T(e, u), T(u, d), T(e, y);
1591
+ },
1592
+ p(k, x) {
1593
+ x & /*participants*/
1594
+ 16 && l !== (l = /*renderMarkdown*/
1595
+ k[10](
1596
+ /*getLatestMessage*/
1597
+ k[12](
1598
+ /*participant*/
1599
+ k[27]
1600
+ )
1601
+ ) + "") && i.p(l), x & /*isBubbleVisible, participants*/
1602
+ 8208 && $(
1603
+ t,
1604
+ "visible",
1605
+ /*isBubbleVisible*/
1606
+ k[13](
1607
+ /*participant*/
1608
+ k[27]
1609
+ )
1610
+ ), x & /*participants*/
1611
+ 16 && c !== (c = /*getEmoji*/
1612
+ k[11](
1613
+ /*participant*/
1614
+ k[27]
1615
+ ) + "") && oe(g, c), x & /*isAvatarActive, participants*/
1616
+ 16400 && $(
1617
+ p,
1618
+ "speaking",
1619
+ /*isAvatarActive*/
1620
+ k[14](
1621
+ /*participant*/
1622
+ k[27]
1623
+ )
1624
+ ), x & /*thinking, participants*/
1625
+ 80 && $(
1626
+ p,
1627
+ "thinking",
1628
+ /*thinking*/
1629
+ k[6].includes(
1630
+ /*participant*/
1631
+ k[27]
1632
+ )
1633
+ ), x & /*currentSpeaker, participants*/
1634
+ 48 && $(
1635
+ p,
1636
+ "responding",
1637
+ /*currentSpeaker*/
1638
+ k[5] === /*participant*/
1639
+ k[27]
1640
+ ), x & /*participants*/
1641
+ 16 && b !== (b = /*participant*/
1642
+ k[27] + "") && oe(d, b), x & /*participants*/
1643
+ 16 && O(e, "left", Q(
1644
+ /*index*/
1645
+ k[29],
1646
+ /*participants*/
1647
+ k[4].length
1648
+ ).left), x & /*participants*/
1649
+ 16 && O(e, "top", Q(
1650
+ /*index*/
1651
+ k[29],
1652
+ /*participants*/
1653
+ k[4].length
1654
+ ).top), x & /*participants*/
1655
+ 16 && O(e, "transform", Q(
1656
+ /*index*/
1657
+ k[29],
1658
+ /*participants*/
1659
+ k[4].length
1660
+ ).transform);
1661
+ },
1662
+ d(k) {
1663
+ k && I(e);
1664
+ }
1665
+ };
1666
+ }
1667
+ function Ot(r) {
1668
+ let e, t, n, i, l = '<div class="consensus-flame svelte-1eo2cb7">🎭</div> <div class="table-label svelte-1eo2cb7">CONSILIUM</div>', s, o, a, p, c = (
1669
+ /*show_label*/
1670
+ r[3] && /*label*/
1671
+ r[2] && Ee(r)
1672
+ ), g = Re(
1673
+ /*participants*/
1674
+ r[4]
1675
+ ), h = [];
1676
+ for (let u = 0; u < g.length; u += 1)
1677
+ h[u] = Ce(Ae(r, g, u));
1678
+ return {
1679
+ c() {
1680
+ e = E("div"), c && c.c(), t = N(), n = E("div"), i = E("div"), i.innerHTML = l, s = N(), o = E("div");
1681
+ for (let u = 0; u < h.length; u += 1)
1682
+ h[u].c();
1683
+ this.h();
1684
+ },
1685
+ l(u) {
1686
+ e = A(u, "DIV", { class: !0, id: !0, style: !0 });
1687
+ var b = L(e);
1688
+ c && c.l(b), t = j(b), n = A(b, "DIV", { class: !0, id: !0 });
1689
+ var d = L(n);
1690
+ i = A(d, "DIV", { class: !0, "data-svelte-h": !0 }), Bt(i) !== "svelte-fj2hkt" && (i.innerHTML = l), s = j(d), o = A(d, "DIV", { class: !0 });
1691
+ var y = L(o);
1692
+ for (let k = 0; k < h.length; k += 1)
1693
+ h[k].l(y);
1694
+ y.forEach(I), d.forEach(I), b.forEach(I), this.h();
1695
+ },
1696
+ h() {
1697
+ v(i, "class", "table-center svelte-1eo2cb7"), v(o, "class", "participants-circle"), v(n, "class", "consilium-container svelte-1eo2cb7"), v(n, "id", "consilium-roundtable"), v(e, "class", a = Se(
1698
+ /*containerClasses*/
1699
+ r[9]
1700
+ ) + " svelte-1eo2cb7"), v(
1701
+ e,
1702
+ "id",
1703
+ /*elem_id*/
1704
+ r[0]
1705
+ ), v(e, "style", p = /*containerStyle*/
1706
+ r[8] + "; " + /*minWidthStyle*/
1707
+ r[7]), $(e, "hidden", !/*visible*/
1708
+ r[1]);
1709
+ },
1710
+ m(u, b) {
1711
+ ke(u, e, b), c && c.m(e, null), T(e, t), T(e, n), T(n, i), T(n, s), T(n, o);
1712
+ for (let d = 0; d < h.length; d += 1)
1713
+ h[d] && h[d].m(o, null);
1714
+ },
1715
+ p(u, [b]) {
1716
+ if (/*show_label*/
1717
+ u[3] && /*label*/
1718
+ u[2] ? c ? c.p(u, b) : (c = Ee(u), c.c(), c.m(e, t)) : c && (c.d(1), c = null), b & /*getPosition, participants, isAvatarActive, thinking, currentSpeaker, getEmoji, isBubbleVisible, renderMarkdown, getLatestMessage*/
1719
+ 31856) {
1720
+ g = Re(
1721
+ /*participants*/
1722
+ u[4]
1723
+ );
1724
+ let d;
1725
+ for (d = 0; d < g.length; d += 1) {
1726
+ const y = Ae(u, g, d);
1727
+ h[d] ? h[d].p(y, b) : (h[d] = Ce(y), h[d].c(), h[d].m(o, null));
1728
+ }
1729
+ for (; d < h.length; d += 1)
1730
+ h[d].d(1);
1731
+ h.length = g.length;
1732
+ }
1733
+ b & /*containerClasses*/
1734
+ 512 && a !== (a = Se(
1735
+ /*containerClasses*/
1736
+ u[9]
1737
+ ) + " svelte-1eo2cb7") && v(e, "class", a), b & /*elem_id*/
1738
+ 1 && v(
1739
+ e,
1740
+ "id",
1741
+ /*elem_id*/
1742
+ u[0]
1743
+ ), b & /*containerStyle, minWidthStyle*/
1744
+ 384 && p !== (p = /*containerStyle*/
1745
+ u[8] + "; " + /*minWidthStyle*/
1746
+ u[7]) && v(e, "style", p), b & /*containerClasses, visible*/
1747
+ 514 && $(e, "hidden", !/*visible*/
1748
+ u[1]);
1749
+ },
1750
+ i: Ie,
1751
+ o: Ie,
1752
+ d(u) {
1753
+ u && I(e), c && c.d(), Pt(h, u);
1754
+ }
1755
+ };
1756
+ }
1757
+ function Q(r, e) {
1758
+ const n = (360 / e * r - 90) * (Math.PI / 180), i = 260, l = 180, s = Math.cos(n) * i, o = Math.sin(n) * l;
1759
+ return {
1760
+ left: `calc(50% + ${s}px)`,
1761
+ top: `calc(50% + ${o}px)`,
1762
+ transform: "translate(-50%, -50%)"
1763
+ };
1764
+ }
1765
+ function Qt(r, e, t) {
1766
+ let n, i, l, { gradio: s } = e, { elem_id: o = "" } = e, { elem_classes: a = [] } = e, { visible: p = !0 } = e, { value: c = "{}" } = e, { label: g = "Consilium Roundtable" } = e, { show_label: h = !0 } = e, { scale: u = null } = e, { min_width: b = void 0 } = e, { loading_status: d } = e, { interactive: y = !0 } = e, k = [], x = [], z = null, S = [], C = [];
1767
+ function J() {
1768
+ try {
1769
+ const f = JSON.parse(c);
1770
+ t(4, k = f.participants || []), x = f.messages || [], t(5, z = f.currentSpeaker || null), t(6, S = f.thinking || []), C = f.showBubbles || [], console.log("Clean JSON parsed:", {
1771
+ participants: k,
1772
+ messages: x,
1773
+ currentSpeaker: z,
1774
+ thinking: S,
1775
+ showBubbles: C
1776
+ });
1777
+ } catch (f) {
1778
+ console.error("Invalid JSON:", c, f);
1779
+ }
1780
+ }
1781
+ function Ne(f) {
1782
+ if (!f) return f;
1783
+ try {
1784
+ return m.setOptions({
1785
+ breaks: !0,
1786
+ // Convert line breaks to <br>
1787
+ gfm: !0,
1788
+ // GitHub flavored markdown
1789
+ sanitize: !1,
1790
+ // Allow HTML (safe since we control input)
1791
+ smartypants: !1
1792
+ // Don't convert quotes/dashes
1793
+ }), f.includes(`
1794
+ `) ? m.parse(f) : m.parseInline(f);
1795
+ } catch (P) {
1796
+ return console.error("Markdown parsing error:", P), f;
1797
+ }
1798
+ }
1799
+ const Ve = {
1800
+ Claude: "🤖",
1801
+ "GPT-4": "🧠",
1802
+ Mistral: "🦾",
1803
+ Gemini: "💎",
1804
+ Search: "🔍",
1805
+ OpenAI: "🧠",
1806
+ Anthropic: "🤖",
1807
+ Google: "💎"
1808
+ };
1809
+ function He(f) {
1810
+ return Ve[f] || "🤖";
1811
+ }
1812
+ function Fe(f) {
1813
+ if (S.includes(f))
1814
+ return `${f} is thinking...`;
1815
+ if (z === f)
1816
+ return `${f} is responding...`;
1817
+ const P = x.filter((W) => W.speaker === f);
1818
+ return P.length === 0 ? `${f} is ready to discuss...` : P[P.length - 1].text || `${f} responded`;
1819
+ }
1820
+ function Ge(f) {
1821
+ const P = S.includes(f), W = z === f, be = C.includes(f), me = P || W || be;
1822
+ return console.log(`${f} bubble visible:`, me, { isThinking: P, isSpeaking: W, shouldShow: be }), me;
1823
+ }
1824
+ function Ue(f) {
1825
+ return S.includes(f) || z === f;
1826
+ }
1827
+ return r.$$set = (f) => {
1828
+ "gradio" in f && t(15, s = f.gradio), "elem_id" in f && t(0, o = f.elem_id), "elem_classes" in f && t(16, a = f.elem_classes), "visible" in f && t(1, p = f.visible), "value" in f && t(17, c = f.value), "label" in f && t(2, g = f.label), "show_label" in f && t(3, h = f.show_label), "scale" in f && t(18, u = f.scale), "min_width" in f && t(19, b = f.min_width), "loading_status" in f && t(20, d = f.loading_status), "interactive" in f && t(21, y = f.interactive);
1829
+ }, r.$$.update = () => {
1830
+ r.$$.dirty & /*elem_classes*/
1831
+ 65536 && t(9, n = `wrapper ${a.join(" ")}`), r.$$.dirty & /*scale*/
1832
+ 262144 && t(8, i = u ? `--scale: ${u}` : ""), r.$$.dirty & /*min_width*/
1833
+ 524288 && t(7, l = b ? `min-width: ${b}px` : ""), r.$$.dirty & /*interactive*/
1834
+ 2097152, r.$$.dirty & /*value*/
1835
+ 131072 && J();
1836
+ }, [
1837
+ o,
1838
+ p,
1839
+ g,
1840
+ h,
1841
+ k,
1842
+ z,
1843
+ S,
1844
+ l,
1845
+ i,
1846
+ n,
1847
+ Ne,
1848
+ He,
1849
+ Fe,
1850
+ Ge,
1851
+ Ue,
1852
+ s,
1853
+ a,
1854
+ c,
1855
+ u,
1856
+ b,
1857
+ d,
1858
+ y
1859
+ ];
1860
+ }
1861
+ class jt extends Mt {
1862
+ constructor(e) {
1863
+ super(), Zt(this, e, Qt, Ot, Dt, {
1864
+ gradio: 15,
1865
+ elem_id: 0,
1866
+ elem_classes: 16,
1867
+ visible: 1,
1868
+ value: 17,
1869
+ label: 2,
1870
+ show_label: 3,
1871
+ scale: 18,
1872
+ min_width: 19,
1873
+ loading_status: 20,
1874
+ interactive: 21
1875
+ });
1876
+ }
1877
+ }
1878
+ const {
1879
+ SvelteComponent: Nt,
1880
+ claim_component: Vt,
1881
+ create_component: Ht,
1882
+ destroy_component: Ft,
1883
+ init: Gt,
1884
+ mount_component: Ut,
1885
+ noop: Jt,
1886
+ safe_not_equal: Wt,
1887
+ transition_in: Xt,
1888
+ transition_out: Yt
1889
+ } = window.__gradio__svelte__internal, { onMount: nn } = window.__gradio__svelte__internal;
1890
+ function Kt(r) {
1891
+ let e, t;
1892
+ return e = new jt({
1893
+ props: {
1894
+ value: (
1895
+ /*value*/
1896
+ r[0]
1897
+ ),
1898
+ label: "Example Roundtable",
1899
+ visible: !0,
1900
+ elem_id: "example",
1901
+ elem_classes: [],
1902
+ scale: null,
1903
+ min_width: 600,
1904
+ interactive: !0,
1905
+ gradio: {},
1906
+ loading_status: {},
1907
+ show_label: !0
1908
+ }
1909
+ }), {
1910
+ c() {
1911
+ Ht(e.$$.fragment);
1912
+ },
1913
+ l(n) {
1914
+ Vt(e.$$.fragment, n);
1915
+ },
1916
+ m(n, i) {
1917
+ Ut(e, n, i), t = !0;
1918
+ },
1919
+ p: Jt,
1920
+ i(n) {
1921
+ t || (Xt(e.$$.fragment, n), t = !0);
1922
+ },
1923
+ o(n) {
1924
+ Yt(e.$$.fragment, n), t = !1;
1925
+ },
1926
+ d(n) {
1927
+ Ft(e, n);
1928
+ }
1929
+ };
1930
+ }
1931
+ function en(r) {
1932
+ return [JSON.stringify({
1933
+ participants: ["Claude", "GPT-4", "Mistral"],
1934
+ messages: [
1935
+ {
1936
+ speaker: "Claude",
1937
+ text: "Welcome to the roundtable!"
1938
+ }
1939
+ ],
1940
+ currentSpeaker: "Claude",
1941
+ thinking: []
1942
+ })];
1943
+ }
1944
+ class sn extends Nt {
1945
+ constructor(e) {
1946
+ super(), Gt(this, e, en, Kt, Wt, {});
1947
+ }
1948
+ }
1949
+ export {
1950
+ sn as default
1951
+ };
src/gradio_consilium_roundtable/templates/example/style.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .hidden.svelte-1eo2cb7{display:none}.block-title.svelte-1eo2cb7{display:block;margin-bottom:10px;padding:10px;font-weight:700;color:gold}.wrapper.svelte-1eo2cb7{width:600px;height:600px;position:relative}.consilium-container.svelte-1eo2cb7{top:150px;position:relative;width:450px;height:300px;margin:20px auto;border-radius:50%;background:linear-gradient(135deg,#0f5132,#198754);border:8px solid #8b4513;box-shadow:0 8px 32px #0006,inset 0 0 20px #0003}.table-center.svelte-1eo2cb7{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;background:#0000004d;border-radius:50%;width:140px;height:100px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px solid #8b4513;box-shadow:inset 0 0 10px #00000080}.consensus-flame.svelte-1eo2cb7{font-size:2rem;margin-bottom:5px}.table-label.svelte-1eo2cb7{color:gold;font-size:.7rem;font-weight:700;letter-spacing:2px;text-shadow:0 2px 4px rgba(0,0,0,.8)}.participant-seat.svelte-1eo2cb7{position:absolute}.avatar.svelte-1eo2cb7{width:60px;height:60px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:1.4rem;background:linear-gradient(145deg,#fff,#e6e6e6);border:3px solid #8b4513;box-shadow:0 6px 15px #0000004d,inset 0 2px 5px #ffffff80;margin-bottom:8px;cursor:pointer;transition:all .3s ease;position:relative;z-index:10}.avatar.svelte-1eo2cb7:hover{transform:scale(1.05);box-shadow:0 8px 20px #0006,inset 0 2px 5px #ffffff80}.avatar.thinking.svelte-1eo2cb7{border-color:#ff6b35;animation:svelte-1eo2cb7-thinking-pulse 1.5s infinite}.avatar.responding.svelte-1eo2cb7{border-color:gold;animation:svelte-1eo2cb7-speaking-glow 1s infinite}.avatar.speaking.svelte-1eo2cb7{border-color:gold}.participant-name.svelte-1eo2cb7{font-size:.75rem;font-weight:700;color:gold;text-shadow:0 2px 4px rgba(0,0,0,.8);text-align:center;white-space:nowrap;background:#0000004d;padding:2px 8px;border-radius:10px;border:1px solid #8b4513}.speech-bubble.svelte-1eo2cb7{position:absolute;bottom:85px;left:50%;transform:translate(-50%) translateY(20px);background:#fff;border-radius:15px;padding:10px 14px;box-shadow:0 8px 25px #0000004d;z-index:20;opacity:0;transition:all .4s ease;pointer-events:none;border:2px solid #8b4513;min-width:180px;max-width:300px;word-wrap:break-word;white-space:normal}.speech-bubble.visible.svelte-1eo2cb7{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.bubble-content.svelte-1eo2cb7{font-size:.8rem;color:#333;line-height:1.4;text-align:left;max-height:100px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#8b4513 #f0f0f0}.bubble-content.svelte-1eo2cb7::-webkit-scrollbar{width:6px}.bubble-content.svelte-1eo2cb7::-webkit-scrollbar-track{background:#f0f0f0;border-radius:3px}.bubble-content.svelte-1eo2cb7::-webkit-scrollbar-thumb{background:#8b4513;border-radius:3px}.bubble-content.svelte-1eo2cb7::-webkit-scrollbar-thumb:hover{background:#654321}.bubble-arrow.svelte-1eo2cb7{position:absolute;bottom:-10px;left:50%;transform:translate(-50%);width:0;height:0;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid white}.bubble-arrow.svelte-1eo2cb7:before{content:"";position:absolute;bottom:2px;left:50%;transform:translate(-50%);width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid #8b4513}@keyframes svelte-1eo2cb7-thinking-pulse{0%,to{transform:scale(1);box-shadow:0 6px 15px #0000004d,0 0 15px #ff6b3566}50%{transform:scale(1.03);box-shadow:0 8px 20px #0006,0 0 25px #ff6b3599}}@keyframes svelte-1eo2cb7-speaking-glow{0%,to{box-shadow:0 6px 15px #0000004d,0 0 20px #ffd70080}50%{box-shadow:0 8px 20px #0006,0 0 30px #ffd700cc}}
src/pyproject.toml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = [
3
+ "hatchling",
4
+ "hatch-requirements-txt",
5
+ "hatch-fancy-pypi-readme>=22.5.0",
6
+ ]
7
+ build-backend = "hatchling.build"
8
+
9
+ [project]
10
+ name = "gradio_consilium_roundtable"
11
+ version = "0.0.5"
12
+ description = "The roundtable for artificial minds"
13
+ readme = "README.md"
14
+ license = "apache-2.0"
15
+ requires-python = ">=3.10"
16
+ authors = [{ name = "Andreas Zettl", email = "info@azettl.net" }]
17
+ keywords = ["gradio-custom-component", "custom-component-track", "roundtable", "consilium"]
18
+ # Add dependencies here
19
+ dependencies = ["gradio>=4.0,<6.0"]
20
+ classifiers = [
21
+ 'Development Status :: 3 - Alpha',
22
+ 'Operating System :: OS Independent',
23
+ 'Programming Language :: Python :: 3',
24
+ 'Programming Language :: Python :: 3 :: Only',
25
+ 'Programming Language :: Python :: 3.8',
26
+ 'Programming Language :: Python :: 3.9',
27
+ 'Programming Language :: Python :: 3.10',
28
+ 'Programming Language :: Python :: 3.11',
29
+ 'Topic :: Scientific/Engineering',
30
+ 'Topic :: Scientific/Engineering :: Artificial Intelligence',
31
+ 'Topic :: Scientific/Engineering :: Visualization',
32
+ ]
33
+
34
+ # The repository and space URLs are optional, but recommended.
35
+ # Adding a repository URL will create a badge in the auto-generated README that links to the repository.
36
+ # Adding a space URL will create a badge in the auto-generated README that links to the space.
37
+ # This will make it easy for people to find your deployed demo or source code when they
38
+ # encounter your project in the wild.
39
+
40
+ # [project.urls]
41
+ # repository = "your github repository"
42
+ # space = "your space url"
43
+
44
+ [project.optional-dependencies]
45
+ dev = ["build", "twine"]
46
+
47
+ [tool.hatch.build]
48
+ artifacts = ["/backend/gradio_consilium_roundtable/templates", "*.pyi", "/home/andreas/.pyenv/versions/3.10.12/lib/python3.10/site-packages/gradio_consilium_roundtable/templates"]
49
+
50
+ [tool.hatch.build.targets.wheel]
51
+ packages = ["/backend/gradio_consilium_roundtable"]