| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- var vt=Object.defineProperty;var St=(c,e,t)=>e in c?vt(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t;var I=(c,e,t)=>St(c,typeof e!="symbol"?e+"":e,t);import{_ as P,o as v,d as E,e as C,t as qe,c as te,f as D,h as W,l as $t,m as Z,g as j,w as Y,n as At,p as nt,M as st,k as _e,F as Te,q as Re,s as fe,r as F,v as Be,x as Ct,y as ze,z as Le,A as Tt,B as Rt,u as It,C as Et,i as qt}from"./index-CAiT_9zb.js";import{L as Bt}from"./LayoutExperience-CQj2Gfes.js";import{C as zt}from"./ContentContainer-D_D4NfTU.js";import{C as Lt}from"./ChatAsideMenu-CoVzTM1H.js";import{u as it}from"./use-all-agents-B4j_CH5Z.js";import{j as ot,a as He}from"./icon-map-WRw1Tr5g.js";import{g as rt,a as me}from"./get-icon-4-dialog-DrrNyWJ9.js";import"./Header-DwUZU9kb.js";import"./Header.vue_vue_type_style_index_0_scoped_0b4b82f2_lang-CmyFc8-Z.js";import"./use-current-user-0TcEUpoc.js";/* empty css */import"./intelligent-frame8-D_OmWET8.js";const Dt={},Pt={class:"dialog-aside-left"};function Ft(c,e){return v(),E("div",Pt,e[0]||(e[0]=[C("div",null,null,-1)]))}const Mt=P(Dt,[["render",Ft],["__scopeId","data-v-c656b8f9"]]),Ot={class:"dialog-header"},jt={__name:"DialogHeader",props:{agent_info:Object},setup(c){return(e,t)=>(v(),E("div",Ot,[C("div",null,qe(c.agent_info.agent.name),1)]))}},Nt=P(jt,[["__scopeId","data-v-54c912dd"]]),Ut={class:"dialog-welcome-content"},Ht={__name:"DialogWelcome",props:{agent_info:Object},setup(c){return(e,t)=>(v(),E("div",Ut,t[0]||(t[0]=[C("div",null,null,-1)])))}},Qt=P(Ht,[["__scopeId","data-v-f217c60a"]]),Wt={class:"dialog-item-select question-select"},Zt={__name:"BtnSelectItem",props:{is_selected:Boolean},emits:["change"],setup(c,{emit:e}){return(t,n)=>(v(),E("div",Wt))}},at=P(Zt,[["__scopeId","data-v-b88b55f4"]]),Vt={class:"dialog-chat-answer-content"},Gt={key:0},Jt=["innerHTML"],Xt={__name:"DialogContent",props:{type:String,content:String,is_loading:Boolean},setup(c){return(e,t)=>{const n=te("a-spin");return v(),E("div",Vt,[c.is_loading?(v(),E("div",Gt,[D(n)])):W("",!0),c.is_loading?W("",!0):(v(),E("div",{key:1,innerHTML:c.content},null,8,Jt)),$t(e.$slots,"default",{},void 0,!0)])}}},lt=P(Xt,[["__scopeId","data-v-f4c95850"]]),Kt={class:"dialog-item dialog-question"},Yt={class:"dialog-main question-main"},en={class:"dialog-content question-content"},tn={class:"dialog-icon question-icon"},nn=["src"],sn={__name:"DialogQuestion",props:{show_select:!0,question:Object},emits:["select"],setup(c,{emit:e}){const t=c,n=Z(()=>t.show_select===!0),a=e,i=()=>{a("select")};return(l,s)=>(v(),E("div",Kt,[n.value?(v(),j(at,{key:0,onChange:i})):W("",!0),C("div",Yt,[C("div",en,[C("div",null,[D(lt,{content:c.question.content,class:"question-content-core-text"},null,8,["content"])])]),C("div",tn,[C("img",{src:c.question.client_custom_icon},null,8,nn)])])]))}},on=P(sn,[["__scopeId","data-v-6f3c947e"]]),rn={class:"dialog-actions-container"},an={class:"dialog-action-part dialog-action-left"},ln={__name:"DialogActions",emits:["copy","retry","share"],setup(c,{emit:e}){const t=e,n=()=>{t("copy")};return(a,i)=>{const l=te("icon-copy"),s=te("a-tooltip");return v(),E("div",rn,[C("div",an,[D(s,{content:"复制",position:"right"},{default:Y(()=>[C("div",{class:"action-btn-item",onClick:n},[D(l,{size:"22"})])]),_:1})]),i[0]||(i[0]=C("div",{class:"dialog-action-part dialog-action-right"},[C("div",{class:"action-btn-item"})],-1))])}}},cn=P(ln,[["__scopeId","data-v-8542f408"]]),un={__name:"BtnStopChat",emits:["stop"],setup(c,{emit:e}){const t=e,n=()=>{t("stop")};return(a,i)=>(v(),E("div",{class:"btn-chat-stop-generate",onClick:n},"停止生成"))}},pn=P(un,[["__scopeId","data-v-65272300"]]);function De(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let se=De();function ct(c){se=c}const ae={exec:()=>null};function R(c,e=""){let t=typeof c=="string"?c:c.source;const n={replace:(a,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(U.caret,"$1"),t=t.replace(a,l),n},getRegex:()=>new RegExp(t,e)};return n}const U={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:c=>new RegExp(`^( {0,3}${c})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}#`),htmlBeginRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}<(?:[a-z].*>|!--)`,"i")},fn=/^(?:[ \t]*(?:\n|$))+/,hn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,dn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ce=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,gn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ut=/(?:[*+-]|\d{1,9}[.)])/,pt=R(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ut).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),Pe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,_n=/^[^\n]+/,Fe=/(?!\s*\])(?:\\.|[^\[\]\\])+/,mn=R(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Fe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),kn=R(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ut).getRegex(),ke="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Me=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,yn=R("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Me).replace("tag",ke).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ft=R(Pe).replace("hr",ce).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ke).getRegex(),bn=R(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ft).getRegex(),Oe={blockquote:bn,code:hn,def:mn,fences:dn,heading:gn,hr:ce,html:yn,lheading:pt,list:kn,newline:fn,paragraph:ft,table:ae,text:_n},Qe=R("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ce).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ke).getRegex(),xn={...Oe,table:Qe,paragraph:R(Pe).replace("hr",ce).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ke).getRegex()},wn={...Oe,html:R(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Me).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ae,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:R(Pe).replace("hr",ce).replace("heading",` *#{1,6} *[^
- ]`).replace("lheading",pt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ht=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,dt=/^( {2,}|\\)\n(?!\s*$)/,Sn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ye=/[\p{P}\p{S}]/u,je=/[\s\p{P}\p{S}]/u,gt=/[^\s\p{P}\p{S}]/u,$n=R(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,je).getRegex(),An=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Cn=R(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,"u").replace(/punct/g,ye).getRegex(),Tn=R("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,gt).replace(/punctSpace/g,je).replace(/punct/g,ye).getRegex(),Rn=R("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,gt).replace(/punctSpace/g,je).replace(/punct/g,ye).getRegex(),In=R(/\\(punct)/,"gu").replace(/punct/g,ye).getRegex(),En=R(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),qn=R(Me).replace("(?:-->|$)","-->").getRegex(),Bn=R("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",qn).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),he=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,zn=R(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",he).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_t=R(/^!?\[(label)\]\[(ref)\]/).replace("label",he).replace("ref",Fe).getRegex(),mt=R(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fe).getRegex(),Ln=R("reflink|nolink(?!\\()","g").replace("reflink",_t).replace("nolink",mt).getRegex(),Ne={_backpedal:ae,anyPunctuation:In,autolink:En,blockSkip:An,br:dt,code:vn,del:ae,emStrongLDelim:Cn,emStrongRDelimAst:Tn,emStrongRDelimUnd:Rn,escape:ht,link:zn,nolink:mt,punctuation:$n,reflink:_t,reflinkSearch:Ln,tag:Bn,text:Sn,url:ae},Dn={...Ne,link:R(/^!?\[(label)\]\((.*?)\)/).replace("label",he).getRegex(),reflink:R(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he).getRegex()},Ie={...Ne,escape:R(ht).replace("])","~|])").getRegex(),url:R(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Pn={...Ie,br:R(dt).replace("{2,}","*").getRegex(),text:R(Ie.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},pe={normal:Oe,gfm:xn,pedantic:wn},oe={normal:Ne,gfm:Ie,breaks:Pn,pedantic:Dn},Fn={"&":"&","<":"<",">":">",'"':""","'":"'"},We=c=>Fn[c];function K(c,e){if(e){if(U.escapeTest.test(c))return c.replace(U.escapeReplace,We)}else if(U.escapeTestNoEncode.test(c))return c.replace(U.escapeReplaceNoEncode,We);return c}function Ze(c){try{c=encodeURI(c).replace(U.percentDecode,"%")}catch{return null}return c}function Ve(c,e){var i;const t=c.replace(U.findPipe,(l,s,f)=>{let o=!1,r=s;for(;--r>=0&&f[r]==="\\";)o=!o;return o?"|":" |"}),n=t.split(U.splitPipe);let a=0;if(n[0].trim()||n.shift(),n.length>0&&!((i=n.at(-1))!=null&&i.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;a<n.length;a++)n[a]=n[a].trim().replace(U.slashPipe,"|");return n}function re(c,e,t){const n=c.length;if(n===0)return"";let a=0;for(;a<n;){const i=c.charAt(n-a-1);if(i===e&&!t)a++;else if(i!==e&&t)a++;else break}return c.slice(0,n-a)}function Mn(c,e){if(c.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<c.length;n++)if(c[n]==="\\")n++;else if(c[n]===e[0])t++;else if(c[n]===e[1]&&(t--,t<0))return n;return-1}function Ge(c,e,t,n,a){const i=e.href,l=e.title||null,s=c[1].replace(a.other.outputLinkReplace,"$1");if(c[0].charAt(0)!=="!"){n.state.inLink=!0;const f={type:"link",raw:t,href:i,title:l,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,f}return{type:"image",raw:t,href:i,title:l,text:s}}function On(c,e,t){const n=c.match(t.other.indentCodeCompensation);if(n===null)return e;const a=n[1];return e.split(`
- `).map(i=>{const l=i.match(t.other.beginningSpace);if(l===null)return i;const[s]=l;return s.length>=a.length?i.slice(a.length):i}).join(`
- `)}class de{constructor(e){I(this,"options");I(this,"rules");I(this,"lexer");this.options=e||se}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:re(n,`
- `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],a=On(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:a}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){const a=re(n,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(n=a.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:re(t[0],`
- `)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=re(t[0],`
- `).split(`
- `),a="",i="";const l=[];for(;n.length>0;){let s=!1;const f=[];let o;for(o=0;o<n.length;o++)if(this.rules.other.blockquoteStart.test(n[o]))f.push(n[o]),s=!0;else if(!s)f.push(n[o]);else break;n=n.slice(o);const r=f.join(`
- `),u=r.replace(this.rules.other.blockquoteSetextReplace,`
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
- ${r}`:r,i=i?`${i}
- ${u}`:u;const p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,l,!0),this.lexer.state.top=p,n.length===0)break;const h=l.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){const d=h,g=d.raw+`
- `+n.join(`
- `),_=this.blockquote(g);l[l.length-1]=_,a=a.substring(0,a.length-d.raw.length)+_.raw,i=i.substring(0,i.length-d.text.length)+_.text;break}else if((h==null?void 0:h.type)==="list"){const d=h,g=d.raw+`
- `+n.join(`
- `),_=this.list(g);l[l.length-1]=_,a=a.substring(0,a.length-h.raw.length)+_.raw,i=i.substring(0,i.length-d.raw.length)+_.raw,n=g.substring(l.at(-1).raw.length).split(`
- `);continue}}return{type:"blockquote",raw:a,tokens:l,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const a=n.length>1,i={type:"list",raw:"",ordered:a,start:a?+n.slice(0,-1):"",loose:!1,items:[]};n=a?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=a?n:"[*+-]");const l=this.rules.other.listItemRegex(n);let s=!1;for(;e;){let o=!1,r="",u="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let p=t[2].split(`
- `,1)[0].replace(this.rules.other.listReplaceTabs,S=>" ".repeat(3*S.length)),h=e.split(`
- `,1)[0],d=!p.trim(),g=0;if(this.options.pedantic?(g=2,u=p.trimStart()):d?g=t[1].length+1:(g=t[2].search(this.rules.other.nonSpaceChar),g=g>4?1:g,u=p.slice(g),g+=t[1].length),d&&this.rules.other.blankLine.test(h)&&(r+=h+`
- `,e=e.substring(h.length+1),o=!0),!o){const S=this.rules.other.nextBulletRegex(g),B=this.rules.other.hrRegex(g),z=this.rules.other.fencesBeginRegex(g),$=this.rules.other.headingBeginRegex(g),L=this.rules.other.htmlBeginRegex(g);for(;e;){const H=e.split(`
- `,1)[0];let M;if(h=H,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),M=h):M=h.replace(this.rules.other.tabCharGlobal," "),z.test(h)||$.test(h)||L.test(h)||S.test(h)||B.test(h))break;if(M.search(this.rules.other.nonSpaceChar)>=g||!h.trim())u+=`
- `+M.slice(g);else{if(d||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||z.test(p)||$.test(p)||B.test(p))break;u+=`
- `+h}!d&&!h.trim()&&(d=!0),r+=H+`
- `,e=e.substring(H.length+1),p=M.slice(g)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(s=!0));let _=null,y;this.options.gfm&&(_=this.rules.other.listIsTask.exec(u),_&&(y=_[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!_,checked:y,loose:!1,text:u,tokens:[]}),i.raw+=r}const f=i.items.at(-1);if(f)f.raw=f.raw.trimEnd(),f.text=f.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let o=0;o<i.items.length;o++)if(this.lexer.state.top=!1,i.items[o].tokens=this.lexer.blockTokens(i.items[o].text,[]),!i.loose){const r=i.items[o].tokens.filter(p=>p.type==="space"),u=r.length>0&&r.some(p=>this.rules.other.anyLine.test(p.raw));i.loose=u}if(i.loose)for(let o=0;o<i.items.length;o++)i.items[o].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:a,title:i}}}table(e){var s;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const n=Ve(t[1]),a=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(s=t[3])!=null&&s.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
- `):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===a.length){for(const f of a)this.rules.other.tableAlignRight.test(f)?l.align.push("right"):this.rules.other.tableAlignCenter.test(f)?l.align.push("center"):this.rules.other.tableAlignLeft.test(f)?l.align.push("left"):l.align.push(null);for(let f=0;f<n.length;f++)l.header.push({text:n[f],tokens:this.lexer.inline(n[f]),header:!0,align:l.align[f]});for(const f of i)l.rows.push(Ve(f,l.header.length).map((o,r)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:l.align[r]})));return l}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const l=re(n.slice(0,-1),"\\");if((n.length-l.length)%2===0)return}else{const l=Mn(t[2],"()");if(l>-1){const f=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,f).trim(),t[3]=""}}let a=t[2],i="";if(this.options.pedantic){const l=this.rules.other.pedanticHrefTitle.exec(a);l&&(a=l[1],i=l[3])}else i=t[3]?t[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?a=a.slice(1):a=a.slice(1,-1)),Ge(t,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const a=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[a.toLowerCase()];if(!i){const l=n[0].charAt(0);return{type:"text",raw:l,text:l}}return Ge(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let a=this.rules.inline.emStrongLDelim.exec(e);if(!a||a[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(a[1]||a[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const l=[...a[0]].length-1;let s,f,o=l,r=0;const u=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+l);(a=u.exec(t))!=null;){if(s=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!s)continue;if(f=[...s].length,a[3]||a[4]){o+=f;continue}else if((a[5]||a[6])&&l%3&&!((l+f)%3)){r+=f;continue}if(o-=f,o>0)continue;f=Math.min(f,f+o+r);const p=[...a[0]][0].length,h=e.slice(0,l+a.index+p+f);if(Math.min(l,f)%2){const g=h.slice(1,-1);return{type:"em",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}const d=h.slice(2,-2);return{type:"strong",raw:h,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," ");const a=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return a&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,a;return t[2]==="@"?(n=t[1],a="mailto:"+n):(n=t[1],a=n),{type:"link",raw:t[0],text:n,href:a,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let a,i;if(t[2]==="@")a=t[0],i="mailto:"+a;else{let l;do l=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(l!==t[0]);a=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:a,href:i,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}}class V{constructor(e){I(this,"tokens");I(this,"options");I(this,"state");I(this,"tokenizer");I(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||se,this.options.tokenizer=this.options.tokenizer||new de,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:U,block:pe.normal,inline:oe.normal};this.options.pedantic?(t.block=pe.pedantic,t.inline=oe.pedantic):this.options.gfm&&(t.block=pe.gfm,this.options.breaks?t.inline=oe.breaks:t.inline=oe.gfm),this.tokenizer.rules=t}static get rules(){return{block:pe,inline:oe}}static lex(e,t){return new V(t).lex(e)}static lexInline(e,t){return new V(t).inlineTokens(e)}lex(e){e=e.replace(U.carriageReturn,`
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){var a,i,l;for(this.options.pedantic&&(e=e.replace(U.tabCharGlobal," ").replace(U.spaceLine,""));e;){let s;if((i=(a=this.options.extensions)==null?void 0:a.block)!=null&&i.some(o=>(s=o.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);const o=t.at(-1);s.raw.length===1&&o!==void 0?o.raw+=`
- `:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);const o=t.at(-1);(o==null?void 0:o.type)==="paragraph"||(o==null?void 0:o.type)==="text"?(o.raw+=`
- `+s.raw,o.text+=`
- `+s.text,this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);const o=t.at(-1);(o==null?void 0:o.type)==="paragraph"||(o==null?void 0:o.type)==="text"?(o.raw+=`
- `+s.raw,o.text+=`
- `+s.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let f=e;if((l=this.options.extensions)!=null&&l.startBlock){let o=1/0;const r=e.slice(1);let u;this.options.extensions.startBlock.forEach(p=>{u=p.call({lexer:this},r),typeof u=="number"&&u>=0&&(o=Math.min(o,u))}),o<1/0&&o>=0&&(f=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(f))){const o=t.at(-1);n&&(o==null?void 0:o.type)==="paragraph"?(o.raw+=`
- `+s.raw,o.text+=`
- `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s),n=f.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);const o=t.at(-1);(o==null?void 0:o.type)==="text"?(o.raw+=`
- `+s.raw,o.text+=`
- `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(e){const o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var s,f,o;let n=e,a=null;if(this.tokens.links){const r=Object.keys(this.tokens.links);if(r.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)r.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,a.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i=!1,l="";for(;e;){i||(l=""),i=!1;let r;if((f=(s=this.options.extensions)==null?void 0:s.inline)!=null&&f.some(p=>(r=p.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);const p=t.at(-1);r.type==="text"&&(p==null?void 0:p.type)==="text"?(p.raw+=r.raw,p.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,l)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let u=e;if((o=this.options.extensions)!=null&&o.startInline){let p=1/0;const h=e.slice(1);let d;this.options.extensions.startInline.forEach(g=>{d=g.call({lexer:this},h),typeof d=="number"&&d>=0&&(p=Math.min(p,d))}),p<1/0&&p>=0&&(u=e.substring(0,p+1))}if(r=this.tokenizer.inlineText(u)){e=e.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(l=r.raw.slice(-1)),i=!0;const p=t.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=r.raw,p.text+=r.text):t.push(r);continue}if(e){const p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return t}}class ge{constructor(e){I(this,"options");I(this,"parser");this.options=e||se}space(e){return""}code({text:e,lang:t,escaped:n}){var l;const a=(l=(t||"").match(U.notSpaceStart))==null?void 0:l[0],i=e.replace(U.endingNewline,"")+`
- `;return a?'<pre><code class="language-'+K(a)+'">'+(n?i:K(i,!0))+`</code></pre>
- `:"<pre><code>"+(n?i:K(i,!0))+`</code></pre>
- `}blockquote({tokens:e}){return`<blockquote>
- ${this.parser.parse(e)}</blockquote>
- `}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
- `}hr(e){return`<hr>
- `}list(e){const t=e.ordered,n=e.start;let a="";for(let s=0;s<e.items.length;s++){const f=e.items[s];a+=this.listitem(f)}const i=t?"ol":"ul",l=t&&n!==1?' start="'+n+'"':"";return"<"+i+l+`>
- `+a+"</"+i+`>
- `}listitem(e){var n;let t="";if(e.task){const a=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=a+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=a+" "+K(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:a+" ",text:a+" ",escaped:!0}):t+=a+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
- `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
- `}table(e){let t="",n="";for(let i=0;i<e.header.length;i++)n+=this.tablecell(e.header[i]);t+=this.tablerow({text:n});let a="";for(let i=0;i<e.rows.length;i++){const l=e.rows[i];n="";for(let s=0;s<l.length;s++)n+=this.tablecell(l[s]);a+=this.tablerow({text:n})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
- <thead>
- `+t+`</thead>
- `+a+`</table>
- `}tablerow({text:e}){return`<tr>
- ${e}</tr>
- `}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${K(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const a=this.parser.parseInline(n),i=Ze(e);if(i===null)return a;e=i;let l='<a href="'+e+'"';return t&&(l+=' title="'+K(t)+'"'),l+=">"+a+"</a>",l}image({href:e,title:t,text:n}){const a=Ze(e);if(a===null)return K(n);e=a;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${K(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:K(e.text)}}class Ue{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class G{constructor(e){I(this,"options");I(this,"renderer");I(this,"textRenderer");this.options=e||se,this.options.renderer=this.options.renderer||new ge,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ue}static parse(e,t){return new G(t).parse(e)}static parseInline(e,t){return new G(t).parseInline(e)}parse(e,t=!0){var a,i;let n="";for(let l=0;l<e.length;l++){const s=e[l];if((i=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&i[s.type]){const o=s,r=this.options.extensions.renderers[o.type].call({parser:this},o);if(r!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type)){n+=r||"";continue}}const f=s;switch(f.type){case"space":{n+=this.renderer.space(f);continue}case"hr":{n+=this.renderer.hr(f);continue}case"heading":{n+=this.renderer.heading(f);continue}case"code":{n+=this.renderer.code(f);continue}case"table":{n+=this.renderer.table(f);continue}case"blockquote":{n+=this.renderer.blockquote(f);continue}case"list":{n+=this.renderer.list(f);continue}case"html":{n+=this.renderer.html(f);continue}case"paragraph":{n+=this.renderer.paragraph(f);continue}case"text":{let o=f,r=this.renderer.text(o);for(;l+1<e.length&&e[l+1].type==="text";)o=e[++l],r+=`
- `+this.renderer.text(o);t?n+=this.renderer.paragraph({type:"paragraph",raw:r,text:r,tokens:[{type:"text",raw:r,text:r,escaped:!0}]}):n+=r;continue}default:{const o='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,t=this.renderer){var a,i;let n="";for(let l=0;l<e.length;l++){const s=e[l];if((i=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&i[s.type]){const o=this.options.extensions.renderers[s.type].call({parser:this},s);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){n+=o||"";continue}}const f=s;switch(f.type){case"escape":{n+=t.text(f);break}case"html":{n+=t.html(f);break}case"link":{n+=t.link(f);break}case"image":{n+=t.image(f);break}case"strong":{n+=t.strong(f);break}case"em":{n+=t.em(f);break}case"codespan":{n+=t.codespan(f);break}case"br":{n+=t.br(f);break}case"del":{n+=t.del(f);break}case"text":{n+=t.text(f);break}default:{const o='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}}class le{constructor(e){I(this,"options");I(this,"block");this.options=e||se}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?V.lex:V.lexInline}provideParser(){return this.block?G.parse:G.parseInline}}I(le,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class kt{constructor(...e){I(this,"defaults",De());I(this,"options",this.setOptions);I(this,"parse",this.parseMarkdown(!0));I(this,"parseInline",this.parseMarkdown(!1));I(this,"Parser",G);I(this,"Renderer",ge);I(this,"TextRenderer",Ue);I(this,"Lexer",V);I(this,"Tokenizer",de);I(this,"Hooks",le);this.use(...e)}walkTokens(e,t){var a,i;let n=[];for(const l of e)switch(n=n.concat(t.call(this,l)),l.type){case"table":{const s=l;for(const f of s.header)n=n.concat(this.walkTokens(f.tokens,t));for(const f of s.rows)for(const o of f)n=n.concat(this.walkTokens(o.tokens,t));break}case"list":{const s=l;n=n.concat(this.walkTokens(s.items,t));break}default:{const s=l;(i=(a=this.defaults.extensions)==null?void 0:a.childTokens)!=null&&i[s.type]?this.defaults.extensions.childTokens[s.type].forEach(f=>{const o=s[f].flat(1/0);n=n.concat(this.walkTokens(o,t))}):s.tokens&&(n=n.concat(this.walkTokens(s.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const a={...n};if(a.async=this.defaults.async||a.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const l=t.renderers[i.name];l?t.renderers[i.name]=function(...s){let f=i.renderer.apply(this,s);return f===!1&&(f=l.apply(this,s)),f}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=t[i.level];l?l.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),a.extensions=t),n.renderer){const i=this.defaults.renderer||new ge(this.defaults);for(const l in n.renderer){if(!(l in i))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;const s=l,f=n.renderer[s],o=i[s];i[s]=(...r)=>{let u=f.apply(i,r);return u===!1&&(u=o.apply(i,r)),u||""}}a.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new de(this.defaults);for(const l in n.tokenizer){if(!(l in i))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const s=l,f=n.tokenizer[s],o=i[s];i[s]=(...r)=>{let u=f.apply(i,r);return u===!1&&(u=o.apply(i,r)),u}}a.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new le;for(const l in n.hooks){if(!(l in i))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;const s=l,f=n.hooks[s],o=i[s];le.passThroughHooks.has(l)?i[s]=r=>{if(this.defaults.async)return Promise.resolve(f.call(i,r)).then(p=>o.call(i,p));const u=f.call(i,r);return o.call(i,u)}:i[s]=(...r)=>{let u=f.apply(i,r);return u===!1&&(u=o.apply(i,r)),u}}a.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,l=n.walkTokens;a.walkTokens=function(s){let f=[];return f.push(l.call(this,s)),i&&(f=f.concat(i.call(this,s))),f}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return V.lex(e,t??this.defaults)}parser(e,t){return G.parse(e,t??this.defaults)}parseMarkdown(e){return(n,a)=>{const i={...a},l={...this.defaults,...i},s=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&i.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));l.hooks&&(l.hooks.options=l,l.hooks.block=e);const f=l.hooks?l.hooks.provideLexer():e?V.lex:V.lexInline,o=l.hooks?l.hooks.provideParser():e?G.parse:G.parseInline;if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(n):n).then(r=>f(r,l)).then(r=>l.hooks?l.hooks.processAllTokens(r):r).then(r=>l.walkTokens?Promise.all(this.walkTokens(r,l.walkTokens)).then(()=>r):r).then(r=>o(r,l)).then(r=>l.hooks?l.hooks.postprocess(r):r).catch(s);try{l.hooks&&(n=l.hooks.preprocess(n));let r=f(n,l);l.hooks&&(r=l.hooks.processAllTokens(r)),l.walkTokens&&this.walkTokens(r,l.walkTokens);let u=o(r,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(r){return s(r)}}}onError(e,t){return n=>{if(n.message+=`
- Please report this to https://github.com/markedjs/marked.`,e){const a="<p>An error occurred:</p><pre>"+K(n.message+"",!0)+"</pre>";return t?Promise.resolve(a):a}if(t)return Promise.reject(n);throw n}}}const ne=new kt;function T(c,e){return ne.parse(c,e)}T.options=T.setOptions=function(c){return ne.setOptions(c),T.defaults=ne.defaults,ct(T.defaults),T};T.getDefaults=De;T.defaults=se;T.use=function(...c){return ne.use(...c),T.defaults=ne.defaults,ct(T.defaults),T};T.walkTokens=function(c,e){return ne.walkTokens(c,e)};T.parseInline=ne.parseInline;T.Parser=G;T.parser=G.parse;T.Renderer=ge;T.TextRenderer=Ue;T.Lexer=V;T.lexer=V.lex;T.Tokenizer=de;T.Hooks=le;T.parse=T;T.options;T.setOptions;T.use;T.walkTokens;T.parseInline;G.parse;V.lex;const jn=new kt,Nn="refference-flag",Un=c=>c.replace(/##\d\$\$/g,' <span class="circle"></span>');function Hn(c){if(!c)return"";let e=Un(c);c.indexOf("![]")<0;let n=jn.parse(e).replace("<a href=",'<a target="_blank" href=');const a=/<span class="circle" data-list-index="\d"><\/span>/g;let i=0;return n.replaceAll(a,function(s,f,o,r){let u=s.replace("></span>",`data-flag-index="${i}"></span>`);return u=u.replace('class="circle"',`class="refflag-refflag-refflag ${Nn}"`),i++,u})}var yt={exports:{}};/*!
- * clipboard.js v2.0.11
- * https://clipboardjs.com/
- *
- * Licensed MIT © Zeno Rocha
- */(function(c,e){(function(n,a){c.exports=a()})(At,function(){return function(){var t={686:function(i,l,s){s.d(l,{default:function(){return J}});var f=s(279),o=s.n(f),r=s(370),u=s.n(r),p=s(817),h=s.n(p);function d(x){try{return document.execCommand(x)}catch{return!1}}var g=function(k){var m=h()(k);return d("cut"),m},_=g;function y(x){var k=document.documentElement.getAttribute("dir")==="rtl",m=document.createElement("textarea");m.style.fontSize="12pt",m.style.border="0",m.style.padding="0",m.style.margin="0",m.style.position="absolute",m.style[k?"right":"left"]="-9999px";var w=window.pageYOffset||document.documentElement.scrollTop;return m.style.top="".concat(w,"px"),m.setAttribute("readonly",""),m.value=x,m}var S=function(k,m){var w=y(k);m.container.appendChild(w);var b=h()(w);return d("copy"),w.remove(),b},B=function(k){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},w="";return typeof k=="string"?w=S(k,m):k instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(k==null?void 0:k.type)?w=S(k.value,m):(w=h()(k),d("copy")),w},z=B;function $(x){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$=function(m){return typeof m}:$=function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},$(x)}var L=function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},m=k.action,w=m===void 0?"copy":m,b=k.container,A=k.target,X=k.text;if(w!=="copy"&&w!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(A!==void 0)if(A&&$(A)==="object"&&A.nodeType===1){if(w==="copy"&&A.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(w==="cut"&&(A.hasAttribute("readonly")||A.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(X)return z(X,{container:b});if(A)return w==="cut"?_(A):z(A,{container:b})},H=L;function M(x){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?M=function(m){return typeof m}:M=function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},M(x)}function xe(x,k){if(!(x instanceof k))throw new TypeError("Cannot call a class as a function")}function we(x,k){for(var m=0;m<k.length;m++){var w=k[m];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(x,w.key,w)}}function ve(x,k,m){return k&&we(x.prototype,k),m&&we(x,m),x}function Se(x,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(k&&k.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),k&&ie(x,k)}function ie(x,k){return ie=Object.setPrototypeOf||function(w,b){return w.__proto__=b,w},ie(x,k)}function $e(x){var k=N();return function(){var w=Q(x),b;if(k){var A=Q(this).constructor;b=Reflect.construct(w,arguments,A)}else b=w.apply(this,arguments);return Ae(this,b)}}function Ae(x,k){return k&&(M(k)==="object"||typeof k=="function")?k:q(x)}function q(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function N(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Q(x){return Q=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},Q(x)}function O(x,k){var m="data-clipboard-".concat(x);if(k.hasAttribute(m))return k.getAttribute(m)}var ee=function(x){Se(m,x);var k=$e(m);function m(w,b){var A;return xe(this,m),A=k.call(this),A.resolveOptions(b),A.listenClick(w),A}return ve(m,[{key:"resolveOptions",value:function(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof b.action=="function"?b.action:this.defaultAction,this.target=typeof b.target=="function"?b.target:this.defaultTarget,this.text=typeof b.text=="function"?b.text:this.defaultText,this.container=M(b.container)==="object"?b.container:document.body}},{key:"listenClick",value:function(b){var A=this;this.listener=u()(b,"click",function(X){return A.onClick(X)})}},{key:"onClick",value:function(b){var A=b.delegateTarget||b.currentTarget,X=this.action(A)||"copy",ue=H({action:X,container:this.container,target:this.target(A),text:this.text(A)});this.emit(ue?"success":"error",{action:X,text:ue,trigger:A,clearSelection:function(){A&&A.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(b){return O("action",b)}},{key:"defaultTarget",value:function(b){var A=O("target",b);if(A)return document.querySelector(A)}},{key:"defaultText",value:function(b){return O("text",b)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(b){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return z(b,A)}},{key:"cut",value:function(b){return _(b)}},{key:"isSupported",value:function(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],A=typeof b=="string"?[b]:b,X=!!document.queryCommandSupported;return A.forEach(function(ue){X=X&&!!document.queryCommandSupported(ue)}),X}}]),m}(o()),J=ee},828:function(i){var l=9;if(typeof Element<"u"&&!Element.prototype.matches){var s=Element.prototype;s.matches=s.matchesSelector||s.mozMatchesSelector||s.msMatchesSelector||s.oMatchesSelector||s.webkitMatchesSelector}function f(o,r){for(;o&&o.nodeType!==l;){if(typeof o.matches=="function"&&o.matches(r))return o;o=o.parentNode}}i.exports=f},438:function(i,l,s){var f=s(828);function o(p,h,d,g,_){var y=u.apply(this,arguments);return p.addEventListener(d,y,_),{destroy:function(){p.removeEventListener(d,y,_)}}}function r(p,h,d,g,_){return typeof p.addEventListener=="function"?o.apply(null,arguments):typeof d=="function"?o.bind(null,document).apply(null,arguments):(typeof p=="string"&&(p=document.querySelectorAll(p)),Array.prototype.map.call(p,function(y){return o(y,h,d,g,_)}))}function u(p,h,d,g){return function(_){_.delegateTarget=f(_.target,h),_.delegateTarget&&g.call(p,_)}}i.exports=r},879:function(i,l){l.node=function(s){return s!==void 0&&s instanceof HTMLElement&&s.nodeType===1},l.nodeList=function(s){var f=Object.prototype.toString.call(s);return s!==void 0&&(f==="[object NodeList]"||f==="[object HTMLCollection]")&&"length"in s&&(s.length===0||l.node(s[0]))},l.string=function(s){return typeof s=="string"||s instanceof String},l.fn=function(s){var f=Object.prototype.toString.call(s);return f==="[object Function]"}},370:function(i,l,s){var f=s(879),o=s(438);function r(d,g,_){if(!d&&!g&&!_)throw new Error("Missing required arguments");if(!f.string(g))throw new TypeError("Second argument must be a String");if(!f.fn(_))throw new TypeError("Third argument must be a Function");if(f.node(d))return u(d,g,_);if(f.nodeList(d))return p(d,g,_);if(f.string(d))return h(d,g,_);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function u(d,g,_){return d.addEventListener(g,_),{destroy:function(){d.removeEventListener(g,_)}}}function p(d,g,_){return Array.prototype.forEach.call(d,function(y){y.addEventListener(g,_)}),{destroy:function(){Array.prototype.forEach.call(d,function(y){y.removeEventListener(g,_)})}}}function h(d,g,_){return o(document.body,d,g,_)}i.exports=r},817:function(i){function l(s){var f;if(s.nodeName==="SELECT")s.focus(),f=s.value;else if(s.nodeName==="INPUT"||s.nodeName==="TEXTAREA"){var o=s.hasAttribute("readonly");o||s.setAttribute("readonly",""),s.select(),s.setSelectionRange(0,s.value.length),o||s.removeAttribute("readonly"),f=s.value}else{s.hasAttribute("contenteditable")&&s.focus();var r=window.getSelection(),u=document.createRange();u.selectNodeContents(s),r.removeAllRanges(),r.addRange(u),f=r.toString()}return f}i.exports=l},279:function(i){function l(){}l.prototype={on:function(s,f,o){var r=this.e||(this.e={});return(r[s]||(r[s]=[])).push({fn:f,ctx:o}),this},once:function(s,f,o){var r=this;function u(){r.off(s,u),f.apply(o,arguments)}return u._=f,this.on(s,u,o)},emit:function(s){var f=[].slice.call(arguments,1),o=((this.e||(this.e={}))[s]||[]).slice(),r=0,u=o.length;for(r;r<u;r++)o[r].fn.apply(o[r].ctx,f);return this},off:function(s,f){var o=this.e||(this.e={}),r=o[s],u=[];if(r&&f)for(var p=0,h=r.length;p<h;p++)r[p].fn!==f&&r[p].fn._!==f&&u.push(r[p]);return u.length?o[s]=u:delete o[s],this}},i.exports=l,i.exports.TinyEmitter=l}},n={};function a(i){if(n[i])return n[i].exports;var l=n[i]={exports:{}};return t[i](l,l.exports,a),l.exports}return function(){a.n=function(i){var l=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(l,{a:l}),l}}(),function(){a.d=function(i,l){for(var s in l)a.o(l,s)&&!a.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:l[s]})}}(),function(){a.o=function(i,l){return Object.prototype.hasOwnProperty.call(i,l)}}(),a(686)}().default})})(yt);var Qn=yt.exports;const Wn=nt(Qn);function Zn(c){Wn.copy(c)}const Vn={class:"dialog-item dialog-anwser"},Gn={class:"dialog-main answer-main"},Jn={class:"dialog-icon answer-icon"},Xn=["src"],Kn={class:"dialog-content answer-content"},Yn={__name:"DialogAnswer",props:{show_select:!0,answer:Object},emits:["stop","retry","select"],setup(c,{emit:e}){const t=c,n=e,a=Z(()=>t.show_select===!0),i=Z(()=>t.answer.client_custom_chat_status),l=Z(()=>i.value===0),s=Z(()=>{const h=t.answer.content;return Hn(h)}),f=()=>{n("select")},o=()=>{n("stop")},r=()=>{Zn(s.value),st.success("已复制")},u=()=>{},p=()=>{n("retry")};return(h,d)=>(v(),E("div",Vn,[a.value?(v(),j(at,{key:0,onChange:f})):W("",!0),C("div",Gn,[C("div",Jn,[C("img",{src:c.answer.client_custom_icon},null,8,Xn)]),C("div",Kn,[C("div",null,[D(lt,{content:s.value,is_loading:l.value},{default:Y(()=>[i.value===2?(v(),j(cn,{key:0,class:"answer-actions-btns",onCopy:r,onShare:u,onRetry:p})):W("",!0)]),_:1},8,["content","is_loading"]),i.value===1?(v(),j(pn,{key:0,onStop:o})):W("",!0)])])])]))}},es=P(Yn,[["__scopeId","data-v-a30c5be3"]]),ts={class:"dialog-item-container"},ns={__name:"DialogItem",props:{dialog:Object},emits:["stop","retry","select"],setup(c,{emit:e}){const t=c,n=e,a=Z(()=>t.dialog.client_custom_item_type),i=Z(()=>({content:t.dialog.question,client_custom_icon:t.dialog.client_custom_icon})),l=Z(()=>{const r=t.dialog,u={};return r.answer&&(u.content=r.answer),u.client_custom_chat_status=r.client_custom_chat_status,u.client_custom_icon=r.client_custom_icon,u}),s=()=>{n("stop")},f=()=>{n("retry")},o=()=>{n("select")};return(r,u)=>(v(),E("div",ts,[a.value==="q"?(v(),j(on,{key:0,question:i.value,onSelect:o},null,8,["question"])):W("",!0),a.value==="a"?(v(),j(es,{key:1,answer:l.value,onStop:s,onRetry:f,onSelect:o},null,8,["answer"])):W("",!0)]))}},ss=P(ns,[["__scopeId","data-v-824ca041"]]),is={class:"dialog-suggestion"},os={__name:"DialogSuggestion",props:{suggestion:Object},setup(c){return(e,t)=>(v(),E("div",is,t[0]||(t[0]=[C("div",null,"对话推荐项,当一轮对话结束后,可能有其他推荐的内容项目,在对话结束处进行展示。",-1)])))}},rs=P(os,[["__scopeId","data-v-c9a060e3"]]);function as(c){const{proxy:e}=_e();return t=>{e.$refs[c].scrollTop(t)}}const ls={class:"dialog-list"},cs={__name:"DialogList",props:{height:Number,agent_id:String,list:Array,suggestion:Array},setup(c,{expose:e}){const t=c,n=as("scroll_container"),a=Z(()=>({height:t.height+"px",overflow:"auto"})),i=l=>{};return e({scroll2Bottom:()=>{n(1e6)}}),(l,s)=>{const f=te("a-scrollbar");return v(),j(f,{type:"track",style:fe(a.value),ref:"scroll_container"},{default:Y(()=>[C("div",ls,[(v(!0),E(Te,null,Re(c.list,(o,r)=>(v(),j(ss,{dialog:o,index:r,key:o.client_custom_unique_id,onSelect:u=>i(o)},null,8,["dialog","index","onSelect"]))),128)),c.suggestion.length!==0?(v(),j(rs,{key:0,suggestion:c.suggestion},null,8,["suggestion"])):W("",!0)])]),_:1},8,["style"])}}},us=P(cs,[["__scopeId","data-v-1ac57521"]]),ps="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAL0SURBVHgB7Vc7ctswEF19ipRKqVER5gbUrw5dpop9AtsnSG4g+QSJTiDmBJFPEKbWZ+gb0I2kLiyVGX3ylsEyCC1KICVNGr4ZDgEQu3j7wQIkKlCgQIGLomQyybZti/Ij9H0/pJxIJQhSTqVS6XETT41Og7/b7Qbb7dYD2SCLYGkPMQvEhmg6dH4E5XL5Zjwe+6YC/xBU5L6jaXEfVoelUomt/0E5AXkL8u/4rY1dTSYTz0he77Tbbfbcnep6m83mPmtI0tDpdPog2lPdELrfmuRmRRqcc3D/F25DUTCbzZrL5TJ3cicxn8+9RqPBDnHwvIIXfy0WC++YXFkaCO2ttJHMV3QBIKx9vDxug+BHE5mq1rbV2zcJqyo97HWLDACjXdaL6DyCnIOhGnTYvBhlJPhMh4lJ+XEoA6rVqodXAHKBNna0fJW1tuTbz7TJrVarp3a5Q2cGexOb9DY5rnvQVwtf47mnPeRgfV8bGqA/ghcCMsBqtRIHfJCx9Xod8FsRizZot9t90utkTJBrneQGBK6n0+mINOuEHO9w5NPNsdzZB8lb0SO5jvZr6I/CDd3fMK8pJSgOMT6wBWLlUD9/EdbP2ry85GrqhLLU0IN8Q0njtQeqa2Hj3cm3mCAzhiUiVJNJrJj+5txjTnIOUkHPXR+kXH0OCneflIPgzTgN9ByMLEF4LUwIEeK+6JfvMMBTC9q6Vw+AjbP4DVnREaVIciI7CGvLPrD2EmSA2CdKgVYidK9mAd9o+mlHHL49I3J0kOAexMpgfU0b88gMfOF4wo51jx0AIPcmuaYJwUAaWIjLgavy8KzHob7D6U/Ji1A+JqjC4amug1uJQxcAvBcXaUTqazxuIgzPPWjCwxN/AV5APwTUTcqN1zZVkrjPMVyUBrY0oPxw1C3KkQHobOqlzJhgCsmzgW/v/DuQvGlXMuiILp31ep1vO7YcTWeChxLzHqF9cQhk8qAOHOo2lPL/hk35wJsvhI7RKb+lBQoUKFDgP+M3zC1vWE7HoR8AAAAASUVORK5CYII=",fs={class:"dialog-input-actions"},hs={class:"dialog-input-action-left"},ds={class:"dialog-input-action-right"},gs={__name:"InputActions",props:{disabled:{type:Boolean,default:!1,required:!1},enable_file_upload:{type:Boolean,default:!0,required:!1},enable_frequent_question:{type:Boolean,default:!0,required:!1},enable_voice_recognition:{type:Boolean,default:!1,required:!1},file_upload_type:{type:String,default:"*",required:!1},file_upload_limit:{type:Number,default:0,required:!1}},emits:["fileUpload","questionDefine","voiceRecognize","submit"],setup(c,{emit:e}){const t=e,n=()=>{t("fileUpload")},a=()=>{t("submit")};return(i,l)=>{const s=te("a-tooltip");return v(),E("div",fs,[C("div",hs,[D(s,{content:"文件上传",position:"top"},{default:Y(()=>[c.enable_file_upload?(v(),E("div",{key:0,class:"action-left-item-btn",onClick:n},l[0]||(l[0]=[C("img",{src:ps},null,-1)]))):W("",!0)]),_:1})]),C("div",ds,[D(s,{content:"请输入您的问题",position:"top"},{default:Y(()=>[C("div",{class:"action-right-item-btn submit-input-btn",onClick:a},"发送")]),_:1})])])}}},_s=P(gs,[["__scopeId","data-v-4c099028"]]),ms={class:"file-item-doc-preview"},ks={__name:"FileItemDocPreview",props:{file:Object},setup(c){return console.log(c.file,"文档内容"),(t,n)=>(v(),E("div",ms,[C("div",null,qe(c.file.name),1)]))}},ys=P(ks,[["__scopeId","data-v-85c455c3"]]),bs={__name:"FileItemImagePreview",props:{file:Object},setup(c){return(e,t)=>(v(),E("div",null,[C("div",null,qe(c.file.name),1)]))}},xs=c=>c==="jpg"||c==="png"||c==="jpeg"||c==="gif";function Je(c){const e=c.split("."),t=e[e.length-1];return xs(t)}const ws={class:"file-upload-preview-area"},vs={class:"file-doc-preview-container"},Ss={class:"file-image-preview-container"},$s={__name:"FileUploadPreview",props:{file_list:Array},setup(c){const e=c,t=Z(()=>{const a=[];return e.file_list.forEach((i,l)=>{const s=i.file.name;Je(s)&&a.push(i)}),a}),n=Z(()=>{const a=[];return e.file_list.forEach((i,l)=>{const s=i.file.name;Je(s)||a.push(i)}),a});return(a,i)=>(v(),E("div",ws,[C("div",vs,[(v(!0),E(Te,null,Re(n.value,(l,s)=>(v(),j(ys,{key:l.id+l.index,file:l.file},null,8,["file"]))),128))]),C("div",Ss,[(v(!0),E(Te,null,Re(t.value,(l,s)=>(v(),j(bs,{key:l.id+l.index,file:l.file},null,8,["file"]))),128))])]))}},As=P($s,[["__scopeId","data-v-4f79cc00"]]);function Cs(c){const e=[];let t=0;return{select(n){const a=Date.now(),i=document.createElement("input");i.type="file",i.id=`9d75142a66eb4e23b7d403efe4584915-${a}-${t}`,i.setAttribute("multiple",!0),i.setAttribute("style","display: none;"),document.body.appendChild(i),t=t+1,i.click(),i.onchange=l=>{typeof n=="function"&&n(l)},e.push(i)},remove(){e.forEach(n=>{document.body.removeChild(n)})}}}const Ts={class:"dialog-input-area-container"},Rs={class:"textarea-container"},Is={__name:"DialogInput",props:{disabled:{type:Boolean,default:!1,required:!1},agent_info:{type:Object},agent_config:{type:Object},enable_file_upload:{type:Boolean,default:!0,required:!1},enable_frequent_question:{type:Boolean,default:!0,required:!1},enable_voice_recognition:{type:Boolean,default:!1,required:!1},file_upload_type:{type:String,default:"*",required:!1},file_upload_limit:{type:Number,default:0,required:!1},text_placeholder:{type:String},text_limit:{type:Number,default:0,required:!1},show_text_count:{type:Boolean,default:!1,required:!1}},emits:["submit"],setup(c,{expose:e,emit:t}){const n=c,a=F(""),i=F([]),l=t,{select:s,remove:f}=Cs(),o=()=>{if(n.disabled)return;const y=[];i.value.forEach(S=>{y.push(S.file)}),l("submit",{text:a.value,files:y})},r=()=>{a.value="",i.value=[]},u=()=>{s(y=>{const S=y.target.files,B=y.target.id,z=S.length;if(z===1&&i.value.push({type:1,id:B,index:0,file:S[0]}),z>1)for(let $=0;$<z;$++){const L=S[$],H=$;i.value.push({type:2,id:B,index:H,file:L})}})},p=()=>{},h=()=>{},d=()=>{a.value=a.value.replace(/\n/,"")},g=(y,S)=>{n.disabled||(a.value=y)},_=y=>{if(n.disabled){y.keyCode===13&&d();return}y.keyCode===13&&(y.ctrlKey||(d(),o()))};return Be(()=>{f()}),e({clear:r}),(y,S)=>{const B=te("a-textarea");return v(),E("div",null,[C("div",Ts,[C("div",Rs,[D(B,{class:"textarea-input",placeholder:"输入文本内容","model-value":a.value,"allow-clear":"","auto-size":{minRows:1,maxRows:4},onInput:g,onKeyup:_},null,8,["model-value"])]),D(_s,{disabled:c.disabled,enable_file_upload:c.enable_file_upload,enable_frequent_question:c.enable_frequent_question,enable_voice_recognition:c.enable_voice_recognition,file_upload_type:c.file_upload_type,file_upload_limit:c.file_upload_limit,onFileUpload:u,onQuestionDefine:p,onVoiceRecognize:h,onSubmit:o},null,8,["disabled","enable_file_upload","enable_frequent_question","enable_voice_recognition","file_upload_type","file_upload_limit"]),D(As,{file_list:i.value},null,8,["file_list"])])])}}},Es=P(Is,[["__scopeId","data-v-d85483d3"]]),qs={},Bs={class:"dialog-footer"};function zs(c,e){return v(),E("div",Bs,e[0]||(e[0]=[C("div",null,"内容由 AI 大模型生成,请仔细甄别",-1)]))}const Ls=P(qs,[["render",zs],["__scopeId","data-v-a73a920d"]]),Ds={},Ps={class:"dialog-aside-right"};function Fs(c,e){return v(),E("div",Ps,e[0]||(e[0]=[C("div",null,null,-1)]))}const Ms=P(Ds,[["render",Fs],["__scopeId","data-v-dea2ba14"]]),Xe={"9d75142a-66eb-4e23-b7d4-03efe4584915":{text_limit:250,file_upload:!0,file_accept:".jpg,.png",file_limit:1,file_message:"支持上传 .png, .jpg,大小不超过10M"}};function Os(c){return c&&c in Xe?Xe[c]:null}function js(c,e,t){const n=location.host,a=Ct.get();return c==="report"?`ws://${n}/api/${c}/ws/${e}/${t}?token=${a}`:c==="chat"?`ws://${n}/api/${c}/ws/${e}/${t}?token=${a}`:c==="excel"?`ws://${n}/api/document/ws/excel`:`ws://${n}/api/chat/ws/${e}/${t}?token=${a}`}function Ce(c){return typeof c=="function"?c:Function.prototype}function Ns(c){let e=[];const t=Ce(c.onMessage),n=Ce(c.onClose),a=Ce(c.onError);F(-1);function i(r,u,p){const h=js(p,r,u),d=new WebSocket(h);return d.onopen=function(g){e.forEach(_=>{d.send(_)}),e=[]},d.onclose=function(g){n(g)},d.onerror=function(g){a(g)},d.onmessage=g=>{t(g)},d}let l=null,s=null,f=null,o=null;return{initWSConnection(r,u,p){return l=r,s=u,f=p,o===null&&(o=i(l,s,f)),o},sendWSMessage(r){o===null&&(o=i(l,s,f)),o.readyState===0&&e.push(r),o.readyState===1&&o.send(r),o.readyState===2&&console.log("web socket正在关闭"),o.readyState===3&&(e.push(r),o=i(l,s,f))},getWSInstance(){return o},closeWSConnect(){o!==null&&o.close()}}}const Us=(c,e,t)=>ze.post(`/api/files/upload/${c}?chat_id=${e}`,t,{headers:{"Content-Type":"multipart/form-data"}}),Hs=c=>ze.get(`/api/agent/get-chat-id/${c}`),Qs=(c,e)=>ze.get(`/api/agent/${c}/${e}/session_log`);function Ws(c){const e=new FormData;return c.forEach(t=>{e.append("file",t)}),e}function Zs(c,e){return ot({message:c})}var bt={exports:{}},xt={exports:{}};(function(){var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(t,n){return t<<n|t>>>32-n},rotr:function(t,n){return t<<32-n|t>>>n},endian:function(t){if(t.constructor==Number)return e.rotl(t,8)&16711935|e.rotl(t,24)&4278255360;for(var n=0;n<t.length;n++)t[n]=e.endian(t[n]);return t},randomBytes:function(t){for(var n=[];t>0;t--)n.push(Math.floor(Math.random()*256));return n},bytesToWords:function(t){for(var n=[],a=0,i=0;a<t.length;a++,i+=8)n[i>>>5]|=t[a]<<24-i%32;return n},wordsToBytes:function(t){for(var n=[],a=0;a<t.length*32;a+=8)n.push(t[a>>>5]>>>24-a%32&255);return n},bytesToHex:function(t){for(var n=[],a=0;a<t.length;a++)n.push((t[a]>>>4).toString(16)),n.push((t[a]&15).toString(16));return n.join("")},hexToBytes:function(t){for(var n=[],a=0;a<t.length;a+=2)n.push(parseInt(t.substr(a,2),16));return n},bytesToBase64:function(t){for(var n=[],a=0;a<t.length;a+=3)for(var i=t[a]<<16|t[a+1]<<8|t[a+2],l=0;l<4;l++)a*8+l*6<=t.length*8?n.push(c.charAt(i>>>6*(3-l)&63)):n.push("=");return n.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/ig,"");for(var n=[],a=0,i=0;a<t.length;i=++a%4)i!=0&&n.push((c.indexOf(t.charAt(a-1))&Math.pow(2,-2*i+8)-1)<<i*2|c.indexOf(t.charAt(a))>>>6-i*2);return n}};xt.exports=e})();var Vs=xt.exports,Ee={utf8:{stringToBytes:function(c){return Ee.bin.stringToBytes(unescape(encodeURIComponent(c)))},bytesToString:function(c){return decodeURIComponent(escape(Ee.bin.bytesToString(c)))}},bin:{stringToBytes:function(c){for(var e=[],t=0;t<c.length;t++)e.push(c.charCodeAt(t)&255);return e},bytesToString:function(c){for(var e=[],t=0;t<c.length;t++)e.push(String.fromCharCode(c[t]));return e.join("")}}},Ke=Ee;/*!
- * Determine if an object is a Buffer
- *
- * @author Feross Aboukhadijeh <https://feross.org>
- * @license MIT
- */var Gs=function(c){return c!=null&&(wt(c)||Js(c)||!!c._isBuffer)};function wt(c){return!!c.constructor&&typeof c.constructor.isBuffer=="function"&&c.constructor.isBuffer(c)}function Js(c){return typeof c.readFloatLE=="function"&&typeof c.slice=="function"&&wt(c.slice(0,0))}(function(){var c=Vs,e=Ke.utf8,t=Gs,n=Ke.bin,a=function(i,l){i.constructor==String?l&&l.encoding==="binary"?i=n.stringToBytes(i):i=e.stringToBytes(i):t(i)?i=Array.prototype.slice.call(i,0):!Array.isArray(i)&&i.constructor!==Uint8Array&&(i=i.toString());for(var s=c.bytesToWords(i),f=i.length*8,o=1732584193,r=-271733879,u=-1732584194,p=271733878,h=0;h<s.length;h++)s[h]=(s[h]<<8|s[h]>>>24)&16711935|(s[h]<<24|s[h]>>>8)&4278255360;s[f>>>5]|=128<<f%32,s[(f+64>>>9<<4)+14]=f;for(var d=a._ff,g=a._gg,_=a._hh,y=a._ii,h=0;h<s.length;h+=16){var S=o,B=r,z=u,$=p;o=d(o,r,u,p,s[h+0],7,-680876936),p=d(p,o,r,u,s[h+1],12,-389564586),u=d(u,p,o,r,s[h+2],17,606105819),r=d(r,u,p,o,s[h+3],22,-1044525330),o=d(o,r,u,p,s[h+4],7,-176418897),p=d(p,o,r,u,s[h+5],12,1200080426),u=d(u,p,o,r,s[h+6],17,-1473231341),r=d(r,u,p,o,s[h+7],22,-45705983),o=d(o,r,u,p,s[h+8],7,1770035416),p=d(p,o,r,u,s[h+9],12,-1958414417),u=d(u,p,o,r,s[h+10],17,-42063),r=d(r,u,p,o,s[h+11],22,-1990404162),o=d(o,r,u,p,s[h+12],7,1804603682),p=d(p,o,r,u,s[h+13],12,-40341101),u=d(u,p,o,r,s[h+14],17,-1502002290),r=d(r,u,p,o,s[h+15],22,1236535329),o=g(o,r,u,p,s[h+1],5,-165796510),p=g(p,o,r,u,s[h+6],9,-1069501632),u=g(u,p,o,r,s[h+11],14,643717713),r=g(r,u,p,o,s[h+0],20,-373897302),o=g(o,r,u,p,s[h+5],5,-701558691),p=g(p,o,r,u,s[h+10],9,38016083),u=g(u,p,o,r,s[h+15],14,-660478335),r=g(r,u,p,o,s[h+4],20,-405537848),o=g(o,r,u,p,s[h+9],5,568446438),p=g(p,o,r,u,s[h+14],9,-1019803690),u=g(u,p,o,r,s[h+3],14,-187363961),r=g(r,u,p,o,s[h+8],20,1163531501),o=g(o,r,u,p,s[h+13],5,-1444681467),p=g(p,o,r,u,s[h+2],9,-51403784),u=g(u,p,o,r,s[h+7],14,1735328473),r=g(r,u,p,o,s[h+12],20,-1926607734),o=_(o,r,u,p,s[h+5],4,-378558),p=_(p,o,r,u,s[h+8],11,-2022574463),u=_(u,p,o,r,s[h+11],16,1839030562),r=_(r,u,p,o,s[h+14],23,-35309556),o=_(o,r,u,p,s[h+1],4,-1530992060),p=_(p,o,r,u,s[h+4],11,1272893353),u=_(u,p,o,r,s[h+7],16,-155497632),r=_(r,u,p,o,s[h+10],23,-1094730640),o=_(o,r,u,p,s[h+13],4,681279174),p=_(p,o,r,u,s[h+0],11,-358537222),u=_(u,p,o,r,s[h+3],16,-722521979),r=_(r,u,p,o,s[h+6],23,76029189),o=_(o,r,u,p,s[h+9],4,-640364487),p=_(p,o,r,u,s[h+12],11,-421815835),u=_(u,p,o,r,s[h+15],16,530742520),r=_(r,u,p,o,s[h+2],23,-995338651),o=y(o,r,u,p,s[h+0],6,-198630844),p=y(p,o,r,u,s[h+7],10,1126891415),u=y(u,p,o,r,s[h+14],15,-1416354905),r=y(r,u,p,o,s[h+5],21,-57434055),o=y(o,r,u,p,s[h+12],6,1700485571),p=y(p,o,r,u,s[h+3],10,-1894986606),u=y(u,p,o,r,s[h+10],15,-1051523),r=y(r,u,p,o,s[h+1],21,-2054922799),o=y(o,r,u,p,s[h+8],6,1873313359),p=y(p,o,r,u,s[h+15],10,-30611744),u=y(u,p,o,r,s[h+6],15,-1560198380),r=y(r,u,p,o,s[h+13],21,1309151649),o=y(o,r,u,p,s[h+4],6,-145523070),p=y(p,o,r,u,s[h+11],10,-1120210379),u=y(u,p,o,r,s[h+2],15,718787259),r=y(r,u,p,o,s[h+9],21,-343485551),o=o+S>>>0,r=r+B>>>0,u=u+z>>>0,p=p+$>>>0}return c.endian([o,r,u,p])};a._ff=function(i,l,s,f,o,r,u){var p=i+(l&s|~l&f)+(o>>>0)+u;return(p<<r|p>>>32-r)+l},a._gg=function(i,l,s,f,o,r,u){var p=i+(l&f|s&~f)+(o>>>0)+u;return(p<<r|p>>>32-r)+l},a._hh=function(i,l,s,f,o,r,u){var p=i+(l^s^f)+(o>>>0)+u;return(p<<r|p>>>32-r)+l},a._ii=function(i,l,s,f,o,r,u){var p=i+(s^(l|~f))+(o>>>0)+u;return(p<<r|p>>>32-r)+l},a._blocksize=16,a._digestsize=16,bt.exports=function(i,l){if(i==null)throw new Error("Illegal argument "+i);var s=c.wordsToBytes(a(i,l));return l&&l.asBytes?s:l&&l.asString?n.bytesToString(s):c.bytesToHex(s)}})();var Xs=bt.exports;const Ks=nt(Xs);function be(c){return c?Ks(c):Date.now()+""}function Ys(c,e){var n;return(n=e==null?void 0:e.agent)!=null&&n.icon,{client_custom_chat_type:0,client_custom_item_type:"q",client_custom_chat_status:2,client_custom_icon:rt(),client_custom_unique_id:be(c.question),question:c.question}}function ei(c,e){return{client_custom_chat_type:0,client_custom_item_type:"a",client_custom_chat_status:2,client_custom_icon:me(e),client_custom_unique_id:be(c.answer),answer:c.answer}}function ti(c,e){const t=[];return c.forEach(n=>{const a=Ys(n,e),i=ei(n,e);t.push(a),t.push(i)}),t}function ni(c,e,t){const n=Date.now(),a=rt();return{client_custom_item_type:"q",client_custom_create_time:n,client_custom_unique_id:be(c+n),client_custom_icon:a,question:c}}function si(c){return{client_custom_chat_type:2,client_custom_item_type:"a",client_custom_chat_status:0,client_custom_icon:me(c),client_custom_unique_id:"loading_"+Date.now(),question:"",answer:""}}function ii(c,e){return{client_custom_chat_type:1,client_custom_item_type:"a",client_custom_chat_status:2,client_custom_icon:me(c),client_custom_unique_id:"exception_"+Date.now(),question:"",answer:e.message}}const oi=c=>`<pre><code class="hljs language-python">
- ${c}</code></pre>`,ri=c=>`<pre><code class="hljs language-sql">
- ${c}</code></pre>`;function ai(c,e,t){const n=He(c),a=He(ot(e)),i=me(t),l=n.type,s=n.message;n.reference,n.step_message;const f=n.files,o=n.message_files,r=n.download_url,u=n.file_url,p=n.file_name,h=n.image_url,d=n.excel_url,g=n.excel_name,_=n.code,y=n.sql,S={client_custom_chat_type:2,client_custom_item_type:"a",client_custom_chat_status:1,client_custom_icon:i,question:n.question};for(let $ in a)$==="client_custom_chat_type"||$==="client_custom_chat_status"||(S[$]=a[$]);let B=0,z="";if(l==="message"){if(B=1,S.answer=s,h){const $=window.location.port?`:${window.location.port}`:"",L=`http://${window.location.hostname}${$}${h}`;S.image_url=L}if(d&&g){const $=window.location.port?`:${window.location.port}`:"",L={file_type:"excel",file_url:`http://${window.location.hostname}${$}${d}`,file_name:`${g}.xlsx`||"点击下载"};S.file=L}if(u&&p){const $=window.location.port?`:${window.location.port}`:"",L={file_type:"word",file_url:`http://${window.location.hostname}${$}${u}`,file_name:`${p}.docx`||"点击下载"};S.file=L}if(_){const $=oi(_);S.code=$}if(y){const $=ri(y);S.sql=$}if(r){const $=decodeURIComponent(r).split("/"),L=$[$.length-1],H={file_type:"word",file_url:r,file_name:`${L}.docx`||"点击下载"};S.file=H}}if(l==="stream"&&(B=1,e&&e.answer?S.answer=e.answer+s:S.answer=s,f)){const L=f[0].file_name.split("."),H=L[L.length-1],M={file_name:f[0].file_name,file_url:f[0].file_url};H==="xlsx"&&(M.file_type="excel"),H==="docx"&&(M.file_type="word"),S.file=M}return l==="system"&&(B=1),l==="close"&&(B=2,S.client_custom_chat_status=2,S.client_custom_chat_type=1,o&&Array.isArray(o)&&o.forEach(($,L)=>{}),s&&(S.answer=s)),l==="error"&&(B=3,S.client_custom_chat_status=2,S.client_custom_chat_type=1,S.answer=s),S.client_custom_unique_id=be(S.answer),{status:B,message:z,data:S}}function li(c){const e=F(0),t=F(0),{proxy:n}=_e(),a=()=>{const i=n.$refs[c];e.value=i.offsetHeight,t.value=i.offsetWidth};return Le(()=>{a(),window.addEventListener("resize",a)}),Be(()=>{window.removeEventListener("resize",a)}),{height:e,width:t}}function ci(c){const{proxy:e}=_e();return()=>{const t=e.$refs[c];t&&t.clear&&typeof t.clear=="function"&&t.clear()}}function ui(c){const{proxy:e}=_e();return t=>{const n=e.$refs[c];n&&n.scroll2Bottom&&typeof n.scroll2Bottom=="function"&&n.scroll2Bottom(t)}}const pi={class:"conversation-chat-container"},fi={class:"conversation-chat-left"},hi={class:"conversation-chat-main",ref:"chat_main"},di={class:"conversation-chat-content"},gi={class:"conversation-chat-right"},Ye=30,et=30,tt=100,_i={__name:"ConversationChatContainer",props:{agent_id:String,session_id:String,chat_type:String},setup(c){const e=c,t=it(),n=F({agent:{},config:{}}),{width:a,height:i}=li("chat_main"),l=ci("dialog_input"),s=ui("list_scroller"),f=()=>{Tt(()=>{s()})},o=Z(()=>i.value-Ye-et-tt-20),r=F([]),u=F([]),p=F([]);F(0);const h=F(null),d=F({}),g=Z(()=>[].concat(r.value,u.value)),_=F(!0),y=q=>{},S=q=>{},B=q=>{st.error({content:q,position:"top"})},z=F(!1),$=q=>{const N=ii(n.value,q);u.value.pop(),u.value.push(N),z.value=!1,f()},L=async q=>{const N=q.text,Q=q.files;if(!N){B("请输入文字");return}const O=ni(N,Q,n.value);d.value=O,u.value.push(d.value);const ee=si(n.value);u.value.push(ee),_.value=!1,l(),p.value=[],d.value=null,z.value=!0,f();const J=e.agent_id;if(h.value===null)try{const m=await Hs(J);if(m.code/1===200){const w=m.data;h.value=w.chat_id}else{$({message:`code: ${m.code} message: ${m.msg}`});return}}catch(m){console.log("err-nfsdnakiuwirea7",m),$({message:m.message});return}let x=null;if(Q.length!==0){const m=Ws(Q),w=h.value;try{const b=await Us(J,w,m);if(b.code/1===200){const A=b.data;Array.isArray(A)?x=A:x=[A]}else{$({message:`code: ${b.code}
- message: ${b.msg}`});return}}catch(b){console.log("err-fhskafhakfjslkfjl",b),$({message:b.message});return}}const k=Zs(N);Se(h.value,k)},H={onMessage:ie,onError:$e,onClose:Ae},{initWSConnection:M,sendWSMessage:xe,getWSInstance:we,closeWSConnect:ve}=Ns(H);function Se(q,N){M(e.agent_id,q,e.chat_type),xe(N)}function ie(q){const N=q.data,Q=u.value[u.value.length-1],O=ai(N,Q,n.value),ee=O.status,J=()=>{const x=O.data;u.value.pop(),u.value.push(x),f()};if(ee===1&&J(),ee===2){J();const x=O.suggest;x&&(p.value=x),z.value=!1}ee===3&&(J(),z.value=!1)}function $e(q){}function Ae(q){}return Le(()=>{const q=e.agent_id,N=e.session_id,Q=t.getInfo(q);if(Q){const O=Os(q);O?n.value={config:O,agent:Q}:n.value={config:{},agent:Q}}N&&Qs(q,N).then(O=>{if(O.code/1===200){const ee=O.data,J=ti(ee,n.value);J.length!==0&&(_.value=!1,f()),r.value=J}}).catch(O=>{console.log(O)})}),Be(()=>{ve()}),(q,N)=>(v(),E("div",pi,[C("div",fi,[D(Mt)]),C("div",hi,[D(Nt,{class:"conversation-chat-header",agent_info:n.value,style:fe({height:Ye+"px"})},null,8,["agent_info","style"]),C("div",di,[_.value?(v(),j(Qt,{key:0,class:"conversation-chat-area",agent_info:n.value},null,8,["agent_info"])):W("",!0),_.value?W("",!0):(v(),j(us,{key:1,ref:"list_scroller",class:"conversation-chat-area",height:o.value,agent_id:c.agent_id,list:g.value,suggestion:p.value,onShare:y,onSubmit:S},null,8,["height","agent_id","list","suggestion"])),D(Es,{ref:"dialog_input",class:"conversation-chat-input",style:fe({height:tt+"px"}),agent_info:n.value.agent,agent_config:n.value.config,disabled:z.value,onSubmit:L},null,8,["style","agent_info","agent_config","disabled"])]),D(Ls,{class:"conversation-chat-footer",style:fe({height:et+"px"})},null,8,["style"])],512),C("div",gi,[D(Ms)])]))}},mi=P(_i,[["__scopeId","data-v-60bd32dd"]]),qi={__name:"ConversationQA",setup(c){const e=Rt(),t=It(),n=it(),a=F(""),i=F(""),l=F(1),s=F(""),f=()=>{t.back()};async function o(r){if(!r)return!1;const u=n.getList();return u.length===0?!0:!!u.find(h=>h.id===r)}return Le(async()=>{const r=e.query,u=r.agent,p=r.session;if(u){if(!await o(u)){l.value=3,s.value="非法操作:参数异常";return}a.value=u,i.value=p,l.value=2,s.value="success"}else{const h=Et("DEFAULT_CHAT_AGENT_ID");a.value=h,l.value=2,s.value="success"}}),(r,u)=>{const p=te("a-button"),h=te("a-space"),d=te("a-result");return v(),j(Bt,null,{default:Y(()=>[D(zt,null,{default:Y(()=>[D(Lt),l.value===2?(v(),j(mi,{key:0,agent_id:a.value,session_id:i.value},null,8,["agent_id","session_id"])):W("",!0),l.value===3?(v(),j(d,{key:1,status:"error",title:s.value},{extra:Y(()=>[D(h,null,{default:Y(()=>[D(p,{type:"primary",onClick:f},{default:Y(()=>u[0]||(u[0]=[qt("返回")])),_:1})]),_:1})]),_:1},8,["title"])):W("",!0)]),_:1})]),_:1})}}};export{qi as default};
|