@deep-eye/core 1.2.9 → 1.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  `@deep-eye/core` 的用户可见变更(语义化版本)。
4
4
 
5
+ ## [1.2.10] - 2026-08-03
6
+
7
+ ### Changed
8
+
9
+ - 思考过程默认展开显示。
10
+
11
+ ### Fixed
12
+
13
+ - 移除表格流式输出时的骨架占位动画,流式渲染直接展示已有表格内容。
14
+
5
15
  ## [1.2.9] - 2026-08-03
6
16
 
7
17
  ### Fixed
@@ -1 +1 @@
1
- {"version":3,"file":"ChatReasoning.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/components/ChatReasoning.vue"],"names":[],"mappings":"AAqVA,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAqO5D,QAAA,IAAI,QAAQ;;;CAAY,CAAE;AAC1B,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAQhD,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ChatReasoning.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/components/ChatReasoning.vue"],"names":[],"mappings":"AA0VA,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AA0O5D,QAAA,IAAI,QAAQ;;;CAAY,CAAE;AAC1B,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAQhD,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -1,4 +1,2 @@
1
- export declare function decorateTables(html: string, options?: {
2
- streaming?: boolean;
3
- }): string;
1
+ export declare function decorateTables(html: string): string;
4
2
  //# sourceMappingURL=tableStreaming.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tableStreaming.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/mdoc/tableStreaming.ts"],"names":[],"mappings":"AAUA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CAuB1F"}
