@blueking/ai-blueking 0.1.2 → 0.1.3-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { RoleType } from './enum';
2
2
  export interface IMessage extends IChatHistory {
3
- status?: 'error' | 'loading';
3
+ status?: 'error' | 'loading' | 'success';
4
4
  }
5
5
  export interface IPrompt {
6
6
  id: number | string;
@@ -16400,7 +16400,8 @@ const cce = { class: "message-content user" }, lce = ["innerHTML"], uce = { clas
16400
16400
  var i;
16401
16401
  const o = {
16402
16402
  error: "ai-blueking-icon ai-blueking-warning-circle-fill",
16403
- loading: ""
16403
+ loading: "",
16404
+ success: ""
16404
16405
  };
16405
16406
  return (i = e.message) != null && i.status ? o[e.message.status] : "";
16406
16407
  }), r = fi(() => {
@@ -85,4 +85,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
85
85
  `:">",i)},_o.prototype.renderInline=function(t,e,n){for(var r,o="",i=this.rules,s=0,c=t.length;s<c;s++)r=t[s].type,typeof i[r]<"u"?o+=i[r](t,s,e,n,this):o+=this.renderToken(t,s,e);return o},_o.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+=`
86
86
  `);return r},_o.prototype.render=function(t,e,n){var r,o,i,s="",c=this.rules;for(r=0,o=t.length;r<o;r++)i=t[r].type,i==="inline"?s+=this.renderInline(t[r].children,e,n):typeof c[i]<"u"?s+=c[i](t,r,e,n,this):s+=this.renderToken(t,r,e,n);return s};var nP=_o;function en(){this.__rules__=[],this.__cache__=null}en.prototype.__find__=function(t){for(var e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1},en.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))})})},en.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},en.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},en.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},en.prototype.push=function(t,e,n){var r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null},en.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},en.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(n){n.enabled=!1}),this.enable(t,e)},en.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},en.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};var ju=en,rP=/\r\n?|\n/g,oP=/\0/g,iP=function(e){var n;n=e.src.replace(rP,`
87
87
  `),n=n.replace(oP,"�"),e.src=n},sP=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)},cP=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)},aP=_e.arrayReplaceAt;function lP(t){return/^<a[>\s]/i.test(t)}function uP(t){return/^<\/a\s*>/i.test(t)}var fP=function(e){var n,r,o,i,s,c,a,l,u,f,d,p,b,g,L,m,x=e.tokens,C;if(e.md.options.linkify){for(r=0,o=x.length;r<o;r++)if(!(x[r].type!=="inline"||!e.md.linkify.pretest(x[r].content)))for(i=x[r].children,b=0,n=i.length-1;n>=0;n--){if(c=i[n],c.type==="link_close"){for(n--;i[n].level!==c.level&&i[n].type!=="link_open";)n--;continue}if(c.type==="html_inline"&&(lP(c.content)&&b>0&&b--,uP(c.content)&&b++),!(b>0)&&c.type==="text"&&e.md.linkify.test(c.content)){for(u=c.content,C=e.md.linkify.match(u),a=[],p=c.level,d=0,C.length>0&&C[0].index===0&&n>0&&i[n-1].type==="text_special"&&(C=C.slice(1)),l=0;l<C.length;l++)g=C[l].url,L=e.md.normalizeLink(g),e.md.validateLink(L)&&(m=C[l].text,C[l].schema?C[l].schema==="mailto:"&&!/^mailto:/i.test(m)?m=e.md.normalizeLinkText("mailto:"+m).replace(/^mailto:/,""):m=e.md.normalizeLinkText(m):m=e.md.normalizeLinkText("http://"+m).replace(/^http:\/\//,""),f=C[l].index,f>d&&(s=new e.Token("text","",0),s.content=u.slice(d,f),s.level=p,a.push(s)),s=new e.Token("link_open","a",1),s.attrs=[["href",L]],s.level=p++,s.markup="linkify",s.info="auto",a.push(s),s=new e.Token("text","",0),s.content=m,s.level=p,a.push(s),s=new e.Token("link_close","a",-1),s.level=--p,s.markup="linkify",s.info="auto",a.push(s),d=C[l].lastIndex);d<u.length&&(s=new e.Token("text","",0),s.content=u.slice(d),s.level=p,a.push(s)),x[r].children=i=aP(i,n,a)}}}},Lv=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,dP=/\((c|tm|r)\)/i,pP=/\((c|tm|r)\)/ig,gP={c:"©",r:"®",tm:"™"};function hP(t,e){return gP[e.toLowerCase()]}function mP(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(pP,hP)),n.type==="link_open"&&n.info==="auto"&&r--,n.type==="link_close"&&n.info==="auto"&&r++}function vP(t){var e,n,r=0;for(e=t.length-1;e>=0;e--)n=t[e],n.type==="text"&&!r&&Lv.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 yP=function(e){var n;if(e.md.options.typographer)for(n=e.tokens.length-1;n>=0;n--)e.tokens[n].type==="inline"&&(dP.test(e.tokens[n].content)&&mP(e.tokens[n].children),Lv.test(e.tokens[n].content)&&vP(e.tokens[n].children))},Tv=_e.isWhiteSpace,xv=_e.isPunctChar,kv=_e.isMdAsciiPunct,bP=/['"]/,Nv=/['"]/g,jv="’";function Kc(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function IP(t,e){var n,r,o,i,s,c,a,l,u,f,d,p,b,g,L,m,x,C,S,D,T;for(S=[],n=0;n<t.length;n++){for(r=t[n],a=t[n].level,x=S.length-1;x>=0&&!(S[x].level<=a);x--);if(S.length=x+1,r.type==="text"){o=r.content,s=0,c=o.length;e:for(;s<c&&(Nv.lastIndex=s,i=Nv.exec(o),!!i);){if(L=m=!0,s=i.index+1,C=i[0]==="'",u=32,i.index-1>=0)u=o.charCodeAt(i.index-1);else for(x=n-1;x>=0&&!(t[x].type==="softbreak"||t[x].type==="hardbreak");x--)if(t[x].content){u=t[x].content.charCodeAt(t[x].content.length-1);break}if(f=32,s<c)f=o.charCodeAt(s);else for(x=n+1;x<t.length&&!(t[x].type==="softbreak"||t[x].type==="hardbreak");x++)if(t[x].content){f=t[x].content.charCodeAt(0);break}if(d=kv(u)||xv(String.fromCharCode(u)),p=kv(f)||xv(String.fromCharCode(f)),b=Tv(u),g=Tv(f),g?L=!1:p&&(b||d||(L=!1)),b?m=!1:d&&(g||p||(m=!1)),f===34&&i[0]==='"'&&u>=48&&u<=57&&(m=L=!1),L&&m&&(L=d,m=p),!L&&!m){C&&(r.content=Kc(r.content,i.index,jv));continue}if(m){for(x=S.length-1;x>=0&&(l=S[x],!(S[x].level<a));x--)if(l.single===C&&S[x].level===a){l=S[x],C?(D=e.md.options.quotes[2],T=e.md.options.quotes[3]):(D=e.md.options.quotes[0],T=e.md.options.quotes[1]),r.content=Kc(r.content,i.index,T),t[l.token].content=Kc(t[l.token].content,l.pos,D),s+=T.length-1,l.token===n&&(s+=D.length-1),o=r.content,c=o.length,S.length=x;continue e}}L?S.push({token:n,pos:i.index,single:C,level:a}):m&&C&&(r.content=Kc(r.content,i.index,jv))}}}}var MP=function(e){var n;if(e.md.options.typographer)for(n=e.tokens.length-1;n>=0;n--)e.tokens[n].type!=="inline"||!bP.test(e.tokens[n].content)||IP(e.tokens[n].children,e)},CP=function(e){var n,r,o,i,s,c,a=e.tokens;for(n=0,r=a.length;n<r;n++)if(a[n].type==="inline"){for(o=a[n].children,s=o.length,i=0;i<s;i++)o[i].type==="text_special"&&(o[i].type="text");for(i=c=0;i<s;i++)o[i].type==="text"&&i+1<s&&o[i+1].type==="text"?o[i+1].content=o[i].content+o[i+1].content:(i!==c&&(o[c]=o[i]),c++);i!==c&&(o.length=c)}};function Oo(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}Oo.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},Oo.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},Oo.prototype.attrSet=function(e,n){var r=this.attrIndex(e),o=[e,n];r<0?this.attrPush(o):this.attrs[r]=o},Oo.prototype.attrGet=function(e){var n=this.attrIndex(e),r=null;return n>=0&&(r=this.attrs[n][1]),r},Oo.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 Su=Oo,wP=Su;function Sv(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}Sv.prototype.Token=wP;var LP=Sv,TP=ju,Du=[["normalize",iP],["block",sP],["inline",cP],["linkify",fP],["replacements",yP],["smartquotes",MP],["text_join",CP]];function Eu(){this.ruler=new TP;for(var t=0;t<Du.length;t++)this.ruler.push(Du[t][0],Du[t][1])}Eu.prototype.process=function(t){var e,n,r;for(r=this.ruler.getRules(""),e=0,n=r.length;e<n;e++)r[e](t)},Eu.prototype.State=LP;var xP=Eu,_u=_e.isSpace;function Ou(t,e){var n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function Dv(t){var e=[],n=0,r=t.length,o,i=!1,s=0,c="";for(o=t.charCodeAt(n);n<r;)o===124&&(i?(c+=t.substring(s,n-1),s=n):(e.push(c+t.substring(s,n)),c="",s=n+1)),i=o===92,n++,o=t.charCodeAt(n);return e.push(c+t.substring(s)),e}var kP=function(e,n,r,o){var i,s,c,a,l,u,f,d,p,b,g,L,m,x,C,S,D,T;if(n+2>r||(u=n+1,e.sCount[u]<e.blkIndent)||e.sCount[u]-e.blkIndent>=4||(c=e.bMarks[u]+e.tShift[u],c>=e.eMarks[u])||(D=e.src.charCodeAt(c++),D!==124&&D!==45&&D!==58)||c>=e.eMarks[u]||(T=e.src.charCodeAt(c++),T!==124&&T!==45&&T!==58&&!_u(T))||D===45&&_u(T))return!1;for(;c<e.eMarks[u];){if(i=e.src.charCodeAt(c),i!==124&&i!==45&&i!==58&&!_u(i))return!1;c++}for(s=Ou(e,n+1),f=s.split("|"),b=[],a=0;a<f.length;a++){if(g=f[a].trim(),!g){if(a===0||a===f.length-1)continue;return!1}if(!/^:?-+:?$/.test(g))return!1;g.charCodeAt(g.length-1)===58?b.push(g.charCodeAt(0)===58?"center":"right"):g.charCodeAt(0)===58?b.push("left"):b.push("")}if(s=Ou(e,n).trim(),s.indexOf("|")===-1||e.sCount[n]-e.blkIndent>=4||(f=Dv(s),f.length&&f[0]===""&&f.shift(),f.length&&f[f.length-1]===""&&f.pop(),d=f.length,d===0||d!==b.length))return!1;if(o)return!0;for(x=e.parentType,e.parentType="table",S=e.md.block.ruler.getRules("blockquote"),p=e.push("table_open","table",1),p.map=L=[n,0],p=e.push("thead_open","thead",1),p.map=[n,n+1],p=e.push("tr_open","tr",1),p.map=[n,n+1],a=0;a<f.length;a++)p=e.push("th_open","th",1),b[a]&&(p.attrs=[["style","text-align:"+b[a]]]),p=e.push("inline","",0),p.content=f[a].trim(),p.children=[],p=e.push("th_close","th",-1);for(p=e.push("tr_close","tr",-1),p=e.push("thead_close","thead",-1),u=n+2;u<r&&!(e.sCount[u]<e.blkIndent);u++){for(C=!1,a=0,l=S.length;a<l;a++)if(S[a](e,u,r,!0)){C=!0;break}if(C||(s=Ou(e,u).trim(),!s)||e.sCount[u]-e.blkIndent>=4)break;for(f=Dv(s),f.length&&f[0]===""&&f.shift(),f.length&&f[f.length-1]===""&&f.pop(),u===n+2&&(p=e.push("tbody_open","tbody",1),p.map=m=[n+2,0]),p=e.push("tr_open","tr",1),p.map=[u,u+1],a=0;a<d;a++)p=e.push("td_open","td",1),b[a]&&(p.attrs=[["style","text-align:"+b[a]]]),p=e.push("inline","",0),p.content=f[a]?f[a].trim():"",p.children=[],p=e.push("td_close","td",-1);p=e.push("tr_close","tr",-1)}return m&&(p=e.push("tbody_close","tbody",-1),m[1]=u),p=e.push("table_close","table",-1),L[1]=u,e.parentType=x,e.line=u,!0},NP=function(e,n,r){var o,i,s;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,s=e.push("code_block","code",0),s.content=e.getLines(n,i,4+e.blkIndent,!1)+`
88
- `,s.map=[n,e.line],!0},jP=function(e,n,r,o){var i,s,c,a,l,u,f,d=!1,p=e.bMarks[n]+e.tShift[n],b=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||p+3>b||(i=e.src.charCodeAt(p),i!==126&&i!==96)||(l=p,p=e.skipChars(p,i),s=p-l,s<3)||(f=e.src.slice(l,p),c=e.src.slice(p,b),i===96&&c.indexOf(String.fromCharCode(i))>=0))return!1;if(o)return!0;for(a=n;a++,!(a>=r||(p=l=e.bMarks[a]+e.tShift[a],b=e.eMarks[a],p<b&&e.sCount[a]<e.blkIndent));)if(e.src.charCodeAt(p)===i&&!(e.sCount[a]-e.blkIndent>=4)&&(p=e.skipChars(p,i),!(p-l<s)&&(p=e.skipSpaces(p),!(p<b)))){d=!0;break}return s=e.sCount[n],e.line=a+(d?1:0),u=e.push("fence","code",0),u.info=c,u.content=e.getLines(n+1,a,s,!0),u.markup=f,u.map=[n,e.line],!0},SP=_e.isSpace,DP=function(e,n,r,o){var i,s,c,a,l,u,f,d,p,b,g,L,m,x,C,S,D,T,G,U,te=e.lineMax,Q=e.bMarks[n]+e.tShift[n],K=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(Q)!==62)return!1;if(o)return!0;for(b=[],g=[],x=[],C=[],T=e.md.block.ruler.getRules("blockquote"),m=e.parentType,e.parentType="blockquote",d=n;d<r&&(U=e.sCount[d]<e.blkIndent,Q=e.bMarks[d]+e.tShift[d],K=e.eMarks[d],!(Q>=K));d++){if(e.src.charCodeAt(Q++)===62&&!U){for(a=e.sCount[d]+1,e.src.charCodeAt(Q)===32?(Q++,a++,i=!1,S=!0):e.src.charCodeAt(Q)===9?(S=!0,(e.bsCount[d]+a)%4===3?(Q++,a++,i=!1):i=!0):S=!1,p=a,b.push(e.bMarks[d]),e.bMarks[d]=Q;Q<K&&(s=e.src.charCodeAt(Q),SP(s));){s===9?p+=4-(p+e.bsCount[d]+(i?1:0))%4:p++;Q++}u=Q>=K,g.push(e.bsCount[d]),e.bsCount[d]=e.sCount[d]+1+(S?1:0),x.push(e.sCount[d]),e.sCount[d]=p-a,C.push(e.tShift[d]),e.tShift[d]=Q-e.bMarks[d];continue}if(u)break;for(D=!1,c=0,l=T.length;c<l;c++)if(T[c](e,d,r,!0)){D=!0;break}if(D){e.lineMax=d,e.blkIndent!==0&&(b.push(e.bMarks[d]),g.push(e.bsCount[d]),C.push(e.tShift[d]),x.push(e.sCount[d]),e.sCount[d]-=e.blkIndent);break}b.push(e.bMarks[d]),g.push(e.bsCount[d]),C.push(e.tShift[d]),x.push(e.sCount[d]),e.sCount[d]=-1}for(L=e.blkIndent,e.blkIndent=0,G=e.push("blockquote_open","blockquote",1),G.markup=">",G.map=f=[n,0],e.md.block.tokenize(e,n,d),G=e.push("blockquote_close","blockquote",-1),G.markup=">",e.lineMax=te,e.parentType=m,f[1]=e.line,c=0;c<C.length;c++)e.bMarks[c+n]=b[c],e.tShift[c+n]=C[c],e.sCount[c+n]=x[c],e.bsCount[c+n]=g[c];return e.blkIndent=L,!0},EP=_e.isSpace,_P=function(e,n,r,o){var i,s,c,a,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(s=1;l<u;){if(c=e.src.charCodeAt(l++),c!==i&&!EP(c))return!1;c===i&&s++}return s<3?!1:(o||(e.line=n+1,a=e.push("hr","hr",0),a.map=[n,e.line],a.markup=Array(s+1).join(String.fromCharCode(i))),!0)},Ev=_e.isSpace;function _v(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),!Ev(i))?-1:r}function Ov(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),!Ev(n))?-1:o}function OP(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 PP=function(e,n,r,o){var i,s,c,a,l,u,f,d,p,b,g,L,m,x,C,S,D,T,G,U,te,Q,K,W,V,A,P,E=n,F=!1,$=!0;if(e.sCount[E]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[E]-e.listIndent>=4&&e.sCount[E]<e.blkIndent)return!1;if(o&&e.parentType==="paragraph"&&e.sCount[E]>=e.blkIndent&&(F=!0),(Q=Ov(e,E))>=0){if(f=!0,W=e.bMarks[E]+e.tShift[E],m=Number(e.src.slice(W,Q-1)),F&&m!==1)return!1}else if((Q=_v(e,E))>=0)f=!1;else return!1;if(F&&e.skipSpaces(Q)>=e.eMarks[E])return!1;if(o)return!0;for(L=e.src.charCodeAt(Q-1),g=e.tokens.length,f?(P=e.push("ordered_list_open","ol",1),m!==1&&(P.attrs=[["start",m]])):P=e.push("bullet_list_open","ul",1),P.map=b=[E,0],P.markup=String.fromCharCode(L),K=!1,A=e.md.block.ruler.getRules("list"),D=e.parentType,e.parentType="list";E<r;){for(te=Q,x=e.eMarks[E],u=C=e.sCount[E]+Q-(e.bMarks[E]+e.tShift[E]);te<x;){if(i=e.src.charCodeAt(te),i===9)C+=4-(C+e.bsCount[E])%4;else if(i===32)C++;else break;te++}if(s=te,s>=x?l=1:l=C-u,l>4&&(l=1),a=u+l,P=e.push("list_item_open","li",1),P.markup=String.fromCharCode(L),P.map=d=[E,0],f&&(P.info=e.src.slice(W,Q-1)),U=e.tight,G=e.tShift[E],T=e.sCount[E],S=e.listIndent,e.listIndent=e.blkIndent,e.blkIndent=a,e.tight=!0,e.tShift[E]=s-e.bMarks[E],e.sCount[E]=C,s>=x&&e.isEmpty(E+1)?e.line=Math.min(e.line+2,r):e.md.block.tokenize(e,E,r,!0),(!e.tight||K)&&($=!1),K=e.line-E>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[E]=G,e.sCount[E]=T,e.tight=U,P=e.push("list_item_close","li",-1),P.markup=String.fromCharCode(L),E=e.line,d[1]=E,E>=r||e.sCount[E]<e.blkIndent||e.sCount[E]-e.blkIndent>=4)break;for(V=!1,c=0,p=A.length;c<p;c++)if(A[c](e,E,r,!0)){V=!0;break}if(V)break;if(f){if(Q=Ov(e,E),Q<0)break;W=e.bMarks[E]+e.tShift[E]}else if(Q=_v(e,E),Q<0)break;if(L!==e.src.charCodeAt(Q-1))break}return f?P=e.push("ordered_list_close","ol",-1):P=e.push("bullet_list_close","ul",-1),P.markup=String.fromCharCode(L),b[1]=E,e.line=E,e.parentType=D,$&&OP(e,g),!0},AP=_e.normalizeReference,ea=_e.isSpace,zP=function(e,n,r,o){var i,s,c,a,l,u,f,d,p,b,g,L,m,x,C,S,D=0,T=e.bMarks[n]+e.tShift[n],G=e.eMarks[n],U=n+1;if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(T)!==91)return!1;for(;++T<G;)if(e.src.charCodeAt(T)===93&&e.src.charCodeAt(T-1)!==92){if(T+1===G||e.src.charCodeAt(T+1)!==58)return!1;break}for(a=e.lineMax,C=e.md.block.ruler.getRules("reference"),b=e.parentType,e.parentType="reference";U<a&&!e.isEmpty(U);U++)if(!(e.sCount[U]-e.blkIndent>3)&&!(e.sCount[U]<0)){for(x=!1,u=0,f=C.length;u<f;u++)if(C[u](e,U,a,!0)){x=!0;break}if(x)break}for(m=e.getLines(n,U,e.blkIndent,!1).trim(),G=m.length,T=1;T<G;T++){if(i=m.charCodeAt(T),i===91)return!1;if(i===93){p=T;break}else i===10?D++:i===92&&(T++,T<G&&m.charCodeAt(T)===10&&D++)}if(p<0||m.charCodeAt(p+1)!==58)return!1;for(T=p+2;T<G;T++)if(i=m.charCodeAt(T),i===10)D++;else if(!ea(i))break;if(g=e.md.helpers.parseLinkDestination(m,T,G),!g.ok||(l=e.md.normalizeLink(g.str),!e.md.validateLink(l)))return!1;for(T=g.pos,D+=g.lines,s=T,c=D,L=T;T<G;T++)if(i=m.charCodeAt(T),i===10)D++;else if(!ea(i))break;for(g=e.md.helpers.parseLinkTitle(m,T,G),T<G&&L!==T&&g.ok?(S=g.str,T=g.pos,D+=g.lines):(S="",T=s,D=c);T<G&&(i=m.charCodeAt(T),!!ea(i));)T++;if(T<G&&m.charCodeAt(T)!==10&&S)for(S="",T=s,D=c;T<G&&(i=m.charCodeAt(T),!!ea(i));)T++;return T<G&&m.charCodeAt(T)!==10||(d=AP(m.slice(1,p)),!d)?!1:(o||(typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[d]>"u"&&(e.env.references[d]={title:S,href:l}),e.parentType=b,e.line=n+D+1),!0)},JP=["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"],ta={},QP="[a-zA-Z_:][a-zA-Z0-9:._-]*",RP="[^\"'=<>`\\x00-\\x20]+",GP="'[^']*'",FP='"[^"]*"',WP="(?:"+RP+"|"+GP+"|"+FP+")",ZP="(?:\\s+"+QP+"(?:\\s*=\\s*"+WP+")?)",Pv="<[A-Za-z][A-Za-z0-9\\-]*"+ZP+"*\\s*\\/?>",Av="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",BP="<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->",HP="<[?][\\s\\S]*?[?]>",UP="<![A-Z]+\\s+[^>]*>",YP="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",VP=new RegExp("^(?:"+Pv+"|"+Av+"|"+BP+"|"+HP+"|"+UP+"|"+YP+")"),$P=new RegExp("^(?:"+Pv+"|"+Av+")");ta.HTML_TAG_RE=VP,ta.HTML_OPEN_CLOSE_TAG_RE=$P;var qP=JP,XP=ta.HTML_OPEN_CLOSE_TAG_RE,Po=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+qP.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(XP.source+"\\s*$"),/^$/,!1]],KP=function(e,n,r,o){var i,s,c,a,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(a=e.src.slice(l,u),i=0;i<Po.length&&!Po[i][0].test(a);i++);if(i===Po.length)return!1;if(o)return Po[i][2];if(s=n+1,!Po[i][1].test(a)){for(;s<r&&!(e.sCount[s]<e.blkIndent);s++)if(l=e.bMarks[s]+e.tShift[s],u=e.eMarks[s],a=e.src.slice(l,u),Po[i][1].test(a)){a.length!==0&&s++;break}}return e.line=s,c=e.push("html_block","",0),c.map=[n,s],c.content=e.getLines(n,s,e.blkIndent,!0),!0},zv=_e.isSpace,eA=function(e,n,r,o){var i,s,c,a,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(s=1,i=e.src.charCodeAt(++l);i===35&&l<u&&s<=6;)s++,i=e.src.charCodeAt(++l);return s>6||l<u&&!zv(i)?!1:(o||(u=e.skipSpacesBack(u,l),c=e.skipCharsBack(u,35,l),c>l&&zv(e.src.charCodeAt(c-1))&&(u=c),e.line=n+1,a=e.push("heading_open","h"+String(s),1),a.markup="########".slice(0,s),a.map=[n,e.line],a=e.push("inline","",0),a.content=e.src.slice(l,u).trim(),a.map=[n,e.line],a.children=[],a=e.push("heading_close","h"+String(s),-1),a.markup="########".slice(0,s)),!0)},tA=function(e,n,r){var o,i,s,c,a,l,u,f,d,p=n+1,b,g=e.md.block.ruler.getRules("paragraph");if(e.sCount[n]-e.blkIndent>=4)return!1;for(b=e.parentType,e.parentType="paragraph";p<r&&!e.isEmpty(p);p++)if(!(e.sCount[p]-e.blkIndent>3)){if(e.sCount[p]>=e.blkIndent&&(l=e.bMarks[p]+e.tShift[p],u=e.eMarks[p],l<u&&(d=e.src.charCodeAt(l),(d===45||d===61)&&(l=e.skipChars(l,d),l=e.skipSpaces(l),l>=u)))){f=d===61?1:2;break}if(!(e.sCount[p]<0)){for(i=!1,s=0,c=g.length;s<c;s++)if(g[s](e,p,r,!0)){i=!0;break}if(i)break}}return f?(o=e.getLines(n,p,e.blkIndent,!1).trim(),e.line=p+1,a=e.push("heading_open","h"+String(f),1),a.markup=String.fromCharCode(d),a.map=[n,e.line],a=e.push("inline","",0),a.content=o,a.map=[n,e.line-1],a.children=[],a=e.push("heading_close","h"+String(f),-1),a.markup=String.fromCharCode(d),e.parentType=b,!0):!1},nA=function(e,n,r){var o,i,s,c,a,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,s=0,c=f.length;s<c;s++)if(f[s](e,u,r,!0)){i=!0;break}if(i)break}return o=e.getLines(n,u,e.blkIndent,!1).trim(),e.line=u,a=e.push("paragraph_open","p",1),a.map=[n,e.line],a=e.push("inline","",0),a.content=o,a.map=[n,e.line],a.children=[],a=e.push("paragraph_close","p",-1),e.parentType=l,!0},Jv=Su,na=_e.isSpace;function xn(t,e,n,r){var o,i,s,c,a,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,s=c=l=u=0,a=i.length;c<a;c++){if(o=i.charCodeAt(c),!f)if(na(o)){l++,o===9?u+=4-u%4:u++;continue}else f=!0;(o===10||c===a-1)&&(o!==10&&c++,this.bMarks.push(s),this.eMarks.push(c),this.tShift.push(l),this.sCount.push(u),this.bsCount.push(0),f=!1,l=0,u=0,s=c+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}xn.prototype.push=function(t,e,n){var r=new Jv(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},xn.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},xn.prototype.skipEmptyLines=function(e){for(var n=this.lineMax;e<n&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},xn.prototype.skipSpaces=function(e){for(var n,r=this.src.length;e<r&&(n=this.src.charCodeAt(e),!!na(n));e++);return e},xn.prototype.skipSpacesBack=function(e,n){if(e<=n)return e;for(;e>n;)if(!na(this.src.charCodeAt(--e)))return e+1;return e},xn.prototype.skipChars=function(e,n){for(var r=this.src.length;e<r&&this.src.charCodeAt(e)===n;e++);return e},xn.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},xn.prototype.getLines=function(e,n,r,o){var i,s,c,a,l,u,f,d=e;if(e>=n)return"";for(u=new Array(n-e),i=0;d<n;d++,i++){for(s=0,f=a=this.bMarks[d],d+1<n||o?l=this.eMarks[d]+1:l=this.eMarks[d];a<l&&s<r;){if(c=this.src.charCodeAt(a),na(c))c===9?s+=4-(s+this.bsCount[d])%4:s++;else if(a-f<this.tShift[d])s++;else break;a++}s>r?u[i]=new Array(s-r+1).join(" ")+this.src.slice(a,l):u[i]=this.src.slice(a,l)}return u.join("")},xn.prototype.Token=Jv;var rA=xn,oA=ju,ra=[["table",kP,["paragraph","reference"]],["code",NP],["fence",jP,["paragraph","reference","blockquote","list"]],["blockquote",DP,["paragraph","reference","blockquote","list"]],["hr",_P,["paragraph","reference","blockquote","list"]],["list",PP,["paragraph","reference","blockquote"]],["reference",zP],["html_block",KP,["paragraph","reference","blockquote"]],["heading",eA,["paragraph","reference","blockquote"]],["lheading",tA],["paragraph",nA]];function oa(){this.ruler=new oA;for(var t=0;t<ra.length;t++)this.ruler.push(ra[t][0],ra[t][1],{alt:(ra[t][2]||[]).slice()})}oa.prototype.tokenize=function(t,e,n){for(var r,o,i,s=this.ruler.getRules(""),c=s.length,a=e,l=!1,u=t.md.options.maxNesting;a<n&&(t.line=a=t.skipEmptyLines(a),!(a>=n||t.sCount[a]<t.blkIndent));){if(t.level>=u){t.line=n;break}for(i=t.line,o=0;o<c;o++)if(r=s[o](t,a,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),a=t.line,a<n&&t.isEmpty(a)&&(l=!0,a++,t.line=a)}},oa.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))},oa.prototype.State=rA;var iA=oa;function sA(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 cA=function(e,n){for(var r=e.pos;r<e.posMax&&!sA(e.src.charCodeAt(r));)r++;return r===e.pos?!1:(n||(e.pending+=e.src.slice(e.pos,r)),e.pos=r,!0)},aA=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i,lA=function(e,n){var r,o,i,s,c,a,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(aA),!i)||(s=i[1],c=e.md.linkify.matchAtStart(e.src.slice(r-s.length)),!c)||(a=c.url,a.length<=s.length)||(a=a.replace(/\*+$/,""),l=e.md.normalizeLink(a),!e.md.validateLink(l))?!1:(n||(e.pending=e.pending.slice(0,-s.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(a),u=e.push("link_close","a",-1),u.markup="linkify",u.info="auto"),e.pos+=a.length-s.length,!0)},uA=_e.isSpace,fA=function(e,n){var r,o,i,s=e.pos;if(e.src.charCodeAt(s)!==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(s++;s<o&&uA(e.src.charCodeAt(s));)s++;return e.pos=s,!0},dA=_e.isSpace,Pu=[],Qv=0;Qv<256;Qv++)Pu.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){Pu[t.charCodeAt(0)]=1});var pA=function(e,n){var r,o,i,s,c,a=e.pos,l=e.posMax;if(e.src.charCodeAt(a)!==92||(a++,a>=l))return!1;if(r=e.src.charCodeAt(a),r===10){for(n||e.push("hardbreak","br",0),a++;a<l&&(r=e.src.charCodeAt(a),!!dA(r));)a++;return e.pos=a,!0}return s=e.src[a],r>=55296&&r<=56319&&a+1<l&&(o=e.src.charCodeAt(a+1),o>=56320&&o<=57343&&(s+=e.src[a+1],a++)),i="\\"+s,n||(c=e.push("text_special","",0),r<256&&Pu[r]!==0?c.content=s:c.content=i,c.markup=i,c.info="escape"),e.pos=a+1,!0},gA=function(e,n){var r,o,i,s,c,a,l,u,f=e.pos,d=e.src.charCodeAt(f);if(d!==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(a=f;(c=e.src.indexOf("`",a))!==-1;){for(a=c+1;a<o&&e.src.charCodeAt(a)===96;)a++;if(u=a-c,u===l)return n||(s=e.push("code_inline","code",0),s.markup=i,s.content=e.src.slice(f,c).replace(/\n/g," ").replace(/^ (.+) $/,"$1")),e.pos=a,!0;e.backticks[u]=c}return e.backticksScanned=!0,n||(e.pending+=i),e.pos+=l,!0},ia={};ia.tokenize=function(e,n){var r,o,i,s,c,a=e.pos,l=e.src.charCodeAt(a);if(n||l!==126||(o=e.scanDelims(e.pos,!0),s=o.length,c=String.fromCharCode(l),s<2))return!1;for(s%2&&(i=e.push("text","",0),i.content=c,s--),r=0;r<s;r+=2)i=e.push("text","",0),i.content=c+c,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 Rv(t,e){var n,r,o,i,s,c=[],a=e.length;for(n=0;n<a;n++)o=e[n],o.marker===126&&o.end!==-1&&(i=e[o.end],s=t.tokens[o.token],s.type="s_open",s.tag="s",s.nesting=1,s.markup="~~",s.content="",s=t.tokens[i.token],s.type="s_close",s.tag="s",s.nesting=-1,s.markup="~~",s.content="",t.tokens[i.token-1].type==="text"&&t.tokens[i.token-1].content==="~"&&c.push(i.token-1));for(;c.length;){for(n=c.pop(),r=n+1;r<t.tokens.length&&t.tokens[r].type==="s_close";)r++;r--,n!==r&&(s=t.tokens[r],t.tokens[r]=t.tokens[n],t.tokens[n]=s)}}ia.postProcess=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(Rv(e,e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&Rv(e,r[n].delimiters)};var sa={};sa.tokenize=function(e,n){var r,o,i,s=e.pos,c=e.src.charCodeAt(s);if(n||c!==95&&c!==42)return!1;for(o=e.scanDelims(e.pos,c===42),r=0;r<o.length;r++)i=e.push("text","",0),i.content=String.fromCharCode(c),e.delimiters.push({marker:c,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 Gv(t,e){var n,r,o,i,s,c,a=e.length;for(n=a-1;n>=0;n--)r=e[n],!(r.marker!==95&&r.marker!==42)&&r.end!==-1&&(o=e[r.end],c=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,s=String.fromCharCode(r.marker),i=t.tokens[r.token],i.type=c?"strong_open":"em_open",i.tag=c?"strong":"em",i.nesting=1,i.markup=c?s+s:s,i.content="",i=t.tokens[o.token],i.type=c?"strong_close":"em_close",i.tag=c?"strong":"em",i.nesting=-1,i.markup=c?s+s:s,i.content="",c&&(t.tokens[e[n-1].token].content="",t.tokens[e[r.end+1].token].content="",n--))}sa.postProcess=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(Gv(e,e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&Gv(e,r[n].delimiters)};var hA=_e.normalizeReference,Au=_e.isSpace,mA=function(e,n){var r,o,i,s,c,a,l,u,f,d="",p="",b=e.pos,g=e.posMax,L=e.pos,m=!0;if(e.src.charCodeAt(e.pos)!==91||(c=e.pos+1,s=e.md.helpers.parseLinkLabel(e,e.pos,!0),s<0))return!1;if(a=s+1,a<g&&e.src.charCodeAt(a)===40){for(m=!1,a++;a<g&&(o=e.src.charCodeAt(a),!(!Au(o)&&o!==10));a++);if(a>=g)return!1;if(L=a,l=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),l.ok){for(d=e.md.normalizeLink(l.str),e.md.validateLink(d)?a=l.pos:d="",L=a;a<g&&(o=e.src.charCodeAt(a),!(!Au(o)&&o!==10));a++);if(l=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<g&&L!==a&&l.ok)for(p=l.str,a=l.pos;a<g&&(o=e.src.charCodeAt(a),!(!Au(o)&&o!==10));a++);}(a>=g||e.src.charCodeAt(a)!==41)&&(m=!0),a++}if(m){if(typeof e.env.references>"u")return!1;if(a<g&&e.src.charCodeAt(a)===91?(L=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(L,a++):a=s+1):a=s+1,i||(i=e.src.slice(c,s)),u=e.env.references[hA(i)],!u)return e.pos=b,!1;d=u.href,p=u.title}return n||(e.pos=c,e.posMax=s,f=e.push("link_open","a",1),f.attrs=r=[["href",d]],p&&r.push(["title",p]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,f=e.push("link_close","a",-1)),e.pos=a,e.posMax=g,!0},vA=_e.normalizeReference,zu=_e.isSpace,yA=function(e,n){var r,o,i,s,c,a,l,u,f,d,p,b,g,L="",m=e.pos,x=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91||(a=e.pos+2,c=e.md.helpers.parseLinkLabel(e,e.pos+1,!1),c<0))return!1;if(l=c+1,l<x&&e.src.charCodeAt(l)===40){for(l++;l<x&&(o=e.src.charCodeAt(l),!(!zu(o)&&o!==10));l++);if(l>=x)return!1;for(g=l,f=e.md.helpers.parseLinkDestination(e.src,l,e.posMax),f.ok&&(L=e.md.normalizeLink(f.str),e.md.validateLink(L)?l=f.pos:L=""),g=l;l<x&&(o=e.src.charCodeAt(l),!(!zu(o)&&o!==10));l++);if(f=e.md.helpers.parseLinkTitle(e.src,l,e.posMax),l<x&&g!==l&&f.ok)for(d=f.str,l=f.pos;l<x&&(o=e.src.charCodeAt(l),!(!zu(o)&&o!==10));l++);else d="";if(l>=x||e.src.charCodeAt(l)!==41)return e.pos=m,!1;l++}else{if(typeof e.env.references>"u")return!1;if(l<x&&e.src.charCodeAt(l)===91?(g=l+1,l=e.md.helpers.parseLinkLabel(e,l),l>=0?s=e.src.slice(g,l++):l=c+1):l=c+1,s||(s=e.src.slice(a,c)),u=e.env.references[vA(s)],!u)return e.pos=m,!1;L=u.href,d=u.title}return n||(i=e.src.slice(a,c),e.md.inline.parse(i,e.md,e.env,b=[]),p=e.push("image","img",0),p.attrs=r=[["src",L],["alt",""]],p.children=b,p.content=i,d&&r.push(["title",d])),e.pos=l,e.posMax=x,!0},bA=/^([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])?)*)$/,IA=/^([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)$/,MA=function(e,n){var r,o,i,s,c,a,l=e.pos;if(e.src.charCodeAt(l)!==60)return!1;for(c=e.pos,a=e.posMax;;){if(++l>=a||(s=e.src.charCodeAt(l),s===60))return!1;if(s===62)break}return r=e.src.slice(c+1,l),IA.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):bA.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},CA=ta.HTML_TAG_RE;function wA(t){return/^<a[>\s]/i.test(t)}function LA(t){return/^<\/a\s*>/i.test(t)}function TA(t){var e=t|32;return e>=97&&e<=122}var xA=function(e,n){var r,o,i,s,c=e.pos;return!e.md.options.html||(i=e.posMax,e.src.charCodeAt(c)!==60||c+2>=i)||(r=e.src.charCodeAt(c+1),r!==33&&r!==63&&r!==47&&!TA(r))||(o=e.src.slice(c).match(CA),!o)?!1:(n||(s=e.push("html_inline","",0),s.content=o[0],wA(s.content)&&e.linkLevel++,LA(s.content)&&e.linkLevel--),e.pos+=o[0].length,!0)},Fv=cv,kA=_e.has,NA=_e.isValidEntityCode,Wv=_e.fromCodePoint,jA=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,SA=/^&([a-z][a-z0-9]{1,31});/i,DA=function(e,n){var r,o,i,s,c=e.pos,a=e.posMax;if(e.src.charCodeAt(c)!==38||c+1>=a)return!1;if(r=e.src.charCodeAt(c+1),r===35){if(i=e.src.slice(c).match(jA),i)return n||(o=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),s=e.push("text_special","",0),s.content=NA(o)?Wv(o):Wv(65533),s.markup=i[0],s.info="entity"),e.pos+=i[0].length,!0}else if(i=e.src.slice(c).match(SA),i&&kA(Fv,i[1]))return n||(s=e.push("text_special","",0),s.content=Fv[i[1]],s.markup=i[0],s.info="entity"),e.pos+=i[0].length,!0;return!1};function Zv(t){var e,n,r,o,i,s,c,a,l={},u=t.length;if(u){var f=0,d=-2,p=[];for(e=0;e<u;e++)if(r=t[e],p.push(0),(t[f].marker!==r.marker||d!==r.token-1)&&(f=e),d=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-p[f]-1,s=n;n>i;n-=p[n]+1)if(o=t[n],o.marker===r.marker&&o.open&&o.end<0&&(c=!1,(o.close||r.open)&&(o.length+r.length)%3===0&&(o.length%3!==0||r.length%3!==0)&&(c=!0),!c)){a=n>0&&!t[n-1].open?p[n-1]+1:0,p[e]=e-n+a,p[n]=a,r.open=!1,o.end=e,o.close=!1,s=-1,d=-2;break}s!==-1&&(l[r.marker][(r.open?3:0)+(r.length||0)%3]=s)}}}var EA=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(Zv(e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&Zv(r[n].delimiters)},_A=function(e){var n,r,o=0,i=e.tokens,s=e.tokens.length;for(n=r=0;n<s;n++)i[n].nesting<0&&o--,i[n].level=o,i[n].nesting>0&&o++,i[n].type==="text"&&n+1<s&&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)},Ju=Su,Bv=_e.isWhiteSpace,Hv=_e.isPunctChar,Uv=_e.isMdAsciiPunct;function qi(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}qi.prototype.pushPending=function(){var t=new Ju("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t},qi.prototype.push=function(t,e,n){this.pending&&this.pushPending();var r=new Ju(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},qi.prototype.scanDelims=function(t,e){var n=t,r,o,i,s,c,a,l,u,f,d=!0,p=!0,b=this.posMax,g=this.src.charCodeAt(t);for(r=t>0?this.src.charCodeAt(t-1):32;n<b&&this.src.charCodeAt(n)===g;)n++;return i=n-t,o=n<b?this.src.charCodeAt(n):32,l=Uv(r)||Hv(String.fromCharCode(r)),f=Uv(o)||Hv(String.fromCharCode(o)),a=Bv(r),u=Bv(o),u?d=!1:f&&(a||l||(d=!1)),a?p=!1:l&&(u||f||(p=!1)),e?(s=d,c=p):(s=d&&(!p||l),c=p&&(!d||f)),{can_open:s,can_close:c,length:i}},qi.prototype.Token=Ju;var OA=qi,Yv=ju,Qu=[["text",cA],["linkify",lA],["newline",fA],["escape",pA],["backticks",gA],["strikethrough",ia.tokenize],["emphasis",sa.tokenize],["link",mA],["image",yA],["autolink",MA],["html_inline",xA],["entity",DA]],Ru=[["balance_pairs",EA],["strikethrough",ia.postProcess],["emphasis",sa.postProcess],["fragments_join",_A]];function Xi(){var t;for(this.ruler=new Yv,t=0;t<Qu.length;t++)this.ruler.push(Qu[t][0],Qu[t][1]);for(this.ruler2=new Yv,t=0;t<Ru.length;t++)this.ruler2.push(Ru[t][0],Ru[t][1])}Xi.prototype.skipToken=function(t){var e,n,r=t.pos,o=this.ruler.getRules(""),i=o.length,s=t.md.options.maxNesting,c=t.cache;if(typeof c[r]<"u"){t.pos=c[r];return}if(t.level<s){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++,c[r]=t.pos},Xi.prototype.tokenize=function(t){for(var e,n,r,o=this.ruler.getRules(""),i=o.length,s=t.posMax,c=t.md.options.maxNesting;t.pos<s;){if(r=t.pos,t.level<c){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>=s)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},Xi.prototype.parse=function(t,e,n,r){var o,i,s,c=new this.State(t,e,n,r);for(this.tokenize(c),i=this.ruler2.getRules(""),s=i.length,o=0;o<s;o++)i[o](c)},Xi.prototype.State=OA;var PA=Xi,Gu,Vv;function AA(){return Vv||(Vv=1,Gu=function(t){var e={};t=t||{},e.src_Any=mv().source,e.src_Cc=yv().source,e.src_Z=Mv().source,e.src_P=Lu.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}),Gu}function Fu(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 ca(t){return Object.prototype.toString.call(t)}function zA(t){return ca(t)==="[object String]"}function JA(t){return ca(t)==="[object Object]"}function QA(t){return ca(t)==="[object RegExp]"}function $v(t){return ca(t)==="[object Function]"}function RA(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var qv={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function GA(t){return Object.keys(t||{}).reduce(function(e,n){return e||qv.hasOwnProperty(n)},!1)}var FA={"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}}},WA="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]",ZA="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function BA(t){t.__index__=-1,t.__text_cache__=""}function HA(t){return function(e,n){var r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function Xv(){return function(t,e){e.normalize(t)}}function aa(t){var e=t.re=AA()(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(WA),n.push(e.src_xn),e.src_tlds=n.join("|");function r(c){return c.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(c,a){throw new Error('(LinkifyIt) Invalid schema "'+c+'": '+a)}Object.keys(t.__schemas__).forEach(function(c){var a=t.__schemas__[c];if(a!==null){var l={validate:null,link:null};if(t.__compiled__[c]=l,JA(a)){QA(a.validate)?l.validate=HA(a.validate):$v(a.validate)?l.validate=a.validate:i(c,a),$v(a.normalize)?l.normalize=a.normalize:a.normalize?i(c,a):l.normalize=Xv();return}if(zA(a)){o.push(c);return}i(c,a)}}),o.forEach(function(c){t.__compiled__[t.__schemas__[c]]&&(t.__compiled__[c].validate=t.__compiled__[t.__schemas__[c]].validate,t.__compiled__[c].normalize=t.__compiled__[t.__schemas__[c]].normalize)}),t.__compiled__[""]={validate:null,normalize:Xv()};var s=Object.keys(t.__compiled__).filter(function(c){return c.length>0&&t.__compiled__[c]}).map(RA).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+s+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+s+")","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"),BA(t)}function UA(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 Wu(t,e){var n=new UA(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function Dt(t,e){if(!(this instanceof Dt))return new Dt(t,e);e||GA(t)&&(e=t,t={}),this.__opts__=Fu({},qv,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Fu({},FA,t),this.__compiled__={},this.__tlds__=ZA,this.__tlds_replaced__=!1,this.re={},aa(this)}Dt.prototype.add=function(e,n){return this.__schemas__[e]=n,aa(this),this},Dt.prototype.set=function(e){return this.__opts__=Fu(this.__opts__,e),this},Dt.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var n,r,o,i,s,c,a,l,u;if(this.re.schema_test.test(e)){for(a=this.re.schema_search,a.lastIndex=0;(n=a.exec(e))!==null;)if(i=this.testSchemaAt(e,n[2],a.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&&(s=r.index+r[1].length,(this.__index__<0||s<this.__index__)&&(this.__schema__="",this.__index__=s,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&&(s=o.index+o[1].length,c=o.index+o[0].length,(this.__index__<0||s<this.__index__||s===this.__index__&&c>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=c))),this.__index__>=0},Dt.prototype.pretest=function(e){return this.re.pretest.test(e)},Dt.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0},Dt.prototype.match=function(e){var n=0,r=[];this.__index__>=0&&this.__text_cache__===e&&(r.push(Wu(this,n)),n=this.__last_index__);for(var o=n?e.slice(n):e;this.test(o);)r.push(Wu(this,n)),o=o.slice(this.__last_index__),n+=this.__last_index__;return r.length?r:null},Dt.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,Wu(this,0)):null},Dt.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(),aa(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,aa(this),this)},Dt.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)},Dt.prototype.onCompile=function(){};var YA=Dt;const Ao=2147483647,kn=36,Zu=1,Ki=26,VA=38,$A=700,Kv=72,ey=128,ty="-",qA=/^xn--/,XA=/[^\0-\x7F]/,KA=/[\x2E\u3002\uFF0E\uFF61]/g,e1={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Bu=kn-Zu,Nn=Math.floor,Hu=String.fromCharCode;function mr(t){throw new RangeError(e1[t])}function t1(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function ny(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(KA,".");const o=t.split("."),i=t1(o,e).join(".");return r+i}function Uu(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 ry=t=>String.fromCodePoint(...t),n1=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:kn},oy=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},iy=function(t,e,n){let r=0;for(t=n?Nn(t/$A):t>>1,t+=Nn(t/e);t>Bu*Ki>>1;r+=kn)t=Nn(t/Bu);return Nn(r+(Bu+1)*t/(t+VA))},Yu=function(t){const e=[],n=t.length;let r=0,o=ey,i=Kv,s=t.lastIndexOf(ty);s<0&&(s=0);for(let c=0;c<s;++c)t.charCodeAt(c)>=128&&mr("not-basic"),e.push(t.charCodeAt(c));for(let c=s>0?s+1:0;c<n;){const a=r;for(let u=1,f=kn;;f+=kn){c>=n&&mr("invalid-input");const d=n1(t.charCodeAt(c++));d>=kn&&mr("invalid-input"),d>Nn((Ao-r)/u)&&mr("overflow"),r+=d*u;const p=f<=i?Zu:f>=i+Ki?Ki:f-i;if(d<p)break;const b=kn-p;u>Nn(Ao/b)&&mr("overflow"),u*=b}const l=e.length+1;i=iy(r-a,l,a==0),Nn(r/l)>Ao-o&&mr("overflow"),o+=Nn(r/l),r%=l,e.splice(r++,0,o)}return String.fromCodePoint(...e)},Vu=function(t){const e=[];t=Uu(t);const n=t.length;let r=ey,o=0,i=Kv;for(const a of t)a<128&&e.push(Hu(a));const s=e.length;let c=s;for(s&&e.push(ty);c<n;){let a=Ao;for(const u of t)u>=r&&u<a&&(a=u);const l=c+1;a-r>Nn((Ao-o)/l)&&mr("overflow"),o+=(a-r)*l,r=a;for(const u of t)if(u<r&&++o>Ao&&mr("overflow"),u===r){let f=o;for(let d=kn;;d+=kn){const p=d<=i?Zu:d>=i+Ki?Ki:d-i;if(f<p)break;const b=f-p,g=kn-p;e.push(Hu(oy(p+b%g,0))),f=Nn(b/g)}e.push(Hu(oy(f,0))),i=iy(o,l,c===s),o=0,++c}++o,++r}return e.join("")},sy=function(t){return ny(t,function(e){return qA.test(e)?Yu(e.slice(4).toLowerCase()):e})},cy=function(t){return ny(t,function(e){return XA.test(e)?"xn--"+Vu(e):e})},r1=YI(Object.freeze(Object.defineProperty({__proto__:null,decode:Yu,default:{version:"2.3.1",ucs2:{decode:Uu,encode:ry},decode:Yu,encode:Vu,toASCII:cy,toUnicode:sy},encode:Vu,toASCII:cy,toUnicode:sy,ucs2decode:Uu,ucs2encode:ry},Symbol.toStringTag,{value:"Module"})));var o1={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},i1={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"]}}},s1={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"]}}},es=_e,c1=Xc,a1=nP,l1=xP,u1=iA,f1=PA,d1=YA,Fr=Eo,ay=r1,p1={default:o1,zero:i1,commonmark:s1},g1=/^(vbscript|javascript|file|data):/,h1=/^data:image\/(gif|png|jpeg|webp);/;function m1(t){var e=t.trim().toLowerCase();return g1.test(e)?!!h1.test(e):!0}var ly=["http:","https:","mailto:"];function v1(t){var e=Fr.parse(t,!0);if(e.hostname&&(!e.protocol||ly.indexOf(e.protocol)>=0))try{e.hostname=ay.toASCII(e.hostname)}catch{}return Fr.encode(Fr.format(e))}function y1(t){var e=Fr.parse(t,!0);if(e.hostname&&(!e.protocol||ly.indexOf(e.protocol)>=0))try{e.hostname=ay.toUnicode(e.hostname)}catch{}return Fr.decode(Fr.format(e),Fr.decode.defaultChars+"%")}function Ft(t,e){if(!(this instanceof Ft))return new Ft(t,e);e||es.isString(t)||(e=t||{},t="default"),this.inline=new f1,this.block=new u1,this.core=new l1,this.renderer=new a1,this.linkify=new d1,this.validateLink=m1,this.normalizeLink=v1,this.normalizeLinkText=y1,this.utils=es,this.helpers=es.assign({},c1),this.options={},this.configure(t),e&&this.set(e)}Ft.prototype.set=function(t){return es.assign(this.options,t),this},Ft.prototype.configure=function(t){var e=this,n;if(es.isString(t)&&(n=t,t=p1[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},Ft.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},Ft.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},Ft.prototype.use=function(t){var e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this},Ft.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},Ft.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},Ft.prototype.parseInline=function(t,e){var n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens},Ft.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};var b1=Ft,I1=b1;const M1=fi(I1);var $u=(t=>(t.Assistant="assistant",t.System="system",t.User="user",t))($u||{});const C1={class:"message-content user"},w1=["innerHTML"],L1={class:"message-photo user"},T1=["src"],x1=Oe("span",{class:"message-photo ai"},[Oe("i",{class:"ai-blueking-icon ai-blueking-ai"})],-1),k1={class:"message-content ai"},N1={key:1,width:"18",height:"18",class:"loading-message","aria-hidden":"true"},j1=[Oe("use",{"xlink:href":"#ai-blueking-loading-2"},null,-1)],S1={key:2,class:"message-wrap"},D1=["innerHTML"],E1=Lt({__name:"render-message",props:{message:{},userPhoto:{default:Bd}},setup(t){const e=t,n=_t(()=>{var i;const o={error:"ai-blueking-icon ai-blueking-warning-circle-fill",loading:""};return(i=e.message)!=null&&i.status?o[e.message.status]:""}),r=_t(()=>{if(e.message.content){const i=new M1().render(e.message.content);return EO.sanitize(i)}return""});return(o,i)=>(Fe(),ft("li",{class:Ur([o.message.role,"message-main"])},[o.message.role===Ge($u).User?(Fe(),ft($e,{key:0},[Oe("p",C1,[Oe("span",{class:"markdown-message",innerHTML:r.value},null,8,w1)]),Oe("span",L1,[Oe("img",{src:o.userPhoto},null,8,T1)])],64)):(Fe(),ft($e,{key:1},[x1,Oe("p",k1,[n.value?(Fe(),ft("i",{key:0,class:Ur(n.value)},null,2)):qa("v-if",!0),o.message.status==="loading"?(Fe(),ft("svg",N1,j1)):qa("v-if",!0),o.message.status==="error"?(Fe(),ft("span",S1,ls(o.message.content),1)):(Fe(),ft("span",{key:3,class:"markdown-message",innerHTML:r.value},null,8,D1))])],64))],2))}}),_1={class:"prompt-list"},O1={class:"search-group"},P1=["onClick"],A1={class:"prompt-content"},z1=Lt({__name:"render-send",props:{prompts:{},value:{}},emits:["update:value","enter","choose-prompt"],setup(t,{emit:e}){const n=t,r=e,o=cO,i=Zc,s=Bt(""),c=Bt(40),a=Bt(),l=Bt(!1),u=_t(()=>{var C;return((C=n.prompts)==null?void 0:C.filter(S=>S.content.includes(s.value)))||[]}),f=C=>{r("update:value",C)},d=()=>{var C;n.value==="/"&&((C=n.prompts)!=null&&C.length)?m():x()},p=()=>{let S=24+n.value.split(/\r?\n/).length*16;S>=200&&(S=200),c.value=S},b=C=>{r("update:value",C.content),r("choose-prompt",C),x(),L()},g=(C,S)=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),r("enter"))},L=()=>{var S;const C=(S=a.value)==null?void 0:S.$el.querySelector("textarea");C==null||C.focus()},m=()=>{l.value=!0},x=()=>{l.value=!1};return _n(()=>n.value,()=>{p(),d()}),Vr(L),(C,S)=>(Fe(),Kr(Ge(rm),{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:Yo(()=>{var D;return[Oe("div",null,[on((Fe(),ft("section",_1,[Ee(Ge(Hm),{class:"input-search",modelValue:s.value,"onUpdate:modelValue":S[0]||(S[0]=T=>s.value=T),behavior:"simplicity",clearable:""},null,8,["modelValue"]),Oe("section",O1,[(Fe(!0),ft($e,null,ed(u.value,(T,G)=>on((Fe(),ft("span",{class:"group-prompt",key:G,onClick:U=>b(T)},[Oe("span",A1,ls(T.content),1)],8,P1)),[[Ge(i),{content:T.content,placement:"right",theme:"light",width:300,zIndex:9999999,extCls:"prompt-popover ai-blueking-popover ai-blueking-pop2-content"}]])),128)),(D=u.value)!=null&&D.length?qa("v-if",!0):(Fe(),Kr(Ge(uO),{key:0,class:"exception-wrap-item exception-part",scene:"part",type:"search-empty"}))])])),[[Ge(o),x]])])]}),default:Yo(()=>{var D;return[Oe("section",{style:Ir({width:"calc(100% - 84px)","margin-right":"7px","--text-height":c.value+"px"})},[Ee(Ge(Hm),{ref_key:"inputRef",ref:a,class:"send-prompt",clearable:!0,"model-value":C.value,"native-attributes":{autofocus:"autofocus"},placeholder:(D=C.prompts)!=null&&D.length?Ge(Yn)("您可以键入 “/” 查看更多Prompt"):Ge(Yn)("请输入"),row:"1",type:"textarea",onInput:f,onKeydown:g},null,8,["model-value","placeholder"])],4)]}),_:1},8,["is-show"]))}}),qu=(t,e)=>{const n=t.__vccOpts||t;for(const[r,o]of e)n[r]=o;return n},J1=qu(z1,[["__scopeId","data-v-f2501723"]]),Q1=t=>(l0("data-v-7a07ab7e"),t=t(),u0(),t),R1={class:"ai-operation"},G1=Q1(()=>Oe("i",{class:"ai-blueking-icon ai-blueking-fasong"},null,-1)),F1=qu(Lt({__name:"render-content",props:{messages:{},prompts:{},loading:{type:Boolean},background:{default:"#f5f7fa"},userPhoto:{}},emits:["send","choose-prompt","scroll"],setup(t,{emit:e}){const n=t,r=e,o=Zc,i=Bt(""),s=()=>{Ho(()=>{const u=document.querySelector(".ai-blueking-messages");u.scrollTop=u.scrollHeight})},c=()=>{n.loading||(r("send",i.value),i.value="")},a=u=>{r("choose-prompt",u)},l=u=>{r("scroll",u)};return _n(()=>n.messages,s,{deep:!0,immediate:!0}),(u,f)=>(Fe(),ft("section",{style:Ir({background:u.background}),class:"ai-content"},[Oe("ul",{class:"ai-messages ai-blueking-messages",onScroll:l},[(Fe(!0),ft($e,null,ed(u.messages,d=>(Fe(),Kr(E1,{class:"ai-message",key:d.content,message:d,"user-photo":u.userPhoto},null,8,["message","user-photo"]))),128))],32),on((Fe(),ft("section",R1,[Ee(J1,{value:i.value,"onUpdate:value":f[0]||(f[0]=d=>i.value=d),prompts:u.prompts,onChoosePrompt:a,onEnter:c},null,8,["value","prompts"]),Ee(Ge(KD),{class:"ai-operation-button",disabled:u.loading||!i.value,size:"large",theme:"primary",onClick:c},{default:Yo(()=>[G1,Ss(" "+ls(Ge(Yn)("发送")),1)]),_:1},8,["disabled"])])),[[Ge(o),{content:Ge(Yn)("内容正在执行中,请执行完成后再输入"),disabled:!u.loading,extCls:"ai-tooltips ai-blueking-popover ai-blueking-pop2-content"}]])],4))}}),[["__scopeId","data-v-7a07ab7e"]]),W1=qu(Lt({__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"},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=Zc,i={height:window.innerHeight,width:window.innerWidth},s={isMove:!1,type:"",clientX:0,clientY:0},c=()=>{var V,A,P,E;const W=(F,$)=>F===void 0?$:F;return{top:W((V=n.startPosition)==null?void 0:V.top,i.height-n.sizeLimit.height),bottom:W((A=n.startPosition)==null?void 0:A.bottom,0),left:W((P=n.startPosition)==null?void 0:P.left,0),right:W((E=n.startPosition)==null?void 0:E.right,i.width-n.sizeLimit.width)}},a=Bt(c()),l=_t(()=>a.value.top<=n.positionLimit.top&&a.value.bottom<=n.positionLimit.bottom),u=W=>{s.isMove=!0,s.type="move",s.clientX=W.clientX,s.clientY=W.clientY},f=W=>{s.isMove=!0,s.type="rightDrag",s.clientX=W.clientX},d=W=>{s.isMove=!0,s.type="leftDrag",s.clientX=W.clientX},p=W=>{s.isMove=!0,s.type="topDrag",s.clientY=W.clientY},b=W=>{s.isMove=!0,s.type="bottomDrag",s.clientY=W.clientY},g=W=>{s.isMove=!0,s.type="topLeftDrag",s.clientY=W.clientY,s.clientX=W.clientX},L=W=>{s.isMove=!0,s.type="topRightDrag",s.clientY=W.clientY,s.clientX=W.clientX},m=W=>{s.isMove=!0,s.type="bottomLeftDrag",s.clientY=W.clientY,s.clientX=W.clientX},x=W=>{s.isMove=!0,s.type="bottomRightDrag",s.clientY=W.clientY,s.clientX=W.clientX},C=()=>{s.isMove=!1},S=(W,V)=>{["move","leftDrag"].includes(s.type)&&(a.value.left+=W),["move","rightDrag"].includes(s.type)&&(a.value.right-=W),["move","topDrag"].includes(s.type)&&(a.value.top+=V),["move","bottomDrag"].includes(s.type)&&(a.value.bottom-=V),["topLeftDrag"].includes(s.type)&&(a.value.left+=W,a.value.top+=V),["topRightDrag"].includes(s.type)&&(a.value.right-=W,a.value.top+=V),["bottomLeftDrag"].includes(s.type)&&(a.value.left+=W,a.value.bottom-=V),["bottomRightDrag"].includes(s.type)&&(a.value.right-=W,a.value.bottom-=V)},D=(W,V)=>{const{top:A,bottom:P,left:E,right:F}=a.value;(i.width-E-F<n.sizeLimit.width||E<n.positionLimit.left||F<n.positionLimit.right)&&(["move","leftDrag","topLeftDrag","bottomLeftDrag"].includes(s.type)&&(a.value.left-=W),["move","rightDrag","topRightDrag","bottomRightDrag"].includes(s.type)&&(a.value.right+=W)),(i.height-A-P<n.sizeLimit.height||A<n.positionLimit.top||P<n.positionLimit.bottom)&&(["move","topDrag","topRightDrag","topLeftDrag"].includes(s.type)&&(a.value.top-=V),["move","bottomDrag","bottomLeftDrag","bottomRightDrag"].includes(s.type)&&(a.value.bottom+=V))},T=W=>{if(!s.isMove)return;W.preventDefault();const V=W.clientX-s.clientX,A=W.clientY-s.clientY;S(V,A),D(V,A),s.clientX=W.clientX,s.clientY=W.clientY},G=()=>{i.height=window.innerHeight,i.width=window.innerWidth,a.value=c()},U=()=>{a.value.top=n.positionLimit.top,a.value.bottom=n.positionLimit.bottom},te=()=>{a.value.top=i.height-n.sizeLimit.height,a.value.bottom=n.positionLimit.bottom},Q=()=>{r("clear")},K=()=>{r("close")};return Xf(()=>{window.addEventListener("mousemove",T,!0),window.addEventListener("mouseup",C),window.addEventListener("resize",G)}),$r(()=>{window.removeEventListener("mousemove",T,!0),window.removeEventListener("mouseup",C),window.removeEventListener("resize",G)}),(W,V)=>(Fe(),ft("section",{style:Ir({top:a.value.top+"px",bottom:a.value.bottom+"px",left:a.value.left+"px",right:a.value.right+"px"}),class:"ai-modal"},[Oe("header",{style:Ir({background:W.headBackground}),class:"ai-modal-header",onMousedown:Pn(u,["stop"])},[Oe("span",null,[Oe("i",{class:Ur(W.logo)},null,2),Ss(" "+ls(Ge(Yn)("小鲸")),1)]),Oe("span",null,[l.value?on((Fe(),ft("i",{key:0,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxiajuhe",onClick:te},null,512)),[[Ge(o),{content:Ge(Yn)("向下收缩"),distance:20,extCls:"ai-tooltips ai-blueking-popover ai-blueking-pop2-content"}]]):on((Fe(),ft("i",{key:1,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxialashen-2",onClick:U},null,512)),[[Ge(o),{content:Ge(Yn)("向上扩展"),distance:20,extCls:"ai-tooltips ai-blueking-popover ai-blueking-pop2-content"}]]),on(Oe("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-saoba",onClick:Q},null,512),[[Ge(o),{content:Ge(Yn)("清空聊天记录"),distance:20,extCls:"ai-tooltips ai-blueking-popover ai-blueking-pop2-content"}]]),on(Oe("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-shanchu-2",onClick:K},null,512),[[Ge(o),{content:Ge(Yn)("关闭"),distance:20,extCls:"ai-tooltips ai-blueking-popover ai-blueking-pop2-content"}]])])],36),E0(W.$slots,"default",{},void 0),Oe("span",{class:"drag-line left",onMousedown:Pn(d,["stop"])},null,32),Oe("span",{class:"drag-line right",onMousedown:Pn(f,["stop"])},null,32),Oe("span",{class:"drag-line top",onMousedown:Pn(p,["stop"])},null,32),Oe("span",{class:"drag-line bottom",onMousedown:Pn(b,["stop"])},null,32),Oe("span",{class:"drag-line top-left-corner",onMousedown:Pn(g,["stop"])},null,32),Oe("span",{class:"drag-line top-right-corner",onMousedown:Pn(L,["stop"])},null,32),Oe("span",{class:"drag-line bottom-left-corner",onMousedown:Pn(m,["stop"])},null,32),Oe("span",{class:"drag-line bottom-right-corner",onMousedown:Pn(x,["stop"])},null,32)],4))}}),[["__scopeId","data-v-de00de78"]]),Z1=Lt({__name:"ai-blueking",props:{messages:{},prompts:{},loading:{type:Boolean},headBackground:{},background:{},positionLimit:{},sizeLimit:{},startPosition:{},userPhoto:{},logo:{}},emits:["clear","close","send","choose-prompt","scroll"],setup(t,{emit:e}){const n=e,r=()=>{n("clear")},o=()=>{n("close")},i=a=>{n("send",a)},s=a=>{n("choose-prompt",a)},c=a=>{n("scroll",a)};return(a,l)=>(Fe(),Kr(W1,{"head-background":a.headBackground,logo:a.logo,"position-limit":a.positionLimit,"size-limit":a.sizeLimit,"start-position":a.startPosition,onClear:r,onClose:o},{default:Yo(()=>[Ee(F1,{background:a.background,loading:a.loading,messages:a.messages,prompts:a.prompts,"user-photo":a.userPhoto,onChoosePrompt:s,onScroll:c,onSend:i},null,8,["background","loading","messages","prompts","user-photo"])]),_:1},8,["head-background","logo","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></svg>';document.body?document.body.insertAdjacentHTML("afterbegin",t):document.addEventListener("DOMContentLoaded",function(){document.body.insertAdjacentHTML("afterbegin",t)})})(),DS({prefix:"ai-blueking"});const B1={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:Bd,type:String},logo:{default:"ai-blueking-icon ai-blueking-ai",type:String}},data(){return{app:null,unWatchStack:[]}},watch:{messages:{handler(){this.$nextTick(()=>{const t=document.querySelector(".ai-blueking-messages");t.scrollTop=t.scrollHeight})},deep:!0,immediate:!0}},created(){const t=this.$emit.bind(this);let e=null;const n=this;this.app=Ps({render(){return e=this,nr(Z1,{messages: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,startPosition:n.startPosition,onClear(){t("clear",...arguments)},onClose(){t("close",...arguments)},onSend(){t("send",...arguments)},onChoosePrompt(){t("choose-prompt",...arguments)},onScroll(){t("scroll",...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()}};return is.RoleType=$u,is.default=B1,Object.defineProperties(is,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),is}({});
88
+ `,s.map=[n,e.line],!0},jP=function(e,n,r,o){var i,s,c,a,l,u,f,d=!1,p=e.bMarks[n]+e.tShift[n],b=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||p+3>b||(i=e.src.charCodeAt(p),i!==126&&i!==96)||(l=p,p=e.skipChars(p,i),s=p-l,s<3)||(f=e.src.slice(l,p),c=e.src.slice(p,b),i===96&&c.indexOf(String.fromCharCode(i))>=0))return!1;if(o)return!0;for(a=n;a++,!(a>=r||(p=l=e.bMarks[a]+e.tShift[a],b=e.eMarks[a],p<b&&e.sCount[a]<e.blkIndent));)if(e.src.charCodeAt(p)===i&&!(e.sCount[a]-e.blkIndent>=4)&&(p=e.skipChars(p,i),!(p-l<s)&&(p=e.skipSpaces(p),!(p<b)))){d=!0;break}return s=e.sCount[n],e.line=a+(d?1:0),u=e.push("fence","code",0),u.info=c,u.content=e.getLines(n+1,a,s,!0),u.markup=f,u.map=[n,e.line],!0},SP=_e.isSpace,DP=function(e,n,r,o){var i,s,c,a,l,u,f,d,p,b,g,L,m,x,C,S,D,T,G,U,te=e.lineMax,Q=e.bMarks[n]+e.tShift[n],K=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(Q)!==62)return!1;if(o)return!0;for(b=[],g=[],x=[],C=[],T=e.md.block.ruler.getRules("blockquote"),m=e.parentType,e.parentType="blockquote",d=n;d<r&&(U=e.sCount[d]<e.blkIndent,Q=e.bMarks[d]+e.tShift[d],K=e.eMarks[d],!(Q>=K));d++){if(e.src.charCodeAt(Q++)===62&&!U){for(a=e.sCount[d]+1,e.src.charCodeAt(Q)===32?(Q++,a++,i=!1,S=!0):e.src.charCodeAt(Q)===9?(S=!0,(e.bsCount[d]+a)%4===3?(Q++,a++,i=!1):i=!0):S=!1,p=a,b.push(e.bMarks[d]),e.bMarks[d]=Q;Q<K&&(s=e.src.charCodeAt(Q),SP(s));){s===9?p+=4-(p+e.bsCount[d]+(i?1:0))%4:p++;Q++}u=Q>=K,g.push(e.bsCount[d]),e.bsCount[d]=e.sCount[d]+1+(S?1:0),x.push(e.sCount[d]),e.sCount[d]=p-a,C.push(e.tShift[d]),e.tShift[d]=Q-e.bMarks[d];continue}if(u)break;for(D=!1,c=0,l=T.length;c<l;c++)if(T[c](e,d,r,!0)){D=!0;break}if(D){e.lineMax=d,e.blkIndent!==0&&(b.push(e.bMarks[d]),g.push(e.bsCount[d]),C.push(e.tShift[d]),x.push(e.sCount[d]),e.sCount[d]-=e.blkIndent);break}b.push(e.bMarks[d]),g.push(e.bsCount[d]),C.push(e.tShift[d]),x.push(e.sCount[d]),e.sCount[d]=-1}for(L=e.blkIndent,e.blkIndent=0,G=e.push("blockquote_open","blockquote",1),G.markup=">",G.map=f=[n,0],e.md.block.tokenize(e,n,d),G=e.push("blockquote_close","blockquote",-1),G.markup=">",e.lineMax=te,e.parentType=m,f[1]=e.line,c=0;c<C.length;c++)e.bMarks[c+n]=b[c],e.tShift[c+n]=C[c],e.sCount[c+n]=x[c],e.bsCount[c+n]=g[c];return e.blkIndent=L,!0},EP=_e.isSpace,_P=function(e,n,r,o){var i,s,c,a,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(s=1;l<u;){if(c=e.src.charCodeAt(l++),c!==i&&!EP(c))return!1;c===i&&s++}return s<3?!1:(o||(e.line=n+1,a=e.push("hr","hr",0),a.map=[n,e.line],a.markup=Array(s+1).join(String.fromCharCode(i))),!0)},Ev=_e.isSpace;function _v(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),!Ev(i))?-1:r}function Ov(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),!Ev(n))?-1:o}function OP(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 PP=function(e,n,r,o){var i,s,c,a,l,u,f,d,p,b,g,L,m,x,C,S,D,T,G,U,te,Q,K,W,V,A,P,E=n,F=!1,$=!0;if(e.sCount[E]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[E]-e.listIndent>=4&&e.sCount[E]<e.blkIndent)return!1;if(o&&e.parentType==="paragraph"&&e.sCount[E]>=e.blkIndent&&(F=!0),(Q=Ov(e,E))>=0){if(f=!0,W=e.bMarks[E]+e.tShift[E],m=Number(e.src.slice(W,Q-1)),F&&m!==1)return!1}else if((Q=_v(e,E))>=0)f=!1;else return!1;if(F&&e.skipSpaces(Q)>=e.eMarks[E])return!1;if(o)return!0;for(L=e.src.charCodeAt(Q-1),g=e.tokens.length,f?(P=e.push("ordered_list_open","ol",1),m!==1&&(P.attrs=[["start",m]])):P=e.push("bullet_list_open","ul",1),P.map=b=[E,0],P.markup=String.fromCharCode(L),K=!1,A=e.md.block.ruler.getRules("list"),D=e.parentType,e.parentType="list";E<r;){for(te=Q,x=e.eMarks[E],u=C=e.sCount[E]+Q-(e.bMarks[E]+e.tShift[E]);te<x;){if(i=e.src.charCodeAt(te),i===9)C+=4-(C+e.bsCount[E])%4;else if(i===32)C++;else break;te++}if(s=te,s>=x?l=1:l=C-u,l>4&&(l=1),a=u+l,P=e.push("list_item_open","li",1),P.markup=String.fromCharCode(L),P.map=d=[E,0],f&&(P.info=e.src.slice(W,Q-1)),U=e.tight,G=e.tShift[E],T=e.sCount[E],S=e.listIndent,e.listIndent=e.blkIndent,e.blkIndent=a,e.tight=!0,e.tShift[E]=s-e.bMarks[E],e.sCount[E]=C,s>=x&&e.isEmpty(E+1)?e.line=Math.min(e.line+2,r):e.md.block.tokenize(e,E,r,!0),(!e.tight||K)&&($=!1),K=e.line-E>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[E]=G,e.sCount[E]=T,e.tight=U,P=e.push("list_item_close","li",-1),P.markup=String.fromCharCode(L),E=e.line,d[1]=E,E>=r||e.sCount[E]<e.blkIndent||e.sCount[E]-e.blkIndent>=4)break;for(V=!1,c=0,p=A.length;c<p;c++)if(A[c](e,E,r,!0)){V=!0;break}if(V)break;if(f){if(Q=Ov(e,E),Q<0)break;W=e.bMarks[E]+e.tShift[E]}else if(Q=_v(e,E),Q<0)break;if(L!==e.src.charCodeAt(Q-1))break}return f?P=e.push("ordered_list_close","ol",-1):P=e.push("bullet_list_close","ul",-1),P.markup=String.fromCharCode(L),b[1]=E,e.line=E,e.parentType=D,$&&OP(e,g),!0},AP=_e.normalizeReference,ea=_e.isSpace,zP=function(e,n,r,o){var i,s,c,a,l,u,f,d,p,b,g,L,m,x,C,S,D=0,T=e.bMarks[n]+e.tShift[n],G=e.eMarks[n],U=n+1;if(e.sCount[n]-e.blkIndent>=4||e.src.charCodeAt(T)!==91)return!1;for(;++T<G;)if(e.src.charCodeAt(T)===93&&e.src.charCodeAt(T-1)!==92){if(T+1===G||e.src.charCodeAt(T+1)!==58)return!1;break}for(a=e.lineMax,C=e.md.block.ruler.getRules("reference"),b=e.parentType,e.parentType="reference";U<a&&!e.isEmpty(U);U++)if(!(e.sCount[U]-e.blkIndent>3)&&!(e.sCount[U]<0)){for(x=!1,u=0,f=C.length;u<f;u++)if(C[u](e,U,a,!0)){x=!0;break}if(x)break}for(m=e.getLines(n,U,e.blkIndent,!1).trim(),G=m.length,T=1;T<G;T++){if(i=m.charCodeAt(T),i===91)return!1;if(i===93){p=T;break}else i===10?D++:i===92&&(T++,T<G&&m.charCodeAt(T)===10&&D++)}if(p<0||m.charCodeAt(p+1)!==58)return!1;for(T=p+2;T<G;T++)if(i=m.charCodeAt(T),i===10)D++;else if(!ea(i))break;if(g=e.md.helpers.parseLinkDestination(m,T,G),!g.ok||(l=e.md.normalizeLink(g.str),!e.md.validateLink(l)))return!1;for(T=g.pos,D+=g.lines,s=T,c=D,L=T;T<G;T++)if(i=m.charCodeAt(T),i===10)D++;else if(!ea(i))break;for(g=e.md.helpers.parseLinkTitle(m,T,G),T<G&&L!==T&&g.ok?(S=g.str,T=g.pos,D+=g.lines):(S="",T=s,D=c);T<G&&(i=m.charCodeAt(T),!!ea(i));)T++;if(T<G&&m.charCodeAt(T)!==10&&S)for(S="",T=s,D=c;T<G&&(i=m.charCodeAt(T),!!ea(i));)T++;return T<G&&m.charCodeAt(T)!==10||(d=AP(m.slice(1,p)),!d)?!1:(o||(typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[d]>"u"&&(e.env.references[d]={title:S,href:l}),e.parentType=b,e.line=n+D+1),!0)},JP=["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"],ta={},QP="[a-zA-Z_:][a-zA-Z0-9:._-]*",RP="[^\"'=<>`\\x00-\\x20]+",GP="'[^']*'",FP='"[^"]*"',WP="(?:"+RP+"|"+GP+"|"+FP+")",ZP="(?:\\s+"+QP+"(?:\\s*=\\s*"+WP+")?)",Pv="<[A-Za-z][A-Za-z0-9\\-]*"+ZP+"*\\s*\\/?>",Av="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",BP="<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->",HP="<[?][\\s\\S]*?[?]>",UP="<![A-Z]+\\s+[^>]*>",YP="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",VP=new RegExp("^(?:"+Pv+"|"+Av+"|"+BP+"|"+HP+"|"+UP+"|"+YP+")"),$P=new RegExp("^(?:"+Pv+"|"+Av+")");ta.HTML_TAG_RE=VP,ta.HTML_OPEN_CLOSE_TAG_RE=$P;var qP=JP,XP=ta.HTML_OPEN_CLOSE_TAG_RE,Po=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+qP.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(XP.source+"\\s*$"),/^$/,!1]],KP=function(e,n,r,o){var i,s,c,a,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(a=e.src.slice(l,u),i=0;i<Po.length&&!Po[i][0].test(a);i++);if(i===Po.length)return!1;if(o)return Po[i][2];if(s=n+1,!Po[i][1].test(a)){for(;s<r&&!(e.sCount[s]<e.blkIndent);s++)if(l=e.bMarks[s]+e.tShift[s],u=e.eMarks[s],a=e.src.slice(l,u),Po[i][1].test(a)){a.length!==0&&s++;break}}return e.line=s,c=e.push("html_block","",0),c.map=[n,s],c.content=e.getLines(n,s,e.blkIndent,!0),!0},zv=_e.isSpace,eA=function(e,n,r,o){var i,s,c,a,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(s=1,i=e.src.charCodeAt(++l);i===35&&l<u&&s<=6;)s++,i=e.src.charCodeAt(++l);return s>6||l<u&&!zv(i)?!1:(o||(u=e.skipSpacesBack(u,l),c=e.skipCharsBack(u,35,l),c>l&&zv(e.src.charCodeAt(c-1))&&(u=c),e.line=n+1,a=e.push("heading_open","h"+String(s),1),a.markup="########".slice(0,s),a.map=[n,e.line],a=e.push("inline","",0),a.content=e.src.slice(l,u).trim(),a.map=[n,e.line],a.children=[],a=e.push("heading_close","h"+String(s),-1),a.markup="########".slice(0,s)),!0)},tA=function(e,n,r){var o,i,s,c,a,l,u,f,d,p=n+1,b,g=e.md.block.ruler.getRules("paragraph");if(e.sCount[n]-e.blkIndent>=4)return!1;for(b=e.parentType,e.parentType="paragraph";p<r&&!e.isEmpty(p);p++)if(!(e.sCount[p]-e.blkIndent>3)){if(e.sCount[p]>=e.blkIndent&&(l=e.bMarks[p]+e.tShift[p],u=e.eMarks[p],l<u&&(d=e.src.charCodeAt(l),(d===45||d===61)&&(l=e.skipChars(l,d),l=e.skipSpaces(l),l>=u)))){f=d===61?1:2;break}if(!(e.sCount[p]<0)){for(i=!1,s=0,c=g.length;s<c;s++)if(g[s](e,p,r,!0)){i=!0;break}if(i)break}}return f?(o=e.getLines(n,p,e.blkIndent,!1).trim(),e.line=p+1,a=e.push("heading_open","h"+String(f),1),a.markup=String.fromCharCode(d),a.map=[n,e.line],a=e.push("inline","",0),a.content=o,a.map=[n,e.line-1],a.children=[],a=e.push("heading_close","h"+String(f),-1),a.markup=String.fromCharCode(d),e.parentType=b,!0):!1},nA=function(e,n,r){var o,i,s,c,a,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,s=0,c=f.length;s<c;s++)if(f[s](e,u,r,!0)){i=!0;break}if(i)break}return o=e.getLines(n,u,e.blkIndent,!1).trim(),e.line=u,a=e.push("paragraph_open","p",1),a.map=[n,e.line],a=e.push("inline","",0),a.content=o,a.map=[n,e.line],a.children=[],a=e.push("paragraph_close","p",-1),e.parentType=l,!0},Jv=Su,na=_e.isSpace;function xn(t,e,n,r){var o,i,s,c,a,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,s=c=l=u=0,a=i.length;c<a;c++){if(o=i.charCodeAt(c),!f)if(na(o)){l++,o===9?u+=4-u%4:u++;continue}else f=!0;(o===10||c===a-1)&&(o!==10&&c++,this.bMarks.push(s),this.eMarks.push(c),this.tShift.push(l),this.sCount.push(u),this.bsCount.push(0),f=!1,l=0,u=0,s=c+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}xn.prototype.push=function(t,e,n){var r=new Jv(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},xn.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},xn.prototype.skipEmptyLines=function(e){for(var n=this.lineMax;e<n&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},xn.prototype.skipSpaces=function(e){for(var n,r=this.src.length;e<r&&(n=this.src.charCodeAt(e),!!na(n));e++);return e},xn.prototype.skipSpacesBack=function(e,n){if(e<=n)return e;for(;e>n;)if(!na(this.src.charCodeAt(--e)))return e+1;return e},xn.prototype.skipChars=function(e,n){for(var r=this.src.length;e<r&&this.src.charCodeAt(e)===n;e++);return e},xn.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},xn.prototype.getLines=function(e,n,r,o){var i,s,c,a,l,u,f,d=e;if(e>=n)return"";for(u=new Array(n-e),i=0;d<n;d++,i++){for(s=0,f=a=this.bMarks[d],d+1<n||o?l=this.eMarks[d]+1:l=this.eMarks[d];a<l&&s<r;){if(c=this.src.charCodeAt(a),na(c))c===9?s+=4-(s+this.bsCount[d])%4:s++;else if(a-f<this.tShift[d])s++;else break;a++}s>r?u[i]=new Array(s-r+1).join(" ")+this.src.slice(a,l):u[i]=this.src.slice(a,l)}return u.join("")},xn.prototype.Token=Jv;var rA=xn,oA=ju,ra=[["table",kP,["paragraph","reference"]],["code",NP],["fence",jP,["paragraph","reference","blockquote","list"]],["blockquote",DP,["paragraph","reference","blockquote","list"]],["hr",_P,["paragraph","reference","blockquote","list"]],["list",PP,["paragraph","reference","blockquote"]],["reference",zP],["html_block",KP,["paragraph","reference","blockquote"]],["heading",eA,["paragraph","reference","blockquote"]],["lheading",tA],["paragraph",nA]];function oa(){this.ruler=new oA;for(var t=0;t<ra.length;t++)this.ruler.push(ra[t][0],ra[t][1],{alt:(ra[t][2]||[]).slice()})}oa.prototype.tokenize=function(t,e,n){for(var r,o,i,s=this.ruler.getRules(""),c=s.length,a=e,l=!1,u=t.md.options.maxNesting;a<n&&(t.line=a=t.skipEmptyLines(a),!(a>=n||t.sCount[a]<t.blkIndent));){if(t.level>=u){t.line=n;break}for(i=t.line,o=0;o<c;o++)if(r=s[o](t,a,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),a=t.line,a<n&&t.isEmpty(a)&&(l=!0,a++,t.line=a)}},oa.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))},oa.prototype.State=rA;var iA=oa;function sA(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 cA=function(e,n){for(var r=e.pos;r<e.posMax&&!sA(e.src.charCodeAt(r));)r++;return r===e.pos?!1:(n||(e.pending+=e.src.slice(e.pos,r)),e.pos=r,!0)},aA=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i,lA=function(e,n){var r,o,i,s,c,a,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(aA),!i)||(s=i[1],c=e.md.linkify.matchAtStart(e.src.slice(r-s.length)),!c)||(a=c.url,a.length<=s.length)||(a=a.replace(/\*+$/,""),l=e.md.normalizeLink(a),!e.md.validateLink(l))?!1:(n||(e.pending=e.pending.slice(0,-s.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(a),u=e.push("link_close","a",-1),u.markup="linkify",u.info="auto"),e.pos+=a.length-s.length,!0)},uA=_e.isSpace,fA=function(e,n){var r,o,i,s=e.pos;if(e.src.charCodeAt(s)!==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(s++;s<o&&uA(e.src.charCodeAt(s));)s++;return e.pos=s,!0},dA=_e.isSpace,Pu=[],Qv=0;Qv<256;Qv++)Pu.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){Pu[t.charCodeAt(0)]=1});var pA=function(e,n){var r,o,i,s,c,a=e.pos,l=e.posMax;if(e.src.charCodeAt(a)!==92||(a++,a>=l))return!1;if(r=e.src.charCodeAt(a),r===10){for(n||e.push("hardbreak","br",0),a++;a<l&&(r=e.src.charCodeAt(a),!!dA(r));)a++;return e.pos=a,!0}return s=e.src[a],r>=55296&&r<=56319&&a+1<l&&(o=e.src.charCodeAt(a+1),o>=56320&&o<=57343&&(s+=e.src[a+1],a++)),i="\\"+s,n||(c=e.push("text_special","",0),r<256&&Pu[r]!==0?c.content=s:c.content=i,c.markup=i,c.info="escape"),e.pos=a+1,!0},gA=function(e,n){var r,o,i,s,c,a,l,u,f=e.pos,d=e.src.charCodeAt(f);if(d!==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(a=f;(c=e.src.indexOf("`",a))!==-1;){for(a=c+1;a<o&&e.src.charCodeAt(a)===96;)a++;if(u=a-c,u===l)return n||(s=e.push("code_inline","code",0),s.markup=i,s.content=e.src.slice(f,c).replace(/\n/g," ").replace(/^ (.+) $/,"$1")),e.pos=a,!0;e.backticks[u]=c}return e.backticksScanned=!0,n||(e.pending+=i),e.pos+=l,!0},ia={};ia.tokenize=function(e,n){var r,o,i,s,c,a=e.pos,l=e.src.charCodeAt(a);if(n||l!==126||(o=e.scanDelims(e.pos,!0),s=o.length,c=String.fromCharCode(l),s<2))return!1;for(s%2&&(i=e.push("text","",0),i.content=c,s--),r=0;r<s;r+=2)i=e.push("text","",0),i.content=c+c,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 Rv(t,e){var n,r,o,i,s,c=[],a=e.length;for(n=0;n<a;n++)o=e[n],o.marker===126&&o.end!==-1&&(i=e[o.end],s=t.tokens[o.token],s.type="s_open",s.tag="s",s.nesting=1,s.markup="~~",s.content="",s=t.tokens[i.token],s.type="s_close",s.tag="s",s.nesting=-1,s.markup="~~",s.content="",t.tokens[i.token-1].type==="text"&&t.tokens[i.token-1].content==="~"&&c.push(i.token-1));for(;c.length;){for(n=c.pop(),r=n+1;r<t.tokens.length&&t.tokens[r].type==="s_close";)r++;r--,n!==r&&(s=t.tokens[r],t.tokens[r]=t.tokens[n],t.tokens[n]=s)}}ia.postProcess=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(Rv(e,e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&Rv(e,r[n].delimiters)};var sa={};sa.tokenize=function(e,n){var r,o,i,s=e.pos,c=e.src.charCodeAt(s);if(n||c!==95&&c!==42)return!1;for(o=e.scanDelims(e.pos,c===42),r=0;r<o.length;r++)i=e.push("text","",0),i.content=String.fromCharCode(c),e.delimiters.push({marker:c,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 Gv(t,e){var n,r,o,i,s,c,a=e.length;for(n=a-1;n>=0;n--)r=e[n],!(r.marker!==95&&r.marker!==42)&&r.end!==-1&&(o=e[r.end],c=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,s=String.fromCharCode(r.marker),i=t.tokens[r.token],i.type=c?"strong_open":"em_open",i.tag=c?"strong":"em",i.nesting=1,i.markup=c?s+s:s,i.content="",i=t.tokens[o.token],i.type=c?"strong_close":"em_close",i.tag=c?"strong":"em",i.nesting=-1,i.markup=c?s+s:s,i.content="",c&&(t.tokens[e[n-1].token].content="",t.tokens[e[r.end+1].token].content="",n--))}sa.postProcess=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(Gv(e,e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&Gv(e,r[n].delimiters)};var hA=_e.normalizeReference,Au=_e.isSpace,mA=function(e,n){var r,o,i,s,c,a,l,u,f,d="",p="",b=e.pos,g=e.posMax,L=e.pos,m=!0;if(e.src.charCodeAt(e.pos)!==91||(c=e.pos+1,s=e.md.helpers.parseLinkLabel(e,e.pos,!0),s<0))return!1;if(a=s+1,a<g&&e.src.charCodeAt(a)===40){for(m=!1,a++;a<g&&(o=e.src.charCodeAt(a),!(!Au(o)&&o!==10));a++);if(a>=g)return!1;if(L=a,l=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),l.ok){for(d=e.md.normalizeLink(l.str),e.md.validateLink(d)?a=l.pos:d="",L=a;a<g&&(o=e.src.charCodeAt(a),!(!Au(o)&&o!==10));a++);if(l=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<g&&L!==a&&l.ok)for(p=l.str,a=l.pos;a<g&&(o=e.src.charCodeAt(a),!(!Au(o)&&o!==10));a++);}(a>=g||e.src.charCodeAt(a)!==41)&&(m=!0),a++}if(m){if(typeof e.env.references>"u")return!1;if(a<g&&e.src.charCodeAt(a)===91?(L=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(L,a++):a=s+1):a=s+1,i||(i=e.src.slice(c,s)),u=e.env.references[hA(i)],!u)return e.pos=b,!1;d=u.href,p=u.title}return n||(e.pos=c,e.posMax=s,f=e.push("link_open","a",1),f.attrs=r=[["href",d]],p&&r.push(["title",p]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,f=e.push("link_close","a",-1)),e.pos=a,e.posMax=g,!0},vA=_e.normalizeReference,zu=_e.isSpace,yA=function(e,n){var r,o,i,s,c,a,l,u,f,d,p,b,g,L="",m=e.pos,x=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91||(a=e.pos+2,c=e.md.helpers.parseLinkLabel(e,e.pos+1,!1),c<0))return!1;if(l=c+1,l<x&&e.src.charCodeAt(l)===40){for(l++;l<x&&(o=e.src.charCodeAt(l),!(!zu(o)&&o!==10));l++);if(l>=x)return!1;for(g=l,f=e.md.helpers.parseLinkDestination(e.src,l,e.posMax),f.ok&&(L=e.md.normalizeLink(f.str),e.md.validateLink(L)?l=f.pos:L=""),g=l;l<x&&(o=e.src.charCodeAt(l),!(!zu(o)&&o!==10));l++);if(f=e.md.helpers.parseLinkTitle(e.src,l,e.posMax),l<x&&g!==l&&f.ok)for(d=f.str,l=f.pos;l<x&&(o=e.src.charCodeAt(l),!(!zu(o)&&o!==10));l++);else d="";if(l>=x||e.src.charCodeAt(l)!==41)return e.pos=m,!1;l++}else{if(typeof e.env.references>"u")return!1;if(l<x&&e.src.charCodeAt(l)===91?(g=l+1,l=e.md.helpers.parseLinkLabel(e,l),l>=0?s=e.src.slice(g,l++):l=c+1):l=c+1,s||(s=e.src.slice(a,c)),u=e.env.references[vA(s)],!u)return e.pos=m,!1;L=u.href,d=u.title}return n||(i=e.src.slice(a,c),e.md.inline.parse(i,e.md,e.env,b=[]),p=e.push("image","img",0),p.attrs=r=[["src",L],["alt",""]],p.children=b,p.content=i,d&&r.push(["title",d])),e.pos=l,e.posMax=x,!0},bA=/^([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])?)*)$/,IA=/^([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)$/,MA=function(e,n){var r,o,i,s,c,a,l=e.pos;if(e.src.charCodeAt(l)!==60)return!1;for(c=e.pos,a=e.posMax;;){if(++l>=a||(s=e.src.charCodeAt(l),s===60))return!1;if(s===62)break}return r=e.src.slice(c+1,l),IA.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):bA.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},CA=ta.HTML_TAG_RE;function wA(t){return/^<a[>\s]/i.test(t)}function LA(t){return/^<\/a\s*>/i.test(t)}function TA(t){var e=t|32;return e>=97&&e<=122}var xA=function(e,n){var r,o,i,s,c=e.pos;return!e.md.options.html||(i=e.posMax,e.src.charCodeAt(c)!==60||c+2>=i)||(r=e.src.charCodeAt(c+1),r!==33&&r!==63&&r!==47&&!TA(r))||(o=e.src.slice(c).match(CA),!o)?!1:(n||(s=e.push("html_inline","",0),s.content=o[0],wA(s.content)&&e.linkLevel++,LA(s.content)&&e.linkLevel--),e.pos+=o[0].length,!0)},Fv=cv,kA=_e.has,NA=_e.isValidEntityCode,Wv=_e.fromCodePoint,jA=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,SA=/^&([a-z][a-z0-9]{1,31});/i,DA=function(e,n){var r,o,i,s,c=e.pos,a=e.posMax;if(e.src.charCodeAt(c)!==38||c+1>=a)return!1;if(r=e.src.charCodeAt(c+1),r===35){if(i=e.src.slice(c).match(jA),i)return n||(o=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),s=e.push("text_special","",0),s.content=NA(o)?Wv(o):Wv(65533),s.markup=i[0],s.info="entity"),e.pos+=i[0].length,!0}else if(i=e.src.slice(c).match(SA),i&&kA(Fv,i[1]))return n||(s=e.push("text_special","",0),s.content=Fv[i[1]],s.markup=i[0],s.info="entity"),e.pos+=i[0].length,!0;return!1};function Zv(t){var e,n,r,o,i,s,c,a,l={},u=t.length;if(u){var f=0,d=-2,p=[];for(e=0;e<u;e++)if(r=t[e],p.push(0),(t[f].marker!==r.marker||d!==r.token-1)&&(f=e),d=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-p[f]-1,s=n;n>i;n-=p[n]+1)if(o=t[n],o.marker===r.marker&&o.open&&o.end<0&&(c=!1,(o.close||r.open)&&(o.length+r.length)%3===0&&(o.length%3!==0||r.length%3!==0)&&(c=!0),!c)){a=n>0&&!t[n-1].open?p[n-1]+1:0,p[e]=e-n+a,p[n]=a,r.open=!1,o.end=e,o.close=!1,s=-1,d=-2;break}s!==-1&&(l[r.marker][(r.open?3:0)+(r.length||0)%3]=s)}}}var EA=function(e){var n,r=e.tokens_meta,o=e.tokens_meta.length;for(Zv(e.delimiters),n=0;n<o;n++)r[n]&&r[n].delimiters&&Zv(r[n].delimiters)},_A=function(e){var n,r,o=0,i=e.tokens,s=e.tokens.length;for(n=r=0;n<s;n++)i[n].nesting<0&&o--,i[n].level=o,i[n].nesting>0&&o++,i[n].type==="text"&&n+1<s&&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)},Ju=Su,Bv=_e.isWhiteSpace,Hv=_e.isPunctChar,Uv=_e.isMdAsciiPunct;function qi(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}qi.prototype.pushPending=function(){var t=new Ju("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t},qi.prototype.push=function(t,e,n){this.pending&&this.pushPending();var r=new Ju(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},qi.prototype.scanDelims=function(t,e){var n=t,r,o,i,s,c,a,l,u,f,d=!0,p=!0,b=this.posMax,g=this.src.charCodeAt(t);for(r=t>0?this.src.charCodeAt(t-1):32;n<b&&this.src.charCodeAt(n)===g;)n++;return i=n-t,o=n<b?this.src.charCodeAt(n):32,l=Uv(r)||Hv(String.fromCharCode(r)),f=Uv(o)||Hv(String.fromCharCode(o)),a=Bv(r),u=Bv(o),u?d=!1:f&&(a||l||(d=!1)),a?p=!1:l&&(u||f||(p=!1)),e?(s=d,c=p):(s=d&&(!p||l),c=p&&(!d||f)),{can_open:s,can_close:c,length:i}},qi.prototype.Token=Ju;var OA=qi,Yv=ju,Qu=[["text",cA],["linkify",lA],["newline",fA],["escape",pA],["backticks",gA],["strikethrough",ia.tokenize],["emphasis",sa.tokenize],["link",mA],["image",yA],["autolink",MA],["html_inline",xA],["entity",DA]],Ru=[["balance_pairs",EA],["strikethrough",ia.postProcess],["emphasis",sa.postProcess],["fragments_join",_A]];function Xi(){var t;for(this.ruler=new Yv,t=0;t<Qu.length;t++)this.ruler.push(Qu[t][0],Qu[t][1]);for(this.ruler2=new Yv,t=0;t<Ru.length;t++)this.ruler2.push(Ru[t][0],Ru[t][1])}Xi.prototype.skipToken=function(t){var e,n,r=t.pos,o=this.ruler.getRules(""),i=o.length,s=t.md.options.maxNesting,c=t.cache;if(typeof c[r]<"u"){t.pos=c[r];return}if(t.level<s){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++,c[r]=t.pos},Xi.prototype.tokenize=function(t){for(var e,n,r,o=this.ruler.getRules(""),i=o.length,s=t.posMax,c=t.md.options.maxNesting;t.pos<s;){if(r=t.pos,t.level<c){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>=s)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},Xi.prototype.parse=function(t,e,n,r){var o,i,s,c=new this.State(t,e,n,r);for(this.tokenize(c),i=this.ruler2.getRules(""),s=i.length,o=0;o<s;o++)i[o](c)},Xi.prototype.State=OA;var PA=Xi,Gu,Vv;function AA(){return Vv||(Vv=1,Gu=function(t){var e={};t=t||{},e.src_Any=mv().source,e.src_Cc=yv().source,e.src_Z=Mv().source,e.src_P=Lu.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}),Gu}function Fu(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 ca(t){return Object.prototype.toString.call(t)}function zA(t){return ca(t)==="[object String]"}function JA(t){return ca(t)==="[object Object]"}function QA(t){return ca(t)==="[object RegExp]"}function $v(t){return ca(t)==="[object Function]"}function RA(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var qv={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function GA(t){return Object.keys(t||{}).reduce(function(e,n){return e||qv.hasOwnProperty(n)},!1)}var FA={"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}}},WA="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]",ZA="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function BA(t){t.__index__=-1,t.__text_cache__=""}function HA(t){return function(e,n){var r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function Xv(){return function(t,e){e.normalize(t)}}function aa(t){var e=t.re=AA()(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(WA),n.push(e.src_xn),e.src_tlds=n.join("|");function r(c){return c.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(c,a){throw new Error('(LinkifyIt) Invalid schema "'+c+'": '+a)}Object.keys(t.__schemas__).forEach(function(c){var a=t.__schemas__[c];if(a!==null){var l={validate:null,link:null};if(t.__compiled__[c]=l,JA(a)){QA(a.validate)?l.validate=HA(a.validate):$v(a.validate)?l.validate=a.validate:i(c,a),$v(a.normalize)?l.normalize=a.normalize:a.normalize?i(c,a):l.normalize=Xv();return}if(zA(a)){o.push(c);return}i(c,a)}}),o.forEach(function(c){t.__compiled__[t.__schemas__[c]]&&(t.__compiled__[c].validate=t.__compiled__[t.__schemas__[c]].validate,t.__compiled__[c].normalize=t.__compiled__[t.__schemas__[c]].normalize)}),t.__compiled__[""]={validate:null,normalize:Xv()};var s=Object.keys(t.__compiled__).filter(function(c){return c.length>0&&t.__compiled__[c]}).map(RA).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+s+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+s+")","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"),BA(t)}function UA(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 Wu(t,e){var n=new UA(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function Dt(t,e){if(!(this instanceof Dt))return new Dt(t,e);e||GA(t)&&(e=t,t={}),this.__opts__=Fu({},qv,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Fu({},FA,t),this.__compiled__={},this.__tlds__=ZA,this.__tlds_replaced__=!1,this.re={},aa(this)}Dt.prototype.add=function(e,n){return this.__schemas__[e]=n,aa(this),this},Dt.prototype.set=function(e){return this.__opts__=Fu(this.__opts__,e),this},Dt.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var n,r,o,i,s,c,a,l,u;if(this.re.schema_test.test(e)){for(a=this.re.schema_search,a.lastIndex=0;(n=a.exec(e))!==null;)if(i=this.testSchemaAt(e,n[2],a.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&&(s=r.index+r[1].length,(this.__index__<0||s<this.__index__)&&(this.__schema__="",this.__index__=s,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&&(s=o.index+o[1].length,c=o.index+o[0].length,(this.__index__<0||s<this.__index__||s===this.__index__&&c>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=c))),this.__index__>=0},Dt.prototype.pretest=function(e){return this.re.pretest.test(e)},Dt.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0},Dt.prototype.match=function(e){var n=0,r=[];this.__index__>=0&&this.__text_cache__===e&&(r.push(Wu(this,n)),n=this.__last_index__);for(var o=n?e.slice(n):e;this.test(o);)r.push(Wu(this,n)),o=o.slice(this.__last_index__),n+=this.__last_index__;return r.length?r:null},Dt.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,Wu(this,0)):null},Dt.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(),aa(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,aa(this),this)},Dt.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)},Dt.prototype.onCompile=function(){};var YA=Dt;const Ao=2147483647,kn=36,Zu=1,Ki=26,VA=38,$A=700,Kv=72,ey=128,ty="-",qA=/^xn--/,XA=/[^\0-\x7F]/,KA=/[\x2E\u3002\uFF0E\uFF61]/g,e1={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Bu=kn-Zu,Nn=Math.floor,Hu=String.fromCharCode;function mr(t){throw new RangeError(e1[t])}function t1(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function ny(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(KA,".");const o=t.split("."),i=t1(o,e).join(".");return r+i}function Uu(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 ry=t=>String.fromCodePoint(...t),n1=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:kn},oy=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},iy=function(t,e,n){let r=0;for(t=n?Nn(t/$A):t>>1,t+=Nn(t/e);t>Bu*Ki>>1;r+=kn)t=Nn(t/Bu);return Nn(r+(Bu+1)*t/(t+VA))},Yu=function(t){const e=[],n=t.length;let r=0,o=ey,i=Kv,s=t.lastIndexOf(ty);s<0&&(s=0);for(let c=0;c<s;++c)t.charCodeAt(c)>=128&&mr("not-basic"),e.push(t.charCodeAt(c));for(let c=s>0?s+1:0;c<n;){const a=r;for(let u=1,f=kn;;f+=kn){c>=n&&mr("invalid-input");const d=n1(t.charCodeAt(c++));d>=kn&&mr("invalid-input"),d>Nn((Ao-r)/u)&&mr("overflow"),r+=d*u;const p=f<=i?Zu:f>=i+Ki?Ki:f-i;if(d<p)break;const b=kn-p;u>Nn(Ao/b)&&mr("overflow"),u*=b}const l=e.length+1;i=iy(r-a,l,a==0),Nn(r/l)>Ao-o&&mr("overflow"),o+=Nn(r/l),r%=l,e.splice(r++,0,o)}return String.fromCodePoint(...e)},Vu=function(t){const e=[];t=Uu(t);const n=t.length;let r=ey,o=0,i=Kv;for(const a of t)a<128&&e.push(Hu(a));const s=e.length;let c=s;for(s&&e.push(ty);c<n;){let a=Ao;for(const u of t)u>=r&&u<a&&(a=u);const l=c+1;a-r>Nn((Ao-o)/l)&&mr("overflow"),o+=(a-r)*l,r=a;for(const u of t)if(u<r&&++o>Ao&&mr("overflow"),u===r){let f=o;for(let d=kn;;d+=kn){const p=d<=i?Zu:d>=i+Ki?Ki:d-i;if(f<p)break;const b=f-p,g=kn-p;e.push(Hu(oy(p+b%g,0))),f=Nn(b/g)}e.push(Hu(oy(f,0))),i=iy(o,l,c===s),o=0,++c}++o,++r}return e.join("")},sy=function(t){return ny(t,function(e){return qA.test(e)?Yu(e.slice(4).toLowerCase()):e})},cy=function(t){return ny(t,function(e){return XA.test(e)?"xn--"+Vu(e):e})},r1=YI(Object.freeze(Object.defineProperty({__proto__:null,decode:Yu,default:{version:"2.3.1",ucs2:{decode:Uu,encode:ry},decode:Yu,encode:Vu,toASCII:cy,toUnicode:sy},encode:Vu,toASCII:cy,toUnicode:sy,ucs2decode:Uu,ucs2encode:ry},Symbol.toStringTag,{value:"Module"})));var o1={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},i1={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"]}}},s1={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"]}}},es=_e,c1=Xc,a1=nP,l1=xP,u1=iA,f1=PA,d1=YA,Fr=Eo,ay=r1,p1={default:o1,zero:i1,commonmark:s1},g1=/^(vbscript|javascript|file|data):/,h1=/^data:image\/(gif|png|jpeg|webp);/;function m1(t){var e=t.trim().toLowerCase();return g1.test(e)?!!h1.test(e):!0}var ly=["http:","https:","mailto:"];function v1(t){var e=Fr.parse(t,!0);if(e.hostname&&(!e.protocol||ly.indexOf(e.protocol)>=0))try{e.hostname=ay.toASCII(e.hostname)}catch{}return Fr.encode(Fr.format(e))}function y1(t){var e=Fr.parse(t,!0);if(e.hostname&&(!e.protocol||ly.indexOf(e.protocol)>=0))try{e.hostname=ay.toUnicode(e.hostname)}catch{}return Fr.decode(Fr.format(e),Fr.decode.defaultChars+"%")}function Ft(t,e){if(!(this instanceof Ft))return new Ft(t,e);e||es.isString(t)||(e=t||{},t="default"),this.inline=new f1,this.block=new u1,this.core=new l1,this.renderer=new a1,this.linkify=new d1,this.validateLink=m1,this.normalizeLink=v1,this.normalizeLinkText=y1,this.utils=es,this.helpers=es.assign({},c1),this.options={},this.configure(t),e&&this.set(e)}Ft.prototype.set=function(t){return es.assign(this.options,t),this},Ft.prototype.configure=function(t){var e=this,n;if(es.isString(t)&&(n=t,t=p1[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},Ft.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},Ft.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},Ft.prototype.use=function(t){var e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this},Ft.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},Ft.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)},Ft.prototype.parseInline=function(t,e){var n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens},Ft.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};var b1=Ft,I1=b1;const M1=fi(I1);var $u=(t=>(t.Assistant="assistant",t.System="system",t.User="user",t))($u||{});const C1={class:"message-content user"},w1=["innerHTML"],L1={class:"message-photo user"},T1=["src"],x1=Oe("span",{class:"message-photo ai"},[Oe("i",{class:"ai-blueking-icon ai-blueking-ai"})],-1),k1={class:"message-content ai"},N1={key:1,width:"18",height:"18",class:"loading-message","aria-hidden":"true"},j1=[Oe("use",{"xlink:href":"#ai-blueking-loading-2"},null,-1)],S1={key:2,class:"message-wrap"},D1=["innerHTML"],E1=Lt({__name:"render-message",props:{message:{},userPhoto:{default:Bd}},setup(t){const e=t,n=_t(()=>{var i;const o={error:"ai-blueking-icon ai-blueking-warning-circle-fill",loading:"",success:""};return(i=e.message)!=null&&i.status?o[e.message.status]:""}),r=_t(()=>{if(e.message.content){const i=new M1().render(e.message.content);return EO.sanitize(i)}return""});return(o,i)=>(Fe(),ft("li",{class:Ur([o.message.role,"message-main"])},[o.message.role===Ge($u).User?(Fe(),ft($e,{key:0},[Oe("p",C1,[Oe("span",{class:"markdown-message",innerHTML:r.value},null,8,w1)]),Oe("span",L1,[Oe("img",{src:o.userPhoto},null,8,T1)])],64)):(Fe(),ft($e,{key:1},[x1,Oe("p",k1,[n.value?(Fe(),ft("i",{key:0,class:Ur(n.value)},null,2)):qa("v-if",!0),o.message.status==="loading"?(Fe(),ft("svg",N1,j1)):qa("v-if",!0),o.message.status==="error"?(Fe(),ft("span",S1,ls(o.message.content),1)):(Fe(),ft("span",{key:3,class:"markdown-message",innerHTML:r.value},null,8,D1))])],64))],2))}}),_1={class:"prompt-list"},O1={class:"search-group"},P1=["onClick"],A1={class:"prompt-content"},z1=Lt({__name:"render-send",props:{prompts:{},value:{}},emits:["update:value","enter","choose-prompt"],setup(t,{emit:e}){const n=t,r=e,o=cO,i=Zc,s=Bt(""),c=Bt(40),a=Bt(),l=Bt(!1),u=_t(()=>{var C;return((C=n.prompts)==null?void 0:C.filter(S=>S.content.includes(s.value)))||[]}),f=C=>{r("update:value",C)},d=()=>{var C;n.value==="/"&&((C=n.prompts)!=null&&C.length)?m():x()},p=()=>{let S=24+n.value.split(/\r?\n/).length*16;S>=200&&(S=200),c.value=S},b=C=>{r("update:value",C.content),r("choose-prompt",C),x(),L()},g=(C,S)=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),r("enter"))},L=()=>{var S;const C=(S=a.value)==null?void 0:S.$el.querySelector("textarea");C==null||C.focus()},m=()=>{l.value=!0},x=()=>{l.value=!1};return _n(()=>n.value,()=>{p(),d()}),Vr(L),(C,S)=>(Fe(),Kr(Ge(rm),{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:Yo(()=>{var D;return[Oe("div",null,[on((Fe(),ft("section",_1,[Ee(Ge(Hm),{class:"input-search",modelValue:s.value,"onUpdate:modelValue":S[0]||(S[0]=T=>s.value=T),behavior:"simplicity",clearable:""},null,8,["modelValue"]),Oe("section",O1,[(Fe(!0),ft($e,null,ed(u.value,(T,G)=>on((Fe(),ft("span",{class:"group-prompt",key:G,onClick:U=>b(T)},[Oe("span",A1,ls(T.content),1)],8,P1)),[[Ge(i),{content:T.content,placement:"right",theme:"light",width:300,zIndex:9999999,extCls:"prompt-popover ai-blueking-popover ai-blueking-pop2-content"}]])),128)),(D=u.value)!=null&&D.length?qa("v-if",!0):(Fe(),Kr(Ge(uO),{key:0,class:"exception-wrap-item exception-part",scene:"part",type:"search-empty"}))])])),[[Ge(o),x]])])]}),default:Yo(()=>{var D;return[Oe("section",{style:Ir({width:"calc(100% - 84px)","margin-right":"7px","--text-height":c.value+"px"})},[Ee(Ge(Hm),{ref_key:"inputRef",ref:a,class:"send-prompt",clearable:!0,"model-value":C.value,"native-attributes":{autofocus:"autofocus"},placeholder:(D=C.prompts)!=null&&D.length?Ge(Yn)("您可以键入 “/” 查看更多Prompt"):Ge(Yn)("请输入"),row:"1",type:"textarea",onInput:f,onKeydown:g},null,8,["model-value","placeholder"])],4)]}),_:1},8,["is-show"]))}}),qu=(t,e)=>{const n=t.__vccOpts||t;for(const[r,o]of e)n[r]=o;return n},J1=qu(z1,[["__scopeId","data-v-f2501723"]]),Q1=t=>(l0("data-v-7a07ab7e"),t=t(),u0(),t),R1={class:"ai-operation"},G1=Q1(()=>Oe("i",{class:"ai-blueking-icon ai-blueking-fasong"},null,-1)),F1=qu(Lt({__name:"render-content",props:{messages:{},prompts:{},loading:{type:Boolean},background:{default:"#f5f7fa"},userPhoto:{}},emits:["send","choose-prompt","scroll"],setup(t,{emit:e}){const n=t,r=e,o=Zc,i=Bt(""),s=()=>{Ho(()=>{const u=document.querySelector(".ai-blueking-messages");u.scrollTop=u.scrollHeight})},c=()=>{n.loading||(r("send",i.value),i.value="")},a=u=>{r("choose-prompt",u)},l=u=>{r("scroll",u)};return _n(()=>n.messages,s,{deep:!0,immediate:!0}),(u,f)=>(Fe(),ft("section",{style:Ir({background:u.background}),class:"ai-content"},[Oe("ul",{class:"ai-messages ai-blueking-messages",onScroll:l},[(Fe(!0),ft($e,null,ed(u.messages,d=>(Fe(),Kr(E1,{class:"ai-message",key:d.content,message:d,"user-photo":u.userPhoto},null,8,["message","user-photo"]))),128))],32),on((Fe(),ft("section",R1,[Ee(J1,{value:i.value,"onUpdate:value":f[0]||(f[0]=d=>i.value=d),prompts:u.prompts,onChoosePrompt:a,onEnter:c},null,8,["value","prompts"]),Ee(Ge(KD),{class:"ai-operation-button",disabled:u.loading||!i.value,size:"large",theme:"primary",onClick:c},{default:Yo(()=>[G1,Ss(" "+ls(Ge(Yn)("发送")),1)]),_:1},8,["disabled"])])),[[Ge(o),{content:Ge(Yn)("内容正在执行中,请执行完成后再输入"),disabled:!u.loading,extCls:"ai-tooltips ai-blueking-popover ai-blueking-pop2-content"}]])],4))}}),[["__scopeId","data-v-7a07ab7e"]]),W1=qu(Lt({__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"},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=Zc,i={height:window.innerHeight,width:window.innerWidth},s={isMove:!1,type:"",clientX:0,clientY:0},c=()=>{var V,A,P,E;const W=(F,$)=>F===void 0?$:F;return{top:W((V=n.startPosition)==null?void 0:V.top,i.height-n.sizeLimit.height),bottom:W((A=n.startPosition)==null?void 0:A.bottom,0),left:W((P=n.startPosition)==null?void 0:P.left,0),right:W((E=n.startPosition)==null?void 0:E.right,i.width-n.sizeLimit.width)}},a=Bt(c()),l=_t(()=>a.value.top<=n.positionLimit.top&&a.value.bottom<=n.positionLimit.bottom),u=W=>{s.isMove=!0,s.type="move",s.clientX=W.clientX,s.clientY=W.clientY},f=W=>{s.isMove=!0,s.type="rightDrag",s.clientX=W.clientX},d=W=>{s.isMove=!0,s.type="leftDrag",s.clientX=W.clientX},p=W=>{s.isMove=!0,s.type="topDrag",s.clientY=W.clientY},b=W=>{s.isMove=!0,s.type="bottomDrag",s.clientY=W.clientY},g=W=>{s.isMove=!0,s.type="topLeftDrag",s.clientY=W.clientY,s.clientX=W.clientX},L=W=>{s.isMove=!0,s.type="topRightDrag",s.clientY=W.clientY,s.clientX=W.clientX},m=W=>{s.isMove=!0,s.type="bottomLeftDrag",s.clientY=W.clientY,s.clientX=W.clientX},x=W=>{s.isMove=!0,s.type="bottomRightDrag",s.clientY=W.clientY,s.clientX=W.clientX},C=()=>{s.isMove=!1},S=(W,V)=>{["move","leftDrag"].includes(s.type)&&(a.value.left+=W),["move","rightDrag"].includes(s.type)&&(a.value.right-=W),["move","topDrag"].includes(s.type)&&(a.value.top+=V),["move","bottomDrag"].includes(s.type)&&(a.value.bottom-=V),["topLeftDrag"].includes(s.type)&&(a.value.left+=W,a.value.top+=V),["topRightDrag"].includes(s.type)&&(a.value.right-=W,a.value.top+=V),["bottomLeftDrag"].includes(s.type)&&(a.value.left+=W,a.value.bottom-=V),["bottomRightDrag"].includes(s.type)&&(a.value.right-=W,a.value.bottom-=V)},D=(W,V)=>{const{top:A,bottom:P,left:E,right:F}=a.value;(i.width-E-F<n.sizeLimit.width||E<n.positionLimit.left||F<n.positionLimit.right)&&(["move","leftDrag","topLeftDrag","bottomLeftDrag"].includes(s.type)&&(a.value.left-=W),["move","rightDrag","topRightDrag","bottomRightDrag"].includes(s.type)&&(a.value.right+=W)),(i.height-A-P<n.sizeLimit.height||A<n.positionLimit.top||P<n.positionLimit.bottom)&&(["move","topDrag","topRightDrag","topLeftDrag"].includes(s.type)&&(a.value.top-=V),["move","bottomDrag","bottomLeftDrag","bottomRightDrag"].includes(s.type)&&(a.value.bottom+=V))},T=W=>{if(!s.isMove)return;W.preventDefault();const V=W.clientX-s.clientX,A=W.clientY-s.clientY;S(V,A),D(V,A),s.clientX=W.clientX,s.clientY=W.clientY},G=()=>{i.height=window.innerHeight,i.width=window.innerWidth,a.value=c()},U=()=>{a.value.top=n.positionLimit.top,a.value.bottom=n.positionLimit.bottom},te=()=>{a.value.top=i.height-n.sizeLimit.height,a.value.bottom=n.positionLimit.bottom},Q=()=>{r("clear")},K=()=>{r("close")};return Xf(()=>{window.addEventListener("mousemove",T,!0),window.addEventListener("mouseup",C),window.addEventListener("resize",G)}),$r(()=>{window.removeEventListener("mousemove",T,!0),window.removeEventListener("mouseup",C),window.removeEventListener("resize",G)}),(W,V)=>(Fe(),ft("section",{style:Ir({top:a.value.top+"px",bottom:a.value.bottom+"px",left:a.value.left+"px",right:a.value.right+"px"}),class:"ai-modal"},[Oe("header",{style:Ir({background:W.headBackground}),class:"ai-modal-header",onMousedown:Pn(u,["stop"])},[Oe("span",null,[Oe("i",{class:Ur(W.logo)},null,2),Ss(" "+ls(Ge(Yn)("小鲸")),1)]),Oe("span",null,[l.value?on((Fe(),ft("i",{key:0,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxiajuhe",onClick:te},null,512)),[[Ge(o),{content:Ge(Yn)("向下收缩"),distance:20,extCls:"ai-tooltips ai-blueking-popover ai-blueking-pop2-content"}]]):on((Fe(),ft("i",{key:1,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxialashen-2",onClick:U},null,512)),[[Ge(o),{content:Ge(Yn)("向上扩展"),distance:20,extCls:"ai-tooltips ai-blueking-popover ai-blueking-pop2-content"}]]),on(Oe("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-saoba",onClick:Q},null,512),[[Ge(o),{content:Ge(Yn)("清空聊天记录"),distance:20,extCls:"ai-tooltips ai-blueking-popover ai-blueking-pop2-content"}]]),on(Oe("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-shanchu-2",onClick:K},null,512),[[Ge(o),{content:Ge(Yn)("关闭"),distance:20,extCls:"ai-tooltips ai-blueking-popover ai-blueking-pop2-content"}]])])],36),E0(W.$slots,"default",{},void 0),Oe("span",{class:"drag-line left",onMousedown:Pn(d,["stop"])},null,32),Oe("span",{class:"drag-line right",onMousedown:Pn(f,["stop"])},null,32),Oe("span",{class:"drag-line top",onMousedown:Pn(p,["stop"])},null,32),Oe("span",{class:"drag-line bottom",onMousedown:Pn(b,["stop"])},null,32),Oe("span",{class:"drag-line top-left-corner",onMousedown:Pn(g,["stop"])},null,32),Oe("span",{class:"drag-line top-right-corner",onMousedown:Pn(L,["stop"])},null,32),Oe("span",{class:"drag-line bottom-left-corner",onMousedown:Pn(m,["stop"])},null,32),Oe("span",{class:"drag-line bottom-right-corner",onMousedown:Pn(x,["stop"])},null,32)],4))}}),[["__scopeId","data-v-de00de78"]]),Z1=Lt({__name:"ai-blueking",props:{messages:{},prompts:{},loading:{type:Boolean},headBackground:{},background:{},positionLimit:{},sizeLimit:{},startPosition:{},userPhoto:{},logo:{}},emits:["clear","close","send","choose-prompt","scroll"],setup(t,{emit:e}){const n=e,r=()=>{n("clear")},o=()=>{n("close")},i=a=>{n("send",a)},s=a=>{n("choose-prompt",a)},c=a=>{n("scroll",a)};return(a,l)=>(Fe(),Kr(W1,{"head-background":a.headBackground,logo:a.logo,"position-limit":a.positionLimit,"size-limit":a.sizeLimit,"start-position":a.startPosition,onClear:r,onClose:o},{default:Yo(()=>[Ee(F1,{background:a.background,loading:a.loading,messages:a.messages,prompts:a.prompts,"user-photo":a.userPhoto,onChoosePrompt:s,onScroll:c,onSend:i},null,8,["background","loading","messages","prompts","user-photo"])]),_:1},8,["head-background","logo","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></svg>';document.body?document.body.insertAdjacentHTML("afterbegin",t):document.addEventListener("DOMContentLoaded",function(){document.body.insertAdjacentHTML("afterbegin",t)})})(),DS({prefix:"ai-blueking"});const B1={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:Bd,type:String},logo:{default:"ai-blueking-icon ai-blueking-ai",type:String}},data(){return{app:null,unWatchStack:[]}},watch:{messages:{handler(){this.$nextTick(()=>{const t=document.querySelector(".ai-blueking-messages");t.scrollTop=t.scrollHeight})},deep:!0,immediate:!0}},created(){const t=this.$emit.bind(this);let e=null;const n=this;this.app=Ps({render(){return e=this,nr(Z1,{messages: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,startPosition:n.startPosition,onClear(){t("clear",...arguments)},onClose(){t("close",...arguments)},onSend(){t("send",...arguments)},onChoosePrompt(){t("choose-prompt",...arguments)},onScroll(){t("scroll",...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()}};return is.RoleType=$u,is.default=B1,Object.defineProperties(is,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),is}({});