var hr=Object.defineProperty;var gr=(n,e,t)=>e in n?hr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Q=(n,e,t)=>gr(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function t(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=t(r);fetch(r.href,i)}})();const dr=!1,br=(n,e)=>n===e,mr=Symbol("solid-track"),An={equals:br};let Ps=Hs;const ut=1,Sn=2,Bs={owned:null,cleanups:null,context:null,owner:null};var me=null;let Hn=null,_r=null,pe=null,Ae=null,st=null,Ln=0;function kn(n,e){const t=pe,s=me,r=n.length===0,i=e===void 0?s:e,l=r?Bs:{owned:null,cleanups:null,context:i?i.context:null,owner:i},o=r?n:()=>n(()=>sn(()=>nn(l)));me=l,pe=null;try{return on(o,!0)}finally{pe=t,me=s}}function Fe(n,e){e=e?Object.assign({},An,e):An;const t={value:n,observers:null,observerSlots:null,comparator:e.equals||void 0},s=r=>(typeof r=="function"&&(r=r(t.value)),Us(t,r));return[zs.bind(t),s]}function He(n,e,t){const s=Jn(n,e,!1,ut);rn(s)}function hs(n,e,t){Ps=yr;const s=Jn(n,e,!1,ut);s.user=!0,st?st.push(s):rn(s)}function Qt(n,e,t){t=t?Object.assign({},An,t):An;const s=Jn(n,e,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=t.equals||void 0,rn(s),zs.bind(s)}function sn(n){if(pe===null)return n();const e=pe;pe=null;try{return n()}finally{pe=e}}function xr(n){return me===null||(me.cleanups===null?me.cleanups=[n]:me.cleanups.push(n)),n}function zs(){if(this.sources&&this.state)if(this.state===ut)rn(this);else{const n=Ae;Ae=null,on(()=>vn(this),!1),Ae=n}if(pe){const n=this.observers?this.observers.length:0;pe.sources?(pe.sources.push(this),pe.sourceSlots.push(n)):(pe.sources=[this],pe.sourceSlots=[n]),this.observers?(this.observers.push(pe),this.observerSlots.push(pe.sources.length-1)):(this.observers=[pe],this.observerSlots=[pe.sources.length-1])}return this.value}function Us(n,e,t){let s=n.value;return(!n.comparator||!n.comparator(s,e))&&(n.value=e,n.observers&&n.observers.length&&on(()=>{for(let r=0;r<n.observers.length;r+=1){const i=n.observers[r],l=Hn&&Hn.running;l&&Hn.disposed.has(i),(l?!i.tState:!i.state)&&(i.pure?Ae.push(i):st.push(i),i.observers&&Fs(i)),l||(i.state=ut)}if(Ae.length>1e6)throw Ae=[],new Error},!1)),e}function rn(n){if(!n.fn)return;nn(n);const e=Ln;wr(n,n.value,e)}function wr(n,e,t){let s;const r=me,i=pe;pe=me=n;try{s=n.fn(e)}catch(l){return n.pure&&(n.state=ut,n.owned&&n.owned.forEach(nn),n.owned=null),n.updatedAt=t+1,js(l)}finally{pe=i,me=r}(!n.updatedAt||n.updatedAt<=t)&&(n.updatedAt!=null&&"observers"in n?Us(n,s):n.value=s,n.updatedAt=t)}function Jn(n,e,t,s=ut,r){const i={fn:n,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:me,context:me?me.context:null,pure:t};return me===null||me!==Bs&&(me.owned?me.owned.push(i):me.owned=[i]),i}function Rn(n){if(n.state===0)return;if(n.state===Sn)return vn(n);if(n.suspense&&sn(n.suspense.inFallback))return n.suspense.effects.push(n);const e=[n];for(;(n=n.owner)&&(!n.updatedAt||n.updatedAt<Ln);)n.state&&e.push(n);for(let t=e.length-1;t>=0;t--)if(n=e[t],n.state===ut)rn(n);else if(n.state===Sn){const s=Ae;Ae=null,on(()=>vn(n,e[0]),!1),Ae=s}}function on(n,e){if(Ae)return n();let t=!1;e||(Ae=[]),st?t=!0:st=[],Ln++;try{const s=n();return Er(t),s}catch(s){t||(st=null),Ae=null,js(s)}}function Er(n){if(Ae&&(Hs(Ae),Ae=null),n)return;const e=st;st=null,e.length&&on(()=>Ps(e),!1)}function Hs(n){for(let e=0;e<n.length;e++)Rn(n[e])}function yr(n){let e,t=0;for(e=0;e<n.length;e++){const s=n[e];s.user?n[t++]=s:Rn(s)}for(e=0;e<t;e++)Rn(n[e])}function vn(n,e){n.state=0;for(let t=0;t<n.sources.length;t+=1){const s=n.sources[t];if(s.sources){const r=s.state;r===ut?s!==e&&(!s.updatedAt||s.updatedAt<Ln)&&Rn(s):r===Sn&&vn(s,e)}}}function Fs(n){for(let e=0;e<n.observers.length;e+=1){const t=n.observers[e];t.state||(t.state=Sn,t.pure?Ae.push(t):st.push(t),t.observers&&Fs(t))}}function nn(n){let e;if(n.sources)for(;n.sources.length;){const t=n.sources.pop(),s=n.sourceSlots.pop(),r=t.observers;if(r&&r.length){const i=r.pop(),l=t.observerSlots.pop();s<r.length&&(i.sourceSlots[l]=s,r[s]=i,t.observerSlots[s]=l)}}if(n.tOwned){for(e=n.tOwned.length-1;e>=0;e--)nn(n.tOwned[e]);delete n.tOwned}if(n.owned){for(e=n.owned.length-1;e>=0;e--)nn(n.owned[e]);n.owned=null}if(n.cleanups){for(e=n.cleanups.length-1;e>=0;e--)n.cleanups[e]();n.cleanups=null}n.state=0}function kr(n){return n instanceof Error?n:new Error(typeof n=="string"?n:"Unknown error",{cause:n})}function js(n,e=me){throw kr(n)}const Tr=Symbol("fallback");function gs(n){for(let e=0;e<n.length;e++)n[e]()}function Ar(n,e,t={}){let s=[],r=[],i=[],l=0,o=e.length>1?[]:null;return xr(()=>gs(i)),()=>{let f=n()||[],u=f.length,p,g;return f[mr],sn(()=>{let y,N,E,Y,J,ne,G,I,X;if(u===0)l!==0&&(gs(i),i=[],s=[],r=[],l=0,o&&(o=[])),t.fallback&&(s=[Tr],r[0]=kn(we=>(i[0]=we,t.fallback())),l=1);else if(l===0){for(r=new Array(u),g=0;g<u;g++)s[g]=f[g],r[g]=kn(x);l=u}else{for(E=new Array(u),Y=new Array(u),o&&(J=new Array(u)),ne=0,G=Math.min(l,u);ne<G&&s[ne]===f[ne];ne++);for(G=l-1,I=u-1;G>=ne&&I>=ne&&s[G]===f[I];G--,I--)E[I]=r[G],Y[I]=i[G],o&&(J[I]=o[G]);for(y=new Map,N=new Array(I+1),g=I;g>=ne;g--)X=f[g],p=y.get(X),N[g]=p===void 0?-1:p,y.set(X,g);for(p=ne;p<=G;p++)X=s[p],g=y.get(X),g!==void 0&&g!==-1?(E[g]=r[p],Y[g]=i[p],o&&(J[g]=o[p]),g=N[g],y.set(X,g)):i[p]();for(g=ne;g<u;g++)g in E?(r[g]=E[g],i[g]=Y[g],o&&(o[g]=J[g],o[g](g))):r[g]=kn(x);r=r.slice(0,l=u),s=f.slice(0)}return r});function x(y){if(i[g]=y,o){const[N,E]=Fe(g);return o[g]=E,e(f[g],N)}return e(f[g])}}}function Nt(n,e){return sn(()=>n(e||{}))}function Mt(n){const e="fallback"in n&&{fallback:()=>n.fallback};return Qt(Ar(()=>n.each,n.children,e||void 0))}function Sr(n,e,t){let s=t.length,r=e.length,i=s,l=0,o=0,f=e[r-1].nextSibling,u=null;for(;l<r||o<i;){if(e[l]===t[o]){l++,o++;continue}for(;e[r-1]===t[i-1];)r--,i--;if(r===l){const p=i<s?o?t[o-1].nextSibling:t[i-o]:f;for(;o<i;)n.insertBefore(t[o++],p)}else if(i===o)for(;l<r;)(!u||!u.has(e[l]))&&e[l].remove(),l++;else if(e[l]===t[i-1]&&t[o]===e[r-1]){const p=e[--r].nextSibling;n.insertBefore(t[o++],e[l++].nextSibling),n.insertBefore(t[--i],p),e[r]=t[i]}else{if(!u){u=new Map;let g=o;for(;g<i;)u.set(t[g],g++)}const p=u.get(e[l]);if(p!=null)if(o<p&&p<i){let g=l,x=1,y;for(;++g<r&&g<i&&!((y=u.get(e[g]))==null||y!==p+x);)x++;if(x>p-o){const N=e[l];for(;o<p;)n.insertBefore(t[o++],N)}else n.replaceChild(t[o++],e[l++])}else l++;else e[l++].remove()}}}const ds="_$DX_DELEGATE";function Se(n,e,t,s){let r;const i=()=>{const o=document.createElement("template");return o.innerHTML=n,o.content.firstChild},l=()=>(r||(r=i())).cloneNode(!0);return l.cloneNode=l,l}function Rr(n,e=window.document){const t=e[ds]||(e[ds]=new Set);for(let s=0,r=n.length;s<r;s++){const i=n[s];t.has(i)||(t.add(i),e.addEventListener(i,vr))}}function _e(n,e,t){t==null?n.removeAttribute(e):n.setAttribute(e,t)}function Gt(n,e){e==null?n.removeAttribute("class"):n.className=e}function bs(n,e,t){return sn(()=>n(e,t))}function be(n,e,t,s){if(t!==void 0&&!s&&(s=[]),typeof e!="function")return On(n,e,s,t);He(r=>On(n,e(),r,t),s)}function vr(n){let e=n.target;const t=`$$${n.type}`,s=n.target,r=n.currentTarget,i=f=>Object.defineProperty(n,"target",{configurable:!0,value:f}),l=()=>{const f=e[t];if(f&&!e.disabled){const u=e[`${t}Data`];if(u!==void 0?f.call(e,u,n):f.call(e,n),n.cancelBubble)return}return e.host&&typeof e.host!="string"&&!e.host._$host&&e.contains(n.target)&&i(e.host),!0},o=()=>{for(;l()&&(e=e._$host||e.parentNode||e.host););};if(Object.defineProperty(n,"currentTarget",{configurable:!0,get(){return e||document}}),n.composedPath){const f=n.composedPath();i(f[0]);for(let u=0;u<f.length-2&&(e=f[u],!!l());u++){if(e._$host){e=e._$host,o();break}if(e.parentNode===r)break}}else o();i(s)}function On(n,e,t,s,r){for(;typeof t=="function";)t=t();if(e===t)return t;const i=typeof e,l=s!==void 0;if(n=l&&t[0]&&t[0].parentNode||n,i==="string"||i==="number"){if(i==="number"&&(e=e.toString(),e===t))return t;if(l){let o=t[0];o&&o.nodeType===3?o.data!==e&&(o.data=e):o=document.createTextNode(e),t=Lt(n,t,s,o)}else t!==""&&typeof t=="string"?t=n.firstChild.data=e:t=n.textContent=e}else if(e==null||i==="boolean")t=Lt(n,t,s);else{if(i==="function")return He(()=>{let o=e();for(;typeof o=="function";)o=o();t=On(n,o,t,s)}),()=>t;if(Array.isArray(e)){const o=[],f=t&&Array.isArray(t);if(Yn(o,e,t,r))return He(()=>t=On(n,o,t,s,!0)),()=>t;if(o.length===0){if(t=Lt(n,t,s),l)return t}else f?t.length===0?ms(n,o,s):Sr(n,t,o):(t&&Lt(n),ms(n,o));t=o}else if(e.nodeType){if(Array.isArray(t)){if(l)return t=Lt(n,t,s,e);Lt(n,t,null,e)}else t==null||t===""||!n.firstChild?n.appendChild(e):n.replaceChild(e,n.firstChild);t=e}}return t}function Yn(n,e,t,s){let r=!1;for(let i=0,l=e.length;i<l;i++){let o=e[i],f=t&&t[n.length],u;if(!(o==null||o===!0||o===!1))if((u=typeof o)=="object"&&o.nodeType)n.push(o);else if(Array.isArray(o))r=Yn(n,o,f)||r;else if(u==="function")if(s){for(;typeof o=="function";)o=o();r=Yn(n,Array.isArray(o)?o:[o],Array.isArray(f)?f:[f])||r}else n.push(o),r=!0;else{const p=String(o);f&&f.nodeType===3&&f.data===p?n.push(f):n.push(document.createTextNode(p))}}return r}function ms(n,e,t=null){for(let s=0,r=e.length;s<r;s++)n.insertBefore(e[s],t)}function Lt(n,e,t,s){if(t===void 0)return n.textContent="";const r=s||document.createTextNode("");if(e.length){let i=!1;for(let l=e.length-1;l>=0;l--){const o=e[l];if(r!==o){const f=o.parentNode===n;!i&&!l?f?n.replaceChild(r,o):n.insertBefore(r,t):f&&o.remove()}else i=!0}}else n.insertBefore(r,t);return[r]}function Or(n){return Object.keys(n).reduce((t,s)=>{const r=n[s];return t[s]=Object.assign({},r),qs(r.value)&&!Ir(r.value)&&!Array.isArray(r.value)&&(t[s].value=Object.assign({},r.value)),Array.isArray(r.value)&&(t[s].value=r.value.slice(0)),t},{})}function Cr(n){return n?Object.keys(n).reduce((t,s)=>{const r=n[s];return t[s]=qs(r)&&"value"in r?r:{value:r},t[s].attribute||(t[s].attribute=Lr(s)),t[s].parse="parse"in t[s]?t[s].parse:typeof t[s].value!="string",t},{}):{}}function Nr(n){return Object.keys(n).reduce((t,s)=>(t[s]=n[s].value,t),{})}function Mr(n,e){const t=Or(e);return Object.keys(e).forEach(r=>{const i=t[r],l=n.getAttribute(i.attribute),o=n[r];l!=null&&(i.value=i.parse?Gs(l):l),o!=null&&(i.value=Array.isArray(o)?o.slice(0):o),i.reflect&&_s(n,i.attribute,i.value,!!i.parse),Object.defineProperty(n,r,{get(){return i.value},set(f){const u=i.value;i.value=f,i.reflect&&_s(this,i.attribute,i.value,!!i.parse);for(let p=0,g=this.__propertyChangedCallbacks.length;p<g;p++)this.__propertyChangedCallbacks[p](r,f,u)},enumerable:!0,configurable:!0})}),t}function Gs(n){if(n)try{return JSON.parse(n)}catch{return n}}function _s(n,e,t,s){if(t==null||t===!1)return n.removeAttribute(e);let r=s?JSON.stringify(t):t;n.__updating[e]=!0,r==="true"&&(r=""),n.setAttribute(e,r),Promise.resolve().then(()=>delete n.__updating[e])}function Lr(n){return n.replace(/\.?([A-Z]+)/g,(e,t)=>"-"+t.toLowerCase()).replace("_","-").replace(/^-/,"")}function qs(n){return n!=null&&(typeof n=="object"||typeof n=="function")}function Ir(n){return Object.prototype.toString.call(n)==="[object Function]"}function $r(n){return typeof n=="function"&&n.toString().indexOf("class")===0}let Jt;function Dr(){Object.defineProperty(Jt,"renderRoot",{value:Jt})}function Pr(n,e){const t=Object.keys(e);return class extends n{static get observedAttributes(){return t.map(r=>e[r].attribute)}constructor(){super(),this.__initialized=!1,this.__released=!1,this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props={}}connectedCallback(){if(this.__initialized)return;this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props=Mr(this,e);const r=Nr(this.props),i=this.Component,l=Jt;try{Jt=this,this.__initialized=!0,$r(i)?new i(r,{element:this}):i(r,{element:this})}finally{Jt=l}}async disconnectedCallback(){if(await Promise.resolve(),this.isConnected)return;this.__propertyChangedCallbacks.length=0;let r=null;for(;r=this.__releaseCallbacks.pop();)r(this);delete this.__initialized,this.__released=!0}attributeChangedCallback(r,i,l){if(this.__initialized&&!this.__updating[r]&&(r=this.lookupProp(r),r in e)){if(l==null&&!this[r])return;this[r]=e[r].parse?Gs(l):l}}lookupProp(r){if(e)return t.find(i=>r===i||r===e[i].attribute)}get renderRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}addReleaseCallback(r){this.__releaseCallbacks.push(r)}addPropertyChangedCallback(r){this.__propertyChangedCallbacks.push(r)}}}function Br(n,e={},t={}){const{BaseElement:s=HTMLElement,extension:r,customElements:i=window.customElements}=t;return l=>{let o=i.get(n);return o?(o.prototype.Component=l,o):(o=Pr(s,Cr(e)),o.prototype.Component=l,o.prototype.registeredTag=n,i.define(n,o,r),o)}}function zr(n){const e=Object.keys(n),t={};for(let s=0;s<e.length;s++){const[r,i]=Fe(n[e[s]]);Object.defineProperty(t,e[s],{get:r,set(l){i(()=>l)}})}return t}function Ur(n){if(n.assignedSlot&&n.assignedSlot._$owner)return n.assignedSlot._$owner;let e=n.parentNode;for(;e&&!e._$owner&&!(e.assignedSlot&&e.assignedSlot._$owner);)e=e.parentNode;return e&&e.assignedSlot?e.assignedSlot._$owner:n._$owner}function Hr(n){return(e,t)=>{const{element:s}=t;return kn(r=>{const i=zr(e);s.addPropertyChangedCallback((o,f)=>i[o]=f),s.addReleaseCallback(()=>{s.renderRoot.textContent="",r()});const l=n(i,t);return be(s.renderRoot,l)},Ur(s))}}function Fr(n,e,t){return arguments.length===2&&(t=e,e={}),Br(n,e)(Hr(t))}function es(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let wt=es();function Ws(n){wt=n}const en={exec:()=>null};function Z(n,e=""){let t=typeof n=="string"?n:n.source;const s={replace:(r,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(Ce.caret,"$1"),t=t.replace(r,l),s},getRegex:()=>new RegExp(t,e)};return s}const Ce={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i")},jr=/^(?:[ \t]*(?:\n|$))+/,Gr=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,qr=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ln=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Wr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ks=/(?:[*+-]|\d{1,9}[.)])/,Zs=Z(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Ks).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),ts=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Kr=/^[^\n]+/,ns=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Zr=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ns).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Yr=Z(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ks).getRegex(),In="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ss=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Xr=Z("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ss).replace("tag",In).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ys=Z(ts).replace("hr",ln).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",In).getRegex(),Vr=Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ys).getRegex(),rs={blockquote:Vr,code:Gr,def:Zr,fences:qr,heading:Wr,hr:ln,html:Xr,lheading:Zs,list:Yr,newline:jr,paragraph:Ys,table:en,text:Kr},xs=Z("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ln).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",In).getRegex(),Qr={...rs,table:xs,paragraph:Z(ts).replace("hr",ln).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",xs).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",In).getRegex()},Jr={...rs,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ss).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:en,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Z(ts).replace("hr",ln).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Zs).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Xs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ei=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Vs=/^( {2,}|\\)\n(?!\s*$)/,ti=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,$n=/[\p{P}\p{S}]/u,is=/[\s\p{P}\p{S}]/u,Qs=/[^\s\p{P}\p{S}]/u,ni=Z(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,is).getRegex(),si=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,ri=Z(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,"u").replace(/punct/g,$n).getRegex(),ii=Z("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,Qs).replace(/punctSpace/g,is).replace(/punct/g,$n).getRegex(),oi=Z("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Qs).replace(/punctSpace/g,is).replace(/punct/g,$n).getRegex(),li=Z(/\\(punct)/,"gu").replace(/punct/g,$n).getRegex(),ai=Z(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ci=Z(ss).replace("(?:-->|$)","-->").getRegex(),ui=Z("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ci).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Cn=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,fi=Z(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Cn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Js=Z(/^!?\[(label)\]\[(ref)\]/).replace("label",Cn).replace("ref",ns).getRegex(),er=Z(/^!?\[(ref)\](?:\[\])?/).replace("ref",ns).getRegex(),pi=Z("reflink|nolink(?!\\()","g").replace("reflink",Js).replace("nolink",er).getRegex(),os={_backpedal:en,anyPunctuation:li,autolink:ai,blockSkip:si,br:Vs,code:ei,del:en,emStrongLDelim:ri,emStrongRDelimAst:ii,emStrongRDelimUnd:oi,escape:Xs,link:fi,nolink:er,punctuation:ni,reflink:Js,reflinkSearch:pi,tag:ui,text:ti,url:en},hi={...os,link:Z(/^!?\[(label)\]\((.*?)\)/).replace("label",Cn).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Cn).getRegex()},Xn={...os,escape:Z(Xs).replace("])","~|])").getRegex(),url:Z(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},gi={...Xn,br:Z(Vs).replace("{2,}","*").getRegex(),text:Z(Xn.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},xn={normal:rs,gfm:Qr,pedantic:Jr},qt={normal:os,gfm:Xn,breaks:gi,pedantic:hi},di={"&":"&","<":"<",">":">",'"':""","'":"'"},ws=n=>di[n];function et(n,e){if(e){if(Ce.escapeTest.test(n))return n.replace(Ce.escapeReplace,ws)}else if(Ce.escapeTestNoEncode.test(n))return n.replace(Ce.escapeReplaceNoEncode,ws);return n}function Es(n){try{n=encodeURI(n).replace(Ce.percentDecode,"%")}catch{return null}return n}function ys(n,e){var i;const t=n.replace(Ce.findPipe,(l,o,f)=>{let u=!1,p=o;for(;--p>=0&&f[p]==="\\";)u=!u;return u?"|":" |"}),s=t.split(Ce.splitPipe);let r=0;if(s[0].trim()||s.shift(),s.length>0&&!((i=s.at(-1))!=null&&i.trim())&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(Ce.slashPipe,"|");return s}function Wt(n,e,t){const s=n.length;if(s===0)return"";let r=0;for(;r<s&&n.charAt(s-r-1)===e;)r++;return n.slice(0,s-r)}function bi(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return-1}function ks(n,e,t,s,r){const i=e.href,l=e.title||null,o=n[1].replace(r.other.outputLinkReplace,"$1");if(n[0].charAt(0)!=="!"){s.state.inLink=!0;const f={type:"link",raw:t,href:i,title:l,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,f}return{type:"image",raw:t,href:i,title:l,text:o}}function mi(n,e,t){const s=n.match(t.other.indentCodeCompensation);if(s===null)return e;const r=s[1];return e.split(`
`).map(i=>{const l=i.match(t.other.beginningSpace);if(l===null)return i;const[o]=l;return o.length>=r.length?i.slice(r.length):i}).join(`
`)}class Nn{constructor(e){Q(this,"options");Q(this,"rules");Q(this,"lexer");this.options=e||wt}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const s=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?s:Wt(s,`
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const s=t[0],r=mi(s,t[3]||"",this.rules);return{type:"code",raw:s,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let s=t[2].trim();if(this.rules.other.endingHash.test(s)){const r=Wt(s,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(s=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:s,tokens:this.lexer.inline(s)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Wt(t[0],`
`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let s=Wt(t[0],`
`).split(`
`),r="",i="";const l=[];for(;s.length>0;){let o=!1;const f=[];let u;for(u=0;u<s.length;u++)if(this.rules.other.blockquoteStart.test(s[u]))f.push(s[u]),o=!0;else if(!o)f.push(s[u]);else break;s=s.slice(u);const p=f.join(`
`),g=p.replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
${p}`:p,i=i?`${i}
${g}`:g;const x=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,l,!0),this.lexer.state.top=x,s.length===0)break;const y=l.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){const N=y,E=N.raw+`
`+s.join(`
`),Y=this.blockquote(E);l[l.length-1]=Y,r=r.substring(0,r.length-N.raw.length)+Y.raw,i=i.substring(0,i.length-N.text.length)+Y.text;break}else if((y==null?void 0:y.type)==="list"){const N=y,E=N.raw+`
`+s.join(`
`),Y=this.list(E);l[l.length-1]=Y,r=r.substring(0,r.length-y.raw.length)+Y.raw,i=i.substring(0,i.length-N.raw.length)+Y.raw,s=E.substring(l.at(-1).raw.length).split(`
`);continue}}return{type:"blockquote",raw:r,tokens:l,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim();const r=s.length>1,i={type:"list",raw:"",ordered:r,start:r?+s.slice(0,-1):"",loose:!1,items:[]};s=r?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=r?s:"[*+-]");const l=this.rules.other.listItemRegex(s);let o=!1;for(;e;){let u=!1,p="",g="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let x=t[2].split(`
`,1)[0].replace(this.rules.other.listReplaceTabs,ne=>" ".repeat(3*ne.length)),y=e.split(`
`,1)[0],N=!x.trim(),E=0;if(this.options.pedantic?(E=2,g=x.trimStart()):N?E=t[1].length+1:(E=t[2].search(this.rules.other.nonSpaceChar),E=E>4?1:E,g=x.slice(E),E+=t[1].length),N&&this.rules.other.blankLine.test(y)&&(p+=y+`
`,e=e.substring(y.length+1),u=!0),!u){const ne=this.rules.other.nextBulletRegex(E),G=this.rules.other.hrRegex(E),I=this.rules.other.fencesBeginRegex(E),X=this.rules.other.headingBeginRegex(E),we=this.rules.other.htmlBeginRegex(E);for(;e;){const Ee=e.split(`
`,1)[0];let B;if(y=Ee,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),B=y):B=y.replace(this.rules.other.tabCharGlobal," "),I.test(y)||X.test(y)||we.test(y)||ne.test(y)||G.test(y))break;if(B.search(this.rules.other.nonSpaceChar)>=E||!y.trim())g+=`
`+B.slice(E);else{if(N||x.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||I.test(x)||X.test(x)||G.test(x))break;g+=`
`+y}!N&&!y.trim()&&(N=!0),p+=Ee+`
`,e=e.substring(Ee.length+1),x=B.slice(E)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(o=!0));let Y=null,J;this.options.gfm&&(Y=this.rules.other.listIsTask.exec(g),Y&&(J=Y[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:p,task:!!Y,checked:J,loose:!1,text:g,tokens:[]}),i.raw+=p}const f=i.items.at(-1);f&&(f.raw=f.raw.trimEnd(),f.text=f.text.trimEnd()),i.raw=i.raw.trimEnd();for(let u=0;u<i.items.length;u++)if(this.lexer.state.top=!1,i.items[u].tokens=this.lexer.blockTokens(i.items[u].text,[]),!i.loose){const p=i.items[u].tokens.filter(x=>x.type==="space"),g=p.length>0&&p.some(x=>this.rules.other.anyLine.test(x.raw));i.loose=g}if(i.loose)for(let u=0;u<i.items.length;u++)i.items[u].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const s=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:s,raw:t[0],href:r,title:i}}}table(e){var o;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const s=ys(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=t[3])!=null&&o.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(s.length===r.length){for(const f of r)this.rules.other.tableAlignRight.test(f)?l.align.push("right"):this.rules.other.tableAlignCenter.test(f)?l.align.push("center"):this.rules.other.tableAlignLeft.test(f)?l.align.push("left"):l.align.push(null);for(let f=0;f<s.length;f++)l.header.push({text:s[f],tokens:this.lexer.inline(s[f]),header:!0,align:l.align[f]});for(const f of i)l.rows.push(ys(f,l.header.length).map((u,p)=>({text:u,tokens:this.lexer.inline(u),header:!1,align:l.align[p]})));return l}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const s=t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:s,tokens:this.lexer.inline(s)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const s=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;const l=Wt(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{const l=bi(t[2],"()");if(l>-1){const f=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,f).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){const l=this.rules.other.pedanticHrefTitle.exec(r);l&&(r=l[1],i=l[3])}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?r=r.slice(1):r=r.slice(1,-1)),ks(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let s;if((s=this.rules.inline.reflink.exec(e))||(s=this.rules.inline.nolink.exec(e))){const r=(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){const l=s[0].charAt(0);return{type:"text",raw:l,text:l}}return ks(s,i,s[0],this.lexer,this.rules)}}emStrong(e,t,s=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&s.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const l=[...r[0]].length-1;let o,f,u=l,p=0;const g=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+l);(r=g.exec(t))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(f=[...o].length,r[3]||r[4]){u+=f;continue}else if((r[5]||r[6])&&l%3&&!((l+f)%3)){p+=f;continue}if(u-=f,u>0)continue;f=Math.min(f,f+u+p);const x=[...r[0]][0].length,y=e.slice(0,l+r.index+x+f);if(Math.min(l,f)%2){const E=y.slice(1,-1);return{type:"em",raw:y,text:E,tokens:this.lexer.inlineTokens(E)}}const N=y.slice(2,-2);return{type:"strong",raw:y,text:N,tokens:this.lexer.inlineTokens(N)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let s=t[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(s),i=this.rules.other.startingSpaceChar.test(s)&&this.rules.other.endingSpaceChar.test(s);return r&&i&&(s=s.substring(1,s.length-1)),{type:"codespan",raw:t[0],text:s}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let s,r;return t[2]==="@"?(s=t[1],r="mailto:"+s):(s=t[1],r=s),{type:"link",raw:t[0],text:s,href:r,tokens:[{type:"text",raw:s,text:s}]}}}url(e){var s;let t;if(t=this.rules.inline.url.exec(e)){let r,i;if(t[2]==="@")r=t[0],i="mailto:"+r;else{let l;do l=t[0],t[0]=((s=this.rules.inline._backpedal.exec(t[0]))==null?void 0:s[0])??"";while(l!==t[0]);r=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const s=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:s}}}}class qe{constructor(e){Q(this,"tokens");Q(this,"options");Q(this,"state");Q(this,"tokenizer");Q(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||wt,this.options.tokenizer=this.options.tokenizer||new Nn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:Ce,block:xn.normal,inline:qt.normal};this.options.pedantic?(t.block=xn.pedantic,t.inline=qt.pedantic):this.options.gfm&&(t.block=xn.gfm,this.options.breaks?t.inline=qt.breaks:t.inline=qt.gfm),this.tokenizer.rules=t}static get rules(){return{block:xn,inline:qt}}static lex(e,t){return new qe(t).lex(e)}static lexInline(e,t){return new qe(t).inlineTokens(e)}lex(e){e=e.replace(Ce.carriageReturn,`
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){var r,i,l;for(this.options.pedantic&&(e=e.replace(Ce.tabCharGlobal," ").replace(Ce.spaceLine,""));e;){let o;if((i=(r=this.options.extensions)==null?void 0:r.block)!=null&&i.some(u=>(o=u.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);const u=t.at(-1);o.raw.length===1&&u!==void 0?u.raw+=`
`:t.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.raw.length);const u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=`
`+o.raw,u.text+=`
`+o.text,this.inlineQueue.at(-1).src=u.text):t.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.raw.length);const u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=`
`+o.raw,u.text+=`
`+o.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),t.push(o);continue}let f=e;if((l=this.options.extensions)!=null&&l.startBlock){let u=1/0;const p=e.slice(1);let g;this.options.extensions.startBlock.forEach(x=>{g=x.call({lexer:this},p),typeof g=="number"&&g>=0&&(u=Math.min(u,g))}),u<1/0&&u>=0&&(f=e.substring(0,u+1))}if(this.state.top&&(o=this.tokenizer.paragraph(f))){const u=t.at(-1);s&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=`
`+o.raw,u.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(o),s=f.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);const u=t.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=`
`+o.raw,u.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(o);continue}if(e){const u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var o,f,u;let s=e,r=null;if(this.tokens.links){const p=Object.keys(this.tokens.links);if(p.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)p.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,r.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i=!1,l="";for(;e;){i||(l=""),i=!1;let p;if((f=(o=this.options.extensions)==null?void 0:o.inline)!=null&&f.some(x=>(p=x.call({lexer:this},e,t))?(e=e.substring(p.raw.length),t.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);const x=t.at(-1);p.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=p.raw,x.text+=p.text):t.push(p);continue}if(p=this.tokenizer.emStrong(e,s,l)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.del(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),t.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),t.push(p);continue}let g=e;if((u=this.options.extensions)!=null&&u.startInline){let x=1/0;const y=e.slice(1);let N;this.options.extensions.startInline.forEach(E=>{N=E.call({lexer:this},y),typeof N=="number"&&N>=0&&(x=Math.min(x,N))}),x<1/0&&x>=0&&(g=e.substring(0,x+1))}if(p=this.tokenizer.inlineText(g)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(l=p.raw.slice(-1)),i=!0;const x=t.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=p.raw,x.text+=p.text):t.push(p);continue}if(e){const x="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return t}}class Mn{constructor(e){Q(this,"options");Q(this,"parser");this.options=e||wt}space(e){return""}code({text:e,lang:t,escaped:s}){var l;const r=(l=(t||"").match(Ce.notSpaceStart))==null?void 0:l[0],i=e.replace(Ce.endingNewline,"")+`
`;return r?'<pre><code class="language-'+et(r)+'">'+(s?i:et(i,!0))+`</code></pre>
`:"<pre><code>"+(s?i:et(i,!0))+`</code></pre>
`}blockquote({tokens:e}){return`<blockquote>
${this.parser.parse(e)}</blockquote>
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
`}hr(e){return`<hr>
`}list(e){const t=e.ordered,s=e.start;let r="";for(let o=0;o<e.items.length;o++){const f=e.items[o];r+=this.listitem(f)}const i=t?"ol":"ul",l=t&&s!==1?' start="'+s+'"':"";return"<"+i+l+`>
`+r+"</"+i+`>
`}listitem(e){var s;let t="";if(e.task){const r=this.checkbox({checked:!!e.checked});e.loose?((s=e.tokens[0])==null?void 0:s.type)==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+et(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(e){let t="",s="";for(let i=0;i<e.header.length;i++)s+=this.tablecell(e.header[i]);t+=this.tablerow({text:s});let r="";for(let i=0;i<e.rows.length;i++){const l=e.rows[i];s="";for(let o=0;o<l.length;o++)s+=this.tablecell(l[o]);r+=this.tablerow({text:s})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
<thead>
`+t+`</thead>
`+r+`</table>
`}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){const t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`</${s}>
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${et(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:s}){const r=this.parser.parseInline(s),i=Es(e);if(i===null)return r;e=i;let l='<a href="'+e+'"';return t&&(l+=' title="'+et(t)+'"'),l+=">"+r+"</a>",l}image({href:e,title:t,text:s}){const r=Es(e);if(r===null)return et(s);e=r;let i=`<img src="${e}" alt="${s}"`;return t&&(i+=` title="${et(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:et(e.text)}}class ls{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class We{constructor(e){Q(this,"options");Q(this,"renderer");Q(this,"textRenderer");this.options=e||wt,this.options.renderer=this.options.renderer||new Mn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ls}static parse(e,t){return new We(t).parse(e)}static parseInline(e,t){return new We(t).parseInline(e)}parse(e,t=!0){var r,i;let s="";for(let l=0;l<e.length;l++){const o=e[l];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){const u=o,p=this.options.extensions.renderers[u.type].call({parser:this},u);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(u.type)){s+=p||"";continue}}const f=o;switch(f.type){case"space":{s+=this.renderer.space(f);continue}case"hr":{s+=this.renderer.hr(f);continue}case"heading":{s+=this.renderer.heading(f);continue}case"code":{s+=this.renderer.code(f);continue}case"table":{s+=this.renderer.table(f);continue}case"blockquote":{s+=this.renderer.blockquote(f);continue}case"list":{s+=this.renderer.list(f);continue}case"html":{s+=this.renderer.html(f);continue}case"paragraph":{s+=this.renderer.paragraph(f);continue}case"text":{let u=f,p=this.renderer.text(u);for(;l+1<e.length&&e[l+1].type==="text";)u=e[++l],p+=`
`+this.renderer.text(u);t?s+=this.renderer.paragraph({type:"paragraph",raw:p,text:p,tokens:[{type:"text",raw:p,text:p,escaped:!0}]}):s+=p;continue}default:{const u='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return s}parseInline(e,t=this.renderer){var r,i;let s="";for(let l=0;l<e.length;l++){const o=e[l];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){const u=this.options.extensions.renderers[o.type].call({parser:this},o);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){s+=u||"";continue}}const f=o;switch(f.type){case"escape":{s+=t.text(f);break}case"html":{s+=t.html(f);break}case"link":{s+=t.link(f);break}case"image":{s+=t.image(f);break}case"strong":{s+=t.strong(f);break}case"em":{s+=t.em(f);break}case"codespan":{s+=t.codespan(f);break}case"br":{s+=t.br(f);break}case"del":{s+=t.del(f);break}case"text":{s+=t.text(f);break}default:{const u='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return s}}class tn{constructor(e){Q(this,"options");Q(this,"block");this.options=e||wt}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?qe.lex:qe.lexInline}provideParser(){return this.block?We.parse:We.parseInline}}Q(tn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class _i{constructor(...e){Q(this,"defaults",es());Q(this,"options",this.setOptions);Q(this,"parse",this.parseMarkdown(!0));Q(this,"parseInline",this.parseMarkdown(!1));Q(this,"Parser",We);Q(this,"Renderer",Mn);Q(this,"TextRenderer",ls);Q(this,"Lexer",qe);Q(this,"Tokenizer",Nn);Q(this,"Hooks",tn);this.use(...e)}walkTokens(e,t){var r,i;let s=[];for(const l of e)switch(s=s.concat(t.call(this,l)),l.type){case"table":{const o=l;for(const f of o.header)s=s.concat(this.walkTokens(f.tokens,t));for(const f of o.rows)for(const u of f)s=s.concat(this.walkTokens(u.tokens,t));break}case"list":{const o=l;s=s.concat(this.walkTokens(o.items,t));break}default:{const o=l;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(f=>{const u=o[f].flat(1/0);s=s.concat(this.walkTokens(u,t))}):o.tokens&&(s=s.concat(this.walkTokens(o.tokens,t)))}}return s}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(s=>{const r={...s};if(r.async=this.defaults.async||r.async||!1,s.extensions&&(s.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const l=t.renderers[i.name];l?t.renderers[i.name]=function(...o){let f=i.renderer.apply(this,o);return f===!1&&(f=l.apply(this,o)),f}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=t[i.level];l?l.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),s.renderer){const i=this.defaults.renderer||new Mn(this.defaults);for(const l in s.renderer){if(!(l in i))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;const o=l,f=s.renderer[o],u=i[o];i[o]=(...p)=>{let g=f.apply(i,p);return g===!1&&(g=u.apply(i,p)),g||""}}r.renderer=i}if(s.tokenizer){const i=this.defaults.tokenizer||new Nn(this.defaults);for(const l in s.tokenizer){if(!(l in i))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const o=l,f=s.tokenizer[o],u=i[o];i[o]=(...p)=>{let g=f.apply(i,p);return g===!1&&(g=u.apply(i,p)),g}}r.tokenizer=i}if(s.hooks){const i=this.defaults.hooks||new tn;for(const l in s.hooks){if(!(l in i))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;const o=l,f=s.hooks[o],u=i[o];tn.passThroughHooks.has(l)?i[o]=p=>{if(this.defaults.async)return Promise.resolve(f.call(i,p)).then(x=>u.call(i,x));const g=f.call(i,p);return u.call(i,g)}:i[o]=(...p)=>{let g=f.apply(i,p);return g===!1&&(g=u.apply(i,p)),g}}r.hooks=i}if(s.walkTokens){const i=this.defaults.walkTokens,l=s.walkTokens;r.walkTokens=function(o){let f=[];return f.push(l.call(this,o)),i&&(f=f.concat(i.call(this,o))),f}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return qe.lex(e,t??this.defaults)}parser(e,t){return We.parse(e,t??this.defaults)}parseMarkdown(e){return(s,r)=>{const i={...r},l={...this.defaults,...i},o=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof s>"u"||s===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));l.hooks&&(l.hooks.options=l,l.hooks.block=e);const f=l.hooks?l.hooks.provideLexer():e?qe.lex:qe.lexInline,u=l.hooks?l.hooks.provideParser():e?We.parse:We.parseInline;if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(s):s).then(p=>f(p,l)).then(p=>l.hooks?l.hooks.processAllTokens(p):p).then(p=>l.walkTokens?Promise.all(this.walkTokens(p,l.walkTokens)).then(()=>p):p).then(p=>u(p,l)).then(p=>l.hooks?l.hooks.postprocess(p):p).catch(o);try{l.hooks&&(s=l.hooks.preprocess(s));let p=f(s,l);l.hooks&&(p=l.hooks.processAllTokens(p)),l.walkTokens&&this.walkTokens(p,l.walkTokens);let g=u(p,l);return l.hooks&&(g=l.hooks.postprocess(g)),g}catch(p){return o(p)}}}onError(e,t){return s=>{if(s.message+=`
Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+et(s.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(s);throw s}}}const xt=new _i;function F(n,e){return xt.parse(n,e)}F.options=F.setOptions=function(n){return xt.setOptions(n),F.defaults=xt.defaults,Ws(F.defaults),F};F.getDefaults=es;F.defaults=wt;F.use=function(...n){return xt.use(...n),F.defaults=xt.defaults,Ws(F.defaults),F};F.walkTokens=function(n,e){return xt.walkTokens(n,e)};F.parseInline=xt.parseInline;F.Parser=We;F.parser=We.parse;F.Renderer=Mn;F.TextRenderer=ls;F.Lexer=qe;F.lexer=qe.lex;F.Tokenizer=Nn;F.Hooks=tn;F.parse=F;F.options;F.setOptions;F.use;F.walkTokens;F.parseInline;We.parse;qe.lex;/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */const{entries:tr,setPrototypeOf:Ts,isFrozen:xi,getPrototypeOf:wi,getOwnPropertyDescriptor:Ei}=Object;let{freeze:Ne,seal:Ke,create:nr}=Object,{apply:Vn,construct:Qn}=typeof Reflect<"u"&&Reflect;Ne||(Ne=function(e){return e});Ke||(Ke=function(e){return e});Vn||(Vn=function(e,t,s){return e.apply(t,s)});Qn||(Qn=function(e,t){return new e(...t)});const wn=Me(Array.prototype.forEach),yi=Me(Array.prototype.lastIndexOf),As=Me(Array.prototype.pop),Kt=Me(Array.prototype.push),ki=Me(Array.prototype.splice),Tn=Me(String.prototype.toLowerCase),Fn=Me(String.prototype.toString),Ss=Me(String.prototype.match),Zt=Me(String.prototype.replace),Ti=Me(String.prototype.indexOf),Ai=Me(String.prototype.trim),Xe=Me(Object.prototype.hasOwnProperty),Oe=Me(RegExp.prototype.test),Yt=Si(TypeError);function Me(n){return function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;r<t;r++)s[r-1]=arguments[r];return Vn(n,e,s)}}function Si(n){return function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return Qn(n,t)}}function D(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Tn;Ts&&Ts(n,null);let s=e.length;for(;s--;){let r=e[s];if(typeof r=="string"){const i=t(r);i!==r&&(xi(e)||(e[s]=i),r=i)}n[r]=!0}return n}function Ri(n){for(let e=0;e<n.length;e++)Xe(n,e)||(n[e]=null);return n}function _t(n){const e=nr(null);for(const[t,s]of tr(n))Xe(n,t)&&(Array.isArray(s)?e[t]=Ri(s):s&&typeof s=="object"&&s.constructor===Object?e[t]=_t(s):e[t]=s);return e}function Xt(n,e){for(;n!==null;){const s=Ei(n,e);if(s){if(s.get)return Me(s.get);if(typeof s.value=="function")return Me(s.value)}n=wi(n)}function t(){return null}return t}const Rs=Ne(["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","section","select","shadow","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"]),jn=Ne(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Gn=Ne(["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"]),vi=Ne(["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"]),qn=Ne(["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"]),Oi=Ne(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),vs=Ne(["#text"]),Os=Ne(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Wn=Ne(["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","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"]),Cs=Ne(["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"]),En=Ne(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ci=Ke(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ni=Ke(/<%[\w\W]*|[\w\W]*%>/gm),Mi=Ke(/\$\{[\w\W]*/gm),Li=Ke(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ii=Ke(/^aria-[\-\w]+$/),sr=Ke(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$i=Ke(/^(?:\w+script|data):/i),Di=Ke(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),rr=Ke(/^html$/i),Pi=Ke(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ns=Object.freeze({__proto__:null,ARIA_ATTR:Ii,ATTR_WHITESPACE:Di,CUSTOM_ELEMENT:Pi,DATA_ATTR:Li,DOCTYPE_NAME:rr,ERB_EXPR:Ni,IS_ALLOWED_URI:sr,IS_SCRIPT_OR_DATA:$i,MUSTACHE_EXPR:Ci,TMPLIT_EXPR:Mi});const Vt={element:1,text:3,progressingInstruction:7,comment:8,document:9},Bi=function(){return typeof window>"u"?null:window},zi=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let s=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(s=t.getAttribute(r));const i="dompurify"+(s?"#"+s:"");try{return e.createPolicy(i,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Ms=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ir(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bi();const e=A=>ir(A);if(e.version="3.2.4",e.removed=[],!n||!n.document||n.document.nodeType!==Vt.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const s=t,r=s.currentScript,{DocumentFragment:i,HTMLTemplateElement:l,Node:o,Element:f,NodeFilter:u,NamedNodeMap:p=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:g,DOMParser:x,trustedTypes:y}=n,N=f.prototype,E=Xt(N,"cloneNode"),Y=Xt(N,"remove"),J=Xt(N,"nextSibling"),ne=Xt(N,"childNodes"),G=Xt(N,"parentNode");if(typeof l=="function"){const A=t.createElement("template");A.content&&A.content.ownerDocument&&(t=A.content.ownerDocument)}let I,X="";const{implementation:we,createNodeIterator:Ee,createDocumentFragment:B,getElementsByTagName:$e}=t,{importNode:he}=s;let le=Ms();e.isSupported=typeof tr=="function"&&typeof G=="function"&&we&&we.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ft,ERB_EXPR:Ze,TMPLIT_EXPR:De,DATA_ATTR:Et,ARIA_ATTR:It,IS_SCRIPT_OR_DATA:yt,ATTR_WHITESPACE:Ve,CUSTOM_ELEMENT:U}=Ns;let{IS_ALLOWED_URI:V}=Ns,H=null;const ye=D({},[...Rs,...jn,...Gn,...qn,...vs]);let ae=null;const kt=D({},[...Os,...Wn,...Cs,...En]);let v=Object.seal(nr(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}})),j=null,$=null,ee=!0,Le=!0,Re=!1,Ie=!0,K=!1,ce=!0,ve=!1,$t=!1,Dt=!1,rt=!1,Tt=!1,At=!1,Pt=!0,an=!1;const Dn="user-content-";let St=!0,Pe=!1,tt={},Be=null;const pt=D({},["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 Bt=null;const cn=D({},["audio","video","img","source","image","track"]);let zt=null;const un=D({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Rt="http://www.w3.org/1998/Math/MathML",vt="http://www.w3.org/2000/svg",je="http://www.w3.org/1999/xhtml";let it=je,Ut=!1,Ht=null;const Ft=D({},[Rt,vt,je],Fn);let ht=D({},["mi","mo","mn","ms","mtext"]),gt=D({},["annotation-xml"]);const Pn=D({},["title","style","font","a","script"]);let ot=null;const lt=["application/xhtml+xml","text/html"],a="text/html";let h=null,m=null;const C=t.createElement("form"),oe=function(c){return c instanceof RegExp||c instanceof Function},se=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(m&&m===c)){if((!c||typeof c!="object")&&(c={}),c=_t(c),ot=lt.indexOf(c.PARSER_MEDIA_TYPE)===-1?a:c.PARSER_MEDIA_TYPE,h=ot==="application/xhtml+xml"?Fn:Tn,H=Xe(c,"ALLOWED_TAGS")?D({},c.ALLOWED_TAGS,h):ye,ae=Xe(c,"ALLOWED_ATTR")?D({},c.ALLOWED_ATTR,h):kt,Ht=Xe(c,"ALLOWED_NAMESPACES")?D({},c.ALLOWED_NAMESPACES,Fn):Ft,zt=Xe(c,"ADD_URI_SAFE_ATTR")?D(_t(un),c.ADD_URI_SAFE_ATTR,h):un,Bt=Xe(c,"ADD_DATA_URI_TAGS")?D(_t(cn),c.ADD_DATA_URI_TAGS,h):cn,Be=Xe(c,"FORBID_CONTENTS")?D({},c.FORBID_CONTENTS,h):pt,j=Xe(c,"FORBID_TAGS")?D({},c.FORBID_TAGS,h):{},$=Xe(c,"FORBID_ATTR")?D({},c.FORBID_ATTR,h):{},tt=Xe(c,"USE_PROFILES")?c.USE_PROFILES:!1,ee=c.ALLOW_ARIA_ATTR!==!1,Le=c.ALLOW_DATA_ATTR!==!1,Re=c.ALLOW_UNKNOWN_PROTOCOLS||!1,Ie=c.ALLOW_SELF_CLOSE_IN_ATTR!==!1,K=c.SAFE_FOR_TEMPLATES||!1,ce=c.SAFE_FOR_XML!==!1,ve=c.WHOLE_DOCUMENT||!1,rt=c.RETURN_DOM||!1,Tt=c.RETURN_DOM_FRAGMENT||!1,At=c.RETURN_TRUSTED_TYPE||!1,Dt=c.FORCE_BODY||!1,Pt=c.SANITIZE_DOM!==!1,an=c.SANITIZE_NAMED_PROPS||!1,St=c.KEEP_CONTENT!==!1,Pe=c.IN_PLACE||!1,V=c.ALLOWED_URI_REGEXP||sr,it=c.NAMESPACE||je,ht=c.MATHML_TEXT_INTEGRATION_POINTS||ht,gt=c.HTML_INTEGRATION_POINTS||gt,v=c.CUSTOM_ELEMENT_HANDLING||{},c.CUSTOM_ELEMENT_HANDLING&&oe(c.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(v.tagNameCheck=c.CUSTOM_ELEMENT_HANDLING.tagNameCheck),c.CUSTOM_ELEMENT_HANDLING&&oe(c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(v.attributeNameCheck=c.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),c.CUSTOM_ELEMENT_HANDLING&&typeof c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(v.allowCustomizedBuiltInElements=c.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),K&&(Le=!1),Tt&&(rt=!0),tt&&(H=D({},vs),ae=[],tt.html===!0&&(D(H,Rs),D(ae,Os)),tt.svg===!0&&(D(H,jn),D(ae,Wn),D(ae,En)),tt.svgFilters===!0&&(D(H,Gn),D(ae,Wn),D(ae,En)),tt.mathMl===!0&&(D(H,qn),D(ae,Cs),D(ae,En))),c.ADD_TAGS&&(H===ye&&(H=_t(H)),D(H,c.ADD_TAGS,h)),c.ADD_ATTR&&(ae===kt&&(ae=_t(ae)),D(ae,c.ADD_ATTR,h)),c.ADD_URI_SAFE_ATTR&&D(zt,c.ADD_URI_SAFE_ATTR,h),c.FORBID_CONTENTS&&(Be===pt&&(Be=_t(Be)),D(Be,c.FORBID_CONTENTS,h)),St&&(H["#text"]=!0),ve&&D(H,["html","head","body"]),H.table&&(D(H,["tbody"]),delete j.tbody),c.TRUSTED_TYPES_POLICY){if(typeof c.TRUSTED_TYPES_POLICY.createHTML!="function")throw Yt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof c.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Yt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');I=c.TRUSTED_TYPES_POLICY,X=I.createHTML("")}else I===void 0&&(I=zi(y,r)),I!==null&&typeof X=="string"&&(X=I.createHTML(""));Ne&&Ne(c),m=c}},k=D({},[...jn,...Gn,...vi]),w=D({},[...qn,...Oi]),O=function(c){let d=G(c);(!d||!d.tagName)&&(d={namespaceURI:it,tagName:"template"});const T=Tn(c.tagName),z=Tn(d.tagName);return Ht[c.namespaceURI]?c.namespaceURI===vt?d.namespaceURI===je?T==="svg":d.namespaceURI===Rt?T==="svg"&&(z==="annotation-xml"||ht[z]):!!k[T]:c.namespaceURI===Rt?d.namespaceURI===je?T==="math":d.namespaceURI===vt?T==="math"&>[z]:!!w[T]:c.namespaceURI===je?d.namespaceURI===vt&&!gt[z]||d.namespaceURI===Rt&&!ht[z]?!1:!w[T]&&(Pn[T]||!k[T]):!!(ot==="application/xhtml+xml"&&Ht[c.namespaceURI]):!1},q=function(c){Kt(e.removed,{element:c});try{G(c).removeChild(c)}catch{Y(c)}},re=function(c,d){try{Kt(e.removed,{attribute:d.getAttributeNode(c),from:d})}catch{Kt(e.removed,{attribute:null,from:d})}if(d.removeAttribute(c),c==="is")if(rt||Tt)try{q(d)}catch{}else try{d.setAttribute(c,"")}catch{}},at=function(c){let d=null,T=null;if(Dt)c="<remove></remove>"+c;else{const ue=Ss(c,/^[\r\n\t ]+/);T=ue&&ue[0]}ot==="application/xhtml+xml"&&it===je&&(c='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+c+"</body></html>");const z=I?I.createHTML(c):c;if(it===je)try{d=new x().parseFromString(z,ot)}catch{}if(!d||!d.documentElement){d=we.createDocument(it,"template",null);try{d.documentElement.innerHTML=Ut?X:z}catch{}}const ge=d.body||d.documentElement;return c&&T&&ge.insertBefore(t.createTextNode(T),ge.childNodes[0]||null),it===je?$e.call(d,ve?"html":"body")[0]:ve?d.documentElement:ge},Ot=function(c){return Ee.call(c.ownerDocument||c,c,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},dt=function(c){return c instanceof g&&(typeof c.nodeName!="string"||typeof c.textContent!="string"||typeof c.removeChild!="function"||!(c.attributes instanceof p)||typeof c.removeAttribute!="function"||typeof c.setAttribute!="function"||typeof c.namespaceURI!="string"||typeof c.insertBefore!="function"||typeof c.hasChildNodes!="function")},fn=function(c){return typeof o=="function"&&c instanceof o};function ze(A,c,d){wn(A,T=>{T.call(e,c,d,m)})}const pn=function(c){let d=null;if(ze(le.beforeSanitizeElements,c,null),dt(c))return q(c),!0;const T=h(c.nodeName);if(ze(le.uponSanitizeElement,c,{tagName:T,allowedTags:H}),c.hasChildNodes()&&!fn(c.firstElementChild)&&Oe(/<[/\w]/g,c.innerHTML)&&Oe(/<[/\w]/g,c.textContent)||c.nodeType===Vt.progressingInstruction||ce&&c.nodeType===Vt.comment&&Oe(/<[/\w]/g,c.data))return q(c),!0;if(!H[T]||j[T]){if(!j[T]&&gn(T)&&(v.tagNameCheck instanceof RegExp&&Oe(v.tagNameCheck,T)||v.tagNameCheck instanceof Function&&v.tagNameCheck(T)))return!1;if(St&&!Be[T]){const z=G(c)||c.parentNode,ge=ne(c)||c.childNodes;if(ge&&z){const ue=ge.length;for(let ke=ue-1;ke>=0;--ke){const Ge=E(ge[ke],!0);Ge.__removalCount=(c.__removalCount||0)+1,z.insertBefore(Ge,J(c))}}}return q(c),!0}return c instanceof f&&!O(c)||(T==="noscript"||T==="noembed"||T==="noframes")&&Oe(/<\/no(script|embed|frames)/i,c.innerHTML)?(q(c),!0):(K&&c.nodeType===Vt.text&&(d=c.textContent,wn([ft,Ze,De],z=>{d=Zt(d,z," ")}),c.textContent!==d&&(Kt(e.removed,{element:c.cloneNode()}),c.textContent=d)),ze(le.afterSanitizeElements,c,null),!1)},hn=function(c,d,T){if(Pt&&(d==="id"||d==="name")&&(T in t||T in C))return!1;if(!(Le&&!$[d]&&Oe(Et,d))){if(!(ee&&Oe(It,d))){if(!ae[d]||$[d]){if(!(gn(c)&&(v.tagNameCheck instanceof RegExp&&Oe(v.tagNameCheck,c)||v.tagNameCheck instanceof Function&&v.tagNameCheck(c))&&(v.attributeNameCheck instanceof RegExp&&Oe(v.attributeNameCheck,d)||v.attributeNameCheck instanceof Function&&v.attributeNameCheck(d))||d==="is"&&v.allowCustomizedBuiltInElements&&(v.tagNameCheck instanceof RegExp&&Oe(v.tagNameCheck,T)||v.tagNameCheck instanceof Function&&v.tagNameCheck(T))))return!1}else if(!zt[d]){if(!Oe(V,Zt(T,Ve,""))){if(!((d==="src"||d==="xlink:href"||d==="href")&&c!=="script"&&Ti(T,"data:")===0&&Bt[c])){if(!(Re&&!Oe(yt,Zt(T,Ve,"")))){if(T)return!1}}}}}}return!0},gn=function(c){return c!=="annotation-xml"&&Ss(c,U)},jt=function(c){ze(le.beforeSanitizeAttributes,c,null);const{attributes:d}=c;if(!d||dt(c))return;const T={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae,forceKeepAttr:void 0};let z=d.length;for(;z--;){const ge=d[z],{name:ue,namespaceURI:ke,value:Ge}=ge,bt=h(ue);let fe=ue==="value"?Ge:Ai(Ge);if(T.attrName=bt,T.attrValue=fe,T.keepAttr=!0,T.forceKeepAttr=void 0,ze(le.uponSanitizeAttribute,c,T),fe=T.attrValue,an&&(bt==="id"||bt==="name")&&(re(ue,c),fe=Dn+fe),ce&&Oe(/((--!?|])>)|<\/(style|title)/i,fe)){re(ue,c);continue}if(T.forceKeepAttr||(re(ue,c),!T.keepAttr))continue;if(!Ie&&Oe(/\/>/i,fe)){re(ue,c);continue}K&&wn([ft,Ze,De],b=>{fe=Zt(fe,b," ")});const dn=h(c.nodeName);if(hn(dn,bt,fe)){if(I&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!ke)switch(y.getAttributeType(dn,bt)){case"TrustedHTML":{fe=I.createHTML(fe);break}case"TrustedScriptURL":{fe=I.createScriptURL(fe);break}}try{ke?c.setAttributeNS(ke,ue,fe):c.setAttribute(ue,fe),dt(c)?q(c):As(e.removed)}catch{}}}ze(le.afterSanitizeAttributes,c,null)},Ct=function A(c){let d=null;const T=Ot(c);for(ze(le.beforeSanitizeShadowDOM,c,null);d=T.nextNode();)ze(le.uponSanitizeShadowNode,d,null),pn(d),jt(d),d.content instanceof i&&A(d.content);ze(le.afterSanitizeShadowDOM,c,null)};return e.sanitize=function(A){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d=null,T=null,z=null,ge=null;if(Ut=!A,Ut&&(A="<!-->"),typeof A!="string"&&!fn(A))if(typeof A.toString=="function"){if(A=A.toString(),typeof A!="string")throw Yt("dirty is not a string, aborting")}else throw Yt("toString is not a function");if(!e.isSupported)return A;if($t||se(c),e.removed=[],typeof A=="string"&&(Pe=!1),Pe){if(A.nodeName){const Ge=h(A.nodeName);if(!H[Ge]||j[Ge])throw Yt("root node is forbidden and cannot be sanitized in-place")}}else if(A instanceof o)d=at("<!---->"),T=d.ownerDocument.importNode(A,!0),T.nodeType===Vt.element&&T.nodeName==="BODY"||T.nodeName==="HTML"?d=T:d.appendChild(T);else{if(!rt&&!K&&!ve&&A.indexOf("<")===-1)return I&&At?I.createHTML(A):A;if(d=at(A),!d)return rt?null:At?X:""}d&&Dt&&q(d.firstChild);const ue=Ot(Pe?A:d);for(;z=ue.nextNode();)pn(z),jt(z),z.content instanceof i&&Ct(z.content);if(Pe)return A;if(rt){if(Tt)for(ge=B.call(d.ownerDocument);d.firstChild;)ge.appendChild(d.firstChild);else ge=d;return(ae.shadowroot||ae.shadowrootmode)&&(ge=he.call(s,ge,!0)),ge}let ke=ve?d.outerHTML:d.innerHTML;return ve&&H["!doctype"]&&d.ownerDocument&&d.ownerDocument.doctype&&d.ownerDocument.doctype.name&&Oe(rr,d.ownerDocument.doctype.name)&&(ke="<!DOCTYPE "+d.ownerDocument.doctype.name+`>
`+ke),K&&wn([ft,Ze,De],Ge=>{ke=Zt(ke,Ge," ")}),I&&At?I.createHTML(ke):ke},e.setConfig=function(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};se(A),$t=!0},e.clearConfig=function(){m=null,$t=!1},e.isValidAttribute=function(A,c,d){m||se({});const T=h(A),z=h(c);return hn(T,z,d)},e.addHook=function(A,c){typeof c=="function"&&Kt(le[A],c)},e.removeHook=function(A,c){if(c!==void 0){const d=yi(le[A],c);return d===-1?void 0:ki(le[A],d,1)[0]}return As(le[A])},e.removeHooks=function(A){le[A]=[]},e.removeAllHooks=function(){le=Ms()},e}var Kn=ir();function Ui(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Zn,Ls;function Hi(){if(Ls)return Zn;Ls=1;function n(a){return a instanceof Map?a.clear=a.delete=a.set=function(){throw new Error("map is read-only")}:a instanceof Set&&(a.add=a.clear=a.delete=function(){throw new Error("set is read-only")}),Object.freeze(a),Object.getOwnPropertyNames(a).forEach(h=>{const m=a[h],C=typeof m;(C==="object"||C==="function")&&!Object.isFrozen(m)&&n(m)}),a}class e{constructor(h){h.data===void 0&&(h.data={}),this.data=h.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function s(a,...h){const m=Object.create(null);for(const C in a)m[C]=a[C];return h.forEach(function(C){for(const oe in C)m[oe]=C[oe]}),m}const r="</span>",i=a=>!!a.scope,l=(a,{prefix:h})=>{if(a.startsWith("language:"))return a.replace("language:","language-");if(a.includes(".")){const m=a.split(".");return[`${h}${m.shift()}`,...m.map((C,oe)=>`${C}${"_".repeat(oe+1)}`)].join(" ")}return`${h}${a}`};class o{constructor(h,m){this.buffer="",this.classPrefix=m.classPrefix,h.walk(this)}addText(h){this.buffer+=t(h)}openNode(h){if(!i(h))return;const m=l(h.scope,{prefix:this.classPrefix});this.span(m)}closeNode(h){i(h)&&(this.buffer+=r)}value(){return this.buffer}span(h){this.buffer+=`<span class="${h}">`}}const f=(a={})=>{const h={children:[]};return Object.assign(h,a),h};class u{constructor(){this.rootNode=f(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(h){this.top.children.push(h)}openNode(h){const m=f({scope:h});this.add(m),this.stack.push(m)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(h){return this.constructor._walk(h,this.rootNode)}static _walk(h,m){return typeof m=="string"?h.addText(m):m.children&&(h.openNode(m),m.children.forEach(C=>this._walk(h,C)),h.closeNode(m)),h}static _collapse(h){typeof h!="string"&&h.children&&(h.children.every(m=>typeof m=="string")?h.children=[h.children.join("")]:h.children.forEach(m=>{u._collapse(m)}))}}class p extends u{constructor(h){super(),this.options=h}addText(h){h!==""&&this.add(h)}startScope(h){this.openNode(h)}endScope(){this.closeNode()}__addSublanguage(h,m){const C=h.root;m&&(C.scope=`language:${m}`),this.add(C)}toHTML(){return new o(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(a){return a?typeof a=="string"?a:a.source:null}function x(a){return E("(?=",a,")")}function y(a){return E("(?:",a,")*")}function N(a){return E("(?:",a,")?")}function E(...a){return a.map(m=>g(m)).join("")}function Y(a){const h=a[a.length-1];return typeof h=="object"&&h.constructor===Object?(a.splice(a.length-1,1),h):{}}function J(...a){return"("+(Y(a).capture?"":"?:")+a.map(C=>g(C)).join("|")+")"}function ne(a){return new RegExp(a.toString()+"|").exec("").length-1}function G(a,h){const m=a&&a.exec(h);return m&&m.index===0}const I=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function X(a,{joinWith:h}){let m=0;return a.map(C=>{m+=1;const oe=m;let se=g(C),k="";for(;se.length>0;){const w=I.exec(se);if(!w){k+=se;break}k+=se.substring(0,w.index),se=se.substring(w.index+w[0].length),w[0][0]==="\\"&&w[1]?k+="\\"+String(Number(w[1])+oe):(k+=w[0],w[0]==="("&&m++)}return k}).map(C=>`(${C})`).join(h)}const we=/\b\B/,Ee="[a-zA-Z]\\w*",B="[a-zA-Z_]\\w*",$e="\\b\\d+(\\.\\d+)?",he="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",le="\\b(0b[01]+)",ft="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Ze=(a={})=>{const h=/^#![ ]*\//;return a.binary&&(a.begin=E(h,/.*\b/,a.binary,/\b.*/)),s({scope:"meta",begin:h,end:/$/,relevance:0,"on:begin":(m,C)=>{m.index!==0&&C.ignoreMatch()}},a)},De={begin:"\\\\[\\s\\S]",relevance:0},Et={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[De]},It={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[De]},yt={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Ve=function(a,h,m={}){const C=s({scope:"comment",begin:a,end:h,contains:[]},m);C.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const oe=J("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return C.contains.push({begin:E(/[ ]+/,"(",oe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),C},U=Ve("//","$"),V=Ve("/\\*","\\*/"),H=Ve("#","$"),ye={scope:"number",begin:$e,relevance:0},ae={scope:"number",begin:he,relevance:0},kt={scope:"number",begin:le,relevance:0},v={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[De,{begin:/\[/,end:/\]/,relevance:0,contains:[De]}]},j={scope:"title",begin:Ee,relevance:0},$={scope:"title",begin:B,relevance:0},ee={begin:"\\.\\s*"+B,relevance:0};var Re=Object.freeze({__proto__:null,APOS_STRING_MODE:Et,BACKSLASH_ESCAPE:De,BINARY_NUMBER_MODE:kt,BINARY_NUMBER_RE:le,COMMENT:Ve,C_BLOCK_COMMENT_MODE:V,C_LINE_COMMENT_MODE:U,C_NUMBER_MODE:ae,C_NUMBER_RE:he,END_SAME_AS_BEGIN:function(a){return Object.assign(a,{"on:begin":(h,m)=>{m.data._beginMatch=h[1]},"on:end":(h,m)=>{m.data._beginMatch!==h[1]&&m.ignoreMatch()}})},HASH_COMMENT_MODE:H,IDENT_RE:Ee,MATCH_NOTHING_RE:we,METHOD_GUARD:ee,NUMBER_MODE:ye,NUMBER_RE:$e,PHRASAL_WORDS_MODE:yt,QUOTE_STRING_MODE:It,REGEXP_MODE:v,RE_STARTERS_RE:ft,SHEBANG:Ze,TITLE_MODE:j,UNDERSCORE_IDENT_RE:B,UNDERSCORE_TITLE_MODE:$});function Ie(a,h){a.input[a.index-1]==="."&&h.ignoreMatch()}function K(a,h){a.className!==void 0&&(a.scope=a.className,delete a.className)}function ce(a,h){h&&a.beginKeywords&&(a.begin="\\b("+a.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",a.__beforeBegin=Ie,a.keywords=a.keywords||a.beginKeywords,delete a.beginKeywords,a.relevance===void 0&&(a.relevance=0))}function ve(a,h){Array.isArray(a.illegal)&&(a.illegal=J(...a.illegal))}function $t(a,h){if(a.match){if(a.begin||a.end)throw new Error("begin & end are not supported with match");a.begin=a.match,delete a.match}}function Dt(a,h){a.relevance===void 0&&(a.relevance=1)}const rt=(a,h)=>{if(!a.beforeMatch)return;if(a.starts)throw new Error("beforeMatch cannot be used with starts");const m=Object.assign({},a);Object.keys(a).forEach(C=>{delete a[C]}),a.keywords=m.keywords,a.begin=E(m.beforeMatch,x(m.begin)),a.starts={relevance:0,contains:[Object.assign(m,{endsParent:!0})]},a.relevance=0,delete m.beforeMatch},Tt=["of","and","for","in","not","or","if","then","parent","list","value"],At="keyword";function Pt(a,h,m=At){const C=Object.create(null);return typeof a=="string"?oe(m,a.split(" ")):Array.isArray(a)?oe(m,a):Object.keys(a).forEach(function(se){Object.assign(C,Pt(a[se],h,se))}),C;function oe(se,k){h&&(k=k.map(w=>w.toLowerCase())),k.forEach(function(w){const O=w.split("|");C[O[0]]=[se,an(O[0],O[1])]})}}function an(a,h){return h?Number(h):Dn(a)?0:1}function Dn(a){return Tt.includes(a.toLowerCase())}const St={},Pe=a=>{console.error(a)},tt=(a,...h)=>{console.log(`WARN: ${a}`,...h)},Be=(a,h)=>{St[`${a}/${h}`]||(console.log(`Deprecated as of ${a}. ${h}`),St[`${a}/${h}`]=!0)},pt=new Error;function Bt(a,h,{key:m}){let C=0;const oe=a[m],se={},k={};for(let w=1;w<=h.length;w++)k[w+C]=oe[w],se[w+C]=!0,C+=ne(h[w-1]);a[m]=k,a[m]._emit=se,a[m]._multi=!0}function cn(a){if(Array.isArray(a.begin)){if(a.skip||a.excludeBegin||a.returnBegin)throw Pe("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),pt;if(typeof a.beginScope!="object"||a.beginScope===null)throw Pe("beginScope must be object"),pt;Bt(a,a.begin,{key:"beginScope"}),a.begin=X(a.begin,{joinWith:""})}}function zt(a){if(Array.isArray(a.end)){if(a.skip||a.excludeEnd||a.returnEnd)throw Pe("skip, excludeEnd, returnEnd not compatible with endScope: {}"),pt;if(typeof a.endScope!="object"||a.endScope===null)throw Pe("endScope must be object"),pt;Bt(a,a.end,{key:"endScope"}),a.end=X(a.end,{joinWith:""})}}function un(a){a.scope&&typeof a.scope=="object"&&a.scope!==null&&(a.beginScope=a.scope,delete a.scope)}function Rt(a){un(a),typeof a.beginScope=="string"&&(a.beginScope={_wrap:a.beginScope}),typeof a.endScope=="string"&&(a.endScope={_wrap:a.endScope}),cn(a),zt(a)}function vt(a){function h(k,w){return new RegExp(g(k),"m"+(a.case_insensitive?"i":"")+(a.unicodeRegex?"u":"")+(w?"g":""))}class m{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(w,O){O.position=this.position++,this.matchIndexes[this.matchAt]=O,this.regexes.push([O,w]),this.matchAt+=ne(w)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const w=this.regexes.map(O=>O[1]);this.matcherRe=h(X(w,{joinWith:"|"}),!0),this.lastIndex=0}exec(w){this.matcherRe.lastIndex=this.lastIndex;const O=this.matcherRe.exec(w);if(!O)return null;const q=O.findIndex((at,Ot)=>Ot>0&&at!==void 0),re=this.matchIndexes[q];return O.splice(0,q),Object.assign(O,re)}}class C{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(w){if(this.multiRegexes[w])return this.multiRegexes[w];const O=new m;return this.rules.slice(w).forEach(([q,re])=>O.addRule(q,re)),O.compile(),this.multiRegexes[w]=O,O}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(w,O){this.rules.push([w,O]),O.type==="begin"&&this.count++}exec(w){const O=this.getMatcher(this.regexIndex);O.lastIndex=this.lastIndex;let q=O.exec(w);if(this.resumingScanAtSamePosition()&&!(q&&q.index===this.lastIndex)){const re=this.getMatcher(0);re.lastIndex=this.lastIndex+1,q=re.exec(w)}return q&&(this.regexIndex+=q.position+1,this.regexIndex===this.count&&this.considerAll()),q}}function oe(k){const w=new C;return k.contains.forEach(O=>w.addRule(O.begin,{rule:O,type:"begin"})),k.terminatorEnd&&w.addRule(k.terminatorEnd,{type:"end"}),k.illegal&&w.addRule(k.illegal,{type:"illegal"}),w}function se(k,w){const O=k;if(k.isCompiled)return O;[K,$t,Rt,rt].forEach(re=>re(k,w)),a.compilerExtensions.forEach(re=>re(k,w)),k.__beforeBegin=null,[ce,ve,Dt].forEach(re=>re(k,w)),k.isCompiled=!0;let q=null;return typeof k.keywords=="object"&&k.keywords.$pattern&&(k.keywords=Object.assign({},k.keywords),q=k.keywords.$pattern,delete k.keywords.$pattern),q=q||/\w+/,k.keywords&&(k.keywords=Pt(k.keywords,a.case_insensitive)),O.keywordPatternRe=h(q,!0),w&&(k.begin||(k.begin=/\B|\b/),O.beginRe=h(O.begin),!k.end&&!k.endsWithParent&&(k.end=/\B|\b/),k.end&&(O.endRe=h(O.end)),O.terminatorEnd=g(O.end)||"",k.endsWithParent&&w.terminatorEnd&&(O.terminatorEnd+=(k.end?"|":"")+w.terminatorEnd)),k.illegal&&(O.illegalRe=h(k.illegal)),k.contains||(k.contains=[]),k.contains=[].concat(...k.contains.map(function(re){return it(re==="self"?k:re)})),k.contains.forEach(function(re){se(re,O)}),k.starts&&se(k.starts,w),O.matcher=oe(O),O}if(a.compilerExtensions||(a.compilerExtensions=[]),a.contains&&a.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return a.classNameAliases=s(a.classNameAliases||{}),se(a)}function je(a){return a?a.endsWithParent||je(a.starts):!1}function it(a){return a.variants&&!a.cachedVariants&&(a.cachedVariants=a.variants.map(function(h){return s(a,{variants:null},h)})),a.cachedVariants?a.cachedVariants:je(a)?s(a,{starts:a.starts?s(a.starts):null}):Object.isFrozen(a)?s(a):a}var Ut="11.10.0";class Ht extends Error{constructor(h,m){super(h),this.name="HTMLInjectionError",this.html=m}}const Ft=t,ht=s,gt=Symbol("nomatch"),Pn=7,ot=function(a){const h=Object.create(null),m=Object.create(null),C=[];let oe=!0;const se="Could not find the language '{}', did you forget to load/include a language module?",k={disableAutodetect:!0,name:"Plain text",contains:[]};let w={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:p};function O(b){return w.noHighlightRe.test(b)}function q(b){let R=b.className+" ";R+=b.parentNode?b.parentNode.className:"";const P=w.languageDetectRe.exec(R);if(P){const te=z(P[1]);return te||(tt(se.replace("{}",P[1])),tt("Falling back to no-highlight mode for this block.",b)),te?P[1]:"no-highlight"}return R.split(/\s+/).find(te=>O(te)||z(te))}function re(b,R,P){let te="",de="";typeof R=="object"?(te=b,P=R.ignoreIllegals,de=R.language):(Be("10.7.0","highlight(lang, code, ...args) has been deprecated."),Be("10.7.0",`Please use highlight(code, options) instead.
https://github.com/highlightjs/highlight.js/issues/2277`),de=b,te=R),P===void 0&&(P=!0);const Ye={code:te,language:de};fe("before:highlight",Ye);const ct=Ye.result?Ye.result:at(Ye.language,Ye.code,P);return ct.code=Ye.code,fe("after:highlight",ct),ct}function at(b,R,P,te){const de=Object.create(null);function Ye(_,S){return _.keywords[S]}function ct(){if(!M.keywords){xe.addText(ie);return}let _=0;M.keywordPatternRe.lastIndex=0;let S=M.keywordPatternRe.exec(ie),L="";for(;S;){L+=ie.substring(_,S.index);const W=Je.case_insensitive?S[0].toLowerCase():S[0],Te=Ye(M,W);if(Te){const[nt,fr]=Te;if(xe.addText(L),L="",de[W]=(de[W]||0)+1,de[W]<=Pn&&(_n+=fr),nt.startsWith("_"))L+=S[0];else{const pr=Je.classNameAliases[nt]||nt;Qe(S[0],pr)}}else L+=S[0];_=M.keywordPatternRe.lastIndex,S=M.keywordPatternRe.exec(ie)}L+=ie.substring(_),xe.addText(L)}function bn(){if(ie==="")return;let _=null;if(typeof M.subLanguage=="string"){if(!h[M.subLanguage]){xe.addText(ie);return}_=at(M.subLanguage,ie,!0,ps[M.subLanguage]),ps[M.subLanguage]=_._top}else _=dt(ie,M.subLanguage.length?M.subLanguage:null);M.relevance>0&&(_n+=_.relevance),xe.__addSublanguage(_._emitter,_.language)}function Ue(){M.subLanguage!=null?bn():ct(),ie=""}function Qe(_,S){_!==""&&(xe.startScope(S),xe.addText(_),xe.endScope())}function as(_,S){let L=1;const W=S.length-1;for(;L<=W;){if(!_._emit[L]){L++;continue}const Te=Je.classNameAliases[_[L]]||_[L],nt=S[L];Te?Qe(nt,Te):(ie=nt,ct(),ie=""),L++}}function cs(_,S){return _.scope&&typeof _.scope=="string"&&xe.openNode(Je.classNameAliases[_.scope]||_.scope),_.beginScope&&(_.beginScope._wrap?(Qe(ie,Je.classNameAliases[_.beginScope._wrap]||_.beginScope._wrap),ie=""):_.beginScope._multi&&(as(_.beginScope,S),ie="")),M=Object.create(_,{parent:{value:M}}),M}function us(_,S,L){let W=G(_.endRe,L);if(W){if(_["on:end"]){const Te=new e(_);_["on:end"](S,Te),Te.isMatchIgnored&&(W=!1)}if(W){for(;_.endsParent&&_.parent;)_=_.parent;return _}}if(_.endsWithParent)return us(_.parent,S,L)}function or(_){return M.matcher.regexIndex===0?(ie+=_[0],1):(Un=!0,0)}function lr(_){const S=_[0],L=_.rule,W=new e(L),Te=[L.__beforeBegin,L["on:begin"]];for(const nt of Te)if(nt&&(nt(_,W),W.isMatchIgnored))return or(S);return L.skip?ie+=S:(L.excludeBegin&&(ie+=S),Ue(),!L.returnBegin&&!L.excludeBegin&&(ie=S)),cs(L,_),L.returnBegin?0:S.length}function ar(_){const S=_[0],L=R.substring(_.index),W=us(M,_,L);if(!W)return gt;const Te=M;M.endScope&&M.endScope._wrap?(Ue(),Qe(S,M.endScope._wrap)):M.endScope&&M.endScope._multi?(Ue(),as(M.endScope,_)):Te.skip?ie+=S:(Te.returnEnd||Te.excludeEnd||(ie+=S),Ue(),Te.excludeEnd&&(ie=S));do M.scope&&xe.closeNode(),!M.skip&&!M.subLanguage&&(_n+=M.relevance),M=M.parent;while(M!==W.parent);return W.starts&&cs(W.starts,_),Te.returnEnd?0:S.length}function cr(){const _=[];for(let S=M;S!==Je;S=S.parent)S.scope&&_.unshift(S.scope);_.forEach(S=>xe.openNode(S))}let mn={};function fs(_,S){const L=S&&S[0];if(ie+=_,L==null)return Ue(),0;if(mn.type==="begin"&&S.type==="end"&&mn.index===S.index&&L===""){if(ie+=R.slice(S.index,S.index+1),!oe){const W=new Error(`0 width match regex (${b})`);throw W.languageName=b,W.badRule=mn.rule,W}return 1}if(mn=S,S.type==="begin")return lr(S);if(S.type==="illegal"&&!P){const W=new Error('Illegal lexeme "'+L+'" for mode "'+(M.scope||"<unnamed>")+'"');throw W.mode=M,W}else if(S.type==="end"){const W=ar(S);if(W!==gt)return W}if(S.type==="illegal"&&L==="")return 1;if(zn>1e5&&zn>S.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ie+=L,L.length}const Je=z(b);if(!Je)throw Pe(se.replace("{}",b)),new Error('Unknown language: "'+b+'"');const ur=vt(Je);let Bn="",M=te||ur;const ps={},xe=new w.__emitter(w);cr();let ie="",_n=0,mt=0,zn=0,Un=!1;try{if(Je.__emitTokens)Je.__emitTokens(R,xe);else{for(M.matcher.considerAll();;){zn++,Un?Un=!1:M.matcher.considerAll(),M.matcher.lastIndex=mt;const _=M.matcher.exec(R);if(!_)break;const S=R.substring(mt,_.index),L=fs(S,_);mt=_.index+L}fs(R.substring(mt))}return xe.finalize(),Bn=xe.toHTML(),{language:b,value:Bn,relevance:_n,illegal:!1,_emitter:xe,_top:M}}catch(_){if(_.message&&_.message.includes("Illegal"))return{language:b,value:Ft(R),illegal:!0,relevance:0,_illegalBy:{message:_.message,index:mt,context:R.slice(mt-100,mt+100),mode:_.mode,resultSoFar:Bn},_emitter:xe};if(oe)return{language:b,value:Ft(R),illegal:!1,relevance:0,errorRaised:_,_emitter:xe,_top:M};throw _}}function Ot(b){const R={value:Ft(b),illegal:!1,relevance:0,_top:k,_emitter:new w.__emitter(w)};return R._emitter.addText(b),R}function dt(b,R){R=R||w.languages||Object.keys(h);const P=Ot(b),te=R.filter(z).filter(ue).map(Ue=>at(Ue,b,!1));te.unshift(P);const de=te.sort((Ue,Qe)=>{if(Ue.relevance!==Qe.relevance)return Qe.relevance-Ue.relevance;if(Ue.language&&Qe.language){if(z(Ue.language).supersetOf===Qe.language)return 1;if(z(Qe.language).supersetOf===Ue.language)return-1}return 0}),[Ye,ct]=de,bn=Ye;return bn.secondBest=ct,bn}function fn(b,R,P){const te=R&&m[R]||P;b.classList.add("hljs"),b.classList.add(`language-${te}`)}function ze(b){let R=null;const P=q(b);if(O(P))return;if(fe("before:highlightElement",{el:b,language:P}),b.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",b);return}if(b.children.length>0&&(w.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(b)),w.throwUnescapedHTML))throw new Ht("One of your code blocks includes unescaped HTML.",b.innerHTML);R=b;const te=R.textContent,de=P?re(te,{language:P,ignoreIllegals:!0}):dt(te);b.innerHTML=de.value,b.dataset.highlighted="yes",fn(b,P,de.language),b.result={language:de.language,re:de.relevance,relevance:de.relevance},de.secondBest&&(b.secondBest={language:de.secondBest.language,relevance:de.secondBest.relevance}),fe("after:highlightElement",{el:b,result:de,text:te})}function pn(b){w=ht(w,b)}const hn=()=>{Ct(),Be("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function gn(){Ct(),Be("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let jt=!1;function Ct(){if(document.readyState==="loading"){jt=!0;return}document.querySelectorAll(w.cssSelector).forEach(ze)}function A(){jt&&Ct()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",A,!1);function c(b,R){let P=null;try{P=R(a)}catch(te){if(Pe("Language definition for '{}' could not be registered.".replace("{}",b)),oe)Pe(te);else throw te;P=k}P.name||(P.name=b),h[b]=P,P.rawDefinition=R.bind(null,a),P.aliases&&ge(P.aliases,{languageName:b})}function d(b){delete h[b];for(const R of Object.keys(m))m[R]===b&&delete m[R]}function T(){return Object.keys(h)}function z(b){return b=(b||"").toLowerCase(),h[b]||h[m[b]]}function ge(b,{languageName:R}){typeof b=="string"&&(b=[b]),b.forEach(P=>{m[P.toLowerCase()]=R})}function ue(b){const R=z(b);return R&&!R.disableAutodetect}function ke(b){b["before:highlightBlock"]&&!b["before:highlightElement"]&&(b["before:highlightElement"]=R=>{b["before:highlightBlock"](Object.assign({block:R.el},R))}),b["after:highlightBlock"]&&!b["after:highlightElement"]&&(b["after:highlightElement"]=R=>{b["after:highlightBlock"](Object.assign({block:R.el},R))})}function Ge(b){ke(b),C.push(b)}function bt(b){const R=C.indexOf(b);R!==-1&&C.splice(R,1)}function fe(b,R){const P=b;C.forEach(function(te){te[P]&&te[P](R)})}function dn(b){return Be("10.7.0","highlightBlock will be removed entirely in v12.0"),Be("10.7.0","Please use highlightElement now."),ze(b)}Object.assign(a,{highlight:re,highlightAuto:dt,highlightAll:Ct,highlightElement:ze,highlightBlock:dn,configure:pn,initHighlighting:hn,initHighlightingOnLoad:gn,registerLanguage:c,unregisterLanguage:d,listLanguages:T,getLanguage:z,registerAliases:ge,autoDetection:ue,inherit:ht,addPlugin:Ge,removePlugin:bt}),a.debugMode=function(){oe=!1},a.safeMode=function(){oe=!0},a.versionString=Ut,a.regex={concat:E,lookahead:x,either:J,optional:N,anyNumberOfTimes:y};for(const b in Re)typeof Re[b]=="object"&&n(Re[b]);return Object.assign(a,Re),a},lt=ot({});return lt.newInstance=()=>ot({}),Zn=lt,lt.HighlightJS=lt,lt.default=lt,Zn}var Fi=Hi();const yn=Ui(Fi),ji={label:"Run or edit the query",title:"Open the SPARQL query in an editor in a new tab"};function Gi(n,e=""){return`https://sib-swiss.github.io/sparql-editor/?${e?`endpoint=${e}&`:""}query=${encodeURIComponent(n)}`}const qi=`chat-with-context {
button:hover {
filter: brightness(90%);
}
}
.iconBtn {
filter: invert(44%) sepia(22%) saturate(496%) hue-rotate(176deg) brightness(93%) contrast(79%);
}`;function Wi(n){var e={keyword:"base|10 prefix|10 @base|10 @prefix|10",literal:"true|0 false|0",built_in:"a|0"},t={className:"literal",relevance:1,begin:/</,end:/>/,illegal:/[^\x00-\x20<>"{}|^`]/},s="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�က0-F",r=s+"_",i="-"+r+"0-9·̀-ͯ‿-⁀",l="_:["+r+"0-9](["+i+".]*["+i+"])?",o="["+s+"](["+i+".]*["+i+"])?",f="%[0-9A-Fa-f][0-9A-Fa-f]",u="\\\\[_~.!$&'()*+,;=/?#@%-]",p=f+"|"+u,g="("+o+")?:",x="(["+r+":0-9]|"+p+")(["+i+".:]|"+p+")*(["+i+":]|"+p+")?",y=g+x,N=g+"("+x+")?",E={begin:N,relevance:0,className:"symbol"},Y={begin:l,relevance:10,className:"template-variable"},J={begin:/@[a-zA-Z]+([a-zA-Z0-9-]+)*/,className:"type",relevance:5},ne={begin:"\\^\\^"+y,className:"type",relevance:10},G={begin:/'''/,end:/'''/,className:"string",relevance:0},I={begin:/"""/,end:/"""/,className:"string",relevance:0},X=JSON.parse(JSON.stringify(n.APOS_STRING_MODE));X.relevance=0;var we=JSON.parse(JSON.stringify(n.QUOTE_STRING_MODE));we.relevance=0;var Ee=JSON.parse(JSON.stringify(n.C_NUMBER_MODE));return Ee.relevance=0,{case_insensitive:!0,keywords:e,aliases:["turtle","ttl","n3","ntriples","shex","trig"],contains:[J,ne,t,Y,E,G,I,X,we,Ee,n.HASH_COMMENT_MODE],exports:{LANGTAG:J,DATATYPE:ne,IRI_LITERAL:t,BLANK_NODE:Y,PNAME:E,TRIPLE_APOS_STRING:G,TRIPLE_QUOTE_STRING:I,APOS_STRING_LITERAL:X,QUOTE_STRING_LITERAL:we,NUMBER:Ee,KEYWORDS:e}}}function Ki(n){var e=n.getLanguage("ttl").exports,t={keyword:"base|10 prefix|10 @base|10 @prefix|10 add all as|0 ask bind by|0 clear construct|10 copymove create data default define delete describe distinct drop exists filter from|0 graph|10 group having in|0 insert limit load minus named|10 not offset optional order reduced select|0 service silent to union using values where with|0",function:"abs asc avg bound ceil coalesce concat containsstrbefore count dayhours desc encode_for_uri floor group_concat if|0 iri isblank isiri isliteral isnumeric isuri langdatatype langmatches lcase max md5 min|0 minutes month now rand regex replace round sameterm sample seconds separator sha1 sha256 sha384 sha512 str strafter strdt strends strlang strlen strstarts struuid substr sum then timezone tz ucase uribnode uuid year",literal:"true|0 false|0",built_in:"a|0"},s={className:"variable",begin:"[?$]"+n.IDENT_RE,relevance:0},r={begin:/"""\s*\{/,end:/"""/,subLanguage:"json",excludeBegin:!0,excludeEnd:!0,relevance:0},i={begin:/'''\s*\{/,end:/'''/,subLanguage:"json",excludeBegin:!0,excludeEnd:!0,relevance:0};return{case_insensitive:!0,keywords:t,aliases:["sparql","rql","rq","ru"],contains:[e.LANGTAG,e.DATATYPE,e.IRI_LITERAL,e.BLANK_NODE,e.PNAME,s,r,i,e.TRIPLE_QUOTE_STRING,e.TRIPLE_APOS_STRING,e.QUOTE_STRING_LITERAL,e.APOS_STRING_LITERAL,e.NUMBER,n.HASH_COMMENT_MODE]}}const Zi="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='feather%20feather-send'%3e%3cline%20x1='22'%20y1='2'%20x2='11'%20y2='13'%3e%3c/line%3e%3cpolygon%20points='22%202%2015%2022%2011%2013%202%209%2022%202'%3e%3c/polygon%3e%3c/svg%3e",Is="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='feather%20feather-x'%3e%3cline%20x1='18'%20y1='6'%20x2='6'%20y2='18'%3e%3c/line%3e%3cline%20x1='6'%20y1='6'%20x2='18'%20y2='18'%3e%3c/line%3e%3c/svg%3e",Yi="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='feather%20feather-edit'%3e%3cpath%20d='M11%204H4a2%202%200%200%200-2%202v14a2%202%200%200%200%202%202h14a2%202%200%200%200%202-2v-7'%3e%3c/path%3e%3cpath%20d='M18.5%202.5a2.121%202.121%200%200%201%203%203L12%2015l-4%201%201-4%209.5-9.5z'%3e%3c/path%3e%3c/svg%3e",Xi="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='feather%20feather-square'%3e%3crect%20x='3'%20y='3'%20width='18'%20height='18'%20rx='2'%20ry='2'%3e%3c/rect%3e%3c/svg%3e",Vi="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='feather%20feather-thumbs-down'%3e%3cpath%20d='M10%2015v4a3%203%200%200%200%203%203l4-9V2H5.72a2%202%200%200%200-2%201.7l-1.38%209a2%202%200%200%200%202%202.3zm7-13h2.67A2.31%202.31%200%200%201%2022%204v7a2.31%202.31%200%200%201-2.33%202H17'%3e%3c/path%3e%3c/svg%3e",Qi="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='feather%20feather-thumbs-up'%3e%3cpath%20d='M14%209V5a3%203%200%200%200-3-3l-4%209v11h11.28a2%202%200%200%200%202-1.7l1.38-9a2%202%200%200%200-2-2.3zM7%2022H4a2%202%200%200%201-2-2v-7a2%202%200%200%201%202-2h3'%3e%3c/path%3e%3c/svg%3e";class Ji{constructor({apiUrl:e="",apiKey:t="",model:s=""}){this.abortRequest=()=>{this.abortController.abort(),this.abortController=new AbortController},this.lastMsg=()=>this.messages()[this.messages().length-1],this.scrollToInput=()=>{},this.appendMessage=(l,o="assistant")=>{const[f,u]=Fe(l),[p,g]=Fe([]),[x,y]=Fe([]),N={content:f,setContent:u,steps:p,setSteps:g,role:o,links:x,setLinks:y};this.setMessages(E=>[...E,N])},this.appendContentToLastMsg=(l,o=!1)=>{this.lastMsg().setContent(f=>f+(o?`
`:"")+l),this.onMessageUpdate()},this.appendStepToLastMsg=(l,o,f="",u=[])=>{this.lastMsg().setSteps(p=>[...p,{node_id:l,label:o,details:f,substeps:u}]),this.scrollToInput(),this.onMessageUpdate()},this.apiUrl=e,this.apiKey=t,this.model=s;const[r,i]=Fe([]);this.messages=r,this.setMessages=i,this.abortController=new AbortController,this.onMessageUpdate=()=>{}}}async function eo(n,e){n.appendMessage(e,"user"),await to(n)}async function to(n){var l;const e=await fetch(`${n.apiUrl}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.apiKey}`},signal:n.abortController.signal,body:JSON.stringify({messages:n.messages().map(({content:o,role:f})=>({content:o(),role:f})),stream:!0,...n.model?{model:n.model}:{}})});n.appendMessage("","assistant");const t=(l=e.body)==null?void 0:l.getReader(),s=new TextDecoder("utf-8");let r="",i=null;for(;;)if(t){const{value:o,done:f}=await t.read();if(f)break;const u=s.decode(o,{stream:!0});r+=u;let p=r.split(`
`);r=p.pop()||"";for(const g of p.filter(x=>x.trim()!=="")){if(g==="data: [DONE]")return;if(g.startsWith("event: "))i=g.substring(7).trim();else if(g.startsWith("data: "))try{const x=g.substring(6);let y;try{y=JSON.parse(x)}catch{y=x}i?($s(n,{event:i,data:y}),i=null):$s(n,y)}catch(x){console.log("Error parsing line",x,g)}}}}async function $s(n,e){var t,s,r,i,l;if(console.log("processLangGraphChunk",e),e.event==="error")throw new Error(`An error occurred. Please try again. ${e.data.error}: ${e.data.message}`);if(e.event==="updates")for(const o of Object.keys(e.data)){const f=e.data[o];if(f){if(f.steps)for(const u of f.steps)u.type==="recall"?n.appendMessage("","assistant"):u.fixed_message&&n.lastMsg().setContent(u.fixed_message),n.appendStepToLastMsg(o,u.label,u.details,u.substeps);f.structured_output&&f.structured_output.sparql_query&&n.lastMsg().setLinks([{url:Gi(f.structured_output.sparql_query,f.structured_output.sparql_endpoint_url),...ji}])}}if(e.event==="tool_call_requested")for(const o of e.data)n.currentTool=o;if(e.event==="tool_call_results"){let o=((t=n.currentTool.function)==null?void 0:t.name.replaceAll("_"," ").replace("sparql","SPARQL").replace(/^\w/,p=>p.toUpperCase()))||"Tool call";e.data.total_found&&(o+=` (${e.data.total_found})`);let f=`## Tool call
\`${(s=n.currentTool.function)==null?void 0:s.name}\`
`;const u=JSON.parse((r=n.currentTool.function)==null?void 0:r.arguments);if(u)for(const[p,g]of Object.entries(u))f+=`- **${p}**:`,p==="sparql_query"?f+=`
\`\`\`sparql
${g}
\`\`\`
`:f+=` ${g}
`;else f+=`\`\`\`json
${JSON.stringify(n.currentTool,null,2)}
\`\`\`
`;f+=e.data.results?`## Results
\`\`\`json
${JSON.stringify(e.data.results,null,2)}
\`\`\``:JSON.stringify(e.data,null,2),n.appendMessage("","assistant"),n.appendStepToLastMsg("tool_call_results",o,f)}if(console.log("CHUNK",e.event,e),e.event==="message"){const o=e.data;if(o.content&&o.type==="tool"){const f=o.name?o.name.replace(/_/g," ").replace(/^\w/,p=>p.toUpperCase()):"Tool",u=o.name.includes("resources")?"📚":o.name.includes("execute")?"📡":"🔧";n.appendMessage("","assistant"),n.appendStepToLastMsg("",`${u} ${f}`,o.content)}else o.content==="</think>"&&o.type==="AIMessageChunk"?(n.appendContentToLastMsg(o.content),n.appendStepToLastMsg("","💭 Thought process",n.lastMsg().content()),n.lastMsg().setContent("")):n.appendContentToLastMsg((l=(i=o.choices[0])==null?void 0:i.delta)==null?void 0:l.content)}e.event==="error"&&n.appendMessage(`⚠️ ${e.data.error}`,"assistant")}function no(n){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},t={match:/[{}[\],:]/,className:"punctuation",relevance:0},s=["true","false","null"],r={scope:"literal",beginKeywords:s.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:s},contains:[e,t,n.QUOTE_STRING_MODE,r,n.C_NUMBER_MODE,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var so=Se('<div><style></style><div></div><form class="p-2 flex"><div class="container flex mx-auto max-w-5xl"><textarea autofocus class="flex-grow px-4 py-2 h-auto border border-slate-400 bg-slate-200 dark:bg-slate-700 dark:border-slate-500 rounded-3xl focus:outline-none focus:ring focus:ring-blue-200 dark:focus:ring-blue-400 overflow-y-hidden resize-none"placeholder="Ask your question"rows=1></textarea><button type=submit class="ml-2 px-4 py-2 rounded-3xl text-slate-500 bg-slate-200 dark:text-slate-400 dark:bg-slate-700"></button><button title="Start a new conversation"class="ml-2 px-4 py-2 rounded-3xl text-slate-500 bg-slate-200 dark:text-slate-400 dark:bg-slate-700"><img alt="Start a new conversation"class=iconBtn>'),ro=Se('<div><div><div class="flex flex-col items-start"></div><article class="prose max-w-full">'),Ds=Se('<button class="text-gray-600 ml-8 mb-4 px-3 py-1 border border-gray-300 rounded-lg bg-gray-100 hover:bg-gray-200 transition-colors">'),io=Se('<dialog class="bg-white dark:bg-gray-800 m-3 rounded-3xl shadow-md w-full"><button class="fixed top-2 right-8 m-3 px-2 text-xl text-slate-500 bg-gray-200 dark:bg-gray-700 rounded-3xl"title="Close documents details"><img alt="Close the dialog"class=iconBtn></button><article class="prose max-w-full p-3"><div class="flex space-x-2 mb-4">'),oo=Se("<button>"),lo=Se('<article class="prose max-w-full">'),ao=Se('<dialog class="bg-white dark:bg-gray-800 m-3 rounded-3xl shadow-md w-full"><button class="fixed top-2 right-8 m-3 px-2 text-xl text-slate-500 bg-gray-200 dark:bg-gray-700 rounded-3xl"title="Close step details"><img alt="Close the dialog"class=iconBtn></button><article class="prose max-w-full p-6">'),co=Se('<p class="text-gray-400 ml-8 mb-4">'),uo=Se('<a target=_blank class=hover:text-inherit><button class="my-3 mr-1 px-3 py-1 text-sm bg-gray-300 dark:bg-gray-700 rounded-3xl align-middle">'),fo=Se('<button class="mr-1 my-3 px-3 py-1 text-sm hover:bg-gray-300 dark:hover:bg-gray-800 rounded-3xl align-middle"title="Report a good response"><img alt="Thumbs up"height=20px width=20px class=iconBtn>'),po=Se('<button class="my-3 px-3 py-1 text-sm hover:bg-gray-300 dark:hover:bg-gray-800 rounded-3xl align-middle"title="Report a bad response"><img alt="Thumbs down"height=20px width=20px class=iconBtn>'),ho=Se('<div class=text-center><div class="bg-orange-300 p-2 text-orange-900 text-sm rounded-3xl font-semibold mb-2 inline-block">'),go=Se('<img alt="Stop generation"class=iconBtn>'),bo=Se('<img alt="Send question"class=iconBtn>'),mo=Se('<div class="py-2 px-4 justify-center items-center text-sm flex flex-col space-y-2">'),_o=Se('<button class="px-5 py-2.5 bg-slate-200 text-slate-600 rounded-3xl">');Fr("chat-with-context",{chatEndpoint:"",examples:"",apiKey:"",feedbackEndpoint:"",model:""},n=>{Dr(),yn.registerLanguage("ttl",Wi),yn.registerLanguage("sparql",Ki),yn.registerLanguage("json",no);const[e,t]=Fe([]),[s,r]=Fe(""),[i,l]=Fe(!1),[o,f]=Fe(""),[u,p]=Fe(""),[g,x]=Fe(""),[y,N]=Fe(!1),E=new Ji({});let Y,J;F.use({gfm:!0}),hs(()=>{n.chatEndpoint===""&&r("Please provide an API URL for the chat component to work."),E.apiUrl=n.chatEndpoint,E.apiKey=n.apiKey,E.model=n.model,E.scrollToInput=()=>J.scrollIntoView({behavior:"smooth"}),E.onMessageUpdate=()=>I(),t(n.examples.split(",").map(B=>B.trim())),x(n.feedbackEndpoint),Ee()});const ne=B=>{f(B),document.getElementById(B).showModal(),history.pushState({dialogOpen:!0},""),document.body.style.overflow="hidden",I()},G=()=>{document.body.style.overflow="";const B=document.getElementById(o());B&&B.close(),f("")};hs(()=>{window.addEventListener("popstate",B=>{o()&&(B.preventDefault(),G())})});const I=()=>{document.querySelectorAll("pre code:not(.hljs)").forEach(B=>{yn.highlightElement(B)})};async function X(B){if(!B.trim()||i())return;J.value="",l(!0),r(""),setTimeout(()=>Ee(),0);const $e=Date.now();try{await eo(E,B)}catch(he){he instanceof Error&&he.name!=="AbortError"&&(console.error("An error occurred when querying the API:",he),r("An error occurred when querying the API. Please try again or contact an admin."))}l(!1),N(!1),I(),E.scrollToInput(),console.log(`Request completed in ${(Date.now()-$e)/1e3} seconds`)}function we(B){fetch(g(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({like:B,messages:E.messages().map($e=>({role:$e.role,content:$e.content(),steps:$e.steps().map(he=>({label:he.label,details:he.details,node_id:he.node_id,substeps:he.substeps}))}))})}),N(!0)}function Ee(){J.style.height="auto",J.style.height=J.scrollHeight+"px"}return(()=>{var B=so(),$e=B.firstChild,he=$e.nextSibling,le=he.nextSibling,ft=le.firstChild,Ze=ft.firstChild,De=Ze.nextSibling,Et=De.nextSibling,It=Et.firstChild;be($e,qi);var yt=Y;typeof yt=="function"?bs(yt,he):Y=he,be(he,Nt(Mt,{get each(){return E.messages()},children:(U,V)=>(()=>{var H=ro(),ye=H.firstChild,ae=ye.firstChild,kt=ae.nextSibling;return be(ae,Nt(Mt,{get each(){return U.steps()},children:(v,j)=>v.substeps&&v.substeps.length>0?[(()=>{var $=Ds();return $.$$click=()=>{var ee,Le;p(((Le=(ee=v.substeps)==null?void 0:ee[0])==null?void 0:Le.label)||""),ne(`step-dialog-${V()}-${j()}`)},be($,()=>v.label),He(()=>_e($,"title",`Click to see the documents used to generate the response
Node: ${v.node_id}`)),$})(),(()=>{var $=io(),ee=$.firstChild,Le=ee.firstChild,Re=ee.nextSibling,Ie=Re.firstChild;return $.addEventListener("close",()=>G()),ee.$$click=()=>G(),_e(Le,"src",Is),be(Ie,Nt(Mt,{get each(){return v.substeps.map(K=>K.label)},children:K=>(()=>{var ce=oo();return ce.$$click=()=>{p(K),I()},_e(ce,"title",`Show ${K}`),be(ce,K),He(()=>Gt(ce,`px-4 py-2 rounded-lg transition-all ${u()===K?"bg-gray-600 text-white shadow-md":"bg-gray-200 text-gray-700 hover:bg-gray-300"}`)),ce})()})),be(Re,Nt(Mt,{get each(){return v.substeps.filter(K=>K.label===u())},children:K=>(()=>{var ce=lo();return He(()=>ce.innerHTML=Kn.sanitize(F.parse(K.details),{ADD_TAGS:["think"]})),ce})()}),null),He(K=>{var ce=`step-dialog-${V()}-${j()}`,ve=`close-dialog-${V()}-${j()}`;return ce!==K.e&&_e($,"id",K.e=ce),ve!==K.t&&_e(ee,"id",K.t=ve),K},{e:void 0,t:void 0}),$})()]:v.details?[(()=>{var $=Ds();return $.$$click=()=>{ne(`step-dialog-${V()}-${j()}`)},be($,()=>v.label),He(()=>_e($,"title",`Click to see the documents used to generate the response
Node: ${v.node_id}`)),$})(),(()=>{var $=ao(),ee=$.firstChild,Le=ee.firstChild,Re=ee.nextSibling;return $.addEventListener("close",()=>G()),ee.$$click=()=>G(),_e(Le,"src",Is),He(Ie=>{var K=`step-dialog-${V()}-${j()}`,ce=`close-dialog-${V()}-${j()}`,ve=Kn.sanitize(F.parse(v.details),{ADD_TAGS:["think"]});return K!==Ie.e&&_e($,"id",Ie.e=K),ce!==Ie.t&&_e(ee,"id",Ie.t=ce),ve!==Ie.a&&(Re.innerHTML=Ie.a=ve),Ie},{e:void 0,t:void 0,a:void 0}),$})()]:(()=>{var $=co();return be($,()=>v.label),He(()=>_e($,"title",`Node: ${v.node_id}`)),$})()})),be(ye,Nt(Mt,{get each(){return U.links()},children:v=>(()=>{var j=uo(),$=j.firstChild;return be($,()=>v.label),He(ee=>{var Le=v.url,Re=v.title;return Le!==ee.e&&_e(j,"href",ee.e=Le),Re!==ee.t&&_e(j,"title",ee.t=Re),ee},{e:void 0,t:void 0}),j})()}),null),be(ye,(()=>{var v=Qt(()=>!!(g()&&U.role==="assistant"&&V()===E.messages().length-1&&E.lastMsg().content()&&!y()));return()=>v()&&[(()=>{var j=fo(),$=j.firstChild;return j.$$click=()=>we(!0),_e($,"src",Qi),j})(),(()=>{var j=po(),$=j.firstChild;return j.$$click=()=>we(!1),_e($,"src",Vi),j})()]})(),null),He(v=>{var j=`w-full flex flex-col flex-grow ${U.role==="user"?"items-end":""}`,$=`py-2.5 mb-2 ${U.role==="user"?"bg-gray-300 rounded-3xl px-5":""}`,ee=Kn.sanitize(F.parse(U.content()),{ADD_TAGS:["think"]});return j!==v.e&&Gt(H,v.e=j),$!==v.t&&Gt(ye,v.t=$),ee!==v.a&&(kt.innerHTML=v.a=ee),v},{e:void 0,t:void 0,a:void 0}),H})()})),be(B,(()=>{var U=Qt(()=>!!s());return()=>U()&&(()=>{var V=ho(),H=V.firstChild;return be(H,s),V})()})(),le),le.addEventListener("submit",U=>{U.preventDefault(),U.type==="submit"&&U.submitter&&i()&&E.abortRequest(),X(J.value)}),Ze.$$input=()=>Ee(),Ze.$$keydown=U=>{U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),X(J.value))};var Ve=J;return typeof Ve=="function"?bs(Ve,Ze):J=Ze,be(De,(()=>{var U=Qt(()=>!!i());return()=>U()?(()=>{var V=go();return _e(V,"src",Xi),V})():(()=>{var V=bo();return _e(V,"src",Zi),V})()})()),Et.$$click=()=>E.setMessages([]),_e(It,"src",Yi),be(B,(()=>{var U=Qt(()=>E.messages().length<1);return()=>U()&&(()=>{var V=mo();return be(V,Nt(Mt,{get each(){return e()},children:H=>(()=>{var ye=_o();return ye.$$click=()=>X(H),be(ye,H),ye})()})),V})()})(),null),He(U=>{var V=`chat-with-context w-full h-full flex flex-col ${E.messages().length===0?"justify-center":""}`,H=`overflow-y-auto ${E.messages().length!==0?"flex-grow":""}`,ye=i()?"Stop generation":"Send question";return V!==U.e&&Gt(B,U.e=V),H!==U.t&&Gt(he,U.t=H),ye!==U.a&&_e(De,"title",U.a=ye),U},{e:void 0,t:void 0,a:void 0}),B})()});Rr(["keydown","input","click"]);