rio-assist-widget 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rio-assist.js +119 -19
- package/package.json +1 -1
- package/src/components/fullscreen/fullscreen.styles.ts +20 -10
- package/src/components/mini-panel/mini-panel.styles.ts +67 -10
- package/src/components/mini-panel/mini-panel.template.ts +41 -0
- package/src/components/rio-assist/rio-assist.ts +57 -46
package/dist/rio-assist.js
CHANGED
|
@@ -377,6 +377,63 @@
|
|
|
377
377
|
margin-bottom: 6px;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
+
.short-answer-toggle {
|
|
381
|
+
display: inline-flex;
|
|
382
|
+
align-items: center;
|
|
383
|
+
gap: 12px;
|
|
384
|
+
border: 1px solid #d6dde3;
|
|
385
|
+
background: #f7fafc;
|
|
386
|
+
color: #1f2f36;
|
|
387
|
+
border-radius: 999px;
|
|
388
|
+
padding: 8px 12px 8px 10px;
|
|
389
|
+
font-weight: 600;
|
|
390
|
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
|
|
391
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.short-answer-toggle:focus-visible {
|
|
395
|
+
outline: 2px solid var(--accent-color, #008b9a);
|
|
396
|
+
outline-offset: 2px;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.short-answer-toggle__track {
|
|
400
|
+
width: 44px;
|
|
401
|
+
height: 24px;
|
|
402
|
+
border-radius: 999px;
|
|
403
|
+
background: #c7d0d9;
|
|
404
|
+
position: relative;
|
|
405
|
+
transition: background-color 0.2s ease;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.short-answer-toggle__track--on {
|
|
409
|
+
background: #008b9a;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.short-answer-toggle__thumb {
|
|
413
|
+
position: absolute;
|
|
414
|
+
top: 3px;
|
|
415
|
+
left: 4px;
|
|
416
|
+
width: 18px;
|
|
417
|
+
height: 18px;
|
|
418
|
+
border-radius: 50%;
|
|
419
|
+
background: #fff;
|
|
420
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
|
|
421
|
+
transition: transform 0.2s ease;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.short-answer-toggle__track--on .short-answer-toggle__thumb {
|
|
425
|
+
transform: translateX(18px);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.short-answer-toggle__label {
|
|
429
|
+
font-size: 14px;
|
|
430
|
+
white-space: nowrap;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.short-answer-toggle--hero {
|
|
434
|
+
margin-top: 8px;
|
|
435
|
+
}
|
|
436
|
+
|
|
380
437
|
.suggestions-label {
|
|
381
438
|
text-align: center;
|
|
382
439
|
font-size: 14px;
|
|
@@ -684,29 +741,39 @@
|
|
|
684
741
|
display: flex;
|
|
685
742
|
flex-direction: column;
|
|
686
743
|
align-items: center;
|
|
687
|
-
padding: 36px
|
|
744
|
+
padding: 36px clamp(24px, 4vw, 56px) 18px;
|
|
688
745
|
width: 100%;
|
|
689
746
|
flex: 1;
|
|
690
747
|
min-height: 0;
|
|
691
748
|
overflow: hidden;
|
|
692
749
|
max-width: 1400px;
|
|
693
750
|
margin: 0 auto;
|
|
751
|
+
box-sizing: border-box;
|
|
694
752
|
}
|
|
695
753
|
|
|
696
754
|
.fullscreen-chat .panel-body {
|
|
697
755
|
max-width: 920px;
|
|
698
756
|
width: 100%;
|
|
699
|
-
padding: 12px
|
|
757
|
+
padding: 12px clamp(20px, 3vw, 44px) 12px;
|
|
700
758
|
margin: 0 auto;
|
|
759
|
+
box-sizing: border-box;
|
|
701
760
|
}
|
|
702
761
|
|
|
703
762
|
.fullscreen-chat .panel-footer {
|
|
704
763
|
max-width: 640px;
|
|
764
|
+
width: 100%;
|
|
765
|
+
padding: 0 clamp(16px, 3vw, 32px);
|
|
766
|
+
box-sizing: border-box;
|
|
705
767
|
}
|
|
706
768
|
|
|
707
769
|
.fullscreen-chat form {
|
|
708
770
|
max-width: none;
|
|
709
771
|
}
|
|
772
|
+
|
|
773
|
+
.fullscreen-chat .panel-content {
|
|
774
|
+
padding-right: clamp(12px, 2vw, 24px);
|
|
775
|
+
box-sizing: border-box;
|
|
776
|
+
}
|
|
710
777
|
`,ui=qe`
|
|
711
778
|
.conversations-panel {
|
|
712
779
|
position: absolute;
|
|
@@ -1161,7 +1228,7 @@
|
|
|
1161
1228
|
* @license
|
|
1162
1229
|
* Copyright 2018 Google LLC
|
|
1163
1230
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1164
|
-
*/const
|
|
1231
|
+
*/const G=Gt(class extends Vt{constructor(e){var t;if(super(e),e.type!==Qt.ATTRIBUTE||e.name!=="class"||((t=e.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){var n,r;if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(const i in t)t[i]&&!((n=this.nt)!=null&&n.has(i))&&this.st.add(i);return this.render(t)}const u=e.element.classList;for(const i of this.st)i in t||(u.remove(i),this.st.delete(i));for(const i in t){const o=!!t[i];o===this.st.has(i)||(r=this.nt)!=null&&r.has(i)||(o?(u.add(i),this.st.add(i)):(u.remove(i),this.st.delete(i)))}return ae}}),ri=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIRSURBVHgB7Ze/T8JAFMcfxMVFq5OaGBsTJxccXEn/AAdGNvE/8C9QjP+AOybippuDDrpQdCT+ijpIRJowwICCMZFBk/O99iANob+urS73SV5ee717/XL37l0BkEgkklhJQAQwxhR0isPjbiKR6IIggQSiEA1dBm0BLcVFKT6HG9xIbBntBIUbEBUobptFSwctA1GAgTZZPJBIFcKCQeosPg7c3j3mQ5yG7gPtkDcZDl37+aiClaMq+EOD/4B+mN+Zd4vjuYuZVUIomVWwZmjSoSvNMu1QA02nHcqs/CqBx2xiX7FyRy9gYvlHyb/OY2henUEUFm5zkEiFxym5dXTTkHQRp8HQ0jROK/BcOB/cv93UzPtW+XFUCBKX49f3IEgySOfGWQWq+xeDexL3enwFd7tHTkP6p4zwURdIoJ1es2PO4Ex6Gb4/e+Z1HAgLbF+/mH5+bdX0Lf0B4kBYYD/vqgVryVuXTyCI6/KLz+BtDcZnp9CmYWJpDr6a76YJ4LqBhAS2Md9+MO8Ws2lY2cqannDYzV4UQQRmFemwZHisPYfneQiDV4H1oG6LU7e1UwHXmVVnw4FBFLQiCw4JUHmMnK09B3HAhY5apjwXkGHWmZtitg9Q3tYJI9Dze5CgPz0YfLgcbGB70WkMX8IShES0zLiKI/C5jm4H/gpbLuUCjsvHnoNh4SIpF1MgkUgkkkD8AgAi3WKqFnrYAAAAAElFTkSuQmCC",_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("rio-assist.js",document.baseURI).href).href,ii=e=>T`
|
|
1165
1232
|
<button
|
|
1166
1233
|
class="floating-button"
|
|
1167
1234
|
style="background:${e.accentColor}"
|
|
@@ -1181,19 +1248,19 @@
|
|
|
1181
1248
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1182
1249
|
*/const Ju="important",si=" !"+Ju,ai=Gt(class extends Vt{constructor(e){var t;if(super(e),e.type!==Qt.ATTRIBUTE||e.name!=="style"||((t=e.strings)==null?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,u)=>{const n=e[u];return n==null?t:t+`${u=u.includes("-")?u:u.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(e,[t]){const{style:u}=e.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(const n of this.ft)t[n]==null&&(this.ft.delete(n),n.includes("-")?u.removeProperty(n):u[n]=null);for(const n in t){const r=t[n];if(r!=null){this.ft.add(n);const i=typeof r=="string"&&r.endsWith(si);n.includes("-")||i?u.setProperty(n,i?r.slice(0,-11):r,i?Ju:""):u[n]=r}}return ae}}),ci=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADdSURBVHgB5ZQxCsJAEEX/rsbaI3gEvYE22ppO7DyCJ1BvoCdIFSNBGFOIaBBzg1whR0gpqLsuSWHnBBKI4G+mefyB+Z8B6pBD1C7KCg7wgusCSi0Bndxh9Wb2IP3GS84wN8t2d1rqMeZw3hCIMjuIVEorQhXyKOw7dCt8x98Wm7JPl+4TYiGho4k93HA8G8oLILN1rCHW2/25fMom3U8YDbCSPKAH0CrQwHxqjw74D7n+sevRqVOEZW+4o5Ck1Yo1mrFrKlTa0ISRVcVUpw2F8oZGq3yIpLLnUOtjeAMX/z7Yit+o3QAAAABJRU5ErkJggg==",_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("rio-assist.js",document.baseURI).href).href;new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADJSURBVHgBvZPdCcIwFIVPqvjcETpCnUDzrA86ghOIG+gGbqIv4mPjBhmhI/goFhNv2qpNQfIjeCCQhHu++0MC/CgWEpwfihQjLHCHkEteBgHyc5FBsQIaGR2vqPTYQBJfAG5k0rQapRhgajZOgMmcny5rymaycrqStEo8IJwtWGUztpWzya6eA1XgnEGv51Z6I+d8341L/M1UdoVjP5b5mzV/lf0VEGq2ADHmNyDWbNQMUdGjiDB/ALa8zUbDFiOg9Kredz7KX/QESDR2d7Kg6IcAAAAASUVORK5CYII=",_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("rio-assist.js",document.baseURI).href).href;const li=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADoSURBVHgBpZLfDYIwEMavqImPjOAIdQP6bIw6AhM4giMYR3ACEhOegQ3qBh2hvplIOItG6NXKn/glbY6745e7DwD+FPMl+SXbwgRCkqxAybXI3d6pDwAB2wNCRJNYmCvyTsCTLIQZS+whzAmdXm2ObJ4eGMudUO8J5qa5RHudK/jFHCD1gKfFARAX0CeGJ7kSr2moB1gtTXXTC6jg/AkDp6RbGApz519xrRKUH4BtoUu1eX5AMAig6SvjpboAEvqEePsNCKzxmPUz0ZisQD/j3RRnDeHYFqzYMZoAjLuap1kMXWID1hyjJ+SZQp3ORCa/AAAAAElFTkSuQmCC",_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("rio-assist.js",document.baseURI).href).href,di=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAF+SURBVHgBxZNNTsMwEIVnnBAqVuEG6Q16A8INeoOSFXRFkEpFVqRCaquqi7CA0hXhBNATUE4ANyBHyA4aKg+OU0QgxgKExNvkx8+fx89jgD8S6gb98NK2rKcdALZFCLacwOkuYxBHQTv5FqhzMnGZCdfCYqvGOWA4DnZ7b99MZTocnTWYibcFhHoMqD4K9jBbrG8SkCcsifgXdvrnvrai7uDiUTwcYd4eBu355/GjwcThAPdEAC9ZrR6FXlqpqNufNnOIWCFWQXIN83w4nCKiba09+8qtEZJblEpXoFG2UYukH6ChBCFREe4CEh0oOvBS6V+dZjVsKgDcooYO5Iucyt8VEGcwlzxk+6CRCawlfQSxEjSWAeODCNvtDKbHKojsMXH84jUxVgtXjj+fvDJJiTBjvsQZY8uEc9NBgzcZYquo4r09UAcRmPSLzs4b0iu3B2ogvVHQDkXzuZyDK5wOEaYGoxtVf6EOAj+QDBuN5azYxu8gH5Rf1PIl/De9AhTgnL0rAocOAAAAAElFTkSuQmCC",_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("rio-assist.js",document.baseURI).href).href,fi=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADhSURBVHgB7ZbdCYNAEIRnJb6nBEu4ErSAEK0gLaSUdJAS8gt5vKQDO4gd6HtAc0YhEm4NOQUJ7AcnuHMrI7cMBwjCP6N2el4vDMCDI+qoY/h0NytXJx3CEWcDpjM2z+bviVZwxN3ASIgBMTC5gRkntAHTFzJvjVAHUsBtTJMo4zSyFV8h49EW/QZ+o6qidBFdP8v2I+iGzFgwYWU3UGKPsSmrg61M3P6vM+BjY9qXzYv5+ANr8BRmDgqbwA5h21BwujrrjkZ5moQZHJAcEANiwN1AN6zK6oYpUBcdDL0VC8ITASg13Rg8meYAAAAASUVORK5CYII=",_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("rio-assist.js",document.baseURI).href).href,hi=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACTSURBVHgB7dQxDsIgFMbxP9iLdDPOJq4cxSt4BE/iUWQ1OqsjvUFP0NeOtGV6DW3S8EsI4QvkDTyAYmtmGpwuTtAL35ev48CSWfYC1TToDDVFJNVFD5Sko/29/S3OqsS+K0rGEoZpVGD9LkK4oySGlt2ZddHx7BwL/D/ex+vZHdgDT/TCMNb97FLvoEFJRH+2yKcHytAb6RI8xigAAAAASUVORK5CYII=",_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("rio-assist.js",document.baseURI).href).href,en=(e,t={})=>{const u=t.variant??"drawer",n=u==="sidebar",r=n||e.showConversations;return T`
|
|
1183
1250
|
<div
|
|
1184
|
-
class=${
|
|
1251
|
+
class=${G({"conversations-panel":!0,"conversations-panel--open":r,"conversations-panel--sidebar":n})}
|
|
1185
1252
|
aria-hidden=${!r}
|
|
1186
1253
|
@pointerdown=${i=>e.handleConversationsPanelPointer(i)}
|
|
1187
1254
|
>
|
|
1188
1255
|
<div
|
|
1189
|
-
class=${
|
|
1256
|
+
class=${G({"conversations-panel__surface":!0,"conversations-panel__surface--sidebar":n})}
|
|
1190
1257
|
>
|
|
1191
1258
|
${pi(e,u)}
|
|
1192
1259
|
</div>
|
|
1193
1260
|
</div>
|
|
1194
1261
|
`},pi=(e,t)=>{const u=t==="sidebar",n=u?T`
|
|
1195
1262
|
<div
|
|
1196
|
-
class=${
|
|
1263
|
+
class=${G({"new-conversation-cta":!0,open:e.showNewConversationShortcut})}
|
|
1197
1264
|
>
|
|
1198
1265
|
<button
|
|
1199
1266
|
type="button"
|
|
@@ -1208,7 +1275,7 @@
|
|
|
1208
1275
|
</div>
|
|
1209
1276
|
`:null,r=T`
|
|
1210
1277
|
<div
|
|
1211
|
-
class=${
|
|
1278
|
+
class=${G({"conversation-list":!0,"conversation-list--sidebar":u})}
|
|
1212
1279
|
@scroll=${u?i=>e.handleConversationListScroll(i):null}
|
|
1213
1280
|
>
|
|
1214
1281
|
${e.filteredConversations.map(i=>{const o=e.conversationMenuId===i.id;return T`
|
|
@@ -1232,7 +1299,7 @@
|
|
|
1232
1299
|
</button>
|
|
1233
1300
|
${o?T`
|
|
1234
1301
|
<div
|
|
1235
|
-
class=${
|
|
1302
|
+
class=${G({"conversation-menu":!0,"conversation-menu--above":e.conversationMenuPlacement==="above"})}
|
|
1236
1303
|
@click=${s=>s.stopPropagation()}
|
|
1237
1304
|
>
|
|
1238
1305
|
${null}
|
|
@@ -1269,14 +1336,14 @@
|
|
|
1269
1336
|
</div>
|
|
1270
1337
|
|
|
1271
1338
|
<div
|
|
1272
|
-
class=${
|
|
1339
|
+
class=${G({"conversation-list-wrapper":!0,"conversation-list-wrapper--sidebar":u})}
|
|
1273
1340
|
>
|
|
1274
1341
|
${e.conversationHistoryLoading?T`<div class="conversation-loading">Carregando conversas...</div>`:null}
|
|
1275
1342
|
${e.conversationHistoryError?T`<div class="conversation-error">${e.conversationHistoryError}</div>`:null}
|
|
1276
1343
|
${r}
|
|
1277
1344
|
${u?T`
|
|
1278
1345
|
<div
|
|
1279
|
-
class=${
|
|
1346
|
+
class=${G({"conversation-scrollbar":!0,"conversation-scrollbar--visible":e.conversationScrollbar.visible})}
|
|
1280
1347
|
@pointerdown=${i=>e.handleConversationScrollbarPointerDown(i)}
|
|
1281
1348
|
@pointermove=${i=>e.handleConversationScrollbarPointerMove(i)}
|
|
1282
1349
|
@pointerup=${i=>e.handleConversationScrollbarPointerUp(i)}
|
|
@@ -1293,12 +1360,27 @@
|
|
|
1293
1360
|
<div class="hero-card">
|
|
1294
1361
|
<img src=${mi} alt="IA assistente" class="hero-card__icon" />
|
|
1295
1362
|
<h3>Como posso te ajudar hoje?</h3>
|
|
1363
|
+
<button
|
|
1364
|
+
type="button"
|
|
1365
|
+
class="short-answer-toggle short-answer-toggle--hero"
|
|
1366
|
+
role="switch"
|
|
1367
|
+
aria-checked=${e.shortAnswerEnabled}
|
|
1368
|
+
@click=${()=>e.toggleShortAnswers()}
|
|
1369
|
+
>
|
|
1370
|
+
<span
|
|
1371
|
+
class=${G({"short-answer-toggle__track":!0,"short-answer-toggle__track--on":e.shortAnswerEnabled})}
|
|
1372
|
+
aria-hidden="true"
|
|
1373
|
+
>
|
|
1374
|
+
<span class="short-answer-toggle__thumb"></span>
|
|
1375
|
+
</span>
|
|
1376
|
+
<span class="short-answer-toggle__label">Ativar respostas curtas</span>
|
|
1377
|
+
</button>
|
|
1296
1378
|
</div>
|
|
1297
1379
|
`,n=T`
|
|
1298
1380
|
<div class="conversation">
|
|
1299
1381
|
${e.messages.map(r=>T`
|
|
1300
1382
|
<div
|
|
1301
|
-
class=${
|
|
1383
|
+
class=${G({message:!0,"message--user":r.role==="user","message--assistant":r.role==="assistant"})}
|
|
1302
1384
|
>
|
|
1303
1385
|
<div class="message__content">
|
|
1304
1386
|
${oi(r.html??r.text)}
|
|
@@ -1320,7 +1402,7 @@
|
|
|
1320
1402
|
`;return T`
|
|
1321
1403
|
<div class="panel-body">
|
|
1322
1404
|
<div
|
|
1323
|
-
class=${
|
|
1405
|
+
class=${G({"panel-content":!0,"panel-content--empty":!t})}
|
|
1324
1406
|
>
|
|
1325
1407
|
${t?n:u}
|
|
1326
1408
|
</div>
|
|
@@ -1328,6 +1410,24 @@
|
|
|
1328
1410
|
${e.errorMessage?T`<p class="error-banner">${e.errorMessage}</p>`:null}
|
|
1329
1411
|
|
|
1330
1412
|
<div class="panel-footer">
|
|
1413
|
+
${t?T`
|
|
1414
|
+
<button
|
|
1415
|
+
type="button"
|
|
1416
|
+
class="short-answer-toggle"
|
|
1417
|
+
role="switch"
|
|
1418
|
+
aria-checked=${e.shortAnswerEnabled}
|
|
1419
|
+
@click=${()=>e.toggleShortAnswers()}
|
|
1420
|
+
>
|
|
1421
|
+
<span
|
|
1422
|
+
class=${G({"short-answer-toggle__track":!0,"short-answer-toggle__track--on":e.shortAnswerEnabled})}
|
|
1423
|
+
aria-hidden="true"
|
|
1424
|
+
>
|
|
1425
|
+
<span class="short-answer-toggle__thumb"></span>
|
|
1426
|
+
</span>
|
|
1427
|
+
<span class="short-answer-toggle__label">Ativar respostas curtas</span>
|
|
1428
|
+
</button>
|
|
1429
|
+
`:null}
|
|
1430
|
+
|
|
1331
1431
|
${e.suggestions.length>0?T`
|
|
1332
1432
|
<div class="suggestions-wrapper">
|
|
1333
1433
|
<p class="suggestions-label">Sugestões de Perguntas</p>
|
|
@@ -1372,7 +1472,7 @@
|
|
|
1372
1472
|
</div>
|
|
1373
1473
|
</div>
|
|
1374
1474
|
`},Ci=e=>{const t=tn(e);return T`
|
|
1375
|
-
<aside class=${
|
|
1475
|
+
<aside class=${G({panel:!0,open:e.open})} role="dialog">
|
|
1376
1476
|
<header class="panel-header">
|
|
1377
1477
|
<div class="panel-header__top">
|
|
1378
1478
|
<span class="panel-title">${e.titleText}</span>
|
|
@@ -1457,7 +1557,7 @@
|
|
|
1457
1557
|
<span class="fullscreen-header__brand">RIO INSIGHT</span>
|
|
1458
1558
|
<button
|
|
1459
1559
|
type="button"
|
|
1460
|
-
class=${
|
|
1560
|
+
class=${G({"fullscreen-header__brand-toggle":!0,"fullscreen-header__brand-toggle--open":e.showNewConversationShortcut})}
|
|
1461
1561
|
aria-label="Alternar ações de conversa"
|
|
1462
1562
|
@click=${()=>e.toggleNewConversationShortcut()}
|
|
1463
1563
|
>
|
|
@@ -1510,7 +1610,7 @@
|
|
|
1510
1610
|
</div>
|
|
1511
1611
|
</div>
|
|
1512
1612
|
</section>
|
|
1513
|
-
`},Ti=e=>{const t=
|
|
1613
|
+
`},Ti=e=>{const t=G({canvas:!0,"canvas--fullscreen":e.isFullscreen});return T`
|
|
1514
1614
|
<div class=${t}>
|
|
1515
1615
|
${ii(e)}
|
|
1516
1616
|
${Ci(e)}
|
|
@@ -1601,7 +1701,7 @@
|
|
|
1601
1701
|
`},ue.text=function(e,t){return me(e[t].content)},ue.html_block=function(e,t){return e[t].content},ue.html_inline=function(e,t){return e[t].content};function Ie(){this.rules=xt({},ue)}Ie.prototype.renderAttrs=function(t){let u,n,r;if(!t.attrs)return"";for(r="",u=0,n=t.attrs.length;u<n;u++)r+=" "+me(t.attrs[u][0])+'="'+me(t.attrs[u][1])+'"';return r},Ie.prototype.renderToken=function(t,u,n){const r=t[u];let i="";if(r.hidden)return"";r.block&&r.nesting!==-1&&u&&t[u-1].hidden&&(i+=`
|
|
1602
1702
|
`),i+=(r.nesting===-1?"</":"<")+r.tag,i+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(i+=" /");let o=!1;if(r.block&&(o=!0,r.nesting===1&&u+1<t.length)){const s=t[u+1];(s.type==="inline"||s.hidden||s.nesting===-1&&s.tag===r.tag)&&(o=!1)}return i+=o?`>
|
|
1603
1703
|
`:">",i},Ie.prototype.renderInline=function(e,t,u){let n="";const r=this.rules;for(let i=0,o=e.length;i<o;i++){const s=e[i].type;typeof r[s]<"u"?n+=r[s](e,i,t,u,this):n+=this.renderToken(e,i,t)}return n},Ie.prototype.renderInlineAsText=function(e,t,u){let n="";for(let r=0,i=e.length;r<i;r++)switch(e[r].type){case"text":n+=e[r].content;break;case"image":n+=this.renderInlineAsText(e[r].children,t,u);break;case"html_inline":case"html_block":n+=e[r].content;break;case"softbreak":case"hardbreak":n+=`
|
|
1604
|
-
`;break}return n},Ie.prototype.render=function(e,t,u){let n="";const r=this.rules;for(let i=0,o=e.length;i<o;i++){const s=e[i].type;s==="inline"?n+=this.renderInline(e[i].children,t,u):typeof r[s]<"u"?n+=r[s](e,i,t,u,this):n+=this.renderToken(e,i,t,u)}return n};function
|
|
1605
|
-
`),t=t.replace(ko,"�"),e.src=t}function Do(e){let t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function So(e){const t=e.tokens;for(let u=0,n=t.length;u<n;u++){const r=t[u];r.type==="inline"&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function To(e){return/^<a[>\s]/i.test(e)}function Fo(e){return/^<\/a\s*>/i.test(e)}function Io(e){const t=e.tokens;if(e.md.options.linkify)for(let u=0,n=t.length;u<n;u++){if(t[u].type!=="inline"||!e.md.linkify.pretest(t[u].content))continue;let r=t[u].children,i=0;for(let o=r.length-1;o>=0;o--){const s=r[o];if(s.type==="link_close"){for(o--;r[o].level!==s.level&&r[o].type!=="link_open";)o--;continue}if(s.type==="html_inline"&&(To(s.content)&&i>0&&i--,Fo(s.content)&&i++),!(i>0)&&s.type==="text"&&e.md.linkify.test(s.content)){const a=s.content;let c=e.md.linkify.match(a);const d=[];let f=s.level,g=0;c.length>0&&c[0].index===0&&o>0&&r[o-1].type==="text_special"&&(c=c.slice(1));for(let p=0;p<c.length;p++){const h=c[p].url,v=e.md.normalizeLink(h);if(!e.md.validateLink(v))continue;let w=c[p].text;c[p].schema?c[p].schema==="mailto:"&&!/^mailto:/i.test(w)?w=e.md.normalizeLinkText("mailto:"+w).replace(/^mailto:/,""):w=e.md.normalizeLinkText(w):w=e.md.normalizeLinkText("http://"+w).replace(/^http:\/\//,"");const S=c[p].index;if(S>g){const E=new e.Token("text","",0);E.content=a.slice(g,S),E.level=f,d.push(E)}const y=new e.Token("link_open","a",1);y.attrs=[["href",v]],y.level=f++,y.markup="linkify",y.info="auto",d.push(y);const C=new e.Token("text","",0);C.content=w,C.level=f,d.push(C);const m=new e.Token("link_close","a",-1);m.level=--f,m.markup="linkify",m.info="auto",d.push(m),g=c[p].lastIndex}if(g<a.length){const p=new e.Token("text","",0);p.content=a.slice(g),p.level=f,d.push(p)}t[u].children=r=gn(r,o,d)}}}}const xn=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Ro=/\((c|tm|r)\)/i,Mo=/\((c|tm|r)\)/ig,Lo={c:"©",r:"®",tm:"™"};function Uo(e,t){return Lo[t.toLowerCase()]}function Bo(e){let t=0;for(let u=e.length-1;u>=0;u--){const n=e[u];n.type==="text"&&!t&&(n.content=n.content.replace(Mo,Uo)),n.type==="link_open"&&n.info==="auto"&&t--,n.type==="link_close"&&n.info==="auto"&&t++}}function No(e){let t=0;for(let u=e.length-1;u>=0;u--){const n=e[u];n.type==="text"&&!t&&xn.test(n.content)&&(n.content=n.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),n.type==="link_open"&&n.info==="auto"&&t--,n.type==="link_close"&&n.info==="auto"&&t++}}function Oo(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(Ro.test(e.tokens[t].content)&&Bo(e.tokens[t].children),xn.test(e.tokens[t].content)&&No(e.tokens[t].children))}const Po=/['"]/,_n=/['"]/g,Cn="’";function yt(e,t,u){return e.slice(0,t)+u+e.slice(t+1)}function $o(e,t){let u;const n=[];for(let r=0;r<e.length;r++){const i=e[r],o=e[r].level;for(u=n.length-1;u>=0&&!(n[u].level<=o);u--);if(n.length=u+1,i.type!=="text")continue;let s=i.content,a=0,c=s.length;e:for(;a<c;){_n.lastIndex=a;const d=_n.exec(s);if(!d)break;let f=!0,g=!0;a=d.index+1;const p=d[0]==="'";let h=32;if(d.index-1>=0)h=s.charCodeAt(d.index-1);else for(u=r-1;u>=0&&!(e[u].type==="softbreak"||e[u].type==="hardbreak");u--)if(e[u].content){h=e[u].content.charCodeAt(e[u].content.length-1);break}let v=32;if(a<c)v=s.charCodeAt(a);else for(u=r+1;u<e.length&&!(e[u].type==="softbreak"||e[u].type==="hardbreak");u++)if(e[u].content){v=e[u].content.charCodeAt(0);break}const w=tt(h)||et(String.fromCharCode(h)),S=tt(v)||et(String.fromCharCode(v)),y=Je(h),C=Je(v);if(C?f=!1:S&&(y||w||(f=!1)),y?g=!1:w&&(C||S||(g=!1)),v===34&&d[0]==='"'&&h>=48&&h<=57&&(g=f=!1),f&&g&&(f=w,g=S),!f&&!g){p&&(i.content=yt(i.content,d.index,Cn));continue}if(g)for(u=n.length-1;u>=0;u--){let m=n[u];if(n[u].level<o)break;if(m.single===p&&n[u].level===o){m=n[u];let E,D;p?(E=t.md.options.quotes[2],D=t.md.options.quotes[3]):(E=t.md.options.quotes[0],D=t.md.options.quotes[1]),i.content=yt(i.content,d.index,D),e[m.token].content=yt(e[m.token].content,m.pos,E),a+=D.length-1,m.token===r&&(a+=E.length-1),s=i.content,c=s.length,n.length=u;continue e}}f?n.push({token:r,pos:d.index,single:p,level:o}):g&&p&&(i.content=yt(i.content,d.index,Cn))}}}function zo(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!=="inline"||!Po.test(e.tokens[t].content)||$o(e.tokens[t].children,e)}function Ho(e){let t,u;const n=e.tokens,r=n.length;for(let i=0;i<r;i++){if(n[i].type!=="inline")continue;const o=n[i].children,s=o.length;for(t=0;t<s;t++)o[t].type==="text_special"&&(o[t].type="text");for(t=u=0;t<s;t++)o[t].type==="text"&&t+1<s&&o[t+1].type==="text"?o[t+1].content=o[t].content+o[t+1].content:(t!==u&&(o[u]=o[t]),u++);t!==u&&(o.length=u)}}const nu=[["normalize",wo],["block",Do],["inline",So],["linkify",Io],["replacements",Oo],["smartquotes",zo],["text_join",Ho]];function ru(){this.ruler=new G;for(let e=0;e<nu.length;e++)this.ruler.push(nu[e][0],nu[e][1])}ru.prototype.process=function(e){const t=this.ruler.getRules("");for(let u=0,n=t.length;u<n;u++)t[u](e)},ru.prototype.State=An;function ne(e,t,u,n){this.src=e,this.md=t,this.env=u,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const r=this.src;for(let i=0,o=0,s=0,a=0,c=r.length,d=!1;o<c;o++){const f=r.charCodeAt(o);if(!d)if(F(f)){s++,f===9?a+=4-a%4:a++;continue}else d=!0;(f===10||o===c-1)&&(f!==10&&o++,this.bMarks.push(i),this.eMarks.push(o),this.tShift.push(s),this.sCount.push(a),this.bsCount.push(0),d=!1,s=0,a=0,i=o+1)}this.bMarks.push(r.length),this.eMarks.push(r.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}ne.prototype.push=function(e,t,u){const n=new ee(e,t,u);return n.block=!0,u<0&&this.level--,n.level=this.level,u>0&&this.level++,this.tokens.push(n),n},ne.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]},ne.prototype.skipEmptyLines=function(t){for(let u=this.lineMax;t<u&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t},ne.prototype.skipSpaces=function(t){for(let u=this.src.length;t<u;t++){const n=this.src.charCodeAt(t);if(!F(n))break}return t},ne.prototype.skipSpacesBack=function(t,u){if(t<=u)return t;for(;t>u;)if(!F(this.src.charCodeAt(--t)))return t+1;return t},ne.prototype.skipChars=function(t,u){for(let n=this.src.length;t<n&&this.src.charCodeAt(t)===u;t++);return t},ne.prototype.skipCharsBack=function(t,u,n){if(t<=n)return t;for(;t>n;)if(u!==this.src.charCodeAt(--t))return t+1;return t},ne.prototype.getLines=function(t,u,n,r){if(t>=u)return"";const i=new Array(u-t);for(let o=0,s=t;s<u;s++,o++){let a=0;const c=this.bMarks[s];let d=c,f;for(s+1<u||r?f=this.eMarks[s]+1:f=this.eMarks[s];d<f&&a<n;){const g=this.src.charCodeAt(d);if(F(g))g===9?a+=4-(a+this.bsCount[s])%4:a++;else if(d-c<this.tShift[s])a++;else break;d++}a>n?i[o]=new Array(a-n+1).join(" ")+this.src.slice(d,f):i[o]=this.src.slice(d,f)}return i.join("")},ne.prototype.Token=ee;const qo=65536;function iu(e,t){const u=e.bMarks[t]+e.tShift[t],n=e.eMarks[t];return e.src.slice(u,n)}function yn(e){const t=[],u=e.length;let n=0,r=e.charCodeAt(n),i=!1,o=0,s="";for(;n<u;)r===124&&(i?(s+=e.substring(o,n-1),o=n):(t.push(s+e.substring(o,n)),s="",o=n+1)),i=r===92,n++,r=e.charCodeAt(n);return t.push(s+e.substring(o)),t}function jo(e,t,u,n){if(t+2>u)return!1;let r=t+1;if(e.sCount[r]<e.blkIndent||e.sCount[r]-e.blkIndent>=4)return!1;let i=e.bMarks[r]+e.tShift[r];if(i>=e.eMarks[r])return!1;const o=e.src.charCodeAt(i++);if(o!==124&&o!==45&&o!==58||i>=e.eMarks[r])return!1;const s=e.src.charCodeAt(i++);if(s!==124&&s!==45&&s!==58&&!F(s)||o===45&&F(s))return!1;for(;i<e.eMarks[r];){const m=e.src.charCodeAt(i);if(m!==124&&m!==45&&m!==58&&!F(m))return!1;i++}let a=iu(e,t+1),c=a.split("|");const d=[];for(let m=0;m<c.length;m++){const E=c[m].trim();if(!E){if(m===0||m===c.length-1)continue;return!1}if(!/^:?-+:?$/.test(E))return!1;E.charCodeAt(E.length-1)===58?d.push(E.charCodeAt(0)===58?"center":"right"):E.charCodeAt(0)===58?d.push("left"):d.push("")}if(a=iu(e,t).trim(),a.indexOf("|")===-1||e.sCount[t]-e.blkIndent>=4)return!1;c=yn(a),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop();const f=c.length;if(f===0||f!==d.length)return!1;if(n)return!0;const g=e.parentType;e.parentType="table";const p=e.md.block.ruler.getRules("blockquote"),h=e.push("table_open","table",1),v=[t,0];h.map=v;const w=e.push("thead_open","thead",1);w.map=[t,t+1];const S=e.push("tr_open","tr",1);S.map=[t,t+1];for(let m=0;m<c.length;m++){const E=e.push("th_open","th",1);d[m]&&(E.attrs=[["style","text-align:"+d[m]]]);const D=e.push("inline","",0);D.content=c[m].trim(),D.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let y,C=0;for(r=t+2;r<u&&!(e.sCount[r]<e.blkIndent);r++){let m=!1;for(let D=0,U=p.length;D<U;D++)if(p[D](e,r,u,!0)){m=!0;break}if(m||(a=iu(e,r).trim(),!a)||e.sCount[r]-e.blkIndent>=4||(c=yn(a),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop(),C+=f-c.length,C>qo))break;if(r===t+2){const D=e.push("tbody_open","tbody",1);D.map=y=[t+2,0]}const E=e.push("tr_open","tr",1);E.map=[r,r+1];for(let D=0;D<f;D++){const U=e.push("td_open","td",1);d[D]&&(U.attrs=[["style","text-align:"+d[D]]]);const Z=e.push("inline","",0);Z.content=c[D]?c[D].trim():"",Z.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return y&&(e.push("tbody_close","tbody",-1),y[1]=r),e.push("table_close","table",-1),v[1]=r,e.parentType=g,e.line=r,!0}function Yo(e,t,u){if(e.sCount[t]-e.blkIndent<4)return!1;let n=t+1,r=n;for(;n<u;){if(e.isEmpty(n)){n++;continue}if(e.sCount[n]-e.blkIndent>=4){n++,r=n;continue}break}e.line=r;const i=e.push("code_block","code",0);return i.content=e.getLines(t,r,4+e.blkIndent,!1)+`
|
|
1606
|
-
`,i.map=[t,e.line],!0}function Qo(e,t,u,n){let r=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||r+3>i)return!1;const o=e.src.charCodeAt(r);if(o!==126&&o!==96)return!1;let s=r;r=e.skipChars(r,o);let a=r-s;if(a<3)return!1;const c=e.src.slice(s,r),d=e.src.slice(r,i);if(o===96&&d.indexOf(String.fromCharCode(o))>=0)return!1;if(n)return!0;let f=t,g=!1;for(;f++,!(f>=u||(r=s=e.bMarks[f]+e.tShift[f],i=e.eMarks[f],r<i&&e.sCount[f]<e.blkIndent));)if(e.src.charCodeAt(r)===o&&!(e.sCount[f]-e.blkIndent>=4)&&(r=e.skipChars(r,o),!(r-s<a)&&(r=e.skipSpaces(r),!(r<i)))){g=!0;break}a=e.sCount[t],e.line=f+(g?1:0);const p=e.push("fence","code",0);return p.info=d,p.content=e.getLines(t+1,f,a,!0),p.markup=c,p.map=[t,e.line],!0}function Go(e,t,u,n){let r=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];const o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(r)!==62)return!1;if(n)return!0;const s=[],a=[],c=[],d=[],f=e.md.block.ruler.getRules("blockquote"),g=e.parentType;e.parentType="blockquote";let p=!1,h;for(h=t;h<u;h++){const C=e.sCount[h]<e.blkIndent;if(r=e.bMarks[h]+e.tShift[h],i=e.eMarks[h],r>=i)break;if(e.src.charCodeAt(r++)===62&&!C){let E=e.sCount[h]+1,D,U;e.src.charCodeAt(r)===32?(r++,E++,U=!1,D=!0):e.src.charCodeAt(r)===9?(D=!0,(e.bsCount[h]+E)%4===3?(r++,E++,U=!1):U=!0):D=!1;let Z=E;for(s.push(e.bMarks[h]),e.bMarks[h]=r;r<i;){const oe=e.src.charCodeAt(r);if(F(oe))oe===9?Z+=4-(Z+e.bsCount[h]+(U?1:0))%4:Z++;else break;r++}p=r>=i,a.push(e.bsCount[h]),e.bsCount[h]=e.sCount[h]+1+(D?1:0),c.push(e.sCount[h]),e.sCount[h]=Z-E,d.push(e.tShift[h]),e.tShift[h]=r-e.bMarks[h];continue}if(p)break;let m=!1;for(let E=0,D=f.length;E<D;E++)if(f[E](e,h,u,!0)){m=!0;break}if(m){e.lineMax=h,e.blkIndent!==0&&(s.push(e.bMarks[h]),a.push(e.bsCount[h]),d.push(e.tShift[h]),c.push(e.sCount[h]),e.sCount[h]-=e.blkIndent);break}s.push(e.bMarks[h]),a.push(e.bsCount[h]),d.push(e.tShift[h]),c.push(e.sCount[h]),e.sCount[h]=-1}const v=e.blkIndent;e.blkIndent=0;const w=e.push("blockquote_open","blockquote",1);w.markup=">";const S=[t,0];w.map=S,e.md.block.tokenize(e,t,h);const y=e.push("blockquote_close","blockquote",-1);y.markup=">",e.lineMax=o,e.parentType=g,S[1]=e.line;for(let C=0;C<d.length;C++)e.bMarks[C+t]=s[C],e.tShift[C+t]=d[C],e.sCount[C+t]=c[C],e.bsCount[C+t]=a[C];return e.blkIndent=v,!0}function Vo(e,t,u,n){const r=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.bMarks[t]+e.tShift[t];const o=e.src.charCodeAt(i++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;i<r;){const c=e.src.charCodeAt(i++);if(c!==o&&!F(c))return!1;c===o&&s++}if(s<3)return!1;if(n)return!0;e.line=t+1;const a=e.push("hr","hr",0);return a.map=[t,e.line],a.markup=Array(s+1).join(String.fromCharCode(o)),!0}function En(e,t){const u=e.eMarks[t];let n=e.bMarks[t]+e.tShift[t];const r=e.src.charCodeAt(n++);if(r!==42&&r!==45&&r!==43)return-1;if(n<u){const i=e.src.charCodeAt(n);if(!F(i))return-1}return n}function vn(e,t){const u=e.bMarks[t]+e.tShift[t],n=e.eMarks[t];let r=u;if(r+1>=n)return-1;let i=e.src.charCodeAt(r++);if(i<48||i>57)return-1;for(;;){if(r>=n)return-1;if(i=e.src.charCodeAt(r++),i>=48&&i<=57){if(r-u>=10)return-1;continue}if(i===41||i===46)break;return-1}return r<n&&(i=e.src.charCodeAt(r),!F(i))?-1:r}function Wo(e,t){const u=e.level+2;for(let n=t+2,r=e.tokens.length-2;n<r;n++)e.tokens[n].level===u&&e.tokens[n].type==="paragraph_open"&&(e.tokens[n+2].hidden=!0,e.tokens[n].hidden=!0,n+=2)}function Zo(e,t,u,n){let r,i,o,s,a=t,c=!0;if(e.sCount[a]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[a]-e.listIndent>=4&&e.sCount[a]<e.blkIndent)return!1;let d=!1;n&&e.parentType==="paragraph"&&e.sCount[a]>=e.blkIndent&&(d=!0);let f,g,p;if((p=vn(e,a))>=0){if(f=!0,o=e.bMarks[a]+e.tShift[a],g=Number(e.src.slice(o,p-1)),d&&g!==1)return!1}else if((p=En(e,a))>=0)f=!1;else return!1;if(d&&e.skipSpaces(p)>=e.eMarks[a])return!1;if(n)return!0;const h=e.src.charCodeAt(p-1),v=e.tokens.length;f?(s=e.push("ordered_list_open","ol",1),g!==1&&(s.attrs=[["start",g]])):s=e.push("bullet_list_open","ul",1);const w=[a,0];s.map=w,s.markup=String.fromCharCode(h);let S=!1;const y=e.md.block.ruler.getRules("list"),C=e.parentType;for(e.parentType="list";a<u;){i=p,r=e.eMarks[a];const m=e.sCount[a]+p-(e.bMarks[a]+e.tShift[a]);let E=m;for(;i<r;){const xe=e.src.charCodeAt(i);if(xe===9)E+=4-(E+e.bsCount[a])%4;else if(xe===32)E++;else break;i++}const D=i;let U;D>=r?U=1:U=E-m,U>4&&(U=1);const Z=m+U;s=e.push("list_item_open","li",1),s.markup=String.fromCharCode(h);const oe=[a,0];s.map=oe,f&&(s.info=e.src.slice(o,p-1));const ve=e.tight,B=e.tShift[a],lt=e.sCount[a],dt=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=Z,e.tight=!0,e.tShift[a]=D-e.bMarks[a],e.sCount[a]=E,D>=r&&e.isEmpty(a+1)?e.line=Math.min(e.line+2,u):e.md.block.tokenize(e,a,u,!0),(!e.tight||S)&&(c=!1),S=e.line-a>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=dt,e.tShift[a]=B,e.sCount[a]=lt,e.tight=ve,s=e.push("list_item_close","li",-1),s.markup=String.fromCharCode(h),a=e.line,oe[1]=a,a>=u||e.sCount[a]<e.blkIndent||e.sCount[a]-e.blkIndent>=4)break;let Le=!1;for(let xe=0,ku=y.length;xe<ku;xe++)if(y[xe](e,a,u,!0)){Le=!0;break}if(Le)break;if(f){if(p=vn(e,a),p<0)break;o=e.bMarks[a]+e.tShift[a]}else if(p=En(e,a),p<0)break;if(h!==e.src.charCodeAt(p-1))break}return f?s=e.push("ordered_list_close","ol",-1):s=e.push("bullet_list_close","ul",-1),s.markup=String.fromCharCode(h),w[1]=a,e.line=a,e.parentType=C,c&&Wo(e,v),!0}function Xo(e,t,u,n){let r=e.bMarks[t]+e.tShift[t],i=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(r)!==91)return!1;function s(y){const C=e.lineMax;if(y>=C||e.isEmpty(y))return null;let m=!1;if(e.sCount[y]-e.blkIndent>3&&(m=!0),e.sCount[y]<0&&(m=!0),!m){const U=e.md.block.ruler.getRules("reference"),Z=e.parentType;e.parentType="reference";let oe=!1;for(let ve=0,B=U.length;ve<B;ve++)if(U[ve](e,y,C,!0)){oe=!0;break}if(e.parentType=Z,oe)return null}const E=e.bMarks[y]+e.tShift[y],D=e.eMarks[y];return e.src.slice(E,D+1)}let a=e.src.slice(r,i+1);i=a.length;let c=-1;for(r=1;r<i;r++){const y=a.charCodeAt(r);if(y===91)return!1;if(y===93){c=r;break}else if(y===10){const C=s(o);C!==null&&(a+=C,i=a.length,o++)}else if(y===92&&(r++,r<i&&a.charCodeAt(r)===10)){const C=s(o);C!==null&&(a+=C,i=a.length,o++)}}if(c<0||a.charCodeAt(c+1)!==58)return!1;for(r=c+2;r<i;r++){const y=a.charCodeAt(r);if(y===10){const C=s(o);C!==null&&(a+=C,i=a.length,o++)}else if(!F(y))break}const d=e.md.helpers.parseLinkDestination(a,r,i);if(!d.ok)return!1;const f=e.md.normalizeLink(d.str);if(!e.md.validateLink(f))return!1;r=d.pos;const g=r,p=o,h=r;for(;r<i;r++){const y=a.charCodeAt(r);if(y===10){const C=s(o);C!==null&&(a+=C,i=a.length,o++)}else if(!F(y))break}let v=e.md.helpers.parseLinkTitle(a,r,i);for(;v.can_continue;){const y=s(o);if(y===null)break;a+=y,r=i,i=a.length,o++,v=e.md.helpers.parseLinkTitle(a,r,i,v)}let w;for(r<i&&h!==r&&v.ok?(w=v.str,r=v.pos):(w="",r=g,o=p);r<i;){const y=a.charCodeAt(r);if(!F(y))break;r++}if(r<i&&a.charCodeAt(r)!==10&&w)for(w="",r=g,o=p;r<i;){const y=a.charCodeAt(r);if(!F(y))break;r++}if(r<i&&a.charCodeAt(r)!==10)return!1;const S=Ct(a.slice(1,c));return S?(n||(typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[S]>"u"&&(e.env.references[S]={title:w,href:f}),e.line=o),!0):!1}const Ko=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Jo="[a-zA-Z_:][a-zA-Z0-9:._-]*",es="(?:"+"[^\"'=<>`\\x00-\\x20]+"+"|"+"'[^']*'"+"|"+'"[^"]*"'+")",kn="<[A-Za-z][A-Za-z0-9\\-]*"+("(?:\\s+"+Jo+"(?:\\s*=\\s*"+es+")?)")+"*\\s*\\/?>",wn="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",ts="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",us="<[?][\\s\\S]*?[?]>",ns="<![A-Za-z][^>]*>",rs="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",is=new RegExp("^(?:"+kn+"|"+wn+"|"+ts+"|"+us+"|"+ns+"|"+rs+")"),os=new RegExp("^(?:"+kn+"|"+wn+")"),Re=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+Ko.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(os.source+"\\s*$"),/^$/,!1]];function ss(e,t,u,n){let r=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(r)!==60)return!1;let o=e.src.slice(r,i),s=0;for(;s<Re.length&&!Re[s][0].test(o);s++);if(s===Re.length)return!1;if(n)return Re[s][2];let a=t+1;if(!Re[s][1].test(o)){for(;a<u&&!(e.sCount[a]<e.blkIndent);a++)if(r=e.bMarks[a]+e.tShift[a],i=e.eMarks[a],o=e.src.slice(r,i),Re[s][1].test(o)){o.length!==0&&a++;break}}e.line=a;const c=e.push("html_block","",0);return c.map=[t,a],c.content=e.getLines(t,a,e.blkIndent,!0),!0}function as(e,t,u,n){let r=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(r);if(o!==35||r>=i)return!1;let s=1;for(o=e.src.charCodeAt(++r);o===35&&r<i&&s<=6;)s++,o=e.src.charCodeAt(++r);if(s>6||r<i&&!F(o))return!1;if(n)return!0;i=e.skipSpacesBack(i,r);const a=e.skipCharsBack(i,35,r);a>r&&F(e.src.charCodeAt(a-1))&&(i=a),e.line=t+1;const c=e.push("heading_open","h"+String(s),1);c.markup="########".slice(0,s),c.map=[t,e.line];const d=e.push("inline","",0);d.content=e.src.slice(r,i).trim(),d.map=[t,e.line],d.children=[];const f=e.push("heading_close","h"+String(s),-1);return f.markup="########".slice(0,s),!0}function cs(e,t,u){const n=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;const r=e.parentType;e.parentType="paragraph";let i=0,o,s=t+1;for(;s<u&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let p=e.bMarks[s]+e.tShift[s];const h=e.eMarks[s];if(p<h&&(o=e.src.charCodeAt(p),(o===45||o===61)&&(p=e.skipChars(p,o),p=e.skipSpaces(p),p>=h))){i=o===61?1:2;break}}if(e.sCount[s]<0)continue;let g=!1;for(let p=0,h=n.length;p<h;p++)if(n[p](e,s,u,!0)){g=!0;break}if(g)break}if(!i)return!1;const a=e.getLines(t,s,e.blkIndent,!1).trim();e.line=s+1;const c=e.push("heading_open","h"+String(i),1);c.markup=String.fromCharCode(o),c.map=[t,e.line];const d=e.push("inline","",0);d.content=a,d.map=[t,e.line-1],d.children=[];const f=e.push("heading_close","h"+String(i),-1);return f.markup=String.fromCharCode(o),e.parentType=r,!0}function ls(e,t,u){const n=e.md.block.ruler.getRules("paragraph"),r=e.parentType;let i=t+1;for(e.parentType="paragraph";i<u&&!e.isEmpty(i);i++){if(e.sCount[i]-e.blkIndent>3||e.sCount[i]<0)continue;let c=!1;for(let d=0,f=n.length;d<f;d++)if(n[d](e,i,u,!0)){c=!0;break}if(c)break}const o=e.getLines(t,i,e.blkIndent,!1).trim();e.line=i;const s=e.push("paragraph_open","p",1);s.map=[t,e.line];const a=e.push("inline","",0);return a.content=o,a.map=[t,e.line],a.children=[],e.push("paragraph_close","p",-1),e.parentType=r,!0}const Et=[["table",jo,["paragraph","reference"]],["code",Yo],["fence",Qo,["paragraph","reference","blockquote","list"]],["blockquote",Go,["paragraph","reference","blockquote","list"]],["hr",Vo,["paragraph","reference","blockquote","list"]],["list",Zo,["paragraph","reference","blockquote"]],["reference",Xo],["html_block",ss,["paragraph","reference","blockquote"]],["heading",as,["paragraph","reference","blockquote"]],["lheading",cs],["paragraph",ls]];function vt(){this.ruler=new G;for(let e=0;e<Et.length;e++)this.ruler.push(Et[e][0],Et[e][1],{alt:(Et[e][2]||[]).slice()})}vt.prototype.tokenize=function(e,t,u){const n=this.ruler.getRules(""),r=n.length,i=e.md.options.maxNesting;let o=t,s=!1;for(;o<u&&(e.line=o=e.skipEmptyLines(o),!(o>=u||e.sCount[o]<e.blkIndent));){if(e.level>=i){e.line=u;break}const a=e.line;let c=!1;for(let d=0;d<r;d++)if(c=n[d](e,o,u,!1),c){if(a>=e.line)throw new Error("block rule didn't increment state.line");break}if(!c)throw new Error("none of the block rules matched");e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<u&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}},vt.prototype.parse=function(e,t,u,n){if(!e)return;const r=new this.State(e,t,u,n);this.tokenize(r,r.line,r.lineMax)},vt.prototype.State=ne;function ut(e,t,u,n){this.src=e,this.env=u,this.md=t,this.tokens=n,this.tokens_meta=Array(n.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}ut.prototype.pushPending=function(){const e=new ee("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e},ut.prototype.push=function(e,t,u){this.pending&&this.pushPending();const n=new ee(e,t,u);let r=null;return u<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),n.level=this.level,u>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],r={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(r),n},ut.prototype.scanDelims=function(e,t){const u=this.posMax,n=this.src.charCodeAt(e),r=e>0?this.src.charCodeAt(e-1):32;let i=e;for(;i<u&&this.src.charCodeAt(i)===n;)i++;const o=i-e,s=i<u?this.src.charCodeAt(i):32,a=tt(r)||et(String.fromCharCode(r)),c=tt(s)||et(String.fromCharCode(s)),d=Je(r),f=Je(s),g=!f&&(!c||d||a),p=!d&&(!a||f||c);return{can_open:g&&(t||!p||a),can_close:p&&(t||!g||c),length:o}},ut.prototype.Token=ee;function ds(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function fs(e,t){let u=e.pos;for(;u<e.posMax&&!ds(e.src.charCodeAt(u));)u++;return u===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,u)),e.pos=u,!0)}const hs=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function ps(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;const u=e.pos,n=e.posMax;if(u+3>n||e.src.charCodeAt(u)!==58||e.src.charCodeAt(u+1)!==47||e.src.charCodeAt(u+2)!==47)return!1;const r=e.pending.match(hs);if(!r)return!1;const i=r[1],o=e.md.linkify.matchAtStart(e.src.slice(u-i.length));if(!o)return!1;let s=o.url;if(s.length<=i.length)return!1;s=s.replace(/\*+$/,"");const a=e.md.normalizeLink(s);if(!e.md.validateLink(a))return!1;if(!t){e.pending=e.pending.slice(0,-i.length);const c=e.push("link_open","a",1);c.attrs=[["href",a]],c.markup="linkify",c.info="auto";const d=e.push("text","",0);d.content=e.md.normalizeLinkText(s);const f=e.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return e.pos+=s.length-i.length,!0}function bs(e,t){let u=e.pos;if(e.src.charCodeAt(u)!==10)return!1;const n=e.pending.length-1,r=e.posMax;if(!t)if(n>=0&&e.pending.charCodeAt(n)===32)if(n>=1&&e.pending.charCodeAt(n-1)===32){let i=n-1;for(;i>=1&&e.pending.charCodeAt(i-1)===32;)i--;e.pending=e.pending.slice(0,i),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(u++;u<r&&F(e.src.charCodeAt(u));)u++;return e.pos=u,!0}const ou=[];for(let e=0;e<256;e++)ou.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){ou[e.charCodeAt(0)]=1});function gs(e,t){let u=e.pos;const n=e.posMax;if(e.src.charCodeAt(u)!==92||(u++,u>=n))return!1;let r=e.src.charCodeAt(u);if(r===10){for(t||e.push("hardbreak","br",0),u++;u<n&&(r=e.src.charCodeAt(u),!!F(r));)u++;return e.pos=u,!0}let i=e.src[u];if(r>=55296&&r<=56319&&u+1<n){const s=e.src.charCodeAt(u+1);s>=56320&&s<=57343&&(i+=e.src[u+1],u++)}const o="\\"+i;if(!t){const s=e.push("text_special","",0);r<256&&ou[r]!==0?s.content=i:s.content=o,s.markup=o,s.info="escape"}return e.pos=u+1,!0}function ms(e,t){let u=e.pos;if(e.src.charCodeAt(u)!==96)return!1;const r=u;u++;const i=e.posMax;for(;u<i&&e.src.charCodeAt(u)===96;)u++;const o=e.src.slice(r,u),s=o.length;if(e.backticksScanned&&(e.backticks[s]||0)<=r)return t||(e.pending+=o),e.pos+=s,!0;let a=u,c;for(;(c=e.src.indexOf("`",a))!==-1;){for(a=c+1;a<i&&e.src.charCodeAt(a)===96;)a++;const d=a-c;if(d===s){if(!t){const f=e.push("code_inline","code",0);f.markup=o,f.content=e.src.slice(u,c).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=a,!0}e.backticks[d]=c}return e.backticksScanned=!0,t||(e.pending+=o),e.pos+=s,!0}function As(e,t){const u=e.pos,n=e.src.charCodeAt(u);if(t||n!==126)return!1;const r=e.scanDelims(e.pos,!0);let i=r.length;const o=String.fromCharCode(n);if(i<2)return!1;let s;i%2&&(s=e.push("text","",0),s.content=o,i--);for(let a=0;a<i;a+=2)s=e.push("text","",0),s.content=o+o,e.delimiters.push({marker:n,length:0,token:e.tokens.length-1,end:-1,open:r.can_open,close:r.can_close});return e.pos+=r.length,!0}function Dn(e,t){let u;const n=[],r=t.length;for(let i=0;i<r;i++){const o=t[i];if(o.marker!==126||o.end===-1)continue;const s=t[o.end];u=e.tokens[o.token],u.type="s_open",u.tag="s",u.nesting=1,u.markup="~~",u.content="",u=e.tokens[s.token],u.type="s_close",u.tag="s",u.nesting=-1,u.markup="~~",u.content="",e.tokens[s.token-1].type==="text"&&e.tokens[s.token-1].content==="~"&&n.push(s.token-1)}for(;n.length;){const i=n.pop();let o=i+1;for(;o<e.tokens.length&&e.tokens[o].type==="s_close";)o++;o--,i!==o&&(u=e.tokens[o],e.tokens[o]=e.tokens[i],e.tokens[i]=u)}}function xs(e){const t=e.tokens_meta,u=e.tokens_meta.length;Dn(e,e.delimiters);for(let n=0;n<u;n++)t[n]&&t[n].delimiters&&Dn(e,t[n].delimiters)}const Sn={tokenize:As,postProcess:xs};function _s(e,t){const u=e.pos,n=e.src.charCodeAt(u);if(t||n!==95&&n!==42)return!1;const r=e.scanDelims(e.pos,n===42);for(let i=0;i<r.length;i++){const o=e.push("text","",0);o.content=String.fromCharCode(n),e.delimiters.push({marker:n,length:r.length,token:e.tokens.length-1,end:-1,open:r.can_open,close:r.can_close})}return e.pos+=r.length,!0}function Tn(e,t){const u=t.length;for(let n=u-1;n>=0;n--){const r=t[n];if(r.marker!==95&&r.marker!==42||r.end===-1)continue;const i=t[r.end],o=n>0&&t[n-1].end===r.end+1&&t[n-1].marker===r.marker&&t[n-1].token===r.token-1&&t[r.end+1].token===i.token+1,s=String.fromCharCode(r.marker),a=e.tokens[r.token];a.type=o?"strong_open":"em_open",a.tag=o?"strong":"em",a.nesting=1,a.markup=o?s+s:s,a.content="";const c=e.tokens[i.token];c.type=o?"strong_close":"em_close",c.tag=o?"strong":"em",c.nesting=-1,c.markup=o?s+s:s,c.content="",o&&(e.tokens[t[n-1].token].content="",e.tokens[t[r.end+1].token].content="",n--)}}function Cs(e){const t=e.tokens_meta,u=e.tokens_meta.length;Tn(e,e.delimiters);for(let n=0;n<u;n++)t[n]&&t[n].delimiters&&Tn(e,t[n].delimiters)}const Fn={tokenize:_s,postProcess:Cs};function ys(e,t){let u,n,r,i,o="",s="",a=e.pos,c=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;const d=e.pos,f=e.posMax,g=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let h=p+1;if(h<f&&e.src.charCodeAt(h)===40){for(c=!1,h++;h<f&&(u=e.src.charCodeAt(h),!(!F(u)&&u!==10));h++);if(h>=f)return!1;if(a=h,r=e.md.helpers.parseLinkDestination(e.src,h,e.posMax),r.ok){for(o=e.md.normalizeLink(r.str),e.md.validateLink(o)?h=r.pos:o="",a=h;h<f&&(u=e.src.charCodeAt(h),!(!F(u)&&u!==10));h++);if(r=e.md.helpers.parseLinkTitle(e.src,h,e.posMax),h<f&&a!==h&&r.ok)for(s=r.str,h=r.pos;h<f&&(u=e.src.charCodeAt(h),!(!F(u)&&u!==10));h++);}(h>=f||e.src.charCodeAt(h)!==41)&&(c=!0),h++}if(c){if(typeof e.env.references>"u")return!1;if(h<f&&e.src.charCodeAt(h)===91?(a=h+1,h=e.md.helpers.parseLinkLabel(e,h),h>=0?n=e.src.slice(a,h++):h=p+1):h=p+1,n||(n=e.src.slice(g,p)),i=e.env.references[Ct(n)],!i)return e.pos=d,!1;o=i.href,s=i.title}if(!t){e.pos=g,e.posMax=p;const v=e.push("link_open","a",1),w=[["href",o]];v.attrs=w,s&&w.push(["title",s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=h,e.posMax=f,!0}function Es(e,t){let u,n,r,i,o,s,a,c,d="";const f=e.pos,g=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const p=e.pos+2,h=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(h<0)return!1;if(i=h+1,i<g&&e.src.charCodeAt(i)===40){for(i++;i<g&&(u=e.src.charCodeAt(i),!(!F(u)&&u!==10));i++);if(i>=g)return!1;for(c=i,s=e.md.helpers.parseLinkDestination(e.src,i,e.posMax),s.ok&&(d=e.md.normalizeLink(s.str),e.md.validateLink(d)?i=s.pos:d=""),c=i;i<g&&(u=e.src.charCodeAt(i),!(!F(u)&&u!==10));i++);if(s=e.md.helpers.parseLinkTitle(e.src,i,e.posMax),i<g&&c!==i&&s.ok)for(a=s.str,i=s.pos;i<g&&(u=e.src.charCodeAt(i),!(!F(u)&&u!==10));i++);else a="";if(i>=g||e.src.charCodeAt(i)!==41)return e.pos=f,!1;i++}else{if(typeof e.env.references>"u")return!1;if(i<g&&e.src.charCodeAt(i)===91?(c=i+1,i=e.md.helpers.parseLinkLabel(e,i),i>=0?r=e.src.slice(c,i++):i=h+1):i=h+1,r||(r=e.src.slice(p,h)),o=e.env.references[Ct(r)],!o)return e.pos=f,!1;d=o.href,a=o.title}if(!t){n=e.src.slice(p,h);const v=[];e.md.inline.parse(n,e.md,e.env,v);const w=e.push("image","img",0),S=[["src",d],["alt",""]];w.attrs=S,w.children=v,w.content=n,a&&S.push(["title",a])}return e.pos=i,e.posMax=g,!0}const vs=/^([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])?)*)$/,ks=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function ws(e,t){let u=e.pos;if(e.src.charCodeAt(u)!==60)return!1;const n=e.pos,r=e.posMax;for(;;){if(++u>=r)return!1;const o=e.src.charCodeAt(u);if(o===60)return!1;if(o===62)break}const i=e.src.slice(n+1,u);if(ks.test(i)){const o=e.md.normalizeLink(i);if(!e.md.validateLink(o))return!1;if(!t){const s=e.push("link_open","a",1);s.attrs=[["href",o]],s.markup="autolink",s.info="auto";const a=e.push("text","",0);a.content=e.md.normalizeLinkText(i);const c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=i.length+2,!0}if(vs.test(i)){const o=e.md.normalizeLink("mailto:"+i);if(!e.md.validateLink(o))return!1;if(!t){const s=e.push("link_open","a",1);s.attrs=[["href",o]],s.markup="autolink",s.info="auto";const a=e.push("text","",0);a.content=e.md.normalizeLinkText(i);const c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=i.length+2,!0}return!1}function Ds(e){return/^<a[>\s]/i.test(e)}function Ss(e){return/^<\/a\s*>/i.test(e)}function Ts(e){const t=e|32;return t>=97&&t<=122}function Fs(e,t){if(!e.md.options.html)return!1;const u=e.posMax,n=e.pos;if(e.src.charCodeAt(n)!==60||n+2>=u)return!1;const r=e.src.charCodeAt(n+1);if(r!==33&&r!==63&&r!==47&&!Ts(r))return!1;const i=e.src.slice(n).match(is);if(!i)return!1;if(!t){const o=e.push("html_inline","",0);o.content=i[0],Ds(o.content)&&e.linkLevel++,Ss(o.content)&&e.linkLevel--}return e.pos+=i[0].length,!0}const Is=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Rs=/^&([a-z][a-z0-9]{1,31});/i;function Ms(e,t){const u=e.pos,n=e.posMax;if(e.src.charCodeAt(u)!==38||u+1>=n)return!1;if(e.src.charCodeAt(u+1)===35){const i=e.src.slice(u).match(Is);if(i){if(!t){const o=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),s=e.push("text_special","",0);s.content=uu(o)?_t(o):_t(65533),s.markup=i[0],s.info="entity"}return e.pos+=i[0].length,!0}}else{const i=e.src.slice(u).match(Rs);if(i){const o=bn(i[0]);if(o!==i[0]){if(!t){const s=e.push("text_special","",0);s.content=o,s.markup=i[0],s.info="entity"}return e.pos+=i[0].length,!0}}}return!1}function In(e){const t={},u=e.length;if(!u)return;let n=0,r=-2;const i=[];for(let o=0;o<u;o++){const s=e[o];if(i.push(0),(e[n].marker!==s.marker||r!==s.token-1)&&(n=o),r=s.token,s.length=s.length||0,!s.close)continue;t.hasOwnProperty(s.marker)||(t[s.marker]=[-1,-1,-1,-1,-1,-1]);const a=t[s.marker][(s.open?3:0)+s.length%3];let c=n-i[n]-1,d=c;for(;c>a;c-=i[c]+1){const f=e[c];if(f.marker===s.marker&&f.open&&f.end<0){let g=!1;if((f.close||s.open)&&(f.length+s.length)%3===0&&(f.length%3!==0||s.length%3!==0)&&(g=!0),!g){const p=c>0&&!e[c-1].open?i[c-1]+1:0;i[o]=o-c+p,i[c]=p,s.open=!1,f.end=o,f.close=!1,d=-1,r=-2;break}}}d!==-1&&(t[s.marker][(s.open?3:0)+(s.length||0)%3]=d)}}function Ls(e){const t=e.tokens_meta,u=e.tokens_meta.length;In(e.delimiters);for(let n=0;n<u;n++)t[n]&&t[n].delimiters&&In(t[n].delimiters)}function Us(e){let t,u,n=0;const r=e.tokens,i=e.tokens.length;for(t=u=0;t<i;t++)r[t].nesting<0&&n--,r[t].level=n,r[t].nesting>0&&n++,r[t].type==="text"&&t+1<i&&r[t+1].type==="text"?r[t+1].content=r[t].content+r[t+1].content:(t!==u&&(r[u]=r[t]),u++);t!==u&&(r.length=u)}const su=[["text",fs],["linkify",ps],["newline",bs],["escape",gs],["backticks",ms],["strikethrough",Sn.tokenize],["emphasis",Fn.tokenize],["link",ys],["image",Es],["autolink",ws],["html_inline",Fs],["entity",Ms]],au=[["balance_pairs",Ls],["strikethrough",Sn.postProcess],["emphasis",Fn.postProcess],["fragments_join",Us]];function nt(){this.ruler=new G;for(let e=0;e<su.length;e++)this.ruler.push(su[e][0],su[e][1]);this.ruler2=new G;for(let e=0;e<au.length;e++)this.ruler2.push(au[e][0],au[e][1])}nt.prototype.skipToken=function(e){const t=e.pos,u=this.ruler.getRules(""),n=u.length,r=e.md.options.maxNesting,i=e.cache;if(typeof i[t]<"u"){e.pos=i[t];return}let o=!1;if(e.level<r){for(let s=0;s<n;s++)if(e.level++,o=u[s](e,!0),e.level--,o){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;o||e.pos++,i[t]=e.pos},nt.prototype.tokenize=function(e){const t=this.ruler.getRules(""),u=t.length,n=e.posMax,r=e.md.options.maxNesting;for(;e.pos<n;){const i=e.pos;let o=!1;if(e.level<r){for(let s=0;s<u;s++)if(o=t[s](e,!1),o){if(i>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(o){if(e.pos>=n)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},nt.prototype.parse=function(e,t,u,n){const r=new this.State(e,t,u,n);this.tokenize(r);const i=this.ruler2.getRules(""),o=i.length;for(let s=0;s<o;s++)i[s](r)},nt.prototype.State=ut;function Bs(e){const t={};e=e||{},t.src_Any=ln.source,t.src_Cc=dn.source,t.src_Z=hn.source,t.src_P=Kt.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");const u="[><|]";return t.src_pseudo_letter="(?:(?!"+u+"|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|"+u+"|"+t.src_ZPCc+")(?!"+(e["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|"+u+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+t.src_ZCc+"|[.]|$)|"+(e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+t.src_ZCc+"|$)|;(?!"+t.src_ZCc+"|$)|\\!+(?!"+t.src_ZCc+"|[!]|$)|\\?(?!"+t.src_ZCc+"|[?]|$))+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|"+u+'|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}function cu(e){return Array.prototype.slice.call(arguments,1).forEach(function(u){u&&Object.keys(u).forEach(function(n){e[n]=u[n]})}),e}function kt(e){return Object.prototype.toString.call(e)}function Ns(e){return kt(e)==="[object String]"}function Os(e){return kt(e)==="[object Object]"}function Ps(e){return kt(e)==="[object RegExp]"}function Rn(e){return kt(e)==="[object Function]"}function $s(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const Mn={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function zs(e){return Object.keys(e||{}).reduce(function(t,u){return t||Mn.hasOwnProperty(u)},!1)}const Hs={"http:":{validate:function(e,t,u){const n=e.slice(t);return u.re.http||(u.re.http=new RegExp("^\\/\\/"+u.re.src_auth+u.re.src_host_port_strict+u.re.src_path,"i")),u.re.http.test(n)?n.match(u.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,u){const n=e.slice(t);return u.re.no_http||(u.re.no_http=new RegExp("^"+u.re.src_auth+"(?:localhost|(?:(?:"+u.re.src_domain+")\\.)+"+u.re.src_domain_root+")"+u.re.src_port+u.re.src_host_terminator+u.re.src_path,"i")),u.re.no_http.test(n)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:n.match(u.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,u){const n=e.slice(t);return u.re.mailto||(u.re.mailto=new RegExp("^"+u.re.src_email_name+"@"+u.re.src_host_strict,"i")),u.re.mailto.test(n)?n.match(u.re.mailto)[0].length:0}}},qs="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",js="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function Ys(e){e.__index__=-1,e.__text_cache__=""}function Qs(e){return function(t,u){const n=t.slice(u);return e.test(n)?n.match(e)[0].length:0}}function Ln(){return function(e,t){t.normalize(e)}}function wt(e){const t=e.re=Bs(e.__opts__),u=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||u.push(qs),u.push(t.src_xn),t.src_tlds=u.join("|");function n(s){return s.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(n(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(n(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(n(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(n(t.tpl_host_fuzzy_test),"i");const r=[];e.__compiled__={};function i(s,a){throw new Error('(LinkifyIt) Invalid schema "'+s+'": '+a)}Object.keys(e.__schemas__).forEach(function(s){const a=e.__schemas__[s];if(a===null)return;const c={validate:null,link:null};if(e.__compiled__[s]=c,Os(a)){Ps(a.validate)?c.validate=Qs(a.validate):Rn(a.validate)?c.validate=a.validate:i(s,a),Rn(a.normalize)?c.normalize=a.normalize:a.normalize?i(s,a):c.normalize=Ln();return}if(Ns(a)){r.push(s);return}i(s,a)}),r.forEach(function(s){e.__compiled__[e.__schemas__[s]]&&(e.__compiled__[s].validate=e.__compiled__[e.__schemas__[s]].validate,e.__compiled__[s].normalize=e.__compiled__[e.__schemas__[s]].normalize)}),e.__compiled__[""]={validate:null,normalize:Ln()};const o=Object.keys(e.__compiled__).filter(function(s){return s.length>0&&e.__compiled__[s]}).map($s).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),Ys(e)}function Gs(e,t){const u=e.__index__,n=e.__last_index__,r=e.__text_cache__.slice(u,n);this.schema=e.__schema__.toLowerCase(),this.index=u+t,this.lastIndex=n+t,this.raw=r,this.text=r,this.url=r}function lu(e,t){const u=new Gs(e,t);return e.__compiled__[u.schema].normalize(u,e),u}function W(e,t){if(!(this instanceof W))return new W(e,t);t||zs(e)&&(t=e,e={}),this.__opts__=cu({},Mn,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=cu({},Hs,e),this.__compiled__={},this.__tlds__=js,this.__tlds_replaced__=!1,this.re={},wt(this)}W.prototype.add=function(t,u){return this.__schemas__[t]=u,wt(this),this},W.prototype.set=function(t){return this.__opts__=cu(this.__opts__,t),this},W.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;let u,n,r,i,o,s,a,c,d;if(this.re.schema_test.test(t)){for(a=this.re.schema_search,a.lastIndex=0;(u=a.exec(t))!==null;)if(i=this.testSchemaAt(t,u[2],a.lastIndex),i){this.__schema__=u[2],this.__index__=u.index+u[1].length,this.__last_index__=u.index+u[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(c=t.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=t.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(o=n.index+n[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(d=t.indexOf("@"),d>=0&&(r=t.match(this.re.email_fuzzy))!==null&&(o=r.index+r[1].length,s=r.index+r[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&s>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=s))),this.__index__>=0},W.prototype.pretest=function(t){return this.re.pretest.test(t)},W.prototype.testSchemaAt=function(t,u,n){return this.__compiled__[u.toLowerCase()]?this.__compiled__[u.toLowerCase()].validate(t,n,this):0},W.prototype.match=function(t){const u=[];let n=0;this.__index__>=0&&this.__text_cache__===t&&(u.push(lu(this,n)),n=this.__last_index__);let r=n?t.slice(n):t;for(;this.test(r);)u.push(lu(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return u.length?u:null},W.prototype.matchAtStart=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return null;const u=this.re.schema_at_start.exec(t);if(!u)return null;const n=this.testSchemaAt(t,u[2],u[0].length);return n?(this.__schema__=u[2],this.__index__=u.index+u[1].length,this.__last_index__=u.index+u[0].length+n,lu(this,0)):null},W.prototype.tlds=function(t,u){return t=Array.isArray(t)?t:[t],u?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(n,r,i){return n!==i[r-1]}).reverse(),wt(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,wt(this),this)},W.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)},W.prototype.onCompile=function(){};const Me=2147483647,re=36,du=1,rt=26,Vs=38,Ws=700,Un=72,Bn=128,Nn="-",Zs=/^xn--/,Xs=/[^\0-\x7F]/,Ks=/[\x2E\u3002\uFF0E\uFF61]/g,Js={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},fu=re-du,ie=Math.floor,hu=String.fromCharCode;function Ae(e){throw new RangeError(Js[e])}function ea(e,t){const u=[];let n=e.length;for(;n--;)u[n]=t(e[n]);return u}function On(e,t){const u=e.split("@");let n="";u.length>1&&(n=u[0]+"@",e=u[1]),e=e.replace(Ks,".");const r=e.split("."),i=ea(r,t).join(".");return n+i}function Pn(e){const t=[];let u=0;const n=e.length;for(;u<n;){const r=e.charCodeAt(u++);if(r>=55296&&r<=56319&&u<n){const i=e.charCodeAt(u++);(i&64512)==56320?t.push(((r&1023)<<10)+(i&1023)+65536):(t.push(r),u--)}else t.push(r)}return t}const ta=e=>String.fromCodePoint(...e),ua=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:re},$n=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},zn=function(e,t,u){let n=0;for(e=u?ie(e/Ws):e>>1,e+=ie(e/t);e>fu*rt>>1;n+=re)e=ie(e/fu);return ie(n+(fu+1)*e/(e+Vs))},Hn=function(e){const t=[],u=e.length;let n=0,r=Bn,i=Un,o=e.lastIndexOf(Nn);o<0&&(o=0);for(let s=0;s<o;++s)e.charCodeAt(s)>=128&&Ae("not-basic"),t.push(e.charCodeAt(s));for(let s=o>0?o+1:0;s<u;){const a=n;for(let d=1,f=re;;f+=re){s>=u&&Ae("invalid-input");const g=ua(e.charCodeAt(s++));g>=re&&Ae("invalid-input"),g>ie((Me-n)/d)&&Ae("overflow"),n+=g*d;const p=f<=i?du:f>=i+rt?rt:f-i;if(g<p)break;const h=re-p;d>ie(Me/h)&&Ae("overflow"),d*=h}const c=t.length+1;i=zn(n-a,c,a==0),ie(n/c)>Me-r&&Ae("overflow"),r+=ie(n/c),n%=c,t.splice(n++,0,r)}return String.fromCodePoint(...t)},qn=function(e){const t=[];e=Pn(e);const u=e.length;let n=Bn,r=0,i=Un;for(const a of e)a<128&&t.push(hu(a));const o=t.length;let s=o;for(o&&t.push(Nn);s<u;){let a=Me;for(const d of e)d>=n&&d<a&&(a=d);const c=s+1;a-n>ie((Me-r)/c)&&Ae("overflow"),r+=(a-n)*c,n=a;for(const d of e)if(d<n&&++r>Me&&Ae("overflow"),d===n){let f=r;for(let g=re;;g+=re){const p=g<=i?du:g>=i+rt?rt:g-i;if(f<p)break;const h=f-p,v=re-p;t.push(hu($n(p+h%v,0))),f=ie(h/v)}t.push(hu($n(f,0))),i=zn(r,c,s===o),r=0,++s}++r,++n}return t.join("")},jn={version:"2.3.1",ucs2:{decode:Pn,encode:ta},decode:Hn,encode:qn,toASCII:function(e){return On(e,function(t){return Xs.test(t)?"xn--"+qn(t):t})},toUnicode:function(e){return On(e,function(t){return Zs.test(t)?Hn(t.slice(4).toLowerCase()):t})}},na={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},ra=/^(vbscript|javascript|file|data):/,ia=/^data:image\/(gif|png|jpeg|webp);/;function oa(e){const t=e.trim().toLowerCase();return ra.test(t)?ia.test(t):!0}const Yn=["http:","https:","mailto:"];function sa(e){const t=Xt(e,!0);if(t.hostname&&(!t.protocol||Yn.indexOf(t.protocol)>=0))try{t.hostname=jn.toASCII(t.hostname)}catch{}return Ke(Zt(t))}function aa(e){const t=Xt(e,!0);if(t.hostname&&(!t.protocol||Yn.indexOf(t.protocol)>=0))try{t.hostname=jn.toUnicode(t.hostname)}catch{}return Te(Zt(t),Te.defaultChars+"%")}function K(e,t){if(!(this instanceof K))return new K(e,t);t||tu(e)||(t=e||{},e="default"),this.inline=new nt,this.block=new vt,this.core=new ru,this.renderer=new Ie,this.linkify=new W,this.validateLink=oa,this.normalizeLink=sa,this.normalizeLinkText=aa,this.utils=xo,this.helpers=xt({},Eo),this.options={},this.configure(e),t&&this.set(t)}K.prototype.set=function(e){return xt(this.options,e),this},K.prototype.configure=function(e){const t=this;if(tu(e)){const u=e;if(e=na[u],!e)throw new Error('Wrong `markdown-it` preset "'+u+'", check name')}if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(u){e.components[u].rules&&t[u].ruler.enableOnly(e.components[u].rules),e.components[u].rules2&&t[u].ruler2.enableOnly(e.components[u].rules2)}),this},K.prototype.enable=function(e,t){let u=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(r){u=u.concat(this[r].ruler.enable(e,!0))},this),u=u.concat(this.inline.ruler2.enable(e,!0));const n=e.filter(function(r){return u.indexOf(r)<0});if(n.length&&!t)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this},K.prototype.disable=function(e,t){let u=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(r){u=u.concat(this[r].ruler.disable(e,!0))},this),u=u.concat(this.inline.ruler2.disable(e,!0));const n=e.filter(function(r){return u.indexOf(r)<0});if(n.length&&!t)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this},K.prototype.use=function(e){const t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},K.prototype.parse=function(e,t){if(typeof e!="string")throw new Error("Input data should be a String");const u=new this.core.State(e,this,t);return this.core.process(u),u.tokens},K.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)},K.prototype.parseInline=function(e,t){const u=new this.core.State(e,this,t);return u.inlineMode=!0,this.core.process(u),u.tokens},K.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};function ca(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pu=!0,Qn=!1,Gn=!1,la=function(e,t){t&&(pu=!t.enabled,Qn=!!t.label,Gn=!!t.labelAfter),e.core.ruler.after("inline","github-task-lists",function(u){for(var n=u.tokens,r=2;r<n.length;r++)fa(n,r)&&(ha(n[r],u.Token),Vn(n[r-2],"class","task-list-item"+(pu?"":" enabled")),Vn(n[da(n,r-2)],"class","contains-task-list"))})};function Vn(e,t,u){var n=e.attrIndex(t),r=[t,u];n<0?e.attrPush(r):e.attrs[n]=r}function da(e,t){for(var u=e[t].level-1,n=t-1;n>=0;n--)if(e[n].level===u)return n;return-1}function fa(e,t){return Aa(e[t])&&xa(e[t-1])&&_a(e[t-2])&&Ca(e[t])}function ha(e,t){if(e.children.unshift(pa(e,t)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),Qn)if(Gn){e.children.pop();var u="task-item-"+Math.ceil(Math.random()*(1e4*1e3)-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+' id="'+u+'">',e.children.push(ma(e.content,u,t))}else e.children.unshift(ba(t)),e.children.push(ga(t))}function pa(e,t){var u=new t("html_inline","",0),n=pu?' disabled="" ':"";return e.content.indexOf("[ ] ")===0?u.content='<input class="task-list-item-checkbox"'+n+'type="checkbox">':(e.content.indexOf("[x] ")===0||e.content.indexOf("[X] ")===0)&&(u.content='<input class="task-list-item-checkbox" checked=""'+n+'type="checkbox">'),u}function ba(e){var t=new e("html_inline","",0);return t.content="<label>",t}function ga(e){var t=new e("html_inline","",0);return t.content="</label>",t}function ma(e,t,u){var n=new u("html_inline","",0);return n.content='<label class="task-list-item-label" for="'+t+'">'+e+"</label>",n.attrs=[{for:t}],n}function Aa(e){return e.type==="inline"}function xa(e){return e.type==="paragraph_open"}function _a(e){return e.type==="list_item_open"}function Ca(e){return e.content.indexOf("[ ] ")===0||e.content.indexOf("[x] ")===0||e.content.indexOf("[X] ")===0}const ya=ca(la);/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:Wn,setPrototypeOf:Zn,isFrozen:Ea,getPrototypeOf:va,getOwnPropertyDescriptor:ka}=Object;let{freeze:j,seal:J,create:bu}=Object,{apply:gu,construct:mu}=typeof Reflect<"u"&&Reflect;j||(j=function(t){return t}),J||(J=function(t){return t}),gu||(gu=function(t,u){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return t.apply(u,r)}),mu||(mu=function(t){for(var u=arguments.length,n=new Array(u>1?u-1:0),r=1;r<u;r++)n[r-1]=arguments[r];return new t(...n)});const Dt=Q(Array.prototype.forEach),wa=Q(Array.prototype.lastIndexOf),Xn=Q(Array.prototype.pop),it=Q(Array.prototype.push),Da=Q(Array.prototype.splice),St=Q(String.prototype.toLowerCase),Au=Q(String.prototype.toString),xu=Q(String.prototype.match),ot=Q(String.prototype.replace),Sa=Q(String.prototype.indexOf),Ta=Q(String.prototype.trim),te=Q(Object.prototype.hasOwnProperty),Y=Q(RegExp.prototype.test),st=Fa(TypeError);function Q(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var u=arguments.length,n=new Array(u>1?u-1:0),r=1;r<u;r++)n[r-1]=arguments[r];return gu(e,t,n)}}function Fa(e){return function(){for(var t=arguments.length,u=new Array(t),n=0;n<t;n++)u[n]=arguments[n];return mu(e,u)}}function k(e,t){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:St;Zn&&Zn(e,null);let n=t.length;for(;n--;){let r=t[n];if(typeof r=="string"){const i=u(r);i!==r&&(Ea(t)||(t[n]=i),r=i)}e[r]=!0}return e}function Ia(e){for(let t=0;t<e.length;t++)te(e,t)||(e[t]=null);return e}function ce(e){const t=bu(null);for(const[u,n]of Wn(e))te(e,u)&&(Array.isArray(n)?t[u]=Ia(n):n&&typeof n=="object"&&n.constructor===Object?t[u]=ce(n):t[u]=n);return t}function at(e,t){for(;e!==null;){const n=ka(e,t);if(n){if(n.get)return Q(n.get);if(typeof n.value=="function")return Q(n.value)}e=va(e)}function u(){return null}return u}const Kn=j(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),_u=j(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Cu=j(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ra=j(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),yu=j(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ma=j(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Jn=j(["#text"]),er=j(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Eu=j(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),tr=j(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Tt=j(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),La=J(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ua=J(/<%[\w\W]*|[\w\W]*%>/gm),Ba=J(/\$\{[\w\W]*/gm),Na=J(/^data-[\-\w.\u00B7-\uFFFF]+$/),Oa=J(/^aria-[\-\w]+$/),ur=J(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pa=J(/^(?:\w+script|data):/i),$a=J(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nr=J(/^html$/i),za=J(/^[a-z][.\w]*(-[.\w]+)+$/i);var rr=Object.freeze({__proto__:null,ARIA_ATTR:Oa,ATTR_WHITESPACE:$a,CUSTOM_ELEMENT:za,DATA_ATTR:Na,DOCTYPE_NAME:nr,ERB_EXPR:Ua,IS_ALLOWED_URI:ur,IS_SCRIPT_OR_DATA:Pa,MUSTACHE_EXPR:La,TMPLIT_EXPR:Ba});const ct={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ha=function(){return typeof window>"u"?null:window},qa=function(t,u){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const r="data-tt-policy-suffix";u&&u.hasAttribute(r)&&(n=u.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},ir=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function or(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ha();const t=x=>or(x);if(t.version="3.3.0",t.removed=[],!e||!e.document||e.document.nodeType!==ct.document||!e.Element)return t.isSupported=!1,t;let{document:u}=e;const n=u,r=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:s,Element:a,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:g,trustedTypes:p}=e,h=a.prototype,v=at(h,"cloneNode"),w=at(h,"remove"),S=at(h,"nextSibling"),y=at(h,"childNodes"),C=at(h,"parentNode");if(typeof o=="function"){const x=u.createElement("template");x.content&&x.content.ownerDocument&&(u=x.content.ownerDocument)}let m,E="";const{implementation:D,createNodeIterator:U,createDocumentFragment:Z,getElementsByTagName:oe}=u,{importNode:ve}=n;let B=ir();t.isSupported=typeof Wn=="function"&&typeof C=="function"&&D&&D.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:lt,ERB_EXPR:dt,TMPLIT_EXPR:Le,DATA_ATTR:xe,ARIA_ATTR:ku,IS_SCRIPT_OR_DATA:Ga,ATTR_WHITESPACE:cr,CUSTOM_ELEMENT:Va}=rr;let{IS_ALLOWED_URI:lr}=rr,P=null;const dr=k({},[...Kn,..._u,...Cu,...yu,...Jn]);let z=null;const fr=k({},[...er,...Eu,...tr,...Tt]);let R=Object.seal(bu(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ft=null,wu=null;const Ue=Object.seal(bu(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let hr=!0,Du=!0,pr=!1,br=!0,Be=!1,It=!0,ke=!1,Su=!1,Tu=!1,Ne=!1,Rt=!1,Mt=!1,gr=!0,mr=!1;const Wa="user-content-";let Fu=!0,ht=!1,Oe={},Pe=null;const Ar=k({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let xr=null;const _r=k({},["audio","video","img","source","image","track"]);let Iu=null;const Cr=k({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Lt="http://www.w3.org/1998/Math/MathML",Ut="http://www.w3.org/2000/svg",le="http://www.w3.org/1999/xhtml";let $e=le,Ru=!1,Mu=null;const Za=k({},[Lt,Ut,le],Au);let Bt=k({},["mi","mo","mn","ms","mtext"]),Nt=k({},["annotation-xml"]);const Xa=k({},["title","style","font","a","script"]);let pt=null;const Ka=["application/xhtml+xml","text/html"],Ja="text/html";let $=null,ze=null;const e0=u.createElement("form"),yr=function(l){return l instanceof RegExp||l instanceof Function},Lu=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ze&&ze===l)){if((!l||typeof l!="object")&&(l={}),l=ce(l),pt=Ka.indexOf(l.PARSER_MEDIA_TYPE)===-1?Ja:l.PARSER_MEDIA_TYPE,$=pt==="application/xhtml+xml"?Au:St,P=te(l,"ALLOWED_TAGS")?k({},l.ALLOWED_TAGS,$):dr,z=te(l,"ALLOWED_ATTR")?k({},l.ALLOWED_ATTR,$):fr,Mu=te(l,"ALLOWED_NAMESPACES")?k({},l.ALLOWED_NAMESPACES,Au):Za,Iu=te(l,"ADD_URI_SAFE_ATTR")?k(ce(Cr),l.ADD_URI_SAFE_ATTR,$):Cr,xr=te(l,"ADD_DATA_URI_TAGS")?k(ce(_r),l.ADD_DATA_URI_TAGS,$):_r,Pe=te(l,"FORBID_CONTENTS")?k({},l.FORBID_CONTENTS,$):Ar,ft=te(l,"FORBID_TAGS")?k({},l.FORBID_TAGS,$):ce({}),wu=te(l,"FORBID_ATTR")?k({},l.FORBID_ATTR,$):ce({}),Oe=te(l,"USE_PROFILES")?l.USE_PROFILES:!1,hr=l.ALLOW_ARIA_ATTR!==!1,Du=l.ALLOW_DATA_ATTR!==!1,pr=l.ALLOW_UNKNOWN_PROTOCOLS||!1,br=l.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Be=l.SAFE_FOR_TEMPLATES||!1,It=l.SAFE_FOR_XML!==!1,ke=l.WHOLE_DOCUMENT||!1,Ne=l.RETURN_DOM||!1,Rt=l.RETURN_DOM_FRAGMENT||!1,Mt=l.RETURN_TRUSTED_TYPE||!1,Tu=l.FORCE_BODY||!1,gr=l.SANITIZE_DOM!==!1,mr=l.SANITIZE_NAMED_PROPS||!1,Fu=l.KEEP_CONTENT!==!1,ht=l.IN_PLACE||!1,lr=l.ALLOWED_URI_REGEXP||ur,$e=l.NAMESPACE||le,Bt=l.MATHML_TEXT_INTEGRATION_POINTS||Bt,Nt=l.HTML_INTEGRATION_POINTS||Nt,R=l.CUSTOM_ELEMENT_HANDLING||{},l.CUSTOM_ELEMENT_HANDLING&&yr(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(R.tagNameCheck=l.CUSTOM_ELEMENT_HANDLING.tagNameCheck),l.CUSTOM_ELEMENT_HANDLING&&yr(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(R.attributeNameCheck=l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),l.CUSTOM_ELEMENT_HANDLING&&typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(R.allowCustomizedBuiltInElements=l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Be&&(Du=!1),Rt&&(Ne=!0),Oe&&(P=k({},Jn),z=[],Oe.html===!0&&(k(P,Kn),k(z,er)),Oe.svg===!0&&(k(P,_u),k(z,Eu),k(z,Tt)),Oe.svgFilters===!0&&(k(P,Cu),k(z,Eu),k(z,Tt)),Oe.mathMl===!0&&(k(P,yu),k(z,tr),k(z,Tt))),l.ADD_TAGS&&(typeof l.ADD_TAGS=="function"?Ue.tagCheck=l.ADD_TAGS:(P===dr&&(P=ce(P)),k(P,l.ADD_TAGS,$))),l.ADD_ATTR&&(typeof l.ADD_ATTR=="function"?Ue.attributeCheck=l.ADD_ATTR:(z===fr&&(z=ce(z)),k(z,l.ADD_ATTR,$))),l.ADD_URI_SAFE_ATTR&&k(Iu,l.ADD_URI_SAFE_ATTR,$),l.FORBID_CONTENTS&&(Pe===Ar&&(Pe=ce(Pe)),k(Pe,l.FORBID_CONTENTS,$)),Fu&&(P["#text"]=!0),ke&&k(P,["html","head","body"]),P.table&&(k(P,["tbody"]),delete ft.tbody),l.TRUSTED_TYPES_POLICY){if(typeof l.TRUSTED_TYPES_POLICY.createHTML!="function")throw st('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof l.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw st('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');m=l.TRUSTED_TYPES_POLICY,E=m.createHTML("")}else m===void 0&&(m=qa(p,r)),m!==null&&typeof E=="string"&&(E=m.createHTML(""));j&&j(l),ze=l}},Er=k({},[..._u,...Cu,...Ra]),vr=k({},[...yu,...Ma]),t0=function(l){let b=C(l);(!b||!b.tagName)&&(b={namespaceURI:$e,tagName:"template"});const A=St(l.tagName),I=St(b.tagName);return Mu[l.namespaceURI]?l.namespaceURI===Ut?b.namespaceURI===le?A==="svg":b.namespaceURI===Lt?A==="svg"&&(I==="annotation-xml"||Bt[I]):!!Er[A]:l.namespaceURI===Lt?b.namespaceURI===le?A==="math":b.namespaceURI===Ut?A==="math"&&Nt[I]:!!vr[A]:l.namespaceURI===le?b.namespaceURI===Ut&&!Nt[I]||b.namespaceURI===Lt&&!Bt[I]?!1:!vr[A]&&(Xa[A]||!Er[A]):!!(pt==="application/xhtml+xml"&&Mu[l.namespaceURI]):!1},se=function(l){it(t.removed,{element:l});try{C(l).removeChild(l)}catch{w(l)}},we=function(l,b){try{it(t.removed,{attribute:b.getAttributeNode(l),from:b})}catch{it(t.removed,{attribute:null,from:b})}if(b.removeAttribute(l),l==="is")if(Ne||Rt)try{se(b)}catch{}else try{b.setAttribute(l,"")}catch{}},kr=function(l){let b=null,A=null;if(Tu)l="<remove></remove>"+l;else{const L=xu(l,/^[\r\n\t ]+/);A=L&&L[0]}pt==="application/xhtml+xml"&&$e===le&&(l='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+l+"</body></html>");const I=m?m.createHTML(l):l;if($e===le)try{b=new g().parseFromString(I,pt)}catch{}if(!b||!b.documentElement){b=D.createDocument($e,"template",null);try{b.documentElement.innerHTML=Ru?E:I}catch{}}const q=b.body||b.documentElement;return l&&A&&q.insertBefore(u.createTextNode(A),q.childNodes[0]||null),$e===le?oe.call(b,ke?"html":"body")[0]:ke?b.documentElement:q},wr=function(l){return U.call(l.ownerDocument||l,l,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Uu=function(l){return l instanceof f&&(typeof l.nodeName!="string"||typeof l.textContent!="string"||typeof l.removeChild!="function"||!(l.attributes instanceof d)||typeof l.removeAttribute!="function"||typeof l.setAttribute!="function"||typeof l.namespaceURI!="string"||typeof l.insertBefore!="function"||typeof l.hasChildNodes!="function")},Dr=function(l){return typeof s=="function"&&l instanceof s};function de(x,l,b){Dt(x,A=>{A.call(t,l,b,ze)})}const Sr=function(l){let b=null;if(de(B.beforeSanitizeElements,l,null),Uu(l))return se(l),!0;const A=$(l.nodeName);if(de(B.uponSanitizeElement,l,{tagName:A,allowedTags:P}),It&&l.hasChildNodes()&&!Dr(l.firstElementChild)&&Y(/<[/\w!]/g,l.innerHTML)&&Y(/<[/\w!]/g,l.textContent)||l.nodeType===ct.progressingInstruction||It&&l.nodeType===ct.comment&&Y(/<[/\w]/g,l.data))return se(l),!0;if(!(Ue.tagCheck instanceof Function&&Ue.tagCheck(A))&&(!P[A]||ft[A])){if(!ft[A]&&Fr(A)&&(R.tagNameCheck instanceof RegExp&&Y(R.tagNameCheck,A)||R.tagNameCheck instanceof Function&&R.tagNameCheck(A)))return!1;if(Fu&&!Pe[A]){const I=C(l)||l.parentNode,q=y(l)||l.childNodes;if(q&&I){const L=q.length;for(let V=L-1;V>=0;--V){const fe=v(q[V],!0);fe.__removalCount=(l.__removalCount||0)+1,I.insertBefore(fe,S(l))}}}return se(l),!0}return l instanceof a&&!t0(l)||(A==="noscript"||A==="noembed"||A==="noframes")&&Y(/<\/no(script|embed|frames)/i,l.innerHTML)?(se(l),!0):(Be&&l.nodeType===ct.text&&(b=l.textContent,Dt([lt,dt,Le],I=>{b=ot(b,I," ")}),l.textContent!==b&&(it(t.removed,{element:l.cloneNode()}),l.textContent=b)),de(B.afterSanitizeElements,l,null),!1)},Tr=function(l,b,A){if(gr&&(b==="id"||b==="name")&&(A in u||A in e0))return!1;if(!(Du&&!wu[b]&&Y(xe,b))){if(!(hr&&Y(ku,b))){if(!(Ue.attributeCheck instanceof Function&&Ue.attributeCheck(b,l))){if(!z[b]||wu[b]){if(!(Fr(l)&&(R.tagNameCheck instanceof RegExp&&Y(R.tagNameCheck,l)||R.tagNameCheck instanceof Function&&R.tagNameCheck(l))&&(R.attributeNameCheck instanceof RegExp&&Y(R.attributeNameCheck,b)||R.attributeNameCheck instanceof Function&&R.attributeNameCheck(b,l))||b==="is"&&R.allowCustomizedBuiltInElements&&(R.tagNameCheck instanceof RegExp&&Y(R.tagNameCheck,A)||R.tagNameCheck instanceof Function&&R.tagNameCheck(A))))return!1}else if(!Iu[b]){if(!Y(lr,ot(A,cr,""))){if(!((b==="src"||b==="xlink:href"||b==="href")&&l!=="script"&&Sa(A,"data:")===0&&xr[l])){if(!(pr&&!Y(Ga,ot(A,cr,"")))){if(A)return!1}}}}}}}return!0},Fr=function(l){return l!=="annotation-xml"&&xu(l,Va)},Ir=function(l){de(B.beforeSanitizeAttributes,l,null);const{attributes:b}=l;if(!b||Uu(l))return;const A={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0};let I=b.length;for(;I--;){const q=b[I],{name:L,namespaceURI:V,value:fe}=q,He=$(L),Bu=fe;let H=L==="value"?Bu:Ta(Bu);if(A.attrName=He,A.attrValue=H,A.keepAttr=!0,A.forceKeepAttr=void 0,de(B.uponSanitizeAttribute,l,A),H=A.attrValue,mr&&(He==="id"||He==="name")&&(we(L,l),H=Wa+H),It&&Y(/((--!?|])>)|<\/(style|title|textarea)/i,H)){we(L,l);continue}if(He==="attributename"&&xu(H,"href")){we(L,l);continue}if(A.forceKeepAttr)continue;if(!A.keepAttr){we(L,l);continue}if(!br&&Y(/\/>/i,H)){we(L,l);continue}Be&&Dt([lt,dt,Le],Mr=>{H=ot(H,Mr," ")});const Rr=$(l.nodeName);if(!Tr(Rr,He,H)){we(L,l);continue}if(m&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!V)switch(p.getAttributeType(Rr,He)){case"TrustedHTML":{H=m.createHTML(H);break}case"TrustedScriptURL":{H=m.createScriptURL(H);break}}if(H!==Bu)try{V?l.setAttributeNS(V,L,H):l.setAttribute(L,H),Uu(l)?se(l):Xn(t.removed)}catch{we(L,l)}}de(B.afterSanitizeAttributes,l,null)},u0=function x(l){let b=null;const A=wr(l);for(de(B.beforeSanitizeShadowDOM,l,null);b=A.nextNode();)de(B.uponSanitizeShadowNode,b,null),Sr(b),Ir(b),b.content instanceof i&&x(b.content);de(B.afterSanitizeShadowDOM,l,null)};return t.sanitize=function(x){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=null,A=null,I=null,q=null;if(Ru=!x,Ru&&(x="<!-->"),typeof x!="string"&&!Dr(x))if(typeof x.toString=="function"){if(x=x.toString(),typeof x!="string")throw st("dirty is not a string, aborting")}else throw st("toString is not a function");if(!t.isSupported)return x;if(Su||Lu(l),t.removed=[],typeof x=="string"&&(ht=!1),ht){if(x.nodeName){const fe=$(x.nodeName);if(!P[fe]||ft[fe])throw st("root node is forbidden and cannot be sanitized in-place")}}else if(x instanceof s)b=kr("<!---->"),A=b.ownerDocument.importNode(x,!0),A.nodeType===ct.element&&A.nodeName==="BODY"||A.nodeName==="HTML"?b=A:b.appendChild(A);else{if(!Ne&&!Be&&!ke&&x.indexOf("<")===-1)return m&&Mt?m.createHTML(x):x;if(b=kr(x),!b)return Ne?null:Mt?E:""}b&&Tu&&se(b.firstChild);const L=wr(ht?x:b);for(;I=L.nextNode();)Sr(I),Ir(I),I.content instanceof i&&u0(I.content);if(ht)return x;if(Ne){if(Rt)for(q=Z.call(b.ownerDocument);b.firstChild;)q.appendChild(b.firstChild);else q=b;return(z.shadowroot||z.shadowrootmode)&&(q=ve.call(n,q,!0)),q}let V=ke?b.outerHTML:b.innerHTML;return ke&&P["!doctype"]&&b.ownerDocument&&b.ownerDocument.doctype&&b.ownerDocument.doctype.name&&Y(nr,b.ownerDocument.doctype.name)&&(V="<!DOCTYPE "+b.ownerDocument.doctype.name+`>
|
|
1607
|
-
`+V),Be&&Dt([lt,dt,Le],fe=>{V=ot(V,fe," ")}),m&&Mt?m.createHTML(V):V},t.setConfig=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Lu(x),Su=!0},t.clearConfig=function(){ze=null,Su=!1},t.isValidAttribute=function(x,l,b){ze||Lu({});const A=$(x),I=$(l);return Tr(A,I,b)},t.addHook=function(x,l){typeof l=="function"&&it(B[x],l)},t.removeHook=function(x,l){if(l!==void 0){const b=wa(B[x],l);return b===-1?void 0:Da(B[x],b,1)[0]}return Xn(B[x])},t.removeHooks=function(x){B[x]=[]},t.removeAllHooks=function(){B=ir()},t}var ja=or();const Ft=class Ft extends Xe{constructor(){super(...arguments),this.open=!1,this.message="",this.titleText="Rio Insight",this.buttonLabel="Rio Insight",this.placeholder="Pergunte alguma coisa",this.accentColor="#008B9A",this.apiBaseUrl="",this.rioToken="",this.suggestionsSource="",this.randomizedSuggestions=[],this.messages=[],this.isLoading=!1,this.errorMessage="",this.showConversations=!1,this.conversationSearch="",this.conversationMenuId=null,this.conversationMenuPlacement="below",this.isFullscreen=!1,this.showNewConversationShortcut=!1,this.conversationScrollbar={height:0,top:0,visible:!1},this.conversationHistoryLoading=!1,this.conversationHistoryError="",this.deleteConversationTarget=null,this.renameConversationTarget=null,this.conversationActionError=null,this.loadingLabelInternal="Rio Insight está respondendo...",this.loadingTimerSlow=null,this.loadingTimerTimeout=null,this.refreshConversationsAfterResponse=!1,this.activeConversationTitle=null,this.headerActions=[],this.homeUrl="",this.pendingConversationAction=null,this.conversationScrollbarRaf=null,this.rioClient=null,this.rioUnsubscribe=null,this.loadingTimer=null,this.currentConversationId=null,this.conversationCounter=0,this.conversationUserId=null,this.conversationScrollbarDraggingId=null,this.conversationScrollbarDragState=null,this.markdownRenderer=new K({html:!1,linkify:!0,breaks:!0}).use(ya),this.conversations=[]}get loadingLabel(){return this.loadingLabelInternal}generateConversationId(){this.conversationUserId||(this.conversationUserId=this.inferUserIdFromToken());const u=`default-${this.conversationUserId??"user"}-${this.randomId(8)}`;return console.info("[RioAssist][conversation] gerando conversationId",u),u}inferUserIdFromToken(){const t=this.rioToken.trim();if(!t||!t.includes("."))return null;const[,u]=t.split(".");try{const n=JSON.parse(atob(u.replace(/-/g,"+").replace(/_/g,"/"))),r=(n==null?void 0:n.userId)??(n==null?void 0:n.user_id)??(n==null?void 0:n.sub)??(n==null?void 0:n.id)??(n==null?void 0:n.email)??(n==null?void 0:n.username);if(r&&typeof r=="string")return r.replace(/[^a-zA-Z0-9_-]/g,"")}catch{return null}return null}randomId(t){const u="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let n="";for(let r=0;r<t;r+=1)n+=u.charAt(Math.floor(Math.random()*u.length));return n}get suggestions(){return this.randomizedSuggestions}parseSuggestions(t){return t?t.split("|").map(u=>u.trim()).filter(Boolean):[]}pickRandomSuggestions(t,u){if(t.length<=u)return[...t];const n=[...t];for(let r=n.length-1;r>0;r-=1){const i=Math.floor(Math.random()*(r+1));[n[r],n[i]]=[n[i],n[r]]}return n.slice(0,u)}willUpdate(t){super.willUpdate(t),t.has("suggestionsSource")&&(this.randomizedSuggestions=this.pickRandomSuggestions(this.parseSuggestions(this.suggestionsSource),3))}updated(t){super.updated(t),this.style.setProperty("--accent-color",this.accentColor),(t.has("isFullscreen")||t.has("showConversations")||t.has("conversations"))&&this.enqueueConversationScrollbarMeasure(),(t.has("messages")||t.has("isLoading")&&this.isLoading||t.has("open")&&this.open||t.has("isFullscreen")&&this.isFullscreen)&&this.scrollConversationToBottom()}firstUpdated(){this.enqueueConversationScrollbarMeasure()}disconnectedCallback(){super.disconnectedCallback(),this.conversationScrollbarRaf!==null&&(cancelAnimationFrame(this.conversationScrollbarRaf),this.conversationScrollbarRaf=null),this.teardownRioClient(),this.clearLoadingGuard()}get filteredConversations(){const t=this.conversationSearch.trim().toLowerCase();return t?this.conversations.filter(u=>u.title.toLowerCase().includes(t)):this.conversations}get hasActiveConversation(){return this.messages.length>0}togglePanel(){if(this.isFullscreen){this.exitFullscreen(!1);return}this.open=!this.open,this.dispatchEvent(new CustomEvent(this.open?"rioassist:open":"rioassist:close",{bubbles:!0,composed:!0}))}closePanel(){this.isFullscreen=!1,this.open&&this.togglePanel()}openConversationsPanel(){this.showConversations=!0,this.requestConversationHistory()}closeConversationsPanel(){this.showConversations=!1,this.conversationMenuId=null}toggleConversationsPanel(){if(this.showConversations=!this.showConversations,!this.showConversations){this.conversationMenuId=null;return}this.requestConversationHistory()}toggleNewConversationShortcut(){this.showNewConversationShortcut=!this.showNewConversationShortcut}handleConversationSelect(t){t&&(this.showConversations=!1,this.conversationMenuId=null,this.errorMessage="",this.currentConversationId=t,this.activeConversationTitle=this.lookupConversationTitle(t),console.info("[RioAssist][history] carregando conversa",t),this.requestConversationHistory(t))}handleConversationSearch(t){this.conversationSearch=t.target.value}handleConversationMenuToggle(t,u){if(t.stopPropagation(),this.conversationMenuId===u){this.conversationMenuId=null;return}const n=t.currentTarget,r=this.renderRoot.querySelector(".conversations-panel__surface");if(n&&r){const i=n.getBoundingClientRect(),s=r.getBoundingClientRect().bottom-i.bottom;this.conversationMenuPlacement=s<140?"above":"below"}else this.conversationMenuPlacement="below";this.conversationMenuId=u}handleConversationsPanelPointer(t){const u=t.target;!u.closest(".conversation-menu")&&!u.closest(".conversation-menu-button")&&(this.conversationMenuId=null)}handleConversationAction(t,u){this.conversationMenuId=null;const n=this.conversations.findIndex(i=>i.id===u);if(n===-1)return;const r=this.conversations[n];if(t==="delete"){this.deleteConversationTarget={id:r.id,title:r.title,index:n};return}this.renameConversationTarget={id:r.id,title:r.title,index:n,draft:r.title}}handleHomeNavigation(){const t={url:this.homeUrl||null};this.dispatchEvent(new CustomEvent("rioassist:home",{detail:t,bubbles:!0,composed:!0,cancelable:!0}))&&this.homeUrl&&window.location.assign(this.homeUrl)}applyConversationRename(t,u){if(!t||!u)return;let n=!1;this.conversations=this.conversations.map(r=>r.id===t?(n=!0,{...r,title:u}):r),n&&this.currentConversationId===t&&(this.activeConversationTitle=u)}applyConversationDeletion(t){if(!t)return;const u=this.currentConversationId===t,n=this.conversations.filter(r=>r.id!==t);n.length!==this.conversations.length&&(this.conversations=n,u&&(this.currentConversationId=null,this.activeConversationTitle=null,this.messages=[]))}restoreConversationSnapshot(t,u){if(!t||this.conversations.some(o=>o.id===t.id))return;const r=[...this.conversations],i=u>=0&&u<=r.length?u:r.length;r.splice(i,0,t),this.conversations=r}async confirmDeleteConversation(){const t=this.deleteConversationTarget;if(!t)return;const u=this.conversations[t.index]??this.conversations.find(i=>i.id===t.id)??{id:t.id,title:t.title,updatedAt:new Date().toISOString()},n=this.currentConversationId===t.id;if(this.pendingConversationAction={action:"delete",conversationId:t.id,originalTitle:t.title,index:t.index,snapshot:u,messagesSnapshot:n?[...this.messages]:void 0,wasActive:n},await this.dispatchConversationAction("delete",{id:t.id,title:t.title},t.index)){this.deleteConversationTarget=null;return}this.pendingConversationAction=null}cancelDeleteConversation(){this.deleteConversationTarget=null}handleRenameDraft(t){this.renameConversationTarget&&(this.renameConversationTarget={...this.renameConversationTarget,draft:t.target.value})}async confirmRenameConversation(){const t=this.renameConversationTarget;if(!t)return;const u=t.draft.trim();if(!u)return;if(this.pendingConversationAction={action:"rename",conversationId:t.id,originalTitle:t.title,index:t.index,newTitle:u},await this.dispatchConversationAction("rename",{id:t.id,title:u},t.index,u)){this.renameConversationTarget=null;return}this.pendingConversationAction=null}cancelRenameConversation(){this.renameConversationTarget=null}cancelConversationActionError(){this.conversationActionError=null,this.pendingConversationAction=null}async retryConversationAction(){const t=this.conversationActionError;if(!t)return;const u=typeof t.index=="number"?t.index:this.conversations.findIndex(i=>i.id===t.conversationId),n=u>=0?u:this.conversations.length>0?this.conversations.length-1:0,r=t.snapshot??this.conversations.find(i=>i.id===t.conversationId)??{id:t.conversationId,title:t.originalTitle,updatedAt:new Date().toISOString()};this.pendingConversationAction={action:t.action,conversationId:t.conversationId,originalTitle:t.originalTitle,index:n,newTitle:t.newTitle,snapshot:r,messagesSnapshot:t.messagesSnapshot,wasActive:t.wasActive},this.conversationActionError=null,await this.dispatchConversationAction(t.action,{id:t.conversationId,title:t.newTitle??t.originalTitle},n,t.newTitle)}async dispatchConversationAction(t,u,n,r){const i=t==="rename"?"rioassist:conversation-rename":"rioassist:conversation-delete",o={id:u.id,title:u.title,index:n,action:t};return this.dispatchEvent(new CustomEvent(i,{detail:o,bubbles:!0,composed:!0,cancelable:!0}))?t==="delete"?await this.syncConversationDeleteBackend(u.id):t==="rename"&&r?await this.syncConversationRenameBackend(u.id,r):!1:!1}async syncConversationRenameBackend(t,u){try{return await this.ensureRioClient().renameConversation(t,u),this.applyConversationRename(t,u),this.conversationHistoryError="",!0}catch(n){return console.error("[RioAssist][history] erro ao renomear conversa",n),this.conversationHistoryError=n instanceof Error&&n.message?n.message:"Nao foi possivel renomear a conversa.",!1}}async syncConversationDeleteBackend(t){try{return await this.ensureRioClient().deleteConversation(t),this.applyConversationDeletion(t),this.conversationHistoryError="",!0}catch(u){return console.error("[RioAssist][history] erro ao excluir conversa",u),this.conversationHistoryError=u instanceof Error&&u.message?u.message:"Nao foi possivel excluir a conversa.",!1}}handleConversationSystemAction(t){const u=(t.action??"").toLowerCase();if(u==="conversationrenamed"){const n=t.data,r=this.extractString(n,["conversationId","id"]),i=this.extractString(n,["newTitle","title"]);return r&&i&&(this.applyConversationRename(r,i),this.conversationHistoryError="",this.pendingConversationAction&&this.pendingConversationAction.conversationId===r&&this.pendingConversationAction.action==="rename"&&(this.pendingConversationAction=null,this.conversationActionError=null)),!0}if(u==="conversationdeleted"){const n=t.data,r=this.extractString(n,["conversationId","id"]);return r&&(this.applyConversationDeletion(r),this.conversationHistoryError="",this.pendingConversationAction&&this.pendingConversationAction.conversationId===r&&this.pendingConversationAction.action==="delete"&&(this.pendingConversationAction=null,this.conversationActionError=null)),!0}return u==="processing"}handleConversationActionError(t){if((t.action??"").toLowerCase()!=="error")return!1;const n=t.data,r=this.extractString(n,["error","message","detail","description"])||(typeof t.text=="string"&&t.text.trim()?t.text:"O agente retornou um erro ao processar a conversa."),i=this.pendingConversationAction;return i?(i.action==="rename"&&this.applyConversationRename(i.conversationId,i.originalTitle),i.action==="delete"&&(this.restoreConversationSnapshot(i.snapshot,i.index),i.wasActive&&(this.currentConversationId=i.conversationId,this.activeConversationTitle=i.originalTitle,this.messages=i.messagesSnapshot??this.messages)),this.conversationActionError={...i,message:r},this.pendingConversationAction=null,this.clearLoadingGuard(),this.isLoading=!1,!0):(this.errorMessage=r,this.clearLoadingGuard(),this.isLoading=!1,!0)}shouldIgnoreAssistantPayload(t){if(!t)return!1;const u=t.toLowerCase();return u==="processing"||u==="conversationrenamed"||u==="conversationdeleted"}extractString(t,u){if(!t||typeof t!="object")return null;for(const n of u){const r=t[n];if(typeof r=="string"&&r.trim())return r}return null}handleHeaderActionClick(t,u){const n={index:u,id:t.id??null,ariaLabel:t.ariaLabel??null,iconUrl:t.iconUrl};this.dispatchEvent(new CustomEvent("rioassist:header-action",{detail:n,bubbles:!0,composed:!0,cancelable:!0}))&&typeof t.onClick=="function"&&t.onClick()}handleCloseAction(){if(this.isFullscreen){this.exitFullscreen(!0);return}this.showConversations?this.closeConversationsPanel():this.closePanel()}enterFullscreen(){this.isFullscreen||(this.isFullscreen=!0,this.open=!1,this.showConversations=!1,this.requestConversationHistory())}exitFullscreen(t){this.isFullscreen&&(this.isFullscreen=!1,this.conversationMenuId=null,this.showNewConversationShortcut=!1,t&&(this.open=!0))}handleCreateConversation(){this.hasActiveConversation&&(this.clearLoadingGuard(),this.isLoading=!1,this.messages=[],this.message="",this.errorMessage="",this.showConversations=!1,this.teardownRioClient(),this.currentConversationId=this.generateConversationId(),this.activeConversationTitle=null,this.showNewConversationShortcut=!1,this.dispatchEvent(new CustomEvent("rioassist:new-conversation",{bubbles:!0,composed:!0})))}handleConversationListScroll(t){const u=t.currentTarget;u&&this.updateConversationScrollbar(u)}handleConversationScrollbarPointerDown(t){const u=t.currentTarget,n=this.renderRoot.querySelector(".conversation-list--sidebar");if(!u||!n)return;const r=u.getBoundingClientRect(),i=r.height*(this.conversationScrollbar.height/100),o=Math.max(r.height-i,0),s=Math.max(n.scrollHeight-n.clientHeight,1),a=n.scrollTop/s*o,c=t.clientY-r.top,d=c>=a&&c<=a+i,f=d?a:Math.min(Math.max(c-i/2,0),o);d||(n.scrollTop=f/Math.max(o,1)*(n.scrollHeight-n.clientHeight),this.updateConversationScrollbar(n)),u.setPointerCapture(t.pointerId),this.conversationScrollbarDraggingId=t.pointerId,this.conversationScrollbarDragState={startY:t.clientY,startThumbTop:f,trackHeight:r.height,thumbHeight:i,list:n},t.preventDefault()}handleConversationScrollbarPointerMove(t){if(this.conversationScrollbarDraggingId===null||this.conversationScrollbarDraggingId!==t.pointerId||!this.conversationScrollbarDragState)return;const{startY:u,startThumbTop:n,trackHeight:r,thumbHeight:i,list:o}=this.conversationScrollbarDragState,s=Math.max(r-i,0),a=t.clientY-u,c=Math.min(Math.max(n+a,0),s),d=o.scrollHeight-o.clientHeight;d>0&&(o.scrollTop=c/Math.max(s,1)*d,this.updateConversationScrollbar(o)),t.preventDefault()}handleConversationScrollbarPointerUp(t){if(this.conversationScrollbarDraggingId!==t.pointerId)return;const u=t.currentTarget;u==null||u.releasePointerCapture(t.pointerId),this.conversationScrollbarDraggingId=null,this.conversationScrollbarDragState=null}enqueueConversationScrollbarMeasure(){this.conversationScrollbarRaf===null&&(this.conversationScrollbarRaf=requestAnimationFrame(()=>{this.conversationScrollbarRaf=null,this.updateConversationScrollbar()}))}updateConversationScrollbar(t){const u=t??this.renderRoot.querySelector(".conversation-list--sidebar");if(!u){this.conversationScrollbar.visible&&(this.conversationScrollbar={height:0,top:0,visible:!1});return}const{scrollHeight:n,clientHeight:r,scrollTop:i}=u;if(n<=r+1){this.conversationScrollbar.visible&&(this.conversationScrollbar={height:0,top:0,visible:!1});return}const o=r/n,s=Math.max(o*100,8),a=100-s,c=i/(n-r)*(a>0?a:0);this.conversationScrollbar={height:s,top:c,visible:!0}}async onSuggestionClick(t){await this.processMessage(t)}async handleSubmit(t){t.preventDefault(),await this.processMessage(this.message)}createMessage(t,u){return{id:typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random()}`,role:t,text:u,html:this.renderMarkdown(u),timestamp:Date.now()}}async processMessage(t){const u=t.trim();if(!u||this.isLoading)return;this.currentConversationId||(this.currentConversationId=this.generateConversationId(),this.activeConversationTitle=null);const n=this.messages.length===0;this.dispatchEvent(new CustomEvent("rioassist:send",{detail:{message:u,apiBaseUrl:this.apiBaseUrl,token:this.rioToken},bubbles:!0,composed:!0}));const r=this.createMessage("user",u);this.messages=[...this.messages,r],n&&(this.showNewConversationShortcut=!0,this.refreshConversationsAfterResponse=!0),this.message="",this.errorMessage="",this.isLoading=!0,this.startLoadingGuard();try{await this.ensureRioClient().sendMessage(u,this.currentConversationId)}catch(i){this.clearLoadingGuard(),this.isLoading=!1,this.errorMessage=i instanceof Error?i.message:"Nao foi possivel enviar a mensagem para o agente."}}ensureRioClient(){const t=this.rioToken.trim();if(!t)throw new Error("Informe o token RIO em data-rio-token para conectar no websocket do assistente.");return(!this.rioClient||!this.rioClient.matchesToken(t))&&(this.teardownRioClient(),this.rioClient=new Ri(t),this.rioUnsubscribe=this.rioClient.onMessage(u=>{this.handleIncomingMessage(u)})),this.rioClient}handleIncomingMessage(t){if(this.isHistoryPayload(t)){this.logHistoryPayload(t),this.handleHistoryPayload(t.data);return}if(this.handleConversationSystemAction(t)||this.handleConversationActionError(t)||this.shouldIgnoreAssistantPayload(t.action))return;if(console.info("[RioAssist][ws] resposta de mensagem recebida",{action:t.action??"message",text:t.text,raw:t.raw,data:t.data}),t.action==="processing"){console.info("[RioAssist][ws] processando mensagem - aguardando resposta final");return}const u=this.createMessage("assistant",t.text);this.messages=[...this.messages,u],this.clearLoadingGuard(),this.isLoading=!1,this.refreshConversationsAfterResponse&&(this.refreshConversationsAfterResponse=!1,this.requestConversationHistory())}teardownRioClient(){this.rioUnsubscribe&&(this.rioUnsubscribe(),this.rioUnsubscribe=null),this.rioClient&&(this.rioClient.close(),this.rioClient=null)}async requestConversationHistory(t){try{const u=this.ensureRioClient(),n=50;console.info("[RioAssist][history] solicitando historico de conversas",{conversationId:t??null,limit:n}),this.conversationHistoryError="",this.conversationHistoryLoading=!0,await u.requestHistory({conversationId:t,limit:n})}catch(u){console.error("[RioAssist][history] erro ao solicitar historico",u),this.conversationHistoryError=u instanceof Error&&u.message?u.message:"Nao foi possivel carregar as conversas.",this.conversationHistoryLoading=!1}}handleHistoryPayload(t){const u=this.extractHistoryEntries(t),n=this.extractConversationId(t);if(n!=null){this.applyMessageHistory(u,n);return}if(this.isMessageHistoryEntries(u)){this.applyMessageHistory(u);return}this.applyConversationHistoryFromEntries(u),this.refreshConversationsAfterResponse&&(this.refreshConversationsAfterResponse=!1)}isHistoryPayload(t){if(typeof t.action=="string"&&t.action.toLowerCase().includes("history"))return!0;const u=t.data;if(u&&typeof u=="object"){const n=u.action;if(typeof n=="string"&&n.toLowerCase().includes("history")||Array.isArray(u.history)||Array.isArray(u.conversations))return!0}return!1}logHistoryPayload(t){const u="[RioAssist][history] payload recebido do websocket";if(t.data!==null&&t.data!==void 0){console.info(u,t.data);return}console.info(u,t.raw)}applyConversationHistoryFromEntries(t){if(t.length===0){console.info("[RioAssist][history] payload sem itens para montar lista de conversas"),this.conversations=[],this.conversationHistoryLoading=!1,this.conversationHistoryError="";return}const u=new Map;t.forEach((r,i)=>{if(!r||typeof r!="object")return;const o=this.normalizeConversationItem(r,i);if(!o)return;const s=u.get(o.id);if(!s){u.set(o.id,o);return}const a=Date.parse(s.updatedAt),c=Date.parse(o.updatedAt);Number.isFinite(c)&&c>a&&u.set(o.id,o)});const n=Array.from(u.values()).sort((r,i)=>{const o=Date.parse(i.updatedAt)-Date.parse(r.updatedAt);return Number.isFinite(o)?o:0});this.conversations=n,this.conversationHistoryLoading=!1,this.conversationHistoryError="",this.syncActiveConversationTitle(),console.info("[RioAssist][history] conversas normalizadas",n)}applyMessageHistory(t,u){if(t.length===0){console.info("[RioAssist][history] lista de mensagens vazia",{conversationId:u}),this.messages=[],this.showConversations=!1,this.clearLoadingGuard(),this.isLoading=!1,this.conversationHistoryLoading=!1;return}const n=t.flatMap((r,i)=>this.normalizeHistoryMessages(r,i));u&&(this.currentConversationId=u),this.messages=n,this.showConversations=!1,this.clearLoadingGuard(),this.isLoading=!1,this.showNewConversationShortcut=n.length>0,this.conversationHistoryLoading=!1,this.refreshConversationsAfterResponse=!1,console.info("[RioAssist][history] mensagens carregadas",{conversationId:u??null,total:n.length})}extractHistoryEntries(t){if(Array.isArray(t))return t;if(t&&typeof t=="object"){const u=t,n=[u.history,u.conversations,u.data,u.items,u.messages];for(const r of n)if(Array.isArray(r))return r;if(u.data&&typeof u.data=="object"&&!Array.isArray(u.data)){const r=this.extractHistoryEntries(u.data);if(r.length>0)return r}}return[]}extractConversationId(t){if(t&&typeof t=="object"){const u=t,n=[u.conversationId,u.conversationUUID,u.conversationUuid,u.uuid,u.id];for(const r of n){if(r===null)return null;if(r!==void 0)return String(r)}}}isMessageHistoryEntries(t){return t.some(u=>this.looksLikeMessageHistoryEntry(u))}looksLikeMessageHistoryEntry(t){if(!t||typeof t!="object")return!1;const u=t,n=u.role??u.sender??u.from??u.author??u.type;return!!(typeof n=="string"&&n.trim().length>0||typeof u.content=="string"||typeof u.message=="string"||typeof u.text=="string"||typeof u.response=="string"||Array.isArray(u.parts)&&u.parts.length>0)}normalizeConversationItem(t,u){const n=t.id??t.conversationId??t.conversationUUID??t.conversationUuid??t.uuid,r=n!=null?String(n):`history-${u+1}`,i=t.title??t.name??t.topic??t.subject??t.question??t.query??t.message,o=typeof i=="string"&&i.trim().length>0?i.trim():`Conversa ${u+1}`,s=t.updatedAt??t.updated_at??t.lastMessageAt??t.last_message_at??t.createdAt??t.created_at??t.timestamp??t.date,a=this.toIsoString(s);return{id:r,title:o,updatedAt:a}}normalizeHistoryMessages(t,u){const n=[],r=t.message??t.question??t.query??t.text??t.content,i=typeof r=="string"?r.trim():"",o=t.response??t.answer??t.reply??t.completion??t.body??t.preview,s=typeof o=="string"?o.trim():"",a=t.id??t.messageId??t.uuid??t.conversationMessageId,c=a!=null?String(a):`history-${u+1}`,d=t.timestamp??t.createdAt??t.created_at??t.date??t.time,f=t.responseTimestamp??t.responseTime??t.responseDate??t.response_at??t.updatedAt??t.updated_at,g=this.parseTimestamp(d),p=this.parseTimestamp(f,g+1);if(s)i&&n.push({id:`${c}-user`,role:"user",text:i,html:this.renderMarkdown(i),timestamp:g}),n.push({id:`${c}-assistant`,role:"assistant",text:s,html:this.renderMarkdown(s),timestamp:p});else if(i)return[];if(n.length>0)return n;const h=this.normalizeSingleHistoryMessage(t,u);return h?[h]:[]}normalizeSingleHistoryMessage(t,u){const n=t.text??t.message??t.content??t.response??t.body??t.preview,r=typeof n=="string"&&n.trim().length>0?n:"";if(!r)return null;const i=this.normalizeRole(t.role??t.sender??t.from??t.author??t.type??t.direction),o=t.id??t.messageId??t.uuid??t.conversationMessageId,s=o!=null?String(o):`history-message-${u+1}`,a=t.timestamp??t.createdAt??t.created_at??t.updatedAt??t.updated_at??t.date??t.time,c=this.parseTimestamp(a);return{id:s,role:i,text:r,html:this.renderMarkdown(r),timestamp:c}}normalizeRole(t){if(typeof t=="string"){const u=t.toLowerCase();if(u.includes("user")||u.includes("client"))return"user";if(u.includes("assistant")||u.includes("agent")||u.includes("bot"))return"assistant"}return"assistant"}parseTimestamp(t,u){const n=Date.parse(this.toIsoString(t));return Number.isFinite(n)?n:Number.isFinite(u??NaN)?u:Date.now()}lookupConversationTitle(t){if(!t)return null;const u=this.conversations.find(n=>n.id===t);return u?u.title:null}syncActiveConversationTitle(){if(!this.currentConversationId)return;const t=this.lookupConversationTitle(this.currentConversationId);t&&(this.activeConversationTitle=t)}toIsoString(t){if(typeof t=="string"||typeof t=="number"){const u=new Date(t);if(!Number.isNaN(u.getTime()))return u.toISOString()}return new Date().toISOString()}startLoadingGuard(){this.clearLoadingGuard(),this.loadingLabelInternal="RIO Insight está respondendo",this.loadingTimerSlow=window.setTimeout(()=>{this.loadingLabelInternal="RIO Insight continua respondendo",this.requestUpdate()},2e4),this.loadingTimerTimeout=window.setTimeout(()=>{this.loadingLabelInternal="RIO Insight ainda está processando sua resposta. Peço que aguarde um pouco mais",this.requestUpdate()},6e4),this.loadingTimerTimeout=window.setTimeout(()=>{this.loadingLabelInternal="Essa solicitação está demorando um pouco mais que o esperado. Pode favor, aguarde mais um pouco",this.requestUpdate()},12e4)}clearLoadingGuard(){this.loadingTimer!==null&&(window.clearTimeout(this.loadingTimer),this.loadingTimer=null),this.loadingTimerSlow!==null&&(window.clearTimeout(this.loadingTimerSlow),this.loadingTimerSlow=null),this.loadingTimerTimeout!==null&&(window.clearTimeout(this.loadingTimerTimeout),this.loadingTimerTimeout=null)}scrollConversationToBottom(){Array.from(this.renderRoot.querySelectorAll(".panel-content")).forEach(u=>{requestAnimationFrame(()=>{u.scrollTop=u.scrollHeight})})}renderMarkdown(t){const u=this.markdownRenderer.render(t),n=ja.sanitize(u,{ALLOWED_TAGS:["a","p","ul","ol","li","code","pre","strong","em","blockquote","table","thead","tbody","tr","th","td","del","hr","br","img","span","input"],ALLOWED_ATTR:["href","title","target","rel","src","alt","class","type","checked","disabled","aria-label"],ALLOW_DATA_ATTR:!1,FORBID_TAGS:["style","script"],USE_PROFILES:{html:!0}}),r=document.createElement("div");return r.innerHTML=n,r.querySelectorAll("a").forEach(i=>{i.setAttribute("target","_blank"),i.setAttribute("rel","noopener noreferrer")}),r.querySelectorAll('input[type="checkbox"]').forEach(i=>{i.setAttribute("disabled",""),i.setAttribute("tabindex","-1")}),r.innerHTML}render(){return Ti(this)}};Ft.styles=ni,Ft.properties={open:{type:Boolean,state:!0},message:{type:String,state:!0},titleText:{type:String,attribute:"data-title"},buttonLabel:{type:String,attribute:"data-button-label"},placeholder:{type:String,attribute:"data-placeholder"},accentColor:{type:String,attribute:"data-accent-color"},apiBaseUrl:{type:String,attribute:"data-api-base-url"},rioToken:{type:String,attribute:"data-rio-token"},suggestionsSource:{type:String,attribute:"data-suggestions"},messages:{state:!0},isLoading:{type:Boolean,state:!0},errorMessage:{type:String,state:!0},showConversations:{type:Boolean,state:!0},conversationSearch:{type:String,state:!0},conversationMenuId:{state:!0},conversationMenuPlacement:{state:!0},isFullscreen:{type:Boolean,state:!0},conversationScrollbar:{state:!0},showNewConversationShortcut:{type:Boolean,state:!0},conversations:{state:!0},conversationHistoryLoading:{type:Boolean,state:!0},activeConversationTitle:{state:!0},conversationHistoryError:{type:String,state:!0},deleteConversationTarget:{attribute:!1},renameConversationTarget:{attribute:!1},conversationActionError:{attribute:!1},headerActions:{attribute:!1},homeUrl:{type:String,attribute:"data-home-url"}};let vu=Ft;customElements.get("rio-assist-widget")||customElements.define("rio-assist-widget",vu);const Ya={title:"Rio Insight",buttonLabel:"Rio Insight",placeholder:"Pergunte alguma coisa",suggestions:["Resumo da Frota","Frota Disponível","Chamados Abertos","Parados + Causas","Aguardando Peças","Principais Gargalos","Tempo por Concessionária","Tempo de Ciclo","Preventiva x Corretiva"],accentColor:"#008B9A",apiBaseUrl:"",rioToken:""},sr="rio-assist-widget";function Qa(e={}){const{target:t=document.body,...u}=e;let n=document.querySelector(sr);n||(n=document.createElement(sr),t.appendChild(n));const r={...Ya,...u};Object.entries(r).forEach(([i,o])=>{o!==void 0&&(n==null||n.setAttribute(`data-${i.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`)}`,Array.isArray(o)?o.join("|"):String(o)))})}typeof window<"u"&&(window.RioAssist=window.RioAssist??{init:Qa},window.dispatchEvent(new Event("rio-assist-ready")))})();
|
|
1704
|
+
`;break}return n},Ie.prototype.render=function(e,t,u){let n="";const r=this.rules;for(let i=0,o=e.length;i<o;i++){const s=e[i].type;s==="inline"?n+=this.renderInline(e[i].children,t,u):typeof r[s]<"u"?n+=r[s](e,i,t,u,this):n+=this.renderToken(e,i,t,u)}return n};function V(){this.__rules__=[],this.__cache__=null}V.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1},V.prototype.__compile__=function(){const e=this,t=[""];e.__rules__.forEach(function(u){u.enabled&&u.alt.forEach(function(n){t.indexOf(n)<0&&t.push(n)})}),e.__cache__={},t.forEach(function(u){e.__cache__[u]=[],e.__rules__.forEach(function(n){n.enabled&&(u&&n.alt.indexOf(u)<0||e.__cache__[u].push(n.fn))})})},V.prototype.at=function(e,t,u){const n=this.__find__(e),r=u||{};if(n===-1)throw new Error("Parser rule not found: "+e);this.__rules__[n].fn=t,this.__rules__[n].alt=r.alt||[],this.__cache__=null},V.prototype.before=function(e,t,u,n){const r=this.__find__(e),i=n||{};if(r===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(r,0,{name:t,enabled:!0,fn:u,alt:i.alt||[]}),this.__cache__=null},V.prototype.after=function(e,t,u,n){const r=this.__find__(e),i=n||{};if(r===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(r+1,0,{name:t,enabled:!0,fn:u,alt:i.alt||[]}),this.__cache__=null},V.prototype.push=function(e,t,u){const n=u||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:n.alt||[]}),this.__cache__=null},V.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);const u=[];return e.forEach(function(n){const r=this.__find__(n);if(r<0){if(t)return;throw new Error("Rules manager: invalid rule name "+n)}this.__rules__[r].enabled=!0,u.push(n)},this),this.__cache__=null,u},V.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(u){u.enabled=!1}),this.enable(e,t)},V.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);const u=[];return e.forEach(function(n){const r=this.__find__(n);if(r<0){if(t)return;throw new Error("Rules manager: invalid rule name "+n)}this.__rules__[r].enabled=!1,u.push(n)},this),this.__cache__=null,u},V.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function ee(e,t,u){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=u,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}ee.prototype.attrIndex=function(t){if(!this.attrs)return-1;const u=this.attrs;for(let n=0,r=u.length;n<r;n++)if(u[n][0]===t)return n;return-1},ee.prototype.attrPush=function(t){this.attrs?this.attrs.push(t):this.attrs=[t]},ee.prototype.attrSet=function(t,u){const n=this.attrIndex(t),r=[t,u];n<0?this.attrPush(r):this.attrs[n]=r},ee.prototype.attrGet=function(t){const u=this.attrIndex(t);let n=null;return u>=0&&(n=this.attrs[u][1]),n},ee.prototype.attrJoin=function(t,u){const n=this.attrIndex(t);n<0?this.attrPush([t,u]):this.attrs[n][1]=this.attrs[n][1]+" "+u};function An(e,t,u){this.src=e,this.env=u,this.tokens=[],this.inlineMode=!1,this.md=t}An.prototype.Token=ee;const vo=/\r\n?|\n/g,ko=/\0/g;function wo(e){let t;t=e.src.replace(vo,`
|
|
1705
|
+
`),t=t.replace(ko,"�"),e.src=t}function Do(e){let t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function So(e){const t=e.tokens;for(let u=0,n=t.length;u<n;u++){const r=t[u];r.type==="inline"&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function To(e){return/^<a[>\s]/i.test(e)}function Fo(e){return/^<\/a\s*>/i.test(e)}function Io(e){const t=e.tokens;if(e.md.options.linkify)for(let u=0,n=t.length;u<n;u++){if(t[u].type!=="inline"||!e.md.linkify.pretest(t[u].content))continue;let r=t[u].children,i=0;for(let o=r.length-1;o>=0;o--){const s=r[o];if(s.type==="link_close"){for(o--;r[o].level!==s.level&&r[o].type!=="link_open";)o--;continue}if(s.type==="html_inline"&&(To(s.content)&&i>0&&i--,Fo(s.content)&&i++),!(i>0)&&s.type==="text"&&e.md.linkify.test(s.content)){const a=s.content;let c=e.md.linkify.match(a);const d=[];let f=s.level,g=0;c.length>0&&c[0].index===0&&o>0&&r[o-1].type==="text_special"&&(c=c.slice(1));for(let p=0;p<c.length;p++){const h=c[p].url,v=e.md.normalizeLink(h);if(!e.md.validateLink(v))continue;let w=c[p].text;c[p].schema?c[p].schema==="mailto:"&&!/^mailto:/i.test(w)?w=e.md.normalizeLinkText("mailto:"+w).replace(/^mailto:/,""):w=e.md.normalizeLinkText(w):w=e.md.normalizeLinkText("http://"+w).replace(/^http:\/\//,"");const S=c[p].index;if(S>g){const E=new e.Token("text","",0);E.content=a.slice(g,S),E.level=f,d.push(E)}const y=new e.Token("link_open","a",1);y.attrs=[["href",v]],y.level=f++,y.markup="linkify",y.info="auto",d.push(y);const C=new e.Token("text","",0);C.content=w,C.level=f,d.push(C);const m=new e.Token("link_close","a",-1);m.level=--f,m.markup="linkify",m.info="auto",d.push(m),g=c[p].lastIndex}if(g<a.length){const p=new e.Token("text","",0);p.content=a.slice(g),p.level=f,d.push(p)}t[u].children=r=gn(r,o,d)}}}}const xn=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Ro=/\((c|tm|r)\)/i,Mo=/\((c|tm|r)\)/ig,Lo={c:"©",r:"®",tm:"™"};function Uo(e,t){return Lo[t.toLowerCase()]}function Bo(e){let t=0;for(let u=e.length-1;u>=0;u--){const n=e[u];n.type==="text"&&!t&&(n.content=n.content.replace(Mo,Uo)),n.type==="link_open"&&n.info==="auto"&&t--,n.type==="link_close"&&n.info==="auto"&&t++}}function No(e){let t=0;for(let u=e.length-1;u>=0;u--){const n=e[u];n.type==="text"&&!t&&xn.test(n.content)&&(n.content=n.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),n.type==="link_open"&&n.info==="auto"&&t--,n.type==="link_close"&&n.info==="auto"&&t++}}function Oo(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(Ro.test(e.tokens[t].content)&&Bo(e.tokens[t].children),xn.test(e.tokens[t].content)&&No(e.tokens[t].children))}const Po=/['"]/,_n=/['"]/g,Cn="’";function yt(e,t,u){return e.slice(0,t)+u+e.slice(t+1)}function $o(e,t){let u;const n=[];for(let r=0;r<e.length;r++){const i=e[r],o=e[r].level;for(u=n.length-1;u>=0&&!(n[u].level<=o);u--);if(n.length=u+1,i.type!=="text")continue;let s=i.content,a=0,c=s.length;e:for(;a<c;){_n.lastIndex=a;const d=_n.exec(s);if(!d)break;let f=!0,g=!0;a=d.index+1;const p=d[0]==="'";let h=32;if(d.index-1>=0)h=s.charCodeAt(d.index-1);else for(u=r-1;u>=0&&!(e[u].type==="softbreak"||e[u].type==="hardbreak");u--)if(e[u].content){h=e[u].content.charCodeAt(e[u].content.length-1);break}let v=32;if(a<c)v=s.charCodeAt(a);else for(u=r+1;u<e.length&&!(e[u].type==="softbreak"||e[u].type==="hardbreak");u++)if(e[u].content){v=e[u].content.charCodeAt(0);break}const w=tt(h)||et(String.fromCharCode(h)),S=tt(v)||et(String.fromCharCode(v)),y=Je(h),C=Je(v);if(C?f=!1:S&&(y||w||(f=!1)),y?g=!1:w&&(C||S||(g=!1)),v===34&&d[0]==='"'&&h>=48&&h<=57&&(g=f=!1),f&&g&&(f=w,g=S),!f&&!g){p&&(i.content=yt(i.content,d.index,Cn));continue}if(g)for(u=n.length-1;u>=0;u--){let m=n[u];if(n[u].level<o)break;if(m.single===p&&n[u].level===o){m=n[u];let E,D;p?(E=t.md.options.quotes[2],D=t.md.options.quotes[3]):(E=t.md.options.quotes[0],D=t.md.options.quotes[1]),i.content=yt(i.content,d.index,D),e[m.token].content=yt(e[m.token].content,m.pos,E),a+=D.length-1,m.token===r&&(a+=E.length-1),s=i.content,c=s.length,n.length=u;continue e}}f?n.push({token:r,pos:d.index,single:p,level:o}):g&&p&&(i.content=yt(i.content,d.index,Cn))}}}function zo(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!=="inline"||!Po.test(e.tokens[t].content)||$o(e.tokens[t].children,e)}function Ho(e){let t,u;const n=e.tokens,r=n.length;for(let i=0;i<r;i++){if(n[i].type!=="inline")continue;const o=n[i].children,s=o.length;for(t=0;t<s;t++)o[t].type==="text_special"&&(o[t].type="text");for(t=u=0;t<s;t++)o[t].type==="text"&&t+1<s&&o[t+1].type==="text"?o[t+1].content=o[t].content+o[t+1].content:(t!==u&&(o[u]=o[t]),u++);t!==u&&(o.length=u)}}const nu=[["normalize",wo],["block",Do],["inline",So],["linkify",Io],["replacements",Oo],["smartquotes",zo],["text_join",Ho]];function ru(){this.ruler=new V;for(let e=0;e<nu.length;e++)this.ruler.push(nu[e][0],nu[e][1])}ru.prototype.process=function(e){const t=this.ruler.getRules("");for(let u=0,n=t.length;u<n;u++)t[u](e)},ru.prototype.State=An;function ne(e,t,u,n){this.src=e,this.md=t,this.env=u,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const r=this.src;for(let i=0,o=0,s=0,a=0,c=r.length,d=!1;o<c;o++){const f=r.charCodeAt(o);if(!d)if(F(f)){s++,f===9?a+=4-a%4:a++;continue}else d=!0;(f===10||o===c-1)&&(f!==10&&o++,this.bMarks.push(i),this.eMarks.push(o),this.tShift.push(s),this.sCount.push(a),this.bsCount.push(0),d=!1,s=0,a=0,i=o+1)}this.bMarks.push(r.length),this.eMarks.push(r.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}ne.prototype.push=function(e,t,u){const n=new ee(e,t,u);return n.block=!0,u<0&&this.level--,n.level=this.level,u>0&&this.level++,this.tokens.push(n),n},ne.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]},ne.prototype.skipEmptyLines=function(t){for(let u=this.lineMax;t<u&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t},ne.prototype.skipSpaces=function(t){for(let u=this.src.length;t<u;t++){const n=this.src.charCodeAt(t);if(!F(n))break}return t},ne.prototype.skipSpacesBack=function(t,u){if(t<=u)return t;for(;t>u;)if(!F(this.src.charCodeAt(--t)))return t+1;return t},ne.prototype.skipChars=function(t,u){for(let n=this.src.length;t<n&&this.src.charCodeAt(t)===u;t++);return t},ne.prototype.skipCharsBack=function(t,u,n){if(t<=n)return t;for(;t>n;)if(u!==this.src.charCodeAt(--t))return t+1;return t},ne.prototype.getLines=function(t,u,n,r){if(t>=u)return"";const i=new Array(u-t);for(let o=0,s=t;s<u;s++,o++){let a=0;const c=this.bMarks[s];let d=c,f;for(s+1<u||r?f=this.eMarks[s]+1:f=this.eMarks[s];d<f&&a<n;){const g=this.src.charCodeAt(d);if(F(g))g===9?a+=4-(a+this.bsCount[s])%4:a++;else if(d-c<this.tShift[s])a++;else break;d++}a>n?i[o]=new Array(a-n+1).join(" ")+this.src.slice(d,f):i[o]=this.src.slice(d,f)}return i.join("")},ne.prototype.Token=ee;const qo=65536;function iu(e,t){const u=e.bMarks[t]+e.tShift[t],n=e.eMarks[t];return e.src.slice(u,n)}function yn(e){const t=[],u=e.length;let n=0,r=e.charCodeAt(n),i=!1,o=0,s="";for(;n<u;)r===124&&(i?(s+=e.substring(o,n-1),o=n):(t.push(s+e.substring(o,n)),s="",o=n+1)),i=r===92,n++,r=e.charCodeAt(n);return t.push(s+e.substring(o)),t}function jo(e,t,u,n){if(t+2>u)return!1;let r=t+1;if(e.sCount[r]<e.blkIndent||e.sCount[r]-e.blkIndent>=4)return!1;let i=e.bMarks[r]+e.tShift[r];if(i>=e.eMarks[r])return!1;const o=e.src.charCodeAt(i++);if(o!==124&&o!==45&&o!==58||i>=e.eMarks[r])return!1;const s=e.src.charCodeAt(i++);if(s!==124&&s!==45&&s!==58&&!F(s)||o===45&&F(s))return!1;for(;i<e.eMarks[r];){const m=e.src.charCodeAt(i);if(m!==124&&m!==45&&m!==58&&!F(m))return!1;i++}let a=iu(e,t+1),c=a.split("|");const d=[];for(let m=0;m<c.length;m++){const E=c[m].trim();if(!E){if(m===0||m===c.length-1)continue;return!1}if(!/^:?-+:?$/.test(E))return!1;E.charCodeAt(E.length-1)===58?d.push(E.charCodeAt(0)===58?"center":"right"):E.charCodeAt(0)===58?d.push("left"):d.push("")}if(a=iu(e,t).trim(),a.indexOf("|")===-1||e.sCount[t]-e.blkIndent>=4)return!1;c=yn(a),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop();const f=c.length;if(f===0||f!==d.length)return!1;if(n)return!0;const g=e.parentType;e.parentType="table";const p=e.md.block.ruler.getRules("blockquote"),h=e.push("table_open","table",1),v=[t,0];h.map=v;const w=e.push("thead_open","thead",1);w.map=[t,t+1];const S=e.push("tr_open","tr",1);S.map=[t,t+1];for(let m=0;m<c.length;m++){const E=e.push("th_open","th",1);d[m]&&(E.attrs=[["style","text-align:"+d[m]]]);const D=e.push("inline","",0);D.content=c[m].trim(),D.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let y,C=0;for(r=t+2;r<u&&!(e.sCount[r]<e.blkIndent);r++){let m=!1;for(let D=0,U=p.length;D<U;D++)if(p[D](e,r,u,!0)){m=!0;break}if(m||(a=iu(e,r).trim(),!a)||e.sCount[r]-e.blkIndent>=4||(c=yn(a),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop(),C+=f-c.length,C>qo))break;if(r===t+2){const D=e.push("tbody_open","tbody",1);D.map=y=[t+2,0]}const E=e.push("tr_open","tr",1);E.map=[r,r+1];for(let D=0;D<f;D++){const U=e.push("td_open","td",1);d[D]&&(U.attrs=[["style","text-align:"+d[D]]]);const X=e.push("inline","",0);X.content=c[D]?c[D].trim():"",X.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return y&&(e.push("tbody_close","tbody",-1),y[1]=r),e.push("table_close","table",-1),v[1]=r,e.parentType=g,e.line=r,!0}function Yo(e,t,u){if(e.sCount[t]-e.blkIndent<4)return!1;let n=t+1,r=n;for(;n<u;){if(e.isEmpty(n)){n++;continue}if(e.sCount[n]-e.blkIndent>=4){n++,r=n;continue}break}e.line=r;const i=e.push("code_block","code",0);return i.content=e.getLines(t,r,4+e.blkIndent,!1)+`
|
|
1706
|
+
`,i.map=[t,e.line],!0}function Qo(e,t,u,n){let r=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||r+3>i)return!1;const o=e.src.charCodeAt(r);if(o!==126&&o!==96)return!1;let s=r;r=e.skipChars(r,o);let a=r-s;if(a<3)return!1;const c=e.src.slice(s,r),d=e.src.slice(r,i);if(o===96&&d.indexOf(String.fromCharCode(o))>=0)return!1;if(n)return!0;let f=t,g=!1;for(;f++,!(f>=u||(r=s=e.bMarks[f]+e.tShift[f],i=e.eMarks[f],r<i&&e.sCount[f]<e.blkIndent));)if(e.src.charCodeAt(r)===o&&!(e.sCount[f]-e.blkIndent>=4)&&(r=e.skipChars(r,o),!(r-s<a)&&(r=e.skipSpaces(r),!(r<i)))){g=!0;break}a=e.sCount[t],e.line=f+(g?1:0);const p=e.push("fence","code",0);return p.info=d,p.content=e.getLines(t+1,f,a,!0),p.markup=c,p.map=[t,e.line],!0}function Go(e,t,u,n){let r=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];const o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(r)!==62)return!1;if(n)return!0;const s=[],a=[],c=[],d=[],f=e.md.block.ruler.getRules("blockquote"),g=e.parentType;e.parentType="blockquote";let p=!1,h;for(h=t;h<u;h++){const C=e.sCount[h]<e.blkIndent;if(r=e.bMarks[h]+e.tShift[h],i=e.eMarks[h],r>=i)break;if(e.src.charCodeAt(r++)===62&&!C){let E=e.sCount[h]+1,D,U;e.src.charCodeAt(r)===32?(r++,E++,U=!1,D=!0):e.src.charCodeAt(r)===9?(D=!0,(e.bsCount[h]+E)%4===3?(r++,E++,U=!1):U=!0):D=!1;let X=E;for(s.push(e.bMarks[h]),e.bMarks[h]=r;r<i;){const oe=e.src.charCodeAt(r);if(F(oe))oe===9?X+=4-(X+e.bsCount[h]+(U?1:0))%4:X++;else break;r++}p=r>=i,a.push(e.bsCount[h]),e.bsCount[h]=e.sCount[h]+1+(D?1:0),c.push(e.sCount[h]),e.sCount[h]=X-E,d.push(e.tShift[h]),e.tShift[h]=r-e.bMarks[h];continue}if(p)break;let m=!1;for(let E=0,D=f.length;E<D;E++)if(f[E](e,h,u,!0)){m=!0;break}if(m){e.lineMax=h,e.blkIndent!==0&&(s.push(e.bMarks[h]),a.push(e.bsCount[h]),d.push(e.tShift[h]),c.push(e.sCount[h]),e.sCount[h]-=e.blkIndent);break}s.push(e.bMarks[h]),a.push(e.bsCount[h]),d.push(e.tShift[h]),c.push(e.sCount[h]),e.sCount[h]=-1}const v=e.blkIndent;e.blkIndent=0;const w=e.push("blockquote_open","blockquote",1);w.markup=">";const S=[t,0];w.map=S,e.md.block.tokenize(e,t,h);const y=e.push("blockquote_close","blockquote",-1);y.markup=">",e.lineMax=o,e.parentType=g,S[1]=e.line;for(let C=0;C<d.length;C++)e.bMarks[C+t]=s[C],e.tShift[C+t]=d[C],e.sCount[C+t]=c[C],e.bsCount[C+t]=a[C];return e.blkIndent=v,!0}function Vo(e,t,u,n){const r=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.bMarks[t]+e.tShift[t];const o=e.src.charCodeAt(i++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;i<r;){const c=e.src.charCodeAt(i++);if(c!==o&&!F(c))return!1;c===o&&s++}if(s<3)return!1;if(n)return!0;e.line=t+1;const a=e.push("hr","hr",0);return a.map=[t,e.line],a.markup=Array(s+1).join(String.fromCharCode(o)),!0}function En(e,t){const u=e.eMarks[t];let n=e.bMarks[t]+e.tShift[t];const r=e.src.charCodeAt(n++);if(r!==42&&r!==45&&r!==43)return-1;if(n<u){const i=e.src.charCodeAt(n);if(!F(i))return-1}return n}function vn(e,t){const u=e.bMarks[t]+e.tShift[t],n=e.eMarks[t];let r=u;if(r+1>=n)return-1;let i=e.src.charCodeAt(r++);if(i<48||i>57)return-1;for(;;){if(r>=n)return-1;if(i=e.src.charCodeAt(r++),i>=48&&i<=57){if(r-u>=10)return-1;continue}if(i===41||i===46)break;return-1}return r<n&&(i=e.src.charCodeAt(r),!F(i))?-1:r}function Wo(e,t){const u=e.level+2;for(let n=t+2,r=e.tokens.length-2;n<r;n++)e.tokens[n].level===u&&e.tokens[n].type==="paragraph_open"&&(e.tokens[n+2].hidden=!0,e.tokens[n].hidden=!0,n+=2)}function Zo(e,t,u,n){let r,i,o,s,a=t,c=!0;if(e.sCount[a]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[a]-e.listIndent>=4&&e.sCount[a]<e.blkIndent)return!1;let d=!1;n&&e.parentType==="paragraph"&&e.sCount[a]>=e.blkIndent&&(d=!0);let f,g,p;if((p=vn(e,a))>=0){if(f=!0,o=e.bMarks[a]+e.tShift[a],g=Number(e.src.slice(o,p-1)),d&&g!==1)return!1}else if((p=En(e,a))>=0)f=!1;else return!1;if(d&&e.skipSpaces(p)>=e.eMarks[a])return!1;if(n)return!0;const h=e.src.charCodeAt(p-1),v=e.tokens.length;f?(s=e.push("ordered_list_open","ol",1),g!==1&&(s.attrs=[["start",g]])):s=e.push("bullet_list_open","ul",1);const w=[a,0];s.map=w,s.markup=String.fromCharCode(h);let S=!1;const y=e.md.block.ruler.getRules("list"),C=e.parentType;for(e.parentType="list";a<u;){i=p,r=e.eMarks[a];const m=e.sCount[a]+p-(e.bMarks[a]+e.tShift[a]);let E=m;for(;i<r;){const xe=e.src.charCodeAt(i);if(xe===9)E+=4-(E+e.bsCount[a])%4;else if(xe===32)E++;else break;i++}const D=i;let U;D>=r?U=1:U=E-m,U>4&&(U=1);const X=m+U;s=e.push("list_item_open","li",1),s.markup=String.fromCharCode(h);const oe=[a,0];s.map=oe,f&&(s.info=e.src.slice(o,p-1));const ve=e.tight,B=e.tShift[a],lt=e.sCount[a],dt=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=X,e.tight=!0,e.tShift[a]=D-e.bMarks[a],e.sCount[a]=E,D>=r&&e.isEmpty(a+1)?e.line=Math.min(e.line+2,u):e.md.block.tokenize(e,a,u,!0),(!e.tight||S)&&(c=!1),S=e.line-a>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=dt,e.tShift[a]=B,e.sCount[a]=lt,e.tight=ve,s=e.push("list_item_close","li",-1),s.markup=String.fromCharCode(h),a=e.line,oe[1]=a,a>=u||e.sCount[a]<e.blkIndent||e.sCount[a]-e.blkIndent>=4)break;let Le=!1;for(let xe=0,ku=y.length;xe<ku;xe++)if(y[xe](e,a,u,!0)){Le=!0;break}if(Le)break;if(f){if(p=vn(e,a),p<0)break;o=e.bMarks[a]+e.tShift[a]}else if(p=En(e,a),p<0)break;if(h!==e.src.charCodeAt(p-1))break}return f?s=e.push("ordered_list_close","ol",-1):s=e.push("bullet_list_close","ul",-1),s.markup=String.fromCharCode(h),w[1]=a,e.line=a,e.parentType=C,c&&Wo(e,v),!0}function Xo(e,t,u,n){let r=e.bMarks[t]+e.tShift[t],i=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(r)!==91)return!1;function s(y){const C=e.lineMax;if(y>=C||e.isEmpty(y))return null;let m=!1;if(e.sCount[y]-e.blkIndent>3&&(m=!0),e.sCount[y]<0&&(m=!0),!m){const U=e.md.block.ruler.getRules("reference"),X=e.parentType;e.parentType="reference";let oe=!1;for(let ve=0,B=U.length;ve<B;ve++)if(U[ve](e,y,C,!0)){oe=!0;break}if(e.parentType=X,oe)return null}const E=e.bMarks[y]+e.tShift[y],D=e.eMarks[y];return e.src.slice(E,D+1)}let a=e.src.slice(r,i+1);i=a.length;let c=-1;for(r=1;r<i;r++){const y=a.charCodeAt(r);if(y===91)return!1;if(y===93){c=r;break}else if(y===10){const C=s(o);C!==null&&(a+=C,i=a.length,o++)}else if(y===92&&(r++,r<i&&a.charCodeAt(r)===10)){const C=s(o);C!==null&&(a+=C,i=a.length,o++)}}if(c<0||a.charCodeAt(c+1)!==58)return!1;for(r=c+2;r<i;r++){const y=a.charCodeAt(r);if(y===10){const C=s(o);C!==null&&(a+=C,i=a.length,o++)}else if(!F(y))break}const d=e.md.helpers.parseLinkDestination(a,r,i);if(!d.ok)return!1;const f=e.md.normalizeLink(d.str);if(!e.md.validateLink(f))return!1;r=d.pos;const g=r,p=o,h=r;for(;r<i;r++){const y=a.charCodeAt(r);if(y===10){const C=s(o);C!==null&&(a+=C,i=a.length,o++)}else if(!F(y))break}let v=e.md.helpers.parseLinkTitle(a,r,i);for(;v.can_continue;){const y=s(o);if(y===null)break;a+=y,r=i,i=a.length,o++,v=e.md.helpers.parseLinkTitle(a,r,i,v)}let w;for(r<i&&h!==r&&v.ok?(w=v.str,r=v.pos):(w="",r=g,o=p);r<i;){const y=a.charCodeAt(r);if(!F(y))break;r++}if(r<i&&a.charCodeAt(r)!==10&&w)for(w="",r=g,o=p;r<i;){const y=a.charCodeAt(r);if(!F(y))break;r++}if(r<i&&a.charCodeAt(r)!==10)return!1;const S=Ct(a.slice(1,c));return S?(n||(typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[S]>"u"&&(e.env.references[S]={title:w,href:f}),e.line=o),!0):!1}const Ko=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Jo="[a-zA-Z_:][a-zA-Z0-9:._-]*",es="(?:"+"[^\"'=<>`\\x00-\\x20]+"+"|"+"'[^']*'"+"|"+'"[^"]*"'+")",kn="<[A-Za-z][A-Za-z0-9\\-]*"+("(?:\\s+"+Jo+"(?:\\s*=\\s*"+es+")?)")+"*\\s*\\/?>",wn="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",ts="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",us="<[?][\\s\\S]*?[?]>",ns="<![A-Za-z][^>]*>",rs="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",is=new RegExp("^(?:"+kn+"|"+wn+"|"+ts+"|"+us+"|"+ns+"|"+rs+")"),os=new RegExp("^(?:"+kn+"|"+wn+")"),Re=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+Ko.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(os.source+"\\s*$"),/^$/,!1]];function ss(e,t,u,n){let r=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(r)!==60)return!1;let o=e.src.slice(r,i),s=0;for(;s<Re.length&&!Re[s][0].test(o);s++);if(s===Re.length)return!1;if(n)return Re[s][2];let a=t+1;if(!Re[s][1].test(o)){for(;a<u&&!(e.sCount[a]<e.blkIndent);a++)if(r=e.bMarks[a]+e.tShift[a],i=e.eMarks[a],o=e.src.slice(r,i),Re[s][1].test(o)){o.length!==0&&a++;break}}e.line=a;const c=e.push("html_block","",0);return c.map=[t,a],c.content=e.getLines(t,a,e.blkIndent,!0),!0}function as(e,t,u,n){let r=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(r);if(o!==35||r>=i)return!1;let s=1;for(o=e.src.charCodeAt(++r);o===35&&r<i&&s<=6;)s++,o=e.src.charCodeAt(++r);if(s>6||r<i&&!F(o))return!1;if(n)return!0;i=e.skipSpacesBack(i,r);const a=e.skipCharsBack(i,35,r);a>r&&F(e.src.charCodeAt(a-1))&&(i=a),e.line=t+1;const c=e.push("heading_open","h"+String(s),1);c.markup="########".slice(0,s),c.map=[t,e.line];const d=e.push("inline","",0);d.content=e.src.slice(r,i).trim(),d.map=[t,e.line],d.children=[];const f=e.push("heading_close","h"+String(s),-1);return f.markup="########".slice(0,s),!0}function cs(e,t,u){const n=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;const r=e.parentType;e.parentType="paragraph";let i=0,o,s=t+1;for(;s<u&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let p=e.bMarks[s]+e.tShift[s];const h=e.eMarks[s];if(p<h&&(o=e.src.charCodeAt(p),(o===45||o===61)&&(p=e.skipChars(p,o),p=e.skipSpaces(p),p>=h))){i=o===61?1:2;break}}if(e.sCount[s]<0)continue;let g=!1;for(let p=0,h=n.length;p<h;p++)if(n[p](e,s,u,!0)){g=!0;break}if(g)break}if(!i)return!1;const a=e.getLines(t,s,e.blkIndent,!1).trim();e.line=s+1;const c=e.push("heading_open","h"+String(i),1);c.markup=String.fromCharCode(o),c.map=[t,e.line];const d=e.push("inline","",0);d.content=a,d.map=[t,e.line-1],d.children=[];const f=e.push("heading_close","h"+String(i),-1);return f.markup=String.fromCharCode(o),e.parentType=r,!0}function ls(e,t,u){const n=e.md.block.ruler.getRules("paragraph"),r=e.parentType;let i=t+1;for(e.parentType="paragraph";i<u&&!e.isEmpty(i);i++){if(e.sCount[i]-e.blkIndent>3||e.sCount[i]<0)continue;let c=!1;for(let d=0,f=n.length;d<f;d++)if(n[d](e,i,u,!0)){c=!0;break}if(c)break}const o=e.getLines(t,i,e.blkIndent,!1).trim();e.line=i;const s=e.push("paragraph_open","p",1);s.map=[t,e.line];const a=e.push("inline","",0);return a.content=o,a.map=[t,e.line],a.children=[],e.push("paragraph_close","p",-1),e.parentType=r,!0}const Et=[["table",jo,["paragraph","reference"]],["code",Yo],["fence",Qo,["paragraph","reference","blockquote","list"]],["blockquote",Go,["paragraph","reference","blockquote","list"]],["hr",Vo,["paragraph","reference","blockquote","list"]],["list",Zo,["paragraph","reference","blockquote"]],["reference",Xo],["html_block",ss,["paragraph","reference","blockquote"]],["heading",as,["paragraph","reference","blockquote"]],["lheading",cs],["paragraph",ls]];function vt(){this.ruler=new V;for(let e=0;e<Et.length;e++)this.ruler.push(Et[e][0],Et[e][1],{alt:(Et[e][2]||[]).slice()})}vt.prototype.tokenize=function(e,t,u){const n=this.ruler.getRules(""),r=n.length,i=e.md.options.maxNesting;let o=t,s=!1;for(;o<u&&(e.line=o=e.skipEmptyLines(o),!(o>=u||e.sCount[o]<e.blkIndent));){if(e.level>=i){e.line=u;break}const a=e.line;let c=!1;for(let d=0;d<r;d++)if(c=n[d](e,o,u,!1),c){if(a>=e.line)throw new Error("block rule didn't increment state.line");break}if(!c)throw new Error("none of the block rules matched");e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<u&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}},vt.prototype.parse=function(e,t,u,n){if(!e)return;const r=new this.State(e,t,u,n);this.tokenize(r,r.line,r.lineMax)},vt.prototype.State=ne;function ut(e,t,u,n){this.src=e,this.env=u,this.md=t,this.tokens=n,this.tokens_meta=Array(n.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}ut.prototype.pushPending=function(){const e=new ee("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e},ut.prototype.push=function(e,t,u){this.pending&&this.pushPending();const n=new ee(e,t,u);let r=null;return u<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),n.level=this.level,u>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],r={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(r),n},ut.prototype.scanDelims=function(e,t){const u=this.posMax,n=this.src.charCodeAt(e),r=e>0?this.src.charCodeAt(e-1):32;let i=e;for(;i<u&&this.src.charCodeAt(i)===n;)i++;const o=i-e,s=i<u?this.src.charCodeAt(i):32,a=tt(r)||et(String.fromCharCode(r)),c=tt(s)||et(String.fromCharCode(s)),d=Je(r),f=Je(s),g=!f&&(!c||d||a),p=!d&&(!a||f||c);return{can_open:g&&(t||!p||a),can_close:p&&(t||!g||c),length:o}},ut.prototype.Token=ee;function ds(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function fs(e,t){let u=e.pos;for(;u<e.posMax&&!ds(e.src.charCodeAt(u));)u++;return u===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,u)),e.pos=u,!0)}const hs=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function ps(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;const u=e.pos,n=e.posMax;if(u+3>n||e.src.charCodeAt(u)!==58||e.src.charCodeAt(u+1)!==47||e.src.charCodeAt(u+2)!==47)return!1;const r=e.pending.match(hs);if(!r)return!1;const i=r[1],o=e.md.linkify.matchAtStart(e.src.slice(u-i.length));if(!o)return!1;let s=o.url;if(s.length<=i.length)return!1;s=s.replace(/\*+$/,"");const a=e.md.normalizeLink(s);if(!e.md.validateLink(a))return!1;if(!t){e.pending=e.pending.slice(0,-i.length);const c=e.push("link_open","a",1);c.attrs=[["href",a]],c.markup="linkify",c.info="auto";const d=e.push("text","",0);d.content=e.md.normalizeLinkText(s);const f=e.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return e.pos+=s.length-i.length,!0}function bs(e,t){let u=e.pos;if(e.src.charCodeAt(u)!==10)return!1;const n=e.pending.length-1,r=e.posMax;if(!t)if(n>=0&&e.pending.charCodeAt(n)===32)if(n>=1&&e.pending.charCodeAt(n-1)===32){let i=n-1;for(;i>=1&&e.pending.charCodeAt(i-1)===32;)i--;e.pending=e.pending.slice(0,i),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(u++;u<r&&F(e.src.charCodeAt(u));)u++;return e.pos=u,!0}const ou=[];for(let e=0;e<256;e++)ou.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){ou[e.charCodeAt(0)]=1});function gs(e,t){let u=e.pos;const n=e.posMax;if(e.src.charCodeAt(u)!==92||(u++,u>=n))return!1;let r=e.src.charCodeAt(u);if(r===10){for(t||e.push("hardbreak","br",0),u++;u<n&&(r=e.src.charCodeAt(u),!!F(r));)u++;return e.pos=u,!0}let i=e.src[u];if(r>=55296&&r<=56319&&u+1<n){const s=e.src.charCodeAt(u+1);s>=56320&&s<=57343&&(i+=e.src[u+1],u++)}const o="\\"+i;if(!t){const s=e.push("text_special","",0);r<256&&ou[r]!==0?s.content=i:s.content=o,s.markup=o,s.info="escape"}return e.pos=u+1,!0}function ms(e,t){let u=e.pos;if(e.src.charCodeAt(u)!==96)return!1;const r=u;u++;const i=e.posMax;for(;u<i&&e.src.charCodeAt(u)===96;)u++;const o=e.src.slice(r,u),s=o.length;if(e.backticksScanned&&(e.backticks[s]||0)<=r)return t||(e.pending+=o),e.pos+=s,!0;let a=u,c;for(;(c=e.src.indexOf("`",a))!==-1;){for(a=c+1;a<i&&e.src.charCodeAt(a)===96;)a++;const d=a-c;if(d===s){if(!t){const f=e.push("code_inline","code",0);f.markup=o,f.content=e.src.slice(u,c).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=a,!0}e.backticks[d]=c}return e.backticksScanned=!0,t||(e.pending+=o),e.pos+=s,!0}function As(e,t){const u=e.pos,n=e.src.charCodeAt(u);if(t||n!==126)return!1;const r=e.scanDelims(e.pos,!0);let i=r.length;const o=String.fromCharCode(n);if(i<2)return!1;let s;i%2&&(s=e.push("text","",0),s.content=o,i--);for(let a=0;a<i;a+=2)s=e.push("text","",0),s.content=o+o,e.delimiters.push({marker:n,length:0,token:e.tokens.length-1,end:-1,open:r.can_open,close:r.can_close});return e.pos+=r.length,!0}function Dn(e,t){let u;const n=[],r=t.length;for(let i=0;i<r;i++){const o=t[i];if(o.marker!==126||o.end===-1)continue;const s=t[o.end];u=e.tokens[o.token],u.type="s_open",u.tag="s",u.nesting=1,u.markup="~~",u.content="",u=e.tokens[s.token],u.type="s_close",u.tag="s",u.nesting=-1,u.markup="~~",u.content="",e.tokens[s.token-1].type==="text"&&e.tokens[s.token-1].content==="~"&&n.push(s.token-1)}for(;n.length;){const i=n.pop();let o=i+1;for(;o<e.tokens.length&&e.tokens[o].type==="s_close";)o++;o--,i!==o&&(u=e.tokens[o],e.tokens[o]=e.tokens[i],e.tokens[i]=u)}}function xs(e){const t=e.tokens_meta,u=e.tokens_meta.length;Dn(e,e.delimiters);for(let n=0;n<u;n++)t[n]&&t[n].delimiters&&Dn(e,t[n].delimiters)}const Sn={tokenize:As,postProcess:xs};function _s(e,t){const u=e.pos,n=e.src.charCodeAt(u);if(t||n!==95&&n!==42)return!1;const r=e.scanDelims(e.pos,n===42);for(let i=0;i<r.length;i++){const o=e.push("text","",0);o.content=String.fromCharCode(n),e.delimiters.push({marker:n,length:r.length,token:e.tokens.length-1,end:-1,open:r.can_open,close:r.can_close})}return e.pos+=r.length,!0}function Tn(e,t){const u=t.length;for(let n=u-1;n>=0;n--){const r=t[n];if(r.marker!==95&&r.marker!==42||r.end===-1)continue;const i=t[r.end],o=n>0&&t[n-1].end===r.end+1&&t[n-1].marker===r.marker&&t[n-1].token===r.token-1&&t[r.end+1].token===i.token+1,s=String.fromCharCode(r.marker),a=e.tokens[r.token];a.type=o?"strong_open":"em_open",a.tag=o?"strong":"em",a.nesting=1,a.markup=o?s+s:s,a.content="";const c=e.tokens[i.token];c.type=o?"strong_close":"em_close",c.tag=o?"strong":"em",c.nesting=-1,c.markup=o?s+s:s,c.content="",o&&(e.tokens[t[n-1].token].content="",e.tokens[t[r.end+1].token].content="",n--)}}function Cs(e){const t=e.tokens_meta,u=e.tokens_meta.length;Tn(e,e.delimiters);for(let n=0;n<u;n++)t[n]&&t[n].delimiters&&Tn(e,t[n].delimiters)}const Fn={tokenize:_s,postProcess:Cs};function ys(e,t){let u,n,r,i,o="",s="",a=e.pos,c=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;const d=e.pos,f=e.posMax,g=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let h=p+1;if(h<f&&e.src.charCodeAt(h)===40){for(c=!1,h++;h<f&&(u=e.src.charCodeAt(h),!(!F(u)&&u!==10));h++);if(h>=f)return!1;if(a=h,r=e.md.helpers.parseLinkDestination(e.src,h,e.posMax),r.ok){for(o=e.md.normalizeLink(r.str),e.md.validateLink(o)?h=r.pos:o="",a=h;h<f&&(u=e.src.charCodeAt(h),!(!F(u)&&u!==10));h++);if(r=e.md.helpers.parseLinkTitle(e.src,h,e.posMax),h<f&&a!==h&&r.ok)for(s=r.str,h=r.pos;h<f&&(u=e.src.charCodeAt(h),!(!F(u)&&u!==10));h++);}(h>=f||e.src.charCodeAt(h)!==41)&&(c=!0),h++}if(c){if(typeof e.env.references>"u")return!1;if(h<f&&e.src.charCodeAt(h)===91?(a=h+1,h=e.md.helpers.parseLinkLabel(e,h),h>=0?n=e.src.slice(a,h++):h=p+1):h=p+1,n||(n=e.src.slice(g,p)),i=e.env.references[Ct(n)],!i)return e.pos=d,!1;o=i.href,s=i.title}if(!t){e.pos=g,e.posMax=p;const v=e.push("link_open","a",1),w=[["href",o]];v.attrs=w,s&&w.push(["title",s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=h,e.posMax=f,!0}function Es(e,t){let u,n,r,i,o,s,a,c,d="";const f=e.pos,g=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const p=e.pos+2,h=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(h<0)return!1;if(i=h+1,i<g&&e.src.charCodeAt(i)===40){for(i++;i<g&&(u=e.src.charCodeAt(i),!(!F(u)&&u!==10));i++);if(i>=g)return!1;for(c=i,s=e.md.helpers.parseLinkDestination(e.src,i,e.posMax),s.ok&&(d=e.md.normalizeLink(s.str),e.md.validateLink(d)?i=s.pos:d=""),c=i;i<g&&(u=e.src.charCodeAt(i),!(!F(u)&&u!==10));i++);if(s=e.md.helpers.parseLinkTitle(e.src,i,e.posMax),i<g&&c!==i&&s.ok)for(a=s.str,i=s.pos;i<g&&(u=e.src.charCodeAt(i),!(!F(u)&&u!==10));i++);else a="";if(i>=g||e.src.charCodeAt(i)!==41)return e.pos=f,!1;i++}else{if(typeof e.env.references>"u")return!1;if(i<g&&e.src.charCodeAt(i)===91?(c=i+1,i=e.md.helpers.parseLinkLabel(e,i),i>=0?r=e.src.slice(c,i++):i=h+1):i=h+1,r||(r=e.src.slice(p,h)),o=e.env.references[Ct(r)],!o)return e.pos=f,!1;d=o.href,a=o.title}if(!t){n=e.src.slice(p,h);const v=[];e.md.inline.parse(n,e.md,e.env,v);const w=e.push("image","img",0),S=[["src",d],["alt",""]];w.attrs=S,w.children=v,w.content=n,a&&S.push(["title",a])}return e.pos=i,e.posMax=g,!0}const vs=/^([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])?)*)$/,ks=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function ws(e,t){let u=e.pos;if(e.src.charCodeAt(u)!==60)return!1;const n=e.pos,r=e.posMax;for(;;){if(++u>=r)return!1;const o=e.src.charCodeAt(u);if(o===60)return!1;if(o===62)break}const i=e.src.slice(n+1,u);if(ks.test(i)){const o=e.md.normalizeLink(i);if(!e.md.validateLink(o))return!1;if(!t){const s=e.push("link_open","a",1);s.attrs=[["href",o]],s.markup="autolink",s.info="auto";const a=e.push("text","",0);a.content=e.md.normalizeLinkText(i);const c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=i.length+2,!0}if(vs.test(i)){const o=e.md.normalizeLink("mailto:"+i);if(!e.md.validateLink(o))return!1;if(!t){const s=e.push("link_open","a",1);s.attrs=[["href",o]],s.markup="autolink",s.info="auto";const a=e.push("text","",0);a.content=e.md.normalizeLinkText(i);const c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=i.length+2,!0}return!1}function Ds(e){return/^<a[>\s]/i.test(e)}function Ss(e){return/^<\/a\s*>/i.test(e)}function Ts(e){const t=e|32;return t>=97&&t<=122}function Fs(e,t){if(!e.md.options.html)return!1;const u=e.posMax,n=e.pos;if(e.src.charCodeAt(n)!==60||n+2>=u)return!1;const r=e.src.charCodeAt(n+1);if(r!==33&&r!==63&&r!==47&&!Ts(r))return!1;const i=e.src.slice(n).match(is);if(!i)return!1;if(!t){const o=e.push("html_inline","",0);o.content=i[0],Ds(o.content)&&e.linkLevel++,Ss(o.content)&&e.linkLevel--}return e.pos+=i[0].length,!0}const Is=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Rs=/^&([a-z][a-z0-9]{1,31});/i;function Ms(e,t){const u=e.pos,n=e.posMax;if(e.src.charCodeAt(u)!==38||u+1>=n)return!1;if(e.src.charCodeAt(u+1)===35){const i=e.src.slice(u).match(Is);if(i){if(!t){const o=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),s=e.push("text_special","",0);s.content=uu(o)?_t(o):_t(65533),s.markup=i[0],s.info="entity"}return e.pos+=i[0].length,!0}}else{const i=e.src.slice(u).match(Rs);if(i){const o=bn(i[0]);if(o!==i[0]){if(!t){const s=e.push("text_special","",0);s.content=o,s.markup=i[0],s.info="entity"}return e.pos+=i[0].length,!0}}}return!1}function In(e){const t={},u=e.length;if(!u)return;let n=0,r=-2;const i=[];for(let o=0;o<u;o++){const s=e[o];if(i.push(0),(e[n].marker!==s.marker||r!==s.token-1)&&(n=o),r=s.token,s.length=s.length||0,!s.close)continue;t.hasOwnProperty(s.marker)||(t[s.marker]=[-1,-1,-1,-1,-1,-1]);const a=t[s.marker][(s.open?3:0)+s.length%3];let c=n-i[n]-1,d=c;for(;c>a;c-=i[c]+1){const f=e[c];if(f.marker===s.marker&&f.open&&f.end<0){let g=!1;if((f.close||s.open)&&(f.length+s.length)%3===0&&(f.length%3!==0||s.length%3!==0)&&(g=!0),!g){const p=c>0&&!e[c-1].open?i[c-1]+1:0;i[o]=o-c+p,i[c]=p,s.open=!1,f.end=o,f.close=!1,d=-1,r=-2;break}}}d!==-1&&(t[s.marker][(s.open?3:0)+(s.length||0)%3]=d)}}function Ls(e){const t=e.tokens_meta,u=e.tokens_meta.length;In(e.delimiters);for(let n=0;n<u;n++)t[n]&&t[n].delimiters&&In(t[n].delimiters)}function Us(e){let t,u,n=0;const r=e.tokens,i=e.tokens.length;for(t=u=0;t<i;t++)r[t].nesting<0&&n--,r[t].level=n,r[t].nesting>0&&n++,r[t].type==="text"&&t+1<i&&r[t+1].type==="text"?r[t+1].content=r[t].content+r[t+1].content:(t!==u&&(r[u]=r[t]),u++);t!==u&&(r.length=u)}const su=[["text",fs],["linkify",ps],["newline",bs],["escape",gs],["backticks",ms],["strikethrough",Sn.tokenize],["emphasis",Fn.tokenize],["link",ys],["image",Es],["autolink",ws],["html_inline",Fs],["entity",Ms]],au=[["balance_pairs",Ls],["strikethrough",Sn.postProcess],["emphasis",Fn.postProcess],["fragments_join",Us]];function nt(){this.ruler=new V;for(let e=0;e<su.length;e++)this.ruler.push(su[e][0],su[e][1]);this.ruler2=new V;for(let e=0;e<au.length;e++)this.ruler2.push(au[e][0],au[e][1])}nt.prototype.skipToken=function(e){const t=e.pos,u=this.ruler.getRules(""),n=u.length,r=e.md.options.maxNesting,i=e.cache;if(typeof i[t]<"u"){e.pos=i[t];return}let o=!1;if(e.level<r){for(let s=0;s<n;s++)if(e.level++,o=u[s](e,!0),e.level--,o){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;o||e.pos++,i[t]=e.pos},nt.prototype.tokenize=function(e){const t=this.ruler.getRules(""),u=t.length,n=e.posMax,r=e.md.options.maxNesting;for(;e.pos<n;){const i=e.pos;let o=!1;if(e.level<r){for(let s=0;s<u;s++)if(o=t[s](e,!1),o){if(i>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(o){if(e.pos>=n)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},nt.prototype.parse=function(e,t,u,n){const r=new this.State(e,t,u,n);this.tokenize(r);const i=this.ruler2.getRules(""),o=i.length;for(let s=0;s<o;s++)i[s](r)},nt.prototype.State=ut;function Bs(e){const t={};e=e||{},t.src_Any=ln.source,t.src_Cc=dn.source,t.src_Z=hn.source,t.src_P=Kt.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");const u="[><|]";return t.src_pseudo_letter="(?:(?!"+u+"|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|"+u+"|"+t.src_ZPCc+")(?!"+(e["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|"+u+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+t.src_ZCc+"|[.]|$)|"+(e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+t.src_ZCc+"|$)|;(?!"+t.src_ZCc+"|$)|\\!+(?!"+t.src_ZCc+"|[!]|$)|\\?(?!"+t.src_ZCc+"|[?]|$))+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|"+u+'|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}function cu(e){return Array.prototype.slice.call(arguments,1).forEach(function(u){u&&Object.keys(u).forEach(function(n){e[n]=u[n]})}),e}function kt(e){return Object.prototype.toString.call(e)}function Ns(e){return kt(e)==="[object String]"}function Os(e){return kt(e)==="[object Object]"}function Ps(e){return kt(e)==="[object RegExp]"}function Rn(e){return kt(e)==="[object Function]"}function $s(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const Mn={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function zs(e){return Object.keys(e||{}).reduce(function(t,u){return t||Mn.hasOwnProperty(u)},!1)}const Hs={"http:":{validate:function(e,t,u){const n=e.slice(t);return u.re.http||(u.re.http=new RegExp("^\\/\\/"+u.re.src_auth+u.re.src_host_port_strict+u.re.src_path,"i")),u.re.http.test(n)?n.match(u.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,u){const n=e.slice(t);return u.re.no_http||(u.re.no_http=new RegExp("^"+u.re.src_auth+"(?:localhost|(?:(?:"+u.re.src_domain+")\\.)+"+u.re.src_domain_root+")"+u.re.src_port+u.re.src_host_terminator+u.re.src_path,"i")),u.re.no_http.test(n)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:n.match(u.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,u){const n=e.slice(t);return u.re.mailto||(u.re.mailto=new RegExp("^"+u.re.src_email_name+"@"+u.re.src_host_strict,"i")),u.re.mailto.test(n)?n.match(u.re.mailto)[0].length:0}}},qs="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",js="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function Ys(e){e.__index__=-1,e.__text_cache__=""}function Qs(e){return function(t,u){const n=t.slice(u);return e.test(n)?n.match(e)[0].length:0}}function Ln(){return function(e,t){t.normalize(e)}}function wt(e){const t=e.re=Bs(e.__opts__),u=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||u.push(qs),u.push(t.src_xn),t.src_tlds=u.join("|");function n(s){return s.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(n(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(n(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(n(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(n(t.tpl_host_fuzzy_test),"i");const r=[];e.__compiled__={};function i(s,a){throw new Error('(LinkifyIt) Invalid schema "'+s+'": '+a)}Object.keys(e.__schemas__).forEach(function(s){const a=e.__schemas__[s];if(a===null)return;const c={validate:null,link:null};if(e.__compiled__[s]=c,Os(a)){Ps(a.validate)?c.validate=Qs(a.validate):Rn(a.validate)?c.validate=a.validate:i(s,a),Rn(a.normalize)?c.normalize=a.normalize:a.normalize?i(s,a):c.normalize=Ln();return}if(Ns(a)){r.push(s);return}i(s,a)}),r.forEach(function(s){e.__compiled__[e.__schemas__[s]]&&(e.__compiled__[s].validate=e.__compiled__[e.__schemas__[s]].validate,e.__compiled__[s].normalize=e.__compiled__[e.__schemas__[s]].normalize)}),e.__compiled__[""]={validate:null,normalize:Ln()};const o=Object.keys(e.__compiled__).filter(function(s){return s.length>0&&e.__compiled__[s]}).map($s).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+o+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),Ys(e)}function Gs(e,t){const u=e.__index__,n=e.__last_index__,r=e.__text_cache__.slice(u,n);this.schema=e.__schema__.toLowerCase(),this.index=u+t,this.lastIndex=n+t,this.raw=r,this.text=r,this.url=r}function lu(e,t){const u=new Gs(e,t);return e.__compiled__[u.schema].normalize(u,e),u}function Z(e,t){if(!(this instanceof Z))return new Z(e,t);t||zs(e)&&(t=e,e={}),this.__opts__=cu({},Mn,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=cu({},Hs,e),this.__compiled__={},this.__tlds__=js,this.__tlds_replaced__=!1,this.re={},wt(this)}Z.prototype.add=function(t,u){return this.__schemas__[t]=u,wt(this),this},Z.prototype.set=function(t){return this.__opts__=cu(this.__opts__,t),this},Z.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;let u,n,r,i,o,s,a,c,d;if(this.re.schema_test.test(t)){for(a=this.re.schema_search,a.lastIndex=0;(u=a.exec(t))!==null;)if(i=this.testSchemaAt(t,u[2],a.lastIndex),i){this.__schema__=u[2],this.__index__=u.index+u[1].length,this.__last_index__=u.index+u[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(c=t.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=t.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(o=n.index+n[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(d=t.indexOf("@"),d>=0&&(r=t.match(this.re.email_fuzzy))!==null&&(o=r.index+r[1].length,s=r.index+r[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&s>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=s))),this.__index__>=0},Z.prototype.pretest=function(t){return this.re.pretest.test(t)},Z.prototype.testSchemaAt=function(t,u,n){return this.__compiled__[u.toLowerCase()]?this.__compiled__[u.toLowerCase()].validate(t,n,this):0},Z.prototype.match=function(t){const u=[];let n=0;this.__index__>=0&&this.__text_cache__===t&&(u.push(lu(this,n)),n=this.__last_index__);let r=n?t.slice(n):t;for(;this.test(r);)u.push(lu(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return u.length?u:null},Z.prototype.matchAtStart=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return null;const u=this.re.schema_at_start.exec(t);if(!u)return null;const n=this.testSchemaAt(t,u[2],u[0].length);return n?(this.__schema__=u[2],this.__index__=u.index+u[1].length,this.__last_index__=u.index+u[0].length+n,lu(this,0)):null},Z.prototype.tlds=function(t,u){return t=Array.isArray(t)?t:[t],u?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(n,r,i){return n!==i[r-1]}).reverse(),wt(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,wt(this),this)},Z.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)},Z.prototype.onCompile=function(){};const Me=2147483647,re=36,du=1,rt=26,Vs=38,Ws=700,Un=72,Bn=128,Nn="-",Zs=/^xn--/,Xs=/[^\0-\x7F]/,Ks=/[\x2E\u3002\uFF0E\uFF61]/g,Js={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},fu=re-du,ie=Math.floor,hu=String.fromCharCode;function Ae(e){throw new RangeError(Js[e])}function ea(e,t){const u=[];let n=e.length;for(;n--;)u[n]=t(e[n]);return u}function On(e,t){const u=e.split("@");let n="";u.length>1&&(n=u[0]+"@",e=u[1]),e=e.replace(Ks,".");const r=e.split("."),i=ea(r,t).join(".");return n+i}function Pn(e){const t=[];let u=0;const n=e.length;for(;u<n;){const r=e.charCodeAt(u++);if(r>=55296&&r<=56319&&u<n){const i=e.charCodeAt(u++);(i&64512)==56320?t.push(((r&1023)<<10)+(i&1023)+65536):(t.push(r),u--)}else t.push(r)}return t}const ta=e=>String.fromCodePoint(...e),ua=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:re},$n=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},zn=function(e,t,u){let n=0;for(e=u?ie(e/Ws):e>>1,e+=ie(e/t);e>fu*rt>>1;n+=re)e=ie(e/fu);return ie(n+(fu+1)*e/(e+Vs))},Hn=function(e){const t=[],u=e.length;let n=0,r=Bn,i=Un,o=e.lastIndexOf(Nn);o<0&&(o=0);for(let s=0;s<o;++s)e.charCodeAt(s)>=128&&Ae("not-basic"),t.push(e.charCodeAt(s));for(let s=o>0?o+1:0;s<u;){const a=n;for(let d=1,f=re;;f+=re){s>=u&&Ae("invalid-input");const g=ua(e.charCodeAt(s++));g>=re&&Ae("invalid-input"),g>ie((Me-n)/d)&&Ae("overflow"),n+=g*d;const p=f<=i?du:f>=i+rt?rt:f-i;if(g<p)break;const h=re-p;d>ie(Me/h)&&Ae("overflow"),d*=h}const c=t.length+1;i=zn(n-a,c,a==0),ie(n/c)>Me-r&&Ae("overflow"),r+=ie(n/c),n%=c,t.splice(n++,0,r)}return String.fromCodePoint(...t)},qn=function(e){const t=[];e=Pn(e);const u=e.length;let n=Bn,r=0,i=Un;for(const a of e)a<128&&t.push(hu(a));const o=t.length;let s=o;for(o&&t.push(Nn);s<u;){let a=Me;for(const d of e)d>=n&&d<a&&(a=d);const c=s+1;a-n>ie((Me-r)/c)&&Ae("overflow"),r+=(a-n)*c,n=a;for(const d of e)if(d<n&&++r>Me&&Ae("overflow"),d===n){let f=r;for(let g=re;;g+=re){const p=g<=i?du:g>=i+rt?rt:g-i;if(f<p)break;const h=f-p,v=re-p;t.push(hu($n(p+h%v,0))),f=ie(h/v)}t.push(hu($n(f,0))),i=zn(r,c,s===o),r=0,++s}++r,++n}return t.join("")},jn={version:"2.3.1",ucs2:{decode:Pn,encode:ta},decode:Hn,encode:qn,toASCII:function(e){return On(e,function(t){return Xs.test(t)?"xn--"+qn(t):t})},toUnicode:function(e){return On(e,function(t){return Zs.test(t)?Hn(t.slice(4).toLowerCase()):t})}},na={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},ra=/^(vbscript|javascript|file|data):/,ia=/^data:image\/(gif|png|jpeg|webp);/;function oa(e){const t=e.trim().toLowerCase();return ra.test(t)?ia.test(t):!0}const Yn=["http:","https:","mailto:"];function sa(e){const t=Xt(e,!0);if(t.hostname&&(!t.protocol||Yn.indexOf(t.protocol)>=0))try{t.hostname=jn.toASCII(t.hostname)}catch{}return Ke(Zt(t))}function aa(e){const t=Xt(e,!0);if(t.hostname&&(!t.protocol||Yn.indexOf(t.protocol)>=0))try{t.hostname=jn.toUnicode(t.hostname)}catch{}return Te(Zt(t),Te.defaultChars+"%")}function K(e,t){if(!(this instanceof K))return new K(e,t);t||tu(e)||(t=e||{},e="default"),this.inline=new nt,this.block=new vt,this.core=new ru,this.renderer=new Ie,this.linkify=new Z,this.validateLink=oa,this.normalizeLink=sa,this.normalizeLinkText=aa,this.utils=xo,this.helpers=xt({},Eo),this.options={},this.configure(e),t&&this.set(t)}K.prototype.set=function(e){return xt(this.options,e),this},K.prototype.configure=function(e){const t=this;if(tu(e)){const u=e;if(e=na[u],!e)throw new Error('Wrong `markdown-it` preset "'+u+'", check name')}if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(u){e.components[u].rules&&t[u].ruler.enableOnly(e.components[u].rules),e.components[u].rules2&&t[u].ruler2.enableOnly(e.components[u].rules2)}),this},K.prototype.enable=function(e,t){let u=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(r){u=u.concat(this[r].ruler.enable(e,!0))},this),u=u.concat(this.inline.ruler2.enable(e,!0));const n=e.filter(function(r){return u.indexOf(r)<0});if(n.length&&!t)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this},K.prototype.disable=function(e,t){let u=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(r){u=u.concat(this[r].ruler.disable(e,!0))},this),u=u.concat(this.inline.ruler2.disable(e,!0));const n=e.filter(function(r){return u.indexOf(r)<0});if(n.length&&!t)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this},K.prototype.use=function(e){const t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},K.prototype.parse=function(e,t){if(typeof e!="string")throw new Error("Input data should be a String");const u=new this.core.State(e,this,t);return this.core.process(u),u.tokens},K.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)},K.prototype.parseInline=function(e,t){const u=new this.core.State(e,this,t);return u.inlineMode=!0,this.core.process(u),u.tokens},K.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};function ca(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pu=!0,Qn=!1,Gn=!1,la=function(e,t){t&&(pu=!t.enabled,Qn=!!t.label,Gn=!!t.labelAfter),e.core.ruler.after("inline","github-task-lists",function(u){for(var n=u.tokens,r=2;r<n.length;r++)fa(n,r)&&(ha(n[r],u.Token),Vn(n[r-2],"class","task-list-item"+(pu?"":" enabled")),Vn(n[da(n,r-2)],"class","contains-task-list"))})};function Vn(e,t,u){var n=e.attrIndex(t),r=[t,u];n<0?e.attrPush(r):e.attrs[n]=r}function da(e,t){for(var u=e[t].level-1,n=t-1;n>=0;n--)if(e[n].level===u)return n;return-1}function fa(e,t){return Aa(e[t])&&xa(e[t-1])&&_a(e[t-2])&&Ca(e[t])}function ha(e,t){if(e.children.unshift(pa(e,t)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),Qn)if(Gn){e.children.pop();var u="task-item-"+Math.ceil(Math.random()*(1e4*1e3)-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+' id="'+u+'">',e.children.push(ma(e.content,u,t))}else e.children.unshift(ba(t)),e.children.push(ga(t))}function pa(e,t){var u=new t("html_inline","",0),n=pu?' disabled="" ':"";return e.content.indexOf("[ ] ")===0?u.content='<input class="task-list-item-checkbox"'+n+'type="checkbox">':(e.content.indexOf("[x] ")===0||e.content.indexOf("[X] ")===0)&&(u.content='<input class="task-list-item-checkbox" checked=""'+n+'type="checkbox">'),u}function ba(e){var t=new e("html_inline","",0);return t.content="<label>",t}function ga(e){var t=new e("html_inline","",0);return t.content="</label>",t}function ma(e,t,u){var n=new u("html_inline","",0);return n.content='<label class="task-list-item-label" for="'+t+'">'+e+"</label>",n.attrs=[{for:t}],n}function Aa(e){return e.type==="inline"}function xa(e){return e.type==="paragraph_open"}function _a(e){return e.type==="list_item_open"}function Ca(e){return e.content.indexOf("[ ] ")===0||e.content.indexOf("[x] ")===0||e.content.indexOf("[X] ")===0}const ya=ca(la);/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:Wn,setPrototypeOf:Zn,isFrozen:Ea,getPrototypeOf:va,getOwnPropertyDescriptor:ka}=Object;let{freeze:j,seal:J,create:bu}=Object,{apply:gu,construct:mu}=typeof Reflect<"u"&&Reflect;j||(j=function(t){return t}),J||(J=function(t){return t}),gu||(gu=function(t,u){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return t.apply(u,r)}),mu||(mu=function(t){for(var u=arguments.length,n=new Array(u>1?u-1:0),r=1;r<u;r++)n[r-1]=arguments[r];return new t(...n)});const Dt=Q(Array.prototype.forEach),wa=Q(Array.prototype.lastIndexOf),Xn=Q(Array.prototype.pop),it=Q(Array.prototype.push),Da=Q(Array.prototype.splice),St=Q(String.prototype.toLowerCase),Au=Q(String.prototype.toString),xu=Q(String.prototype.match),ot=Q(String.prototype.replace),Sa=Q(String.prototype.indexOf),Ta=Q(String.prototype.trim),te=Q(Object.prototype.hasOwnProperty),Y=Q(RegExp.prototype.test),st=Fa(TypeError);function Q(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var u=arguments.length,n=new Array(u>1?u-1:0),r=1;r<u;r++)n[r-1]=arguments[r];return gu(e,t,n)}}function Fa(e){return function(){for(var t=arguments.length,u=new Array(t),n=0;n<t;n++)u[n]=arguments[n];return mu(e,u)}}function k(e,t){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:St;Zn&&Zn(e,null);let n=t.length;for(;n--;){let r=t[n];if(typeof r=="string"){const i=u(r);i!==r&&(Ea(t)||(t[n]=i),r=i)}e[r]=!0}return e}function Ia(e){for(let t=0;t<e.length;t++)te(e,t)||(e[t]=null);return e}function ce(e){const t=bu(null);for(const[u,n]of Wn(e))te(e,u)&&(Array.isArray(n)?t[u]=Ia(n):n&&typeof n=="object"&&n.constructor===Object?t[u]=ce(n):t[u]=n);return t}function at(e,t){for(;e!==null;){const n=ka(e,t);if(n){if(n.get)return Q(n.get);if(typeof n.value=="function")return Q(n.value)}e=va(e)}function u(){return null}return u}const Kn=j(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),_u=j(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Cu=j(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ra=j(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),yu=j(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ma=j(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Jn=j(["#text"]),er=j(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Eu=j(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),tr=j(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Tt=j(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),La=J(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ua=J(/<%[\w\W]*|[\w\W]*%>/gm),Ba=J(/\$\{[\w\W]*/gm),Na=J(/^data-[\-\w.\u00B7-\uFFFF]+$/),Oa=J(/^aria-[\-\w]+$/),ur=J(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pa=J(/^(?:\w+script|data):/i),$a=J(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nr=J(/^html$/i),za=J(/^[a-z][.\w]*(-[.\w]+)+$/i);var rr=Object.freeze({__proto__:null,ARIA_ATTR:Oa,ATTR_WHITESPACE:$a,CUSTOM_ELEMENT:za,DATA_ATTR:Na,DOCTYPE_NAME:nr,ERB_EXPR:Ua,IS_ALLOWED_URI:ur,IS_SCRIPT_OR_DATA:Pa,MUSTACHE_EXPR:La,TMPLIT_EXPR:Ba});const ct={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ha=function(){return typeof window>"u"?null:window},qa=function(t,u){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const r="data-tt-policy-suffix";u&&u.hasAttribute(r)&&(n=u.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},ir=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function or(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ha();const t=x=>or(x);if(t.version="3.3.0",t.removed=[],!e||!e.document||e.document.nodeType!==ct.document||!e.Element)return t.isSupported=!1,t;let{document:u}=e;const n=u,r=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:s,Element:a,NodeFilter:c,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:g,trustedTypes:p}=e,h=a.prototype,v=at(h,"cloneNode"),w=at(h,"remove"),S=at(h,"nextSibling"),y=at(h,"childNodes"),C=at(h,"parentNode");if(typeof o=="function"){const x=u.createElement("template");x.content&&x.content.ownerDocument&&(u=x.content.ownerDocument)}let m,E="";const{implementation:D,createNodeIterator:U,createDocumentFragment:X,getElementsByTagName:oe}=u,{importNode:ve}=n;let B=ir();t.isSupported=typeof Wn=="function"&&typeof C=="function"&&D&&D.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:lt,ERB_EXPR:dt,TMPLIT_EXPR:Le,DATA_ATTR:xe,ARIA_ATTR:ku,IS_SCRIPT_OR_DATA:Ga,ATTR_WHITESPACE:cr,CUSTOM_ELEMENT:Va}=rr;let{IS_ALLOWED_URI:lr}=rr,P=null;const dr=k({},[...Kn,..._u,...Cu,...yu,...Jn]);let z=null;const fr=k({},[...er,...Eu,...tr,...Tt]);let R=Object.seal(bu(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ft=null,wu=null;const Ue=Object.seal(bu(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let hr=!0,Du=!0,pr=!1,br=!0,Be=!1,It=!0,ke=!1,Su=!1,Tu=!1,Ne=!1,Rt=!1,Mt=!1,gr=!0,mr=!1;const Wa="user-content-";let Fu=!0,ht=!1,Oe={},Pe=null;const Ar=k({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let xr=null;const _r=k({},["audio","video","img","source","image","track"]);let Iu=null;const Cr=k({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Lt="http://www.w3.org/1998/Math/MathML",Ut="http://www.w3.org/2000/svg",le="http://www.w3.org/1999/xhtml";let $e=le,Ru=!1,Mu=null;const Za=k({},[Lt,Ut,le],Au);let Bt=k({},["mi","mo","mn","ms","mtext"]),Nt=k({},["annotation-xml"]);const Xa=k({},["title","style","font","a","script"]);let pt=null;const Ka=["application/xhtml+xml","text/html"],Ja="text/html";let $=null,ze=null;const e0=u.createElement("form"),yr=function(l){return l instanceof RegExp||l instanceof Function},Lu=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ze&&ze===l)){if((!l||typeof l!="object")&&(l={}),l=ce(l),pt=Ka.indexOf(l.PARSER_MEDIA_TYPE)===-1?Ja:l.PARSER_MEDIA_TYPE,$=pt==="application/xhtml+xml"?Au:St,P=te(l,"ALLOWED_TAGS")?k({},l.ALLOWED_TAGS,$):dr,z=te(l,"ALLOWED_ATTR")?k({},l.ALLOWED_ATTR,$):fr,Mu=te(l,"ALLOWED_NAMESPACES")?k({},l.ALLOWED_NAMESPACES,Au):Za,Iu=te(l,"ADD_URI_SAFE_ATTR")?k(ce(Cr),l.ADD_URI_SAFE_ATTR,$):Cr,xr=te(l,"ADD_DATA_URI_TAGS")?k(ce(_r),l.ADD_DATA_URI_TAGS,$):_r,Pe=te(l,"FORBID_CONTENTS")?k({},l.FORBID_CONTENTS,$):Ar,ft=te(l,"FORBID_TAGS")?k({},l.FORBID_TAGS,$):ce({}),wu=te(l,"FORBID_ATTR")?k({},l.FORBID_ATTR,$):ce({}),Oe=te(l,"USE_PROFILES")?l.USE_PROFILES:!1,hr=l.ALLOW_ARIA_ATTR!==!1,Du=l.ALLOW_DATA_ATTR!==!1,pr=l.ALLOW_UNKNOWN_PROTOCOLS||!1,br=l.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Be=l.SAFE_FOR_TEMPLATES||!1,It=l.SAFE_FOR_XML!==!1,ke=l.WHOLE_DOCUMENT||!1,Ne=l.RETURN_DOM||!1,Rt=l.RETURN_DOM_FRAGMENT||!1,Mt=l.RETURN_TRUSTED_TYPE||!1,Tu=l.FORCE_BODY||!1,gr=l.SANITIZE_DOM!==!1,mr=l.SANITIZE_NAMED_PROPS||!1,Fu=l.KEEP_CONTENT!==!1,ht=l.IN_PLACE||!1,lr=l.ALLOWED_URI_REGEXP||ur,$e=l.NAMESPACE||le,Bt=l.MATHML_TEXT_INTEGRATION_POINTS||Bt,Nt=l.HTML_INTEGRATION_POINTS||Nt,R=l.CUSTOM_ELEMENT_HANDLING||{},l.CUSTOM_ELEMENT_HANDLING&&yr(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(R.tagNameCheck=l.CUSTOM_ELEMENT_HANDLING.tagNameCheck),l.CUSTOM_ELEMENT_HANDLING&&yr(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(R.attributeNameCheck=l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),l.CUSTOM_ELEMENT_HANDLING&&typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(R.allowCustomizedBuiltInElements=l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Be&&(Du=!1),Rt&&(Ne=!0),Oe&&(P=k({},Jn),z=[],Oe.html===!0&&(k(P,Kn),k(z,er)),Oe.svg===!0&&(k(P,_u),k(z,Eu),k(z,Tt)),Oe.svgFilters===!0&&(k(P,Cu),k(z,Eu),k(z,Tt)),Oe.mathMl===!0&&(k(P,yu),k(z,tr),k(z,Tt))),l.ADD_TAGS&&(typeof l.ADD_TAGS=="function"?Ue.tagCheck=l.ADD_TAGS:(P===dr&&(P=ce(P)),k(P,l.ADD_TAGS,$))),l.ADD_ATTR&&(typeof l.ADD_ATTR=="function"?Ue.attributeCheck=l.ADD_ATTR:(z===fr&&(z=ce(z)),k(z,l.ADD_ATTR,$))),l.ADD_URI_SAFE_ATTR&&k(Iu,l.ADD_URI_SAFE_ATTR,$),l.FORBID_CONTENTS&&(Pe===Ar&&(Pe=ce(Pe)),k(Pe,l.FORBID_CONTENTS,$)),Fu&&(P["#text"]=!0),ke&&k(P,["html","head","body"]),P.table&&(k(P,["tbody"]),delete ft.tbody),l.TRUSTED_TYPES_POLICY){if(typeof l.TRUSTED_TYPES_POLICY.createHTML!="function")throw st('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof l.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw st('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');m=l.TRUSTED_TYPES_POLICY,E=m.createHTML("")}else m===void 0&&(m=qa(p,r)),m!==null&&typeof E=="string"&&(E=m.createHTML(""));j&&j(l),ze=l}},Er=k({},[..._u,...Cu,...Ra]),vr=k({},[...yu,...Ma]),t0=function(l){let b=C(l);(!b||!b.tagName)&&(b={namespaceURI:$e,tagName:"template"});const A=St(l.tagName),I=St(b.tagName);return Mu[l.namespaceURI]?l.namespaceURI===Ut?b.namespaceURI===le?A==="svg":b.namespaceURI===Lt?A==="svg"&&(I==="annotation-xml"||Bt[I]):!!Er[A]:l.namespaceURI===Lt?b.namespaceURI===le?A==="math":b.namespaceURI===Ut?A==="math"&&Nt[I]:!!vr[A]:l.namespaceURI===le?b.namespaceURI===Ut&&!Nt[I]||b.namespaceURI===Lt&&!Bt[I]?!1:!vr[A]&&(Xa[A]||!Er[A]):!!(pt==="application/xhtml+xml"&&Mu[l.namespaceURI]):!1},se=function(l){it(t.removed,{element:l});try{C(l).removeChild(l)}catch{w(l)}},we=function(l,b){try{it(t.removed,{attribute:b.getAttributeNode(l),from:b})}catch{it(t.removed,{attribute:null,from:b})}if(b.removeAttribute(l),l==="is")if(Ne||Rt)try{se(b)}catch{}else try{b.setAttribute(l,"")}catch{}},kr=function(l){let b=null,A=null;if(Tu)l="<remove></remove>"+l;else{const L=xu(l,/^[\r\n\t ]+/);A=L&&L[0]}pt==="application/xhtml+xml"&&$e===le&&(l='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+l+"</body></html>");const I=m?m.createHTML(l):l;if($e===le)try{b=new g().parseFromString(I,pt)}catch{}if(!b||!b.documentElement){b=D.createDocument($e,"template",null);try{b.documentElement.innerHTML=Ru?E:I}catch{}}const q=b.body||b.documentElement;return l&&A&&q.insertBefore(u.createTextNode(A),q.childNodes[0]||null),$e===le?oe.call(b,ke?"html":"body")[0]:ke?b.documentElement:q},wr=function(l){return U.call(l.ownerDocument||l,l,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Uu=function(l){return l instanceof f&&(typeof l.nodeName!="string"||typeof l.textContent!="string"||typeof l.removeChild!="function"||!(l.attributes instanceof d)||typeof l.removeAttribute!="function"||typeof l.setAttribute!="function"||typeof l.namespaceURI!="string"||typeof l.insertBefore!="function"||typeof l.hasChildNodes!="function")},Dr=function(l){return typeof s=="function"&&l instanceof s};function de(x,l,b){Dt(x,A=>{A.call(t,l,b,ze)})}const Sr=function(l){let b=null;if(de(B.beforeSanitizeElements,l,null),Uu(l))return se(l),!0;const A=$(l.nodeName);if(de(B.uponSanitizeElement,l,{tagName:A,allowedTags:P}),It&&l.hasChildNodes()&&!Dr(l.firstElementChild)&&Y(/<[/\w!]/g,l.innerHTML)&&Y(/<[/\w!]/g,l.textContent)||l.nodeType===ct.progressingInstruction||It&&l.nodeType===ct.comment&&Y(/<[/\w]/g,l.data))return se(l),!0;if(!(Ue.tagCheck instanceof Function&&Ue.tagCheck(A))&&(!P[A]||ft[A])){if(!ft[A]&&Fr(A)&&(R.tagNameCheck instanceof RegExp&&Y(R.tagNameCheck,A)||R.tagNameCheck instanceof Function&&R.tagNameCheck(A)))return!1;if(Fu&&!Pe[A]){const I=C(l)||l.parentNode,q=y(l)||l.childNodes;if(q&&I){const L=q.length;for(let W=L-1;W>=0;--W){const fe=v(q[W],!0);fe.__removalCount=(l.__removalCount||0)+1,I.insertBefore(fe,S(l))}}}return se(l),!0}return l instanceof a&&!t0(l)||(A==="noscript"||A==="noembed"||A==="noframes")&&Y(/<\/no(script|embed|frames)/i,l.innerHTML)?(se(l),!0):(Be&&l.nodeType===ct.text&&(b=l.textContent,Dt([lt,dt,Le],I=>{b=ot(b,I," ")}),l.textContent!==b&&(it(t.removed,{element:l.cloneNode()}),l.textContent=b)),de(B.afterSanitizeElements,l,null),!1)},Tr=function(l,b,A){if(gr&&(b==="id"||b==="name")&&(A in u||A in e0))return!1;if(!(Du&&!wu[b]&&Y(xe,b))){if(!(hr&&Y(ku,b))){if(!(Ue.attributeCheck instanceof Function&&Ue.attributeCheck(b,l))){if(!z[b]||wu[b]){if(!(Fr(l)&&(R.tagNameCheck instanceof RegExp&&Y(R.tagNameCheck,l)||R.tagNameCheck instanceof Function&&R.tagNameCheck(l))&&(R.attributeNameCheck instanceof RegExp&&Y(R.attributeNameCheck,b)||R.attributeNameCheck instanceof Function&&R.attributeNameCheck(b,l))||b==="is"&&R.allowCustomizedBuiltInElements&&(R.tagNameCheck instanceof RegExp&&Y(R.tagNameCheck,A)||R.tagNameCheck instanceof Function&&R.tagNameCheck(A))))return!1}else if(!Iu[b]){if(!Y(lr,ot(A,cr,""))){if(!((b==="src"||b==="xlink:href"||b==="href")&&l!=="script"&&Sa(A,"data:")===0&&xr[l])){if(!(pr&&!Y(Ga,ot(A,cr,"")))){if(A)return!1}}}}}}}return!0},Fr=function(l){return l!=="annotation-xml"&&xu(l,Va)},Ir=function(l){de(B.beforeSanitizeAttributes,l,null);const{attributes:b}=l;if(!b||Uu(l))return;const A={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0};let I=b.length;for(;I--;){const q=b[I],{name:L,namespaceURI:W,value:fe}=q,He=$(L),Bu=fe;let H=L==="value"?Bu:Ta(Bu);if(A.attrName=He,A.attrValue=H,A.keepAttr=!0,A.forceKeepAttr=void 0,de(B.uponSanitizeAttribute,l,A),H=A.attrValue,mr&&(He==="id"||He==="name")&&(we(L,l),H=Wa+H),It&&Y(/((--!?|])>)|<\/(style|title|textarea)/i,H)){we(L,l);continue}if(He==="attributename"&&xu(H,"href")){we(L,l);continue}if(A.forceKeepAttr)continue;if(!A.keepAttr){we(L,l);continue}if(!br&&Y(/\/>/i,H)){we(L,l);continue}Be&&Dt([lt,dt,Le],Mr=>{H=ot(H,Mr," ")});const Rr=$(l.nodeName);if(!Tr(Rr,He,H)){we(L,l);continue}if(m&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!W)switch(p.getAttributeType(Rr,He)){case"TrustedHTML":{H=m.createHTML(H);break}case"TrustedScriptURL":{H=m.createScriptURL(H);break}}if(H!==Bu)try{W?l.setAttributeNS(W,L,H):l.setAttribute(L,H),Uu(l)?se(l):Xn(t.removed)}catch{we(L,l)}}de(B.afterSanitizeAttributes,l,null)},u0=function x(l){let b=null;const A=wr(l);for(de(B.beforeSanitizeShadowDOM,l,null);b=A.nextNode();)de(B.uponSanitizeShadowNode,b,null),Sr(b),Ir(b),b.content instanceof i&&x(b.content);de(B.afterSanitizeShadowDOM,l,null)};return t.sanitize=function(x){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=null,A=null,I=null,q=null;if(Ru=!x,Ru&&(x="<!-->"),typeof x!="string"&&!Dr(x))if(typeof x.toString=="function"){if(x=x.toString(),typeof x!="string")throw st("dirty is not a string, aborting")}else throw st("toString is not a function");if(!t.isSupported)return x;if(Su||Lu(l),t.removed=[],typeof x=="string"&&(ht=!1),ht){if(x.nodeName){const fe=$(x.nodeName);if(!P[fe]||ft[fe])throw st("root node is forbidden and cannot be sanitized in-place")}}else if(x instanceof s)b=kr("<!---->"),A=b.ownerDocument.importNode(x,!0),A.nodeType===ct.element&&A.nodeName==="BODY"||A.nodeName==="HTML"?b=A:b.appendChild(A);else{if(!Ne&&!Be&&!ke&&x.indexOf("<")===-1)return m&&Mt?m.createHTML(x):x;if(b=kr(x),!b)return Ne?null:Mt?E:""}b&&Tu&&se(b.firstChild);const L=wr(ht?x:b);for(;I=L.nextNode();)Sr(I),Ir(I),I.content instanceof i&&u0(I.content);if(ht)return x;if(Ne){if(Rt)for(q=X.call(b.ownerDocument);b.firstChild;)q.appendChild(b.firstChild);else q=b;return(z.shadowroot||z.shadowrootmode)&&(q=ve.call(n,q,!0)),q}let W=ke?b.outerHTML:b.innerHTML;return ke&&P["!doctype"]&&b.ownerDocument&&b.ownerDocument.doctype&&b.ownerDocument.doctype.name&&Y(nr,b.ownerDocument.doctype.name)&&(W="<!DOCTYPE "+b.ownerDocument.doctype.name+`>
|
|
1707
|
+
`+W),Be&&Dt([lt,dt,Le],fe=>{W=ot(W,fe," ")}),m&&Mt?m.createHTML(W):W},t.setConfig=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Lu(x),Su=!0},t.clearConfig=function(){ze=null,Su=!1},t.isValidAttribute=function(x,l,b){ze||Lu({});const A=$(x),I=$(l);return Tr(A,I,b)},t.addHook=function(x,l){typeof l=="function"&&it(B[x],l)},t.removeHook=function(x,l){if(l!==void 0){const b=wa(B[x],l);return b===-1?void 0:Da(B[x],b,1)[0]}return Xn(B[x])},t.removeHooks=function(x){B[x]=[]},t.removeAllHooks=function(){B=ir()},t}var ja=or();const Ft=class Ft extends Xe{constructor(){super(...arguments),this.open=!1,this.message="",this.titleText="Rio Insight",this.buttonLabel="Rio Insight",this.placeholder="Pergunte alguma coisa",this.accentColor="#008B9A",this.apiBaseUrl="",this.rioToken="",this.suggestionsSource="",this.randomizedSuggestions=[],this.messages=[],this.isLoading=!1,this.errorMessage="",this.showConversations=!1,this.conversationSearch="",this.conversationMenuId=null,this.conversationMenuPlacement="below",this.isFullscreen=!1,this.showNewConversationShortcut=!1,this.conversationScrollbar={height:0,top:0,visible:!1},this.conversationHistoryLoading=!1,this.conversationHistoryError="",this.deleteConversationTarget=null,this.renameConversationTarget=null,this.shortAnswerEnabled=!1,this.conversationActionError=null,this.loadingLabelInternal="Rio Insight está respondendo...",this.loadingTimerSlow=null,this.loadingTimerTimeout=null,this.refreshConversationsAfterResponse=!1,this.activeConversationTitle=null,this.headerActions=[],this.homeUrl="",this.pendingConversationAction=null,this.conversationScrollbarRaf=null,this.rioClient=null,this.rioUnsubscribe=null,this.loadingTimer=null,this.currentConversationId=null,this.conversationCounter=0,this.conversationUserId=null,this.conversationScrollbarDraggingId=null,this.conversationScrollbarDragState=null,this.markdownRenderer=new K({html:!1,linkify:!0,breaks:!0}).use(ya),this.conversations=[]}get loadingLabel(){return this.loadingLabelInternal}generateConversationId(){this.conversationUserId||(this.conversationUserId=this.inferUserIdFromToken());const u=`default-${this.conversationUserId??"user"}-${this.randomId(8)}`;return console.info("[RioAssist][conversation] gerando conversationId",u),u}inferUserIdFromToken(){const t=this.rioToken.trim();if(!t||!t.includes("."))return null;const[,u]=t.split(".");try{const n=JSON.parse(atob(u.replace(/-/g,"+").replace(/_/g,"/"))),r=(n==null?void 0:n.userId)??(n==null?void 0:n.user_id)??(n==null?void 0:n.sub)??(n==null?void 0:n.id)??(n==null?void 0:n.email)??(n==null?void 0:n.username);if(r&&typeof r=="string")return r.replace(/[^a-zA-Z0-9_-]/g,"")}catch{return null}return null}randomId(t){const u="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let n="";for(let r=0;r<t;r+=1)n+=u.charAt(Math.floor(Math.random()*u.length));return n}get suggestions(){return this.randomizedSuggestions}parseSuggestions(t){return t?t.split("|").map(u=>u.trim()).filter(Boolean):[]}pickRandomSuggestions(t,u){if(t.length<=u)return[...t];const n=[...t];for(let r=n.length-1;r>0;r-=1){const i=Math.floor(Math.random()*(r+1));[n[r],n[i]]=[n[i],n[r]]}return n.slice(0,u)}willUpdate(t){super.willUpdate(t),t.has("suggestionsSource")&&(this.randomizedSuggestions=this.pickRandomSuggestions(this.parseSuggestions(this.suggestionsSource),3))}updated(t){super.updated(t),this.style.setProperty("--accent-color",this.accentColor),(t.has("isFullscreen")||t.has("showConversations")||t.has("conversations"))&&this.enqueueConversationScrollbarMeasure(),(t.has("messages")||t.has("isLoading")&&this.isLoading||t.has("open")&&this.open||t.has("isFullscreen")&&this.isFullscreen)&&this.scrollConversationToBottom()}firstUpdated(){this.enqueueConversationScrollbarMeasure()}disconnectedCallback(){super.disconnectedCallback(),this.conversationScrollbarRaf!==null&&(cancelAnimationFrame(this.conversationScrollbarRaf),this.conversationScrollbarRaf=null),this.teardownRioClient(),this.clearLoadingGuard()}get filteredConversations(){const t=this.conversationSearch.trim().toLowerCase();return t?this.conversations.filter(u=>u.title.toLowerCase().includes(t)):this.conversations}get hasActiveConversation(){return this.messages.length>0}togglePanel(){if(this.isFullscreen){this.exitFullscreen(!1);return}this.open=!this.open,this.dispatchEvent(new CustomEvent(this.open?"rioassist:open":"rioassist:close",{bubbles:!0,composed:!0}))}closePanel(){this.isFullscreen=!1,this.open&&this.togglePanel()}openConversationsPanel(){this.showConversations=!0,this.requestConversationHistory()}closeConversationsPanel(){this.showConversations=!1,this.conversationMenuId=null}toggleConversationsPanel(){if(this.showConversations=!this.showConversations,!this.showConversations){this.conversationMenuId=null;return}this.requestConversationHistory()}toggleNewConversationShortcut(){this.showNewConversationShortcut=!this.showNewConversationShortcut}toggleShortAnswers(){this.shortAnswerEnabled=!this.shortAnswerEnabled}handleConversationSelect(t){t&&(this.showConversations=!1,this.conversationMenuId=null,this.errorMessage="",this.currentConversationId=t,this.activeConversationTitle=this.lookupConversationTitle(t),console.info("[RioAssist][history] carregando conversa",t),this.requestConversationHistory(t))}handleConversationSearch(t){this.conversationSearch=t.target.value}handleConversationMenuToggle(t,u){if(t.stopPropagation(),this.conversationMenuId===u){this.conversationMenuId=null;return}const n=t.currentTarget,r=this.renderRoot.querySelector(".conversations-panel__surface");if(n&&r){const i=n.getBoundingClientRect(),s=r.getBoundingClientRect().bottom-i.bottom;this.conversationMenuPlacement=s<140?"above":"below"}else this.conversationMenuPlacement="below";this.conversationMenuId=u}handleConversationsPanelPointer(t){const u=t.target;!u.closest(".conversation-menu")&&!u.closest(".conversation-menu-button")&&(this.conversationMenuId=null)}handleConversationAction(t,u){this.conversationMenuId=null;const n=this.conversations.findIndex(i=>i.id===u);if(n===-1)return;const r=this.conversations[n];if(t==="delete"){this.deleteConversationTarget={id:r.id,title:r.title,index:n};return}this.renameConversationTarget={id:r.id,title:r.title,index:n,draft:r.title}}handleHomeNavigation(){const t={url:this.homeUrl||null};this.dispatchEvent(new CustomEvent("rioassist:home",{detail:t,bubbles:!0,composed:!0,cancelable:!0}))&&this.homeUrl&&window.location.assign(this.homeUrl)}applyConversationRename(t,u){if(!t||!u)return;let n=!1;this.conversations=this.conversations.map(r=>r.id===t?(n=!0,{...r,title:u}):r),n&&this.currentConversationId===t&&(this.activeConversationTitle=u)}applyConversationDeletion(t){if(!t)return;const u=this.currentConversationId===t,n=this.conversations.filter(r=>r.id!==t);n.length!==this.conversations.length&&(this.conversations=n,u&&(this.currentConversationId=null,this.activeConversationTitle=null,this.messages=[]))}restoreConversationSnapshot(t,u){if(!t||this.conversations.some(o=>o.id===t.id))return;const r=[...this.conversations],i=u>=0&&u<=r.length?u:r.length;r.splice(i,0,t),this.conversations=r}async confirmDeleteConversation(){const t=this.deleteConversationTarget;if(!t)return;const u=this.conversations[t.index]??this.conversations.find(i=>i.id===t.id)??{id:t.id,title:t.title,updatedAt:new Date().toISOString()},n=this.currentConversationId===t.id;if(this.pendingConversationAction={action:"delete",conversationId:t.id,originalTitle:t.title,index:t.index,snapshot:u,messagesSnapshot:n?[...this.messages]:void 0,wasActive:n},await this.dispatchConversationAction("delete",{id:t.id,title:t.title},t.index)){this.deleteConversationTarget=null;return}this.pendingConversationAction=null}cancelDeleteConversation(){this.deleteConversationTarget=null}handleRenameDraft(t){this.renameConversationTarget&&(this.renameConversationTarget={...this.renameConversationTarget,draft:t.target.value})}async confirmRenameConversation(){const t=this.renameConversationTarget;if(!t)return;const u=t.draft.trim();if(!u)return;if(this.pendingConversationAction={action:"rename",conversationId:t.id,originalTitle:t.title,index:t.index,newTitle:u},await this.dispatchConversationAction("rename",{id:t.id,title:u},t.index,u)){this.renameConversationTarget=null;return}this.pendingConversationAction=null}cancelRenameConversation(){this.renameConversationTarget=null}cancelConversationActionError(){this.conversationActionError=null,this.pendingConversationAction=null}async retryConversationAction(){const t=this.conversationActionError;if(!t)return;const u=typeof t.index=="number"?t.index:this.conversations.findIndex(i=>i.id===t.conversationId),n=u>=0?u:this.conversations.length>0?this.conversations.length-1:0,r=t.snapshot??this.conversations.find(i=>i.id===t.conversationId)??{id:t.conversationId,title:t.originalTitle,updatedAt:new Date().toISOString()};this.pendingConversationAction={action:t.action,conversationId:t.conversationId,originalTitle:t.originalTitle,index:n,newTitle:t.newTitle,snapshot:r,messagesSnapshot:t.messagesSnapshot,wasActive:t.wasActive},this.conversationActionError=null,await this.dispatchConversationAction(t.action,{id:t.conversationId,title:t.newTitle??t.originalTitle},n,t.newTitle)}async dispatchConversationAction(t,u,n,r){const i=t==="rename"?"rioassist:conversation-rename":"rioassist:conversation-delete",o={id:u.id,title:u.title,index:n,action:t};return this.dispatchEvent(new CustomEvent(i,{detail:o,bubbles:!0,composed:!0,cancelable:!0}))?t==="delete"?await this.syncConversationDeleteBackend(u.id):t==="rename"&&r?await this.syncConversationRenameBackend(u.id,r):!1:!1}async syncConversationRenameBackend(t,u){try{return await this.ensureRioClient().renameConversation(t,u),this.applyConversationRename(t,u),this.conversationHistoryError="",!0}catch(n){return console.error("[RioAssist][history] erro ao renomear conversa",n),this.conversationHistoryError=n instanceof Error&&n.message?n.message:"Nao foi possivel renomear a conversa.",!1}}async syncConversationDeleteBackend(t){try{return await this.ensureRioClient().deleteConversation(t),this.applyConversationDeletion(t),this.conversationHistoryError="",!0}catch(u){return console.error("[RioAssist][history] erro ao excluir conversa",u),this.conversationHistoryError=u instanceof Error&&u.message?u.message:"Nao foi possivel excluir a conversa.",!1}}handleConversationSystemAction(t){const u=(t.action??"").toLowerCase();if(u==="conversationrenamed"){const n=t.data,r=this.extractString(n,["conversationId","id"]),i=this.extractString(n,["newTitle","title"]);return r&&i&&(this.applyConversationRename(r,i),this.conversationHistoryError="",this.pendingConversationAction&&this.pendingConversationAction.conversationId===r&&this.pendingConversationAction.action==="rename"&&(this.pendingConversationAction=null,this.conversationActionError=null)),!0}if(u==="conversationdeleted"){const n=t.data,r=this.extractString(n,["conversationId","id"]);return r&&(this.applyConversationDeletion(r),this.conversationHistoryError="",this.pendingConversationAction&&this.pendingConversationAction.conversationId===r&&this.pendingConversationAction.action==="delete"&&(this.pendingConversationAction=null,this.conversationActionError=null)),!0}return u==="processing"}handleConversationActionError(t){if((t.action??"").toLowerCase()!=="error")return!1;const n=t.data,r=this.extractString(n,["error","message","detail","description"])||(typeof t.text=="string"&&t.text.trim()?t.text:"O agente retornou um erro ao processar a conversa."),i=this.pendingConversationAction;return i?(i.action==="rename"&&this.applyConversationRename(i.conversationId,i.originalTitle),i.action==="delete"&&(this.restoreConversationSnapshot(i.snapshot,i.index),i.wasActive&&(this.currentConversationId=i.conversationId,this.activeConversationTitle=i.originalTitle,this.messages=i.messagesSnapshot??this.messages)),this.conversationActionError={...i,message:r},this.pendingConversationAction=null,this.clearLoadingGuard(),this.isLoading=!1,!0):(this.errorMessage=r,this.clearLoadingGuard(),this.isLoading=!1,!0)}shouldIgnoreAssistantPayload(t){if(!t)return!1;const u=t.toLowerCase();return u==="processing"||u==="conversationrenamed"||u==="conversationdeleted"}extractString(t,u){if(!t||typeof t!="object")return null;for(const n of u){const r=t[n];if(typeof r=="string"&&r.trim())return r}return null}handleHeaderActionClick(t,u){const n={index:u,id:t.id??null,ariaLabel:t.ariaLabel??null,iconUrl:t.iconUrl};this.dispatchEvent(new CustomEvent("rioassist:header-action",{detail:n,bubbles:!0,composed:!0,cancelable:!0}))&&typeof t.onClick=="function"&&t.onClick()}handleCloseAction(){if(this.isFullscreen){this.exitFullscreen(!0);return}this.showConversations?this.closeConversationsPanel():this.closePanel()}enterFullscreen(){this.isFullscreen||(this.isFullscreen=!0,this.open=!1,this.showConversations=!1,this.requestConversationHistory())}exitFullscreen(t){this.isFullscreen&&(this.isFullscreen=!1,this.conversationMenuId=null,this.showNewConversationShortcut=!1,t&&(this.open=!0))}handleCreateConversation(){this.hasActiveConversation&&(this.clearLoadingGuard(),this.isLoading=!1,this.messages=[],this.message="",this.errorMessage="",this.showConversations=!1,this.teardownRioClient(),this.currentConversationId=this.generateConversationId(),this.activeConversationTitle=null,this.showNewConversationShortcut=!1,this.dispatchEvent(new CustomEvent("rioassist:new-conversation",{bubbles:!0,composed:!0})))}handleConversationListScroll(t){const u=t.currentTarget;u&&this.updateConversationScrollbar(u)}handleConversationScrollbarPointerDown(t){const u=t.currentTarget,n=this.renderRoot.querySelector(".conversation-list--sidebar");if(!u||!n)return;const r=u.getBoundingClientRect(),i=r.height*(this.conversationScrollbar.height/100),o=Math.max(r.height-i,0),s=Math.max(n.scrollHeight-n.clientHeight,1),a=n.scrollTop/s*o,c=t.clientY-r.top,d=c>=a&&c<=a+i,f=d?a:Math.min(Math.max(c-i/2,0),o);d||(n.scrollTop=f/Math.max(o,1)*(n.scrollHeight-n.clientHeight),this.updateConversationScrollbar(n)),u.setPointerCapture(t.pointerId),this.conversationScrollbarDraggingId=t.pointerId,this.conversationScrollbarDragState={startY:t.clientY,startThumbTop:f,trackHeight:r.height,thumbHeight:i,list:n},t.preventDefault()}handleConversationScrollbarPointerMove(t){if(this.conversationScrollbarDraggingId===null||this.conversationScrollbarDraggingId!==t.pointerId||!this.conversationScrollbarDragState)return;const{startY:u,startThumbTop:n,trackHeight:r,thumbHeight:i,list:o}=this.conversationScrollbarDragState,s=Math.max(r-i,0),a=t.clientY-u,c=Math.min(Math.max(n+a,0),s),d=o.scrollHeight-o.clientHeight;d>0&&(o.scrollTop=c/Math.max(s,1)*d,this.updateConversationScrollbar(o)),t.preventDefault()}handleConversationScrollbarPointerUp(t){if(this.conversationScrollbarDraggingId!==t.pointerId)return;const u=t.currentTarget;u==null||u.releasePointerCapture(t.pointerId),this.conversationScrollbarDraggingId=null,this.conversationScrollbarDragState=null}enqueueConversationScrollbarMeasure(){this.conversationScrollbarRaf===null&&(this.conversationScrollbarRaf=requestAnimationFrame(()=>{this.conversationScrollbarRaf=null,this.updateConversationScrollbar()}))}updateConversationScrollbar(t){const u=t??this.renderRoot.querySelector(".conversation-list--sidebar");if(!u){this.conversationScrollbar.visible&&(this.conversationScrollbar={height:0,top:0,visible:!1});return}const{scrollHeight:n,clientHeight:r,scrollTop:i}=u;if(n<=r+1){this.conversationScrollbar.visible&&(this.conversationScrollbar={height:0,top:0,visible:!1});return}const o=r/n,s=Math.max(o*100,8),a=100-s,c=i/(n-r)*(a>0?a:0);this.conversationScrollbar={height:s,top:c,visible:!0}}async onSuggestionClick(t){await this.processMessage(t)}async handleSubmit(t){t.preventDefault(),await this.processMessage(this.message)}createMessage(t,u){return{id:typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random()}`,role:t,text:u,html:this.renderMarkdown(u),timestamp:Date.now()}}async processMessage(t){const u=t.trim();if(!u||this.isLoading)return;const n=this.shortAnswerEnabled?`Quero uma resposta curta sobre: ${u}`:u;this.currentConversationId||(this.currentConversationId=this.generateConversationId(),this.activeConversationTitle=null);const r=this.messages.length===0;this.dispatchEvent(new CustomEvent("rioassist:send",{detail:{message:u,apiBaseUrl:this.apiBaseUrl,token:this.rioToken},bubbles:!0,composed:!0}));const i=this.createMessage("user",n);this.messages=[...this.messages,i],r&&(this.showNewConversationShortcut=!0,this.refreshConversationsAfterResponse=!0),this.message="",this.errorMessage="",this.isLoading=!0,this.startLoadingGuard();try{await this.ensureRioClient().sendMessage(n,this.currentConversationId)}catch(o){this.clearLoadingGuard(),this.isLoading=!1,this.errorMessage=o instanceof Error?o.message:"Nao foi possivel enviar a mensagem para o agente."}}ensureRioClient(){const t=this.rioToken.trim();if(!t)throw new Error("Informe o token RIO em data-rio-token para conectar no websocket do assistente.");return(!this.rioClient||!this.rioClient.matchesToken(t))&&(this.teardownRioClient(),this.rioClient=new Ri(t),this.rioUnsubscribe=this.rioClient.onMessage(u=>{this.handleIncomingMessage(u)})),this.rioClient}handleIncomingMessage(t){if(this.isHistoryPayload(t)){this.logHistoryPayload(t),this.handleHistoryPayload(t.data);return}if(this.handleConversationSystemAction(t)||this.handleConversationActionError(t)||this.shouldIgnoreAssistantPayload(t.action))return;if(console.info("[RioAssist][ws] resposta de mensagem recebida",{action:t.action??"message",text:t.text,raw:t.raw,data:t.data}),t.action==="processing"){console.info("[RioAssist][ws] processando mensagem - aguardando resposta final");return}const u=this.createMessage("assistant",t.text);this.messages=[...this.messages,u],this.clearLoadingGuard(),this.isLoading=!1,this.refreshConversationsAfterResponse&&(this.refreshConversationsAfterResponse=!1,this.requestConversationHistory())}teardownRioClient(){this.rioUnsubscribe&&(this.rioUnsubscribe(),this.rioUnsubscribe=null),this.rioClient&&(this.rioClient.close(),this.rioClient=null)}async requestConversationHistory(t){try{const u=this.ensureRioClient(),n=50;console.info("[RioAssist][history] solicitando historico de conversas",{conversationId:t??null,limit:n}),this.conversationHistoryError="",this.conversationHistoryLoading=!0,await u.requestHistory({conversationId:t,limit:n})}catch(u){console.error("[RioAssist][history] erro ao solicitar historico",u),this.conversationHistoryError=u instanceof Error&&u.message?u.message:"Nao foi possivel carregar as conversas.",this.conversationHistoryLoading=!1}}handleHistoryPayload(t){const u=this.extractHistoryEntries(t),n=this.extractConversationId(t);if(n!=null){this.applyMessageHistory(u,n);return}if(this.isMessageHistoryEntries(u)){this.applyMessageHistory(u);return}this.applyConversationHistoryFromEntries(u),this.refreshConversationsAfterResponse&&(this.refreshConversationsAfterResponse=!1)}isHistoryPayload(t){if(typeof t.action=="string"&&t.action.toLowerCase().includes("history"))return!0;const u=t.data;if(u&&typeof u=="object"){const n=u.action;if(typeof n=="string"&&n.toLowerCase().includes("history")||Array.isArray(u.history)||Array.isArray(u.conversations))return!0}return!1}logHistoryPayload(t){const u="[RioAssist][history] payload recebido do websocket";if(t.data!==null&&t.data!==void 0){console.info(u,t.data);return}console.info(u,t.raw)}applyConversationHistoryFromEntries(t){if(t.length===0){console.info("[RioAssist][history] payload sem itens para montar lista de conversas"),this.conversations=[],this.conversationHistoryLoading=!1,this.conversationHistoryError="";return}const u=new Map;t.forEach((r,i)=>{if(!r||typeof r!="object")return;const o=this.normalizeConversationItem(r,i);if(!o)return;const s=u.get(o.id);if(!s){u.set(o.id,o);return}const a=Date.parse(s.updatedAt),c=Date.parse(o.updatedAt);Number.isFinite(c)&&c>a&&u.set(o.id,o)});const n=Array.from(u.values()).sort((r,i)=>{const o=Date.parse(i.updatedAt)-Date.parse(r.updatedAt);return Number.isFinite(o)?o:0});this.conversations=n,this.conversationHistoryLoading=!1,this.conversationHistoryError="",this.syncActiveConversationTitle(),console.info("[RioAssist][history] conversas normalizadas",n)}applyMessageHistory(t,u){if(t.length===0){console.info("[RioAssist][history] lista de mensagens vazia",{conversationId:u}),this.messages=[],this.showConversations=!1,this.clearLoadingGuard(),this.isLoading=!1,this.conversationHistoryLoading=!1;return}const n=t.flatMap((r,i)=>this.normalizeHistoryMessages(r,i));u&&(this.currentConversationId=u),this.messages=n,this.showConversations=!1,this.clearLoadingGuard(),this.isLoading=!1,this.showNewConversationShortcut=n.length>0,this.conversationHistoryLoading=!1,this.refreshConversationsAfterResponse=!1,console.info("[RioAssist][history] mensagens carregadas",{conversationId:u??null,total:n.length})}extractHistoryEntries(t){if(Array.isArray(t))return t;if(t&&typeof t=="object"){const u=t,n=[u.history,u.conversations,u.data,u.items,u.messages];for(const r of n)if(Array.isArray(r))return r;if(u.data&&typeof u.data=="object"&&!Array.isArray(u.data)){const r=this.extractHistoryEntries(u.data);if(r.length>0)return r}}return[]}extractConversationId(t){if(t&&typeof t=="object"){const u=t,n=[u.conversationId,u.conversationUUID,u.conversationUuid,u.uuid,u.id];for(const r of n){if(r===null)return null;if(r!==void 0)return String(r)}}}isMessageHistoryEntries(t){return t.some(u=>this.looksLikeMessageHistoryEntry(u))}looksLikeMessageHistoryEntry(t){if(!t||typeof t!="object")return!1;const u=t,n=u.role??u.sender??u.from??u.author??u.type;return!!(typeof n=="string"&&n.trim().length>0||typeof u.content=="string"||typeof u.message=="string"||typeof u.text=="string"||typeof u.response=="string"||Array.isArray(u.parts)&&u.parts.length>0)}normalizeConversationItem(t,u){const n=t.id??t.conversationId??t.conversationUUID??t.conversationUuid??t.uuid,r=n!=null?String(n):`history-${u+1}`,i=t.title??t.name??t.topic??t.subject??t.question??t.query??t.message,o=typeof i=="string"&&i.trim().length>0?i.trim():`Conversa ${u+1}`,s=t.updatedAt??t.updated_at??t.lastMessageAt??t.last_message_at??t.createdAt??t.created_at??t.timestamp??t.date,a=this.toIsoString(s);return{id:r,title:o,updatedAt:a}}normalizeHistoryMessages(t,u){const n=[],r=t.message??t.question??t.query??t.text??t.content,i=typeof r=="string"?r.trim():"",o=t.response??t.answer??t.reply??t.completion??t.body??t.preview,s=typeof o=="string"?o.trim():"",a=t.id??t.messageId??t.uuid??t.conversationMessageId,c=a!=null?String(a):`history-${u+1}`,d=t.timestamp??t.createdAt??t.created_at??t.date??t.time,f=t.responseTimestamp??t.responseTime??t.responseDate??t.response_at??t.updatedAt??t.updated_at,g=this.parseTimestamp(d),p=this.parseTimestamp(f,g+1);if(s)i&&n.push({id:`${c}-user`,role:"user",text:i,html:this.renderMarkdown(i),timestamp:g}),n.push({id:`${c}-assistant`,role:"assistant",text:s,html:this.renderMarkdown(s),timestamp:p});else if(i)return[];if(n.length>0)return n;const h=this.normalizeSingleHistoryMessage(t,u);return h?[h]:[]}normalizeSingleHistoryMessage(t,u){const n=t.text??t.message??t.content??t.response??t.body??t.preview,r=typeof n=="string"&&n.trim().length>0?n:"";if(!r)return null;const i=this.normalizeRole(t.role??t.sender??t.from??t.author??t.type??t.direction),o=t.id??t.messageId??t.uuid??t.conversationMessageId,s=o!=null?String(o):`history-message-${u+1}`,a=t.timestamp??t.createdAt??t.created_at??t.updatedAt??t.updated_at??t.date??t.time,c=this.parseTimestamp(a);return{id:s,role:i,text:r,html:this.renderMarkdown(r),timestamp:c}}normalizeRole(t){if(typeof t=="string"){const u=t.toLowerCase();if(u.includes("user")||u.includes("client"))return"user";if(u.includes("assistant")||u.includes("agent")||u.includes("bot"))return"assistant"}return"assistant"}parseTimestamp(t,u){const n=Date.parse(this.toIsoString(t));return Number.isFinite(n)?n:Number.isFinite(u??NaN)?u:Date.now()}lookupConversationTitle(t){if(!t)return null;const u=this.conversations.find(n=>n.id===t);return u?u.title:null}syncActiveConversationTitle(){if(!this.currentConversationId)return;const t=this.lookupConversationTitle(this.currentConversationId);t&&(this.activeConversationTitle=t)}toIsoString(t){if(typeof t=="string"||typeof t=="number"){const u=new Date(t);if(!Number.isNaN(u.getTime()))return u.toISOString()}return new Date().toISOString()}startLoadingGuard(){this.clearLoadingGuard(),this.loadingLabelInternal="RIO Insight está respondendo",this.loadingTimerSlow=window.setTimeout(()=>{this.loadingLabelInternal="RIO Insight continua respondendo",this.requestUpdate()},2e4),this.loadingTimerTimeout=window.setTimeout(()=>{this.loadingLabelInternal="RIO Insight ainda está processando sua resposta. Peço que aguarde um pouco mais",this.requestUpdate()},6e4),this.loadingTimerTimeout=window.setTimeout(()=>{this.loadingLabelInternal="Essa solicitação está demorando um pouco mais que o esperado. Pode favor, aguarde mais um pouco",this.requestUpdate()},12e4)}clearLoadingGuard(){this.loadingTimer!==null&&(window.clearTimeout(this.loadingTimer),this.loadingTimer=null),this.loadingTimerSlow!==null&&(window.clearTimeout(this.loadingTimerSlow),this.loadingTimerSlow=null),this.loadingTimerTimeout!==null&&(window.clearTimeout(this.loadingTimerTimeout),this.loadingTimerTimeout=null)}scrollConversationToBottom(){Array.from(this.renderRoot.querySelectorAll(".panel-content")).forEach(u=>{requestAnimationFrame(()=>{u.scrollTop=u.scrollHeight})})}renderMarkdown(t){const u=this.markdownRenderer.render(t),n=ja.sanitize(u,{ALLOWED_TAGS:["a","p","ul","ol","li","code","pre","strong","em","blockquote","table","thead","tbody","tr","th","td","del","hr","br","img","span","input"],ALLOWED_ATTR:["href","title","target","rel","src","alt","class","type","checked","disabled","aria-label"],ALLOW_DATA_ATTR:!1,FORBID_TAGS:["style","script"],USE_PROFILES:{html:!0}}),r=document.createElement("div");return r.innerHTML=n,r.querySelectorAll("a").forEach(i=>{i.setAttribute("target","_blank"),i.setAttribute("rel","noopener noreferrer")}),r.querySelectorAll('input[type="checkbox"]').forEach(i=>{i.setAttribute("disabled",""),i.setAttribute("tabindex","-1")}),r.innerHTML}render(){return Ti(this)}};Ft.styles=ni,Ft.properties={open:{type:Boolean,state:!0},message:{type:String,state:!0},titleText:{type:String,attribute:"data-title"},buttonLabel:{type:String,attribute:"data-button-label"},placeholder:{type:String,attribute:"data-placeholder"},accentColor:{type:String,attribute:"data-accent-color"},apiBaseUrl:{type:String,attribute:"data-api-base-url"},rioToken:{type:String,attribute:"data-rio-token"},suggestionsSource:{type:String,attribute:"data-suggestions"},messages:{state:!0},isLoading:{type:Boolean,state:!0},errorMessage:{type:String,state:!0},showConversations:{type:Boolean,state:!0},conversationSearch:{type:String,state:!0},conversationMenuId:{state:!0},conversationMenuPlacement:{state:!0},isFullscreen:{type:Boolean,state:!0},conversationScrollbar:{state:!0},showNewConversationShortcut:{type:Boolean,state:!0},conversations:{state:!0},conversationHistoryLoading:{type:Boolean,state:!0},activeConversationTitle:{state:!0},conversationHistoryError:{type:String,state:!0},deleteConversationTarget:{attribute:!1},renameConversationTarget:{attribute:!1},shortAnswerEnabled:{type:Boolean,state:!0},conversationActionError:{attribute:!1},headerActions:{attribute:!1},homeUrl:{type:String,attribute:"data-home-url"}};let vu=Ft;customElements.get("rio-assist-widget")||customElements.define("rio-assist-widget",vu);const Ya={title:"Rio Insight",buttonLabel:"Rio Insight",placeholder:"Pergunte alguma coisa",suggestions:["Resumo da Frota","Frota Disponível","Chamados Abertos","Parados + Causas","Aguardando Peças","Principais Gargalos","Tempo por Concessionária","Tempo de Ciclo","Preventiva x Corretiva"],accentColor:"#008B9A",apiBaseUrl:"",rioToken:""},sr="rio-assist-widget";function Qa(e={}){const{target:t=document.body,...u}=e;let n=document.querySelector(sr);n||(n=document.createElement(sr),t.appendChild(n));const r={...Ya,...u};Object.entries(r).forEach(([i,o])=>{o!==void 0&&(n==null||n.setAttribute(`data-${i.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`)}`,Array.isArray(o)?o.join("|"):String(o)))})}typeof window<"u"&&(window.RioAssist=window.RioAssist??{init:Qa},window.dispatchEvent(new Event("rio-assist-ready")))})();
|
package/package.json
CHANGED
|
@@ -192,27 +192,37 @@ export const fullscreenStyles = css`
|
|
|
192
192
|
display: flex;
|
|
193
193
|
flex-direction: column;
|
|
194
194
|
align-items: center;
|
|
195
|
-
padding: 36px
|
|
195
|
+
padding: 36px clamp(24px, 4vw, 56px) 18px;
|
|
196
196
|
width: 100%;
|
|
197
197
|
flex: 1;
|
|
198
198
|
min-height: 0;
|
|
199
199
|
overflow: hidden;
|
|
200
200
|
max-width: 1400px;
|
|
201
201
|
margin: 0 auto;
|
|
202
|
+
box-sizing: border-box;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
205
|
.fullscreen-chat .panel-body {
|
|
205
206
|
max-width: 920px;
|
|
206
207
|
width: 100%;
|
|
207
|
-
padding: 12px
|
|
208
|
+
padding: 12px clamp(20px, 3vw, 44px) 12px;
|
|
208
209
|
margin: 0 auto;
|
|
210
|
+
box-sizing: border-box;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.fullscreen-chat .panel-footer {
|
|
214
|
+
max-width: 640px;
|
|
215
|
+
width: 100%;
|
|
216
|
+
padding: 0 clamp(16px, 3vw, 32px);
|
|
217
|
+
box-sizing: border-box;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.fullscreen-chat form {
|
|
221
|
+
max-width: none;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.fullscreen-chat .panel-content {
|
|
225
|
+
padding-right: clamp(12px, 2vw, 24px);
|
|
226
|
+
box-sizing: border-box;
|
|
209
227
|
}
|
|
210
|
-
|
|
211
|
-
.fullscreen-chat .panel-footer {
|
|
212
|
-
max-width: 640px;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
.fullscreen-chat form {
|
|
216
|
-
max-width: none;
|
|
217
|
-
}
|
|
218
228
|
`;
|
|
@@ -105,11 +105,11 @@ export const miniPanelStyles = css`
|
|
|
105
105
|
height: 28px;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
.panel-body {
|
|
109
|
-
flex: 1;
|
|
110
|
-
padding: 48px 32px 12px;
|
|
111
|
-
display: flex;
|
|
112
|
-
flex-direction: column;
|
|
108
|
+
.panel-body {
|
|
109
|
+
flex: 1;
|
|
110
|
+
padding: 48px 32px 12px;
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
113
|
align-items: center;
|
|
114
114
|
gap: 16px;
|
|
115
115
|
max-width: 520px;
|
|
@@ -310,11 +310,68 @@ export const miniPanelStyles = css`
|
|
|
310
310
|
justify-content: center;
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
.suggestions-wrapper {
|
|
314
|
-
width: 100%;
|
|
315
|
-
text-align: center;
|
|
316
|
-
margin-bottom: 6px;
|
|
317
|
-
}
|
|
313
|
+
.suggestions-wrapper {
|
|
314
|
+
width: 100%;
|
|
315
|
+
text-align: center;
|
|
316
|
+
margin-bottom: 6px;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.short-answer-toggle {
|
|
320
|
+
display: inline-flex;
|
|
321
|
+
align-items: center;
|
|
322
|
+
gap: 12px;
|
|
323
|
+
border: 1px solid #d6dde3;
|
|
324
|
+
background: #f7fafc;
|
|
325
|
+
color: #1f2f36;
|
|
326
|
+
border-radius: 999px;
|
|
327
|
+
padding: 8px 12px 8px 10px;
|
|
328
|
+
font-weight: 600;
|
|
329
|
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
|
|
330
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.short-answer-toggle:focus-visible {
|
|
334
|
+
outline: 2px solid var(--accent-color, #008b9a);
|
|
335
|
+
outline-offset: 2px;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.short-answer-toggle__track {
|
|
339
|
+
width: 44px;
|
|
340
|
+
height: 24px;
|
|
341
|
+
border-radius: 999px;
|
|
342
|
+
background: #c7d0d9;
|
|
343
|
+
position: relative;
|
|
344
|
+
transition: background-color 0.2s ease;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.short-answer-toggle__track--on {
|
|
348
|
+
background: #008b9a;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.short-answer-toggle__thumb {
|
|
352
|
+
position: absolute;
|
|
353
|
+
top: 3px;
|
|
354
|
+
left: 4px;
|
|
355
|
+
width: 18px;
|
|
356
|
+
height: 18px;
|
|
357
|
+
border-radius: 50%;
|
|
358
|
+
background: #fff;
|
|
359
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
|
|
360
|
+
transition: transform 0.2s ease;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.short-answer-toggle__track--on .short-answer-toggle__thumb {
|
|
364
|
+
transform: translateX(18px);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.short-answer-toggle__label {
|
|
368
|
+
font-size: 14px;
|
|
369
|
+
white-space: nowrap;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.short-answer-toggle--hero {
|
|
373
|
+
margin-top: 8px;
|
|
374
|
+
}
|
|
318
375
|
|
|
319
376
|
.suggestions-label {
|
|
320
377
|
text-align: center;
|
|
@@ -18,6 +18,24 @@ export const renderChatSurface = (component: RioAssistWidget) => {
|
|
|
18
18
|
<div class="hero-card">
|
|
19
19
|
<img src=${iaCentralIconUrl} alt="IA assistente" class="hero-card__icon" />
|
|
20
20
|
<h3>Como posso te ajudar hoje?</h3>
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
class="short-answer-toggle short-answer-toggle--hero"
|
|
24
|
+
role="switch"
|
|
25
|
+
aria-checked=${component.shortAnswerEnabled}
|
|
26
|
+
@click=${() => component.toggleShortAnswers()}
|
|
27
|
+
>
|
|
28
|
+
<span
|
|
29
|
+
class=${classMap({
|
|
30
|
+
'short-answer-toggle__track': true,
|
|
31
|
+
'short-answer-toggle__track--on': component.shortAnswerEnabled,
|
|
32
|
+
})}
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
>
|
|
35
|
+
<span class="short-answer-toggle__thumb"></span>
|
|
36
|
+
</span>
|
|
37
|
+
<span class="short-answer-toggle__label">Ativar respostas curtas</span>
|
|
38
|
+
</button>
|
|
21
39
|
</div>
|
|
22
40
|
`;
|
|
23
41
|
|
|
@@ -73,6 +91,29 @@ export const renderChatSurface = (component: RioAssistWidget) => {
|
|
|
73
91
|
: null}
|
|
74
92
|
|
|
75
93
|
<div class="panel-footer">
|
|
94
|
+
${hasMessages
|
|
95
|
+
? html`
|
|
96
|
+
<button
|
|
97
|
+
type="button"
|
|
98
|
+
class="short-answer-toggle"
|
|
99
|
+
role="switch"
|
|
100
|
+
aria-checked=${component.shortAnswerEnabled}
|
|
101
|
+
@click=${() => component.toggleShortAnswers()}
|
|
102
|
+
>
|
|
103
|
+
<span
|
|
104
|
+
class=${classMap({
|
|
105
|
+
'short-answer-toggle__track': true,
|
|
106
|
+
'short-answer-toggle__track--on': component.shortAnswerEnabled,
|
|
107
|
+
})}
|
|
108
|
+
aria-hidden="true"
|
|
109
|
+
>
|
|
110
|
+
<span class="short-answer-toggle__thumb"></span>
|
|
111
|
+
</span>
|
|
112
|
+
<span class="short-answer-toggle__label">Ativar respostas curtas</span>
|
|
113
|
+
</button>
|
|
114
|
+
`
|
|
115
|
+
: null}
|
|
116
|
+
|
|
76
117
|
${component.suggestions.length > 0
|
|
77
118
|
? html`
|
|
78
119
|
<div class="suggestions-wrapper">
|
|
@@ -91,6 +91,7 @@ export class RioAssistWidget extends LitElement {
|
|
|
91
91
|
conversationHistoryError: { type: String, state: true },
|
|
92
92
|
deleteConversationTarget: { attribute: false },
|
|
93
93
|
renameConversationTarget: { attribute: false },
|
|
94
|
+
shortAnswerEnabled: { type: Boolean, state: true },
|
|
94
95
|
conversationActionError: { attribute: false },
|
|
95
96
|
headerActions: { attribute: false },
|
|
96
97
|
homeUrl: { type: String, attribute: 'data-home-url' },
|
|
@@ -147,11 +148,13 @@ export class RioAssistWidget extends LitElement {
|
|
|
147
148
|
conversationHistoryLoading = false;
|
|
148
149
|
|
|
149
150
|
conversationHistoryError = '';
|
|
150
|
-
|
|
151
|
-
deleteConversationTarget: ConversationDeleteTarget | null = null;
|
|
152
|
-
|
|
151
|
+
|
|
152
|
+
deleteConversationTarget: ConversationDeleteTarget | null = null;
|
|
153
|
+
|
|
153
154
|
renameConversationTarget: ConversationRenameTarget | null = null;
|
|
154
155
|
|
|
156
|
+
shortAnswerEnabled = false;
|
|
157
|
+
|
|
155
158
|
conversationActionError: ConversationActionErrorState | null = null;
|
|
156
159
|
|
|
157
160
|
private loadingLabelInternal = 'Rio Insight está respondendo...';
|
|
@@ -381,14 +384,18 @@ export class RioAssistWidget extends LitElement {
|
|
|
381
384
|
this.requestConversationHistory();
|
|
382
385
|
}
|
|
383
386
|
|
|
384
|
-
toggleNewConversationShortcut() {
|
|
385
|
-
this.showNewConversationShortcut = !this.showNewConversationShortcut;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
387
|
+
toggleNewConversationShortcut() {
|
|
388
|
+
this.showNewConversationShortcut = !this.showNewConversationShortcut;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
toggleShortAnswers() {
|
|
392
|
+
this.shortAnswerEnabled = !this.shortAnswerEnabled;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
handleConversationSelect(conversationId: string) {
|
|
396
|
+
if (!conversationId) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
392
399
|
|
|
393
400
|
this.showConversations = false;
|
|
394
401
|
this.conversationMenuId = null;
|
|
@@ -1121,16 +1128,20 @@ export class RioAssistWidget extends LitElement {
|
|
|
1121
1128
|
};
|
|
1122
1129
|
}
|
|
1123
1130
|
|
|
1124
|
-
private async processMessage(rawValue: string) {
|
|
1125
|
-
const content = rawValue.trim();
|
|
1126
|
-
if (!content || this.isLoading) {
|
|
1127
|
-
return;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1131
|
+
private async processMessage(rawValue: string) {
|
|
1132
|
+
const content = rawValue.trim();
|
|
1133
|
+
if (!content || this.isLoading) {
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
const contentToSend = this.shortAnswerEnabled
|
|
1138
|
+
? `Quero uma resposta curta sobre: ${content}`
|
|
1139
|
+
: content;
|
|
1140
|
+
|
|
1141
|
+
if (!this.currentConversationId) {
|
|
1142
|
+
this.currentConversationId = this.generateConversationId();
|
|
1143
|
+
this.activeConversationTitle = null;
|
|
1144
|
+
}
|
|
1134
1145
|
|
|
1135
1146
|
const wasEmptyConversation = this.messages.length === 0;
|
|
1136
1147
|
|
|
@@ -1140,31 +1151,31 @@ export class RioAssistWidget extends LitElement {
|
|
|
1140
1151
|
message: content,
|
|
1141
1152
|
apiBaseUrl: this.apiBaseUrl,
|
|
1142
1153
|
token: this.rioToken,
|
|
1143
|
-
},
|
|
1144
|
-
bubbles: true,
|
|
1145
|
-
composed: true,
|
|
1146
|
-
}),
|
|
1147
|
-
);
|
|
1148
|
-
|
|
1149
|
-
const userMessage = this.createMessage('user',
|
|
1150
|
-
this.messages = [...this.messages, userMessage];
|
|
1151
|
-
if (wasEmptyConversation) {
|
|
1152
|
-
this.showNewConversationShortcut = true;
|
|
1153
|
-
this.refreshConversationsAfterResponse = true;
|
|
1154
|
-
}
|
|
1155
|
-
this.message = '';
|
|
1156
|
-
this.errorMessage = '';
|
|
1157
|
-
this.isLoading = true;
|
|
1158
|
-
this.startLoadingGuard();
|
|
1159
|
-
|
|
1160
|
-
try {
|
|
1161
|
-
const client = this.ensureRioClient();
|
|
1162
|
-
await client.sendMessage(
|
|
1163
|
-
} catch (error) {
|
|
1164
|
-
this.clearLoadingGuard();
|
|
1165
|
-
this.isLoading = false;
|
|
1166
|
-
this.errorMessage = error instanceof Error
|
|
1167
|
-
? error.message
|
|
1154
|
+
},
|
|
1155
|
+
bubbles: true,
|
|
1156
|
+
composed: true,
|
|
1157
|
+
}),
|
|
1158
|
+
);
|
|
1159
|
+
|
|
1160
|
+
const userMessage = this.createMessage('user', contentToSend);
|
|
1161
|
+
this.messages = [...this.messages, userMessage];
|
|
1162
|
+
if (wasEmptyConversation) {
|
|
1163
|
+
this.showNewConversationShortcut = true;
|
|
1164
|
+
this.refreshConversationsAfterResponse = true;
|
|
1165
|
+
}
|
|
1166
|
+
this.message = '';
|
|
1167
|
+
this.errorMessage = '';
|
|
1168
|
+
this.isLoading = true;
|
|
1169
|
+
this.startLoadingGuard();
|
|
1170
|
+
|
|
1171
|
+
try {
|
|
1172
|
+
const client = this.ensureRioClient();
|
|
1173
|
+
await client.sendMessage(contentToSend, this.currentConversationId);
|
|
1174
|
+
} catch (error) {
|
|
1175
|
+
this.clearLoadingGuard();
|
|
1176
|
+
this.isLoading = false;
|
|
1177
|
+
this.errorMessage = error instanceof Error
|
|
1178
|
+
? error.message
|
|
1168
1179
|
: 'Nao foi possivel enviar a mensagem para o agente.';
|
|
1169
1180
|
}
|
|
1170
1181
|
}
|