@blueking/ai-blueking 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -266,5 +266,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
266
266
|
`:">",i)},_r.prototype.renderInline=function(t,e,n){for(var r,o="",i=this.rules,a=0,s=t.length;a<s;a++)r=t[a].type,typeof i[r]<"u"?o+=i[r](t,a,e,n,this):o+=this.renderToken(t,a,e);return o},_r.prototype.renderInlineAsText=function(t,e,n){for(var r="",o=0,i=t.length;o<i;o++)t[o].type==="text"?r+=t[o].content:t[o].type==="image"?r+=this.renderInlineAsText(t[o].children,e,n):t[o].type==="softbreak"&&(r+=`
|
|
267
267
|
`);return r},_r.prototype.render=function(t,e,n){var r,o,i,a="",s=this.rules;for(r=0,o=t.length;r<o;r++)i=t[r].type,i==="inline"?a+=this.renderInline(t[r].children,e,n):typeof s[i]<"u"?a+=s[i](t,r,e,n,this):a+=this.renderToken(t,r,e,n);return a};var cS=_r;function Qt(){this.__rules__=[],this.__cache__=null}Qt.prototype.__find__=function(t){for(var e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1},Qt.prototype.__compile__=function(){var t=this,e=[""];t.__rules__.forEach(function(n){n.enabled&&n.alt.forEach(function(r){e.indexOf(r)<0&&e.push(r)})}),t.__cache__={},e.forEach(function(n){t.__cache__[n]=[],t.__rules__.forEach(function(r){r.enabled&&(n&&r.alt.indexOf(n)<0||t.__cache__[n].push(r.fn))})})},Qt.prototype.at=function(t,e,n){var r=this.__find__(t),o=n||{};if(r===-1)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=e,this.__rules__[r].alt=o.alt||[],this.__cache__=null},Qt.prototype.before=function(t,e,n,r){var o=this.__find__(t),i=r||{};if(o===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(o,0,{name:e,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null},Qt.prototype.after=function(t,e,n,r){var o=this.__find__(t),i=r||{};if(o===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(o+1,0,{name:e,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null},Qt.prototype.push=function(t,e,n){var r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null},Qt.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);var n=[];return t.forEach(function(r){var o=this.__find__(r);if(o<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[o].enabled=!0,n.push(r)},this),this.__cache__=null,n},Qt.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(n){n.enabled=!1}),this.enable(t,e)},Qt.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);var n=[];return t.forEach(function(r){var o=this.__find__(r);if(o<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[o].enabled=!1,n.push(r)},this),this.__cache__=null,n},Qt.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};var $c=Qt,lS=/\r\n?|\n/g,uS=/\0/g,fS=function(e){var n;n=e.src.replace(lS,`
|
|
268
268
|
`),n=n.replace(uS,"�"),e.src=n},dS=function(e){var n;e.inlineMode?(n=new e.Token("inline","",0),n.content=e.src,n.map=[0,1],n.children=[],e.tokens.push(n)):e.md.block.parse(e.src,e.md,e.env,e.tokens)},pS=function(e){var n=e.tokens,r,o,i;for(o=0,i=n.length;o<i;o++)r=n[o],r.type==="inline"&&e.md.inline.parse(r.content,e.md,e.env,r.children)},gS=Se.arrayReplaceAt;function mS(t){return/^<a[>\s]/i.test(t)}function hS(t){return/^<\/a\s*>/i.test(t)}var bS=function(e){var n,r,o,i,a,s,c,l,u,f,p,d,m,g,y,h,I=e.tokens,M;if(e.md.options.linkify){for(r=0,o=I.length;r<o;r++)if(!(I[r].type!=="inline"||!e.md.linkify.pretest(I[r].content)))for(i=I[r].children,m=0,n=i.length-1;n>=0;n--){if(s=i[n],s.type==="link_close"){for(n--;i[n].level!==s.level&&i[n].type!=="link_open";)n--;continue}if(s.type==="html_inline"&&(mS(s.content)&&m>0&&m--,hS(s.content)&&m++),!(m>0)&&s.type==="text"&&e.md.linkify.test(s.content)){for(u=s.content,M=e.md.linkify.match(u),c=[],d=s.level,p=0,M.length>0&&M[0].index===0&&n>0&&i[n-1].type==="text_special"&&(M=M.slice(1)),l=0;l<M.length;l++)g=M[l].url,y=e.md.normalizeLink(g),e.md.validateLink(y)&&(h=M[l].text,M[l].schema?M[l].schema==="mailto:"&&!/^mailto:/i.test(h)?h=e.md.normalizeLinkText("mailto:"+h).replace(/^mailto:/,""):h=e.md.normalizeLinkText(h):h=e.md.normalizeLinkText("http://"+h).replace(/^http:\/\//,""),f=M[l].index,f>p&&(a=new e.Token("text","",0),a.content=u.slice(p,f),a.level=d,c.push(a)),a=new e.Token("link_open","a",1),a.attrs=[["href",y]],a.level=d++,a.markup="linkify",a.info="auto",c.push(a),a=new e.Token("text","",0),a.content=h,a.level=d,c.push(a),a=new e.Token("link_close","a",-1),a.level=--d,a.markup="linkify",a.info="auto",c.push(a),p=M[l].lastIndex);p<u.length&&(a=new e.Token("text","",0),a.content=u.slice(p),a.level=d,c.push(a)),I[r].children=i=gS(i,n,c)}}}},cm=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,vS=/\((c|tm|r)\)/i,yS=/\((c|tm|r)\)/ig,AS={c:"©",r:"®",tm:"™"};function wS(t,e){return AS[e.toLowerCase()]}function kS(t){var e,n,r=0;for(e=t.length-1;e>=0;e--)n=t[e],n.type==="text"&&!r&&(n.content=n.content.replace(yS,wS)),n.type==="link_open"&&n.info==="auto"&&r--,n.type==="link_close"&&n.info==="auto"&&r++}function IS(t){var e,n,r=0;for(e=t.length-1;e>=0;e--)n=t[e],n.type==="text"&&!r&&cm.test(n.content)&&(n.content=n.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),n.type==="link_open"&&n.info==="auto"&&r--,n.type==="link_close"&&n.info==="auto"&&r++}var xS=function(e){var n;if(e.md.options.typographer)for(n=e.tokens.length-1;n>=0;n--)e.tokens[n].type==="inline"&&(vS.test(e.tokens[n].content)&&kS(e.tokens[n].children),cm.test(e.tokens[n].content)&&IS(e.tokens[n].children))},lm=Se.isWhiteSpace,um=Se.isPunctChar,fm=Se.isMdAsciiPunct,MS=/['"]/,dm=/['"]/g,pm="’";function Ua(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function CS(t,e){var n,r,o,i,a,s,c,l,u,f,p,d,m,g,y,h,I,M,O,C,T;for(O=[],n=0;n<t.length;n++){for(r=t[n],c=t[n].level,I=O.length-1;I>=0&&!(O[I].level<=c);I--);if(O.length=I+1,r.type==="text"){o=r.content,a=0,s=o.length;e:for(;a<s&&(dm.lastIndex=a,i=dm.exec(o),!!i);){if(y=h=!0,a=i.index+1,M=i[0]==="'",u=32,i.index-1>=0)u=o.charCodeAt(i.index-1);else for(I=n-1;I>=0&&!(t[I].type==="softbreak"||t[I].type==="hardbreak");I--)if(t[I].content){u=t[I].content.charCodeAt(t[I].content.length-1);break}if(f=32,a<s)f=o.charCodeAt(a);else for(I=n+1;I<t.length&&!(t[I].type==="softbreak"||t[I].type==="hardbreak");I++)if(t[I].content){f=t[I].content.charCodeAt(0);break}if(p=fm(u)||um(String.fromCharCode(u)),d=fm(f)||um(String.fromCharCode(f)),m=lm(u),g=lm(f),g?y=!1:d&&(m||p||(y=!1)),m?h=!1:p&&(g||d||(h=!1)),f===34&&i[0]==='"'&&u>=48&&u<=57&&(h=y=!1),y&&h&&(y=p,h=d),!y&&!h){M&&(r.content=Ua(r.content,i.index,pm));continue}if(h){for(I=O.length-1;I>=0&&(l=O[I],!(O[I].level<c));I--)if(l.single===M&&O[I].level===c){l=O[I],M?(C=e.md.options.quotes[2],T=e.md.options.quotes[3]):(C=e.md.options.quotes[0],T=e.md.options.quotes[1]),r.content=Ua(r.content,i.index,T),t[l.token].content=Ua(t[l.token].content,l.pos,C),a+=T.length-1,l.token===n&&(a+=C.length-1),o=r.content,s=o.length,O.length=I;continue e}}y?O.push({token:n,pos:i.index,single:M,level:c}):h&&M&&(r.content=Ua(r.content,i.index,pm))}}}}var jS=function(e){var n;if(e.md.options.typographer)for(n=e.tokens.length-1;n>=0;n--)e.tokens[n].type!=="inline"||!MS.test(e.tokens[n].content)||CS(e.tokens[n].children,e)},TS=function(e){var n,r,o,i,a,s,c=e.tokens;for(n=0,r=c.length;n<r;n++)if(c[n].type==="inline"){for(o=c[n].children,a=o.length,i=0;i<a;i++)o[i].type==="text_special"&&(o[i].type="text");for(i=s=0;i<a;i++)o[i].type==="text"&&i+1<a&&o[i+1].type==="text"?o[i+1].content=o[i].content+o[i+1].content:(i!==s&&(o[s]=o[i]),s++);i!==s&&(o.length=s)}};function Wr(t,e,n){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}Wr.prototype.attrIndex=function(e){var n,r,o;if(!this.attrs)return-1;for(n=this.attrs,r=0,o=n.length;r<o;r++)if(n[r][0]===e)return r;return-1},Wr.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},Wr.prototype.attrSet=function(e,n){var r=this.attrIndex(e),o=[e,n];r<0?this.attrPush(o):this.attrs[r]=o},Wr.prototype.attrGet=function(e){var n=this.attrIndex(e),r=null;return n>=0&&(r=this.attrs[n][1]),r},Wr.prototype.attrJoin=function(e,n){var r=this.attrIndex(e);r<0?this.attrPush([e,n]):this.attrs[r][1]=this.attrs[r][1]+" "+n};var qc=Wr,LS=qc;function gm(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}gm.prototype.Token=LS;var SS=gm,NS=$c,Xc=[["normalize",fS],["block",dS],["inline",pS],["linkify",bS],["replacements",xS],["smartquotes",jS],["text_join",TS]];function Kc(){this.ruler=new NS;for(var t=0;t<Xc.length;t++)this.ruler.push(Xc[t][0],Xc[t][1])}Kc.prototype.process=function(t){var e,n,r;for(r=this.ruler.getRules(""),e=0,n=r.length;e<n;e++)r[e](t)},Kc.prototype.State=SS;var DS=Kc,el=Se.isSpace;function tl(t,e){var n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function mm(t){var e=[],n=0,r=t.length,o,i=!1,a=0,s="";for(o=t.charCodeAt(n);n<r;)o===124&&(i?(s+=t.substring(a,n-1),a=n):(e.push(s+t.substring(a,n)),s="",a=n+1)),i=o===92,n++,o=t.charCodeAt(n);return e.push(s+t.substring(a)),e}var OS=function(e,n,r,o){var i,a,s,c,l,u,f,p,d,m,g,y,h,I,M,O,C,T;if(n+2>r||(u=n+1,e.sCount[u]<e.blkIndent)||e.sCount[u]-e.blkIndent>=4||(s=e.bMarks[u]+e.tShift[u],s>=e.eMarks[u])||(C=e.src.charCodeAt(s++),C!==124&&C!==45&&C!==58)||s>=e.eMarks[u]||(T=e.src.charCodeAt(s++),T!==124&&T!==45&&T!==58&&!el(T))||C===45&&el(T))return!1;for(;s<e.eMarks[u];){if(i=e.src.charCodeAt(s),i!==124&&i!==45&&i!==58&&!el(i))return!1;s++}for(a=tl(e,n+1),f=a.split("|"),m=[],c=0;c<f.length;c++){if(g=f[c].trim(),!g){if(c===0||c===f.length-1)continue;return!1}if(!/^:?-+:?$/.test(g))return!1;g.charCodeAt(g.length-1)===58?m.push(g.charCodeAt(0)===58?"center":"right"):g.charCodeAt(0)===58?m.push("left"):m.push("")}if(a=tl(e,n).trim(),a.indexOf("|")===-1||e.sCount[n]-e.blkIndent>=4||(f=mm(a),f.length&&f[0]===""&&f.shift(),f.length&&f[f.length-1]===""&&f.pop(),p=f.length,p===0||p!==m.length))return!1;if(o)return!0;for(I=e.parentType,e.parentType="table",O=e.md.block.ruler.getRules("blockquote"),d=e.push("table_open","table",1),d.map=y=[n,0],d=e.push("thead_open","thead",1),d.map=[n,n+1],d=e.push("tr_open","tr",1),d.map=[n,n+1],c=0;c<f.length;c++)d=e.push("th_open","th",1),m[c]&&(d.attrs=[["style","text-align:"+m[c]]]),d=e.push("inline","",0),d.content=f[c].trim(),d.children=[],d=e.push("th_close","th",-1);for(d=e.push("tr_close","tr",-1),d=e.push("thead_close","thead",-1),u=n+2;u<r&&!(e.sCount[u]<e.blkIndent);u++){for(M=!1,c=0,l=O.length;c<l;c++)if(O[c](e,u,r,!0)){M=!0;break}if(M||(a=tl(e,u).trim(),!a)||e.sCount[u]-e.blkIndent>=4)break;for(f=mm(a),f.length&&f[0]===""&&f.shift(),f.length&&f[f.length-1]===""&&f.pop(),u===n+2&&(d=e.push("tbody_open","tbody",1),d.map=h=[n+2,0]),d=e.push("tr_open","tr",1),d.map=[u,u+1],c=0;c<p;c++)d=e.push("td_open","td",1),m[c]&&(d.attrs=[["style","text-align:"+m[c]]]),d=e.push("inline","",0),d.content=f[c]?f[c].trim():"",d.children=[],d=e.push("td_close","td",-1);d=e.push("tr_close","tr",-1)}return h&&(d=e.push("tbody_close","tbody",-1),h[1]=u),d=e.push("table_close","table",-1),y[1]=u,e.parentType=I,e.line=u,!0},PS=function(e,n,r){var o,i,a;if(e.sCount[n]-e.blkIndent<4)return!1;for(i=o=n+1;o<r;){if(e.isEmpty(o)){o++;continue}if(e.sCount[o]-e.blkIndent>=4){o++,i=o;continue}break}return e.line=i,a=e.push("code_block","code",0),a.content=e.getLines(n,i,4+e.blkIndent,!1)+`
|
|
269
|
-
`,a.map=[n,e.line],!0},zS=function(e,n,r,o){var i,a,s,c,l,u,f,p=!1,d=e.bMarks[n]+e.tShift[n],m=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||d+3>m||(i=e.src.charCodeAt(d),i!==126&&i!==96)||(l=d,d=e.skipChars(d,i),a=d-l,a<3)||(f=e.src.slice(l,d),s=e.src.slice(d,m),i===96&&s.indexOf(String.fromCharCode(i))>=0))return!1;if(o)return!0;for(c=n;c++,!(c>=r||(d=l=e.bMarks[c]+e.tShift[c],m=e.eMarks[c],d<m&&e.sCount[c]<e.blkIndent));)if(e.src.charCodeAt(d)===i&&!(e.sCount[c]-e.blkIndent>=4)&&(d=e.skipChars(d,i),!(d-l<a)&&(d=e.skipSpaces(d),!(d<m)))){p=!0;break}return a=e.sCount[n],e.line=c+(p?1:0),u=e.push("fence","code",0),u.info=s,u.content=e.getLines(n+1,c,a,!0),u.markup=f,u.map=[n,e.line],!0},ES=Se.isSpace,QS=function(e,n,r,o){var i,a,s,c,l,u,f,p,d,m,g,y,h,I,M,O,C,T,H,W,ne=e.lineMax,R=e.bMarks[n]+e.tShift[n],K=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(R)!==62)return!1;if(o)return!0;for(m=[],g=[],I=[],M=[],T=e.md.block.ruler.getRules("blockquote"),h=e.parentType,e.parentType="blockquote",p=n;p<r&&(W=e.sCount[p]<e.blkIndent,R=e.bMarks[p]+e.tShift[p],K=e.eMarks[p],!(R>=K));p++){if(e.src.charCodeAt(R++)===62&&!W){for(c=e.sCount[p]+1,e.src.charCodeAt(R)===32?(R++,c++,i=!1,O=!0):e.src.charCodeAt(R)===9?(O=!0,(e.bsCount[p]+c)%4===3?(R++,c++,i=!1):i=!0):O=!1,d=c,m.push(e.bMarks[p]),e.bMarks[p]=R;R<K&&(a=e.src.charCodeAt(R),ES(a));){a===9?d+=4-(d+e.bsCount[p]+(i?1:0))%4:d++;R++}u=R>=K,g.push(e.bsCount[p]),e.bsCount[p]=e.sCount[p]+1+(O?1:0),I.push(e.sCount[p]),e.sCount[p]=d-c,M.push(e.tShift[p]),e.tShift[p]=R-e.bMarks[p];continue}if(u)break;for(C=!1,s=0,l=T.length;s<l;s++)if(T[s](e,p,r,!0)){C=!0;break}if(C){e.lineMax=p,e.blkIndent!==0&&(m.push(e.bMarks[p]),g.push(e.bsCount[p]),M.push(e.tShift[p]),I.push(e.sCount[p]),e.sCount[p]-=e.blkIndent);break}m.push(e.bMarks[p]),g.push(e.bsCount[p]),M.push(e.tShift[p]),I.push(e.sCount[p]),e.sCount[p]=-1}for(y=e.blkIndent,e.blkIndent=0,H=e.push("blockquote_open","blockquote",1),H.markup=">",H.map=f=[n,0],e.md.block.tokenize(e,n,p),H=e.push("blockquote_close","blockquote",-1),H.markup=">",e.lineMax=ne,e.parentType=h,f[1]=e.line,s=0;s<M.length;s++)e.bMarks[s+n]=m[s],e.tShift[s+n]=M[s],e.sCount[s+n]=I[s],e.bsCount[s+n]=g[s];return e.blkIndent=y,!0},JS=Se.isSpace,RS=function(e,n,r,o){var i,a,s,c,l=e.bMarks[n]+e.tShift[n],u=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||(i=e.src.charCodeAt(l++),i!==42&&i!==45&&i!==95))return!1;for(a=1;l<u;){if(s=e.src.charCodeAt(l++),s!==i&&!JS(s))return!1;s===i&&a++}return a<3?!1:(o||(e.line=n+1,c=e.push("hr","hr",0),c.map=[n,e.line],c.markup=Array(a+1).join(String.fromCharCode(i))),!0)},hm=Se.isSpace;function bm(t,e){var n,r,o,i;return r=t.bMarks[e]+t.tShift[e],o=t.eMarks[e],n=t.src.charCodeAt(r++),n!==42&&n!==45&&n!==43||r<o&&(i=t.src.charCodeAt(r),!hm(i))?-1:r}function vm(t,e){var n,r=t.bMarks[e]+t.tShift[e],o=r,i=t.eMarks[e];if(o+1>=i||(n=t.src.charCodeAt(o++),n<48||n>57))return-1;for(;;){if(o>=i)return-1;if(n=t.src.charCodeAt(o++),n>=48&&n<=57){if(o-r>=10)return-1;continue}if(n===41||n===46)break;return-1}return o<i&&(n=t.src.charCodeAt(o),!hm(n))?-1:o}function BS(t,e){var n,r,o=t.level+2;for(n=e+2,r=t.tokens.length-2;n<r;n++)t.tokens[n].level===o&&t.tokens[n].type==="paragraph_open"&&(t.tokens[n+2].hidden=!0,t.tokens[n].hidden=!0,n+=2)}var GS=function(e,n,r,o){var i,a,s,c,l,u,f,p,d,m,g,y,h,I,M,O,C,T,H,W,ne,R,K,G,U,J,P,z=n,V=!1,ee=!0;if(e.sCount[z]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[z]-e.listIndent>=4&&e.sCount[z]<e.blkIndent)return!1;if(o&&e.parentType==="paragraph"&&e.sCount[z]>=e.blkIndent&&(V=!0),(R=vm(e,z))>=0){if(f=!0,G=e.bMarks[z]+e.tShift[z],h=Number(e.src.slice(G,R-1)),V&&h!==1)return!1}else if((R=bm(e,z))>=0)f=!1;else return!1;if(V&&e.skipSpaces(R)>=e.eMarks[z])return!1;if(o)return!0;for(y=e.src.charCodeAt(R-1),g=e.tokens.length,f?(P=e.push("ordered_list_open","ol",1),h!==1&&(P.attrs=[["start",h]])):P=e.push("bullet_list_open","ul",1),P.map=m=[z,0],P.markup=String.fromCharCode(y),K=!1,J=e.md.block.ruler.getRules("list"),C=e.parentType,e.parentType="list";z<r;){for(ne=R,I=e.eMarks[z],u=M=e.sCount[z]+R-(e.bMarks[z]+e.tShift[z]);ne<I;){if(i=e.src.charCodeAt(ne),i===9)M+=4-(M+e.bsCount[z])%4;else if(i===32)M++;else break;ne++}if(a=ne,a>=I?l=1:l=M-u,l>4&&(l=1),c=u+l,P=e.push("list_item_open","li",1),P.markup=String.fromCharCode(y),P.map=p=[z,0],f&&(P.info=e.src.slice(G,R-1)),W=e.tight,H=e.tShift[z],T=e.sCount[z],O=e.listIndent,e.listIndent=e.blkIndent,e.blkIndent=c,e.tight=!0,e.tShift[z]=a-e.bMarks[z],e.sCount[z]=M,a>=I&&e.isEmpty(z+1)?e.line=Math.min(e.line+2,r):e.md.block.tokenize(e,z,r,!0),(!e.tight||K)&&(ee=!1),K=e.line-z>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=O,e.tShift[z]=H,e.sCount[z]=T,e.tight=W,P=e.push("list_item_close","li",-1),P.markup=String.fromCharCode(y),z=e.line,p[1]=z,z>=r||e.sCount[z]<e.blkIndent||e.sCount[z]-e.blkIndent>=4)break;for(U=!1,s=0,d=J.length;s<d;s++)if(J[s](e,z,r,!0)){U=!0;break}if(U)break;if(f){if(R=vm(e,z),R<0)break;G=e.bMarks[z]+e.tShift[z]}else if(R=bm(e,z),R<0)break;if(y!==e.src.charCodeAt(R-1))break}return f?P=e.push("ordered_list_close","ol",-1):P=e.push("bullet_list_close","ul",-1),P.markup=String.fromCharCode(y),m[1]=z,e.line=z,e.parentType=C,ee&&BS(e,g),!0},FS=Se.normalizeReference,$a=Se.isSpace,ZS=function(e,n,r,o){var i,a,s,c,l,u,f,p,d,m,g,y,h,I,M,O,C=0,T=e.bMarks[n]+e.tShift[n],H=e.eMarks[n],W=n+1;if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(T)!==91)return!1;for(;++T<H;)if(e.src.charCodeAt(T)===93&&e.src.charCodeAt(T-1)!==92){if(T+1===H||e.src.charCodeAt(T+1)!==58)return!1;break}for(c=e.lineMax,M=e.md.block.ruler.getRules("reference"),m=e.parentType,e.parentType="reference";W<c&&!e.isEmpty(W);W++)if(!(e.sCount[W]-e.blkIndent>3)&&!(e.sCount[W]<0)){for(I=!1,u=0,f=M.length;u<f;u++)if(M[u](e,W,c,!0)){I=!0;break}if(I)break}for(h=e.getLines(n,W,e.blkIndent,!1).trim(),H=h.length,T=1;T<H;T++){if(i=h.charCodeAt(T),i===91)return!1;if(i===93){d=T;break}else i===10?C++:i===92&&(T++,T<H&&h.charCodeAt(T)===10&&C++)}if(d<0||h.charCodeAt(d+1)!==58)return!1;for(T=d+2;T<H;T++)if(i=h.charCodeAt(T),i===10)C++;else if(!$a(i))break;if(g=e.md.helpers.parseLinkDestination(h,T,H),!g.ok||(l=e.md.normalizeLink(g.str),!e.md.validateLink(l)))return!1;for(T=g.pos,C+=g.lines,a=T,s=C,y=T;T<H;T++)if(i=h.charCodeAt(T),i===10)C++;else if(!$a(i))break;for(g=e.md.helpers.parseLinkTitle(h,T,H),T<H&&y!==T&&g.ok?(O=g.str,T=g.pos,C+=g.lines):(O="",T=a,C=s);T<H&&(i=h.charCodeAt(T),!!$a(i));)T++;if(T<H&&h.charCodeAt(T)!==10&&O)for(O="",T=a,C=s;T<H&&(i=h.charCodeAt(T),!!$a(i));)T++;return T<H&&h.charCodeAt(T)!==10||(p=FS(h.slice(1,d)),!p)?!1:(o||(typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[p]>"u"&&(e.env.references[p]={title:O,href:l}),e.parentType=m,e.line=n+C+1),!0)},HS=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],qa={},YS="[a-zA-Z_:][a-zA-Z0-9:._-]*",VS="[^\"'=<>`\\x00-\\x20]+",_S="'[^']*'",WS='"[^"]*"',US="(?:"+VS+"|"+_S+"|"+WS+")",$S="(?:\\s+"+YS+"(?:\\s*=\\s*"+US+")?)",ym="<[A-Za-z][A-Za-z0-9\\-]*"+$S+"*\\s*\\/?>",Am="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",qS="<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->",XS="<[?][\\s\\S]*?[?]>",KS="<![A-Z]+\\s+[^>]*>",eN="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",tN=new RegExp("^(?:"+ym+"|"+Am+"|"+qS+"|"+XS+"|"+KS+"|"+eN+")"),nN=new RegExp("^(?:"+ym+"|"+Am+")");qa.HTML_TAG_RE=tN,qa.HTML_OPEN_CLOSE_TAG_RE=nN;var rN=HS,oN=qa.HTML_OPEN_CLOSE_TAG_RE,Ur=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+rN.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(oN.source+"\\s*$"),/^$/,!1]],iN=function(e,n,r,o){var i,a,s,c,l=e.bMarks[n]+e.tShift[n],u=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(l)!==60)return!1;for(c=e.src.slice(l,u),i=0;i<Ur.length&&!Ur[i][0].test(c);i++);if(i===Ur.length)return!1;if(o)return Ur[i][2];if(a=n+1,!Ur[i][1].test(c)){for(;a<r&&!(e.sCount[a]<e.blkIndent);a++)if(l=e.bMarks[a]+e.tShift[a],u=e.eMarks[a],c=e.src.slice(l,u),Ur[i][1].test(c)){c.length!==0&&a++;break}}return e.line=a,s=e.push("html_block","",0),s.map=[n,a],s.content=e.getLines(n,a,e.blkIndent,!0),!0},wm=Se.isSpace,aN=function(e,n,r,o){var i,a,s,c,l=e.bMarks[n]+e.tShift[n],u=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||(i=e.src.charCodeAt(l),i!==35||l>=u))return!1;for(a=1,i=e.src.charCodeAt(++l);i===35&&l<u&&a<=6;)a++,i=e.src.charCodeAt(++l);return a>6||l<u&&!wm(i)?!1:(o||(u=e.skipSpacesBack(u,l),s=e.skipCharsBack(u,35,l),s>l&&wm(e.src.charCodeAt(s-1))&&(u=s),e.line=n+1,c=e.push("heading_open","h"+String(a),1),c.markup="########".slice(0,a),c.map=[n,e.line],c=e.push("inline","",0),c.content=e.src.slice(l,u).trim(),c.map=[n,e.line],c.children=[],c=e.push("heading_close","h"+String(a),-1),c.markup="########".slice(0,a)),!0)},sN=function(e,n,r){var o,i,a,s,c,l,u,f,p,d=n+1,m,g=e.md.block.ruler.getRules("paragraph");if(e.sCount[n]-e.blkIndent>=4)return!1;for(m=e.parentType,e.parentType="paragraph";d<r&&!e.isEmpty(d);d++)if(!(e.sCount[d]-e.blkIndent>3)){if(e.sCount[d]>=e.blkIndent&&(l=e.bMarks[d]+e.tShift[d],u=e.eMarks[d],l<u&&(p=e.src.charCodeAt(l),(p===45||p===61)&&(l=e.skipChars(l,p),l=e.skipSpaces(l),l>=u)))){f=p===61?1:2;break}if(!(e.sCount[d]<0)){for(i=!1,a=0,s=g.length;a<s;a++)if(g[a](e,d,r,!0)){i=!0;break}if(i)break}}return f?(o=e.getLines(n,d,e.blkIndent,!1).trim(),e.line=d+1,c=e.push("heading_open","h"+String(f),1),c.markup=String.fromCharCode(p),c.map=[n,e.line],c=e.push("inline","",0),c.content=o,c.map=[n,e.line-1],c.children=[],c=e.push("heading_close","h"+String(f),-1),c.markup=String.fromCharCode(p),e.parentType=m,!0):!1},cN=function(e,n,r){var o,i,a,s,c,l,u=n+1,f=e.md.block.ruler.getRules("paragraph");for(l=e.parentType,e.parentType="paragraph";u<r&&!e.isEmpty(u);u++)if(!(e.sCount[u]-e.blkIndent>3)&&!(e.sCount[u]<0)){for(i=!1,a=0,s=f.length;a<s;a++)if(f[a](e,u,r,!0)){i=!0;break}if(i)break}return o=e.getLines(n,u,e.blkIndent,!1).trim(),e.line=u,c=e.push("paragraph_open","p",1),c.map=[n,e.line],c=e.push("inline","",0),c.content=o,c.map=[n,e.line],c.children=[],c=e.push("paragraph_close","p",-1),e.parentType=l,!0},km=qc,Xa=Se.isSpace;function sn(t,e,n,r){var o,i,a,s,c,l,u,f;for(this.src=t,this.md=e,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0,this.result="",i=this.src,f=!1,a=s=l=u=0,c=i.length;s<c;s++){if(o=i.charCodeAt(s),!f)if(Xa(o)){l++,o===9?u+=4-u%4:u++;continue}else f=!0;(o===10||s===c-1)&&(o!==10&&s++,this.bMarks.push(a),this.eMarks.push(s),this.tShift.push(l),this.sCount.push(u),this.bsCount.push(0),f=!1,l=0,u=0,a=s+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}sn.prototype.push=function(t,e,n){var r=new km(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},sn.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},sn.prototype.skipEmptyLines=function(e){for(var n=this.lineMax;e<n&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},sn.prototype.skipSpaces=function(e){for(var n,r=this.src.length;e<r&&(n=this.src.charCodeAt(e),!!Xa(n));e++);return e},sn.prototype.skipSpacesBack=function(e,n){if(e<=n)return e;for(;e>n;)if(!Xa(this.src.charCodeAt(--e)))return e+1;return e},sn.prototype.skipChars=function(e,n){for(var r=this.src.length;e<r&&this.src.charCodeAt(e)===n;e++);return e},sn.prototype.skipCharsBack=function(e,n,r){if(e<=r)return e;for(;e>r;)if(n!==this.src.charCodeAt(--e))return e+1;return e},sn.prototype.getLines=function(e,n,r,o){var i,a,s,c,l,u,f,p=e;if(e>=n)return"";for(u=new Array(n-e),i=0;p<n;p++,i++){for(a=0,f=c=this.bMarks[p],p+1<n||o?l=this.eMarks[p]+1:l=this.eMarks[p];c<l&&a<r;){if(s=this.src.charCodeAt(c),Xa(s))s===9?a+=4-(a+this.bsCount[p])%4:a++;else if(c-f<this.tShift[p])a++;else break;c++}a>r?u[i]=new Array(a-r+1).join(" ")+this.src.slice(c,l):u[i]=this.src.slice(c,l)}return u.join("")},sn.prototype.Token=km;var lN=sn,uN=$c,Ka=[["table",OS,["paragraph","reference"]],["code",PS],["fence",zS,["paragraph","reference","blockquote","list"]],["blockquote",QS,["paragraph","reference","blockquote","list"]],["hr",RS,["paragraph","reference","blockquote","list"]],["list",GS,["paragraph","reference","blockquote"]],["reference",ZS],["html_block",iN,["paragraph","reference","blockquote"]],["heading",aN,["paragraph","reference","blockquote"]],["lheading",sN],["paragraph",cN]];function es(){this.ruler=new uN;for(var t=0;t<Ka.length;t++)this.ruler.push(Ka[t][0],Ka[t][1],{alt:(Ka[t][2]||[]).slice()})}es.prototype.tokenize=function(t,e,n){for(var r,o,i,a=this.ruler.getRules(""),s=a.length,c=e,l=!1,u=t.md.options.maxNesting;c<n&&(t.line=c=t.skipEmptyLines(c),!(c>=n||t.sCount[c]<t.blkIndent));){if(t.level>=u){t.line=n;break}for(i=t.line,o=0;o<s;o++)if(r=a[o](t,c,n,!1),r){if(i>=t.line)throw new Error("block rule didn't increment state.line");break}if(!r)throw new Error("none of the block rules matched");t.tight=!l,t.isEmpty(t.line-1)&&(l=!0),c=t.line,c<n&&t.isEmpty(c)&&(l=!0,c++,t.line=c)}},es.prototype.parse=function(t,e,n,r){var o;t&&(o=new this.State(t,e,n,r),this.tokenize(o,o.line,o.lineMax))},es.prototype.State=lN;var fN=es;function dN(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}for(var pN=function(e,n){for(var r=e.pos;r<e.posMax&&!dN(e.src.charCodeAt(r));)r++;return r===e.pos?!1:(n||(e.pending+=e.src.slice(e.pos,r)),e.pos=r,!0)},gN=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i,mN=function(e,n){var r,o,i,a,s,c,l,u;return!e.md.options.linkify||e.linkLevel>0||(r=e.pos,o=e.posMax,r+3>o)||e.src.charCodeAt(r)!==58||e.src.charCodeAt(r+1)!==47||e.src.charCodeAt(r+2)!==47||(i=e.pending.match(gN),!i)||(a=i[1],s=e.md.linkify.matchAtStart(e.src.slice(r-a.length)),!s)||(c=s.url,c.length<=a.length)||(c=c.replace(/\*+$/,""),l=e.md.normalizeLink(c),!e.md.validateLink(l))?!1:(n||(e.pending=e.pending.slice(0,-a.length),u=e.push("link_open","a",1),u.attrs=[["href",l]],u.markup="linkify",u.info="auto",u=e.push("text","",0),u.content=e.md.normalizeLinkText(c),u=e.push("link_close","a",-1),u.markup="linkify",u.info="auto"),e.pos+=c.length-a.length,!0)},hN=Se.isSpace,bN=function(e,n){var r,o,i,a=e.pos;if(e.src.charCodeAt(a)!==10)return!1;if(r=e.pending.length-1,o=e.posMax,!n)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){for(i=r-1;i>=1&&e.pending.charCodeAt(i-1)===32;)i--;e.pending=e.pending.slice(0,i),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(a++;a<o&&hN(e.src.charCodeAt(a));)a++;return e.pos=a,!0},vN=Se.isSpace,nl=[],Im=0;Im<256;Im++)nl.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){nl[t.charCodeAt(0)]=1});var yN=function(e,n){var r,o,i,a,s,c=e.pos,l=e.posMax;if(e.src.charCodeAt(c)!==92||(c++,c>=l))return!1;if(r=e.src.charCodeAt(c),r===10){for(n||e.push("hardbreak","br",0),c++;c<l&&(r=e.src.charCodeAt(c),!!vN(r));)c++;return e.pos=c,!0}return a=e.src[c],r>=55296&&r<=56319&&c+1<l&&(o=e.src.charCodeAt(c+1),o>=56320&&o<=57343&&(a+=e.src[c+1],c++)),i="\\"+a,n||(s=e.push("text_special","",0),r<256&&nl[r]!==0?s.content=a:s.content=i,s.markup=i,s.info="escape"),e.pos=c+1,!0},AN=function(e,n){var r,o,i,a,s,c,l,u,f=e.pos,p=e.src.charCodeAt(f);if(p!==96)return!1;for(r=f,f++,o=e.posMax;f<o&&e.src.charCodeAt(f)===96;)f++;if(i=e.src.slice(r,f),l=i.length,e.backticksScanned&&(e.backticks[l]||0)<=r)return n||(e.pending+=i),e.pos+=l,!0;for(c=f;(s=e.src.indexOf("`",c))!==-1;){for(c=s+1;c<o&&e.src.charCodeAt(c)===96;)c++;if(u=c-s,u===l)return n||(a=e.push("code_inline","code",0),a.markup=i,a.content=e.src.slice(f,s).replace(/\n/g," ").replace(/^ (.+) $/,"$1")),e.pos=c,!0;e.backticks[u]=s}return e.backticksScanned=!0,n||(e.pending+=i),e.pos+=l,!0},ts={};ts.tokenize=function(e,n){var r,o,i,a,s,c=e.pos,l=e.src.charCodeAt(c);if(n||l!==126||(o=e.scanDelims(e.pos,!0),a=o.length,s=String.fromCharCode(l),a<2))return!1;for(a%2&&(i=e.push("text","",0),i.content=s,a--),r=0;r<a;r+=2)i=e.push("text","",0),i.content=s+s,e.delimiters.push({marker:l,length:0,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0};function xm(t,e){var n,r,o,i,a,s=[],c=e.length;for(n=0;n<c;n++)o=e[n],o.marker===126&&o.end!==-1&&(i=e[o.end],a=t.tokens[o.token],a.type="s_open",a.tag="s",a.nesting=1,a.markup="~~",a.content="",a=t.tokens[i.token],a.type="s_close",a.tag="s",a.nesting=-1,a.markup="~~",a.content="",t.tokens[i.token-1].type==="text"&&t.tokens[i.token-1].content==="~"&&s.push(i.token-1));for(;s.length;){for(n=s.pop(),r=n+1;r<t.tokens.length&&t.tokens[r].type==="s_close";)r++;r--,n!==r&&(a=t.tokens[r],t.tokens[r]=t.tokens[n],t.tokens[n]=a)}}ts.postProcess=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(xm(e,e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&xm(e,r[n].delimiters)};var ns={};ns.tokenize=function(e,n){var r,o,i,a=e.pos,s=e.src.charCodeAt(a);if(n||s!==95&&s!==42)return!1;for(o=e.scanDelims(e.pos,s===42),r=0;r<o.length;r++)i=e.push("text","",0),i.content=String.fromCharCode(s),e.delimiters.push({marker:s,length:o.length,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0};function Mm(t,e){var n,r,o,i,a,s,c=e.length;for(n=c-1;n>=0;n--)r=e[n],!(r.marker!==95&&r.marker!==42)&&r.end!==-1&&(o=e[r.end],s=n>0&&e[n-1].end===r.end+1&&e[n-1].marker===r.marker&&e[n-1].token===r.token-1&&e[r.end+1].token===o.token+1,a=String.fromCharCode(r.marker),i=t.tokens[r.token],i.type=s?"strong_open":"em_open",i.tag=s?"strong":"em",i.nesting=1,i.markup=s?a+a:a,i.content="",i=t.tokens[o.token],i.type=s?"strong_close":"em_close",i.tag=s?"strong":"em",i.nesting=-1,i.markup=s?a+a:a,i.content="",s&&(t.tokens[e[n-1].token].content="",t.tokens[e[r.end+1].token].content="",n--))}ns.postProcess=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(Mm(e,e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&Mm(e,r[n].delimiters)};var wN=Se.normalizeReference,rl=Se.isSpace,kN=function(e,n){var r,o,i,a,s,c,l,u,f,p="",d="",m=e.pos,g=e.posMax,y=e.pos,h=!0;if(e.src.charCodeAt(e.pos)!==91||(s=e.pos+1,a=e.md.helpers.parseLinkLabel(e,e.pos,!0),a<0))return!1;if(c=a+1,c<g&&e.src.charCodeAt(c)===40){for(h=!1,c++;c<g&&(o=e.src.charCodeAt(c),!(!rl(o)&&o!==10));c++);if(c>=g)return!1;if(y=c,l=e.md.helpers.parseLinkDestination(e.src,c,e.posMax),l.ok){for(p=e.md.normalizeLink(l.str),e.md.validateLink(p)?c=l.pos:p="",y=c;c<g&&(o=e.src.charCodeAt(c),!(!rl(o)&&o!==10));c++);if(l=e.md.helpers.parseLinkTitle(e.src,c,e.posMax),c<g&&y!==c&&l.ok)for(d=l.str,c=l.pos;c<g&&(o=e.src.charCodeAt(c),!(!rl(o)&&o!==10));c++);}(c>=g||e.src.charCodeAt(c)!==41)&&(h=!0),c++}if(h){if(typeof e.env.references>"u")return!1;if(c<g&&e.src.charCodeAt(c)===91?(y=c+1,c=e.md.helpers.parseLinkLabel(e,c),c>=0?i=e.src.slice(y,c++):c=a+1):c=a+1,i||(i=e.src.slice(s,a)),u=e.env.references[wN(i)],!u)return e.pos=m,!1;p=u.href,d=u.title}return n||(e.pos=s,e.posMax=a,f=e.push("link_open","a",1),f.attrs=r=[["href",p]],d&&r.push(["title",d]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,f=e.push("link_close","a",-1)),e.pos=c,e.posMax=g,!0},IN=Se.normalizeReference,ol=Se.isSpace,xN=function(e,n){var r,o,i,a,s,c,l,u,f,p,d,m,g,y="",h=e.pos,I=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91||(c=e.pos+2,s=e.md.helpers.parseLinkLabel(e,e.pos+1,!1),s<0))return!1;if(l=s+1,l<I&&e.src.charCodeAt(l)===40){for(l++;l<I&&(o=e.src.charCodeAt(l),!(!ol(o)&&o!==10));l++);if(l>=I)return!1;for(g=l,f=e.md.helpers.parseLinkDestination(e.src,l,e.posMax),f.ok&&(y=e.md.normalizeLink(f.str),e.md.validateLink(y)?l=f.pos:y=""),g=l;l<I&&(o=e.src.charCodeAt(l),!(!ol(o)&&o!==10));l++);if(f=e.md.helpers.parseLinkTitle(e.src,l,e.posMax),l<I&&g!==l&&f.ok)for(p=f.str,l=f.pos;l<I&&(o=e.src.charCodeAt(l),!(!ol(o)&&o!==10));l++);else p="";if(l>=I||e.src.charCodeAt(l)!==41)return e.pos=h,!1;l++}else{if(typeof e.env.references>"u")return!1;if(l<I&&e.src.charCodeAt(l)===91?(g=l+1,l=e.md.helpers.parseLinkLabel(e,l),l>=0?a=e.src.slice(g,l++):l=s+1):l=s+1,a||(a=e.src.slice(c,s)),u=e.env.references[IN(a)],!u)return e.pos=h,!1;y=u.href,p=u.title}return n||(i=e.src.slice(c,s),e.md.inline.parse(i,e.md,e.env,m=[]),d=e.push("image","img",0),d.attrs=r=[["src",y],["alt",""]],d.children=m,d.content=i,p&&r.push(["title",p])),e.pos=l,e.posMax=I,!0},MN=/^([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])?)*)$/,CN=/^([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)$/,jN=function(e,n){var r,o,i,a,s,c,l=e.pos;if(e.src.charCodeAt(l)!==60)return!1;for(s=e.pos,c=e.posMax;;){if(++l>=c||(a=e.src.charCodeAt(l),a===60))return!1;if(a===62)break}return r=e.src.slice(s+1,l),CN.test(r)?(o=e.md.normalizeLink(r),e.md.validateLink(o)?(n||(i=e.push("link_open","a",1),i.attrs=[["href",o]],i.markup="autolink",i.info="auto",i=e.push("text","",0),i.content=e.md.normalizeLinkText(r),i=e.push("link_close","a",-1),i.markup="autolink",i.info="auto"),e.pos+=r.length+2,!0):!1):MN.test(r)?(o=e.md.normalizeLink("mailto:"+r),e.md.validateLink(o)?(n||(i=e.push("link_open","a",1),i.attrs=[["href",o]],i.markup="autolink",i.info="auto",i=e.push("text","",0),i.content=e.md.normalizeLinkText(r),i=e.push("link_close","a",-1),i.markup="autolink",i.info="auto"),e.pos+=r.length+2,!0):!1):!1},TN=qa.HTML_TAG_RE;function LN(t){return/^<a[>\s]/i.test(t)}function SN(t){return/^<\/a\s*>/i.test(t)}function NN(t){var e=t|32;return e>=97&&e<=122}var DN=function(e,n){var r,o,i,a,s=e.pos;return!e.md.options.html||(i=e.posMax,e.src.charCodeAt(s)!==60||s+2>=i)||(r=e.src.charCodeAt(s+1),r!==33&&r!==63&&r!==47&&!NN(r))||(o=e.src.slice(s).match(TN),!o)?!1:(n||(a=e.push("html_inline","",0),a.content=o[0],LN(a.content)&&e.linkLevel++,SN(a.content)&&e.linkLevel--),e.pos+=o[0].length,!0)},Cm=Yg,ON=Se.has,PN=Se.isValidEntityCode,jm=Se.fromCodePoint,zN=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,EN=/^&([a-z][a-z0-9]{1,31});/i,QN=function(e,n){var r,o,i,a,s=e.pos,c=e.posMax;if(e.src.charCodeAt(s)!==38||s+1>=c)return!1;if(r=e.src.charCodeAt(s+1),r===35){if(i=e.src.slice(s).match(zN),i)return n||(o=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),a=e.push("text_special","",0),a.content=PN(o)?jm(o):jm(65533),a.markup=i[0],a.info="entity"),e.pos+=i[0].length,!0}else if(i=e.src.slice(s).match(EN),i&&ON(Cm,i[1]))return n||(a=e.push("text_special","",0),a.content=Cm[i[1]],a.markup=i[0],a.info="entity"),e.pos+=i[0].length,!0;return!1};function Tm(t){var e,n,r,o,i,a,s,c,l={},u=t.length;if(u){var f=0,p=-2,d=[];for(e=0;e<u;e++)if(r=t[e],d.push(0),(t[f].marker!==r.marker||p!==r.token-1)&&(f=e),p=r.token,r.length=r.length||0,!!r.close){for(l.hasOwnProperty(r.marker)||(l[r.marker]=[-1,-1,-1,-1,-1,-1]),i=l[r.marker][(r.open?3:0)+r.length%3],n=f-d[f]-1,a=n;n>i;n-=d[n]+1)if(o=t[n],o.marker===r.marker&&o.open&&o.end<0&&(s=!1,(o.close||r.open)&&(o.length+r.length)%3===0&&(o.length%3!==0||r.length%3!==0)&&(s=!0),!s)){c=n>0&&!t[n-1].open?d[n-1]+1:0,d[e]=e-n+c,d[n]=c,r.open=!1,o.end=e,o.close=!1,a=-1,p=-2;break}a!==-1&&(l[r.marker][(r.open?3:0)+(r.length||0)%3]=a)}}}var JN=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(Tm(e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&Tm(r[n].delimiters)},RN=function(e){var n,r,o=0,i=e.tokens,a=e.tokens.length;for(n=r=0;n<a;n++)i[n].nesting<0&&o--,i[n].level=o,i[n].nesting>0&&o++,i[n].type==="text"&&n+1<a&&i[n+1].type==="text"?i[n+1].content=i[n].content+i[n+1].content:(n!==r&&(i[r]=i[n]),r++);n!==r&&(i.length=r)},il=qc,Lm=Se.isWhiteSpace,Sm=Se.isPunctChar,Nm=Se.isMdAsciiPunct;function hi(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}hi.prototype.pushPending=function(){var t=new il("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t},hi.prototype.push=function(t,e,n){this.pending&&this.pushPending();var r=new il(t,e,n),o=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],o={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(o),r},hi.prototype.scanDelims=function(t,e){var n=t,r,o,i,a,s,c,l,u,f,p=!0,d=!0,m=this.posMax,g=this.src.charCodeAt(t);for(r=t>0?this.src.charCodeAt(t-1):32;n<m&&this.src.charCodeAt(n)===g;)n++;return i=n-t,o=n<m?this.src.charCodeAt(n):32,l=Nm(r)||Sm(String.fromCharCode(r)),f=Nm(o)||Sm(String.fromCharCode(o)),c=Lm(r),u=Lm(o),u?p=!1:f&&(c||l||(p=!1)),c?d=!1:l&&(u||f||(d=!1)),e?(a=p,s=d):(a=p&&(!d||l),s=d&&(!p||f)),{can_open:a,can_close:s,length:i}},hi.prototype.Token=il;var BN=hi,Dm=$c,al=[["text",pN],["linkify",mN],["newline",bN],["escape",yN],["backticks",AN],["strikethrough",ts.tokenize],["emphasis",ns.tokenize],["link",kN],["image",xN],["autolink",jN],["html_inline",DN],["entity",QN]],sl=[["balance_pairs",JN],["strikethrough",ts.postProcess],["emphasis",ns.postProcess],["fragments_join",RN]];function bi(){var t;for(this.ruler=new Dm,t=0;t<al.length;t++)this.ruler.push(al[t][0],al[t][1]);for(this.ruler2=new Dm,t=0;t<sl.length;t++)this.ruler2.push(sl[t][0],sl[t][1])}bi.prototype.skipToken=function(t){var e,n,r=t.pos,o=this.ruler.getRules(""),i=o.length,a=t.md.options.maxNesting,s=t.cache;if(typeof s[r]<"u"){t.pos=s[r];return}if(t.level<a){for(n=0;n<i;n++)if(t.level++,e=o[n](t,!0),t.level--,e){if(r>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;e||t.pos++,s[r]=t.pos},bi.prototype.tokenize=function(t){for(var e,n,r,o=this.ruler.getRules(""),i=o.length,a=t.posMax,s=t.md.options.maxNesting;t.pos<a;){if(r=t.pos,t.level<s){for(n=0;n<i;n++)if(e=o[n](t,!1),e){if(r>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(e){if(t.pos>=a)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},bi.prototype.parse=function(t,e,n,r){var o,i,a,s=new this.State(t,e,n,r);for(this.tokenize(s),i=this.ruler2.getRules(""),a=i.length,o=0;o<a;o++)i[o](s)},bi.prototype.State=BN;var GN=bi,cl,Om;function FN(){return Om||(Om=1,cl=function(t){var e={};t=t||{},e.src_Any=em().source,e.src_Cc=nm().source,e.src_Z=im().source,e.src_P=Yc.source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");var n="[><|]";return e.src_pseudo_letter="(?:(?!"+n+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+n+"|"+e.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+"|$)|;(?!"+e.src_ZCc+"|$)|\\!+(?!"+e.src_ZCc+"|[!]|$)|\\?(?!"+e.src_ZCc+"|[?]|$))+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}),cl}function ll(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function rs(t){return Object.prototype.toString.call(t)}function ZN(t){return rs(t)==="[object String]"}function HN(t){return rs(t)==="[object Object]"}function YN(t){return rs(t)==="[object RegExp]"}function Pm(t){return rs(t)==="[object Function]"}function VN(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var zm={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function _N(t){return Object.keys(t||{}).reduce(function(e,n){return e||zm.hasOwnProperty(n)},!1)}var WN={"http:":{validate:function(t,e,n){var r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){var r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){var r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},UN="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",$N="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function qN(t){t.__index__=-1,t.__text_cache__=""}function XN(t){return function(e,n){var r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function Em(){return function(t,e){e.normalize(t)}}function os(t){var e=t.re=FN()(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(UN),n.push(e.src_xn),e.src_tlds=n.join("|");function r(s){return s.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");var o=[];t.__compiled__={};function i(s,c){throw new Error('(LinkifyIt) Invalid schema "'+s+'": '+c)}Object.keys(t.__schemas__).forEach(function(s){var c=t.__schemas__[s];if(c!==null){var l={validate:null,link:null};if(t.__compiled__[s]=l,HN(c)){YN(c.validate)?l.validate=XN(c.validate):Pm(c.validate)?l.validate=c.validate:i(s,c),Pm(c.normalize)?l.normalize=c.normalize:c.normalize?i(s,c):l.normalize=Em();return}if(ZN(c)){o.push(s);return}i(s,c)}}),o.forEach(function(s){t.__compiled__[t.__schemas__[s]]&&(t.__compiled__[s].validate=t.__compiled__[t.__schemas__[s]].validate,t.__compiled__[s].normalize=t.__compiled__[t.__schemas__[s]].normalize)}),t.__compiled__[""]={validate:null,normalize:Em()};var a=Object.keys(t.__compiled__).filter(function(s){return s.length>0&&t.__compiled__[s]}).map(VN).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+a+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+a+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),qN(t)}function KN(t,e){var n=t.__index__,r=t.__last_index__,o=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=o,this.text=o,this.url=o}function ul(t,e){var n=new KN(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function wt(t,e){if(!(this instanceof wt))return new wt(t,e);e||_N(t)&&(e=t,t={}),this.__opts__=ll({},zm,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=ll({},WN,t),this.__compiled__={},this.__tlds__=$N,this.__tlds_replaced__=!1,this.re={},os(this)}wt.prototype.add=function(e,n){return this.__schemas__[e]=n,os(this),this},wt.prototype.set=function(e){return this.__opts__=ll(this.__opts__,e),this},wt.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var n,r,o,i,a,s,c,l,u;if(this.re.schema_test.test(e)){for(c=this.re.schema_search,c.lastIndex=0;(n=c.exec(e))!==null;)if(i=this.testSchemaAt(e,n[2],c.lastIndex),i){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=e.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l<this.__index__)&&(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=r.index+r[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__="",this.__index__=a,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(u=e.indexOf("@"),u>=0&&(o=e.match(this.re.email_fuzzy))!==null&&(a=o.index+o[1].length,s=o.index+o[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&s>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=a,this.__last_index__=s))),this.__index__>=0},wt.prototype.pretest=function(e){return this.re.pretest.test(e)},wt.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0},wt.prototype.match=function(e){var n=0,r=[];this.__index__>=0&&this.__text_cache__===e&&(r.push(ul(this,n)),n=this.__last_index__);for(var o=n?e.slice(n):e;this.test(o);)r.push(ul(this,n)),o=o.slice(this.__last_index__),n+=this.__last_index__;return r.length?r:null},wt.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;var n=this.re.schema_at_start.exec(e);if(!n)return null;var r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,ul(this,0)):null},wt.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,o,i){return r!==i[o-1]}).reverse(),os(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,os(this),this)},wt.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)},wt.prototype.onCompile=function(){};var e3=wt;const $r=2147483647,cn=36,fl=1,vi=26,t3=38,n3=700,Qm=72,Jm=128,Rm="-",r3=/^xn--/,o3=/[^\0-\x7F]/,i3=/[\x2E\u3002\uFF0E\uFF61]/g,a3={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},dl=cn-fl,ln=Math.floor,pl=String.fromCharCode;function Rn(t){throw new RangeError(a3[t])}function s3(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function Bm(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(i3,".");const o=t.split("."),i=s3(o,e).join(".");return r+i}function gl(t){const e=[];let n=0;const r=t.length;for(;n<r;){const o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){const i=t.charCodeAt(n++);(i&64512)==56320?e.push(((o&1023)<<10)+(i&1023)+65536):(e.push(o),n--)}else e.push(o)}return e}const Gm=t=>String.fromCodePoint(...t),c3=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:cn},Fm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Zm=function(t,e,n){let r=0;for(t=n?ln(t/n3):t>>1,t+=ln(t/e);t>dl*vi>>1;r+=cn)t=ln(t/dl);return ln(r+(dl+1)*t/(t+t3))},ml=function(t){const e=[],n=t.length;let r=0,o=Jm,i=Qm,a=t.lastIndexOf(Rm);a<0&&(a=0);for(let s=0;s<a;++s)t.charCodeAt(s)>=128&&Rn("not-basic"),e.push(t.charCodeAt(s));for(let s=a>0?a+1:0;s<n;){const c=r;for(let u=1,f=cn;;f+=cn){s>=n&&Rn("invalid-input");const p=c3(t.charCodeAt(s++));p>=cn&&Rn("invalid-input"),p>ln(($r-r)/u)&&Rn("overflow"),r+=p*u;const d=f<=i?fl:f>=i+vi?vi:f-i;if(p<d)break;const m=cn-d;u>ln($r/m)&&Rn("overflow"),u*=m}const l=e.length+1;i=Zm(r-c,l,c==0),ln(r/l)>$r-o&&Rn("overflow"),o+=ln(r/l),r%=l,e.splice(r++,0,o)}return String.fromCodePoint(...e)},hl=function(t){const e=[];t=gl(t);const n=t.length;let r=Jm,o=0,i=Qm;for(const c of t)c<128&&e.push(pl(c));const a=e.length;let s=a;for(a&&e.push(Rm);s<n;){let c=$r;for(const u of t)u>=r&&u<c&&(c=u);const l=s+1;c-r>ln(($r-o)/l)&&Rn("overflow"),o+=(c-r)*l,r=c;for(const u of t)if(u<r&&++o>$r&&Rn("overflow"),u===r){let f=o;for(let p=cn;;p+=cn){const d=p<=i?fl:p>=i+vi?vi:p-i;if(f<d)break;const m=f-d,g=cn-d;e.push(pl(Fm(d+m%g,0))),f=ln(m/g)}e.push(pl(Fm(f,0))),i=Zm(o,l,s===a),o=0,++s}++o,++r}return e.join("")},Hm=function(t){return Bm(t,function(e){return r3.test(e)?ml(e.slice(4).toLowerCase()):e})},Ym=function(t){return Bm(t,function(e){return o3.test(e)?"xn--"+hl(e):e})},l3=th(Object.freeze(Object.defineProperty({__proto__:null,decode:ml,default:{version:"2.3.1",ucs2:{decode:gl,encode:Gm},decode:ml,encode:hl,toASCII:Ym,toUnicode:Hm},encode:hl,toASCII:Ym,toUnicode:Hm,ucs2decode:gl,ucs2encode:Gm},Symbol.toStringTag,{value:"Module"})));var u3={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},f3={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},d3={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}},yi=Se,p3=Wa,g3=cS,m3=DS,h3=fN,b3=GN,v3=e3,rr=Vr,Vm=l3,y3={default:u3,zero:f3,commonmark:d3},A3=/^(vbscript|javascript|file|data):/,w3=/^data:image\/(gif|png|jpeg|webp);/;function k3(t){var e=t.trim().toLowerCase();return A3.test(e)?!!w3.test(e):!0}var _m=["http:","https:","mailto:"];function I3(t){var e=rr.parse(t,!0);if(e.hostname&&(!e.protocol||_m.indexOf(e.protocol)>=0))try{e.hostname=Vm.toASCII(e.hostname)}catch{}return rr.encode(rr.format(e))}function x3(t){var e=rr.parse(t,!0);if(e.hostname&&(!e.protocol||_m.indexOf(e.protocol)>=0))try{e.hostname=Vm.toUnicode(e.hostname)}catch{}return rr.decode(rr.format(e),rr.decode.defaultChars+"%")}function Nt(t,e){if(!(this instanceof Nt))return new Nt(t,e);e||yi.isString(t)||(e=t||{},t="default"),this.inline=new b3,this.block=new h3,this.core=new m3,this.renderer=new g3,this.linkify=new v3,this.validateLink=k3,this.normalizeLink=I3,this.normalizeLinkText=x3,this.utils=yi,this.helpers=yi.assign({},p3),this.options={},this.configure(t),e&&this.set(e)}Nt.prototype.set=function(t){return yi.assign(this.options,t),this},Nt.prototype.configure=function(t){var e=this,n;if(yi.isString(t)&&(n=t,t=y3[n],!t))throw new Error('Wrong `markdown-it` preset "'+n+'", check name');if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(r){t.components[r].rules&&e[r].ruler.enableOnly(t.components[r].rules),t.components[r].rules2&&e[r].ruler2.enableOnly(t.components[r].rules2)}),this},Nt.prototype.enable=function(t,e){var n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(o){n=n.concat(this[o].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));var r=t.filter(function(o){return n.indexOf(o)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this},Nt.prototype.disable=function(t,e){var n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(o){n=n.concat(this[o].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));var r=t.filter(function(o){return n.indexOf(o)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this},Nt.prototype.use=function(t){var e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this},Nt.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");var n=new this.core.State(t,this,e);return this.core.process(n),n.tokens},Nt.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},Nt.prototype.parseInline=function(t,e){var n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens},Nt.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};var M3=Nt,C3=M3;const j3=lo(C3);var bl=(t=>(t.Assistant="assistant",t.System="system",t.User="user",t))(bl||{}),Ai=(t=>(t.Error="error",t.Loading="loading",t.Success="success",t))(Ai||{});const T3={class:"message-content user"},L3={key:0,class:"time-message user"},S3=["innerHTML"],N3={class:"message-photo user"},D3=["src"],O3=w.createElementVNode("span",{class:"message-photo ai"},[w.createElementVNode("i",{class:"ai-blueking-icon ai-blueking-ai"})],-1),P3={class:"message-content ai"},z3={key:0,class:"time-message ai"},E3={key:2,width:"18",height:"18",class:"loading-message","aria-hidden":"true"},Q3=[w.createElementVNode("use",{"xlink:href":"#ai-blueking-quanquan"},null,-1)],J3={key:3,class:"message-wrap"},R3=["innerHTML"],B3=w.defineComponent({__name:"render-message",props:{message:{},userPhoto:{default:yl}},setup(t){const e=t,n=w.computed(()=>{var a;const i={error:"ai-blueking-icon ai-blueking-warning-circle-fill",loading:"",success:""};return(a=e.message)!=null&&a.status?i[e.message.status]:""}),r=w.computed(()=>{if(e.message.content){const a=new j3().render(e.message.content);return JL.sanitize(a)}return""}),o=w.computed(()=>{const i=Gt(e.message.time),a=Gt();return e.message.time?a.isSame(i,"year")?i.format("MM-DD HH:mm:ss"):i.format("YYYY-MM-DD HH:mm:ss"):""});return(i,a)=>(w.openBlock(),w.createElementBlock("li",{class:w.normalizeClass([i.message.role,"message-main"])},[i.message.role===w.unref(bl).User?(w.openBlock(),w.createElementBlock(w.Fragment,{key:0},[w.createElementVNode("p",T3,[o.value?(w.openBlock(),w.createElementBlock("span",L3,w.toDisplayString(o.value),1)):w.createCommentVNode("v-if",!0),w.createElementVNode("span",{class:"markdown-message",innerHTML:r.value},null,8,S3)]),w.createElementVNode("span",N3,[w.createElementVNode("img",{src:i.userPhoto},null,8,D3)])],64)):(w.openBlock(),w.createElementBlock(w.Fragment,{key:1},[O3,w.createElementVNode("p",P3,[o.value?(w.openBlock(),w.createElementBlock("span",z3,w.toDisplayString(o.value),1)):w.createCommentVNode("v-if",!0),n.value?(w.openBlock(),w.createElementBlock("i",{key:1,class:w.normalizeClass(n.value)},null,2)):w.createCommentVNode("v-if",!0),i.message.status===w.unref(Ai).Loading?(w.openBlock(),w.createElementBlock("svg",E3,Q3)):w.createCommentVNode("v-if",!0),i.message.status===w.unref(Ai).Error?(w.openBlock(),w.createElementBlock("span",J3,w.toDisplayString(i.message.content),1)):(w.openBlock(),w.createElementBlock("span",{key:4,innerHTML:r.value,class:w.normalizeClass({"markdown-message":!0,loading:i.message.status===w.unref(Ai).Loading})},null,10,R3))])],64))],2))}}),G3={class:"prompt-list"},F3={class:"search-group"},Z3=["onClick"],H3={class:"prompt-content"},Y3=Yr(w.defineComponent({__name:"render-send",props:{prompts:{},placeholder:{},value:{}},emits:["update:value","enter","choose-prompt"],setup(t,{emit:e}){const n=t,r=e,o=iL,i=Ba,a=w.ref(""),s=w.ref(40),c=w.ref(),l=w.ref(!1),u=w.computed(()=>{var C;return((C=n.prompts)==null?void 0:C.filter(T=>T.content.includes(a.value)))||[]}),f=w.computed(()=>{var C;return n.placeholder?n.placeholder:(C=n.prompts)!=null&&C.length?Ye("您可以键入 “/” 查看更多Prompt"):Ye("请输入")}),p=C=>{r("update:value",C)},d=()=>{var C;n.value==="/"&&((C=n.prompts)!=null&&C.length)?M():O()},m=()=>{w.nextTick(()=>{var T;const C=(T=c.value)==null?void 0:T.$el.querySelector("textarea");(C==null?void 0:C.scrollHeight)>40&&n.value?s.value=C.scrollHeight<=300?C.scrollHeight:300:s.value=40})},g=C=>{r("update:value",C.content),r("choose-prompt",C),O(),I()},y=(C,T)=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),r("enter"))},h=()=>{p("")},I=()=>{var T;const C=(T=c.value)==null?void 0:T.$el.querySelector("textarea");C==null||C.focus()},M=()=>{l.value=!0},O=()=>{l.value=!1};return w.watch(()=>n.value,()=>{m(),d()}),w.onMounted(I),(C,T)=>(w.openBlock(),w.createBlock(w.unref(Ag),{width:"calc(100% - 118px)","ext-cls":"empty-padding",arrow:!1,"is-show":l.value,"popover-delay":0,boundary:"parent",placement:"bottom",theme:"light",trigger:"manual"},{content:w.withCtx(()=>{var H;return[w.createElementVNode("div",null,[w.withDirectives((w.openBlock(),w.createElementBlock("section",G3,[w.createVNode(w.unref(Tg),{class:"input-search",modelValue:a.value,"onUpdate:modelValue":T[0]||(T[0]=W=>a.value=W),behavior:"simplicity",clearable:""},null,8,["modelValue"]),w.createElementVNode("section",F3,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(u.value,(W,ne)=>w.withDirectives((w.openBlock(),w.createElementBlock("span",{class:"group-prompt",key:ne,onClick:R=>g(W)},[w.createElementVNode("span",H3,w.toDisplayString(W.content),1)],8,Z3)),[[w.unref(i),{content:W.content,placement:"right",theme:"light",width:300,zIndex:9999999,extCls:"prompt-popover"}]])),128)),(H=u.value)!=null&&H.length?w.createCommentVNode("v-if",!0):(w.openBlock(),w.createBlock(w.unref(cL),{key:0,class:"exception-wrap-item exception-part",scene:"part",type:"search-empty"}))])])),[[w.unref(o),O]])])]}),default:w.withCtx(()=>[w.createElementVNode("section",{style:w.normalizeStyle({"--text-height":s.value+"px"}),class:"send-prompt-container"},[w.createVNode(w.unref(Tg),{ref_key:"inputRef",ref:c,class:"send-prompt",autosize:!1,clearable:!0,"model-value":C.value,"native-attributes":{autofocus:"autofocus"},placeholder:f.value,row:"1",type:"textarea",onInput:p,onKeydown:y},null,8,["model-value","placeholder"]),C.value?(w.openBlock(),w.createBlock(w.unref(Fs),{key:0,class:"show-clear-only-hover bk-input--clear-icon clear-icon",onClick:h})):w.createCommentVNode("v-if",!0)],4)]),_:1},8,["is-show"]))}}),[["__scopeId","data-v-2374c5aa"]]),V3=(t=>(w.pushScopeId("data-v-fd57f18d"),t=t(),w.popScopeId(),t))(()=>w.createElementVNode("svg",{width:"10",height:"10",class:"ai-blueking-render-stop-icon","aria-hidden":"true"},[w.createElementVNode("use",{"xlink:href":"#ai-blueking-tingzhi"})],-1)),_3=Yr(w.defineComponent({__name:"render-stop",props:{isShow:{type:Boolean}},emits:["stop"],setup(t,{emit:e}){const n=e,r=()=>{n("stop")};return(o,i)=>o.isShow?(w.openBlock(),w.createElementBlock("span",{key:0,class:"ai-blueking-render-stop",onClick:r},[V3,w.createTextVNode(" "+w.toDisplayString(w.unref(Ye)("终止生成")),1)])):w.createCommentVNode("v-if",!0)}}),[["__scopeId","data-v-fd57f18d"]]),W3={key:0,class:"time-wrapper"},U3={class:"time-message"},$3=Yr(w.defineComponent({__name:"render-time",props:{message:{}},setup(t){const e=t,n=w.computed(()=>{var a;const r=Gt(e.message.time),o=Gt(),i={0:Ye("日"),1:Ye("一"),2:Ye("二"),3:Ye("三"),4:Ye("四"),5:Ye("五"),6:Ye("六")};return!e.message.time||(a=window.showTimes)!=null&&a.some(s=>Math.abs(r.diff(s,"minute"))<10&&s!==e.message.time)?"":(window.showTimes=[...window.showTimes||[],e.message.time],o.isSame(r,"day")?r.format("HH:mm:ss"):o.subtract(1,"day").isSame(r,"week")?Ye("昨天")+" "+r.format("HH:mm:ss"):o.isSame(r,"week")?Ye("本周")+i[r.day()]+" "+r.format("HH:mm:ss"):o.subtract(1,"week").isSame(r,"week")?Ye("上周")+i[r.day()]+" "+r.format("HH:mm:ss"):o.isSame(r,"year")?r.format("MM-DD HH:mm:ss"):r.format("YYYY-MM-DD HH:mm:ss"))});return(r,o)=>n.value?(w.openBlock(),w.createElementBlock("section",W3,[w.createElementVNode("span",U3,w.toDisplayString(n.value),1)])):w.createCommentVNode("v-if",!0)}}),[["__scopeId","data-v-55c9a119"]]),Wm=t=>(w.pushScopeId("data-v-6cc6ac8a"),t=t(),w.popScopeId(),t),q3={key:0,width:"18",height:"18",class:"scroll-loading-icon","aria-hidden":"true"},X3=[Wm(()=>w.createElementVNode("use",{"xlink:href":"#ai-blueking-loading-2"},null,-1))],K3={class:"ai-operation"},eD={class:"ai-operation-tools"},tD={class:"ai-operation-input"},nD=Wm(()=>w.createElementVNode("i",{class:"ai-blueking-icon ai-blueking-fasong"},null,-1)),rD=Yr(w.defineComponent({__name:"render-content",props:{messages:{},prompts:{},loading:{type:Boolean},background:{default:"#f5f7fa"},userPhoto:{},placeholder:{},scrollLoading:{type:Boolean},scrollLoadingEnd:{type:Boolean,default:!0}},emits:["send","choose-prompt","scroll-load","stop"],setup(t,{emit:e}){const n=t,r=e,o=Ba,i=w.ref(""),a=()=>{w.nextTick(()=>{const p=document.querySelector(".ai-blueking-messages");p.scrollTop=p.scrollHeight})},s=pL(p=>{if(n.scrollLoading||n.scrollLoadingEnd)return;p.target.scrollTop<200&&r("scroll-load")}),c=()=>{if(i.value){if(n.loading){uL({theme:"warning",message:Ye("内容正在执行中,请执行完成后再发送")});return}r("send",i.value),i.value=""}},l=p=>{r("choose-prompt",p)},u=()=>{r("stop")};w.watch(()=>n.messages,()=>{const p=document.querySelector(".ai-blueking-messages");(p==null?void 0:p.scrollTop)+(p==null?void 0:p.clientHeight)+100>=(p==null?void 0:p.scrollHeight)&&a()},{deep:!0});const f=()=>{window.showTimes=[]};return w.onMounted(a),w.onBeforeUnmount(f),(p,d)=>(w.openBlock(),w.createElementBlock("section",{style:w.normalizeStyle({background:p.background}),class:"ai-content"},[w.createElementVNode("ul",{class:"ai-messages ai-blueking-messages",onScrollPassive:d[0]||(d[0]=(...m)=>w.unref(s)&&w.unref(s)(...m))},[p.scrollLoading?(w.openBlock(),w.createElementBlock("svg",q3,X3)):w.createCommentVNode("v-if",!0),(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(p.messages,m=>(w.openBlock(),w.createElementBlock(w.Fragment,{key:m.content},[w.createVNode($3,{class:"render-message",message:m},null,8,["message"]),w.createVNode(B3,{class:"render-message",message:m,"user-photo":p.userPhoto},null,8,["message","user-photo"])],64))),128))],32),w.createElementVNode("section",K3,[w.createElementVNode("span",eD,[w.createVNode(vL),w.createVNode(_3,{"is-show":p.loading,onStop:u},null,8,["is-show"])]),w.createElementVNode("section",tD,[w.createVNode(Y3,{value:i.value,"onUpdate:value":d[1]||(d[1]=m=>i.value=m),placeholder:p.placeholder,prompts:p.prompts,onChoosePrompt:l,onEnter:c},null,8,["value","placeholder","prompts"]),w.withDirectives((w.openBlock(),w.createBlock(w.unref(qC),{class:"ai-operation-button",disabled:p.loading||!i.value,size:"large",theme:"primary",onClick:c},{default:w.withCtx(()=>[nD,w.createTextVNode(" "+w.toDisplayString(w.unref(Ye)("发送")),1)]),_:1},8,["disabled"])),[[w.unref(o),{content:w.unref(Ye)("内容正在执行中,请执行完成后再发送"),disabled:!p.loading}]])])])],4))}}),[["__scopeId","data-v-6cc6ac8a"]]),oD={class:"ai-modal-header-icon"},iD=Yr(w.defineComponent({__name:"render-modal",props:{headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)"},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0})},sizeLimit:{default:()=>({height:320,width:400})},logo:{default:"ai-blueking-icon ai-blueking-ai"},name:{},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0})}},emits:["clear","close"],setup(t,{emit:e}){const n=t,r=e,o=Ba,i={height:window.innerHeight,width:window.innerWidth},a={isMove:!1,type:"",clientX:0,clientY:0},s=()=>{var U,J,P,z;const G=(V,ee)=>V===void 0?ee:V;return{top:G((U=n.startPosition)==null?void 0:U.top,i.height-n.sizeLimit.height),bottom:G((J=n.startPosition)==null?void 0:J.bottom,0),left:G((P=n.startPosition)==null?void 0:P.left,0),right:G((z=n.startPosition)==null?void 0:z.right,i.width-n.sizeLimit.width)}},c=w.ref(s()),l=w.computed(()=>c.value.top<=n.positionLimit.top&&c.value.bottom<=n.positionLimit.bottom),u=G=>{a.isMove=!0,a.type="move",a.clientX=G.clientX,a.clientY=G.clientY},f=G=>{a.isMove=!0,a.type="rightDrag",a.clientX=G.clientX},p=G=>{a.isMove=!0,a.type="leftDrag",a.clientX=G.clientX},d=G=>{a.isMove=!0,a.type="topDrag",a.clientY=G.clientY},m=G=>{a.isMove=!0,a.type="bottomDrag",a.clientY=G.clientY},g=G=>{a.isMove=!0,a.type="topLeftDrag",a.clientY=G.clientY,a.clientX=G.clientX},y=G=>{a.isMove=!0,a.type="topRightDrag",a.clientY=G.clientY,a.clientX=G.clientX},h=G=>{a.isMove=!0,a.type="bottomLeftDrag",a.clientY=G.clientY,a.clientX=G.clientX},I=G=>{a.isMove=!0,a.type="bottomRightDrag",a.clientY=G.clientY,a.clientX=G.clientX},M=()=>{a.isMove=!1},O=(G,U)=>{["move","leftDrag"].includes(a.type)&&(c.value.left+=G),["move","rightDrag"].includes(a.type)&&(c.value.right-=G),["move","topDrag"].includes(a.type)&&(c.value.top+=U),["move","bottomDrag"].includes(a.type)&&(c.value.bottom-=U),["topLeftDrag"].includes(a.type)&&(c.value.left+=G,c.value.top+=U),["topRightDrag"].includes(a.type)&&(c.value.right-=G,c.value.top+=U),["bottomLeftDrag"].includes(a.type)&&(c.value.left+=G,c.value.bottom-=U),["bottomRightDrag"].includes(a.type)&&(c.value.right-=G,c.value.bottom-=U)},C=(G,U)=>{const{top:J,bottom:P,left:z,right:V}=c.value;(i.width-z-V<n.sizeLimit.width||z<n.positionLimit.left||V<n.positionLimit.right)&&(["move","leftDrag","topLeftDrag","bottomLeftDrag"].includes(a.type)&&(c.value.left-=G),["move","rightDrag","topRightDrag","bottomRightDrag"].includes(a.type)&&(c.value.right+=G)),(i.height-J-P<n.sizeLimit.height||J<n.positionLimit.top||P<n.positionLimit.bottom)&&(["move","topDrag","topRightDrag","topLeftDrag"].includes(a.type)&&(c.value.top-=U),["move","bottomDrag","bottomLeftDrag","bottomRightDrag"].includes(a.type)&&(c.value.bottom+=U))},T=G=>{if(!a.isMove)return;G.preventDefault();const U=G.clientX-a.clientX,J=G.clientY-a.clientY;O(U,J),C(U,J),a.clientX=G.clientX,a.clientY=G.clientY},H=()=>{i.height=window.innerHeight,i.width=window.innerWidth,c.value=s()},W=()=>{c.value.top=n.positionLimit.top,c.value.bottom=n.positionLimit.bottom},ne=()=>{c.value.top=i.height-n.sizeLimit.height,c.value.bottom=n.positionLimit.bottom},R=()=>{r("clear")},K=()=>{r("close")};return w.onBeforeMount(()=>{window.addEventListener("mousemove",T,!0),window.addEventListener("mouseup",M),window.addEventListener("resize",H)}),w.onBeforeUnmount(()=>{window.removeEventListener("mousemove",T,!0),window.removeEventListener("mouseup",M),window.removeEventListener("resize",H)}),(G,U)=>(w.openBlock(),w.createElementBlock("section",{style:w.normalizeStyle({top:c.value.top+"px",bottom:c.value.bottom+"px",left:c.value.left+"px",right:c.value.right+"px"}),class:"ai-modal"},[w.createElementVNode("header",{style:w.normalizeStyle({background:G.headBackground}),class:"ai-modal-header",onMousedown:w.withModifiers(u,["stop"])},[w.createElementVNode("span",oD,[w.createElementVNode("i",{class:w.normalizeClass(G.logo)},null,2),w.createTextVNode(" "+w.toDisplayString(G.name||w.unref(Ye)("小鲸")),1)]),w.createElementVNode("span",null,[l.value?w.withDirectives((w.openBlock(),w.createElementBlock("i",{key:0,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxiajuhe",onClick:ne},null,512)),[[w.unref(o),{content:w.unref(Ye)("向下收缩"),distance:20}]]):w.withDirectives((w.openBlock(),w.createElementBlock("i",{key:1,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxialashen-2",onClick:W},null,512)),[[w.unref(o),{content:w.unref(Ye)("向上扩展"),distance:20}]]),w.withDirectives(w.createElementVNode("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-saoba",onClick:R},null,512),[[w.unref(o),{content:w.unref(Ye)("清空聊天记录"),distance:20}]]),w.withDirectives(w.createElementVNode("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-shanchu-2",onClick:K},null,512),[[w.unref(o),{content:w.unref(Ye)("关闭"),distance:20}]])])],36),w.renderSlot(G.$slots,"default",{},void 0,!0),w.createElementVNode("span",{class:"drag-line left",onMousedown:w.withModifiers(p,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line right",onMousedown:w.withModifiers(f,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line top",onMousedown:w.withModifiers(d,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line bottom",onMousedown:w.withModifiers(m,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line top-left-corner",onMousedown:w.withModifiers(g,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line top-right-corner",onMousedown:w.withModifiers(y,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line bottom-left-corner",onMousedown:w.withModifiers(h,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line bottom-right-corner",onMousedown:w.withModifiers(I,["stop"])},null,32)],4))}}),[["__scopeId","data-v-e603010f"]]),aD=w.defineComponent({__name:"ai-blueking",props:{messages:{},prompts:{},loading:{type:Boolean},headBackground:{},background:{},positionLimit:{},sizeLimit:{},startPosition:{},userPhoto:{},name:{},placeholder:{},logo:{},scrollLoading:{type:Boolean},scrollLoadingEnd:{type:Boolean}},emits:["clear","close","scroll-load","stop","send","choose-prompt"],setup(t,{emit:e}){const n=e,r=()=>{n("clear")},o=()=>{n("close")},i=l=>{n("send",l)},a=()=>{n("stop")},s=()=>{n("scroll-load")},c=l=>{n("choose-prompt",l)};return(l,u)=>(w.openBlock(),w.createBlock(iD,{"head-background":l.headBackground,logo:l.logo,name:l.name,"position-limit":l.positionLimit,"size-limit":l.sizeLimit,"start-position":l.startPosition,onClear:r,onClose:o},{default:w.withCtx(()=>[w.createVNode(rD,{background:l.background,loading:l.loading,messages:l.messages,placeholder:l.placeholder,prompts:l.prompts,"scroll-loading":l.scrollLoading,"scroll-loading-end":l.scrollLoadingEnd,"user-photo":l.userPhoto,onChoosePrompt:c,onScrollLoad:s,onSend:i,onStop:a},null,8,["background","loading","messages","placeholder","prompts","scroll-loading","scroll-loading-end","user-photo"])]),_:1},8,["head-background","logo","name","position-limit","size-limit","start-position"]))}});(function(){var t='<svg xmlns="http://www.w3.org/2000/svg" data-name="ai-blueking" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0;visibility:hidden"><symbol id="ai-blueking-check-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-26.3 606.3l-181-181L350 444l135.8 135.8L712 353.5l45.3 45.3-271.6 271.5z"/></symbol><symbol id="ai-blueking-close-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm158.4 561.1l-45.3 45.3L512 557.3 398.9 670.4l-45.3-45.3L466.7 512 353.6 398.9l45.3-45.3L512 466.7l113.1-113.1 45.3 45.3L557.3 512l113.1 113.1z"/></symbol><symbol id="ai-blueking-warning-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 640h-64v-64h64v64zm0-128h-64V320h64v256z"/></symbol><symbol id="ai-blueking-loading-2" viewBox="0 0 1024 1024"><path d="M195.2 195.2a64 64 0 000 90.56l44.8 45.28A64 64 0 00331.04 240l-45.28-44.8a64 64 0 00-90.56 0z" opacity=".1"/><path d="M128 576h64a64 64 0 000-128h-64a64 64 0 000 128z" opacity=".15"/><path d="M285.76 828.8l45.28-44.8A64 64 0 00240 692.96l-44.8 45.28a64 64 0 0090.56 90.56z" opacity=".3"/><path d="M576 896v-64a64 64 0 00-128 0v64a64 64 0 00128 0z" opacity=".45"/><path d="M828.8 828.8a64 64 0 000-90.56L784 692.96A64 64 0 00692.96 784l45.28 45.28a64 64 0 0090.56-.48z" opacity=".6"/><path d="M896 448h-64a64 64 0 000 128h64a64 64 0 000-128z" opacity=".75"/><path d="M738.24 195.2L692.96 240A64 64 0 00784 331.04l45.28-45.28a64 64 0 10-90.56-90.56z" opacity=".9"/><path d="M448 128v64a64 64 0 00128 0v-64a64 64 0 00-128 0z"/></g></symbol><symbol id="ai-blueking-ai" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M928 96v448l-1.211-.014C910.455 758.791 730.989 928 512 928 282.25 928 96 741.75 96 512S282.25 96 512 96h416zM488.911 320H379.544L256 672h84.05l23.292-71.909h137.215L523.342 672h87.088L488.911 320zM736 320h-79.494v352H736V320zm-303.797 66.88l47.594 148.343h-95.696l48.102-148.343z"/></symbol><symbol id="ai-blueking-fasong" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M924.55 113.365c0-.09-.088-.09-.088-.18a30.217 30.217 0 00-7.78-9.684 31.929 31.929 0 00-10.606-5.918c-.089 0-.177-.09-.266-.09-1.502-.537-3.093-.806-4.685-1.075-.442-.09-.884-.27-1.414-.27-1.503-.179-2.917-.179-4.42-.09-.618 0-1.149-.089-1.768 0-4.242.27-8.485 1.525-12.375 3.498L113.792 485.577c-7.514 3.677-13.26 10.312-15.911 18.382-.796 2.242-1.15 4.663-1.415 6.994-.795 4.753-.618 9.685.884 14.347 2.475 8.16 8.044 14.885 15.558 18.741l194.734 103.836c4.685 2.51 9.812 3.766 15.115 3.766 11.757.09 22.541-6.367 28.287-16.768 8.397-15.513 2.475-34.791-13.083-43.13l-142.316-75.86 572.358-288.014L418.93 634.516c-.265.27-.354.628-.619.897-8.662 5.739-14.32 15.423-14.32 26.542v234.123a32.598 32.598 0 009.547 22.686c6.01 6.008 14.143 9.236 22.54 9.146v.09c17.68 0 32-14.257 32-31.832V675.405l381.07-444.127-79.202 585.802-200.921-97.917c-15.823-7.712-34.828-1.255-42.872 14.526-3.712 7.622-4.243 16.41-1.503 24.48s8.575 14.615 16.177 18.202l238.754 116.48c4.42 2.151 9.193 3.227 14.144 3.227.176 0 .353-.09.53-.09.53 0 1.15.18 1.68.18 15.91.09 29.435-11.657 31.733-27.618l99.003-731.782c2.21-7.532 1.767-15.871-2.122-23.403z"/></symbol><symbol id="ai-blueking-shangxialashen-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M510.24 64L352 251.52l127.168-.672.928 223.968h.352l.832 298.656-127.168.736L513.792 960 672 772.448l-127.136.704-.928-320h-.384l-.8-202.656 127.168-.704z"/></symbol><symbol id="ai-blueking-shangxiajuhe" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M510.24 384L352 192l317.92 1.77L510.24 384zm1.44 256l158.24 192L352 830.23 511.68 640zM128 480h768v64H128z"/></symbol><symbol id="ai-blueking-shanchu-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M832 259.2L764.8 192 512 444.8 259.2 192 192 259.2 444.8 512 192 764.8l67.2 67.2L512 579.2 764.8 832l67.2-67.2L579.2 512z"/></symbol><symbol id="ai-blueking-saoba" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M566.857 64C607.253 64 640 92.654 640 128v96h256c35.346 0 64 28.654 64 64v96c0 35.346-28.654 64-64 64h-5.818v332.453l21.56 102.356c7.284 34.587-14.848 68.532-49.436 75.817a64 64 0 01-13.19 1.374H175.262c-35.346 0-64-28.654-64-64a64 64 0 011.436-13.484l21.12-97.989V448H128c-35.346 0-64-28.654-64-64v-96c0-35.346 28.654-64 64-64h256v-96c0-35.346 32.747-64 73.143-64h109.714zm259.325 384H197.818v343.346l-1.436 6.665L175.262 896H320V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h96V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h96V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h145.115l-21.559-102.356-1.374-6.524V448zM896 288H128v96h768v-96zM566.857 128H457.143v96h109.714v-96z"/></symbol><symbol id="ai-blueking-quanquan" viewBox="0 0 1024 1024"><path fill="#3A84FF" d="M512 64.129c-9.343-.661-18.345 3.338-27.005 11.998-2.666 2.667-4.831 6.165-6.495 10.495-1.664 4.33-2.496 7.498-2.496 9.503v4c0 10.004 2.997 18.003 8.991 23.997 3.328 4.01 7.327 6.847 11.999 8.511 4.671 1.664 8.34 2.496 11.006 2.496h4c68.003 0 130.993 16.83 188.97 50.49 57.978 33.66 103.807 79.49 137.489 137.488 33.681 57.999 50.511 121.16 50.49 189.483-.021 68.322-16.851 131.313-50.49 188.97-33.64 57.657-79.469 103.316-137.489 136.976-58.02 33.66-121.18 50.49-189.482 50.49-68.301 0-131.292-16.83-188.97-50.49-57.68-33.66-103.338-79.319-136.977-136.976-33.639-57.657-50.469-120.818-50.49-189.482 0-10.005-3.669-18.676-11.007-26.013-2.666-3.328-6.164-5.824-10.494-7.487-4.33-1.664-7.498-2.496-9.503-2.496h-4c-10.004 0-18.334 3.338-24.99 10.015-4.01 4.01-6.846 8.18-8.51 12.51-1.664 4.33-2.496 7.498-2.496 9.503v4c0 60.665 11.828 118.663 35.484 173.996 23.656 55.332 55.482 102.996 95.477 142.991 39.996 39.996 87.66 71.822 142.992 95.478 55.332 23.656 113.33 35.483 173.996 35.483 60.665 0 118.664-11.827 173.996-35.483 55.332-23.656 102.996-55.482 142.992-95.478 39.995-39.995 71.82-87.659 95.477-142.991 23.656-55.333 35.484-113.331 35.484-173.996 0-60.665-11.828-118.664-35.484-173.996-23.656-55.333-55.482-102.997-95.477-142.992-39.996-39.996-87.66-71.821-142.992-95.477C630.664 75.989 572.666 64.16 512 64.16v-.032z"/></symbol><symbol id="ai-blueking-xiangxia-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M176 617.6l92.8-89.6 182.4 179.2V112h121.6v595.2L755.2 528l92.8 89.6L512 944 176 617.6z" clip-rule="evenodd"/></symbol><symbol id="ai-blueking-tingzhi" viewBox="0 0 1024 1024"><path fill="#fdd" d="M256 256h512v512H256V256z"/><path fill="#ea3636" d="M128 128v768h768V128H128zm640 640H256V256h512v512z"/></symbol></svg>';document.body?document.body.insertAdjacentHTML("afterbegin",t):document.addEventListener("DOMContentLoaded",function(){document.body.insertAdjacentHTML("afterbegin",t)})})();class sD{constructor(e,n,r,o,i){sr(this,"controllerMap");sr(this,"handleEnd");sr(this,"handleError");sr(this,"handleReceiveMessage");sr(this,"handleStart");sr(this,"url");this.url=e,this.handleStart=n,this.handleReceiveMessage=r,this.handleEnd=o,this.handleError=i,this.controllerMap={}}stop(e){var n,r;return(r=(n=this.controllerMap[e])==null?void 0:n.abort)==null||r.call(n),this.handleEnd(e)}async stream(e,n,r){const o=new AbortController;this.controllerMap[n]=o,fetch(this.url,{method:"post",signal:o.signal,headers:{"Content-Type":"application/json",...r},mode:"cors",credentials:"include",body:JSON.stringify(e)}).then(async i=>{const a=i.body.pipeThrough(new window.TextDecoderStream).getReader();for(;;)try{const{value:s,done:c}=await a.read();if(!i.ok){this.handleError(s||i.statusText,i.status,n);break}if(c)break;s.toString().split(`
|
|
269
|
+
`,a.map=[n,e.line],!0},zS=function(e,n,r,o){var i,a,s,c,l,u,f,p=!1,d=e.bMarks[n]+e.tShift[n],m=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||d+3>m||(i=e.src.charCodeAt(d),i!==126&&i!==96)||(l=d,d=e.skipChars(d,i),a=d-l,a<3)||(f=e.src.slice(l,d),s=e.src.slice(d,m),i===96&&s.indexOf(String.fromCharCode(i))>=0))return!1;if(o)return!0;for(c=n;c++,!(c>=r||(d=l=e.bMarks[c]+e.tShift[c],m=e.eMarks[c],d<m&&e.sCount[c]<e.blkIndent));)if(e.src.charCodeAt(d)===i&&!(e.sCount[c]-e.blkIndent>=4)&&(d=e.skipChars(d,i),!(d-l<a)&&(d=e.skipSpaces(d),!(d<m)))){p=!0;break}return a=e.sCount[n],e.line=c+(p?1:0),u=e.push("fence","code",0),u.info=s,u.content=e.getLines(n+1,c,a,!0),u.markup=f,u.map=[n,e.line],!0},ES=Se.isSpace,QS=function(e,n,r,o){var i,a,s,c,l,u,f,p,d,m,g,y,h,I,M,O,C,T,H,W,ne=e.lineMax,R=e.bMarks[n]+e.tShift[n],K=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(R)!==62)return!1;if(o)return!0;for(m=[],g=[],I=[],M=[],T=e.md.block.ruler.getRules("blockquote"),h=e.parentType,e.parentType="blockquote",p=n;p<r&&(W=e.sCount[p]<e.blkIndent,R=e.bMarks[p]+e.tShift[p],K=e.eMarks[p],!(R>=K));p++){if(e.src.charCodeAt(R++)===62&&!W){for(c=e.sCount[p]+1,e.src.charCodeAt(R)===32?(R++,c++,i=!1,O=!0):e.src.charCodeAt(R)===9?(O=!0,(e.bsCount[p]+c)%4===3?(R++,c++,i=!1):i=!0):O=!1,d=c,m.push(e.bMarks[p]),e.bMarks[p]=R;R<K&&(a=e.src.charCodeAt(R),ES(a));){a===9?d+=4-(d+e.bsCount[p]+(i?1:0))%4:d++;R++}u=R>=K,g.push(e.bsCount[p]),e.bsCount[p]=e.sCount[p]+1+(O?1:0),I.push(e.sCount[p]),e.sCount[p]=d-c,M.push(e.tShift[p]),e.tShift[p]=R-e.bMarks[p];continue}if(u)break;for(C=!1,s=0,l=T.length;s<l;s++)if(T[s](e,p,r,!0)){C=!0;break}if(C){e.lineMax=p,e.blkIndent!==0&&(m.push(e.bMarks[p]),g.push(e.bsCount[p]),M.push(e.tShift[p]),I.push(e.sCount[p]),e.sCount[p]-=e.blkIndent);break}m.push(e.bMarks[p]),g.push(e.bsCount[p]),M.push(e.tShift[p]),I.push(e.sCount[p]),e.sCount[p]=-1}for(y=e.blkIndent,e.blkIndent=0,H=e.push("blockquote_open","blockquote",1),H.markup=">",H.map=f=[n,0],e.md.block.tokenize(e,n,p),H=e.push("blockquote_close","blockquote",-1),H.markup=">",e.lineMax=ne,e.parentType=h,f[1]=e.line,s=0;s<M.length;s++)e.bMarks[s+n]=m[s],e.tShift[s+n]=M[s],e.sCount[s+n]=I[s],e.bsCount[s+n]=g[s];return e.blkIndent=y,!0},JS=Se.isSpace,RS=function(e,n,r,o){var i,a,s,c,l=e.bMarks[n]+e.tShift[n],u=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||(i=e.src.charCodeAt(l++),i!==42&&i!==45&&i!==95))return!1;for(a=1;l<u;){if(s=e.src.charCodeAt(l++),s!==i&&!JS(s))return!1;s===i&&a++}return a<3?!1:(o||(e.line=n+1,c=e.push("hr","hr",0),c.map=[n,e.line],c.markup=Array(a+1).join(String.fromCharCode(i))),!0)},hm=Se.isSpace;function bm(t,e){var n,r,o,i;return r=t.bMarks[e]+t.tShift[e],o=t.eMarks[e],n=t.src.charCodeAt(r++),n!==42&&n!==45&&n!==43||r<o&&(i=t.src.charCodeAt(r),!hm(i))?-1:r}function vm(t,e){var n,r=t.bMarks[e]+t.tShift[e],o=r,i=t.eMarks[e];if(o+1>=i||(n=t.src.charCodeAt(o++),n<48||n>57))return-1;for(;;){if(o>=i)return-1;if(n=t.src.charCodeAt(o++),n>=48&&n<=57){if(o-r>=10)return-1;continue}if(n===41||n===46)break;return-1}return o<i&&(n=t.src.charCodeAt(o),!hm(n))?-1:o}function BS(t,e){var n,r,o=t.level+2;for(n=e+2,r=t.tokens.length-2;n<r;n++)t.tokens[n].level===o&&t.tokens[n].type==="paragraph_open"&&(t.tokens[n+2].hidden=!0,t.tokens[n].hidden=!0,n+=2)}var GS=function(e,n,r,o){var i,a,s,c,l,u,f,p,d,m,g,y,h,I,M,O,C,T,H,W,ne,R,K,G,U,J,P,z=n,V=!1,ee=!0;if(e.sCount[z]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[z]-e.listIndent>=4&&e.sCount[z]<e.blkIndent)return!1;if(o&&e.parentType==="paragraph"&&e.sCount[z]>=e.blkIndent&&(V=!0),(R=vm(e,z))>=0){if(f=!0,G=e.bMarks[z]+e.tShift[z],h=Number(e.src.slice(G,R-1)),V&&h!==1)return!1}else if((R=bm(e,z))>=0)f=!1;else return!1;if(V&&e.skipSpaces(R)>=e.eMarks[z])return!1;if(o)return!0;for(y=e.src.charCodeAt(R-1),g=e.tokens.length,f?(P=e.push("ordered_list_open","ol",1),h!==1&&(P.attrs=[["start",h]])):P=e.push("bullet_list_open","ul",1),P.map=m=[z,0],P.markup=String.fromCharCode(y),K=!1,J=e.md.block.ruler.getRules("list"),C=e.parentType,e.parentType="list";z<r;){for(ne=R,I=e.eMarks[z],u=M=e.sCount[z]+R-(e.bMarks[z]+e.tShift[z]);ne<I;){if(i=e.src.charCodeAt(ne),i===9)M+=4-(M+e.bsCount[z])%4;else if(i===32)M++;else break;ne++}if(a=ne,a>=I?l=1:l=M-u,l>4&&(l=1),c=u+l,P=e.push("list_item_open","li",1),P.markup=String.fromCharCode(y),P.map=p=[z,0],f&&(P.info=e.src.slice(G,R-1)),W=e.tight,H=e.tShift[z],T=e.sCount[z],O=e.listIndent,e.listIndent=e.blkIndent,e.blkIndent=c,e.tight=!0,e.tShift[z]=a-e.bMarks[z],e.sCount[z]=M,a>=I&&e.isEmpty(z+1)?e.line=Math.min(e.line+2,r):e.md.block.tokenize(e,z,r,!0),(!e.tight||K)&&(ee=!1),K=e.line-z>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=O,e.tShift[z]=H,e.sCount[z]=T,e.tight=W,P=e.push("list_item_close","li",-1),P.markup=String.fromCharCode(y),z=e.line,p[1]=z,z>=r||e.sCount[z]<e.blkIndent||e.sCount[z]-e.blkIndent>=4)break;for(U=!1,s=0,d=J.length;s<d;s++)if(J[s](e,z,r,!0)){U=!0;break}if(U)break;if(f){if(R=vm(e,z),R<0)break;G=e.bMarks[z]+e.tShift[z]}else if(R=bm(e,z),R<0)break;if(y!==e.src.charCodeAt(R-1))break}return f?P=e.push("ordered_list_close","ol",-1):P=e.push("bullet_list_close","ul",-1),P.markup=String.fromCharCode(y),m[1]=z,e.line=z,e.parentType=C,ee&&BS(e,g),!0},FS=Se.normalizeReference,$a=Se.isSpace,ZS=function(e,n,r,o){var i,a,s,c,l,u,f,p,d,m,g,y,h,I,M,O,C=0,T=e.bMarks[n]+e.tShift[n],H=e.eMarks[n],W=n+1;if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(T)!==91)return!1;for(;++T<H;)if(e.src.charCodeAt(T)===93&&e.src.charCodeAt(T-1)!==92){if(T+1===H||e.src.charCodeAt(T+1)!==58)return!1;break}for(c=e.lineMax,M=e.md.block.ruler.getRules("reference"),m=e.parentType,e.parentType="reference";W<c&&!e.isEmpty(W);W++)if(!(e.sCount[W]-e.blkIndent>3)&&!(e.sCount[W]<0)){for(I=!1,u=0,f=M.length;u<f;u++)if(M[u](e,W,c,!0)){I=!0;break}if(I)break}for(h=e.getLines(n,W,e.blkIndent,!1).trim(),H=h.length,T=1;T<H;T++){if(i=h.charCodeAt(T),i===91)return!1;if(i===93){d=T;break}else i===10?C++:i===92&&(T++,T<H&&h.charCodeAt(T)===10&&C++)}if(d<0||h.charCodeAt(d+1)!==58)return!1;for(T=d+2;T<H;T++)if(i=h.charCodeAt(T),i===10)C++;else if(!$a(i))break;if(g=e.md.helpers.parseLinkDestination(h,T,H),!g.ok||(l=e.md.normalizeLink(g.str),!e.md.validateLink(l)))return!1;for(T=g.pos,C+=g.lines,a=T,s=C,y=T;T<H;T++)if(i=h.charCodeAt(T),i===10)C++;else if(!$a(i))break;for(g=e.md.helpers.parseLinkTitle(h,T,H),T<H&&y!==T&&g.ok?(O=g.str,T=g.pos,C+=g.lines):(O="",T=a,C=s);T<H&&(i=h.charCodeAt(T),!!$a(i));)T++;if(T<H&&h.charCodeAt(T)!==10&&O)for(O="",T=a,C=s;T<H&&(i=h.charCodeAt(T),!!$a(i));)T++;return T<H&&h.charCodeAt(T)!==10||(p=FS(h.slice(1,d)),!p)?!1:(o||(typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[p]>"u"&&(e.env.references[p]={title:O,href:l}),e.parentType=m,e.line=n+C+1),!0)},HS=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","section","source","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],qa={},YS="[a-zA-Z_:][a-zA-Z0-9:._-]*",VS="[^\"'=<>`\\x00-\\x20]+",_S="'[^']*'",WS='"[^"]*"',US="(?:"+VS+"|"+_S+"|"+WS+")",$S="(?:\\s+"+YS+"(?:\\s*=\\s*"+US+")?)",ym="<[A-Za-z][A-Za-z0-9\\-]*"+$S+"*\\s*\\/?>",Am="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",qS="<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->",XS="<[?][\\s\\S]*?[?]>",KS="<![A-Z]+\\s+[^>]*>",eN="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",tN=new RegExp("^(?:"+ym+"|"+Am+"|"+qS+"|"+XS+"|"+KS+"|"+eN+")"),nN=new RegExp("^(?:"+ym+"|"+Am+")");qa.HTML_TAG_RE=tN,qa.HTML_OPEN_CLOSE_TAG_RE=nN;var rN=HS,oN=qa.HTML_OPEN_CLOSE_TAG_RE,Ur=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+rN.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(oN.source+"\\s*$"),/^$/,!1]],iN=function(e,n,r,o){var i,a,s,c,l=e.bMarks[n]+e.tShift[n],u=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(l)!==60)return!1;for(c=e.src.slice(l,u),i=0;i<Ur.length&&!Ur[i][0].test(c);i++);if(i===Ur.length)return!1;if(o)return Ur[i][2];if(a=n+1,!Ur[i][1].test(c)){for(;a<r&&!(e.sCount[a]<e.blkIndent);a++)if(l=e.bMarks[a]+e.tShift[a],u=e.eMarks[a],c=e.src.slice(l,u),Ur[i][1].test(c)){c.length!==0&&a++;break}}return e.line=a,s=e.push("html_block","",0),s.map=[n,a],s.content=e.getLines(n,a,e.blkIndent,!0),!0},wm=Se.isSpace,aN=function(e,n,r,o){var i,a,s,c,l=e.bMarks[n]+e.tShift[n],u=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||(i=e.src.charCodeAt(l),i!==35||l>=u))return!1;for(a=1,i=e.src.charCodeAt(++l);i===35&&l<u&&a<=6;)a++,i=e.src.charCodeAt(++l);return a>6||l<u&&!wm(i)?!1:(o||(u=e.skipSpacesBack(u,l),s=e.skipCharsBack(u,35,l),s>l&&wm(e.src.charCodeAt(s-1))&&(u=s),e.line=n+1,c=e.push("heading_open","h"+String(a),1),c.markup="########".slice(0,a),c.map=[n,e.line],c=e.push("inline","",0),c.content=e.src.slice(l,u).trim(),c.map=[n,e.line],c.children=[],c=e.push("heading_close","h"+String(a),-1),c.markup="########".slice(0,a)),!0)},sN=function(e,n,r){var o,i,a,s,c,l,u,f,p,d=n+1,m,g=e.md.block.ruler.getRules("paragraph");if(e.sCount[n]-e.blkIndent>=4)return!1;for(m=e.parentType,e.parentType="paragraph";d<r&&!e.isEmpty(d);d++)if(!(e.sCount[d]-e.blkIndent>3)){if(e.sCount[d]>=e.blkIndent&&(l=e.bMarks[d]+e.tShift[d],u=e.eMarks[d],l<u&&(p=e.src.charCodeAt(l),(p===45||p===61)&&(l=e.skipChars(l,p),l=e.skipSpaces(l),l>=u)))){f=p===61?1:2;break}if(!(e.sCount[d]<0)){for(i=!1,a=0,s=g.length;a<s;a++)if(g[a](e,d,r,!0)){i=!0;break}if(i)break}}return f?(o=e.getLines(n,d,e.blkIndent,!1).trim(),e.line=d+1,c=e.push("heading_open","h"+String(f),1),c.markup=String.fromCharCode(p),c.map=[n,e.line],c=e.push("inline","",0),c.content=o,c.map=[n,e.line-1],c.children=[],c=e.push("heading_close","h"+String(f),-1),c.markup=String.fromCharCode(p),e.parentType=m,!0):!1},cN=function(e,n,r){var o,i,a,s,c,l,u=n+1,f=e.md.block.ruler.getRules("paragraph");for(l=e.parentType,e.parentType="paragraph";u<r&&!e.isEmpty(u);u++)if(!(e.sCount[u]-e.blkIndent>3)&&!(e.sCount[u]<0)){for(i=!1,a=0,s=f.length;a<s;a++)if(f[a](e,u,r,!0)){i=!0;break}if(i)break}return o=e.getLines(n,u,e.blkIndent,!1).trim(),e.line=u,c=e.push("paragraph_open","p",1),c.map=[n,e.line],c=e.push("inline","",0),c.content=o,c.map=[n,e.line],c.children=[],c=e.push("paragraph_close","p",-1),e.parentType=l,!0},km=qc,Xa=Se.isSpace;function sn(t,e,n,r){var o,i,a,s,c,l,u,f;for(this.src=t,this.md=e,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0,this.result="",i=this.src,f=!1,a=s=l=u=0,c=i.length;s<c;s++){if(o=i.charCodeAt(s),!f)if(Xa(o)){l++,o===9?u+=4-u%4:u++;continue}else f=!0;(o===10||s===c-1)&&(o!==10&&s++,this.bMarks.push(a),this.eMarks.push(s),this.tShift.push(l),this.sCount.push(u),this.bsCount.push(0),f=!1,l=0,u=0,a=s+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}sn.prototype.push=function(t,e,n){var r=new km(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},sn.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},sn.prototype.skipEmptyLines=function(e){for(var n=this.lineMax;e<n&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},sn.prototype.skipSpaces=function(e){for(var n,r=this.src.length;e<r&&(n=this.src.charCodeAt(e),!!Xa(n));e++);return e},sn.prototype.skipSpacesBack=function(e,n){if(e<=n)return e;for(;e>n;)if(!Xa(this.src.charCodeAt(--e)))return e+1;return e},sn.prototype.skipChars=function(e,n){for(var r=this.src.length;e<r&&this.src.charCodeAt(e)===n;e++);return e},sn.prototype.skipCharsBack=function(e,n,r){if(e<=r)return e;for(;e>r;)if(n!==this.src.charCodeAt(--e))return e+1;return e},sn.prototype.getLines=function(e,n,r,o){var i,a,s,c,l,u,f,p=e;if(e>=n)return"";for(u=new Array(n-e),i=0;p<n;p++,i++){for(a=0,f=c=this.bMarks[p],p+1<n||o?l=this.eMarks[p]+1:l=this.eMarks[p];c<l&&a<r;){if(s=this.src.charCodeAt(c),Xa(s))s===9?a+=4-(a+this.bsCount[p])%4:a++;else if(c-f<this.tShift[p])a++;else break;c++}a>r?u[i]=new Array(a-r+1).join(" ")+this.src.slice(c,l):u[i]=this.src.slice(c,l)}return u.join("")},sn.prototype.Token=km;var lN=sn,uN=$c,Ka=[["table",OS,["paragraph","reference"]],["code",PS],["fence",zS,["paragraph","reference","blockquote","list"]],["blockquote",QS,["paragraph","reference","blockquote","list"]],["hr",RS,["paragraph","reference","blockquote","list"]],["list",GS,["paragraph","reference","blockquote"]],["reference",ZS],["html_block",iN,["paragraph","reference","blockquote"]],["heading",aN,["paragraph","reference","blockquote"]],["lheading",sN],["paragraph",cN]];function es(){this.ruler=new uN;for(var t=0;t<Ka.length;t++)this.ruler.push(Ka[t][0],Ka[t][1],{alt:(Ka[t][2]||[]).slice()})}es.prototype.tokenize=function(t,e,n){for(var r,o,i,a=this.ruler.getRules(""),s=a.length,c=e,l=!1,u=t.md.options.maxNesting;c<n&&(t.line=c=t.skipEmptyLines(c),!(c>=n||t.sCount[c]<t.blkIndent));){if(t.level>=u){t.line=n;break}for(i=t.line,o=0;o<s;o++)if(r=a[o](t,c,n,!1),r){if(i>=t.line)throw new Error("block rule didn't increment state.line");break}if(!r)throw new Error("none of the block rules matched");t.tight=!l,t.isEmpty(t.line-1)&&(l=!0),c=t.line,c<n&&t.isEmpty(c)&&(l=!0,c++,t.line=c)}},es.prototype.parse=function(t,e,n,r){var o;t&&(o=new this.State(t,e,n,r),this.tokenize(o,o.line,o.lineMax))},es.prototype.State=lN;var fN=es;function dN(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}for(var pN=function(e,n){for(var r=e.pos;r<e.posMax&&!dN(e.src.charCodeAt(r));)r++;return r===e.pos?!1:(n||(e.pending+=e.src.slice(e.pos,r)),e.pos=r,!0)},gN=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i,mN=function(e,n){var r,o,i,a,s,c,l,u;return!e.md.options.linkify||e.linkLevel>0||(r=e.pos,o=e.posMax,r+3>o)||e.src.charCodeAt(r)!==58||e.src.charCodeAt(r+1)!==47||e.src.charCodeAt(r+2)!==47||(i=e.pending.match(gN),!i)||(a=i[1],s=e.md.linkify.matchAtStart(e.src.slice(r-a.length)),!s)||(c=s.url,c.length<=a.length)||(c=c.replace(/\*+$/,""),l=e.md.normalizeLink(c),!e.md.validateLink(l))?!1:(n||(e.pending=e.pending.slice(0,-a.length),u=e.push("link_open","a",1),u.attrs=[["href",l]],u.markup="linkify",u.info="auto",u=e.push("text","",0),u.content=e.md.normalizeLinkText(c),u=e.push("link_close","a",-1),u.markup="linkify",u.info="auto"),e.pos+=c.length-a.length,!0)},hN=Se.isSpace,bN=function(e,n){var r,o,i,a=e.pos;if(e.src.charCodeAt(a)!==10)return!1;if(r=e.pending.length-1,o=e.posMax,!n)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){for(i=r-1;i>=1&&e.pending.charCodeAt(i-1)===32;)i--;e.pending=e.pending.slice(0,i),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(a++;a<o&&hN(e.src.charCodeAt(a));)a++;return e.pos=a,!0},vN=Se.isSpace,nl=[],Im=0;Im<256;Im++)nl.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){nl[t.charCodeAt(0)]=1});var yN=function(e,n){var r,o,i,a,s,c=e.pos,l=e.posMax;if(e.src.charCodeAt(c)!==92||(c++,c>=l))return!1;if(r=e.src.charCodeAt(c),r===10){for(n||e.push("hardbreak","br",0),c++;c<l&&(r=e.src.charCodeAt(c),!!vN(r));)c++;return e.pos=c,!0}return a=e.src[c],r>=55296&&r<=56319&&c+1<l&&(o=e.src.charCodeAt(c+1),o>=56320&&o<=57343&&(a+=e.src[c+1],c++)),i="\\"+a,n||(s=e.push("text_special","",0),r<256&&nl[r]!==0?s.content=a:s.content=i,s.markup=i,s.info="escape"),e.pos=c+1,!0},AN=function(e,n){var r,o,i,a,s,c,l,u,f=e.pos,p=e.src.charCodeAt(f);if(p!==96)return!1;for(r=f,f++,o=e.posMax;f<o&&e.src.charCodeAt(f)===96;)f++;if(i=e.src.slice(r,f),l=i.length,e.backticksScanned&&(e.backticks[l]||0)<=r)return n||(e.pending+=i),e.pos+=l,!0;for(c=f;(s=e.src.indexOf("`",c))!==-1;){for(c=s+1;c<o&&e.src.charCodeAt(c)===96;)c++;if(u=c-s,u===l)return n||(a=e.push("code_inline","code",0),a.markup=i,a.content=e.src.slice(f,s).replace(/\n/g," ").replace(/^ (.+) $/,"$1")),e.pos=c,!0;e.backticks[u]=s}return e.backticksScanned=!0,n||(e.pending+=i),e.pos+=l,!0},ts={};ts.tokenize=function(e,n){var r,o,i,a,s,c=e.pos,l=e.src.charCodeAt(c);if(n||l!==126||(o=e.scanDelims(e.pos,!0),a=o.length,s=String.fromCharCode(l),a<2))return!1;for(a%2&&(i=e.push("text","",0),i.content=s,a--),r=0;r<a;r+=2)i=e.push("text","",0),i.content=s+s,e.delimiters.push({marker:l,length:0,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0};function xm(t,e){var n,r,o,i,a,s=[],c=e.length;for(n=0;n<c;n++)o=e[n],o.marker===126&&o.end!==-1&&(i=e[o.end],a=t.tokens[o.token],a.type="s_open",a.tag="s",a.nesting=1,a.markup="~~",a.content="",a=t.tokens[i.token],a.type="s_close",a.tag="s",a.nesting=-1,a.markup="~~",a.content="",t.tokens[i.token-1].type==="text"&&t.tokens[i.token-1].content==="~"&&s.push(i.token-1));for(;s.length;){for(n=s.pop(),r=n+1;r<t.tokens.length&&t.tokens[r].type==="s_close";)r++;r--,n!==r&&(a=t.tokens[r],t.tokens[r]=t.tokens[n],t.tokens[n]=a)}}ts.postProcess=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(xm(e,e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&xm(e,r[n].delimiters)};var ns={};ns.tokenize=function(e,n){var r,o,i,a=e.pos,s=e.src.charCodeAt(a);if(n||s!==95&&s!==42)return!1;for(o=e.scanDelims(e.pos,s===42),r=0;r<o.length;r++)i=e.push("text","",0),i.content=String.fromCharCode(s),e.delimiters.push({marker:s,length:o.length,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0};function Mm(t,e){var n,r,o,i,a,s,c=e.length;for(n=c-1;n>=0;n--)r=e[n],!(r.marker!==95&&r.marker!==42)&&r.end!==-1&&(o=e[r.end],s=n>0&&e[n-1].end===r.end+1&&e[n-1].marker===r.marker&&e[n-1].token===r.token-1&&e[r.end+1].token===o.token+1,a=String.fromCharCode(r.marker),i=t.tokens[r.token],i.type=s?"strong_open":"em_open",i.tag=s?"strong":"em",i.nesting=1,i.markup=s?a+a:a,i.content="",i=t.tokens[o.token],i.type=s?"strong_close":"em_close",i.tag=s?"strong":"em",i.nesting=-1,i.markup=s?a+a:a,i.content="",s&&(t.tokens[e[n-1].token].content="",t.tokens[e[r.end+1].token].content="",n--))}ns.postProcess=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(Mm(e,e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&Mm(e,r[n].delimiters)};var wN=Se.normalizeReference,rl=Se.isSpace,kN=function(e,n){var r,o,i,a,s,c,l,u,f,p="",d="",m=e.pos,g=e.posMax,y=e.pos,h=!0;if(e.src.charCodeAt(e.pos)!==91||(s=e.pos+1,a=e.md.helpers.parseLinkLabel(e,e.pos,!0),a<0))return!1;if(c=a+1,c<g&&e.src.charCodeAt(c)===40){for(h=!1,c++;c<g&&(o=e.src.charCodeAt(c),!(!rl(o)&&o!==10));c++);if(c>=g)return!1;if(y=c,l=e.md.helpers.parseLinkDestination(e.src,c,e.posMax),l.ok){for(p=e.md.normalizeLink(l.str),e.md.validateLink(p)?c=l.pos:p="",y=c;c<g&&(o=e.src.charCodeAt(c),!(!rl(o)&&o!==10));c++);if(l=e.md.helpers.parseLinkTitle(e.src,c,e.posMax),c<g&&y!==c&&l.ok)for(d=l.str,c=l.pos;c<g&&(o=e.src.charCodeAt(c),!(!rl(o)&&o!==10));c++);}(c>=g||e.src.charCodeAt(c)!==41)&&(h=!0),c++}if(h){if(typeof e.env.references>"u")return!1;if(c<g&&e.src.charCodeAt(c)===91?(y=c+1,c=e.md.helpers.parseLinkLabel(e,c),c>=0?i=e.src.slice(y,c++):c=a+1):c=a+1,i||(i=e.src.slice(s,a)),u=e.env.references[wN(i)],!u)return e.pos=m,!1;p=u.href,d=u.title}return n||(e.pos=s,e.posMax=a,f=e.push("link_open","a",1),f.attrs=r=[["href",p]],d&&r.push(["title",d]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,f=e.push("link_close","a",-1)),e.pos=c,e.posMax=g,!0},IN=Se.normalizeReference,ol=Se.isSpace,xN=function(e,n){var r,o,i,a,s,c,l,u,f,p,d,m,g,y="",h=e.pos,I=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91||(c=e.pos+2,s=e.md.helpers.parseLinkLabel(e,e.pos+1,!1),s<0))return!1;if(l=s+1,l<I&&e.src.charCodeAt(l)===40){for(l++;l<I&&(o=e.src.charCodeAt(l),!(!ol(o)&&o!==10));l++);if(l>=I)return!1;for(g=l,f=e.md.helpers.parseLinkDestination(e.src,l,e.posMax),f.ok&&(y=e.md.normalizeLink(f.str),e.md.validateLink(y)?l=f.pos:y=""),g=l;l<I&&(o=e.src.charCodeAt(l),!(!ol(o)&&o!==10));l++);if(f=e.md.helpers.parseLinkTitle(e.src,l,e.posMax),l<I&&g!==l&&f.ok)for(p=f.str,l=f.pos;l<I&&(o=e.src.charCodeAt(l),!(!ol(o)&&o!==10));l++);else p="";if(l>=I||e.src.charCodeAt(l)!==41)return e.pos=h,!1;l++}else{if(typeof e.env.references>"u")return!1;if(l<I&&e.src.charCodeAt(l)===91?(g=l+1,l=e.md.helpers.parseLinkLabel(e,l),l>=0?a=e.src.slice(g,l++):l=s+1):l=s+1,a||(a=e.src.slice(c,s)),u=e.env.references[IN(a)],!u)return e.pos=h,!1;y=u.href,p=u.title}return n||(i=e.src.slice(c,s),e.md.inline.parse(i,e.md,e.env,m=[]),d=e.push("image","img",0),d.attrs=r=[["src",y],["alt",""]],d.children=m,d.content=i,p&&r.push(["title",p])),e.pos=l,e.posMax=I,!0},MN=/^([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])?)*)$/,CN=/^([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)$/,jN=function(e,n){var r,o,i,a,s,c,l=e.pos;if(e.src.charCodeAt(l)!==60)return!1;for(s=e.pos,c=e.posMax;;){if(++l>=c||(a=e.src.charCodeAt(l),a===60))return!1;if(a===62)break}return r=e.src.slice(s+1,l),CN.test(r)?(o=e.md.normalizeLink(r),e.md.validateLink(o)?(n||(i=e.push("link_open","a",1),i.attrs=[["href",o]],i.markup="autolink",i.info="auto",i=e.push("text","",0),i.content=e.md.normalizeLinkText(r),i=e.push("link_close","a",-1),i.markup="autolink",i.info="auto"),e.pos+=r.length+2,!0):!1):MN.test(r)?(o=e.md.normalizeLink("mailto:"+r),e.md.validateLink(o)?(n||(i=e.push("link_open","a",1),i.attrs=[["href",o]],i.markup="autolink",i.info="auto",i=e.push("text","",0),i.content=e.md.normalizeLinkText(r),i=e.push("link_close","a",-1),i.markup="autolink",i.info="auto"),e.pos+=r.length+2,!0):!1):!1},TN=qa.HTML_TAG_RE;function LN(t){return/^<a[>\s]/i.test(t)}function SN(t){return/^<\/a\s*>/i.test(t)}function NN(t){var e=t|32;return e>=97&&e<=122}var DN=function(e,n){var r,o,i,a,s=e.pos;return!e.md.options.html||(i=e.posMax,e.src.charCodeAt(s)!==60||s+2>=i)||(r=e.src.charCodeAt(s+1),r!==33&&r!==63&&r!==47&&!NN(r))||(o=e.src.slice(s).match(TN),!o)?!1:(n||(a=e.push("html_inline","",0),a.content=o[0],LN(a.content)&&e.linkLevel++,SN(a.content)&&e.linkLevel--),e.pos+=o[0].length,!0)},Cm=Yg,ON=Se.has,PN=Se.isValidEntityCode,jm=Se.fromCodePoint,zN=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,EN=/^&([a-z][a-z0-9]{1,31});/i,QN=function(e,n){var r,o,i,a,s=e.pos,c=e.posMax;if(e.src.charCodeAt(s)!==38||s+1>=c)return!1;if(r=e.src.charCodeAt(s+1),r===35){if(i=e.src.slice(s).match(zN),i)return n||(o=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),a=e.push("text_special","",0),a.content=PN(o)?jm(o):jm(65533),a.markup=i[0],a.info="entity"),e.pos+=i[0].length,!0}else if(i=e.src.slice(s).match(EN),i&&ON(Cm,i[1]))return n||(a=e.push("text_special","",0),a.content=Cm[i[1]],a.markup=i[0],a.info="entity"),e.pos+=i[0].length,!0;return!1};function Tm(t){var e,n,r,o,i,a,s,c,l={},u=t.length;if(u){var f=0,p=-2,d=[];for(e=0;e<u;e++)if(r=t[e],d.push(0),(t[f].marker!==r.marker||p!==r.token-1)&&(f=e),p=r.token,r.length=r.length||0,!!r.close){for(l.hasOwnProperty(r.marker)||(l[r.marker]=[-1,-1,-1,-1,-1,-1]),i=l[r.marker][(r.open?3:0)+r.length%3],n=f-d[f]-1,a=n;n>i;n-=d[n]+1)if(o=t[n],o.marker===r.marker&&o.open&&o.end<0&&(s=!1,(o.close||r.open)&&(o.length+r.length)%3===0&&(o.length%3!==0||r.length%3!==0)&&(s=!0),!s)){c=n>0&&!t[n-1].open?d[n-1]+1:0,d[e]=e-n+c,d[n]=c,r.open=!1,o.end=e,o.close=!1,a=-1,p=-2;break}a!==-1&&(l[r.marker][(r.open?3:0)+(r.length||0)%3]=a)}}}var JN=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(Tm(e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&Tm(r[n].delimiters)},RN=function(e){var n,r,o=0,i=e.tokens,a=e.tokens.length;for(n=r=0;n<a;n++)i[n].nesting<0&&o--,i[n].level=o,i[n].nesting>0&&o++,i[n].type==="text"&&n+1<a&&i[n+1].type==="text"?i[n+1].content=i[n].content+i[n+1].content:(n!==r&&(i[r]=i[n]),r++);n!==r&&(i.length=r)},il=qc,Lm=Se.isWhiteSpace,Sm=Se.isPunctChar,Nm=Se.isMdAsciiPunct;function hi(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}hi.prototype.pushPending=function(){var t=new il("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t},hi.prototype.push=function(t,e,n){this.pending&&this.pushPending();var r=new il(t,e,n),o=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],o={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(o),r},hi.prototype.scanDelims=function(t,e){var n=t,r,o,i,a,s,c,l,u,f,p=!0,d=!0,m=this.posMax,g=this.src.charCodeAt(t);for(r=t>0?this.src.charCodeAt(t-1):32;n<m&&this.src.charCodeAt(n)===g;)n++;return i=n-t,o=n<m?this.src.charCodeAt(n):32,l=Nm(r)||Sm(String.fromCharCode(r)),f=Nm(o)||Sm(String.fromCharCode(o)),c=Lm(r),u=Lm(o),u?p=!1:f&&(c||l||(p=!1)),c?d=!1:l&&(u||f||(d=!1)),e?(a=p,s=d):(a=p&&(!d||l),s=d&&(!p||f)),{can_open:a,can_close:s,length:i}},hi.prototype.Token=il;var BN=hi,Dm=$c,al=[["text",pN],["linkify",mN],["newline",bN],["escape",yN],["backticks",AN],["strikethrough",ts.tokenize],["emphasis",ns.tokenize],["link",kN],["image",xN],["autolink",jN],["html_inline",DN],["entity",QN]],sl=[["balance_pairs",JN],["strikethrough",ts.postProcess],["emphasis",ns.postProcess],["fragments_join",RN]];function bi(){var t;for(this.ruler=new Dm,t=0;t<al.length;t++)this.ruler.push(al[t][0],al[t][1]);for(this.ruler2=new Dm,t=0;t<sl.length;t++)this.ruler2.push(sl[t][0],sl[t][1])}bi.prototype.skipToken=function(t){var e,n,r=t.pos,o=this.ruler.getRules(""),i=o.length,a=t.md.options.maxNesting,s=t.cache;if(typeof s[r]<"u"){t.pos=s[r];return}if(t.level<a){for(n=0;n<i;n++)if(t.level++,e=o[n](t,!0),t.level--,e){if(r>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;e||t.pos++,s[r]=t.pos},bi.prototype.tokenize=function(t){for(var e,n,r,o=this.ruler.getRules(""),i=o.length,a=t.posMax,s=t.md.options.maxNesting;t.pos<a;){if(r=t.pos,t.level<s){for(n=0;n<i;n++)if(e=o[n](t,!1),e){if(r>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(e){if(t.pos>=a)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},bi.prototype.parse=function(t,e,n,r){var o,i,a,s=new this.State(t,e,n,r);for(this.tokenize(s),i=this.ruler2.getRules(""),a=i.length,o=0;o<a;o++)i[o](s)},bi.prototype.State=BN;var GN=bi,cl,Om;function FN(){return Om||(Om=1,cl=function(t){var e={};t=t||{},e.src_Any=em().source,e.src_Cc=nm().source,e.src_Z=im().source,e.src_P=Yc.source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");var n="[><|]";return e.src_pseudo_letter="(?:(?!"+n+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+n+"|"+e.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+"|$)|;(?!"+e.src_ZCc+"|$)|\\!+(?!"+e.src_ZCc+"|[!]|$)|\\?(?!"+e.src_ZCc+"|[?]|$))+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}),cl}function ll(t){var e=Array.prototype.slice.call(arguments,1);return e.forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function rs(t){return Object.prototype.toString.call(t)}function ZN(t){return rs(t)==="[object String]"}function HN(t){return rs(t)==="[object Object]"}function YN(t){return rs(t)==="[object RegExp]"}function Pm(t){return rs(t)==="[object Function]"}function VN(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var zm={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function _N(t){return Object.keys(t||{}).reduce(function(e,n){return e||zm.hasOwnProperty(n)},!1)}var WN={"http:":{validate:function(t,e,n){var r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){var r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){var r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},UN="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",$N="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function qN(t){t.__index__=-1,t.__text_cache__=""}function XN(t){return function(e,n){var r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function Em(){return function(t,e){e.normalize(t)}}function os(t){var e=t.re=FN()(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(UN),n.push(e.src_xn),e.src_tlds=n.join("|");function r(s){return s.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");var o=[];t.__compiled__={};function i(s,c){throw new Error('(LinkifyIt) Invalid schema "'+s+'": '+c)}Object.keys(t.__schemas__).forEach(function(s){var c=t.__schemas__[s];if(c!==null){var l={validate:null,link:null};if(t.__compiled__[s]=l,HN(c)){YN(c.validate)?l.validate=XN(c.validate):Pm(c.validate)?l.validate=c.validate:i(s,c),Pm(c.normalize)?l.normalize=c.normalize:c.normalize?i(s,c):l.normalize=Em();return}if(ZN(c)){o.push(s);return}i(s,c)}}),o.forEach(function(s){t.__compiled__[t.__schemas__[s]]&&(t.__compiled__[s].validate=t.__compiled__[t.__schemas__[s]].validate,t.__compiled__[s].normalize=t.__compiled__[t.__schemas__[s]].normalize)}),t.__compiled__[""]={validate:null,normalize:Em()};var a=Object.keys(t.__compiled__).filter(function(s){return s.length>0&&t.__compiled__[s]}).map(VN).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+a+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+a+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),qN(t)}function KN(t,e){var n=t.__index__,r=t.__last_index__,o=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=o,this.text=o,this.url=o}function ul(t,e){var n=new KN(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function wt(t,e){if(!(this instanceof wt))return new wt(t,e);e||_N(t)&&(e=t,t={}),this.__opts__=ll({},zm,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=ll({},WN,t),this.__compiled__={},this.__tlds__=$N,this.__tlds_replaced__=!1,this.re={},os(this)}wt.prototype.add=function(e,n){return this.__schemas__[e]=n,os(this),this},wt.prototype.set=function(e){return this.__opts__=ll(this.__opts__,e),this},wt.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var n,r,o,i,a,s,c,l,u;if(this.re.schema_test.test(e)){for(c=this.re.schema_search,c.lastIndex=0;(n=c.exec(e))!==null;)if(i=this.testSchemaAt(e,n[2],c.lastIndex),i){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=e.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l<this.__index__)&&(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=r.index+r[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__="",this.__index__=a,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(u=e.indexOf("@"),u>=0&&(o=e.match(this.re.email_fuzzy))!==null&&(a=o.index+o[1].length,s=o.index+o[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&s>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=a,this.__last_index__=s))),this.__index__>=0},wt.prototype.pretest=function(e){return this.re.pretest.test(e)},wt.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0},wt.prototype.match=function(e){var n=0,r=[];this.__index__>=0&&this.__text_cache__===e&&(r.push(ul(this,n)),n=this.__last_index__);for(var o=n?e.slice(n):e;this.test(o);)r.push(ul(this,n)),o=o.slice(this.__last_index__),n+=this.__last_index__;return r.length?r:null},wt.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;var n=this.re.schema_at_start.exec(e);if(!n)return null;var r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,ul(this,0)):null},wt.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,o,i){return r!==i[o-1]}).reverse(),os(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,os(this),this)},wt.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)},wt.prototype.onCompile=function(){};var e3=wt;const $r=2147483647,cn=36,fl=1,vi=26,t3=38,n3=700,Qm=72,Jm=128,Rm="-",r3=/^xn--/,o3=/[^\0-\x7F]/,i3=/[\x2E\u3002\uFF0E\uFF61]/g,a3={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},dl=cn-fl,ln=Math.floor,pl=String.fromCharCode;function Rn(t){throw new RangeError(a3[t])}function s3(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function Bm(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(i3,".");const o=t.split("."),i=s3(o,e).join(".");return r+i}function gl(t){const e=[];let n=0;const r=t.length;for(;n<r;){const o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){const i=t.charCodeAt(n++);(i&64512)==56320?e.push(((o&1023)<<10)+(i&1023)+65536):(e.push(o),n--)}else e.push(o)}return e}const Gm=t=>String.fromCodePoint(...t),c3=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:cn},Fm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Zm=function(t,e,n){let r=0;for(t=n?ln(t/n3):t>>1,t+=ln(t/e);t>dl*vi>>1;r+=cn)t=ln(t/dl);return ln(r+(dl+1)*t/(t+t3))},ml=function(t){const e=[],n=t.length;let r=0,o=Jm,i=Qm,a=t.lastIndexOf(Rm);a<0&&(a=0);for(let s=0;s<a;++s)t.charCodeAt(s)>=128&&Rn("not-basic"),e.push(t.charCodeAt(s));for(let s=a>0?a+1:0;s<n;){const c=r;for(let u=1,f=cn;;f+=cn){s>=n&&Rn("invalid-input");const p=c3(t.charCodeAt(s++));p>=cn&&Rn("invalid-input"),p>ln(($r-r)/u)&&Rn("overflow"),r+=p*u;const d=f<=i?fl:f>=i+vi?vi:f-i;if(p<d)break;const m=cn-d;u>ln($r/m)&&Rn("overflow"),u*=m}const l=e.length+1;i=Zm(r-c,l,c==0),ln(r/l)>$r-o&&Rn("overflow"),o+=ln(r/l),r%=l,e.splice(r++,0,o)}return String.fromCodePoint(...e)},hl=function(t){const e=[];t=gl(t);const n=t.length;let r=Jm,o=0,i=Qm;for(const c of t)c<128&&e.push(pl(c));const a=e.length;let s=a;for(a&&e.push(Rm);s<n;){let c=$r;for(const u of t)u>=r&&u<c&&(c=u);const l=s+1;c-r>ln(($r-o)/l)&&Rn("overflow"),o+=(c-r)*l,r=c;for(const u of t)if(u<r&&++o>$r&&Rn("overflow"),u===r){let f=o;for(let p=cn;;p+=cn){const d=p<=i?fl:p>=i+vi?vi:p-i;if(f<d)break;const m=f-d,g=cn-d;e.push(pl(Fm(d+m%g,0))),f=ln(m/g)}e.push(pl(Fm(f,0))),i=Zm(o,l,s===a),o=0,++s}++o,++r}return e.join("")},Hm=function(t){return Bm(t,function(e){return r3.test(e)?ml(e.slice(4).toLowerCase()):e})},Ym=function(t){return Bm(t,function(e){return o3.test(e)?"xn--"+hl(e):e})},l3=th(Object.freeze(Object.defineProperty({__proto__:null,decode:ml,default:{version:"2.3.1",ucs2:{decode:gl,encode:Gm},decode:ml,encode:hl,toASCII:Ym,toUnicode:Hm},encode:hl,toASCII:Ym,toUnicode:Hm,ucs2decode:gl,ucs2encode:Gm},Symbol.toStringTag,{value:"Module"})));var u3={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},f3={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},d3={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}},yi=Se,p3=Wa,g3=cS,m3=DS,h3=fN,b3=GN,v3=e3,rr=Vr,Vm=l3,y3={default:u3,zero:f3,commonmark:d3},A3=/^(vbscript|javascript|file|data):/,w3=/^data:image\/(gif|png|jpeg|webp);/;function k3(t){var e=t.trim().toLowerCase();return A3.test(e)?!!w3.test(e):!0}var _m=["http:","https:","mailto:"];function I3(t){var e=rr.parse(t,!0);if(e.hostname&&(!e.protocol||_m.indexOf(e.protocol)>=0))try{e.hostname=Vm.toASCII(e.hostname)}catch{}return rr.encode(rr.format(e))}function x3(t){var e=rr.parse(t,!0);if(e.hostname&&(!e.protocol||_m.indexOf(e.protocol)>=0))try{e.hostname=Vm.toUnicode(e.hostname)}catch{}return rr.decode(rr.format(e),rr.decode.defaultChars+"%")}function Nt(t,e){if(!(this instanceof Nt))return new Nt(t,e);e||yi.isString(t)||(e=t||{},t="default"),this.inline=new b3,this.block=new h3,this.core=new m3,this.renderer=new g3,this.linkify=new v3,this.validateLink=k3,this.normalizeLink=I3,this.normalizeLinkText=x3,this.utils=yi,this.helpers=yi.assign({},p3),this.options={},this.configure(t),e&&this.set(e)}Nt.prototype.set=function(t){return yi.assign(this.options,t),this},Nt.prototype.configure=function(t){var e=this,n;if(yi.isString(t)&&(n=t,t=y3[n],!t))throw new Error('Wrong `markdown-it` preset "'+n+'", check name');if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(r){t.components[r].rules&&e[r].ruler.enableOnly(t.components[r].rules),t.components[r].rules2&&e[r].ruler2.enableOnly(t.components[r].rules2)}),this},Nt.prototype.enable=function(t,e){var n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(o){n=n.concat(this[o].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));var r=t.filter(function(o){return n.indexOf(o)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this},Nt.prototype.disable=function(t,e){var n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(o){n=n.concat(this[o].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));var r=t.filter(function(o){return n.indexOf(o)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this},Nt.prototype.use=function(t){var e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this},Nt.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");var n=new this.core.State(t,this,e);return this.core.process(n),n.tokens},Nt.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},Nt.prototype.parseInline=function(t,e){var n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens},Nt.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};var M3=Nt,C3=M3;const j3=lo(C3);var bl=(t=>(t.Assistant="assistant",t.System="system",t.User="user",t))(bl||{}),Ai=(t=>(t.Error="error",t.Loading="loading",t.Success="success",t))(Ai||{});const T3={class:"message-content user"},L3={key:0,class:"time-message user"},S3=["innerHTML"],N3={class:"message-photo user"},D3=["src"],O3=w.createElementVNode("span",{class:"message-photo ai"},[w.createElementVNode("i",{class:"ai-blueking-icon ai-blueking-ai"})],-1),P3={class:"message-content ai"},z3={key:0,class:"time-message ai"},E3={key:2,width:"18",height:"18",class:"loading-message","aria-hidden":"true"},Q3=[w.createElementVNode("use",{"xlink:href":"#ai-blueking-quanquan"},null,-1)],J3={key:3,class:"message-wrap"},R3=["innerHTML"],B3=w.defineComponent({__name:"render-message",props:{message:{},userPhoto:{default:yl}},setup(t){const e=t,n=w.computed(()=>{var a;const i={error:"ai-blueking-icon ai-blueking-warning-circle-fill",loading:"",success:""};return(a=e.message)!=null&&a.status?i[e.message.status]:""}),r=w.computed(()=>{if(e.message.content){const a=new j3({html:!0}).render(e.message.content);return JL.sanitize(a)}return""}),o=w.computed(()=>{const i=Gt(e.message.time),a=Gt();return e.message.time?a.isSame(i,"year")?i.format("MM-DD HH:mm:ss"):i.format("YYYY-MM-DD HH:mm:ss"):""});return(i,a)=>(w.openBlock(),w.createElementBlock("li",{class:w.normalizeClass([i.message.role,"message-main"])},[i.message.role===w.unref(bl).User?(w.openBlock(),w.createElementBlock(w.Fragment,{key:0},[w.createElementVNode("p",T3,[o.value?(w.openBlock(),w.createElementBlock("span",L3,w.toDisplayString(o.value),1)):w.createCommentVNode("v-if",!0),w.createElementVNode("span",{class:"markdown-message",innerHTML:r.value},null,8,S3)]),w.createElementVNode("span",N3,[w.createElementVNode("img",{src:i.userPhoto},null,8,D3)])],64)):(w.openBlock(),w.createElementBlock(w.Fragment,{key:1},[O3,w.createElementVNode("p",P3,[o.value?(w.openBlock(),w.createElementBlock("span",z3,w.toDisplayString(o.value),1)):w.createCommentVNode("v-if",!0),n.value?(w.openBlock(),w.createElementBlock("i",{key:1,class:w.normalizeClass(n.value)},null,2)):w.createCommentVNode("v-if",!0),i.message.status===w.unref(Ai).Loading?(w.openBlock(),w.createElementBlock("svg",E3,Q3)):w.createCommentVNode("v-if",!0),i.message.status===w.unref(Ai).Error?(w.openBlock(),w.createElementBlock("span",J3,w.toDisplayString(i.message.content),1)):(w.openBlock(),w.createElementBlock("span",{key:4,innerHTML:r.value,class:w.normalizeClass({"markdown-message":!0,loading:i.message.status===w.unref(Ai).Loading})},null,10,R3))])],64))],2))}}),G3={class:"prompt-list"},F3={class:"search-group"},Z3=["onClick"],H3={class:"prompt-content"},Y3=Yr(w.defineComponent({__name:"render-send",props:{prompts:{},placeholder:{},value:{}},emits:["update:value","enter","choose-prompt"],setup(t,{emit:e}){const n=t,r=e,o=iL,i=Ba,a=w.ref(""),s=w.ref(40),c=w.ref(),l=w.ref(!1),u=w.computed(()=>{var C;return((C=n.prompts)==null?void 0:C.filter(T=>T.content.includes(a.value)))||[]}),f=w.computed(()=>{var C;return n.placeholder?n.placeholder:(C=n.prompts)!=null&&C.length?Ye("您可以键入 “/” 查看更多Prompt"):Ye("请输入")}),p=C=>{r("update:value",C)},d=()=>{var C;n.value==="/"&&((C=n.prompts)!=null&&C.length)?M():O()},m=()=>{w.nextTick(()=>{var T;const C=(T=c.value)==null?void 0:T.$el.querySelector("textarea");(C==null?void 0:C.scrollHeight)>40&&n.value?s.value=C.scrollHeight<=300?C.scrollHeight:300:s.value=40})},g=C=>{r("update:value",C.content),r("choose-prompt",C),O(),I()},y=(C,T)=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),r("enter"))},h=()=>{p("")},I=()=>{var T;const C=(T=c.value)==null?void 0:T.$el.querySelector("textarea");C==null||C.focus()},M=()=>{l.value=!0},O=()=>{l.value=!1};return w.watch(()=>n.value,()=>{m(),d()}),w.onMounted(I),(C,T)=>(w.openBlock(),w.createBlock(w.unref(Ag),{width:"calc(100% - 118px)","ext-cls":"empty-padding",arrow:!1,"is-show":l.value,"popover-delay":0,boundary:"parent",placement:"bottom",theme:"light",trigger:"manual"},{content:w.withCtx(()=>{var H;return[w.createElementVNode("div",null,[w.withDirectives((w.openBlock(),w.createElementBlock("section",G3,[w.createVNode(w.unref(Tg),{class:"input-search",modelValue:a.value,"onUpdate:modelValue":T[0]||(T[0]=W=>a.value=W),behavior:"simplicity",clearable:""},null,8,["modelValue"]),w.createElementVNode("section",F3,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(u.value,(W,ne)=>w.withDirectives((w.openBlock(),w.createElementBlock("span",{class:"group-prompt",key:ne,onClick:R=>g(W)},[w.createElementVNode("span",H3,w.toDisplayString(W.content),1)],8,Z3)),[[w.unref(i),{content:W.content,placement:"right",theme:"light",width:300,zIndex:9999999,extCls:"prompt-popover"}]])),128)),(H=u.value)!=null&&H.length?w.createCommentVNode("v-if",!0):(w.openBlock(),w.createBlock(w.unref(cL),{key:0,class:"exception-wrap-item exception-part",scene:"part",type:"search-empty"}))])])),[[w.unref(o),O]])])]}),default:w.withCtx(()=>[w.createElementVNode("section",{style:w.normalizeStyle({"--text-height":s.value+"px"}),class:"send-prompt-container"},[w.createVNode(w.unref(Tg),{ref_key:"inputRef",ref:c,class:"send-prompt",autosize:!1,clearable:!0,"model-value":C.value,"native-attributes":{autofocus:"autofocus"},placeholder:f.value,row:"1",type:"textarea",onInput:p,onKeydown:y},null,8,["model-value","placeholder"]),C.value?(w.openBlock(),w.createBlock(w.unref(Fs),{key:0,class:"show-clear-only-hover bk-input--clear-icon clear-icon",onClick:h})):w.createCommentVNode("v-if",!0)],4)]),_:1},8,["is-show"]))}}),[["__scopeId","data-v-2374c5aa"]]),V3=(t=>(w.pushScopeId("data-v-fd57f18d"),t=t(),w.popScopeId(),t))(()=>w.createElementVNode("svg",{width:"10",height:"10",class:"ai-blueking-render-stop-icon","aria-hidden":"true"},[w.createElementVNode("use",{"xlink:href":"#ai-blueking-tingzhi"})],-1)),_3=Yr(w.defineComponent({__name:"render-stop",props:{isShow:{type:Boolean}},emits:["stop"],setup(t,{emit:e}){const n=e,r=()=>{n("stop")};return(o,i)=>o.isShow?(w.openBlock(),w.createElementBlock("span",{key:0,class:"ai-blueking-render-stop",onClick:r},[V3,w.createTextVNode(" "+w.toDisplayString(w.unref(Ye)("终止生成")),1)])):w.createCommentVNode("v-if",!0)}}),[["__scopeId","data-v-fd57f18d"]]),W3={key:0,class:"time-wrapper"},U3={class:"time-message"},$3=Yr(w.defineComponent({__name:"render-time",props:{message:{}},setup(t){const e=t,n=w.computed(()=>{var a;const r=Gt(e.message.time),o=Gt(),i={0:Ye("日"),1:Ye("一"),2:Ye("二"),3:Ye("三"),4:Ye("四"),5:Ye("五"),6:Ye("六")};return!e.message.time||(a=window.showTimes)!=null&&a.some(s=>Math.abs(r.diff(s,"minute"))<10&&s!==e.message.time)?"":(window.showTimes=[...window.showTimes||[],e.message.time],o.isSame(r,"day")?r.format("HH:mm:ss"):o.subtract(1,"day").isSame(r,"week")?Ye("昨天")+" "+r.format("HH:mm:ss"):o.isSame(r,"week")?Ye("本周")+i[r.day()]+" "+r.format("HH:mm:ss"):o.subtract(1,"week").isSame(r,"week")?Ye("上周")+i[r.day()]+" "+r.format("HH:mm:ss"):o.isSame(r,"year")?r.format("MM-DD HH:mm:ss"):r.format("YYYY-MM-DD HH:mm:ss"))});return(r,o)=>n.value?(w.openBlock(),w.createElementBlock("section",W3,[w.createElementVNode("span",U3,w.toDisplayString(n.value),1)])):w.createCommentVNode("v-if",!0)}}),[["__scopeId","data-v-55c9a119"]]),Wm=t=>(w.pushScopeId("data-v-6cc6ac8a"),t=t(),w.popScopeId(),t),q3={key:0,width:"18",height:"18",class:"scroll-loading-icon","aria-hidden":"true"},X3=[Wm(()=>w.createElementVNode("use",{"xlink:href":"#ai-blueking-loading-2"},null,-1))],K3={class:"ai-operation"},eD={class:"ai-operation-tools"},tD={class:"ai-operation-input"},nD=Wm(()=>w.createElementVNode("i",{class:"ai-blueking-icon ai-blueking-fasong"},null,-1)),rD=Yr(w.defineComponent({__name:"render-content",props:{messages:{},prompts:{},loading:{type:Boolean},background:{default:"#f5f7fa"},userPhoto:{},placeholder:{},scrollLoading:{type:Boolean},scrollLoadingEnd:{type:Boolean,default:!0}},emits:["send","choose-prompt","scroll-load","stop"],setup(t,{emit:e}){const n=t,r=e,o=Ba,i=w.ref(""),a=()=>{w.nextTick(()=>{const p=document.querySelector(".ai-blueking-messages");p.scrollTop=p.scrollHeight})},s=pL(p=>{if(n.scrollLoading||n.scrollLoadingEnd)return;p.target.scrollTop<200&&r("scroll-load")}),c=()=>{if(i.value){if(n.loading){uL({theme:"warning",message:Ye("内容正在执行中,请执行完成后再发送")});return}r("send",i.value),i.value=""}},l=p=>{r("choose-prompt",p)},u=()=>{r("stop")};w.watch(()=>n.messages,()=>{const p=document.querySelector(".ai-blueking-messages");(p==null?void 0:p.scrollTop)+(p==null?void 0:p.clientHeight)+100>=(p==null?void 0:p.scrollHeight)&&a()},{deep:!0});const f=()=>{window.showTimes=[]};return w.onMounted(a),w.onBeforeUnmount(f),(p,d)=>(w.openBlock(),w.createElementBlock("section",{style:w.normalizeStyle({background:p.background}),class:"ai-content"},[w.createElementVNode("ul",{class:"ai-messages ai-blueking-messages",onScrollPassive:d[0]||(d[0]=(...m)=>w.unref(s)&&w.unref(s)(...m))},[p.scrollLoading?(w.openBlock(),w.createElementBlock("svg",q3,X3)):w.createCommentVNode("v-if",!0),(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(p.messages,m=>(w.openBlock(),w.createElementBlock(w.Fragment,{key:m.content},[w.createVNode($3,{class:"render-message",message:m},null,8,["message"]),w.createVNode(B3,{class:"render-message",message:m,"user-photo":p.userPhoto},null,8,["message","user-photo"])],64))),128))],32),w.createElementVNode("section",K3,[w.createElementVNode("span",eD,[w.createVNode(vL),w.createVNode(_3,{"is-show":p.loading,onStop:u},null,8,["is-show"])]),w.createElementVNode("section",tD,[w.createVNode(Y3,{value:i.value,"onUpdate:value":d[1]||(d[1]=m=>i.value=m),placeholder:p.placeholder,prompts:p.prompts,onChoosePrompt:l,onEnter:c},null,8,["value","placeholder","prompts"]),w.withDirectives((w.openBlock(),w.createBlock(w.unref(qC),{class:"ai-operation-button",disabled:p.loading||!i.value,size:"large",theme:"primary",onClick:c},{default:w.withCtx(()=>[nD,w.createTextVNode(" "+w.toDisplayString(w.unref(Ye)("发送")),1)]),_:1},8,["disabled"])),[[w.unref(o),{content:w.unref(Ye)("内容正在执行中,请执行完成后再发送"),disabled:!p.loading}]])])])],4))}}),[["__scopeId","data-v-6cc6ac8a"]]),oD={class:"ai-modal-header-icon"},iD=Yr(w.defineComponent({__name:"render-modal",props:{headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)"},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0})},sizeLimit:{default:()=>({height:320,width:400})},logo:{default:"ai-blueking-icon ai-blueking-ai"},name:{},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0})}},emits:["clear","close"],setup(t,{emit:e}){const n=t,r=e,o=Ba,i={height:window.innerHeight,width:window.innerWidth},a={isMove:!1,type:"",clientX:0,clientY:0},s=()=>{var U,J,P,z;const G=(V,ee)=>V===void 0?ee:V;return{top:G((U=n.startPosition)==null?void 0:U.top,i.height-n.sizeLimit.height),bottom:G((J=n.startPosition)==null?void 0:J.bottom,0),left:G((P=n.startPosition)==null?void 0:P.left,0),right:G((z=n.startPosition)==null?void 0:z.right,i.width-n.sizeLimit.width)}},c=w.ref(s()),l=w.computed(()=>c.value.top<=n.positionLimit.top&&c.value.bottom<=n.positionLimit.bottom),u=G=>{a.isMove=!0,a.type="move",a.clientX=G.clientX,a.clientY=G.clientY},f=G=>{a.isMove=!0,a.type="rightDrag",a.clientX=G.clientX},p=G=>{a.isMove=!0,a.type="leftDrag",a.clientX=G.clientX},d=G=>{a.isMove=!0,a.type="topDrag",a.clientY=G.clientY},m=G=>{a.isMove=!0,a.type="bottomDrag",a.clientY=G.clientY},g=G=>{a.isMove=!0,a.type="topLeftDrag",a.clientY=G.clientY,a.clientX=G.clientX},y=G=>{a.isMove=!0,a.type="topRightDrag",a.clientY=G.clientY,a.clientX=G.clientX},h=G=>{a.isMove=!0,a.type="bottomLeftDrag",a.clientY=G.clientY,a.clientX=G.clientX},I=G=>{a.isMove=!0,a.type="bottomRightDrag",a.clientY=G.clientY,a.clientX=G.clientX},M=()=>{a.isMove=!1},O=(G,U)=>{["move","leftDrag"].includes(a.type)&&(c.value.left+=G),["move","rightDrag"].includes(a.type)&&(c.value.right-=G),["move","topDrag"].includes(a.type)&&(c.value.top+=U),["move","bottomDrag"].includes(a.type)&&(c.value.bottom-=U),["topLeftDrag"].includes(a.type)&&(c.value.left+=G,c.value.top+=U),["topRightDrag"].includes(a.type)&&(c.value.right-=G,c.value.top+=U),["bottomLeftDrag"].includes(a.type)&&(c.value.left+=G,c.value.bottom-=U),["bottomRightDrag"].includes(a.type)&&(c.value.right-=G,c.value.bottom-=U)},C=(G,U)=>{const{top:J,bottom:P,left:z,right:V}=c.value;(i.width-z-V<n.sizeLimit.width||z<n.positionLimit.left||V<n.positionLimit.right)&&(["move","leftDrag","topLeftDrag","bottomLeftDrag"].includes(a.type)&&(c.value.left-=G),["move","rightDrag","topRightDrag","bottomRightDrag"].includes(a.type)&&(c.value.right+=G)),(i.height-J-P<n.sizeLimit.height||J<n.positionLimit.top||P<n.positionLimit.bottom)&&(["move","topDrag","topRightDrag","topLeftDrag"].includes(a.type)&&(c.value.top-=U),["move","bottomDrag","bottomLeftDrag","bottomRightDrag"].includes(a.type)&&(c.value.bottom+=U))},T=G=>{if(!a.isMove)return;G.preventDefault();const U=G.clientX-a.clientX,J=G.clientY-a.clientY;O(U,J),C(U,J),a.clientX=G.clientX,a.clientY=G.clientY},H=()=>{i.height=window.innerHeight,i.width=window.innerWidth,c.value=s()},W=()=>{c.value.top=n.positionLimit.top,c.value.bottom=n.positionLimit.bottom},ne=()=>{c.value.top=i.height-n.sizeLimit.height,c.value.bottom=n.positionLimit.bottom},R=()=>{r("clear")},K=()=>{r("close")};return w.onBeforeMount(()=>{window.addEventListener("mousemove",T,!0),window.addEventListener("mouseup",M),window.addEventListener("resize",H)}),w.onBeforeUnmount(()=>{window.removeEventListener("mousemove",T,!0),window.removeEventListener("mouseup",M),window.removeEventListener("resize",H)}),(G,U)=>(w.openBlock(),w.createElementBlock("section",{style:w.normalizeStyle({top:c.value.top+"px",bottom:c.value.bottom+"px",left:c.value.left+"px",right:c.value.right+"px"}),class:"ai-modal"},[w.createElementVNode("header",{style:w.normalizeStyle({background:G.headBackground}),class:"ai-modal-header",onMousedown:w.withModifiers(u,["stop"])},[w.createElementVNode("span",oD,[w.createElementVNode("i",{class:w.normalizeClass(G.logo)},null,2),w.createTextVNode(" "+w.toDisplayString(G.name||w.unref(Ye)("小鲸")),1)]),w.createElementVNode("span",null,[l.value?w.withDirectives((w.openBlock(),w.createElementBlock("i",{key:0,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxiajuhe",onClick:ne},null,512)),[[w.unref(o),{content:w.unref(Ye)("向下收缩"),distance:20}]]):w.withDirectives((w.openBlock(),w.createElementBlock("i",{key:1,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxialashen-2",onClick:W},null,512)),[[w.unref(o),{content:w.unref(Ye)("向上扩展"),distance:20}]]),w.withDirectives(w.createElementVNode("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-saoba",onClick:R},null,512),[[w.unref(o),{content:w.unref(Ye)("清空聊天记录"),distance:20}]]),w.withDirectives(w.createElementVNode("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-shanchu-2",onClick:K},null,512),[[w.unref(o),{content:w.unref(Ye)("关闭"),distance:20}]])])],36),w.renderSlot(G.$slots,"default",{},void 0,!0),w.createElementVNode("span",{class:"drag-line left",onMousedown:w.withModifiers(p,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line right",onMousedown:w.withModifiers(f,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line top",onMousedown:w.withModifiers(d,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line bottom",onMousedown:w.withModifiers(m,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line top-left-corner",onMousedown:w.withModifiers(g,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line top-right-corner",onMousedown:w.withModifiers(y,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line bottom-left-corner",onMousedown:w.withModifiers(h,["stop"])},null,32),w.createElementVNode("span",{class:"drag-line bottom-right-corner",onMousedown:w.withModifiers(I,["stop"])},null,32)],4))}}),[["__scopeId","data-v-e603010f"]]),aD=w.defineComponent({__name:"ai-blueking",props:{messages:{},prompts:{},loading:{type:Boolean},headBackground:{},background:{},positionLimit:{},sizeLimit:{},startPosition:{},userPhoto:{},name:{},placeholder:{},logo:{},scrollLoading:{type:Boolean},scrollLoadingEnd:{type:Boolean}},emits:["clear","close","scroll-load","stop","send","choose-prompt"],setup(t,{emit:e}){const n=e,r=()=>{n("clear")},o=()=>{n("close")},i=l=>{n("send",l)},a=()=>{n("stop")},s=()=>{n("scroll-load")},c=l=>{n("choose-prompt",l)};return(l,u)=>(w.openBlock(),w.createBlock(iD,{"head-background":l.headBackground,logo:l.logo,name:l.name,"position-limit":l.positionLimit,"size-limit":l.sizeLimit,"start-position":l.startPosition,onClear:r,onClose:o},{default:w.withCtx(()=>[w.createVNode(rD,{background:l.background,loading:l.loading,messages:l.messages,placeholder:l.placeholder,prompts:l.prompts,"scroll-loading":l.scrollLoading,"scroll-loading-end":l.scrollLoadingEnd,"user-photo":l.userPhoto,onChoosePrompt:c,onScrollLoad:s,onSend:i,onStop:a},null,8,["background","loading","messages","placeholder","prompts","scroll-loading","scroll-loading-end","user-photo"])]),_:1},8,["head-background","logo","name","position-limit","size-limit","start-position"]))}});(function(){var t='<svg xmlns="http://www.w3.org/2000/svg" data-name="ai-blueking" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0;visibility:hidden"><symbol id="ai-blueking-check-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-26.3 606.3l-181-181L350 444l135.8 135.8L712 353.5l45.3 45.3-271.6 271.5z"/></symbol><symbol id="ai-blueking-close-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm158.4 561.1l-45.3 45.3L512 557.3 398.9 670.4l-45.3-45.3L466.7 512 353.6 398.9l45.3-45.3L512 466.7l113.1-113.1 45.3 45.3L557.3 512l113.1 113.1z"/></symbol><symbol id="ai-blueking-warning-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 640h-64v-64h64v64zm0-128h-64V320h64v256z"/></symbol><symbol id="ai-blueking-loading-2" viewBox="0 0 1024 1024"><path d="M195.2 195.2a64 64 0 000 90.56l44.8 45.28A64 64 0 00331.04 240l-45.28-44.8a64 64 0 00-90.56 0z" opacity=".1"/><path d="M128 576h64a64 64 0 000-128h-64a64 64 0 000 128z" opacity=".15"/><path d="M285.76 828.8l45.28-44.8A64 64 0 00240 692.96l-44.8 45.28a64 64 0 0090.56 90.56z" opacity=".3"/><path d="M576 896v-64a64 64 0 00-128 0v64a64 64 0 00128 0z" opacity=".45"/><path d="M828.8 828.8a64 64 0 000-90.56L784 692.96A64 64 0 00692.96 784l45.28 45.28a64 64 0 0090.56-.48z" opacity=".6"/><path d="M896 448h-64a64 64 0 000 128h64a64 64 0 000-128z" opacity=".75"/><path d="M738.24 195.2L692.96 240A64 64 0 00784 331.04l45.28-45.28a64 64 0 10-90.56-90.56z" opacity=".9"/><path d="M448 128v64a64 64 0 00128 0v-64a64 64 0 00-128 0z"/></g></symbol><symbol id="ai-blueking-ai" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M928 96v448l-1.211-.014C910.455 758.791 730.989 928 512 928 282.25 928 96 741.75 96 512S282.25 96 512 96h416zM488.911 320H379.544L256 672h84.05l23.292-71.909h137.215L523.342 672h87.088L488.911 320zM736 320h-79.494v352H736V320zm-303.797 66.88l47.594 148.343h-95.696l48.102-148.343z"/></symbol><symbol id="ai-blueking-fasong" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M924.55 113.365c0-.09-.088-.09-.088-.18a30.217 30.217 0 00-7.78-9.684 31.929 31.929 0 00-10.606-5.918c-.089 0-.177-.09-.266-.09-1.502-.537-3.093-.806-4.685-1.075-.442-.09-.884-.27-1.414-.27-1.503-.179-2.917-.179-4.42-.09-.618 0-1.149-.089-1.768 0-4.242.27-8.485 1.525-12.375 3.498L113.792 485.577c-7.514 3.677-13.26 10.312-15.911 18.382-.796 2.242-1.15 4.663-1.415 6.994-.795 4.753-.618 9.685.884 14.347 2.475 8.16 8.044 14.885 15.558 18.741l194.734 103.836c4.685 2.51 9.812 3.766 15.115 3.766 11.757.09 22.541-6.367 28.287-16.768 8.397-15.513 2.475-34.791-13.083-43.13l-142.316-75.86 572.358-288.014L418.93 634.516c-.265.27-.354.628-.619.897-8.662 5.739-14.32 15.423-14.32 26.542v234.123a32.598 32.598 0 009.547 22.686c6.01 6.008 14.143 9.236 22.54 9.146v.09c17.68 0 32-14.257 32-31.832V675.405l381.07-444.127-79.202 585.802-200.921-97.917c-15.823-7.712-34.828-1.255-42.872 14.526-3.712 7.622-4.243 16.41-1.503 24.48s8.575 14.615 16.177 18.202l238.754 116.48c4.42 2.151 9.193 3.227 14.144 3.227.176 0 .353-.09.53-.09.53 0 1.15.18 1.68.18 15.91.09 29.435-11.657 31.733-27.618l99.003-731.782c2.21-7.532 1.767-15.871-2.122-23.403z"/></symbol><symbol id="ai-blueking-shangxialashen-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M510.24 64L352 251.52l127.168-.672.928 223.968h.352l.832 298.656-127.168.736L513.792 960 672 772.448l-127.136.704-.928-320h-.384l-.8-202.656 127.168-.704z"/></symbol><symbol id="ai-blueking-shangxiajuhe" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M510.24 384L352 192l317.92 1.77L510.24 384zm1.44 256l158.24 192L352 830.23 511.68 640zM128 480h768v64H128z"/></symbol><symbol id="ai-blueking-shanchu-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M832 259.2L764.8 192 512 444.8 259.2 192 192 259.2 444.8 512 192 764.8l67.2 67.2L512 579.2 764.8 832l67.2-67.2L579.2 512z"/></symbol><symbol id="ai-blueking-saoba" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M566.857 64C607.253 64 640 92.654 640 128v96h256c35.346 0 64 28.654 64 64v96c0 35.346-28.654 64-64 64h-5.818v332.453l21.56 102.356c7.284 34.587-14.848 68.532-49.436 75.817a64 64 0 01-13.19 1.374H175.262c-35.346 0-64-28.654-64-64a64 64 0 011.436-13.484l21.12-97.989V448H128c-35.346 0-64-28.654-64-64v-96c0-35.346 28.654-64 64-64h256v-96c0-35.346 32.747-64 73.143-64h109.714zm259.325 384H197.818v343.346l-1.436 6.665L175.262 896H320V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h96V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h96V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h145.115l-21.559-102.356-1.374-6.524V448zM896 288H128v96h768v-96zM566.857 128H457.143v96h109.714v-96z"/></symbol><symbol id="ai-blueking-quanquan" viewBox="0 0 1024 1024"><path fill="#3A84FF" d="M512 64.129c-9.343-.661-18.345 3.338-27.005 11.998-2.666 2.667-4.831 6.165-6.495 10.495-1.664 4.33-2.496 7.498-2.496 9.503v4c0 10.004 2.997 18.003 8.991 23.997 3.328 4.01 7.327 6.847 11.999 8.511 4.671 1.664 8.34 2.496 11.006 2.496h4c68.003 0 130.993 16.83 188.97 50.49 57.978 33.66 103.807 79.49 137.489 137.488 33.681 57.999 50.511 121.16 50.49 189.483-.021 68.322-16.851 131.313-50.49 188.97-33.64 57.657-79.469 103.316-137.489 136.976-58.02 33.66-121.18 50.49-189.482 50.49-68.301 0-131.292-16.83-188.97-50.49-57.68-33.66-103.338-79.319-136.977-136.976-33.639-57.657-50.469-120.818-50.49-189.482 0-10.005-3.669-18.676-11.007-26.013-2.666-3.328-6.164-5.824-10.494-7.487-4.33-1.664-7.498-2.496-9.503-2.496h-4c-10.004 0-18.334 3.338-24.99 10.015-4.01 4.01-6.846 8.18-8.51 12.51-1.664 4.33-2.496 7.498-2.496 9.503v4c0 60.665 11.828 118.663 35.484 173.996 23.656 55.332 55.482 102.996 95.477 142.991 39.996 39.996 87.66 71.822 142.992 95.478 55.332 23.656 113.33 35.483 173.996 35.483 60.665 0 118.664-11.827 173.996-35.483 55.332-23.656 102.996-55.482 142.992-95.478 39.995-39.995 71.82-87.659 95.477-142.991 23.656-55.333 35.484-113.331 35.484-173.996 0-60.665-11.828-118.664-35.484-173.996-23.656-55.333-55.482-102.997-95.477-142.992-39.996-39.996-87.66-71.821-142.992-95.477C630.664 75.989 572.666 64.16 512 64.16v-.032z"/></symbol><symbol id="ai-blueking-xiangxia-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M176 617.6l92.8-89.6 182.4 179.2V112h121.6v595.2L755.2 528l92.8 89.6L512 944 176 617.6z" clip-rule="evenodd"/></symbol><symbol id="ai-blueking-tingzhi" viewBox="0 0 1024 1024"><path fill="#fdd" d="M256 256h512v512H256V256z"/><path fill="#ea3636" d="M128 128v768h768V128H128zm640 640H256V256h512v512z"/></symbol></svg>';document.body?document.body.insertAdjacentHTML("afterbegin",t):document.addEventListener("DOMContentLoaded",function(){document.body.insertAdjacentHTML("afterbegin",t)})})();class sD{constructor(e,n,r,o,i){sr(this,"controllerMap");sr(this,"handleEnd");sr(this,"handleError");sr(this,"handleReceiveMessage");sr(this,"handleStart");sr(this,"url");this.url=e,this.handleStart=n,this.handleReceiveMessage=r,this.handleEnd=o,this.handleError=i,this.controllerMap={}}stop(e){var n,r;return(r=(n=this.controllerMap[e])==null?void 0:n.abort)==null||r.call(n),this.handleEnd(e)}async stream(e,n,r){const o=new AbortController;this.controllerMap[n]=o,fetch(this.url,{method:"post",signal:o.signal,headers:{"Content-Type":"application/json",...r},mode:"cors",credentials:"include",body:JSON.stringify(e)}).then(async i=>{const a=i.body.pipeThrough(new window.TextDecoderStream).getReader();for(;;)try{const{value:s,done:c}=await a.read();if(!i.ok){this.handleError(s||i.statusText,i.status,n);break}if(c)break;s.toString().split(`
|
|
270
270
|
`).forEach(u=>{const f=u.replace("data:","").trim();if(dL(f)){const{event:p,content:d,result:m,code:g,message:y}=JSON.parse(f);if(m===!1||i.status!==200){this.handleError(y,g,n);return}switch(p){case"text":this.handleReceiveMessage(d,n);break;case"done":this.handleEnd(n);break;case"error":this.handleError(y,g,n);break}}})}catch(s){(s==null?void 0:s.code)!==20&&this.handleError(s.message,s.code,n);break}}).catch(i=>{(i==null?void 0:i.code)!==20&&this.handleError(i.message,i.code,n)}),await this.handleStart(n)}}Rx({prefix:"ai-blueking"});const cD={name:"AiBlueking",render(t){return t("div",{style:{width:"100%"}})},props:{messages:{default:()=>[],type:Array},prompts:{default:()=>[],type:Array},loading:{default:!1,type:Boolean},headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)",type:String},background:{default:"#f5f7fa",type:String},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0}),type:Object},sizeLimit:{default:()=>({height:320,width:400}),type:Object},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0}),type:Object},userPhoto:{default:yl,type:String},logo:{default:"ai-blueking-icon ai-blueking-ai",type:String},name:{default:"",type:String},placeholder:{default:"",type:String},scrollLoading:{default:!1,type:Boolean},scrollLoadingEnd:{default:!0,type:Boolean}},data(){return{app:null,unWatchStack:[]}},watch:{messages:{handler(){setTimeout(()=>{const t=document.querySelector(".ai-blueking-messages");(t==null?void 0:t.scrollTop)+(t==null?void 0:t.clientHeight)+100>=(t==null?void 0:t.scrollHeight)&&(t.scrollTop=t.scrollHeight)},10)},deep:!0}},created(){const t=this.$emit.bind(this);let e=null;const n=this;this.app=w.createApp({render(){return e=this,w.h(aD,{messages:JSON.parse(JSON.stringify(n.messages)),prompts:n.prompts,loading:n.loading,headBackground:n.headBackground,background:n.background,positionLimit:n.positionLimit,sizeLimit:n.sizeLimit,userPhoto:n.userPhoto,logo:n.logo,name:n.name,placeholder:n.placeholder,startPosition:n.startPosition,scrollLoading:n.scrollLoading,scrollLoadingEnd:n.scrollLoadingEnd,onClear(){t("clear",...arguments)},onClose(){t("close",...arguments)},onSend(){t("send",...arguments)},onChoosePrompt(){t("choose-prompt",...arguments)},onStop(){t("stop",...arguments)},onScrollLoad(){t("scroll-load",...arguments)},...n.$attrs})}}),this.unWatchStack=Object.keys(this.$props).map(r=>this.$watch(r,()=>{e.$forceUpdate()},{deep:!0}))},mounted(){var t;(t=this.app)==null||t.mount(this.$el)},beforeDestroy(){var t;this.unWatchStack.forEach(e=>e==null?void 0:e()),(t=this.app)==null||t.unmount()}};Xe.ChatHelper=sD,Xe.MessageStatus=Ai,Xe.RoleType=bl,Xe.default=cD,Object.defineProperties(Xe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -5003,7 +5003,9 @@ const qN = { class: "message-content user" }, RN = {
|
|
|
5003
5003
|
return (c = t.message) != null && c.status ? r[t.message.status] : "";
|
|
5004
5004
|
}), o = Tt(() => {
|
|
5005
5005
|
if (t.message.content) {
|
|
5006
|
-
const c = new TN(
|
|
5006
|
+
const c = new TN({
|
|
5007
|
+
html: !0
|
|
5008
|
+
}).render(t.message.content);
|
|
5007
5009
|
return bs.sanitize(c);
|
|
5008
5010
|
}
|
|
5009
5011
|
return "";
|