1
+ {"version":3,"file":"tableStreaming.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/mdoc/tableStreaming.ts"],"names":[],"mappings":"AASA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkBnD"}
package/dist/index.cjs CHANGED
@@ -507,9 +507,9 @@ l0,-`+(e+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
507
507
  please report what input caused this bug`);return g=g.slice(1,-1),{type:"verb",mode:"text",body:g,star:i}}Vn.hasOwnProperty(e[0])&&!ae[this.mode][e[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+e[0]+'" used in math mode',A),e=Vn[e[0]]+e.slice(1));var o=Eh.exec(e);o&&(e=e.substring(0,o.index),e==="i"?e="ı":e==="j"&&(e="ȷ"));var s;if(ae[this.mode][e]){this.settings.strict&&this.mode==="math"&&Va.includes(e)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+e[0]+'" used in math mode',A);var n=ae[this.mode][e].group,I=Oe.range(A),C;if(hE.hasOwnProperty(n)){var r=n;C={type:"atom",mode:this.mode,family:r,loc:I,text:e}}else C={type:n,mode:this.mode,loc:I,text:e};s=C}else if(e.charCodeAt(0)>=128)this.settings.strict&&(ir(e.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+e[0]+'" used in math mode',A):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+e[0]+'"'+(" ("+e.charCodeAt(0)+")"),A)),s={type:"textord",mode:"text",loc:Oe.range(A),text:e};else return null;if(this.consume(),o)for(var B=0;B<o[0].length;B++){var c=o[0][B];if(!ua[c])throw new eA("Unknown accent ' "+c+"'",A);var l=ua[c][this.mode]||ua[c].text;if(!l)throw new eA("Accent "+c+" unsupported in "+this.mode+" mode",A);s={type:"accent",mode:this.mode,loc:Oe.range(A),label:l,isStretchy:!1,isShifty:!0,base:s}}return s}}Oo.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Ss=function(A,e){if(!(typeof A=="string"||A instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var g=new Oo(A,e);delete g.gullet.macros.current["\\df@tag"];var i=g.parse();if(delete g.gullet.macros.current["\\current@color"],delete g.gullet.macros.current["\\color"],g.gullet.macros.get("\\df@tag")){if(!e.displayMode)throw new eA("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:g.subparse([new At("\\df@tag")])}]}return i},Pr=function(A,e,g){e.textContent="";var i=Gs(A,g).toNode();e.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Pr=function(){throw new eA("KaTeX doesn't work in quirks mode.")});var wh=function(A,e){var g=Gs(A,e).toMarkup();return g},ph=function(A,e){var g=new us(e);return Ss(A,g)},$r=function(A,e,g){if(g.throwOnError||!(A instanceof eA))throw A;var i=z(["katex-error"],[new et(e)]);return i.setAttribute("title",A.toString()),i.setAttribute("style","color:"+g.errorColor),i},Gs=function(A,e){var g=new us(e);try{var i=Ss(A,g);return RE(i,A,g)}catch(o){return $r(o,A,g)}},Dh=function(A,e){var g=new us(e);try{var i=Ss(A,g);return YE(i,A,g)}catch(o){return $r(o,A,g)}},kh="0.16.45",yh={Span:Kg,Anchor:Uo,SymbolNode:et,SvgNode:Yt,PathNode:zt,LineNode:Wa},Fh={version:kh,render:Pr,renderToString:wh,ParseError:eA,SETTINGS_SCHEMA:qa,__parse:ph,__renderToDomTree:Gs,__renderToHTMLTree:Dh,__setFontMetrics:cE,__defineSymbol:Q,__defineFunction:QA,__defineMacro:f,__domTree:yh};const Nh=/<summary\b[^>]*>[\s\S]*?<\/summary\s*>/gi,bh=/<summary\b/gi;function A0(t){return t?Sh(vh(t)):""}function vh(t){const A=t.replace(Nh,""),e=[...A.matchAll(bh)],g=e[e.length-1];return(g==null?void 0:g.index)!==void 0?A.slice(0,g.index):A}function Sh(t){return t.trim()?t.replace(/^(?:[\t ]*\r?\n)+/,"").replace(/(?:\r?\n[\t ]*)+$/,"").replace(/(?:\r?\n[\t ]*){3,}/g,`
508
508
 
509
509
  `):""}/*! @license DOMPurify 3.4.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.2/LICENSE */const{entries:e0,setPrototypeOf:_n,isFrozen:Gh,getPrototypeOf:Rh,getOwnPropertyDescriptor:Yh}=Object;let{freeze:qe,seal:st,create:yg}=Object,{apply:ts,construct:gs}=typeof Reflect<"u"&&Reflect;qe||(qe=function(A){return A});st||(st=function(A){return A});ts||(ts=function(A,e){for(var g=arguments.length,i=new Array(g>2?g-2:0),o=2;o<g;o++)i[o-2]=arguments[o];return A.apply(e,i)});gs||(gs=function(A){for(var e=arguments.length,g=new Array(e>1?e-1:0),i=1;i<e;i++)g[i-1]=arguments[i];return new A(...g)});const Pg=ke(Array.prototype.forEach),Jh=ke(Array.prototype.lastIndexOf),On=ke(Array.prototype.pop),$g=ke(Array.prototype.push),Uh=ke(Array.prototype.splice),Le=Array.isArray,Ci=ke(String.prototype.toLowerCase),da=ke(String.prototype.toString),Xn=ke(String.prototype.match),wg=ke(String.prototype.replace),zn=ke(String.prototype.indexOf),Mh=ke(String.prototype.trim),xh=ke(Number.prototype.toString),Lh=ke(Boolean.prototype.toString),jn=typeof BigInt>"u"?null:ke(BigInt.prototype.toString),Pn=typeof Symbol>"u"?null:ke(Symbol.prototype.toString),ce=ke(Object.prototype.hasOwnProperty),Ai=ke(Object.prototype.toString),Je=ke(RegExp.prototype.test),Vi=Hh(TypeError);function ke(t){return function(A){A instanceof RegExp&&(A.lastIndex=0);for(var e=arguments.length,g=new Array(e>1?e-1:0),i=1;i<e;i++)g[i-1]=arguments[i];return ts(t,A,g)}}function Hh(t){return function(){for(var A=arguments.length,e=new Array(A),g=0;g<A;g++)e[g]=arguments[g];return gs(t,e)}}function RA(t,A){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ci;if(_n&&_n(t,null),!Le(A))return t;let g=A.length;for(;g--;){let i=A[g];if(typeof i=="string"){const o=e(i);o!==i&&(Gh(A)||(A[g]=o),i=o)}t[i]=!0}return t}function Kh(t){for(let A=0;A<t.length;A++)ce(t,A)||(t[A]=null);return t}function _e(t){const A=yg(null);for(const[e,g]of e0(t))ce(t,e)&&(Le(g)?A[e]=Kh(g):g&&typeof g=="object"&&g.constructor===Object?A[e]=_e(g):A[e]=g);return A}function qh(t){switch(typeof t){case"string":return t;case"number":return xh(t);case"boolean":return Lh(t);case"bigint":return jn?jn(t):"0";case"symbol":return Pn?Pn(t):"Symbol()";case"undefined":return Ai(t);case"function":case"object":{if(t===null)return Ai(t);const A=t,e=Fg(A,"toString");if(typeof e=="function"){const g=e(A);return typeof g=="string"?g:Ai(g)}return Ai(t)}default:return Ai(t)}}function Fg(t,A){for(;t!==null;){const g=Yh(t,A);if(g){if(g.get)return ke(g.get);if(typeof g.value=="function")return ke(g.value)}t=Rh(t)}function e(){return null}return e}function Th(t){try{return Je(t,""),!0}catch{return!1}}const $n=qe(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ma=qe(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),fa=qe(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Zh=qe(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),wa=qe(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Wh=qe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),AI=qe(["#text"]),eI=qe(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),pa=qe(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),tI=qe(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),_i=qe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Vh=st(/\{\{[\w\W]*|[\w\W]*\}\}/gm),_h=st(/<%[\w\W]*|[\w\W]*%>/gm),Oh=st(/\$\{[\w\W]*/gm),Xh=st(/^data-[\-\w.\u00B7-\uFFFF]+$/),zh=st(/^aria-[\-\w]+$/),t0=st(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jh=st(/^(?:\w+script|data):/i),Ph=st(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),g0=st(/^html$/i),$h=st(/^[a-z][.\w]*(-[.\w]+)+$/i);var gI=Object.freeze({__proto__:null,ARIA_ATTR:zh,ATTR_WHITESPACE:Ph,CUSTOM_ELEMENT:$h,DATA_ATTR:Xh,DOCTYPE_NAME:g0,ERB_EXPR:_h,IS_ALLOWED_URI:t0,IS_SCRIPT_OR_DATA:jh,MUSTACHE_EXPR:Vh,TMPLIT_EXPR:Oh});const ei={element:1,text:3,progressingInstruction:7,comment:8,document:9},Au=function(){return typeof window>"u"?null:window},eu=function(A,e){if(typeof A!="object"||typeof A.createPolicy!="function")return null;let g=null;const i="data-tt-policy-suffix";e&&e.hasAttribute(i)&&(g=e.getAttribute(i));const o="dompurify"+(g?"#"+g:"");try{return A.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},iI=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function i0(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Au();const A=W=>i0(W);if(A.version="3.4.2",A.removed=[],!t||!t.document||t.document.nodeType!==ei.document||!t.Element)return A.isSupported=!1,A;let{document:e}=t;const g=e,i=g.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:n,Element:I,NodeFilter:C,NamedNodeMap:r=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:B,DOMParser:c,trustedTypes:l}=t,h=I.prototype,d=Fg(h,"cloneNode"),u=Fg(h,"remove"),p=Fg(h,"nextSibling"),b=Fg(h,"childNodes"),N=Fg(h,"parentNode");if(typeof s=="function"){const W=e.createElement("template");W.content&&W.content.ownerDocument&&(e=W.content.ownerDocument)}let y,v="";const{implementation:U,createNodeIterator:G,createDocumentFragment:Y,getElementsByTagName:K}=e,{importNode:sA}=g;let _=iI();A.isSupported=typeof e0=="function"&&typeof N=="function"&&U&&U.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:AA,ERB_EXPR:BA,TMPLIT_EXPR:uA,DATA_ATTR:L,ARIA_ATTR:q,IS_SCRIPT_OR_DATA:IA,ATTR_WHITESPACE:O,CUSTOM_ELEMENT:Z}=gI;let{IS_ALLOWED_URI:iA}=gI,cA=null;const vA=RA({},[...$n,...ma,...fa,...wa,...AI]);let fA=null;const rA=RA({},[...eI,...pa,...tI,..._i]);let gA=Object.seal(yg(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),lA=null,LA=null;const UA=Object.seal(yg(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let MA=!0,te=!0,Ee=!1,dA=!0,ne=!1,Qe=!0,PA=!1,T=!1,hA=!1,nA=!1,x=!1,oA=!1,WA=!0,de=!1;const Me="user-content-";let me=!0,H=!1,j={},X=null;const ZA=RA({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let OA=null;const Fe=RA({},["audio","video","img","source","image","track"]);let he=null;const hg=RA({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pt="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",Ze="http://www.w3.org/1999/xhtml";let Qt=Ze,_g=!1,Og=null;const $o=RA({},[pt,xt,Ze],da);let Xg=RA({},["mi","mo","mn","ms","mtext"]),zg=RA({},["annotation-xml"]);const Ri=RA({},["title","style","font","a","script"]);let tg=null;const gg=["application/xhtml+xml","text/html"],An="text/html";let fe=null,ig=null;const en=e.createElement("form"),Aa=function(D){return D instanceof RegExp||D instanceof Function},Yi=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ig&&ig===D)return;(!D||typeof D!="object")&&(D={}),D=_e(D),tg=gg.indexOf(D.PARSER_MEDIA_TYPE)===-1?An:D.PARSER_MEDIA_TYPE,fe=tg==="application/xhtml+xml"?da:Ci,cA=ce(D,"ALLOWED_TAGS")&&Le(D.ALLOWED_TAGS)?RA({},D.ALLOWED_TAGS,fe):vA,fA=ce(D,"ALLOWED_ATTR")&&Le(D.ALLOWED_ATTR)?RA({},D.ALLOWED_ATTR,fe):rA,Og=ce(D,"ALLOWED_NAMESPACES")&&Le(D.ALLOWED_NAMESPACES)?RA({},D.ALLOWED_NAMESPACES,da):$o,he=ce(D,"ADD_URI_SAFE_ATTR")&&Le(D.ADD_URI_SAFE_ATTR)?RA(_e(hg),D.ADD_URI_SAFE_ATTR,fe):hg,OA=ce(D,"ADD_DATA_URI_TAGS")&&Le(D.ADD_DATA_URI_TAGS)?RA(_e(Fe),D.ADD_DATA_URI_TAGS,fe):Fe,X=ce(D,"FORBID_CONTENTS")&&Le(D.FORBID_CONTENTS)?RA({},D.FORBID_CONTENTS,fe):ZA,lA=ce(D,"FORBID_TAGS")&&Le(D.FORBID_TAGS)?RA({},D.FORBID_TAGS,fe):_e({}),LA=ce(D,"FORBID_ATTR")&&Le(D.FORBID_ATTR)?RA({},D.FORBID_ATTR,fe):_e({}),j=ce(D,"USE_PROFILES")?D.USE_PROFILES&&typeof D.USE_PROFILES=="object"?_e(D.USE_PROFILES):D.USE_PROFILES:!1,MA=D.ALLOW_ARIA_ATTR!==!1,te=D.ALLOW_DATA_ATTR!==!1,Ee=D.ALLOW_UNKNOWN_PROTOCOLS||!1,dA=D.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ne=D.SAFE_FOR_TEMPLATES||!1,Qe=D.SAFE_FOR_XML!==!1,PA=D.WHOLE_DOCUMENT||!1,nA=D.RETURN_DOM||!1,x=D.RETURN_DOM_FRAGMENT||!1,oA=D.RETURN_TRUSTED_TYPE||!1,hA=D.FORCE_BODY||!1,WA=D.SANITIZE_DOM!==!1,de=D.SANITIZE_NAMED_PROPS||!1,me=D.KEEP_CONTENT!==!1,H=D.IN_PLACE||!1,iA=Th(D.ALLOWED_URI_REGEXP)?D.ALLOWED_URI_REGEXP:t0,Qt=typeof D.NAMESPACE=="string"?D.NAMESPACE:Ze,Xg=ce(D,"MATHML_TEXT_INTEGRATION_POINTS")&&D.MATHML_TEXT_INTEGRATION_POINTS&&typeof D.MATHML_TEXT_INTEGRATION_POINTS=="object"?_e(D.MATHML_TEXT_INTEGRATION_POINTS):RA({},["mi","mo","mn","ms","mtext"]),zg=ce(D,"HTML_INTEGRATION_POINTS")&&D.HTML_INTEGRATION_POINTS&&typeof D.HTML_INTEGRATION_POINTS=="object"?_e(D.HTML_INTEGRATION_POINTS):RA({},["annotation-xml"]);const w=ce(D,"CUSTOM_ELEMENT_HANDLING")&&D.CUSTOM_ELEMENT_HANDLING&&typeof D.CUSTOM_ELEMENT_HANDLING=="object"?_e(D.CUSTOM_ELEMENT_HANDLING):yg(null);if(gA=yg(null),ce(w,"tagNameCheck")&&Aa(w.tagNameCheck)&&(gA.tagNameCheck=w.tagNameCheck),ce(w,"attributeNameCheck")&&Aa(w.attributeNameCheck)&&(gA.attributeNameCheck=w.attributeNameCheck),ce(w,"allowCustomizedBuiltInElements")&&typeof w.allowCustomizedBuiltInElements=="boolean"&&(gA.allowCustomizedBuiltInElements=w.allowCustomizedBuiltInElements),ne&&(te=!1),x&&(nA=!0),j&&(cA=RA({},AI),fA=yg(null),j.html===!0&&(RA(cA,$n),RA(fA,eI)),j.svg===!0&&(RA(cA,ma),RA(fA,pa),RA(fA,_i)),j.svgFilters===!0&&(RA(cA,fa),RA(fA,pa),RA(fA,_i)),j.mathMl===!0&&(RA(cA,wa),RA(fA,tI),RA(fA,_i))),UA.tagCheck=null,UA.attributeCheck=null,ce(D,"ADD_TAGS")&&(typeof D.ADD_TAGS=="function"?UA.tagCheck=D.ADD_TAGS:Le(D.ADD_TAGS)&&(cA===vA&&(cA=_e(cA)),RA(cA,D.ADD_TAGS,fe))),ce(D,"ADD_ATTR")&&(typeof D.ADD_ATTR=="function"?UA.attributeCheck=D.ADD_ATTR:Le(D.ADD_ATTR)&&(fA===rA&&(fA=_e(fA)),RA(fA,D.ADD_ATTR,fe))),ce(D,"ADD_URI_SAFE_ATTR")&&Le(D.ADD_URI_SAFE_ATTR)&&RA(he,D.ADD_URI_SAFE_ATTR,fe),ce(D,"FORBID_CONTENTS")&&Le(D.FORBID_CONTENTS)&&(X===ZA&&(X=_e(X)),RA(X,D.FORBID_CONTENTS,fe)),ce(D,"ADD_FORBID_CONTENTS")&&Le(D.ADD_FORBID_CONTENTS)&&(X===ZA&&(X=_e(X)),RA(X,D.ADD_FORBID_CONTENTS,fe)),me&&(cA["#text"]=!0),PA&&RA(cA,["html","head","body"]),cA.table&&(RA(cA,["tbody"]),delete lA.tbody),D.TRUSTED_TYPES_POLICY){if(typeof D.TRUSTED_TYPES_POLICY.createHTML!="function")throw Vi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof D.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Vi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=D.TRUSTED_TYPES_POLICY,v=y.createHTML("")}else y===void 0&&(y=eu(l,i)),y!==null&&typeof v=="string"&&(v=y.createHTML(""));qe&&qe(D),ig=D},R=RA({},[...ma,...fa,...Zh]),J=RA({},[...wa,...Wh]),P=function(D){let w=N(D);(!w||!w.tagName)&&(w={namespaceURI:Qt,tagName:"template"});const M=Ci(D.tagName),CA=Ci(w.tagName);return Og[D.namespaceURI]?D.namespaceURI===xt?w.namespaceURI===Ze?M==="svg":w.namespaceURI===pt?M==="svg"&&(CA==="annotation-xml"||Xg[CA]):!!R[M]:D.namespaceURI===pt?w.namespaceURI===Ze?M==="math":w.namespaceURI===xt?M==="math"&&zg[CA]:!!J[M]:D.namespaceURI===Ze?w.namespaceURI===xt&&!zg[CA]||w.namespaceURI===pt&&!Xg[CA]?!1:!J[M]&&(Ri[M]||!R[M]):!!(tg==="application/xhtml+xml"&&Og[D.namespaceURI]):!1},$=function(D){$g(A.removed,{element:D});try{N(D).removeChild(D)}catch{u(D)}},mA=function(D,w){try{$g(A.removed,{attribute:w.getAttributeNode(D),from:w})}catch{$g(A.removed,{attribute:null,from:w})}if(w.removeAttribute(D),D==="is")if(nA||x)try{$(w)}catch{}else try{w.setAttribute(D,"")}catch{}},yA=function(D){let w=null,M=null;if(hA)D="<remove></remove>"+D;else{const wA=Xn(D,/^[\r\n\t ]+/);M=wA&&wA[0]}tg==="application/xhtml+xml"&&Qt===Ze&&(D='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+D+"</body></html>");const CA=y?y.createHTML(D):D;if(Qt===Ze)try{w=new c().parseFromString(CA,tg)}catch{}if(!w||!w.documentElement){w=U.createDocument(Qt,"template",null);try{w.documentElement.innerHTML=_g?v:CA}catch{}}const FA=w.body||w.documentElement;return D&&M&&FA.insertBefore(e.createTextNode(M),FA.childNodes[0]||null),Qt===Ze?K.call(w,PA?"html":"body")[0]:PA?w.documentElement:FA},JA=function(D){return G.call(D.ownerDocument||D,D,C.SHOW_ELEMENT|C.SHOW_COMMENT|C.SHOW_TEXT|C.SHOW_PROCESSING_INSTRUCTION|C.SHOW_CDATA_SECTION,null)},DA=function(D){return D instanceof B&&(typeof D.nodeName!="string"||typeof D.textContent!="string"||typeof D.removeChild!="function"||!(D.attributes instanceof r)||typeof D.removeAttribute!="function"||typeof D.setAttribute!="function"||typeof D.namespaceURI!="string"||typeof D.insertBefore!="function"||typeof D.hasChildNodes!="function")},HA=function(D){return typeof n=="function"&&D instanceof n};function bA(W,D,w){Pg(W,M=>{M.call(A,D,w,ig)})}const Ie=function(D){let w=null;if(bA(_.beforeSanitizeElements,D,null),DA(D))return $(D),!0;const M=fe(D.nodeName);if(bA(_.uponSanitizeElement,D,{tagName:M,allowedTags:cA}),Qe&&D.hasChildNodes()&&!HA(D.firstElementChild)&&Je(/<[/\w!]/g,D.innerHTML)&&Je(/<[/\w!]/g,D.textContent)||Qe&&D.namespaceURI===Ze&&M==="style"&&HA(D.firstElementChild)||D.nodeType===ei.progressingInstruction||Qe&&D.nodeType===ei.comment&&Je(/<[/\w]/g,D.data))return $(D),!0;if(lA[M]||!(UA.tagCheck instanceof Function&&UA.tagCheck(M))&&!cA[M]){if(!lA[M]&&Ne(M)&&(gA.tagNameCheck instanceof RegExp&&Je(gA.tagNameCheck,M)||gA.tagNameCheck instanceof Function&&gA.tagNameCheck(M)))return!1;if(me&&!X[M]){const CA=N(D)||D.parentNode,FA=b(D)||D.childNodes;if(FA&&CA){const wA=FA.length;for(let jA=wA-1;jA>=0;--jA){const Ce=d(FA[jA],!0);CA.insertBefore(Ce,p(D))}}}return $(D),!0}return D instanceof I&&!P(D)||(M==="noscript"||M==="noembed"||M==="noframes")&&Je(/<\/no(script|embed|frames)/i,D.innerHTML)?($(D),!0):(ne&&D.nodeType===ei.text&&(w=D.textContent,Pg([AA,BA,uA],CA=>{w=wg(w,CA," ")}),D.textContent!==w&&($g(A.removed,{element:D.cloneNode()}),D.textContent=w)),bA(_.afterSanitizeElements,D,null),!1)},Ge=function(D,w,M){if(LA[w]||WA&&(w==="id"||w==="name")&&(M in e||M in en))return!1;const CA=fA[w]||UA.attributeCheck instanceof Function&&UA.attributeCheck(w,D);if(!(te&&!LA[w]&&Je(L,w))){if(!(MA&&Je(q,w))){if(!CA||LA[w]){if(!(Ne(D)&&(gA.tagNameCheck instanceof RegExp&&Je(gA.tagNameCheck,D)||gA.tagNameCheck instanceof Function&&gA.tagNameCheck(D))&&(gA.attributeNameCheck instanceof RegExp&&Je(gA.attributeNameCheck,w)||gA.attributeNameCheck instanceof Function&&gA.attributeNameCheck(w,D))||w==="is"&&gA.allowCustomizedBuiltInElements&&(gA.tagNameCheck instanceof RegExp&&Je(gA.tagNameCheck,M)||gA.tagNameCheck instanceof Function&&gA.tagNameCheck(M))))return!1}else if(!he[w]){if(!Je(iA,wg(M,O,""))){if(!((w==="src"||w==="xlink:href"||w==="href")&&D!=="script"&&zn(M,"data:")===0&&OA[D])){if(!(Ee&&!Je(IA,wg(M,O,"")))){if(M)return!1}}}}}}return!0},It=RA({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ne=function(D){return!It[Ci(D)]&&Je(Z,D)},Dt=function(D){bA(_.beforeSanitizeAttributes,D,null);const{attributes:w}=D;if(!w||DA(D))return;const M={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:fA,forceKeepAttr:void 0};let CA=w.length;for(;CA--;){const FA=w[CA],{name:wA,namespaceURI:jA,value:Ce}=FA,Ye=fe(wA),We=Ce;let $A=wA==="value"?We:Mh(We);if(M.attrName=Ye,M.attrValue=$A,M.keepAttr=!0,M.forceKeepAttr=void 0,bA(_.uponSanitizeAttribute,D,M),$A=M.attrValue,de&&(Ye==="id"||Ye==="name")&&zn($A,Me)!==0&&(mA(wA,D),$A=Me+$A),Qe&&Je(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$A)){mA(wA,D);continue}if(Ye==="attributename"&&Xn($A,"href")){mA(wA,D);continue}if(M.forceKeepAttr)continue;if(!M.keepAttr){mA(wA,D);continue}if(!dA&&Je(/\/>/i,$A)){mA(wA,D);continue}ne&&Pg([AA,BA,uA],Ui=>{$A=wg($A,Ui," ")});const Ji=fe(D.nodeName);if(!Ge(Ji,Ye,$A)){mA(wA,D);continue}if(y&&typeof l=="object"&&typeof l.getAttributeType=="function"&&!jA)switch(l.getAttributeType(Ji,Ye)){case"TrustedHTML":{$A=y.createHTML($A);break}case"TrustedScriptURL":{$A=y.createScriptURL($A);break}}if($A!==We)try{jA?D.setAttributeNS(jA,wA,$A):D.setAttribute(wA,$A),DA(D)?$(D):On(A.removed)}catch{mA(wA,D)}}bA(_.afterSanitizeAttributes,D,null)},oe=function(D){let w=null;const M=JA(D);for(bA(_.beforeSanitizeShadowDOM,D,null);w=M.nextNode();)bA(_.uponSanitizeShadowNode,w,null),Ie(w),Dt(w),w.content instanceof o&&oe(w.content);bA(_.afterSanitizeShadowDOM,D,null)};return A.sanitize=function(W){let D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=null,M=null,CA=null,FA=null;if(_g=!W,_g&&(W="<!-->"),typeof W!="string"&&!HA(W)&&(W=qh(W),typeof W!="string"))throw Vi("dirty is not a string, aborting");if(!A.isSupported)return W;if(T||Yi(D),A.removed=[],typeof W=="string"&&(H=!1),H){const Ce=W.nodeName;if(typeof Ce=="string"){const Ye=fe(Ce);if(!cA[Ye]||lA[Ye])throw Vi("root node is forbidden and cannot be sanitized in-place")}}else if(W instanceof n)w=yA("<!---->"),M=w.ownerDocument.importNode(W,!0),M.nodeType===ei.element&&M.nodeName==="BODY"||M.nodeName==="HTML"?w=M:w.appendChild(M);else{if(!nA&&!ne&&!PA&&W.indexOf("<")===-1)return y&&oA?y.createHTML(W):W;if(w=yA(W),!w)return nA?null:oA?v:""}w&&hA&&$(w.firstChild);const wA=JA(H?W:w);for(;CA=wA.nextNode();)Ie(CA),Dt(CA),CA.content instanceof o&&oe(CA.content);if(H)return W;if(nA){if(ne){w.normalize();let Ce=w.innerHTML;Pg([AA,BA,uA],Ye=>{Ce=wg(Ce,Ye," ")}),w.innerHTML=Ce}if(x)for(FA=Y.call(w.ownerDocument);w.firstChild;)FA.appendChild(w.firstChild);else FA=w;return(fA.shadowroot||fA.shadowrootmode)&&(FA=sA.call(g,FA,!0)),FA}let jA=PA?w.outerHTML:w.innerHTML;return PA&&cA["!doctype"]&&w.ownerDocument&&w.ownerDocument.doctype&&w.ownerDocument.doctype.name&&Je(g0,w.ownerDocument.doctype.name)&&(jA="<!DOCTYPE "+w.ownerDocument.doctype.name+`>
510
- `+jA),ne&&Pg([AA,BA,uA],Ce=>{jA=wg(jA,Ce," ")}),y&&oA?y.createHTML(jA):jA},A.setConfig=function(){let W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yi(W),T=!0},A.clearConfig=function(){ig=null,T=!1},A.isValidAttribute=function(W,D,w){ig||Yi({});const M=fe(W),CA=fe(D);return Ge(M,CA,w)},A.addHook=function(W,D){typeof D=="function"&&$g(_[W],D)},A.removeHook=function(W,D){if(D!==void 0){const w=Jh(_[W],D);return w===-1?void 0:Uh(_[W],w,1)[0]}return On(_[W])},A.removeHooks=function(W){_[W]=[]},A.removeAllHooks=function(){_=iI()},A}var tu=i0();const gu={ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","p","br","hr","strong","em","u","s","del","ins","a","img","ul","ol","li","blockquote","pre","code","table","thead","tbody","tr","th","td","div","span","annotation","math","semantics","mrow","mi","mo","mn","msup","msub","mfrac"],ALLOWED_ATTR:["href","target","rel","src","alt","width","height","class","id","colspan","rowspan","style","aria-hidden"],ALLOW_DATA_ATTR:!1};function iu(t){return tu.sanitize(t,gu)}const ou=/<table[\s\S]*?<\/table>/g;function au(t,A={}){const e=[...t.matchAll(ou)];if(e.length===0)return t;let g="",i=0;for(let o=0;o<e.length;o+=1){const s=e[o],n=s[0],I=s.index,C=I+n.length,r=o===e.length-1&&!t.slice(C).trim(),B=A.streaming===!0&&r;g+=t.slice(i,I),g+=B?`<div class="table-node-wrapper table-node--loading"><div class="table-node">${n}</div><div class="table-node__loading"><span class="table-node__spinner"></span></div></div>`:`<div class="table-node-wrapper"><div class="table-node">${n}</div></div>`,i=C}return g+t.slice(i)}const fo=a.ref(!1);let ti=null;function o0(){return fo.value?Promise.resolve():ti||(ti=xc().then(()=>{fo.value=!0}).catch(t=>{console.error("[mdoc] Failed to initialize md4x:",t),ti=null}),ti)}typeof window<"u"&&o0();const su=/\[(IMG|VIDEO|AUDIO):\{([^}]+)\}\]/g,nu=/<x-equation(\s+type="display")?>([\s\S]*?)<\/x-equation>/g;function Iu(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}function Cu(t){return t.replace(nu,(A,e,g)=>{const i=!!e,o=Fh.renderToString(Iu(g).trim(),{displayMode:i,throwOnError:!1,strict:!1});return i?`<span class="math-block">${o}</span>`:`<span class="math-inline">${o}</span>`})}function ru(t){const A=[];let e=0;return{content:t.replace(su,(i,o,s)=>{try{const n=JSON.parse(`{${s}}`),I=o==="IMG"?"image":o.toLowerCase(),C=`media-${e}`;return A.push({id:C,type:I,data:n}),e+=1,`
510
+ `+jA),ne&&Pg([AA,BA,uA],Ce=>{jA=wg(jA,Ce," ")}),y&&oA?y.createHTML(jA):jA},A.setConfig=function(){let W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yi(W),T=!0},A.clearConfig=function(){ig=null,T=!1},A.isValidAttribute=function(W,D,w){ig||Yi({});const M=fe(W),CA=fe(D);return Ge(M,CA,w)},A.addHook=function(W,D){typeof D=="function"&&$g(_[W],D)},A.removeHook=function(W,D){if(D!==void 0){const w=Jh(_[W],D);return w===-1?void 0:Uh(_[W],w,1)[0]}return On(_[W])},A.removeHooks=function(W){_[W]=[]},A.removeAllHooks=function(){_=iI()},A}var tu=i0();const gu={ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","p","br","hr","strong","em","u","s","del","ins","a","img","ul","ol","li","blockquote","pre","code","table","thead","tbody","tr","th","td","div","span","annotation","math","semantics","mrow","mi","mo","mn","msup","msub","mfrac"],ALLOWED_ATTR:["href","target","rel","src","alt","width","height","class","id","colspan","rowspan","style","aria-hidden"],ALLOW_DATA_ATTR:!1};function iu(t){return tu.sanitize(t,gu)}const ou=/<table[\s\S]*?<\/table>/g;function au(t){const A=[...t.matchAll(ou)];if(A.length===0)return t;let e="",g=0;for(const i of A){const o=i[0],s=i.index,n=s+o.length;e+=t.slice(g,s),e+=`<div class="table-node-wrapper"><div class="table-node">${o}</div></div>`,g=n}return e+t.slice(g)}const fo=a.ref(!1);let ti=null;function o0(){return fo.value?Promise.resolve():ti||(ti=xc().then(()=>{fo.value=!0}).catch(t=>{console.error("[mdoc] Failed to initialize md4x:",t),ti=null}),ti)}typeof window<"u"&&o0();const su=/\[(IMG|VIDEO|AUDIO):\{([^}]+)\}\]/g,nu=/<x-equation(\s+type="display")?>([\s\S]*?)<\/x-equation>/g;function Iu(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}function Cu(t){return t.replace(nu,(A,e,g)=>{const i=!!e,o=Fh.renderToString(Iu(g).trim(),{displayMode:i,throwOnError:!1,strict:!1});return i?`<span class="math-block">${o}</span>`:`<span class="math-inline">${o}</span>`})}function ru(t){const A=[];let e=0;return{content:t.replace(su,(i,o,s)=>{try{const n=JSON.parse(`{${s}}`),I=o==="IMG"?"image":o.toLowerCase(),C=`media-${e}`;return A.push({id:C,type:I,data:n}),e+=1,`
511
511
  %%${C}%%
512
- `}catch{return i}}),media:A}}function Bu(t,A={}){if(!t)return[];if(!fo.value)return[{type:"html",id:"pending",html:"<p></p>"}];const e=A0(t);if(!e)return[];const{content:g,media:i}=ru(e);let o=Mc(g,{heal:A.streaming===!0});o=Cu(o),o=iu(o),o=au(o,{streaming:A.streaming===!0}),o=o.replace(/<p>\s*((?:%%media-\d+%%\s*)+)<\/p>/g,"$1");const s=new Map(i.map(r=>[r.id,r])),n=o.split(/(%%media-\d+%%)/),I=[];let C=0;for(const r of n){const B=r.match(/^%%(media-\d+)%%$/);if(B){const c=s.get(B[1]);if(!c||typeof c.data.url!="string")continue;c.type==="image"?I.push({type:"image",id:`${c.id}-${C}`,url:c.data.url,alt:typeof c.data.alt=="string"?c.data.alt:void 0}):c.type==="video"?I.push({type:"video",id:`${c.id}-${C}`,url:c.data.url,poster:typeof c.data.poster=="string"?c.data.poster:void 0}):I.push({type:"audio",id:`${c.id}-${C}`,url:c.data.url,title:typeof c.data.title=="string"?c.data.title:void 0}),C+=1;continue}r.trim()&&(I.push({type:"html",id:`html-${C}`,html:r}),C+=1)}return Qu(I)}function Qu(t){const A=[];let e=[];const g=()=>{e.length!==0&&(e.length===1?A.push(e[0]):A.push({type:"image-stack",id:`image-stack-${e[0].id}`,images:e.map(i=>({id:i.id,url:i.url,alt:i.alt}))}),e=[])};for(const i of t){if(i.type==="image"){e.push(i);continue}g(),A.push(i)}return g(),A}const lu={key:1,class:"content-nodes__text"},cu=["innerHTML"],Eu={key:3,class:"content-nodes__media"},hu=["src","poster"],uu={key:4,class:"content-nodes__media"},du={key:0},mu=["src"],fu=a.defineComponent({name:"ContentNodes",__name:"ContentNodes",props:{content:{},isStreaming:{type:Boolean},highlightStreamTail:{type:Boolean},density:{}},emits:["action"],setup(t,{emit:A}){const e=t,g=A,i=a.ref([]),o=a.ref();function s(l,h){const d=new tr({registry:Jo});return l&&d.push(l),h||d.finalize(),d.getNodes().filter(u=>u.kind==="text"?u.text.length>0:u.tag==="ask-form"?!1:u.complete)}function n(){i.value=s(e.content,e.isStreaming===!0),a.nextTick(c)}a.watch(()=>[e.content,e.isStreaming,e.highlightStreamTail,fo.value],()=>n(),{immediate:!0}),a.onMounted(()=>{o0().then(()=>n())});const I=a.computed(()=>{const l=[];let h=-1;for(let d=0;d<i.value.length;d+=1)i.value[d].kind==="text"&&(h=d);for(let d=0;d<i.value.length;d+=1){const u=i.value[d];if(u.kind==="text"){const p=e.isStreaming===!0&&d===h;l.push({type:"text",key:u.id,segments:Bu(u.text,{streaming:p})});continue}u.tag==="artifact"&&l.push({type:"artifact",key:u.id,node:u})}return l});function C(){const l=o.value;if(!(!l||typeof document>"u"))for(const h of l.querySelectorAll(".content-nodes__stream-tail"))h.replaceWith(document.createTextNode(h.textContent??""))}function r(l){let h;const d=l.lastElementChild,u=d==null?void 0:d.lastElementChild;if(!(u!=null&&u.classList.contains("content-nodes__html")))return;function p(b){for(const N of b.childNodes){if(N.nodeType===3){const y=N,v=y.parentElement;y.data.trim().length>0&&v&&!v.closest(".math-block, .math-inline, .content-nodes__media")&&(h=y);continue}p(N)}}return p(u),h}function B(l){var y;const h=l.data,d=h.length-(((y=h.match(/\s*$/))==null?void 0:y[0].length)??0);if(d===0||typeof document>"u")return 0;const u=document.createRange();if(typeof u.getClientRects!="function")return 0;const p=v=>(u.setStart(l,v),u.setEnd(l,d),u.getClientRects().length);if(p(0)===0)return 0;let b=0,N=d;for(;b<N;){const v=Math.floor((b+N)/2);p(v)<=1?N=v:b=v+1}return b}function c(){C();const l=o.value;if(!l||!e.isStreaming||!e.highlightStreamTail||typeof document>"u")return;const h=r(l);if(!h||!h.data.trim())return;const d=B(h),u=h.data.slice(0,d),p=h.data.slice(d),b=document.createElement("span");b.className="content-nodes__stream-tail",b.textContent=p;const N=document.createDocumentFragment();u&&N.append(document.createTextNode(u)),N.append(b),h.replaceWith(N)}return(l,h)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"rootRef",ref:o,class:a.normalizeClass(["content-nodes",{"content-nodes--compact":t.density==="compact"}])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(I.value,d=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:d.key},[d.type==="artifact"?(a.openBlock(),a.createBlock(_l,{key:0,node:d.node,onAction:h[0]||(h[0]=u=>g("action",u))},null,8,["node"])):(a.openBlock(),a.createElementBlock("div",lu,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.segments,u=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:u.id},[u.type==="html"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"content-nodes__html",innerHTML:u.html},null,8,cu)):u.type==="image"?(a.openBlock(),a.createBlock(Qn,{key:1,images:[{id:u.id,url:u.url,alt:u.alt}]},null,8,["images"])):u.type==="image-stack"?(a.openBlock(),a.createBlock(Qn,{key:2,images:u.images},null,8,["images"])):u.type==="video"?(a.openBlock(),a.createElementBlock("figure",Eu,[a.createElementVNode("video",{src:u.url,poster:u.poster,controls:"",playsinline:""},null,8,hu)])):u.type==="audio"?(a.openBlock(),a.createElementBlock("figure",uu,[u.title?(a.openBlock(),a.createElementBlock("figcaption",du,a.toDisplayString(u.title),1)):a.createCommentVNode("",!0),a.createElementVNode("audio",{src:u.url,controls:""},null,8,mu)])):a.createCommentVNode("",!0)],64))),128))]))],64))),128))],2))}}),wu=xA(fu,[["__scopeId","data-v-8ef9846c"]]),pu=8;function Du(t,A){const e=a.ref(t.value);let g,i=!1;function o(){g!==void 0&&(cancelAnimationFrame(g),g=void 0)}function s(){const n=t.value,I=e.value;if(!A.value||I.length>=n.length){e.value=n,g=void 0;return}const C=n.length-I.length,r=Math.max(1,Math.ceil(C/pu));e.value=n.slice(0,I.length+r),g=requestAnimationFrame(s)}return a.watch(t,n=>{if(!i){i=!0,e.value=n;return}if(!A.value||n.length<e.value.length){e.value=n,o();return}g===void 0&&(g=requestAnimationFrame(s))},{immediate:!0}),a.watch(A,n=>{n||(e.value=t.value,o())}),a.onBeforeUnmount(o),{displayed:e}}const Rs=a.defineComponent({name:"TextPartRenderer",__name:"TextPartRenderer",props:{content:{},isStreaming:{type:Boolean},highlightStreamTail:{type:Boolean},density:{default:"default"}},emits:["action"],setup(t,{emit:A}){const e=t,g=A,{displayed:i}=Du(a.toRef(e,"content"),a.computed(()=>e.isStreaming===!0));return(o,s)=>(a.openBlock(),a.createBlock(wu,{content:a.unref(i),"is-streaming":t.isStreaming,"highlight-stream-tail":t.highlightStreamTail,density:t.density,onAction:s[0]||(s[0]=n=>g("action",n))},null,8,["content","is-streaming","highlight-stream-tail","density"]))}});function a0(t,A){const e=a.ref(void 0);let g;function i(){const s=t.value;s&&(e.value=`${s.scrollHeight}px`)}function o(){g==null||g.disconnect(),g=void 0}return a.watch([t,A],([s,n])=>{if(o(),!s||!n){e.value=void 0;return}i(),typeof ResizeObserver<"u"&&(g=new ResizeObserver(i),g.observe(s))},{immediate:!0,flush:"post"}),a.onBeforeUnmount(o),{height:e}}const ku=["open","aria-busy"],yu=["aria-expanded","aria-disabled"],Fu=a.defineComponent({__name:"ChatReasoning",props:{content:{},streaming:{type:Boolean}},setup(t){const A=t,e=a.ref(!1),g=a.ref(!1),i=a.ref(),o=a.ref(),{height:s}=a0(o,e),n=a.ref(0),I=a.ref(!1);let C=0,r;const B=a.computed(()=>!!A.content.trim());function c(){B.value&&(g.value=!0,e.value=!e.value)}a.watch(B,p=>{p||(e.value=!1,g.value=!1)}),a.watch(()=>A.streaming,p=>{g.value||(e.value=!1),p?l():h()}),a.watch(()=>A.content,()=>{!A.streaming||!e.value||a.nextTick(()=>{const p=i.value;p&&(p.scrollTop=p.scrollHeight)})});function l(){r||(C=Date.now()-n.value*1e3,I.value=!0,r=setInterval(()=>{n.value=Math.floor((Date.now()-C)/1e3)},250))}function h(){r&&(clearInterval(r),r=void 0,n.value=Math.max(n.value,Math.floor((Date.now()-C)/1e3)))}function d(){if(n.value<1)return"<1 秒";if(n.value<60)return`${n.value} 秒`;const p=Math.floor(n.value/60),b=n.value%60;return b?`${p} 分 ${b} 秒`:`${p} 分钟`}const u=a.computed(()=>A.streaming?`正在思考 ${d()}`:I.value?`已思考 ${d()}`:"思考过程");return a.onMounted(()=>{A.streaming&&l()}),a.onBeforeUnmount(h),(p,b)=>(a.openBlock(),a.createElementBlock("details",{class:a.normalizeClass(["chat-reasoning",{"chat-reasoning--empty":!B.value}]),open:e.value,"aria-busy":t.streaming?"true":void 0,"aria-label":"思考过程"},[a.createElementVNode("summary",{class:"chat-reasoning__summary","aria-expanded":e.value,"aria-disabled":B.value?void 0:"true",onClick:a.withModifiers(c,["prevent"])},[a.createVNode(a.unref(jB),{class:a.normalizeClass(["chat-reasoning__spark",{"chat-reasoning__spark--active":t.streaming}]),size:16,"stroke-width":1.75,"aria-hidden":"true"},null,8,["class"]),a.createElementVNode("span",{class:a.normalizeClass(["chat-reasoning__label",{"chat-reasoning__label--streaming":t.streaming}])},a.toDisplayString(u.value),3),B.value?(a.openBlock(),a.createBlock(a.unref(ls),{key:0,class:"chat-reasoning__chevron",size:14,"stroke-width":1.75,"aria-hidden":"true"})):a.createCommentVNode("",!0)],8,yu),B.value?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"bodyRef",ref:i,class:"chat-reasoning__viewport",style:a.normalizeStyle({height:a.unref(s)})},[a.createElementVNode("div",{ref_key:"contentRef",ref:o,class:"chat-reasoning__body"},[a.renderSlot(p.$slots,"default",{content:t.content,streaming:t.streaming===!0},()=>[a.createVNode(Rs,{content:t.content,"is-streaming":t.streaming,"highlight-stream-tail":t.streaming},null,8,["content","is-streaming","highlight-stream-tail"])],!0)],512)],4)):a.createCommentVNode("",!0)],10,ku))}}),s0=xA(Fu,[["__scopeId","data-v-09e6bd1d"]]),Nu=["aria-label"],bu={class:"conversation-chart__title"},vu={class:"conversation-chart__rows",role:"list"},Su={class:"conversation-chart__label"},Gu={class:"conversation-chart__bar-wrap"},Ru={class:"conversation-chart__value"},Yu=a.defineComponent({name:"ChartToolRenderer",__name:"ChartToolRenderer",props:{result:{}},setup(t){const A=t,e=a.computed(()=>{const o=i(A.result)?A.result:{},n=(Array.isArray(o.data)?o.data:[]).flatMap(C=>!i(C)||typeof C.label!="string"||typeof C.value!="number"?[]:[{label:C.label,value:C.value}]),I=Math.max(1,...n.map(C=>C.value));return{title:typeof o.title=="string"?o.title:"图表结果",rows:n,maxValue:I}});function g(o){return`${Math.max(0,Math.min(100,o/e.value.maxValue*100))}%`}function i(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}return(o,s)=>e.value.rows.length?(a.openBlock(),a.createElementBlock("section",{key:0,class:"conversation-chart","aria-label":e.value.title},[a.createElementVNode("strong",bu,a.toDisplayString(e.value.title),1),a.createElementVNode("div",vu,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.value.rows,n=>(a.openBlock(),a.createElementBlock("div",{key:n.label,class:"conversation-chart__row",role:"listitem"},[a.createElementVNode("span",Su,a.toDisplayString(n.label),1),a.createElementVNode("span",Gu,[a.createElementVNode("span",{class:"conversation-chart__bar",style:a.normalizeStyle({width:g(n.value)})},null,4)]),a.createElementVNode("span",Ru,a.toDisplayString(n.value),1)]))),128))])],8,Nu)):a.createCommentVNode("",!0)}}),n0=xA(Yu,[["__scopeId","data-v-db9fb284"]]),Ju={class:"conversation-code-result","aria-label":"代码执行结果"},Uu={key:0,class:"conversation-code-result__block"},Mu={class:"conversation-code-result__label"},xu={class:"conversation-code-result__code"},Lu={key:1,class:"conversation-code-result__block"},Hu={class:"conversation-code-result__label"},Ku={class:"conversation-code-result__code"},qu=a.defineComponent({name:"CodeToolRenderer",__name:"CodeToolRenderer",props:{toolCall:{},result:{}},setup(t){const A=t,e=a.computed(()=>C(A.result)?A.result:{}),g=a.computed(()=>I(e.value.language)??"text"),i=a.computed(()=>I(e.value.code)??n(A.toolCall.function.arguments)),o=a.computed(()=>I(e.value.output)??""),s=a.computed(()=>e.value.exitCode);function n(r){try{const B=JSON.parse(r);return C(B)?I(B.code)??"":""}catch{return""}}function I(r){return typeof r=="string"?r:void 0}function C(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}return(r,B)=>(a.openBlock(),a.createElementBlock("section",Ju,[i.value?(a.openBlock(),a.createElementBlock("div",Uu,[a.createElementVNode("span",Mu,a.toDisplayString(g.value),1),a.createElementVNode("pre",xu,[a.createElementVNode("code",null,a.toDisplayString(i.value),1)])])):a.createCommentVNode("",!0),o.value?(a.openBlock(),a.createElementBlock("div",Lu,[a.createElementVNode("span",Hu,"输出"+a.toDisplayString(s.value===void 0?"":` (${s.value})`),1),a.createElementVNode("pre",Ku,[a.createElementVNode("code",null,a.toDisplayString(o.value),1)])])):a.createCommentVNode("",!0)]))}}),I0=xA(qu,[["__scopeId","data-v-161409fc"]]),Tu={class:"conversation-mind-map","aria-label":"思维导图结果"},Zu={key:1,class:"conversation-mind-map__error",role:"alert"},oI=6,aI=80,Wu=a.defineComponent({name:"MindMapToolRenderer",__name:"MindMapToolRenderer",props:{result:{}},setup(t){const A=t,e=a.computed(()=>i(A.result)),g={name:"ai-conversation",background:"transparent",grid:{show:!1},nodeStyle:{colors:["var(--ai-conversation-code-bg)","var(--ai-conversation-tool-bg)","var(--ai-conversation-assistant-bg)"],textColor:"var(--ai-conversation-assistant-color)",borderColor:"var(--ai-conversation-tool-border)",borderWidth:1,borderRadius:6,fontSize:13,fontWeight:600},linkStyle:{color:"var(--ai-conversation-tool-running)",width:1.5,curve:"bezier",animated:!1}};function i(I){const C=n(I)?I:void 0,r=n(C==null?void 0:C.data)?C.data:C;if(!r||!n(r.nodeData))return o();let B=0;const c=new WeakSet;function l(h,d){if(!n(h)||c.has(h))return;if(d>oI)throw new Error(`思维导图最多支持 ${oI} 层。`);const u=s(h.id),p=s(h.topic);if(!u||!p||h.children!==void 0&&!Array.isArray(h.children))return;if(c.add(h),B+=1,B>aI)throw new Error(`思维导图最多支持 ${aI} 个节点。`);const b=[];for(const N of h.children??[]){const y=l(N,d+1);if(!y)return;b.push(y)}return{id:u,topic:p,root:d===1,expanded:typeof h.expanded=="boolean"?h.expanded:!0,...b.length?{children:b}:{}}}try{const h=l(r.nodeData,1);return h?{data:{nodeData:h}}:o()}catch(h){return{error:h instanceof Error?h.message:o().error}}}function o(){return{error:"无法显示思维导图:数据结构无效。"}}function s(I){return typeof I=="string"&&I.trim()?I.trim():void 0}function n(I){return typeof I=="object"&&I!==null&&!Array.isArray(I)}return(I,C)=>(a.openBlock(),a.createElementBlock("section",Tu,[e.value.data?(a.openBlock(),a.createBlock(xC,{key:0,data:e.value.data,theme:g,height:"18rem",readonly:"","show-toolbar":"","show-download":!1,"show-counts":!0,"toolbar-position":"bottom"},null,8,["data"])):(a.openBlock(),a.createElementBlock("p",Zu,a.toDisplayString(e.value.error),1))]))}}),C0=xA(Wu,[["__scopeId","data-v-42be305a"]]);/*!
512
+ `}catch{return i}}),media:A}}function Bu(t,A={}){if(!t)return[];if(!fo.value)return[{type:"html",id:"pending",html:"<p></p>"}];const e=A0(t);if(!e)return[];const{content:g,media:i}=ru(e);let o=Mc(g,{heal:A.streaming===!0});o=Cu(o),o=iu(o),o=au(o),o=o.replace(/<p>\s*((?:%%media-\d+%%\s*)+)<\/p>/g,"$1");const s=new Map(i.map(r=>[r.id,r])),n=o.split(/(%%media-\d+%%)/),I=[];let C=0;for(const r of n){const B=r.match(/^%%(media-\d+)%%$/);if(B){const c=s.get(B[1]);if(!c||typeof c.data.url!="string")continue;c.type==="image"?I.push({type:"image",id:`${c.id}-${C}`,url:c.data.url,alt:typeof c.data.alt=="string"?c.data.alt:void 0}):c.type==="video"?I.push({type:"video",id:`${c.id}-${C}`,url:c.data.url,poster:typeof c.data.poster=="string"?c.data.poster:void 0}):I.push({type:"audio",id:`${c.id}-${C}`,url:c.data.url,title:typeof c.data.title=="string"?c.data.title:void 0}),C+=1;continue}r.trim()&&(I.push({type:"html",id:`html-${C}`,html:r}),C+=1)}return Qu(I)}function Qu(t){const A=[];let e=[];const g=()=>{e.length!==0&&(e.length===1?A.push(e[0]):A.push({type:"image-stack",id:`image-stack-${e[0].id}`,images:e.map(i=>({id:i.id,url:i.url,alt:i.alt}))}),e=[])};for(const i of t){if(i.type==="image"){e.push(i);continue}g(),A.push(i)}return g(),A}const lu={key:1,class:"content-nodes__text"},cu=["innerHTML"],Eu={key:3,class:"content-nodes__media"},hu=["src","poster"],uu={key:4,class:"content-nodes__media"},du={key:0},mu=["src"],fu=a.defineComponent({name:"ContentNodes",__name:"ContentNodes",props:{content:{},isStreaming:{type:Boolean},highlightStreamTail:{type:Boolean},density:{}},emits:["action"],setup(t,{emit:A}){const e=t,g=A,i=a.ref([]),o=a.ref();function s(l,h){const d=new tr({registry:Jo});return l&&d.push(l),h||d.finalize(),d.getNodes().filter(u=>u.kind==="text"?u.text.length>0:u.tag==="ask-form"?!1:u.complete)}function n(){i.value=s(e.content,e.isStreaming===!0),a.nextTick(c)}a.watch(()=>[e.content,e.isStreaming,e.highlightStreamTail,fo.value],()=>n(),{immediate:!0}),a.onMounted(()=>{o0().then(()=>n())});const I=a.computed(()=>{const l=[];let h=-1;for(let d=0;d<i.value.length;d+=1)i.value[d].kind==="text"&&(h=d);for(let d=0;d<i.value.length;d+=1){const u=i.value[d];if(u.kind==="text"){const p=e.isStreaming===!0&&d===h;l.push({type:"text",key:u.id,segments:Bu(u.text,{streaming:p})});continue}u.tag==="artifact"&&l.push({type:"artifact",key:u.id,node:u})}return l});function C(){const l=o.value;if(!(!l||typeof document>"u"))for(const h of l.querySelectorAll(".content-nodes__stream-tail"))h.replaceWith(document.createTextNode(h.textContent??""))}function r(l){let h;const d=l.lastElementChild,u=d==null?void 0:d.lastElementChild;if(!(u!=null&&u.classList.contains("content-nodes__html")))return;function p(b){for(const N of b.childNodes){if(N.nodeType===3){const y=N,v=y.parentElement;y.data.trim().length>0&&v&&!v.closest(".math-block, .math-inline, .content-nodes__media")&&(h=y);continue}p(N)}}return p(u),h}function B(l){var y;const h=l.data,d=h.length-(((y=h.match(/\s*$/))==null?void 0:y[0].length)??0);if(d===0||typeof document>"u")return 0;const u=document.createRange();if(typeof u.getClientRects!="function")return 0;const p=v=>(u.setStart(l,v),u.setEnd(l,d),u.getClientRects().length);if(p(0)===0)return 0;let b=0,N=d;for(;b<N;){const v=Math.floor((b+N)/2);p(v)<=1?N=v:b=v+1}return b}function c(){C();const l=o.value;if(!l||!e.isStreaming||!e.highlightStreamTail||typeof document>"u")return;const h=r(l);if(!h||!h.data.trim())return;const d=B(h),u=h.data.slice(0,d),p=h.data.slice(d),b=document.createElement("span");b.className="content-nodes__stream-tail",b.textContent=p;const N=document.createDocumentFragment();u&&N.append(document.createTextNode(u)),N.append(b),h.replaceWith(N)}return(l,h)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"rootRef",ref:o,class:a.normalizeClass(["content-nodes",{"content-nodes--compact":t.density==="compact"}])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(I.value,d=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:d.key},[d.type==="artifact"?(a.openBlock(),a.createBlock(_l,{key:0,node:d.node,onAction:h[0]||(h[0]=u=>g("action",u))},null,8,["node"])):(a.openBlock(),a.createElementBlock("div",lu,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.segments,u=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:u.id},[u.type==="html"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"content-nodes__html",innerHTML:u.html},null,8,cu)):u.type==="image"?(a.openBlock(),a.createBlock(Qn,{key:1,images:[{id:u.id,url:u.url,alt:u.alt}]},null,8,["images"])):u.type==="image-stack"?(a.openBlock(),a.createBlock(Qn,{key:2,images:u.images},null,8,["images"])):u.type==="video"?(a.openBlock(),a.createElementBlock("figure",Eu,[a.createElementVNode("video",{src:u.url,poster:u.poster,controls:"",playsinline:""},null,8,hu)])):u.type==="audio"?(a.openBlock(),a.createElementBlock("figure",uu,[u.title?(a.openBlock(),a.createElementBlock("figcaption",du,a.toDisplayString(u.title),1)):a.createCommentVNode("",!0),a.createElementVNode("audio",{src:u.url,controls:""},null,8,mu)])):a.createCommentVNode("",!0)],64))),128))]))],64))),128))],2))}}),wu=xA(fu,[["__scopeId","data-v-6a17c994"]]),pu=8;function Du(t,A){const e=a.ref(t.value);let g,i=!1;function o(){g!==void 0&&(cancelAnimationFrame(g),g=void 0)}function s(){const n=t.value,I=e.value;if(!A.value||I.length>=n.length){e.value=n,g=void 0;return}const C=n.length-I.length,r=Math.max(1,Math.ceil(C/pu));e.value=n.slice(0,I.length+r),g=requestAnimationFrame(s)}return a.watch(t,n=>{if(!i){i=!0,e.value=n;return}if(!A.value||n.length<e.value.length){e.value=n,o();return}g===void 0&&(g=requestAnimationFrame(s))},{immediate:!0}),a.watch(A,n=>{n||(e.value=t.value,o())}),a.onBeforeUnmount(o),{displayed:e}}const Rs=a.defineComponent({name:"TextPartRenderer",__name:"TextPartRenderer",props:{content:{},isStreaming:{type:Boolean},highlightStreamTail:{type:Boolean},density:{default:"default"}},emits:["action"],setup(t,{emit:A}){const e=t,g=A,{displayed:i}=Du(a.toRef(e,"content"),a.computed(()=>e.isStreaming===!0));return(o,s)=>(a.openBlock(),a.createBlock(wu,{content:a.unref(i),"is-streaming":t.isStreaming,"highlight-stream-tail":t.highlightStreamTail,density:t.density,onAction:s[0]||(s[0]=n=>g("action",n))},null,8,["content","is-streaming","highlight-stream-tail","density"]))}});function a0(t,A){const e=a.ref(void 0);let g;function i(){const s=t.value;s&&(e.value=`${s.scrollHeight}px`)}function o(){g==null||g.disconnect(),g=void 0}return a.watch([t,A],([s,n])=>{if(o(),!s||!n){e.value=void 0;return}i(),typeof ResizeObserver<"u"&&(g=new ResizeObserver(i),g.observe(s))},{immediate:!0,flush:"post"}),a.onBeforeUnmount(o),{height:e}}const ku=["open","aria-busy"],yu=["aria-expanded","aria-disabled"],Fu=a.defineComponent({__name:"ChatReasoning",props:{content:{},streaming:{type:Boolean}},setup(t){const A=t,e=a.ref(!0),g=a.ref(!1),i=a.ref(),o=a.ref(),{height:s}=a0(o,e),n=a.ref(0),I=a.ref(!1);let C=0,r;const B=a.computed(()=>!!A.content.trim());function c(){B.value&&(g.value=!0,e.value=!e.value)}a.watch(B,p=>{if(!p){e.value=!1,g.value=!1;return}g.value||(e.value=!0)},{immediate:!0}),a.watch(()=>A.streaming,p=>{p?l():h()}),a.watch(()=>A.content,()=>{!A.streaming||!e.value||a.nextTick(()=>{const p=i.value;p&&(p.scrollTop=p.scrollHeight)})});function l(){r||(C=Date.now()-n.value*1e3,I.value=!0,r=setInterval(()=>{n.value=Math.floor((Date.now()-C)/1e3)},250))}function h(){r&&(clearInterval(r),r=void 0,n.value=Math.max(n.value,Math.floor((Date.now()-C)/1e3)))}function d(){if(n.value<1)return"<1 秒";if(n.value<60)return`${n.value} 秒`;const p=Math.floor(n.value/60),b=n.value%60;return b?`${p} 分 ${b} 秒`:`${p} 分钟`}const u=a.computed(()=>A.streaming?`正在思考 ${d()}`:I.value?`已思考 ${d()}`:"思考过程");return a.onMounted(()=>{A.streaming&&l()}),a.onBeforeUnmount(h),(p,b)=>(a.openBlock(),a.createElementBlock("details",{class:a.normalizeClass(["chat-reasoning",{"chat-reasoning--empty":!B.value}]),open:e.value,"aria-busy":t.streaming?"true":void 0,"aria-label":"思考过程"},[a.createElementVNode("summary",{class:"chat-reasoning__summary","aria-expanded":e.value,"aria-disabled":B.value?void 0:"true",onClick:a.withModifiers(c,["prevent"])},[a.createVNode(a.unref(jB),{class:a.normalizeClass(["chat-reasoning__spark",{"chat-reasoning__spark--active":t.streaming}]),size:16,"stroke-width":1.75,"aria-hidden":"true"},null,8,["class"]),a.createElementVNode("span",{class:a.normalizeClass(["chat-reasoning__label",{"chat-reasoning__label--streaming":t.streaming}])},a.toDisplayString(u.value),3),B.value?(a.openBlock(),a.createBlock(a.unref(ls),{key:0,class:"chat-reasoning__chevron",size:14,"stroke-width":1.75,"aria-hidden":"true"})):a.createCommentVNode("",!0)],8,yu),B.value?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"bodyRef",ref:i,class:"chat-reasoning__viewport",style:a.normalizeStyle({height:a.unref(s)})},[a.createElementVNode("div",{ref_key:"contentRef",ref:o,class:"chat-reasoning__body"},[a.renderSlot(p.$slots,"default",{content:t.content,streaming:t.streaming===!0},()=>[a.createVNode(Rs,{content:t.content,"is-streaming":t.streaming,"highlight-stream-tail":t.streaming},null,8,["content","is-streaming","highlight-stream-tail"])],!0)],512)],4)):a.createCommentVNode("",!0)],10,ku))}}),s0=xA(Fu,[["__scopeId","data-v-6eefa7f8"]]),Nu=["aria-label"],bu={class:"conversation-chart__title"},vu={class:"conversation-chart__rows",role:"list"},Su={class:"conversation-chart__label"},Gu={class:"conversation-chart__bar-wrap"},Ru={class:"conversation-chart__value"},Yu=a.defineComponent({name:"ChartToolRenderer",__name:"ChartToolRenderer",props:{result:{}},setup(t){const A=t,e=a.computed(()=>{const o=i(A.result)?A.result:{},n=(Array.isArray(o.data)?o.data:[]).flatMap(C=>!i(C)||typeof C.label!="string"||typeof C.value!="number"?[]:[{label:C.label,value:C.value}]),I=Math.max(1,...n.map(C=>C.value));return{title:typeof o.title=="string"?o.title:"图表结果",rows:n,maxValue:I}});function g(o){return`${Math.max(0,Math.min(100,o/e.value.maxValue*100))}%`}function i(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}return(o,s)=>e.value.rows.length?(a.openBlock(),a.createElementBlock("section",{key:0,class:"conversation-chart","aria-label":e.value.title},[a.createElementVNode("strong",bu,a.toDisplayString(e.value.title),1),a.createElementVNode("div",vu,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(e.value.rows,n=>(a.openBlock(),a.createElementBlock("div",{key:n.label,class:"conversation-chart__row",role:"listitem"},[a.createElementVNode("span",Su,a.toDisplayString(n.label),1),a.createElementVNode("span",Gu,[a.createElementVNode("span",{class:"conversation-chart__bar",style:a.normalizeStyle({width:g(n.value)})},null,4)]),a.createElementVNode("span",Ru,a.toDisplayString(n.value),1)]))),128))])],8,Nu)):a.createCommentVNode("",!0)}}),n0=xA(Yu,[["__scopeId","data-v-db9fb284"]]),Ju={class:"conversation-code-result","aria-label":"代码执行结果"},Uu={key:0,class:"conversation-code-result__block"},Mu={class:"conversation-code-result__label"},xu={class:"conversation-code-result__code"},Lu={key:1,class:"conversation-code-result__block"},Hu={class:"conversation-code-result__label"},Ku={class:"conversation-code-result__code"},qu=a.defineComponent({name:"CodeToolRenderer",__name:"CodeToolRenderer",props:{toolCall:{},result:{}},setup(t){const A=t,e=a.computed(()=>C(A.result)?A.result:{}),g=a.computed(()=>I(e.value.language)??"text"),i=a.computed(()=>I(e.value.code)??n(A.toolCall.function.arguments)),o=a.computed(()=>I(e.value.output)??""),s=a.computed(()=>e.value.exitCode);function n(r){try{const B=JSON.parse(r);return C(B)?I(B.code)??"":""}catch{return""}}function I(r){return typeof r=="string"?r:void 0}function C(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}return(r,B)=>(a.openBlock(),a.createElementBlock("section",Ju,[i.value?(a.openBlock(),a.createElementBlock("div",Uu,[a.createElementVNode("span",Mu,a.toDisplayString(g.value),1),a.createElementVNode("pre",xu,[a.createElementVNode("code",null,a.toDisplayString(i.value),1)])])):a.createCommentVNode("",!0),o.value?(a.openBlock(),a.createElementBlock("div",Lu,[a.createElementVNode("span",Hu,"输出"+a.toDisplayString(s.value===void 0?"":` (${s.value})`),1),a.createElementVNode("pre",Ku,[a.createElementVNode("code",null,a.toDisplayString(o.value),1)])])):a.createCommentVNode("",!0)]))}}),I0=xA(qu,[["__scopeId","data-v-161409fc"]]),Tu={class:"conversation-mind-map","aria-label":"思维导图结果"},Zu={key:1,class:"conversation-mind-map__error",role:"alert"},oI=6,aI=80,Wu=a.defineComponent({name:"MindMapToolRenderer",__name:"MindMapToolRenderer",props:{result:{}},setup(t){const A=t,e=a.computed(()=>i(A.result)),g={name:"ai-conversation",background:"transparent",grid:{show:!1},nodeStyle:{colors:["var(--ai-conversation-code-bg)","var(--ai-conversation-tool-bg)","var(--ai-conversation-assistant-bg)"],textColor:"var(--ai-conversation-assistant-color)",borderColor:"var(--ai-conversation-tool-border)",borderWidth:1,borderRadius:6,fontSize:13,fontWeight:600},linkStyle:{color:"var(--ai-conversation-tool-running)",width:1.5,curve:"bezier",animated:!1}};function i(I){const C=n(I)?I:void 0,r=n(C==null?void 0:C.data)?C.data:C;if(!r||!n(r.nodeData))return o();let B=0;const c=new WeakSet;function l(h,d){if(!n(h)||c.has(h))return;if(d>oI)throw new Error(`思维导图最多支持 ${oI} 层。`);const u=s(h.id),p=s(h.topic);if(!u||!p||h.children!==void 0&&!Array.isArray(h.children))return;if(c.add(h),B+=1,B>aI)throw new Error(`思维导图最多支持 ${aI} 个节点。`);const b=[];for(const N of h.children??[]){const y=l(N,d+1);if(!y)return;b.push(y)}return{id:u,topic:p,root:d===1,expanded:typeof h.expanded=="boolean"?h.expanded:!0,...b.length?{children:b}:{}}}try{const h=l(r.nodeData,1);return h?{data:{nodeData:h}}:o()}catch(h){return{error:h instanceof Error?h.message:o().error}}}function o(){return{error:"无法显示思维导图:数据结构无效。"}}function s(I){return typeof I=="string"&&I.trim()?I.trim():void 0}function n(I){return typeof I=="object"&&I!==null&&!Array.isArray(I)}return(I,C)=>(a.openBlock(),a.createElementBlock("section",Tu,[e.value.data?(a.openBlock(),a.createBlock(xC,{key:0,data:e.value.data,theme:g,height:"18rem",readonly:"","show-toolbar":"","show-download":!1,"show-counts":!0,"toolbar-position":"bottom"},null,8,["data"])):(a.openBlock(),a.createElementBlock("p",Zu,a.toDisplayString(e.value.error),1))]))}}),C0=xA(Wu,[["__scopeId","data-v-42be305a"]]);/*!
513
513
  * @kurkle/color v0.3.4
514
514
  * https://github.com/kurkle/color#readme
515
515
  * (c) 2024 Jukka Kurkela
package/dist/index.js CHANGED
@@ -15457,15 +15457,15 @@ function Qu(t) {
15457
15457
  return nu.sanitize(t, ru);
15458
15458
  }
15459
15459
  const Bu = /<table[\s\S]*?<\/table>/g;
15460
- function lu(t, A = {}) {
15461
- const e = [...t.matchAll(Bu)];
15462
- if (e.length === 0) return t;
15463
- let g = "", i = 0;
15464
- for (let I = 0; I < e.length; I += 1) {
15465
- const s = e[I], a = s[0], o = s.index, C = o + a.length, n = I === e.length - 1 && !t.slice(C).trim(), r = A.streaming === !0 && n;
15466
- g += t.slice(i, o), g += r ? `<div class="table-node-wrapper table-node--loading"><div class="table-node">${a}</div><div class="table-node__loading"><span class="table-node__spinner"></span></div></div>` : `<div class="table-node-wrapper"><div class="table-node">${a}</div></div>`, i = C;
15460
+ function lu(t) {
15461
+ const A = [...t.matchAll(Bu)];
15462
+ if (A.length === 0) return t;
15463
+ let e = "", g = 0;
15464
+ for (const i of A) {
15465
+ const I = i[0], s = i.index, a = s + I.length;
15466
+ e += t.slice(g, s), e += `<div class="table-node-wrapper"><div class="table-node">${I}</div></div>`, g = a;
15467
15467
  }
15468
- return g + t.slice(i);
15468
+ return e + t.slice(g);
15469
15469
  }
15470
15470
  const OI = gA(!1);
15471
15471
  let Fi = null;
@@ -15513,7 +15513,7 @@ function fu(t, A = {}) {
15513
15513
  if (!e) return [];
15514
15514
  const { content: g, media: i } = du(e);
15515
15515
  let I = Wc(g, { heal: A.streaming === !0 });
15516
- I = uu(I), I = Qu(I), I = lu(I, { streaming: A.streaming === !0 }), I = I.replace(/<p>\s*((?:%%media-\d+%%\s*)+)<\/p>/g, "$1");
15516
+ I = uu(I), I = Qu(I), I = lu(I), I = I.replace(/<p>\s*((?:%%media-\d+%%\s*)+)<\/p>/g, "$1");
15517
15517
  const s = new Map(i.map((n) => [n.id, n])), a = I.split(/(%%media-\d+%%)/), o = [];
15518
15518
  let C = 0;
15519
15519
  for (const n of a) {
@@ -15711,7 +15711,7 @@ const wu = {
15711
15711
  ], 64))), 128))
15712
15712
  ], 2));
15713
15713
  }
15714
- }), vu = /* @__PURE__ */ zA(bu, [["__scopeId", "data-v-8ef9846c"]]), Gu = 8;
15714
+ }), vu = /* @__PURE__ */ zA(bu, [["__scopeId", "data-v-6a17c994"]]), Gu = 8;
15715
15715
  function Ru(t, A) {
15716
15716
  const e = gA(t.value);
15717
15717
  let g, i = !1;
@@ -15798,18 +15798,26 @@ const Su = ["open", "aria-busy"], Yu = ["aria-expanded", "aria-disabled"], Ju =
15798
15798
  streaming: { type: Boolean }
15799
15799
  },
15800
15800
  setup(t) {
15801
- const A = t, e = gA(!1), g = gA(!1), i = gA(), I = gA(), { height: s } = d0(I, e), a = gA(0), o = gA(!1);
15801
+ const A = t, e = gA(!0), g = gA(!1), i = gA(), I = gA(), { height: s } = d0(I, e), a = gA(0), o = gA(!1);
15802
15802
  let C = 0, n;
15803
15803
  const r = J(() => !!A.content.trim());
15804
15804
  function l() {
15805
15805
  r.value && (g.value = !0, e.value = !e.value);
15806
15806
  }
15807
- Re(r, (D) => {
15808
- D || (e.value = !1, g.value = !1);
15809
- }), Re(
15807
+ Re(
15808
+ r,
15809
+ (D) => {
15810
+ if (!D) {
15811
+ e.value = !1, g.value = !1;
15812
+ return;
15813
+ }
15814
+ g.value || (e.value = !0);
15815
+ },
15816
+ { immediate: !0 }
15817
+ ), Re(
15810
15818
  () => A.streaming,
15811
15819
  (D) => {
15812
- g.value || (e.value = !1), D ? B() : E();
15820
+ D ? B() : E();
15813
15821
  }
15814
15822
  ), Re(
15815
15823
  () => A.content,
@@ -15892,7 +15900,7 @@ const Su = ["open", "aria-busy"], Yu = ["aria-expanded", "aria-disabled"], Ju =
15892
15900
  ], 4)) : nA("", !0)
15893
15901
  ], 10, Su));
15894
15902
  }
15895
- }), Uu = /* @__PURE__ */ zA(Ju, [["__scopeId", "data-v-09e6bd1d"]]), Mu = ["aria-label"], xu = { class: "conversation-chart__title" }, Lu = {
15903
+ }), Uu = /* @__PURE__ */ zA(Ju, [["__scopeId", "data-v-6eefa7f8"]]), Mu = ["aria-label"], xu = { class: "conversation-chart__title" }, Lu = {
15896
15904
  class: "conversation-chart__rows",
15897
15905
  role: "list"
15898
15906
  }, Hu = { class: "conversation-chart__label" }, Ku = { class: "conversation-chart__bar-wrap" }, qu = { class: "conversation-chart__value" }, Tu = /* @__PURE__ */ ZA({