@farris/x-ui 0.1.9 → 0.2.0

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.
@@ -7274,9 +7274,11 @@ const nu = /* @__PURE__ */ ie({
7274
7274
  }, [e.content.toolDescription ?? "tool"]), f("div", {
7275
7275
  class: d.value
7276
7276
  }, [n.value ? f(zn, {
7277
- status: "Error"
7277
+ status: "Error",
7278
+ variant: "tool-use"
7278
7279
  }, null) : f(zn, {
7279
- status: i.value ? "Done" : o.value ? "Working" : "NotStart"
7280
+ status: i.value ? "Done" : o.value ? "Working" : "NotStart",
7281
+ variant: "tool-use"
7280
7282
  }, null), f("span", {
7281
7283
  class: "f-chat-tool-use-status-text"
7282
7284
  }, [a.value])]), f("i", {
@@ -29,7 +29,7 @@ $3`),t}function Ff(e){const t=e.split(`
29
29
  overflow: hidden;
30
30
  `,c=Co("caf-assistant-widget-container__inner",f),h=i.computed(()=>{const b=ko`
31
31
  display: ${l.value?"block":"none"};
32
- `;return Co("caf-assistant-widget-container__error",b)}),m=()=>{const b=a.value;b&&(s.value=new wh(b))},p=()=>{const b=s.value;b&&(b.dispose(),s.value=null)},w=()=>{const b=u.value,g=o.value;b&&(b.unmount(),b.dispose()),g&&g.cleanup(),u.value=null,o.value=null},y=async()=>{const b=await n(e.widgetAPIURL);if(!b)throw new Error("Failed to load widget API");await b.initialize();const g=b.createWidget();o.value=b,u.value=g},A=b=>{console.error(b),l.value=b};return i.watch(()=>e.widgetAPIURL,async()=>{if(a.value)try{w(),await y();const b=a.value,g=u.value;g==null||g.updateOptions(e.widgetOptions),g==null||g.updateData(e.widgetData),b&&g&&await g.mount(b)}catch(b){A(b)}}),i.watch(()=>e.widgetOptions,(b,g)=>{try{const x=u.value;x&&(!g||!r(g,b))&&x.updateOptions(b)}catch(x){A(x)}}),i.watch(()=>e.widgetData,(b,g)=>{try{const x=u.value;x&&(!g||!r(g,b))&&x.updateData(b)}catch(x){A(x)}}),i.onMounted(async()=>{try{const b=a.value;if(b){m();const g=s.value;if(g){await y();const x=u.value;x&&(x.updateOptions(e.widgetOptions),x.updateData(e.widgetData),x.mount(g.getElement()),i.nextTick(()=>{b.parentElement&&(b.style.width="100%")}))}}}catch(b){A(b)}}),i.onBeforeUnmount(async()=>{try{w(),p()}catch(b){console.error(b)}}),()=>i.createVNode("div",{class:d.value},[i.createVNode("div",{ref:a,class:c},null),i.createVNode("div",{class:h.value},null)])}}),Ga=(e,t)=>{var n;if(e.type===Le.AssistantWidgetComplete){const r=e;return r.widgetUrl?i.createVNode(yn,{key:`widget-${t}`,widgetAPIURL:r.widgetUrl,widgetOptions:{mode:"embedded",implOptions:r.widgetImplOptions},widgetData:((n=r.widgetData)==null?void 0:n.data)||{}},null):null}return e.type===Le.AssistantWidgetPending?i.createVNode("div",{class:"f-chat-bubble-widget-pending",key:`widget-loading-${t}`},[i.createVNode("span",{class:"f-chat-todo-status-icon f-chat-todo-status-working"},null),i.createVNode("span",{class:"f-chat-bubble-widget-pending-text"},[i.createTextVNode("数据生成中......")])]):null},Ch=3e4,Xa=8e3,Ie=new Map,Qe=new Map,nr=new Map,Et=[];function Pe(e){return String(e??"").replace(/^\ufeff/,"").replace(/[\u200b\u200c\u200d]/g,"").replace(/\u00a0/g," ").trim()}function uu(e){const t=Pe(e);if(t)for(let n=Et.length-1;n>=0;n--)Et[n]===t&&Et.splice(n,1)}function _h(e){typeof window>"u"||(window.__fluens_dynamic_component_bootstrap_instance_id=e)}function ou(e){if(typeof window>"u")return;const t=window;t.__fluens_dynamic_component_bootstrap_instance_id===e&&delete t.__fluens_dynamic_component_bootstrap_instance_id}function Eh(){return Et[Et.length-1]||void 0}function iu(e,t){const n=Pe(t);return n?Pe(e.instanceId)===n||e.componentId!=null&&Pe(String(e.componentId))===n||e.name!=null&&Pe(String(e.name))===n:!1}function Eo(e){const t=Pe(e);if(!t)return null;const n=Ie.get(t);if(n)return{canonicalKey:t,entry:n};for(const[o,u]of Ie.entries())if(Pe(o)===t)return{canonicalKey:o,entry:u};const r=[];for(const[o,u]of Ie.entries())iu(u.config,t)&&r.push({key:o,entry:u});if(r.length===1){const{key:o,entry:u}=r[0];return o!==t&&console.warn(`[DynamicComponent] register id "${t}" resolved to pending instanceId "${o}" (alias match)`),{canonicalKey:o,entry:u}}if(r.length>1)return console.warn(`[DynamicComponent] register id "${t}" is ambiguous (${r.length} pending matches); refusing`),null;if(Ie.size===1){const[o,u]=[...Ie.entries()][0];return console.warn(`[DynamicComponent] register id "${t}" unmatched; using sole pending instance "${o}"`),{canonicalKey:o,entry:u}}return null}function qa(e,t){for(const[n,r]of Qe){const o=Pe(n),u=e!==""&&o===e,a=String(t??"").trim(),s=e&&iu(r.config,e)||a&&iu(r.config,a);if(u||s)return console.warn(`[DynamicComponent] register skipped: id "${e||a}" already active (canonical "${n}"); unload first — second register yields "no pending", not duplicate mount`),!0}return!1}function So(){return{pendingKeys:[...Ie.keys()],bootstrapQueue:[...Et],activeKeys:[...Qe.keys()],...typeof window<"u"?{windowBootstrapPeek:window.__fluens_dynamic_component_bootstrap_instance_id}:{}}}function Sh(e){console.warn("[DynamicComponent] register diagnostics",{claimedNormalized:e,...So()})}function Dh(e){const t=Pe(e);if(t){if(qa(t,e))return{ok:!1,reason:"already_active_duplicate"};const r=Eo(t);if(r)return{ok:!0,...r}}else if(qa("",e))return{ok:!1,reason:"already_active_duplicate"};for(let n=0;n<Et.length;n++){const r=Et[n],o=Eo(r);if(o)return Et.splice(n,1),t&&Pe(r)!==t&&console.warn(`[DynamicComponent] register id "${t}" did not match pending; using bootstrap instanceId "${r}" (sync bundle entry or use window.__fluens_dynamic_component_bootstrap_instance_id)`),{ok:!0,...o}}return{ok:!1,reason:"no_pending"}}function Za(e){const t=Pe(e);if(!t)return null;const n=Qe.get(t);if(n)return n;for(const[u,a]of Qe.entries())if(Pe(u)===t)return a;const r=[];for(const u of Qe.values())iu(u.config,t)&&r.push(u);const o=[...new Map(r.map(u=>[u.config.instanceId,u])).values()];if(o.length===1)return o[0].config.instanceId!==t&&console.warn(`[DynamicComponent] assistant post id "${t}" resolved to instanceId "${o[0].config.instanceId}" (alias match)`),o[0];if(o.length>1)return console.warn(`[DynamicComponent] assistant post id "${t}" is ambiguous (${o.length} active matches)`),null;if(Qe.size===1){const u=[...Qe.values()][0];return console.warn(`[DynamicComponent] assistant post id "${t}" unmatched; delivering to sole active instance "${u.config.instanceId}"`),u}return null}function Fh(e){const t=Pe(e);if(!t)return t;const n=Za(t);if(n)return n.config.instanceId;const r=Eo(t);return r?r.canonicalKey:Ie.size===1?[...Ie.keys()][0]:Qe.size===1?[...Qe.values()][0].config.instanceId:t}function Do(e){try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}}function Ya(e,t){if(typeof e.onAssistantMessage!="function")return!0;try{return e.onAssistantMessage(Do(t)),!0}catch(n){return console.warn("[DynamicComponent] onAssistantMessage failed",n),!1}}function Th(e){const t=`fluens-dynamic-component-${e.instanceId}`;let n=document.getElementById(t);return n||(n=document.createElement("div"),n.id=t,n.style.width="100%",n.style.height="100%"),n}function Ka(e){const t=Qe.get(e.instanceId);if(t)return Promise.resolve(t.api);const n=Ie.get(e.instanceId);if(n)return new Promise((o,u)=>{const a=n.resolve,s=n.reject;n.resolve=l=>{a(l),o(l)},n.reject=l=>{s(l),u(l)}});if((e.name||e.componentId)&&!e.jsUrl)return Promise.reject(new Error(`Dynamic component resource is empty: ${e.name||e.componentId}`));const r=Th(e);return new Promise((o,u)=>{const a={config:e,container:r,resolve:o,reject:u,timeoutId:0},s=setTimeout(()=>{a.postLoadRegisterCheckTimerId!=null&&(clearTimeout(a.postLoadRegisterCheckTimerId),a.postLoadRegisterCheckTimerId=void 0),Ie.delete(e.instanceId),uu(e.instanceId),ou(e.instanceId),u(new Error(`Dynamic component script load timeout: ${e.name||e.componentId}`))},Ch);a.timeoutId=s,Ie.set(e.instanceId,a),Et.push(e.instanceId),_h(e.instanceId);const l=document.createElement("script");l.src=(e==null?void 0:e.jsUrl)??"",l.dataset.dynamicComponentId=e.instanceId,l.async=!1,l.onload=()=>{a.postLoadRegisterCheckTimerId=window.setTimeout(()=>{a.postLoadRegisterCheckTimerId=void 0,Ie.has(e.instanceId)&&(clearTimeout(s),Ie.delete(e.instanceId),uu(e.instanceId),ou(e.instanceId),u(new Error(`Dynamic component did not call __fluens_dynamic_component_register within ${Xa}ms after load: ${e.name||e.componentId}`)))},Xa)},l.onerror=()=>{clearTimeout(s),a.postLoadRegisterCheckTimerId!=null&&(clearTimeout(a.postLoadRegisterCheckTimerId),a.postLoadRegisterCheckTimerId=void 0),Ie.delete(e.instanceId),uu(e.instanceId),ou(e.instanceId),u(new Error(`Failed to load dynamic component: ${e.name||e.componentId}`))},document.head.appendChild(l)})}function Qa(e){var o;const t=Qe.get(e);if(t){try{t.api.unmount()}catch{}(o=t.scriptElement)==null||o.remove(),Qe.delete(e)}const n=Ie.get(e);n&&(n.postLoadRegisterCheckTimerId!=null&&(clearTimeout(n.postLoadRegisterCheckTimerId),n.postLoadRegisterCheckTimerId=void 0),clearTimeout(n.timeoutId),Ie.delete(e)),nr.delete(e);const r=document.getElementById(`fluens-dynamic-component-${e}`);r&&r.remove()}function Nh(e,t){const n=Pe(e);if(!n)return!1;const r=Za(n);if(r)return Ya(r.api,t);const o=Fh(n),u=nr.get(o)??[],a=u.findIndex(s=>s.messageId===t.messageId);return a>=0?u[a]=Do(t):u.push(Do(t)),nr.set(o,u),!1}typeof window<"u"&&(window.__fluens_get_dynamic_component_registry_debug_snapshot=So,window.__fluens_dynamic_component_register=function(e,t){const n=Pe(e),r=Dh(e);if(!r.ok){if(r.reason==="already_active_duplicate")return;Sh(n),console.warn(`[DynamicComponent] no pending for register id "${n}" (raw ${JSON.stringify(e)}); see diagnostics above. Try: unload tab / avoid double register / ensure FXDynamicComponent loaded this jsUrl first / empty id if sole pending`);return}const{canonicalKey:o,entry:u}=r;uu(o),ou(o),u.postLoadRegisterCheckTimerId!=null&&(clearTimeout(u.postLoadRegisterCheckTimerId),u.postLoadRegisterCheckTimerId=void 0),clearTimeout(u.timeoutId),Ie.delete(o);const a={config:u.config,container:u.container,api:t,scriptElement:document.currentScript};Qe.set(o,a),a.container.parentElement;try{t.mount(u.container,u.config)}catch(l){console.error(`Failed to mount dynamic component: ${o}`,l)}const s=[o];n&&n!==o&&s.push(n);for(const l of s){const d=nr.get(l);d&&d.length>0&&(nr.delete(l),d.forEach(f=>Ya(t,f)))}u.resolve(t)});const xn=i.defineComponent({name:"FXDynamicComponent",props:{config:{type:Object,required:!0}},setup(e){const t=i.ref("loading"),n=i.ref(""),r=i.computed(()=>`fluens-dynamic-component-${e.config.instanceId}`),o=i.computed(()=>e.config.position==="inline"),u=i.computed(()=>!e.config.jsUrl&&!!e.config.url),a=i.computed(()=>({...o.value?{width:"fit-content",maxWidth:"100%"}:{width:"100%"},height:"auto",...t.value==="ready"&&o.value?{padding:"16px 0"}:{},...t.value==="ready"&&!o.value?{height:"100%",overflow:"hidden"}:{}}));return i.onMounted(()=>{u.value||(t.value="loading",n.value="",Ka(e.config).then(()=>{t.value="ready"}).catch(s=>{t.value="error",n.value=s.message||"Unknown error"}))}),i.onUnmounted(()=>{u.value||Qa(e.config.instanceId)}),()=>u.value?null:i.createVNode("div",{class:"f-chat-dynamic-component-body",style:a.value},[i.createVNode("div",{id:r.value,style:{width:"100%",height:"100%",display:t.value==="ready"?"":"none"}},null),t.value==="loading"&&i.createVNode("div",{class:"f-chat-dynamic-component-loading"},[i.createVNode("span",{class:"f-chat-dynamic-component-loading-spinner"},null),i.createVNode("span",null,[i.createTextVNode("加载中......")])]),t.value==="error"&&i.createVNode("div",{class:"f-chat-dynamic-component-error"},[i.createVNode("span",{class:"f-chat-dynamic-component-error-icon"},[i.createTextVNode("!")]),i.createVNode("span",null,[n.value])])])}}),Ja=(e,t,n)=>{if(e.type===Le.DynamicComponentComplete){const r=e;if(!r.config)return null;if(r.config.position==="inline")return i.createVNode(xn,{key:`dc-${t}`,config:r.config},null);const o={type:"file",fileContent:{type:"md",name:r.config.title}},u={onPreviewFile:a=>{n.emit("showDynamicComponent",r.config)}};return i.nextTick(()=>n.emit("dynamicComponentsDetected",[r.config])),i.createVNode("div",{style:{padding:"16px 0"}},[n.renderFileEmbeddedContent(o,u)])}return e.type===Le.DynamicComponentPending?i.createVNode("div",{class:"f-chat-bubble-widget-pending",key:`dc-loading-${t}`},[i.createVNode("span",{class:"f-chat-todo-status-icon f-chat-todo-status-working"},null),i.createVNode("span",{class:"f-chat-bubble-widget-pending-text"},[i.createTextVNode("组件加载中......")])]):null};function Ih(){return{[Le.Text]:Tf,[Le.AssistantWidgetComplete]:Ga,[Le.AssistantWidgetPending]:Ga,[Le.DynamicComponentComplete]:Ja,[Le.DynamicComponentPending]:Ja}}const Oh=i.defineComponent({name:"FXBubbleTextContent",props:fc,emits:["dynamicComponentsDetected","showDynamicComponent"],setup(e,t){const{renderFileEmbeddedContent:n}=Ai(),{propertyStates:r,registerProperty:o,updatePropertyValue:u,startStreaming:a}=Vr();o("title",e.title??""),o("subtitle",e.subtitle??""),o("text",e.text??""),i.watch([()=>e.title,()=>e.subtitle,()=>e.text],([p,w,y])=>{u("title",p??""),u("subtitle",w??""),u("text",y??"")});const s=i.computed(()=>e.textFormat==="markdown"),l=i.ref(!1),d=i.computed(()=>{var p,w,y;return l.value?{title:((p=r.title)==null?void 0:p.displayedValue)??"",subtitle:((w=r.subtitle)==null?void 0:w.displayedValue)??"",text:((y=r.text)==null?void 0:y.displayedValue)??""}:{title:e.title,subtitle:e.subtitle,text:e.text}}),f=i.computed(()=>Dc(d.value.text)),c={shouldShowMarkdown:s,emit:t.emit,renderFileEmbeddedContent:n},h=Ih(),m=()=>f.value.length===0?null:i.createVNode("div",{class:"f-chat-bubble-text-collection"},[f.value.map((p,w)=>{var y;return(y=h[p.type])==null?void 0:y.call(h,p,w,c)})]);return i.onMounted(()=>{l.value&&a()}),()=>i.createVNode(i.Fragment,null,[d.value.title&&i.createVNode("div",{class:"f-chat-bubble-content-title"},[d.value.title]),d.value.subtitle&&i.createVNode("div",{class:"f-chat-bubble-content-subtitle"},[d.value.subtitle]),m()])}}),Lh={content:{type:Object},outputMode:{type:String,default:"full"}};function wn({status:e,variant:t=""}){let n="";return t?n=`f-chat-todo-status-icon f-chat-todo-status-${e.toLowerCase()} variant--${t.toLowerCase()} `:n=`f-chat-todo-status-icon f-chat-todo-status-${e.toLowerCase()}`,i.createVNode("span",{class:n,"aria-hidden":!0},null)}const Vh=i.defineComponent({name:"FXBubbleThink",props:Lh,setup(e,t){var X;const{propertyStates:n,registerProperty:r,updatePropertyValue:o,isAllDone:u}=Vr(),{elapsedSeconds:a,hasEverStarted:s,start:l,stop:d,reset:f}=Hu(),c=i.ref(((X=e.content)==null?void 0:X.completed)!==!0),h=i.ref(null),m=i.ref(null),p=i.ref(!1),w=i.ref(!1),y=i.computed(()=>e.outputMode==="streaming"),A=i.computed(()=>{var z;return(z=e.content)==null?void 0:z.completed}),b=i.computed(()=>{var _,C,N;const z=(_=g.value)==null?void 0:_.trim(),B=z?z.slice(0,8):"",j=z&&z.length>8?"…":"",I=B?`<span class="f-chat-bubble-thinking-preview">${B}${j}</span>`:"";if(A.value){const F=s.value?`(用时${a.value}秒)`:"";return(((C=e.content)==null?void 0:C.title)??"思考完成"+F)+I}return(((N=e.content)==null?void 0:N.title)??"正在思考......")+I}),g=i.computed(()=>{var z,B;return y.value?((z=n.content)==null?void 0:z.displayedValue)??"":((B=e.content)==null?void 0:B.content)??""}),x=i.computed(()=>({"f-chat-bubble-thinking":!0,"is-pending":!A.value,"is-completed":A.value})),k=()=>{const z=h.value;if(!z||!p.value){w.value=!1;return}w.value=z.scrollTop>0};i.watch(()=>A.value,z=>{z?d():l()},{immediate:!0}),i.watch(()=>A.value,z=>{z&&(c.value=!1)}),i.watch(()=>e.content,z=>{z&&(n.content?o("content",z.content??""):r("content",z.content??""))},{immediate:!0}),i.watch(g,async()=>{if(c.value){await i.nextTick();const z=h.value;if(!z)return;await i.nextTick(),p.value=z.scrollHeight>z.clientHeight,p.value?(z.scrollTop=z.scrollHeight,w.value=!0):w.value=!1}},{immediate:!0}),i.watch(c,async z=>{if(z){await i.nextTick();const B=h.value;if(!B)return;await i.nextTick(),p.value=B.scrollHeight>B.clientHeight,p.value?(B.scrollTop=B.scrollHeight,w.value=!0):w.value=!1}}),i.onUnmounted(()=>{f()}),t.expose({instance:{get loadDone(){return e.content?(y.value?u.value:!0)&&A.value:!0}}});const T=()=>{c.value=!c.value},D=()=>A.value?null:i.createVNode(wn,{status:"Working",variant:"thinking"},null),S=()=>!g.value||!c.value?null:i.createVNode("div",{class:"f-chat-bubble-thinking-content"},[i.createVNode("div",{class:"f-chat-bubble-thinking-scroll-container",ref:h,onScroll:k},[p.value&&w.value&&i.createVNode("div",{class:"f-chat-bubble-thinking-fade-mask"},null),i.createVNode("div",{class:"f-chat-bubble-thinking-text-wrapper"},[i.createVNode("div",{ref:m,class:"f-chat-bubble-thinking-content-text",innerHTML:g.value},null)])])]);return()=>i.createVNode("div",{class:x.value},[i.createVNode("div",{class:"f-chat-bubble-thinking-header",onClick:T},[D(),i.createVNode("span",{class:"f-chat-bubble-thinking-title",innerHTML:b.value},null),g.value&&i.createVNode("i",{class:"fx-icon fx-icon-foldup",style:{transform:c.value?"rotate(0deg)":"rotate(180deg)",transition:"all 0.3s ease-in-out"}},null)]),S()])}}),Ph={content:{type:Object}},es={id:{type:String},arrowOffsetX:{type:Number,default:0},class:{type:String,default:""},customStyles:{type:Object,default:null},isSimpleTips:{type:Boolean,default:!1},fitContent:{type:Boolean,default:!1},host:{type:Object},leftBoundary:{type:Object},keepWidthWithReference:{type:Boolean,default:!1},minWidth:{type:Number,default:-1},offsetX:{type:Object,default:i.ref(0)},offsetY:{type:Object,default:i.ref(0)},placement:{type:String,default:"bottom"},reference:{type:Object},rightBoundary:{type:Object},showArrow:{type:Boolean,default:!1},title:{type:String},visible:{type:Boolean,default:!1},zIndex:{type:Number,default:-1},limitContentBySpace:{type:Boolean,default:!1},beforeClose:{type:Function}};function Rh(e){const t=e.host?e.host:"body",n=i.computed(()=>t==="body"?0:t?t.getBoundingClientRect().top:0),r=i.computed(()=>t==="body"?window.innerHeight:t?t.getBoundingClientRect().bottom:window.innerHeight),o=i.computed(()=>t==="body"?0:t?t.getBoundingClientRect().left:0),u=i.computed(()=>t==="body"?document.body.getBoundingClientRect().width:t?t.getBoundingClientRect().width-(e.rightBoundary?e.rightBoundary.getBoundingClientRect().width:0):document.body.getBoundingClientRect().width),a=i.computed(()=>t==="body"?window.innerHeight:t?t.getBoundingClientRect().height:window.innerHeight);return{host:t,hostLeft:o,hostTop:n,hostWidth:u,hostHeight:a,hostBottom:r}}function Mh(e,t,n,r){const o=i.ref(e.offsetX||0),u=i.ref(e.offsetY||0),a=i.ref(-1),s=i.ref(-1),l=i.ref(-1),d=i.ref(-1),f=i.ref(e.placement),c=i.ref(0),h=i.ref(0),m=i.ref(0),p=i.computed(()=>document.documentElement.scrollLeft),w=i.computed(()=>document.documentElement.scrollTop),{hostLeft:y,hostTop:A,hostWidth:b,hostHeight:g,hostBottom:x}=r;i.watch(()=>e.offsetX,L=>{o.value=L});const k=i.computed(()=>{const L={left:`${h.value}px`,top:`${m.value}px`,transform:`translate(${o.value}px, ${u.value}px)`};return e.zIndex!==-1&&(L["z-index"]=e.zIndex),e.fitContent?e.keepWidthWithReference&&n.value&&a.value>=n.value.getBoundingClientRect().width&&(L.width=`${a.value}px`):a.value!==-1&&(L.width=`${a.value}px`),e.minWidth!==-1&&(L.minWidth=`${e.minWidth}px`),e.customStyles&&Object.assign(L,e.customStyles),s.value>0&&(L.maxHeight=s.value+"px"),L}),T=i.computed(()=>({left:`${c.value}px`,transform:`translateX(${e.arrowOffsetX}px)`}));function D(L){if(L&&e.keepWidthWithReference){const M=L.getBoundingClientRect();a.value=Math.max(e.minWidth,M.width)}}function S(L,M){const G=b.value-L.width-4;return G>0?G:M}function X(L,M){const G=g.value-L.height-12;return G>0?G:M}function z(L,M,G){const J=c.value,Z=M.left-y.value+M.width/2+p.value,K=M.top-A.value-(L.height+G.height)+w.value;return{popoverLeft:Z,popoverTop:K,arrowLeft:J}}function B(L,M,G){const J=M.top-A.value+(M.height+G.height)+w.value,Z=X(L,J);return Math.min(J,Z)}function j(L,M){const G=S(M,L),J=L<=G?c.value:L-G;return{popoverLeft:Math.min(L,G),arrowLeft:J,maxHeight:0}}function I(L,M){const G=S(M,L),J=L<=G?c.value:L-G;return{popoverLeft:L,arrowLeft:J,maxHeight:0}}function W(L,M,G){const J=M.left-y.value+p.value,{arrowLeft:Z,popoverLeft:K}=I(J,L),{popoverTop:ue}=z(L,M,G);return{popoverLeft:K,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function _(L,M,G){const J=M.left-y.value+M.width/2-(G.width/2-(L.left-y.value))+p.value,{arrowLeft:Z,popoverLeft:K}=j(J,L),ue=B(L,M,G);return{popoverLeft:K,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function C(L,M,G){const J=M.left-y.value+p.value,{arrowLeft:Z,popoverLeft:K}=j(J,L),ue=B(L,M,G);return{popoverLeft:K,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function N(L,M,G){const J=M.left-y.value;let Z=0,K=0,ue=0,le=0,Fe="bottom-left";window.innerWidth-J>L.width?Z=J+p.value:(Z=M.right-L.width+p.value,ue=L.width-G.width-20);let Te=0;if(e.limitContentBySpace){const Xt={topHeight:M.top-A.value-G.height-8,bottomHeight:x.value-M.bottom-G.height-8};Te=Math.max(Xt.topHeight,Xt.bottomHeight),L.height>Te&&(le=Te,n.value.classList.add("popover-limitmax"))}const yt=le?Math.floor(le):L.height,Me=M.top-A.value+(M.height+G.height);return x.value-Me>yt?K=Me+w.value:(K=M.top-yt-G.height+w.value,x.value-Me>M.top?(K=Me+w.value,yt>M.top&&(K=x.value-yt)):(K=K<0?0:K,Fe="top")),n.value.classList.add("popover-"+Fe,"bs-popover-"+Fe),{popoverLeft:Z<0?5:Z,popoverTop:K,arrowLeft:ue,maxHeight:le}}function F(L,M,G){const J=M.left+M.width,Z=Math.max(M.top-(L.height/2-M.height/2),A.value);let K=A.value+g.value-L.height;K<0&&(K=Z);const ue=Math.min(Z,K);return{popoverLeft:J,popoverTop:ue,arrowLeft:0,maxHeight:0}}function O(L,M,G){const J=M.left+M.width,Z=Math.max(M.top-M.height,A.value);let K=A.value+g.value-L.height;K<0&&(K=Z);const ue=Math.min(Z,K);return{popoverLeft:J,popoverTop:ue,arrowLeft:0,maxHeight:0}}const H=new Map([["top",z],["top-left",W],["bottom",_],["bottom-left",C],["right",F],["right-top",O],["auto",N]]);function $(L){var K;e.keepWidthWithReference&&D(L);const M=L.getBoundingClientRect();l.value=M.top,d.value=M.left;const G=t.value?t.value.getBoundingClientRect():{height:4,width:4},J=(K=n.value)==null?void 0:K.getBoundingClientRect();a.value=J.width;const Z=H.get(f.value);if(Z){const{arrowLeft:ue,popoverLeft:le,popoverTop:Fe,maxHeight:Te}=Z(J,M,G);c.value=ue,h.value=le,m.value=Fe,s.value=Te||-1}}function R(L){if(L){const M=L.getBoundingClientRect();(M.left!==d.value||M.top!==l.value)&&$(L)}}function V(){f.value=e.placement,c.value=0,h.value=0,m.value=0,a.value=-1}return{arrowStyle:T,popoverStyle:k,position:f,popoverWidth:a,fitToReference:D,followToReferencePosition:R,locateToReference:$,resetPosition:V}}function Bh(e,t,n,r,o,u,a){const s=i.ref(e.visible),l=i.computed(()=>s.value),{fitToReference:d,locateToReference:f,resetPosition:c}=a;let h;async function m(){s.value&&(e.beforeClose&&typeof e.beforeClose=="function"&&!await e.beforeClose()||(s.value=!1,document.body.removeEventListener("click",h),document.body.removeEventListener("mousedown",h),document.body.removeEventListener("wheel",h,!0),document.removeEventListener("scroll",h),c(),t.emit("hidden")))}h=w=>{var b;if(!o.value)return;const y=o.value.contains(w.target);if(w.type==="scroll"||w.type==="wheel"&&y){m();return}if(w.target.closest(".time-picker-panel"))return;const A=(b=w.target)==null?void 0:b.closest(".popover");if(A&&r.value&&A===r.value){w.type!=="scroll"&&w.type!=="wheel"&&w.stopPropagation();return}if(!y&&s.value){const g=o.value.closest(".popover");g&&g.removeEventListener("click",h),m()}};async function p(w){if(r.value&&(e.showArrow===!1||e.showArrow&&n.value)&&w){c(),s.value=!0,o.value=w,u.value&&d(w),await i.nextTick(),f(w),document.body.addEventListener("click",h),document.body.addEventListener("mousedown",h),document.body.addEventListener("wheel",h,!0),document.addEventListener("scroll",h),(top==null?void 0:top.document)!==document&&(top==null||top.document.addEventListener("mousedown",h));const y=w.closest(".popover");y&&y.addEventListener("click",h),t.emit("shown")}}return t.expose({hide:m,popoverRef:r,show:p,shown:l,isShow:s}),{showPopover:s,hidePopverOnClickBodyHandler:h}}function zh(e,t,n,r,o,u){const{popoverWidth:a,fitToReference:s,followToReferencePosition:l}=o;function d(){var f;if(u.value&&((f=u.value.style)==null?void 0:f.display)!=="none"&&n.value){l(n.value);const c=n.value.getBoundingClientRect();r.value&&c.width!==a.value&&s(n.value)}}return{onResize:d}}function jh(e,t=500){const n=i.ref(e.value);let r;const o=i.watch(e,a=>{clearTimeout(r),r=setTimeout(()=>{n.value=a},t)}),u=()=>{clearTimeout(r),o()};return i.onUnmounted(u),{delayedValue:n,cleanup:u}}const Kt=i.defineComponent({name:"FXPopover",props:es,emits:["shown","hidden"],setup(e,t){const n=i.ref(),r=i.ref(),o=i.ref(e.reference),u=i.ref(e.keepWidthWithReference),a=i.computed(()=>!!e.title),s=Rh(e),{host:l}=s,d=Mh(e,n,r,s),{position:f,arrowStyle:c,popoverStyle:h,fitToReference:m,locateToReference:p}=d,{showPopover:w,hidePopverOnClickBodyHandler:y}=Bh(e,t,n,r,o,u,d),{onResize:A}=zh(e,t,o,u,d,r),b=i.computed(()=>{let D=f.value;D==="top-left"&&(D="top");const S=`popover in popover-${D}`,X=`bs-popover-${D}`,z={"popover-fitcontent":e.fitContent,fade:!0};z[S]=!0,z[X]=!0;const B=(e.class||"").split(" ");return e.isSimpleTips&&B.unshift("popover-tips"),B.reduce((j,I)=>(j[I]=!0,j),z),z}),g=i.computed(()=>({"popover-content":!0,"popover-body":!0})),x=i.computed(()=>{const D={};return D.opacity=w.value?1:0,D.visibility=w.value?"visible":"hidden",D.zIndex=1060,D}),k=i.computed(()=>e.isSimpleTips?!0:e.showArrow),{delayedValue:T}=jh(x,50);return i.onMounted(()=>{var D;u.value&&m(o.value),e.reference&&p(o.value),window.addEventListener("resize",A),(D=r.value)==null||D.focus()}),i.onUnmounted(()=>{document.body.removeEventListener("click",y),window.removeEventListener("resize",A),w.value=!1}),()=>i.createVNode(i.Teleport,{to:l},{default:()=>{var D;return[i.withDirectives(i.createVNode("div",{tabindex:"-1",ref:r,class:b.value,style:{...h.value,...T.value},onMousedown:S=>{S.stopPropagation()},onClick:S=>{S.stopPropagation()}},[k.value&&i.createVNode("div",{ref:n,class:"popover-arrow arrow",style:c.value},null),a.value&&i.createVNode("h3",{class:"popover-title popover-header"},[e.title]),i.createVNode("div",{class:g.value},[t.slots.default&&((D=t.slots)==null?void 0:D.default())])]),[[i.vShow,w.value]])]}})}}),au="FarrisX_PopoverInstancesKey";window[au]=window[au]||new WeakMap;function Fo(e,t,n){e.stopPropagation();const r=t.value;r&&r.value&&!r.value.isShow&&(r.value.show(n),window[au].set(n,r.value))}function ts(e,t,n){e.stopPropagation(),t.value.value.hide(),window[au].delete(n)}function Hh(e,t,n){e.stopPropagation();const r=t.value;r&&r.value&&(r.value.isShow?ts(e,t,n):Fo(e,t,n))}function ns(e,t,n){t.arg&&t.arg==="toggle"?Hh(e,t,n):Fo(e,t,n)}const rs={mounted:(e,t,n)=>{t.modifiers.hover?(e.addEventListener("mouseenter",r=>Fo(r,t,e)),e.addEventListener("mouseleave",r=>ts(r,t,e))):t.modifiers.click?e.addEventListener("click",r=>ns(r,t,e)):e.addEventListener("click",r=>ns(r,t,e)),e.classList.add("v-popover")},unMounted:(e,t,n)=>{}};Kt.install=e=>{e.component(Kt.name,Kt),e.directive("fxpopover",rs)};const us={type:{type:String,default:"StartedToDo"},status:{type:String,default:"NotStart"},message:{type:String,default:""},taskDetail:{type:String,default:""},todoList:{type:Array,default:[]},detailViewMode:{type:String,default:"hover"},initExpanded:{type:Boolean,default:!1},showLoading:{type:Boolean,default:!0},showLabel:{type:Boolean,default:!0},loading:Object,shimmer:{type:Boolean,default:!0},outputMode:{type:String,default:"streaming"},listStatus:{type:String,default:void 0},completedCount:{type:Number,default:void 0},totalCount:{type:Number,default:void 0}},os={items:{type:Array,default:()=>[]}},is={id:{type:Number||String,default:0},status:{type:String},task:{type:String,default:""},todoList:{type:Array,default:[]},detailViewMode:{type:String,default:"expand"},initExpanded:{type:Boolean,default:!0},showLoading:{type:Boolean,default:!0},showLabel:{type:Boolean,default:!1},shimmer:{type:Boolean,default:!0},title:{type:String,default:""},message:{type:String,default:""},outputMode:{type:String,default:"full"}},su=i.defineComponent({name:"FXTodoListItemView",props:is,emits:["click"],setup(e,{emit:t}){const{propertyStates:n,registerProperty:r,updatePropertyValue:o,startStreaming:u}=Vr();r("title",e.title??""),r("task",e.task??""),r("detail",e.message??""),i.watch([()=>e.title,()=>e.task,()=>e.message],([m,p,w])=>{o("title",m??""),o("task",p??""),o("detail",w??"")});const a=i.computed(()=>["f-chat-todo-item",{"is-done":e.status==="Done","is-working":e.status==="Working","is-not-start":e.status==="NotStart","no-shimmer":!e.shimmer}]),s=i.computed(()=>["f-chat-todo-task",{"is-done":e.status==="Done"}]);function l(){t("click",e,e.id)}const d=i.computed(()=>e.outputMode==="streaming"),f=i.computed(()=>{var m;return d.value?((m=n.title)==null?void 0:m.displayedValue)??"":e.title??""}),c=i.computed(()=>{var m;return d.value?((m=n.task)==null?void 0:m.displayedValue)??"":e.task??""}),h=i.computed(()=>{var m;return d.value?((m=n.detail)==null?void 0:m.displayedValue)??"":e.message??""});return i.onMounted(()=>{d.value&&u()}),()=>i.createVNode("li",{key:e.id,class:a.value,onClick:l},[e.todoList&&e.todoList.length>0&&i.createVNode(Qt,{todoList:e.todoList,status:e.status,message:e.task,taskDetail:e.message,detailViewMode:e.detailViewMode,initExpanded:e.initExpanded,showLoading:e.showLoading,showLabel:e.showLabel,outputMode:e.outputMode},null),!e.todoList||e.todoList.length===0&&i.createVNode(i.Fragment,null,[e.showLoading&&i.createVNode(wn,{status:e.status??"Done",variant:"todo"},null),f.value?i.createVNode("div",{class:"f-chat-todo-task-wrapper"},[i.createVNode("span",{class:s.value},[f.value]),i.createVNode("div",{class:"f-chat-todo-task-description"},[c.value]),h.value?i.withDirectives(i.createVNode("div",{class:"f-chat-todo-task-description"},[h.value]),[[i.resolveDirective("overflow-tooltip")]]):null]):i.createVNode("div",{class:"f-chat-todo-task-wrapper"},[i.createVNode("span",{class:s.value},[c.value]),h.value?i.withDirectives(i.createVNode("div",{class:"f-chat-todo-task-description"},[h.value]),[[i.resolveDirective("overflow-tooltip")]]):null])])])}}),rr=i.defineComponent({name:"FXTodoListView",props:os,setup(e){return()=>{var t;return(t=e.items)!=null&&t.length?i.createVNode("ul",{class:"f-chat-todo-items"},[e.items.map((n,r)=>i.createVNode(su,i.mergeProps({key:r},n),null))]):null}}}),$h=300,Uh={Working:"正在执行任务",Done:"已完成任务",NotStart:"待执行任务"},Qt=i.defineComponent({name:"FXStartedTodo",props:us,setup(e){const t=i.ref(null),n=i.ref(null),r=i.ref(null),o=i.ref(null),u=i.computed(()=>e.outputMode==="streaming"),{displayContent:a}=bi(()=>({detail:e.taskDetail??""}),()=>!0,u,{charInterval:30}),s=i.ref(e.initExpanded),l=i.computed(()=>({"f-chat-message-started-todo--content":!0,"d-none":!s.value}));function d(){e.detailViewMode!=="expand"&&(o.value!=null&&(window.clearTimeout(o.value),o.value=null),r.value=window.setTimeout(()=>{t.value&&n.value&&n.value.show(t.value),r.value=null},$h))}function f(){e.detailViewMode!=="expand"&&(r.value!=null&&(window.clearTimeout(r.value),r.value=null),o.value=window.setTimeout(()=>{var b,g;(g=(b=n.value)==null?void 0:b.hide)==null||g.call(b),o.value=null},150))}function c(){if(e.detailViewMode==="none")return null;const b=a.value.detail??"";return i.createVNode(i.Fragment,null,[b?i.createVNode("div",{class:"f-chat-started-todo-task-detail"},[b]):null,i.createVNode(rr,{items:e.todoList},null)])}function h(){e.detailViewMode==="expand"&&(s.value=!s.value)}function m(){return e.detailViewMode==="expand"?i.createVNode("i",{class:"fx-icon fx-icon-foldup",style:{transform:s.value?"rotate(0deg)":"rotate(180deg)",transition:"all 0.3s ease-in-out"}},null):null}function p(){return e.detailViewMode==="hover"&&i.createVNode(Kt,{ref:n,class:"f-chat-started-todo-popover"},{default:()=>[i.createVNode("div",{class:"f-chat-started-todo-popover-content",onMouseenter:()=>{o.value!=null&&(window.clearTimeout(o.value),o.value=null)},onMouseleave:f},[c()])]})}const w=i.computed(()=>e.listStatus==="completed"),y=i.computed(()=>{const b=e.todoList??[],g=e.totalCount??b.length;return{done:e.completedCount??b.filter(k=>(k==null?void 0:k.status)==="Done").length,total:g}});function A(){if(!w.value)return null;const{done:b,total:g}=y.value,x=g>0?`已完成 (${b}/${g})`:"已完成";return i.createVNode("span",{class:"f-chat-started-todo-completed-chip","aria-label":x},[x])}return()=>i.createVNode("div",{ref:t,class:["f-chat-message-started-todo",{"is-working":e.status==="Working","is-completed":w.value}],onMouseenter:d,onMouseleave:f},[i.createVNode("div",{class:"f-chat-message-started-todo--header",onClick:h},[e.showLabel&&i.createVNode("span",{class:"f-chat-started-todo-label"},[Uh[e.status]]),i.createVNode("span",{class:"f-chat-started-todo-message",innerHTML:e.message},null),A(),m()]),e.detailViewMode==="expand"&&i.createVNode("div",{class:l.value},[c()]),p()])}});Qt.install=e=>{e.component(Qt.name,Qt)};const Wh=i.defineComponent({name:"FXBubbleThoughtChain",props:Ph,setup(e,t){const{elapsedSeconds:n,hasEverStarted:r,start:o,stop:u,reset:a}=Hu(),s=i.computed(()=>{var c;return((c=e.content)==null?void 0:c.status)==="Done"}),l=i.computed(()=>{var c;return((c=e.content)==null?void 0:c.message)??"正在思考......"}),d=i.computed(()=>{var m,p;const c=((m=e.content)==null?void 0:m.doneMessage)??((p=e.content)==null?void 0:p.message)??"思考完成",h=r.value?`(用时${n.value}秒)`:"";return""+c+h}),f=i.computed(()=>s.value?d.value:l.value);return i.watch(()=>{var c;return(c=e.content)==null?void 0:c.status},c=>{c==="Working"?o():c==="Done"?u():a()},{immediate:!0}),i.onUnmounted(()=>{a()}),t.expose({instance:{get loadDone(){return e.content?s.value:!0}}}),()=>{var c,h,m,p,w,y;return e.content?i.createVNode(Qt,{status:((c=e.content)==null?void 0:c.status)??"Working",message:f.value,todoList:(h=e.content)==null?void 0:h.todoList,detailViewMode:((m=e.content)==null?void 0:m.detailViewMode)??"expand",showLabel:!1,showLoading:!0,initExpanded:!0,listStatus:(p=e.content)==null?void 0:p.listStatus,completedCount:(w=e.content)==null?void 0:w.completedCount,totalCount:(y=e.content)==null?void 0:y.totalCount},null):null}}}),ur=i.defineComponent({name:"UserAuthMessage",props:{content:{type:Object,required:!0},onConfirm:{type:Function,default:void 0}},setup(e){return()=>i.createVNode("div",{class:"f-ec-auth"},[i.createVNode("div",{class:"f-ec-auth-desc"},[e.content.description]),i.createVNode("div",{class:"f-ec-auth-actions"},[e.content.options.map(t=>i.createVNode("button",{key:t.optionId,type:"button",class:"f-ec-auth-btn",onClick:()=>{var n;(n=e.onConfirm)==null||n.call(e,t.optionId,t.name,t.message??t.name),console.info("[UserAuth]",t.optionId,t.name)}},[t.name]))])])}}),Gh=300,Xh={read_file:"tool_file",write_file:"tool_file",edit_file:"tool_file",glob:"tool_file",grep:"tool_file",bash:"tool_command",web_fetch:"tool_internet",web_search:"tool_internet",todo_create:"tool_task",todo_list:"tool_task",todo_get:"tool_task",todo_update:"tool_task",ask_user:"tool_interaction",core_memory:"tool_memory",add_daily_note:"tool_memory",lint_json:"dateselect",lint_markdown:"dateselect",output_validation:"dateselect",load_skill_through_path:"tool_mcp"};function qh(e){return e?e.startsWith("mcp:")?"tool_mcp":Xh[e]??"thinking_tool":"thinking_tool"}const vn=i.defineComponent({name:"FXToolUseMessage",props:{content:{type:Object,required:!0}},setup(e){const t=i.computed(()=>e.content.toolResultApplied===!0||String(e.content.result??"").trim().length>0),n=i.computed(()=>e.content.success===!1),r=i.ref(!1);let o=setTimeout(()=>{r.value=!0},Gh);i.onBeforeUnmount(()=>{o&&clearTimeout(o)});const u=i.computed(()=>t.value),a=i.computed(()=>r.value&&!t.value),s=i.computed(()=>n.value?"执行失败":u.value?"执行完成":"调用中"),l=i.ref(!1),d=i.computed(()=>({"f-chat-tool-use":!0,"is-done":u.value,"is-error":n.value})),f=i.computed(()=>({"f-chat-tool-use-status":!0,"is-done":u.value&&!n.value,"is-run":a.value&&!n.value,"is-error":n.value}));i.watch(()=>[e.content.result,e.content.toolResultApplied,e.content.success],()=>{t.value&&(l.value=!1)},{flush:"post"});const c=()=>t.value?i.createVNode("div",{class:"f-chat-tool-use-result"},[e.content.result??""]):null;return()=>i.createVNode("div",{class:d.value},[i.createVNode("div",{class:"f-chat-tool-use-header",onClick:()=>{l.value=!l.value}},[i.createVNode("i",{class:"fx-icon fx-icon-"+qh(e.content.toolName)+" tool-icon"},null),i.createVNode("span",{class:"f-chat-tool-use-name"},[e.content.toolDescription??"tool"]),i.createVNode("div",{class:f.value},[n.value?i.createVNode(wn,{status:"Error"},null):i.createVNode(wn,{status:u.value?"Done":a.value?"Working":"NotStart"},null),i.createVNode("span",{class:"f-chat-tool-use-status-text"},[s.value])]),i.createVNode("i",{class:"fx-icon fx-icon-foldup",style:{transform:l.value?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.2s ease"}},null)]),l.value&&i.createVNode("div",{class:"f-chat-tool-use-content"},[c()])])}});vn.install=e=>{e.component(vn.name,vn)};const or=i.defineComponent({name:"FXBubble",components:{"fx-user-auth-inline":ur,"fx-app-preview-inline":at,FXToolUse:vn},props:Ir,setup(e,t){const n=i.shallowRef(),r=i.ref(),o=i.ref(),u=i.computed(()=>!!e.showAvatar),a=i.computed(()=>u.value===!0||e.header==="ContentHeader"),s=i.computed(()=>t.slots.leftFooter||t.slots.rightFooter),l=i.computed(()=>{var I;return Ae({},(I=e.styles)==null?void 0:I.footer)}),d=I=>{if(e.attachmentRowClickOpensPreview!==!1&&e.onPreview){if(I.type==="md"&&I.content){e.onPreview({content:I.content,contentType:"markdown"});return}if(I!=null&&I.url){const W=I!=null&&I.fullScreenPreview?"fullScreen":"splitScreen";e.onPreview({url:I.url,previewMode:W,title:I.name})}}},f=I=>{if(e.attachmentRowClickOpensPreview===!1||!e.onPreview)return;const W=I==null?void 0:I.filter(C=>C.type==="md"&&C.content);if(W.length===0)return;const _=Object.fromEntries(W.map(C=>[C.name,C.content??""]));e.onPreview({contentMap:_,contentType:"markdown"})},{renderFileEmbeddedContent:c,renderPageEmbeddedContent:h}=Ai(),m=i.ref(""),p=i.computed(()=>{var W,_;if((W=e.content)!=null&&W.footerContent)return e.content.footerContent;const I=(_=e.content)==null?void 0:_.structuredContent;return I&&(I.footerTemplate||I.footerUrl||I.footerFile)?{type:I.footerUrl?"page":I.footerFile?"file":"template",pageUrl:I.footerUrl,fileContent:I.footerFile,template:I.footerTemplate,width:I.footerWidth,height:I.footerHeight}:null});i.watch(()=>{var I;return(I=p.value)==null?void 0:I.width},I=>{if(!I){m.value="";return}if(I.endsWith("%")){const W=parseFloat(I);isNaN(W)||i.nextTick(()=>{var C,N;const _=(N=(C=n.value)==null?void 0:C.parentElement)==null?void 0:N.clientWidth;_&&(m.value=`${_*W/100}px`)})}else m.value=I},{immediate:!0});const w=I=>{if(!I||I.length===0)return"我";const W=I.charAt(0);return/[\u4e00-\u9fa5]/.test(W)?W:W.toUpperCase()};function y(){return e.header==="ContentHeader"?uc:oc}const A=y(),{renderHeader:b}=A(e,t),g=()=>{var _,C,N;const I=((_=e.content)==null?void 0:_.sender)??"发送人",W=w(((C=e.content)==null?void 0:C.sender)??"");return i.createVNode("div",{class:"f-chat-bubble-avatar"},[(N=e.content)!=null&&N.avatar?i.createVNode("img",{src:e.content.avatar,alt:I},null):i.createVNode("div",{class:"f-chat-bubble-avatar-initial"},[W])])},x=()=>{var W;const I=(W=e.content)==null?void 0:W.toolUseAboveText;return I!=null&&I.length?i.createVNode("div",{class:"f-chat-bubble-tool-use-group"},[I.map((_,C)=>i.createVNode(vn,{key:_.toolUseId??`tu-${C}`,content:_},null))]):null},k=()=>{var I;return(I=e.content)!=null&&I.thinkingContent?i.createVNode(Vh,{ref:r,content:e.content.thinkingContent,outputMode:e.outputMode},null):null},T=()=>{var I;return(I=e.content)!=null&&I.startedTodo?i.createVNode(Wh,{ref:o,content:e.content.startedTodo},null):null},D=I=>{if(!(I!=null&&I.type))return null;const{type:W}=I;return W==="page"&&I.pageUrl?h(I,{onNavigate:_=>{var C;(C=e.onPreview)==null||C.call(e,{url:_})}}):W==="file"&&I.fileContent?c(I,{onPreviewFile:d,onBatchPreviewFile:f}):W==="template"&&I.template?I.template():null},S=()=>{var C,N,F;if(!((F=(N=(C=e.content)==null?void 0:C.structuredContent)==null?void 0:N.sections)!=null&&F.length))return null;const{sections:I,showDivider:W}=e.content.structuredContent,_=O=>{const{content:H,label:$}=O;return $||H&&typeof H=="string"?i.createVNode(i.Fragment,null,[i.createVNode("span",{class:"f-chat-bubble-structured-section-item-dot"},null),O.label&&i.createVNode("span",{class:"f-chat-bubble-structured-section-item-label"},[O.label]),i.createVNode("span",{class:"f-chat-bubble-structured-section-item-content"},[O.content])]):D(O.content)};return i.createVNode("div",{class:["f-chat-bubble-structured",{"structure-content-divider":W}]},[I.map((O,H)=>i.createVNode("div",{key:H,class:["f-chat-bubble-structured-section",{"section-divider":O.showDivider}]},[i.createVNode("div",{class:"f-chat-bubble-structured-section-header"},[O.icon&&(O.icon.startsWith("http")||O.icon.startsWith("//")||O.icon.startsWith("../")||/\.(png|jpg|jpeg|gif|svg|webp|bmp)$/i.test(O.icon)?i.createVNode("img",{alt:O.title,src:O.icon,class:"f-chat-bubble-structured-section-icon"},null):i.createVNode("i",{class:`fx-icon ${O.icon}`,style:O.iconStyle},null)),i.createVNode("span",{class:"f-chat-bubble-structured-section-title"},[O.title])]),O.items&&O.items.length>0&&i.createVNode("div",{class:"f-chat-bubble-structured-section-items"},[O.items.map(($,R)=>i.createVNode("div",{key:R,class:"f-chat-bubble-structured-section-item"},[_($)]))])]))])},X=()=>{const I=p.value;if(!I)return null;const W={};return m.value&&(W.width=m.value),I.height&&(W.height=`${I.height}px`),i.createVNode("div",{class:"f-chat-bubble-content-footer",style:W},[D(I)])},z=()=>{const I=e.attachmentRowClickOpensPreview!==!1?d:void 0;return i.createVNode(vi,{attachments:e.attachments??[],enableFixedWidth:e.placement==="end",showDownloadButton:e.attachmentShowDownload!==!1,onPreview:I,onBatchPreview:e.attachmentRowClickOpensPreview!==!1?f:void 0,role:e.role},null)},B=()=>{var W;const I=(W=e.content)==null?void 0:W.compositeInlineBlocks;return I!=null&&I.length?I.map((_,C)=>_.kind==="userAuth"?i.createVNode(i.resolveComponent("fx-user-auth-inline"),{key:`inline-auth-${C}`,content:_.content,onConfirm:e.onUserAuthConfirm},null):i.createVNode(i.resolveComponent("fx-app-preview-inline"),{key:`inline-preview-${C}`,content:_.content,onOpen:e.onPreview},null)):null},j=()=>{var I,W,_,C,N,F;return i.createVNode("div",{class:`f-chat-bubble-content ${e.placement}`},[a.value&&b(),z(),i.createVNode("div",{class:`f-chat-bubble-content-text-wrapper ${e.placement}`},[(I=e.content)!=null&&I.compositeOrderedBeforeMarkdownRender?e.content.compositeOrderedBeforeMarkdownRender():i.createVNode(i.Fragment,null,[k(),x()]),T(),S(),i.createVNode(Oh,{title:((W=e.content)==null?void 0:W.title)??"",subtitle:((_=e.content)==null?void 0:_.subtitle)??"",text:typeof((C=e.content)==null?void 0:C.text)=="string"?e.content.text:"",textFormat:((N=e.content)==null?void 0:N.textFormat)??"plain",placement:e.placement,onDynamicComponentsDetected:e==null?void 0:e.onDynamicComponentsDetected,onShowDynamicComponent:e==null?void 0:e.onShowDynamicComponent},null),X(),(F=e.compositeTailRender)==null?void 0:F.call(e),B()]),s.value&&i.createVNode("div",{class:"f-chat-bubble-footer",style:l.value},[t.slots.leftFooter&&i.createVNode("div",{class:"f-chat-bubble-footer-left"},[t.slots.leftFooter()]),t.slots.rightFooter&&i.createVNode("div",{class:"f-chat-bubble-footer-right"},[t.slots.rightFooter()])])])};return()=>i.createVNode("div",{class:"f-chat-bubble-container",ref:n},[i.createVNode("div",{class:`f-chat-bubble-wrapper ${e.placement}`},[e.placement==="start"?i.createVNode(i.Fragment,null,[u.value&&g(),j()]):i.createVNode(i.Fragment,null,[j(),u.value&&g()])])])}}),as={customClass:{type:[Object,String,Array],default:""},customStyle:{type:[Object,String],default:""}},To=i.defineComponent({name:"FXBubbleAction",props:as,setup(e,t){const n=i.computed(()=>Ae({},e.customStyle));return()=>t.slots.default&&i.createVNode("span",{class:"f-chat-bubble-footer-action",style:n.value},[t.slots.default()])}});or.install=e=>{e.component(or.name,or),e.component(To.name,To)};const ss={items:{type:Array,default:()=>[]},modelValue:{type:Number,default:0},direction:{type:String,default:"horizontal"},autoplay:{type:Boolean,default:!1},interval:{type:Number,default:3e3},loop:{type:Boolean,default:!0},trigger:{type:String,default:"click"},indicatorPosition:{type:String,default:"inside"},arrowVisibility:{type:String,default:"hover"},showIndicator:{type:Boolean,default:!0},showArrow:{type:Boolean,default:!0},showInfo:{type:Boolean,default:!0},height:{type:[String,Number],default:"400px"},styles:{type:Object,default:()=>({})},classNames:{type:Object,default:()=>({})},customClass:{type:[String,Array,Object],default:""},customStyle:{type:[Object,String],default:""},buttonPosition:{type:String,default:"inner"}},ls={item:{type:Object,default:()=>({})},index:{type:Number,default:0},active:{type:Boolean,default:!1},showInfo:{type:Boolean,default:!0},styles:{type:Object,default:()=>({})},classNames:{type:Object,default:()=>({})}},lu=i.defineComponent({name:"FXCarouselItem",props:ls,emits:["click"],setup(e,{slots:t,emit:n}){const r=i.computed(()=>{var c;const f={"fx-carousel--item":!0,"fx-carousel--item-active":e.active};return ye(f,(c=e.classNames)==null?void 0:c.item)}),o=i.computed(()=>{var c,h;const f=Ae({},(c=e.styles)==null?void 0:c.item);return Ae(f,(h=e.styles)==null?void 0:h.item)}),u=()=>{var f,c,h;return e.item.image?i.createVNode("img",{class:["fx-carousel--item-image",(f=e.classNames)==null?void 0:f.image],style:(c=e.styles)==null?void 0:c.image,src:e.item.image,alt:(h=e.item.title)==null?void 0:h.toString()},null):null},a=()=>{var f,c,h,m;return e.item.content?i.createVNode("div",{class:["fx-carousel--item-content",(f=e.classNames)==null?void 0:f.content],style:(c=e.styles)==null?void 0:c.content},[e.item.content]):t.default?i.createVNode("div",{class:["fx-carousel--item-content",(h=e.classNames)==null?void 0:h.content],style:(m=e.styles)==null?void 0:m.content},[t.default()]):null},s=()=>{var f,c;return e.item.title?i.createVNode("h3",{class:["fx-carousel--item-title",(f=e.classNames)==null?void 0:f.title],style:(c=e.styles)==null?void 0:c.title},[e.item.title]):null},l=()=>{var f,c;return e.item.description?i.createVNode("p",{class:["fx-carousel--item-description",(f=e.classNames)==null?void 0:f.description],style:(c=e.styles)==null?void 0:c.description},[e.item.description]):null},d=f=>{e.item.disabled||n("click",f,e.item,e.index)};return()=>i.createVNode("div",{class:r.value,style:o.value,onClick:d},[u(),a(),e.showInfo&&i.createVNode("div",{class:"fx-carousel--item-info"},[s(),l()])])}});function Zh(e){const{items:t,autoplay:n=!1,interval:r=3e3,loop:o=!0,direction:u="horizontal"}=e,a=i.ref(0),s=i.ref(!1),l=i.ref(null),d=i.computed(()=>t.length),f=i.computed(()=>d.value<=1);i.computed(()=>a.value===0?o?d.value-1:0:a.value-1),i.computed(()=>a.value===d.value-1?o?0:a.value:a.value+1);const c=i.computed(()=>{const g=-a.value*100;return{transform:u==="horizontal"?`translateX(${g}%)`:`translateY(${g}%)`,transition:"transform 0.5s ease"}}),h=g=>{g<0||g>=d.value||(a.value,a.value=g)},m=()=>{f.value||(a.value===d.value-1?h(o?0:a.value):h(a.value+1))},p=()=>{f.value||(a.value===0?h(o?d.value-1:0):h(a.value-1))},w=()=>{!n||f.value||(y(),l.value=window.setInterval(()=>{s.value||m()},r))},y=()=>{l.value&&(clearInterval(l.value),l.value=null)},A=()=>{s.value=!0,n&&y()},b=()=>{s.value=!1,n&&w()};return i.onMounted(()=>{w()}),i.onUnmounted(()=>{y()}),{currentIndex:a,totalItems:d,isSingleItem:f,trackStyle:c,goTo:h,next:m,prev:p,handleMouseEnter:A,handleMouseLeave:b}}const ir=i.defineComponent({name:"FXCarousel",props:ss,emits:["update:modelValue","change","item-click"],setup(e,{slots:t,emit:n}){const{currentIndex:r,isSingleItem:o,trackStyle:u,goTo:a,next:s,prev:l,handleMouseEnter:d,handleMouseLeave:f}=Zh({items:e.items,autoplay:e.autoplay,interval:e.interval,loop:e.loop,direction:e.direction}),c=k=>{n("update:modelValue",k),n("change",k,r.value)},h=i.computed(()=>{var T;const k={"fx-carousel":!0,"fx-carousel--vertical":e.direction==="vertical","fx-carousel--single":o.value,"fx-carousel--button-outer":e.buttonPosition==="outer","fx-carousel--button-inner":e.buttonPosition==="inner"};return ye(k,(T=e.classNames)==null?void 0:T.root)}),m=i.computed(()=>{var D;const k={height:typeof e.height=="number"?`${e.height}px`:e.height},T=Ae(k,e.customStyle);return Ae(T,(D=e.styles)==null?void 0:D.root)}),p=i.computed(()=>{var T;const k={"fx-carousel--container":!0,"fx-carousel--container-hover":e.arrowVisibility==="hover"};return ye(k,(T=e.classNames)==null?void 0:T.container)}),w=i.computed(()=>{var T;return ye({"fx-carousel--track":!0},(T=e.classNames)==null?void 0:T.track)}),y=i.computed(()=>{var T;const k={"fx-carousel--indicator":!0,"fx-carousel--indicator-outside":e.indicatorPosition==="outside","fx-carousel--indicator-none":e.indicatorPosition==="none"||!e.showIndicator};return ye(k,(T=e.classNames)==null?void 0:T.indicator)}),A=k=>{var D,S;const T={"fx-carousel--arrow":!0,"fx-carousel--arrow-left":k==="left","fx-carousel--arrow-right":k==="right","fx-carousel--arrow-never":e.arrowVisibility==="never"||!e.showArrow};return T[`fx-carousel--arrow-${e.buttonPosition}`]=!0,ye(T,k==="left"?(D=e.classNames)==null?void 0:D.arrowLeft:(S=e.classNames)==null?void 0:S.arrowRight)},b=k=>{var S,X;if(o.value)return null;const T=k==="left"?l:s,D=t[k==="left"?"prevArrow":"nextArrow"];return i.createVNode("button",{class:A(k),style:k==="left"?(S=e.styles)==null?void 0:S.arrowLeft:(X=e.styles)==null?void 0:X.arrowRight,onClick:T,"aria-label":`${k} arrow`},[D?D():i.createVNode("i",{style:"font-size: 60px;",class:`fx-icon fx-icon-arrow-${k==="left"?"left":"right"}`},null)])},g=()=>{var k;return o.value||!e.showIndicator?null:i.createVNode("div",{class:y.value,style:(k=e.styles)==null?void 0:k.indicator},[e.items.map((T,D)=>{var S,X;return i.createVNode("button",{"aria-label":`indicator ${D}`,key:D,class:["fx-carousel--indicator-item",{"fx-carousel--indicator-item-active":D===r.value}],style:D===r.value?(S=e.styles)==null?void 0:S.indicatorItemActive:(X=e.styles)==null?void 0:X.indicatorItem,onClick:()=>{a(D),c(D)}},null)})])},x=()=>i.createVNode("div",{class:w.value,style:u.value},[e.items.map((k,T)=>i.createVNode(lu,{key:k.id||`item_${T}`,item:k,showInfo:e.showInfo,index:T,active:T===r.value,styles:e.styles,classNames:e.classNames,onClick:(D,S,X)=>{n("item-click",D,S,X)}},{default:()=>{var D,S;return[(D=t.item)==null?void 0:D.call(t,{item:k,index:T,active:T===r.value}),(S=t[`item${T}`])==null?void 0:S.call(t,{item:k,index:T,active:T===r.value})]}}))]);return()=>{var k;return i.createVNode("div",{class:h.value,style:m.value,onMouseenter:d,onMouseleave:f},[e.buttonPosition==="outer"&&b("left"),i.createVNode("div",{class:p.value,style:(k=e.styles)==null?void 0:k.container},[e.buttonPosition==="inner"&&b("left"),x(),e.buttonPosition==="inner"&&b("right")]),e.buttonPosition==="outer"&&b("right"),g()])}}});ir.install=e=>{e.component(ir.name,ir),e.component(lu.name,lu)};const cs={customStyle:{type:String,default:""},customClass:{type:String,default:""},direction:{Type:String,default:"row"}};function Yh(e){const t=i.ref(-1),n=i.ref(-1),r=i.ref(0),o=i.ref(0),u=i.ref(!1),a=i.ref(!1),s=i.computed(()=>({display:u.value?"block":"none",left:`${r.value}px`,cursor:"e-resize"})),l=i.computed(()=>({display:a.value?"block":"none",top:`${o.value}px`,cursor:"n-resize"})),d=i.computed(()=>{const y={display:a.value||u.value?"block":"none"};return o.value>0&&(y.cursor="n-resize"),y});function f(y,A,b,g){const x=e.value;if(x){const{left:k,right:T,width:D}=x.getBoundingClientRect();let S=y.clientX-k;g==="right"&&(S=T-y.clientX),S>A&&(S=A),S<b&&(S=b),g==="right"&&(S=D-S),r.value=S}}function c(y,A,b,g){const x=e.value;if(x){const{top:k,bottom:T,height:D}=x.getBoundingClientRect();let S=y.clientY-k;g==="bottom"&&(S=T-y.clientY),S>A&&(S=A),S<b&&(S=b),g==="bottom"&&(S=D-S),o.value=S}}function h(){const y=e.value;if(y){const{width:A,height:b}=y.getBoundingClientRect();return{width:A,height:b}}return null}function m(){const y=e.value;return y?Array.from(y.querySelectorAll("[data-position]")).reduce((A,b)=>{const g=b.getAttribute("data-position");return A=Object.assign(A,{[g]:b}),A},{}):null}function p(y,A){const b=h(),g=m();if(b&&g){const x=g==null?void 0:g.right,k=g==null?void 0:g.left;if(y==="left"&&k)return x?b.width-x.clientWidth-A:b.width-A;if(y==="right"&&x)return k?b.width-k.clientWidth-A:b.width-A}}function w(y,A){const b=h(),g=m();if(b&&g){const x=g==null?void 0:g.bottom,k=g==null?void 0:g.top;if(y==="top"&&k)return x?b.height-x.clientHeight-A:b.height-A;if(y==="bottom"&&x)return k?b.height-k.clientHeight-A:b.height-A}}return{horizontalResizeHandleStyle:s,verticalResizeHandleStyle:l,resizeOverlayStyle:d,showHorizontalResizeHandle:u,showVerticalResizeHandle:a,horizontalResizeBarPosition:t,verticalResizeBarPosition:n,verticalResizeHandleOffset:o,horizontalResizeHandleOffset:r,draggingHorizontalResizeHandle:f,draggingVerticalResizeHandle:c,getPanelMaxWidth:p,getPanelMaxHeight:w}}const An=i.defineComponent({name:"FXSplitter",props:cs,emits:[],setup(e,t){const n=i.ref(),r=Yh(n),{horizontalResizeHandleStyle:o,verticalResizeHandleStyle:u,resizeOverlayStyle:a}=r;i.provide("splitter",{useResizeHandleComposition:r});const s=i.computed(()=>ye({"f-splitter":!0},e==null?void 0:e.customClass)),l=i.computed(()=>{const d={"flex-direction":e.direction==="row"?"row":"column"};return Ae(d,e==null?void 0:e.customStyle)});return()=>i.createVNode("div",{class:s.value,ref:n,style:l.value},[t.slots.default&&t.slots.default(),i.createVNode("div",{class:"f-splitter-resize-overlay",style:a.value},null),i.createVNode("div",{class:"f-splitter-horizontal-resize-proxy",style:o.value},null),i.createVNode("div",{class:"f-splitter-vertical-resize-proxy",style:u.value},null)])}}),Kh={customClass:{type:String,defaut:""},customStyle:{type:String,default:""},width:{type:Number},height:{type:Number},position:{type:String,default:"left"},visible:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},resizeHandle:{type:String,default:""},collapsable:{type:Boolean,default:!1},minWidth:{type:Number,default:100},minHeight:{type:Number,default:100},maxWidth:{type:Number,default:0},maxHeight:{type:Number,default:0}};function Qh(e,t){const n=i.ref(e.width),r=i.ref(e.height),{horizontalResizeBarPosition:o,horizontalResizeHandleOffset:u,showHorizontalResizeHandle:a,showVerticalResizeHandle:s,verticalResizeBarPosition:l,verticalResizeHandleOffset:d,draggingHorizontalResizeHandle:f,draggingVerticalResizeHandle:c,getPanelMaxWidth:h,getPanelMaxHeight:m}=t;let p="",w,y,A;const b=()=>e.maxWidth?e.maxWidth:h(p,e.minWidth)||0,g=()=>e.maxHeight?e.maxHeight:m(p,e.minHeight)||0;function x(D){if((p==="left"||p==="right")&&y){const{left:S}=y.getBoundingClientRect(),{width:X}=w.getBoundingClientRect(),z=D.clientX-S;let B=p==="left"?(X||0)+(z-o.value):(X||0)-(z-o.value);B=e.minWidth>0?Math.max(e.minWidth,B):B;const j=b();j!=null&&j>0&&(B=j>B?B:j),n.value=B}if((p==="top"||p==="bottom")&&y){const{top:S}=y.getBoundingClientRect(),{height:X}=w.getBoundingClientRect(),z=D.clientY-S;let B=p==="top"?(X||0)+(z-l.value):(X||0)-(z-l.value);B=e.minHeight>0?Math.max(e.minHeight,B):B;const j=g();j!=null&&j>0&&(B=j>B?B:j),r.value=B}u.value=0,d.value=0,o.value=-1,l.value=-1,a.value=!1,s.value=!1,document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",x),document.body.style.userSelect="",p="",w=null,y=null}function k(D,S,X){if(p=S,w=X,a.value=!0,y=D.composedPath().find(B=>B.className.split(" ")[0]==="f-splitter"),y){const{left:B}=y.getBoundingClientRect();u.value=D.clientX-B,o.value=D.clientX-B;const j=b();A=I=>f(I,j,e.minWidth,p),document.addEventListener("mousemove",A),document.addEventListener("mouseup",x),document.body.style.userSelect="none"}}function T(D,S,X){if(p=S,w=X,s.value=!0,y=D.composedPath().find(B=>B.className.split(" ")[0]==="f-splitter"),y){const{top:B}=y.getBoundingClientRect();d.value=D.clientY-B,l.value=D.clientY-B;const j=g();A=I=>c(I,j,e.minHeight,p),document.addEventListener("mousemove",A),document.addEventListener("mouseup",x),document.body.style.userSelect="none"}}return{actualWidth:n,actualHeight:r,onClickSplitterHorizontalResizeBar:k,onClickSplitterVerticalResizeBar:T}}const ar=i.defineComponent({name:"FSplitterPane",props:Kh,emits:[],setup(e,t){const n=i.ref(),r=i.inject("splitter"),{useResizeHandleComposition:o}=r,u=Qh(e,o),{actualHeight:a,actualWidth:s,onClickSplitterHorizontalResizeBar:l,onClickSplitterVerticalResizeBar:d}=u,f=i.ref(e.position),c=i.computed(()=>{const g={"f-splitter-pane":!0,"f-splitter-pane-main":f.value==="center","has-resize-bar":e.resizable};return g["f-splitter-pane-"+f.value]=!0,ye(g,e==null?void 0:e.customClass)}),h=i.computed(()=>e.resizeHandle?e.resizeHandle.split(",").filter(g=>["e","n","s","w"].find(x=>x===g)):[]),m=i.computed(()=>{const g={};return(s.value||s.value===0)&&(f.value==="left"||f.value==="right"||h.value.find(x=>x==="e")||h.value.find(x=>x==="w"))&&(g.width=`${s.value}px`),(a.value||a.value===0)&&(f.value==="bottom"||f.value==="top"||h.value.find(x=>x==="s")||h.value.find(x=>x==="n"))&&(g.height=`${a.value}px`),e.visible||(g.display="none"),Ae(g,e==null?void 0:e.customStyle)}),p=i.computed(()=>({"f-splitter-resize-bar":!0,"f-splitter-resize-bar-e":f.value==="left","f-splitter-resize-bar-n":f.value==="bottom","f-splitter-resize-bar-s":f.value==="top","f-splitter-resize-bar-w":f.value==="right"}));function w(g){return{e:"left",w:"right",s:"top",n:"bottom"}[g]||g}function y(g,x){x=w(x),["left","right"].find(k=>k===x)&&l(g,x,n.value),["top","bottom"].find(k=>k===x)&&d(g,x,n.value)}function A(){return h.value.length>0?h.value.map(g=>i.createVNode("span",{class:"f-splitter-resize-bar f-splitter-resize-bar-"+g,onMousedown:x=>y(x,g)},null)):i.createVNode("span",{class:p.value,onMousedown:g=>y(g,f.value)},null)}function b(){s.value=e.width,a.value=e.height,m.value}return t.expose({reset:b}),()=>i.createVNode("div",{ref:n,class:c.value,style:m.value,"data-position":f.value},[t.slots.default&&t.slots.default(),e.resizable&&A()])}});An.install=e=>{e.component(An.name,An),e.component(ar.name,ar)};const ds={previewConfig:{type:Object,default:()=>({})},onClose:{type:Function,default:()=>{}},onIframeLoad:{type:Function,default:()=>{}}},fs={content:{type:String,default:null}},Jh=e=>{const t=typeof e;return t!=="function"&&t!=="object"||e===null},ep=e=>{const t=e.flags===""?void 0:e.flags;return new RegExp(e.source,t)},sr=(e,t=new WeakMap)=>{if(e===null||Jh(e))return e;if(t.has(e))return t.get(e);if(e instanceof RegExp)return ep(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Function)return e;if(e instanceof Map){const r=new Map;return t.set(e,r),e.forEach((o,u)=>{r.set(u,sr(o,t))}),r}if(e instanceof Set){const r=new Set;t.set(e,r);for(const o of e)r.add(sr(o,t));return r}if(Array.isArray(e)){const r=[];return t.set(e,r),e.forEach(o=>{r.push(sr(o,t))}),r}const n={};t.set(e,n);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=sr(e[r],t));return n},tp=(e,t=200)=>{let n=0;return(...r)=>new Promise(o=>{n&&(clearTimeout(n),o("cancel")),n=window.setTimeout(()=>{e.apply(void 0,r),n=0,o("done")},t)})},No=()=>`${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`,cu=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),np=new Set(["__proto__","constructor","prototype"]),rp=e=>!np.has(e),Io=(e,t,n={})=>{if(Array.isArray(e)&&Array.isArray(t))return Oo(e,t,n);const{excludeKeys:r}=n,o=e,u=t;for(const a of Object.keys(u)){if(!rp(a))continue;const s=u[a],l=o[a];r&&r(a)?o[a]=s:Array.isArray(s)&&Array.isArray(l)?o[a]=Oo(l,s,n):cu(s)&&cu(l)?o[a]=Io(l,s,n):o[a]=s}return e},Oo=(e,t,n)=>{const r=e.slice();return t.forEach((o,u)=>{const a=r[u];Array.isArray(o)&&Array.isArray(a)?r[u]=Oo(a,o,n):cu(o)&&cu(a)?r[u]=Io(a,o,n):r[u]=o}),r},Y="md-editor",de="https://unpkg.com",up=`${de}/@highlightjs/cdn-assets@11.11.1/highlight.min.js`,hs={main:`${de}/prettier@3.8.1/standalone.js`,markdown:`${de}/prettier@3.8.1/plugins/markdown.js`},op={css:`${de}/cropperjs@1.6.2/dist/cropper.min.css`,js:`${de}/cropperjs@1.6.2/dist/cropper.min.js`},ip=`${de}/screenfull@5.2.0/dist/screenfull.js`,ap=`${de}/mermaid@11.12.3/dist/mermaid.min.js`,sp={js:`${de}/katex@0.16.33/dist/katex.min.js`,css:`${de}/katex@0.16.33/dist/katex.min.css`},Lo={a11y:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/a11y-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/a11y-dark.min.css`},atom:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/atom-one-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/atom-one-dark.min.css`},github:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/github.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/github-dark.min.css`},gradient:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/gradient-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/gradient-dark.min.css`},kimbie:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/kimbie-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/kimbie-dark.min.css`},paraiso:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/paraiso-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/paraiso-dark.min.css`},qtcreator:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/qtcreator-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/qtcreator-dark.min.css`},stackoverflow:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-dark.min.css`}},lp=`${de}/echarts@6.0.0/dist/echarts.min.js`,ps={"zh-CN":{toolbarTips:{bold:"加粗",underline:"下划线",italic:"斜体",strikeThrough:"删除线",title:"标题",sub:"下标",sup:"上标",quote:"引用",unorderedList:"无序列表",orderedList:"有序列表",task:"任务列表",codeRow:"行内代码",code:"块级代码",link:"链接",image:"图片",table:"表格",mermaid:"mermaid图",katex:"katex公式",revoke:"后退",next:"前进",save:"保存",prettier:"美化",pageFullscreen:"浏览器全屏",fullscreen:"屏幕全屏",preview:"预览",previewOnly:"仅预览",htmlPreview:"html代码预览",catalog:"目录",github:"源码地址"},titleItem:{h1:"一级标题",h2:"二级标题",h3:"三级标题",h4:"四级标题",h5:"五级标题",h6:"六级标题"},imgTitleItem:{link:"添加链接",upload:"上传图片",clip2upload:"裁剪上传"},linkModalTips:{linkTitle:"添加链接",imageTitle:"添加图片",descLabel:"链接描述:",descLabelPlaceHolder:"请输入描述...",urlLabel:"链接地址:",urlLabelPlaceHolder:"请输入链接...",buttonOK:"确定"},clipModalTips:{title:"裁剪图片上传",buttonUpload:"上传"},copyCode:{text:"复制代码",successTips:"已复制!",failTips:"复制失败!"},mermaid:{flow:"流程图",sequence:"时序图",gantt:"甘特图",class:"类图",state:"状态图",pie:"饼图",relationship:"关系图",journey:"旅程图"},katex:{inline:"行内公式",block:"块级公式"},footer:{markdownTotal:"字数",scrollAuto:"同步滚动"}},"en-US":{toolbarTips:{bold:"bold",underline:"underline",italic:"italic",strikeThrough:"strikeThrough",title:"title",sub:"subscript",sup:"superscript",quote:"quote",unorderedList:"unordered list",orderedList:"ordered list",task:"task list",codeRow:"inline code",code:"block-level code",link:"link",image:"image",table:"table",mermaid:"mermaid",katex:"formula",revoke:"revoke",next:"undo revoke",save:"save",prettier:"prettier",pageFullscreen:"fullscreen in page",fullscreen:"fullscreen",preview:"preview",previewOnly:"preview only",htmlPreview:"html preview",catalog:"catalog",github:"source code"},titleItem:{h1:"Lv1 Heading",h2:"Lv2 Heading",h3:"Lv3 Heading",h4:"Lv4 Heading",h5:"Lv5 Heading",h6:"Lv6 Heading"},imgTitleItem:{link:"Add Image Link",upload:"Upload Images",clip2upload:"Crop And Upload"},linkModalTips:{linkTitle:"Add Link",imageTitle:"Add Image",descLabel:"Desc:",descLabelPlaceHolder:"Enter a description...",urlLabel:"Link:",urlLabelPlaceHolder:"Enter a link...",buttonOK:"OK"},clipModalTips:{title:"Crop Image",buttonUpload:"Upload"},copyCode:{text:"Copy",successTips:"Copied!",failTips:"Copy failed!"},mermaid:{flow:"flow",sequence:"sequence",gantt:"gantt",class:"class",state:"state",pie:"pie",relationship:"relationship",journey:"journey"},katex:{inline:"inline",block:"block"},footer:{markdownTotal:"Character Count",scrollAuto:"Scroll Auto"}}},lt={editorExtensions:{highlight:{js:up,css:Lo},prettier:{standaloneJs:hs.main,parserMarkdownJs:hs.markdown},cropper:{...op},screenfull:{js:ip},mermaid:{js:ap,enableZoom:!0},katex:{...sp},echarts:{js:lp}},editorExtensionsAttrs:{},editorConfig:{languageUserDefined:{},mermaidTemplate:{},renderDelay:500,zIndex:2e4},codeMirrorExtensions:e=>e,markdownItConfig:()=>{},markdownItPlugins:e=>e,mermaidConfig:e=>e,katexConfig:e=>e,echartsConfig:e=>e},cp=({instance:e,ctx:t,props:n={}},r="default")=>{const o=(e==null?void 0:e.$slots[r])||(t==null?void 0:t.slots[r]);return(o?o(e):"")||n[r]},dp="buildFinished",Vo="errorCatcher",Po="catalogChanged",fp="pushCatalog",ms="rerender",hp="taskStateChanged";class pp{constructor(){fe(this,"pools",{})}remove(t,n,r){const o=this.pools[t]&&this.pools[t][n];o&&(this.pools[t][n]=o.filter(u=>u!==r))}clear(t){this.pools[t]={}}on(t,n){return this.pools[t]||(this.pools[t]={}),this.pools[t][n.name]||(this.pools[t][n.name]=[]),this.pools[t][n.name].push(n.callback),this.pools[t][n.name].includes(n.callback)}emit(t,n,...r){this.pools[t]||(this.pools[t]={});const o=this.pools[t][n];o&&o.forEach(u=>{try{u(...r)}catch(a){console.error(`${n} monitor event exception!`,a)}})}}const ot=new pp,mp=(e,t)=>{if(!e)return e;const n=t.split(`
32
+ `;return Co("caf-assistant-widget-container__error",b)}),m=()=>{const b=a.value;b&&(s.value=new wh(b))},p=()=>{const b=s.value;b&&(b.dispose(),s.value=null)},w=()=>{const b=u.value,g=o.value;b&&(b.unmount(),b.dispose()),g&&g.cleanup(),u.value=null,o.value=null},y=async()=>{const b=await n(e.widgetAPIURL);if(!b)throw new Error("Failed to load widget API");await b.initialize();const g=b.createWidget();o.value=b,u.value=g},A=b=>{console.error(b),l.value=b};return i.watch(()=>e.widgetAPIURL,async()=>{if(a.value)try{w(),await y();const b=a.value,g=u.value;g==null||g.updateOptions(e.widgetOptions),g==null||g.updateData(e.widgetData),b&&g&&await g.mount(b)}catch(b){A(b)}}),i.watch(()=>e.widgetOptions,(b,g)=>{try{const x=u.value;x&&(!g||!r(g,b))&&x.updateOptions(b)}catch(x){A(x)}}),i.watch(()=>e.widgetData,(b,g)=>{try{const x=u.value;x&&(!g||!r(g,b))&&x.updateData(b)}catch(x){A(x)}}),i.onMounted(async()=>{try{const b=a.value;if(b){m();const g=s.value;if(g){await y();const x=u.value;x&&(x.updateOptions(e.widgetOptions),x.updateData(e.widgetData),x.mount(g.getElement()),i.nextTick(()=>{b.parentElement&&(b.style.width="100%")}))}}}catch(b){A(b)}}),i.onBeforeUnmount(async()=>{try{w(),p()}catch(b){console.error(b)}}),()=>i.createVNode("div",{class:d.value},[i.createVNode("div",{ref:a,class:c},null),i.createVNode("div",{class:h.value},null)])}}),Ga=(e,t)=>{var n;if(e.type===Le.AssistantWidgetComplete){const r=e;return r.widgetUrl?i.createVNode(yn,{key:`widget-${t}`,widgetAPIURL:r.widgetUrl,widgetOptions:{mode:"embedded",implOptions:r.widgetImplOptions},widgetData:((n=r.widgetData)==null?void 0:n.data)||{}},null):null}return e.type===Le.AssistantWidgetPending?i.createVNode("div",{class:"f-chat-bubble-widget-pending",key:`widget-loading-${t}`},[i.createVNode("span",{class:"f-chat-todo-status-icon f-chat-todo-status-working"},null),i.createVNode("span",{class:"f-chat-bubble-widget-pending-text"},[i.createTextVNode("数据生成中......")])]):null},Ch=3e4,Xa=8e3,Ie=new Map,Qe=new Map,nr=new Map,Et=[];function Pe(e){return String(e??"").replace(/^\ufeff/,"").replace(/[\u200b\u200c\u200d]/g,"").replace(/\u00a0/g," ").trim()}function uu(e){const t=Pe(e);if(t)for(let n=Et.length-1;n>=0;n--)Et[n]===t&&Et.splice(n,1)}function _h(e){typeof window>"u"||(window.__fluens_dynamic_component_bootstrap_instance_id=e)}function ou(e){if(typeof window>"u")return;const t=window;t.__fluens_dynamic_component_bootstrap_instance_id===e&&delete t.__fluens_dynamic_component_bootstrap_instance_id}function Eh(){return Et[Et.length-1]||void 0}function iu(e,t){const n=Pe(t);return n?Pe(e.instanceId)===n||e.componentId!=null&&Pe(String(e.componentId))===n||e.name!=null&&Pe(String(e.name))===n:!1}function Eo(e){const t=Pe(e);if(!t)return null;const n=Ie.get(t);if(n)return{canonicalKey:t,entry:n};for(const[o,u]of Ie.entries())if(Pe(o)===t)return{canonicalKey:o,entry:u};const r=[];for(const[o,u]of Ie.entries())iu(u.config,t)&&r.push({key:o,entry:u});if(r.length===1){const{key:o,entry:u}=r[0];return o!==t&&console.warn(`[DynamicComponent] register id "${t}" resolved to pending instanceId "${o}" (alias match)`),{canonicalKey:o,entry:u}}if(r.length>1)return console.warn(`[DynamicComponent] register id "${t}" is ambiguous (${r.length} pending matches); refusing`),null;if(Ie.size===1){const[o,u]=[...Ie.entries()][0];return console.warn(`[DynamicComponent] register id "${t}" unmatched; using sole pending instance "${o}"`),{canonicalKey:o,entry:u}}return null}function qa(e,t){for(const[n,r]of Qe){const o=Pe(n),u=e!==""&&o===e,a=String(t??"").trim(),s=e&&iu(r.config,e)||a&&iu(r.config,a);if(u||s)return console.warn(`[DynamicComponent] register skipped: id "${e||a}" already active (canonical "${n}"); unload first — second register yields "no pending", not duplicate mount`),!0}return!1}function So(){return{pendingKeys:[...Ie.keys()],bootstrapQueue:[...Et],activeKeys:[...Qe.keys()],...typeof window<"u"?{windowBootstrapPeek:window.__fluens_dynamic_component_bootstrap_instance_id}:{}}}function Sh(e){console.warn("[DynamicComponent] register diagnostics",{claimedNormalized:e,...So()})}function Dh(e){const t=Pe(e);if(t){if(qa(t,e))return{ok:!1,reason:"already_active_duplicate"};const r=Eo(t);if(r)return{ok:!0,...r}}else if(qa("",e))return{ok:!1,reason:"already_active_duplicate"};for(let n=0;n<Et.length;n++){const r=Et[n],o=Eo(r);if(o)return Et.splice(n,1),t&&Pe(r)!==t&&console.warn(`[DynamicComponent] register id "${t}" did not match pending; using bootstrap instanceId "${r}" (sync bundle entry or use window.__fluens_dynamic_component_bootstrap_instance_id)`),{ok:!0,...o}}return{ok:!1,reason:"no_pending"}}function Za(e){const t=Pe(e);if(!t)return null;const n=Qe.get(t);if(n)return n;for(const[u,a]of Qe.entries())if(Pe(u)===t)return a;const r=[];for(const u of Qe.values())iu(u.config,t)&&r.push(u);const o=[...new Map(r.map(u=>[u.config.instanceId,u])).values()];if(o.length===1)return o[0].config.instanceId!==t&&console.warn(`[DynamicComponent] assistant post id "${t}" resolved to instanceId "${o[0].config.instanceId}" (alias match)`),o[0];if(o.length>1)return console.warn(`[DynamicComponent] assistant post id "${t}" is ambiguous (${o.length} active matches)`),null;if(Qe.size===1){const u=[...Qe.values()][0];return console.warn(`[DynamicComponent] assistant post id "${t}" unmatched; delivering to sole active instance "${u.config.instanceId}"`),u}return null}function Fh(e){const t=Pe(e);if(!t)return t;const n=Za(t);if(n)return n.config.instanceId;const r=Eo(t);return r?r.canonicalKey:Ie.size===1?[...Ie.keys()][0]:Qe.size===1?[...Qe.values()][0].config.instanceId:t}function Do(e){try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}}function Ya(e,t){if(typeof e.onAssistantMessage!="function")return!0;try{return e.onAssistantMessage(Do(t)),!0}catch(n){return console.warn("[DynamicComponent] onAssistantMessage failed",n),!1}}function Th(e){const t=`fluens-dynamic-component-${e.instanceId}`;let n=document.getElementById(t);return n||(n=document.createElement("div"),n.id=t,n.style.width="100%",n.style.height="100%"),n}function Ka(e){const t=Qe.get(e.instanceId);if(t)return Promise.resolve(t.api);const n=Ie.get(e.instanceId);if(n)return new Promise((o,u)=>{const a=n.resolve,s=n.reject;n.resolve=l=>{a(l),o(l)},n.reject=l=>{s(l),u(l)}});if((e.name||e.componentId)&&!e.jsUrl)return Promise.reject(new Error(`Dynamic component resource is empty: ${e.name||e.componentId}`));const r=Th(e);return new Promise((o,u)=>{const a={config:e,container:r,resolve:o,reject:u,timeoutId:0},s=setTimeout(()=>{a.postLoadRegisterCheckTimerId!=null&&(clearTimeout(a.postLoadRegisterCheckTimerId),a.postLoadRegisterCheckTimerId=void 0),Ie.delete(e.instanceId),uu(e.instanceId),ou(e.instanceId),u(new Error(`Dynamic component script load timeout: ${e.name||e.componentId}`))},Ch);a.timeoutId=s,Ie.set(e.instanceId,a),Et.push(e.instanceId),_h(e.instanceId);const l=document.createElement("script");l.src=(e==null?void 0:e.jsUrl)??"",l.dataset.dynamicComponentId=e.instanceId,l.async=!1,l.onload=()=>{a.postLoadRegisterCheckTimerId=window.setTimeout(()=>{a.postLoadRegisterCheckTimerId=void 0,Ie.has(e.instanceId)&&(clearTimeout(s),Ie.delete(e.instanceId),uu(e.instanceId),ou(e.instanceId),u(new Error(`Dynamic component did not call __fluens_dynamic_component_register within ${Xa}ms after load: ${e.name||e.componentId}`)))},Xa)},l.onerror=()=>{clearTimeout(s),a.postLoadRegisterCheckTimerId!=null&&(clearTimeout(a.postLoadRegisterCheckTimerId),a.postLoadRegisterCheckTimerId=void 0),Ie.delete(e.instanceId),uu(e.instanceId),ou(e.instanceId),u(new Error(`Failed to load dynamic component: ${e.name||e.componentId}`))},document.head.appendChild(l)})}function Qa(e){var o;const t=Qe.get(e);if(t){try{t.api.unmount()}catch{}(o=t.scriptElement)==null||o.remove(),Qe.delete(e)}const n=Ie.get(e);n&&(n.postLoadRegisterCheckTimerId!=null&&(clearTimeout(n.postLoadRegisterCheckTimerId),n.postLoadRegisterCheckTimerId=void 0),clearTimeout(n.timeoutId),Ie.delete(e)),nr.delete(e);const r=document.getElementById(`fluens-dynamic-component-${e}`);r&&r.remove()}function Nh(e,t){const n=Pe(e);if(!n)return!1;const r=Za(n);if(r)return Ya(r.api,t);const o=Fh(n),u=nr.get(o)??[],a=u.findIndex(s=>s.messageId===t.messageId);return a>=0?u[a]=Do(t):u.push(Do(t)),nr.set(o,u),!1}typeof window<"u"&&(window.__fluens_get_dynamic_component_registry_debug_snapshot=So,window.__fluens_dynamic_component_register=function(e,t){const n=Pe(e),r=Dh(e);if(!r.ok){if(r.reason==="already_active_duplicate")return;Sh(n),console.warn(`[DynamicComponent] no pending for register id "${n}" (raw ${JSON.stringify(e)}); see diagnostics above. Try: unload tab / avoid double register / ensure FXDynamicComponent loaded this jsUrl first / empty id if sole pending`);return}const{canonicalKey:o,entry:u}=r;uu(o),ou(o),u.postLoadRegisterCheckTimerId!=null&&(clearTimeout(u.postLoadRegisterCheckTimerId),u.postLoadRegisterCheckTimerId=void 0),clearTimeout(u.timeoutId),Ie.delete(o);const a={config:u.config,container:u.container,api:t,scriptElement:document.currentScript};Qe.set(o,a),a.container.parentElement;try{t.mount(u.container,u.config)}catch(l){console.error(`Failed to mount dynamic component: ${o}`,l)}const s=[o];n&&n!==o&&s.push(n);for(const l of s){const d=nr.get(l);d&&d.length>0&&(nr.delete(l),d.forEach(f=>Ya(t,f)))}u.resolve(t)});const xn=i.defineComponent({name:"FXDynamicComponent",props:{config:{type:Object,required:!0}},setup(e){const t=i.ref("loading"),n=i.ref(""),r=i.computed(()=>`fluens-dynamic-component-${e.config.instanceId}`),o=i.computed(()=>e.config.position==="inline"),u=i.computed(()=>!e.config.jsUrl&&!!e.config.url),a=i.computed(()=>({...o.value?{width:"fit-content",maxWidth:"100%"}:{width:"100%"},height:"auto",...t.value==="ready"&&o.value?{padding:"16px 0"}:{},...t.value==="ready"&&!o.value?{height:"100%",overflow:"hidden"}:{}}));return i.onMounted(()=>{u.value||(t.value="loading",n.value="",Ka(e.config).then(()=>{t.value="ready"}).catch(s=>{t.value="error",n.value=s.message||"Unknown error"}))}),i.onUnmounted(()=>{u.value||Qa(e.config.instanceId)}),()=>u.value?null:i.createVNode("div",{class:"f-chat-dynamic-component-body",style:a.value},[i.createVNode("div",{id:r.value,style:{width:"100%",height:"100%",display:t.value==="ready"?"":"none"}},null),t.value==="loading"&&i.createVNode("div",{class:"f-chat-dynamic-component-loading"},[i.createVNode("span",{class:"f-chat-dynamic-component-loading-spinner"},null),i.createVNode("span",null,[i.createTextVNode("加载中......")])]),t.value==="error"&&i.createVNode("div",{class:"f-chat-dynamic-component-error"},[i.createVNode("span",{class:"f-chat-dynamic-component-error-icon"},[i.createTextVNode("!")]),i.createVNode("span",null,[n.value])])])}}),Ja=(e,t,n)=>{if(e.type===Le.DynamicComponentComplete){const r=e;if(!r.config)return null;if(r.config.position==="inline")return i.createVNode(xn,{key:`dc-${t}`,config:r.config},null);const o={type:"file",fileContent:{type:"md",name:r.config.title}},u={onPreviewFile:a=>{n.emit("showDynamicComponent",r.config)}};return i.nextTick(()=>n.emit("dynamicComponentsDetected",[r.config])),i.createVNode("div",{style:{padding:"16px 0"}},[n.renderFileEmbeddedContent(o,u)])}return e.type===Le.DynamicComponentPending?i.createVNode("div",{class:"f-chat-bubble-widget-pending",key:`dc-loading-${t}`},[i.createVNode("span",{class:"f-chat-todo-status-icon f-chat-todo-status-working"},null),i.createVNode("span",{class:"f-chat-bubble-widget-pending-text"},[i.createTextVNode("组件加载中......")])]):null};function Ih(){return{[Le.Text]:Tf,[Le.AssistantWidgetComplete]:Ga,[Le.AssistantWidgetPending]:Ga,[Le.DynamicComponentComplete]:Ja,[Le.DynamicComponentPending]:Ja}}const Oh=i.defineComponent({name:"FXBubbleTextContent",props:fc,emits:["dynamicComponentsDetected","showDynamicComponent"],setup(e,t){const{renderFileEmbeddedContent:n}=Ai(),{propertyStates:r,registerProperty:o,updatePropertyValue:u,startStreaming:a}=Vr();o("title",e.title??""),o("subtitle",e.subtitle??""),o("text",e.text??""),i.watch([()=>e.title,()=>e.subtitle,()=>e.text],([p,w,y])=>{u("title",p??""),u("subtitle",w??""),u("text",y??"")});const s=i.computed(()=>e.textFormat==="markdown"),l=i.ref(!1),d=i.computed(()=>{var p,w,y;return l.value?{title:((p=r.title)==null?void 0:p.displayedValue)??"",subtitle:((w=r.subtitle)==null?void 0:w.displayedValue)??"",text:((y=r.text)==null?void 0:y.displayedValue)??""}:{title:e.title,subtitle:e.subtitle,text:e.text}}),f=i.computed(()=>Dc(d.value.text)),c={shouldShowMarkdown:s,emit:t.emit,renderFileEmbeddedContent:n},h=Ih(),m=()=>f.value.length===0?null:i.createVNode("div",{class:"f-chat-bubble-text-collection"},[f.value.map((p,w)=>{var y;return(y=h[p.type])==null?void 0:y.call(h,p,w,c)})]);return i.onMounted(()=>{l.value&&a()}),()=>i.createVNode(i.Fragment,null,[d.value.title&&i.createVNode("div",{class:"f-chat-bubble-content-title"},[d.value.title]),d.value.subtitle&&i.createVNode("div",{class:"f-chat-bubble-content-subtitle"},[d.value.subtitle]),m()])}}),Lh={content:{type:Object},outputMode:{type:String,default:"full"}};function wn({status:e,variant:t=""}){let n="";return t?n=`f-chat-todo-status-icon f-chat-todo-status-${e.toLowerCase()} variant--${t.toLowerCase()} `:n=`f-chat-todo-status-icon f-chat-todo-status-${e.toLowerCase()}`,i.createVNode("span",{class:n,"aria-hidden":!0},null)}const Vh=i.defineComponent({name:"FXBubbleThink",props:Lh,setup(e,t){var X;const{propertyStates:n,registerProperty:r,updatePropertyValue:o,isAllDone:u}=Vr(),{elapsedSeconds:a,hasEverStarted:s,start:l,stop:d,reset:f}=Hu(),c=i.ref(((X=e.content)==null?void 0:X.completed)!==!0),h=i.ref(null),m=i.ref(null),p=i.ref(!1),w=i.ref(!1),y=i.computed(()=>e.outputMode==="streaming"),A=i.computed(()=>{var z;return(z=e.content)==null?void 0:z.completed}),b=i.computed(()=>{var _,C,N;const z=(_=g.value)==null?void 0:_.trim(),B=z?z.slice(0,8):"",j=z&&z.length>8?"…":"",I=B?`<span class="f-chat-bubble-thinking-preview">${B}${j}</span>`:"";if(A.value){const F=s.value?`(用时${a.value}秒)`:"";return(((C=e.content)==null?void 0:C.title)??"思考完成"+F)+I}return(((N=e.content)==null?void 0:N.title)??"正在思考......")+I}),g=i.computed(()=>{var z,B;return y.value?((z=n.content)==null?void 0:z.displayedValue)??"":((B=e.content)==null?void 0:B.content)??""}),x=i.computed(()=>({"f-chat-bubble-thinking":!0,"is-pending":!A.value,"is-completed":A.value})),k=()=>{const z=h.value;if(!z||!p.value){w.value=!1;return}w.value=z.scrollTop>0};i.watch(()=>A.value,z=>{z?d():l()},{immediate:!0}),i.watch(()=>A.value,z=>{z&&(c.value=!1)}),i.watch(()=>e.content,z=>{z&&(n.content?o("content",z.content??""):r("content",z.content??""))},{immediate:!0}),i.watch(g,async()=>{if(c.value){await i.nextTick();const z=h.value;if(!z)return;await i.nextTick(),p.value=z.scrollHeight>z.clientHeight,p.value?(z.scrollTop=z.scrollHeight,w.value=!0):w.value=!1}},{immediate:!0}),i.watch(c,async z=>{if(z){await i.nextTick();const B=h.value;if(!B)return;await i.nextTick(),p.value=B.scrollHeight>B.clientHeight,p.value?(B.scrollTop=B.scrollHeight,w.value=!0):w.value=!1}}),i.onUnmounted(()=>{f()}),t.expose({instance:{get loadDone(){return e.content?(y.value?u.value:!0)&&A.value:!0}}});const T=()=>{c.value=!c.value},D=()=>A.value?null:i.createVNode(wn,{status:"Working",variant:"thinking"},null),S=()=>!g.value||!c.value?null:i.createVNode("div",{class:"f-chat-bubble-thinking-content"},[i.createVNode("div",{class:"f-chat-bubble-thinking-scroll-container",ref:h,onScroll:k},[p.value&&w.value&&i.createVNode("div",{class:"f-chat-bubble-thinking-fade-mask"},null),i.createVNode("div",{class:"f-chat-bubble-thinking-text-wrapper"},[i.createVNode("div",{ref:m,class:"f-chat-bubble-thinking-content-text",innerHTML:g.value},null)])])]);return()=>i.createVNode("div",{class:x.value},[i.createVNode("div",{class:"f-chat-bubble-thinking-header",onClick:T},[D(),i.createVNode("span",{class:"f-chat-bubble-thinking-title",innerHTML:b.value},null),g.value&&i.createVNode("i",{class:"fx-icon fx-icon-foldup",style:{transform:c.value?"rotate(0deg)":"rotate(180deg)",transition:"all 0.3s ease-in-out"}},null)]),S()])}}),Ph={content:{type:Object}},es={id:{type:String},arrowOffsetX:{type:Number,default:0},class:{type:String,default:""},customStyles:{type:Object,default:null},isSimpleTips:{type:Boolean,default:!1},fitContent:{type:Boolean,default:!1},host:{type:Object},leftBoundary:{type:Object},keepWidthWithReference:{type:Boolean,default:!1},minWidth:{type:Number,default:-1},offsetX:{type:Object,default:i.ref(0)},offsetY:{type:Object,default:i.ref(0)},placement:{type:String,default:"bottom"},reference:{type:Object},rightBoundary:{type:Object},showArrow:{type:Boolean,default:!1},title:{type:String},visible:{type:Boolean,default:!1},zIndex:{type:Number,default:-1},limitContentBySpace:{type:Boolean,default:!1},beforeClose:{type:Function}};function Rh(e){const t=e.host?e.host:"body",n=i.computed(()=>t==="body"?0:t?t.getBoundingClientRect().top:0),r=i.computed(()=>t==="body"?window.innerHeight:t?t.getBoundingClientRect().bottom:window.innerHeight),o=i.computed(()=>t==="body"?0:t?t.getBoundingClientRect().left:0),u=i.computed(()=>t==="body"?document.body.getBoundingClientRect().width:t?t.getBoundingClientRect().width-(e.rightBoundary?e.rightBoundary.getBoundingClientRect().width:0):document.body.getBoundingClientRect().width),a=i.computed(()=>t==="body"?window.innerHeight:t?t.getBoundingClientRect().height:window.innerHeight);return{host:t,hostLeft:o,hostTop:n,hostWidth:u,hostHeight:a,hostBottom:r}}function Mh(e,t,n,r){const o=i.ref(e.offsetX||0),u=i.ref(e.offsetY||0),a=i.ref(-1),s=i.ref(-1),l=i.ref(-1),d=i.ref(-1),f=i.ref(e.placement),c=i.ref(0),h=i.ref(0),m=i.ref(0),p=i.computed(()=>document.documentElement.scrollLeft),w=i.computed(()=>document.documentElement.scrollTop),{hostLeft:y,hostTop:A,hostWidth:b,hostHeight:g,hostBottom:x}=r;i.watch(()=>e.offsetX,L=>{o.value=L});const k=i.computed(()=>{const L={left:`${h.value}px`,top:`${m.value}px`,transform:`translate(${o.value}px, ${u.value}px)`};return e.zIndex!==-1&&(L["z-index"]=e.zIndex),e.fitContent?e.keepWidthWithReference&&n.value&&a.value>=n.value.getBoundingClientRect().width&&(L.width=`${a.value}px`):a.value!==-1&&(L.width=`${a.value}px`),e.minWidth!==-1&&(L.minWidth=`${e.minWidth}px`),e.customStyles&&Object.assign(L,e.customStyles),s.value>0&&(L.maxHeight=s.value+"px"),L}),T=i.computed(()=>({left:`${c.value}px`,transform:`translateX(${e.arrowOffsetX}px)`}));function D(L){if(L&&e.keepWidthWithReference){const M=L.getBoundingClientRect();a.value=Math.max(e.minWidth,M.width)}}function S(L,M){const G=b.value-L.width-4;return G>0?G:M}function X(L,M){const G=g.value-L.height-12;return G>0?G:M}function z(L,M,G){const J=c.value,Z=M.left-y.value+M.width/2+p.value,K=M.top-A.value-(L.height+G.height)+w.value;return{popoverLeft:Z,popoverTop:K,arrowLeft:J}}function B(L,M,G){const J=M.top-A.value+(M.height+G.height)+w.value,Z=X(L,J);return Math.min(J,Z)}function j(L,M){const G=S(M,L),J=L<=G?c.value:L-G;return{popoverLeft:Math.min(L,G),arrowLeft:J,maxHeight:0}}function I(L,M){const G=S(M,L),J=L<=G?c.value:L-G;return{popoverLeft:L,arrowLeft:J,maxHeight:0}}function W(L,M,G){const J=M.left-y.value+p.value,{arrowLeft:Z,popoverLeft:K}=I(J,L),{popoverTop:ue}=z(L,M,G);return{popoverLeft:K,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function _(L,M,G){const J=M.left-y.value+M.width/2-(G.width/2-(L.left-y.value))+p.value,{arrowLeft:Z,popoverLeft:K}=j(J,L),ue=B(L,M,G);return{popoverLeft:K,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function C(L,M,G){const J=M.left-y.value+p.value,{arrowLeft:Z,popoverLeft:K}=j(J,L),ue=B(L,M,G);return{popoverLeft:K,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function N(L,M,G){const J=M.left-y.value;let Z=0,K=0,ue=0,le=0,Fe="bottom-left";window.innerWidth-J>L.width?Z=J+p.value:(Z=M.right-L.width+p.value,ue=L.width-G.width-20);let Te=0;if(e.limitContentBySpace){const Xt={topHeight:M.top-A.value-G.height-8,bottomHeight:x.value-M.bottom-G.height-8};Te=Math.max(Xt.topHeight,Xt.bottomHeight),L.height>Te&&(le=Te,n.value.classList.add("popover-limitmax"))}const yt=le?Math.floor(le):L.height,Me=M.top-A.value+(M.height+G.height);return x.value-Me>yt?K=Me+w.value:(K=M.top-yt-G.height+w.value,x.value-Me>M.top?(K=Me+w.value,yt>M.top&&(K=x.value-yt)):(K=K<0?0:K,Fe="top")),n.value.classList.add("popover-"+Fe,"bs-popover-"+Fe),{popoverLeft:Z<0?5:Z,popoverTop:K,arrowLeft:ue,maxHeight:le}}function F(L,M,G){const J=M.left+M.width,Z=Math.max(M.top-(L.height/2-M.height/2),A.value);let K=A.value+g.value-L.height;K<0&&(K=Z);const ue=Math.min(Z,K);return{popoverLeft:J,popoverTop:ue,arrowLeft:0,maxHeight:0}}function O(L,M,G){const J=M.left+M.width,Z=Math.max(M.top-M.height,A.value);let K=A.value+g.value-L.height;K<0&&(K=Z);const ue=Math.min(Z,K);return{popoverLeft:J,popoverTop:ue,arrowLeft:0,maxHeight:0}}const H=new Map([["top",z],["top-left",W],["bottom",_],["bottom-left",C],["right",F],["right-top",O],["auto",N]]);function $(L){var K;e.keepWidthWithReference&&D(L);const M=L.getBoundingClientRect();l.value=M.top,d.value=M.left;const G=t.value?t.value.getBoundingClientRect():{height:4,width:4},J=(K=n.value)==null?void 0:K.getBoundingClientRect();a.value=J.width;const Z=H.get(f.value);if(Z){const{arrowLeft:ue,popoverLeft:le,popoverTop:Fe,maxHeight:Te}=Z(J,M,G);c.value=ue,h.value=le,m.value=Fe,s.value=Te||-1}}function R(L){if(L){const M=L.getBoundingClientRect();(M.left!==d.value||M.top!==l.value)&&$(L)}}function V(){f.value=e.placement,c.value=0,h.value=0,m.value=0,a.value=-1}return{arrowStyle:T,popoverStyle:k,position:f,popoverWidth:a,fitToReference:D,followToReferencePosition:R,locateToReference:$,resetPosition:V}}function Bh(e,t,n,r,o,u,a){const s=i.ref(e.visible),l=i.computed(()=>s.value),{fitToReference:d,locateToReference:f,resetPosition:c}=a;let h;async function m(){s.value&&(e.beforeClose&&typeof e.beforeClose=="function"&&!await e.beforeClose()||(s.value=!1,document.body.removeEventListener("click",h),document.body.removeEventListener("mousedown",h),document.body.removeEventListener("wheel",h,!0),document.removeEventListener("scroll",h),c(),t.emit("hidden")))}h=w=>{var b;if(!o.value)return;const y=o.value.contains(w.target);if(w.type==="scroll"||w.type==="wheel"&&y){m();return}if(w.target.closest(".time-picker-panel"))return;const A=(b=w.target)==null?void 0:b.closest(".popover");if(A&&r.value&&A===r.value){w.type!=="scroll"&&w.type!=="wheel"&&w.stopPropagation();return}if(!y&&s.value){const g=o.value.closest(".popover");g&&g.removeEventListener("click",h),m()}};async function p(w){if(r.value&&(e.showArrow===!1||e.showArrow&&n.value)&&w){c(),s.value=!0,o.value=w,u.value&&d(w),await i.nextTick(),f(w),document.body.addEventListener("click",h),document.body.addEventListener("mousedown",h),document.body.addEventListener("wheel",h,!0),document.addEventListener("scroll",h),(top==null?void 0:top.document)!==document&&(top==null||top.document.addEventListener("mousedown",h));const y=w.closest(".popover");y&&y.addEventListener("click",h),t.emit("shown")}}return t.expose({hide:m,popoverRef:r,show:p,shown:l,isShow:s}),{showPopover:s,hidePopverOnClickBodyHandler:h}}function zh(e,t,n,r,o,u){const{popoverWidth:a,fitToReference:s,followToReferencePosition:l}=o;function d(){var f;if(u.value&&((f=u.value.style)==null?void 0:f.display)!=="none"&&n.value){l(n.value);const c=n.value.getBoundingClientRect();r.value&&c.width!==a.value&&s(n.value)}}return{onResize:d}}function jh(e,t=500){const n=i.ref(e.value);let r;const o=i.watch(e,a=>{clearTimeout(r),r=setTimeout(()=>{n.value=a},t)}),u=()=>{clearTimeout(r),o()};return i.onUnmounted(u),{delayedValue:n,cleanup:u}}const Kt=i.defineComponent({name:"FXPopover",props:es,emits:["shown","hidden"],setup(e,t){const n=i.ref(),r=i.ref(),o=i.ref(e.reference),u=i.ref(e.keepWidthWithReference),a=i.computed(()=>!!e.title),s=Rh(e),{host:l}=s,d=Mh(e,n,r,s),{position:f,arrowStyle:c,popoverStyle:h,fitToReference:m,locateToReference:p}=d,{showPopover:w,hidePopverOnClickBodyHandler:y}=Bh(e,t,n,r,o,u,d),{onResize:A}=zh(e,t,o,u,d,r),b=i.computed(()=>{let D=f.value;D==="top-left"&&(D="top");const S=`popover in popover-${D}`,X=`bs-popover-${D}`,z={"popover-fitcontent":e.fitContent,fade:!0};z[S]=!0,z[X]=!0;const B=(e.class||"").split(" ");return e.isSimpleTips&&B.unshift("popover-tips"),B.reduce((j,I)=>(j[I]=!0,j),z),z}),g=i.computed(()=>({"popover-content":!0,"popover-body":!0})),x=i.computed(()=>{const D={};return D.opacity=w.value?1:0,D.visibility=w.value?"visible":"hidden",D.zIndex=1060,D}),k=i.computed(()=>e.isSimpleTips?!0:e.showArrow),{delayedValue:T}=jh(x,50);return i.onMounted(()=>{var D;u.value&&m(o.value),e.reference&&p(o.value),window.addEventListener("resize",A),(D=r.value)==null||D.focus()}),i.onUnmounted(()=>{document.body.removeEventListener("click",y),window.removeEventListener("resize",A),w.value=!1}),()=>i.createVNode(i.Teleport,{to:l},{default:()=>{var D;return[i.withDirectives(i.createVNode("div",{tabindex:"-1",ref:r,class:b.value,style:{...h.value,...T.value},onMousedown:S=>{S.stopPropagation()},onClick:S=>{S.stopPropagation()}},[k.value&&i.createVNode("div",{ref:n,class:"popover-arrow arrow",style:c.value},null),a.value&&i.createVNode("h3",{class:"popover-title popover-header"},[e.title]),i.createVNode("div",{class:g.value},[t.slots.default&&((D=t.slots)==null?void 0:D.default())])]),[[i.vShow,w.value]])]}})}}),au="FarrisX_PopoverInstancesKey";window[au]=window[au]||new WeakMap;function Fo(e,t,n){e.stopPropagation();const r=t.value;r&&r.value&&!r.value.isShow&&(r.value.show(n),window[au].set(n,r.value))}function ts(e,t,n){e.stopPropagation(),t.value.value.hide(),window[au].delete(n)}function Hh(e,t,n){e.stopPropagation();const r=t.value;r&&r.value&&(r.value.isShow?ts(e,t,n):Fo(e,t,n))}function ns(e,t,n){t.arg&&t.arg==="toggle"?Hh(e,t,n):Fo(e,t,n)}const rs={mounted:(e,t,n)=>{t.modifiers.hover?(e.addEventListener("mouseenter",r=>Fo(r,t,e)),e.addEventListener("mouseleave",r=>ts(r,t,e))):t.modifiers.click?e.addEventListener("click",r=>ns(r,t,e)):e.addEventListener("click",r=>ns(r,t,e)),e.classList.add("v-popover")},unMounted:(e,t,n)=>{}};Kt.install=e=>{e.component(Kt.name,Kt),e.directive("fxpopover",rs)};const us={type:{type:String,default:"StartedToDo"},status:{type:String,default:"NotStart"},message:{type:String,default:""},taskDetail:{type:String,default:""},todoList:{type:Array,default:[]},detailViewMode:{type:String,default:"hover"},initExpanded:{type:Boolean,default:!1},showLoading:{type:Boolean,default:!0},showLabel:{type:Boolean,default:!0},loading:Object,shimmer:{type:Boolean,default:!0},outputMode:{type:String,default:"streaming"},listStatus:{type:String,default:void 0},completedCount:{type:Number,default:void 0},totalCount:{type:Number,default:void 0}},os={items:{type:Array,default:()=>[]}},is={id:{type:Number||String,default:0},status:{type:String},task:{type:String,default:""},todoList:{type:Array,default:[]},detailViewMode:{type:String,default:"expand"},initExpanded:{type:Boolean,default:!0},showLoading:{type:Boolean,default:!0},showLabel:{type:Boolean,default:!1},shimmer:{type:Boolean,default:!0},title:{type:String,default:""},message:{type:String,default:""},outputMode:{type:String,default:"full"}},su=i.defineComponent({name:"FXTodoListItemView",props:is,emits:["click"],setup(e,{emit:t}){const{propertyStates:n,registerProperty:r,updatePropertyValue:o,startStreaming:u}=Vr();r("title",e.title??""),r("task",e.task??""),r("detail",e.message??""),i.watch([()=>e.title,()=>e.task,()=>e.message],([m,p,w])=>{o("title",m??""),o("task",p??""),o("detail",w??"")});const a=i.computed(()=>["f-chat-todo-item",{"is-done":e.status==="Done","is-working":e.status==="Working","is-not-start":e.status==="NotStart","no-shimmer":!e.shimmer}]),s=i.computed(()=>["f-chat-todo-task",{"is-done":e.status==="Done"}]);function l(){t("click",e,e.id)}const d=i.computed(()=>e.outputMode==="streaming"),f=i.computed(()=>{var m;return d.value?((m=n.title)==null?void 0:m.displayedValue)??"":e.title??""}),c=i.computed(()=>{var m;return d.value?((m=n.task)==null?void 0:m.displayedValue)??"":e.task??""}),h=i.computed(()=>{var m;return d.value?((m=n.detail)==null?void 0:m.displayedValue)??"":e.message??""});return i.onMounted(()=>{d.value&&u()}),()=>i.createVNode("li",{key:e.id,class:a.value,onClick:l},[e.todoList&&e.todoList.length>0&&i.createVNode(Qt,{todoList:e.todoList,status:e.status,message:e.task,taskDetail:e.message,detailViewMode:e.detailViewMode,initExpanded:e.initExpanded,showLoading:e.showLoading,showLabel:e.showLabel,outputMode:e.outputMode},null),!e.todoList||e.todoList.length===0&&i.createVNode(i.Fragment,null,[e.showLoading&&i.createVNode(wn,{status:e.status??"Done",variant:"todo"},null),f.value?i.createVNode("div",{class:"f-chat-todo-task-wrapper"},[i.createVNode("span",{class:s.value},[f.value]),i.createVNode("div",{class:"f-chat-todo-task-description"},[c.value]),h.value?i.withDirectives(i.createVNode("div",{class:"f-chat-todo-task-description"},[h.value]),[[i.resolveDirective("overflow-tooltip")]]):null]):i.createVNode("div",{class:"f-chat-todo-task-wrapper"},[i.createVNode("span",{class:s.value},[c.value]),h.value?i.withDirectives(i.createVNode("div",{class:"f-chat-todo-task-description"},[h.value]),[[i.resolveDirective("overflow-tooltip")]]):null])])])}}),rr=i.defineComponent({name:"FXTodoListView",props:os,setup(e){return()=>{var t;return(t=e.items)!=null&&t.length?i.createVNode("ul",{class:"f-chat-todo-items"},[e.items.map((n,r)=>i.createVNode(su,i.mergeProps({key:r},n),null))]):null}}}),$h=300,Uh={Working:"正在执行任务",Done:"已完成任务",NotStart:"待执行任务"},Qt=i.defineComponent({name:"FXStartedTodo",props:us,setup(e){const t=i.ref(null),n=i.ref(null),r=i.ref(null),o=i.ref(null),u=i.computed(()=>e.outputMode==="streaming"),{displayContent:a}=bi(()=>({detail:e.taskDetail??""}),()=>!0,u,{charInterval:30}),s=i.ref(e.initExpanded),l=i.computed(()=>({"f-chat-message-started-todo--content":!0,"d-none":!s.value}));function d(){e.detailViewMode!=="expand"&&(o.value!=null&&(window.clearTimeout(o.value),o.value=null),r.value=window.setTimeout(()=>{t.value&&n.value&&n.value.show(t.value),r.value=null},$h))}function f(){e.detailViewMode!=="expand"&&(r.value!=null&&(window.clearTimeout(r.value),r.value=null),o.value=window.setTimeout(()=>{var b,g;(g=(b=n.value)==null?void 0:b.hide)==null||g.call(b),o.value=null},150))}function c(){if(e.detailViewMode==="none")return null;const b=a.value.detail??"";return i.createVNode(i.Fragment,null,[b?i.createVNode("div",{class:"f-chat-started-todo-task-detail"},[b]):null,i.createVNode(rr,{items:e.todoList},null)])}function h(){e.detailViewMode==="expand"&&(s.value=!s.value)}function m(){return e.detailViewMode==="expand"?i.createVNode("i",{class:"fx-icon fx-icon-foldup",style:{transform:s.value?"rotate(0deg)":"rotate(180deg)",transition:"all 0.3s ease-in-out"}},null):null}function p(){return e.detailViewMode==="hover"&&i.createVNode(Kt,{ref:n,class:"f-chat-started-todo-popover"},{default:()=>[i.createVNode("div",{class:"f-chat-started-todo-popover-content",onMouseenter:()=>{o.value!=null&&(window.clearTimeout(o.value),o.value=null)},onMouseleave:f},[c()])]})}const w=i.computed(()=>e.listStatus==="completed"),y=i.computed(()=>{const b=e.todoList??[],g=e.totalCount??b.length;return{done:e.completedCount??b.filter(k=>(k==null?void 0:k.status)==="Done").length,total:g}});function A(){if(!w.value)return null;const{done:b,total:g}=y.value,x=g>0?`已完成 (${b}/${g})`:"已完成";return i.createVNode("span",{class:"f-chat-started-todo-completed-chip","aria-label":x},[x])}return()=>i.createVNode("div",{ref:t,class:["f-chat-message-started-todo",{"is-working":e.status==="Working","is-completed":w.value}],onMouseenter:d,onMouseleave:f},[i.createVNode("div",{class:"f-chat-message-started-todo--header",onClick:h},[e.showLabel&&i.createVNode("span",{class:"f-chat-started-todo-label"},[Uh[e.status]]),i.createVNode("span",{class:"f-chat-started-todo-message",innerHTML:e.message},null),A(),m()]),e.detailViewMode==="expand"&&i.createVNode("div",{class:l.value},[c()]),p()])}});Qt.install=e=>{e.component(Qt.name,Qt)};const Wh=i.defineComponent({name:"FXBubbleThoughtChain",props:Ph,setup(e,t){const{elapsedSeconds:n,hasEverStarted:r,start:o,stop:u,reset:a}=Hu(),s=i.computed(()=>{var c;return((c=e.content)==null?void 0:c.status)==="Done"}),l=i.computed(()=>{var c;return((c=e.content)==null?void 0:c.message)??"正在思考......"}),d=i.computed(()=>{var m,p;const c=((m=e.content)==null?void 0:m.doneMessage)??((p=e.content)==null?void 0:p.message)??"思考完成",h=r.value?`(用时${n.value}秒)`:"";return""+c+h}),f=i.computed(()=>s.value?d.value:l.value);return i.watch(()=>{var c;return(c=e.content)==null?void 0:c.status},c=>{c==="Working"?o():c==="Done"?u():a()},{immediate:!0}),i.onUnmounted(()=>{a()}),t.expose({instance:{get loadDone(){return e.content?s.value:!0}}}),()=>{var c,h,m,p,w,y;return e.content?i.createVNode(Qt,{status:((c=e.content)==null?void 0:c.status)??"Working",message:f.value,todoList:(h=e.content)==null?void 0:h.todoList,detailViewMode:((m=e.content)==null?void 0:m.detailViewMode)??"expand",showLabel:!1,showLoading:!0,initExpanded:!0,listStatus:(p=e.content)==null?void 0:p.listStatus,completedCount:(w=e.content)==null?void 0:w.completedCount,totalCount:(y=e.content)==null?void 0:y.totalCount},null):null}}}),ur=i.defineComponent({name:"UserAuthMessage",props:{content:{type:Object,required:!0},onConfirm:{type:Function,default:void 0}},setup(e){return()=>i.createVNode("div",{class:"f-ec-auth"},[i.createVNode("div",{class:"f-ec-auth-desc"},[e.content.description]),i.createVNode("div",{class:"f-ec-auth-actions"},[e.content.options.map(t=>i.createVNode("button",{key:t.optionId,type:"button",class:"f-ec-auth-btn",onClick:()=>{var n;(n=e.onConfirm)==null||n.call(e,t.optionId,t.name,t.message??t.name),console.info("[UserAuth]",t.optionId,t.name)}},[t.name]))])])}}),Gh=300,Xh={read_file:"tool_file",write_file:"tool_file",edit_file:"tool_file",glob:"tool_file",grep:"tool_file",bash:"tool_command",web_fetch:"tool_internet",web_search:"tool_internet",todo_create:"tool_task",todo_list:"tool_task",todo_get:"tool_task",todo_update:"tool_task",ask_user:"tool_interaction",core_memory:"tool_memory",add_daily_note:"tool_memory",lint_json:"dateselect",lint_markdown:"dateselect",output_validation:"dateselect",load_skill_through_path:"tool_mcp"};function qh(e){return e?e.startsWith("mcp:")?"tool_mcp":Xh[e]??"thinking_tool":"thinking_tool"}const vn=i.defineComponent({name:"FXToolUseMessage",props:{content:{type:Object,required:!0}},setup(e){const t=i.computed(()=>e.content.toolResultApplied===!0||String(e.content.result??"").trim().length>0),n=i.computed(()=>e.content.success===!1),r=i.ref(!1);let o=setTimeout(()=>{r.value=!0},Gh);i.onBeforeUnmount(()=>{o&&clearTimeout(o)});const u=i.computed(()=>t.value),a=i.computed(()=>r.value&&!t.value),s=i.computed(()=>n.value?"执行失败":u.value?"执行完成":"调用中"),l=i.ref(!1),d=i.computed(()=>({"f-chat-tool-use":!0,"is-done":u.value,"is-error":n.value})),f=i.computed(()=>({"f-chat-tool-use-status":!0,"is-done":u.value&&!n.value,"is-run":a.value&&!n.value,"is-error":n.value}));i.watch(()=>[e.content.result,e.content.toolResultApplied,e.content.success],()=>{t.value&&(l.value=!1)},{flush:"post"});const c=()=>t.value?i.createVNode("div",{class:"f-chat-tool-use-result"},[e.content.result??""]):null;return()=>i.createVNode("div",{class:d.value},[i.createVNode("div",{class:"f-chat-tool-use-header",onClick:()=>{l.value=!l.value}},[i.createVNode("i",{class:"fx-icon fx-icon-"+qh(e.content.toolName)+" tool-icon"},null),i.createVNode("span",{class:"f-chat-tool-use-name"},[e.content.toolDescription??"tool"]),i.createVNode("div",{class:f.value},[n.value?i.createVNode(wn,{status:"Error",variant:"tool-use"},null):i.createVNode(wn,{status:u.value?"Done":a.value?"Working":"NotStart",variant:"tool-use"},null),i.createVNode("span",{class:"f-chat-tool-use-status-text"},[s.value])]),i.createVNode("i",{class:"fx-icon fx-icon-foldup",style:{transform:l.value?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.2s ease"}},null)]),l.value&&i.createVNode("div",{class:"f-chat-tool-use-content"},[c()])])}});vn.install=e=>{e.component(vn.name,vn)};const or=i.defineComponent({name:"FXBubble",components:{"fx-user-auth-inline":ur,"fx-app-preview-inline":at,FXToolUse:vn},props:Ir,setup(e,t){const n=i.shallowRef(),r=i.ref(),o=i.ref(),u=i.computed(()=>!!e.showAvatar),a=i.computed(()=>u.value===!0||e.header==="ContentHeader"),s=i.computed(()=>t.slots.leftFooter||t.slots.rightFooter),l=i.computed(()=>{var I;return Ae({},(I=e.styles)==null?void 0:I.footer)}),d=I=>{if(e.attachmentRowClickOpensPreview!==!1&&e.onPreview){if(I.type==="md"&&I.content){e.onPreview({content:I.content,contentType:"markdown"});return}if(I!=null&&I.url){const W=I!=null&&I.fullScreenPreview?"fullScreen":"splitScreen";e.onPreview({url:I.url,previewMode:W,title:I.name})}}},f=I=>{if(e.attachmentRowClickOpensPreview===!1||!e.onPreview)return;const W=I==null?void 0:I.filter(C=>C.type==="md"&&C.content);if(W.length===0)return;const _=Object.fromEntries(W.map(C=>[C.name,C.content??""]));e.onPreview({contentMap:_,contentType:"markdown"})},{renderFileEmbeddedContent:c,renderPageEmbeddedContent:h}=Ai(),m=i.ref(""),p=i.computed(()=>{var W,_;if((W=e.content)!=null&&W.footerContent)return e.content.footerContent;const I=(_=e.content)==null?void 0:_.structuredContent;return I&&(I.footerTemplate||I.footerUrl||I.footerFile)?{type:I.footerUrl?"page":I.footerFile?"file":"template",pageUrl:I.footerUrl,fileContent:I.footerFile,template:I.footerTemplate,width:I.footerWidth,height:I.footerHeight}:null});i.watch(()=>{var I;return(I=p.value)==null?void 0:I.width},I=>{if(!I){m.value="";return}if(I.endsWith("%")){const W=parseFloat(I);isNaN(W)||i.nextTick(()=>{var C,N;const _=(N=(C=n.value)==null?void 0:C.parentElement)==null?void 0:N.clientWidth;_&&(m.value=`${_*W/100}px`)})}else m.value=I},{immediate:!0});const w=I=>{if(!I||I.length===0)return"我";const W=I.charAt(0);return/[\u4e00-\u9fa5]/.test(W)?W:W.toUpperCase()};function y(){return e.header==="ContentHeader"?uc:oc}const A=y(),{renderHeader:b}=A(e,t),g=()=>{var _,C,N;const I=((_=e.content)==null?void 0:_.sender)??"发送人",W=w(((C=e.content)==null?void 0:C.sender)??"");return i.createVNode("div",{class:"f-chat-bubble-avatar"},[(N=e.content)!=null&&N.avatar?i.createVNode("img",{src:e.content.avatar,alt:I},null):i.createVNode("div",{class:"f-chat-bubble-avatar-initial"},[W])])},x=()=>{var W;const I=(W=e.content)==null?void 0:W.toolUseAboveText;return I!=null&&I.length?i.createVNode("div",{class:"f-chat-bubble-tool-use-group"},[I.map((_,C)=>i.createVNode(vn,{key:_.toolUseId??`tu-${C}`,content:_},null))]):null},k=()=>{var I;return(I=e.content)!=null&&I.thinkingContent?i.createVNode(Vh,{ref:r,content:e.content.thinkingContent,outputMode:e.outputMode},null):null},T=()=>{var I;return(I=e.content)!=null&&I.startedTodo?i.createVNode(Wh,{ref:o,content:e.content.startedTodo},null):null},D=I=>{if(!(I!=null&&I.type))return null;const{type:W}=I;return W==="page"&&I.pageUrl?h(I,{onNavigate:_=>{var C;(C=e.onPreview)==null||C.call(e,{url:_})}}):W==="file"&&I.fileContent?c(I,{onPreviewFile:d,onBatchPreviewFile:f}):W==="template"&&I.template?I.template():null},S=()=>{var C,N,F;if(!((F=(N=(C=e.content)==null?void 0:C.structuredContent)==null?void 0:N.sections)!=null&&F.length))return null;const{sections:I,showDivider:W}=e.content.structuredContent,_=O=>{const{content:H,label:$}=O;return $||H&&typeof H=="string"?i.createVNode(i.Fragment,null,[i.createVNode("span",{class:"f-chat-bubble-structured-section-item-dot"},null),O.label&&i.createVNode("span",{class:"f-chat-bubble-structured-section-item-label"},[O.label]),i.createVNode("span",{class:"f-chat-bubble-structured-section-item-content"},[O.content])]):D(O.content)};return i.createVNode("div",{class:["f-chat-bubble-structured",{"structure-content-divider":W}]},[I.map((O,H)=>i.createVNode("div",{key:H,class:["f-chat-bubble-structured-section",{"section-divider":O.showDivider}]},[i.createVNode("div",{class:"f-chat-bubble-structured-section-header"},[O.icon&&(O.icon.startsWith("http")||O.icon.startsWith("//")||O.icon.startsWith("../")||/\.(png|jpg|jpeg|gif|svg|webp|bmp)$/i.test(O.icon)?i.createVNode("img",{alt:O.title,src:O.icon,class:"f-chat-bubble-structured-section-icon"},null):i.createVNode("i",{class:`fx-icon ${O.icon}`,style:O.iconStyle},null)),i.createVNode("span",{class:"f-chat-bubble-structured-section-title"},[O.title])]),O.items&&O.items.length>0&&i.createVNode("div",{class:"f-chat-bubble-structured-section-items"},[O.items.map(($,R)=>i.createVNode("div",{key:R,class:"f-chat-bubble-structured-section-item"},[_($)]))])]))])},X=()=>{const I=p.value;if(!I)return null;const W={};return m.value&&(W.width=m.value),I.height&&(W.height=`${I.height}px`),i.createVNode("div",{class:"f-chat-bubble-content-footer",style:W},[D(I)])},z=()=>{const I=e.attachmentRowClickOpensPreview!==!1?d:void 0;return i.createVNode(vi,{attachments:e.attachments??[],enableFixedWidth:e.placement==="end",showDownloadButton:e.attachmentShowDownload!==!1,onPreview:I,onBatchPreview:e.attachmentRowClickOpensPreview!==!1?f:void 0,role:e.role},null)},B=()=>{var W;const I=(W=e.content)==null?void 0:W.compositeInlineBlocks;return I!=null&&I.length?I.map((_,C)=>_.kind==="userAuth"?i.createVNode(i.resolveComponent("fx-user-auth-inline"),{key:`inline-auth-${C}`,content:_.content,onConfirm:e.onUserAuthConfirm},null):i.createVNode(i.resolveComponent("fx-app-preview-inline"),{key:`inline-preview-${C}`,content:_.content,onOpen:e.onPreview},null)):null},j=()=>{var I,W,_,C,N,F;return i.createVNode("div",{class:`f-chat-bubble-content ${e.placement}`},[a.value&&b(),z(),i.createVNode("div",{class:`f-chat-bubble-content-text-wrapper ${e.placement}`},[(I=e.content)!=null&&I.compositeOrderedBeforeMarkdownRender?e.content.compositeOrderedBeforeMarkdownRender():i.createVNode(i.Fragment,null,[k(),x()]),T(),S(),i.createVNode(Oh,{title:((W=e.content)==null?void 0:W.title)??"",subtitle:((_=e.content)==null?void 0:_.subtitle)??"",text:typeof((C=e.content)==null?void 0:C.text)=="string"?e.content.text:"",textFormat:((N=e.content)==null?void 0:N.textFormat)??"plain",placement:e.placement,onDynamicComponentsDetected:e==null?void 0:e.onDynamicComponentsDetected,onShowDynamicComponent:e==null?void 0:e.onShowDynamicComponent},null),X(),(F=e.compositeTailRender)==null?void 0:F.call(e),B()]),s.value&&i.createVNode("div",{class:"f-chat-bubble-footer",style:l.value},[t.slots.leftFooter&&i.createVNode("div",{class:"f-chat-bubble-footer-left"},[t.slots.leftFooter()]),t.slots.rightFooter&&i.createVNode("div",{class:"f-chat-bubble-footer-right"},[t.slots.rightFooter()])])])};return()=>i.createVNode("div",{class:"f-chat-bubble-container",ref:n},[i.createVNode("div",{class:`f-chat-bubble-wrapper ${e.placement}`},[e.placement==="start"?i.createVNode(i.Fragment,null,[u.value&&g(),j()]):i.createVNode(i.Fragment,null,[j(),u.value&&g()])])])}}),as={customClass:{type:[Object,String,Array],default:""},customStyle:{type:[Object,String],default:""}},To=i.defineComponent({name:"FXBubbleAction",props:as,setup(e,t){const n=i.computed(()=>Ae({},e.customStyle));return()=>t.slots.default&&i.createVNode("span",{class:"f-chat-bubble-footer-action",style:n.value},[t.slots.default()])}});or.install=e=>{e.component(or.name,or),e.component(To.name,To)};const ss={items:{type:Array,default:()=>[]},modelValue:{type:Number,default:0},direction:{type:String,default:"horizontal"},autoplay:{type:Boolean,default:!1},interval:{type:Number,default:3e3},loop:{type:Boolean,default:!0},trigger:{type:String,default:"click"},indicatorPosition:{type:String,default:"inside"},arrowVisibility:{type:String,default:"hover"},showIndicator:{type:Boolean,default:!0},showArrow:{type:Boolean,default:!0},showInfo:{type:Boolean,default:!0},height:{type:[String,Number],default:"400px"},styles:{type:Object,default:()=>({})},classNames:{type:Object,default:()=>({})},customClass:{type:[String,Array,Object],default:""},customStyle:{type:[Object,String],default:""},buttonPosition:{type:String,default:"inner"}},ls={item:{type:Object,default:()=>({})},index:{type:Number,default:0},active:{type:Boolean,default:!1},showInfo:{type:Boolean,default:!0},styles:{type:Object,default:()=>({})},classNames:{type:Object,default:()=>({})}},lu=i.defineComponent({name:"FXCarouselItem",props:ls,emits:["click"],setup(e,{slots:t,emit:n}){const r=i.computed(()=>{var c;const f={"fx-carousel--item":!0,"fx-carousel--item-active":e.active};return ye(f,(c=e.classNames)==null?void 0:c.item)}),o=i.computed(()=>{var c,h;const f=Ae({},(c=e.styles)==null?void 0:c.item);return Ae(f,(h=e.styles)==null?void 0:h.item)}),u=()=>{var f,c,h;return e.item.image?i.createVNode("img",{class:["fx-carousel--item-image",(f=e.classNames)==null?void 0:f.image],style:(c=e.styles)==null?void 0:c.image,src:e.item.image,alt:(h=e.item.title)==null?void 0:h.toString()},null):null},a=()=>{var f,c,h,m;return e.item.content?i.createVNode("div",{class:["fx-carousel--item-content",(f=e.classNames)==null?void 0:f.content],style:(c=e.styles)==null?void 0:c.content},[e.item.content]):t.default?i.createVNode("div",{class:["fx-carousel--item-content",(h=e.classNames)==null?void 0:h.content],style:(m=e.styles)==null?void 0:m.content},[t.default()]):null},s=()=>{var f,c;return e.item.title?i.createVNode("h3",{class:["fx-carousel--item-title",(f=e.classNames)==null?void 0:f.title],style:(c=e.styles)==null?void 0:c.title},[e.item.title]):null},l=()=>{var f,c;return e.item.description?i.createVNode("p",{class:["fx-carousel--item-description",(f=e.classNames)==null?void 0:f.description],style:(c=e.styles)==null?void 0:c.description},[e.item.description]):null},d=f=>{e.item.disabled||n("click",f,e.item,e.index)};return()=>i.createVNode("div",{class:r.value,style:o.value,onClick:d},[u(),a(),e.showInfo&&i.createVNode("div",{class:"fx-carousel--item-info"},[s(),l()])])}});function Zh(e){const{items:t,autoplay:n=!1,interval:r=3e3,loop:o=!0,direction:u="horizontal"}=e,a=i.ref(0),s=i.ref(!1),l=i.ref(null),d=i.computed(()=>t.length),f=i.computed(()=>d.value<=1);i.computed(()=>a.value===0?o?d.value-1:0:a.value-1),i.computed(()=>a.value===d.value-1?o?0:a.value:a.value+1);const c=i.computed(()=>{const g=-a.value*100;return{transform:u==="horizontal"?`translateX(${g}%)`:`translateY(${g}%)`,transition:"transform 0.5s ease"}}),h=g=>{g<0||g>=d.value||(a.value,a.value=g)},m=()=>{f.value||(a.value===d.value-1?h(o?0:a.value):h(a.value+1))},p=()=>{f.value||(a.value===0?h(o?d.value-1:0):h(a.value-1))},w=()=>{!n||f.value||(y(),l.value=window.setInterval(()=>{s.value||m()},r))},y=()=>{l.value&&(clearInterval(l.value),l.value=null)},A=()=>{s.value=!0,n&&y()},b=()=>{s.value=!1,n&&w()};return i.onMounted(()=>{w()}),i.onUnmounted(()=>{y()}),{currentIndex:a,totalItems:d,isSingleItem:f,trackStyle:c,goTo:h,next:m,prev:p,handleMouseEnter:A,handleMouseLeave:b}}const ir=i.defineComponent({name:"FXCarousel",props:ss,emits:["update:modelValue","change","item-click"],setup(e,{slots:t,emit:n}){const{currentIndex:r,isSingleItem:o,trackStyle:u,goTo:a,next:s,prev:l,handleMouseEnter:d,handleMouseLeave:f}=Zh({items:e.items,autoplay:e.autoplay,interval:e.interval,loop:e.loop,direction:e.direction}),c=k=>{n("update:modelValue",k),n("change",k,r.value)},h=i.computed(()=>{var T;const k={"fx-carousel":!0,"fx-carousel--vertical":e.direction==="vertical","fx-carousel--single":o.value,"fx-carousel--button-outer":e.buttonPosition==="outer","fx-carousel--button-inner":e.buttonPosition==="inner"};return ye(k,(T=e.classNames)==null?void 0:T.root)}),m=i.computed(()=>{var D;const k={height:typeof e.height=="number"?`${e.height}px`:e.height},T=Ae(k,e.customStyle);return Ae(T,(D=e.styles)==null?void 0:D.root)}),p=i.computed(()=>{var T;const k={"fx-carousel--container":!0,"fx-carousel--container-hover":e.arrowVisibility==="hover"};return ye(k,(T=e.classNames)==null?void 0:T.container)}),w=i.computed(()=>{var T;return ye({"fx-carousel--track":!0},(T=e.classNames)==null?void 0:T.track)}),y=i.computed(()=>{var T;const k={"fx-carousel--indicator":!0,"fx-carousel--indicator-outside":e.indicatorPosition==="outside","fx-carousel--indicator-none":e.indicatorPosition==="none"||!e.showIndicator};return ye(k,(T=e.classNames)==null?void 0:T.indicator)}),A=k=>{var D,S;const T={"fx-carousel--arrow":!0,"fx-carousel--arrow-left":k==="left","fx-carousel--arrow-right":k==="right","fx-carousel--arrow-never":e.arrowVisibility==="never"||!e.showArrow};return T[`fx-carousel--arrow-${e.buttonPosition}`]=!0,ye(T,k==="left"?(D=e.classNames)==null?void 0:D.arrowLeft:(S=e.classNames)==null?void 0:S.arrowRight)},b=k=>{var S,X;if(o.value)return null;const T=k==="left"?l:s,D=t[k==="left"?"prevArrow":"nextArrow"];return i.createVNode("button",{class:A(k),style:k==="left"?(S=e.styles)==null?void 0:S.arrowLeft:(X=e.styles)==null?void 0:X.arrowRight,onClick:T,"aria-label":`${k} arrow`},[D?D():i.createVNode("i",{style:"font-size: 60px;",class:`fx-icon fx-icon-arrow-${k==="left"?"left":"right"}`},null)])},g=()=>{var k;return o.value||!e.showIndicator?null:i.createVNode("div",{class:y.value,style:(k=e.styles)==null?void 0:k.indicator},[e.items.map((T,D)=>{var S,X;return i.createVNode("button",{"aria-label":`indicator ${D}`,key:D,class:["fx-carousel--indicator-item",{"fx-carousel--indicator-item-active":D===r.value}],style:D===r.value?(S=e.styles)==null?void 0:S.indicatorItemActive:(X=e.styles)==null?void 0:X.indicatorItem,onClick:()=>{a(D),c(D)}},null)})])},x=()=>i.createVNode("div",{class:w.value,style:u.value},[e.items.map((k,T)=>i.createVNode(lu,{key:k.id||`item_${T}`,item:k,showInfo:e.showInfo,index:T,active:T===r.value,styles:e.styles,classNames:e.classNames,onClick:(D,S,X)=>{n("item-click",D,S,X)}},{default:()=>{var D,S;return[(D=t.item)==null?void 0:D.call(t,{item:k,index:T,active:T===r.value}),(S=t[`item${T}`])==null?void 0:S.call(t,{item:k,index:T,active:T===r.value})]}}))]);return()=>{var k;return i.createVNode("div",{class:h.value,style:m.value,onMouseenter:d,onMouseleave:f},[e.buttonPosition==="outer"&&b("left"),i.createVNode("div",{class:p.value,style:(k=e.styles)==null?void 0:k.container},[e.buttonPosition==="inner"&&b("left"),x(),e.buttonPosition==="inner"&&b("right")]),e.buttonPosition==="outer"&&b("right"),g()])}}});ir.install=e=>{e.component(ir.name,ir),e.component(lu.name,lu)};const cs={customStyle:{type:String,default:""},customClass:{type:String,default:""},direction:{Type:String,default:"row"}};function Yh(e){const t=i.ref(-1),n=i.ref(-1),r=i.ref(0),o=i.ref(0),u=i.ref(!1),a=i.ref(!1),s=i.computed(()=>({display:u.value?"block":"none",left:`${r.value}px`,cursor:"e-resize"})),l=i.computed(()=>({display:a.value?"block":"none",top:`${o.value}px`,cursor:"n-resize"})),d=i.computed(()=>{const y={display:a.value||u.value?"block":"none"};return o.value>0&&(y.cursor="n-resize"),y});function f(y,A,b,g){const x=e.value;if(x){const{left:k,right:T,width:D}=x.getBoundingClientRect();let S=y.clientX-k;g==="right"&&(S=T-y.clientX),S>A&&(S=A),S<b&&(S=b),g==="right"&&(S=D-S),r.value=S}}function c(y,A,b,g){const x=e.value;if(x){const{top:k,bottom:T,height:D}=x.getBoundingClientRect();let S=y.clientY-k;g==="bottom"&&(S=T-y.clientY),S>A&&(S=A),S<b&&(S=b),g==="bottom"&&(S=D-S),o.value=S}}function h(){const y=e.value;if(y){const{width:A,height:b}=y.getBoundingClientRect();return{width:A,height:b}}return null}function m(){const y=e.value;return y?Array.from(y.querySelectorAll("[data-position]")).reduce((A,b)=>{const g=b.getAttribute("data-position");return A=Object.assign(A,{[g]:b}),A},{}):null}function p(y,A){const b=h(),g=m();if(b&&g){const x=g==null?void 0:g.right,k=g==null?void 0:g.left;if(y==="left"&&k)return x?b.width-x.clientWidth-A:b.width-A;if(y==="right"&&x)return k?b.width-k.clientWidth-A:b.width-A}}function w(y,A){const b=h(),g=m();if(b&&g){const x=g==null?void 0:g.bottom,k=g==null?void 0:g.top;if(y==="top"&&k)return x?b.height-x.clientHeight-A:b.height-A;if(y==="bottom"&&x)return k?b.height-k.clientHeight-A:b.height-A}}return{horizontalResizeHandleStyle:s,verticalResizeHandleStyle:l,resizeOverlayStyle:d,showHorizontalResizeHandle:u,showVerticalResizeHandle:a,horizontalResizeBarPosition:t,verticalResizeBarPosition:n,verticalResizeHandleOffset:o,horizontalResizeHandleOffset:r,draggingHorizontalResizeHandle:f,draggingVerticalResizeHandle:c,getPanelMaxWidth:p,getPanelMaxHeight:w}}const An=i.defineComponent({name:"FXSplitter",props:cs,emits:[],setup(e,t){const n=i.ref(),r=Yh(n),{horizontalResizeHandleStyle:o,verticalResizeHandleStyle:u,resizeOverlayStyle:a}=r;i.provide("splitter",{useResizeHandleComposition:r});const s=i.computed(()=>ye({"f-splitter":!0},e==null?void 0:e.customClass)),l=i.computed(()=>{const d={"flex-direction":e.direction==="row"?"row":"column"};return Ae(d,e==null?void 0:e.customStyle)});return()=>i.createVNode("div",{class:s.value,ref:n,style:l.value},[t.slots.default&&t.slots.default(),i.createVNode("div",{class:"f-splitter-resize-overlay",style:a.value},null),i.createVNode("div",{class:"f-splitter-horizontal-resize-proxy",style:o.value},null),i.createVNode("div",{class:"f-splitter-vertical-resize-proxy",style:u.value},null)])}}),Kh={customClass:{type:String,defaut:""},customStyle:{type:String,default:""},width:{type:Number},height:{type:Number},position:{type:String,default:"left"},visible:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},resizeHandle:{type:String,default:""},collapsable:{type:Boolean,default:!1},minWidth:{type:Number,default:100},minHeight:{type:Number,default:100},maxWidth:{type:Number,default:0},maxHeight:{type:Number,default:0}};function Qh(e,t){const n=i.ref(e.width),r=i.ref(e.height),{horizontalResizeBarPosition:o,horizontalResizeHandleOffset:u,showHorizontalResizeHandle:a,showVerticalResizeHandle:s,verticalResizeBarPosition:l,verticalResizeHandleOffset:d,draggingHorizontalResizeHandle:f,draggingVerticalResizeHandle:c,getPanelMaxWidth:h,getPanelMaxHeight:m}=t;let p="",w,y,A;const b=()=>e.maxWidth?e.maxWidth:h(p,e.minWidth)||0,g=()=>e.maxHeight?e.maxHeight:m(p,e.minHeight)||0;function x(D){if((p==="left"||p==="right")&&y){const{left:S}=y.getBoundingClientRect(),{width:X}=w.getBoundingClientRect(),z=D.clientX-S;let B=p==="left"?(X||0)+(z-o.value):(X||0)-(z-o.value);B=e.minWidth>0?Math.max(e.minWidth,B):B;const j=b();j!=null&&j>0&&(B=j>B?B:j),n.value=B}if((p==="top"||p==="bottom")&&y){const{top:S}=y.getBoundingClientRect(),{height:X}=w.getBoundingClientRect(),z=D.clientY-S;let B=p==="top"?(X||0)+(z-l.value):(X||0)-(z-l.value);B=e.minHeight>0?Math.max(e.minHeight,B):B;const j=g();j!=null&&j>0&&(B=j>B?B:j),r.value=B}u.value=0,d.value=0,o.value=-1,l.value=-1,a.value=!1,s.value=!1,document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",x),document.body.style.userSelect="",p="",w=null,y=null}function k(D,S,X){if(p=S,w=X,a.value=!0,y=D.composedPath().find(B=>B.className.split(" ")[0]==="f-splitter"),y){const{left:B}=y.getBoundingClientRect();u.value=D.clientX-B,o.value=D.clientX-B;const j=b();A=I=>f(I,j,e.minWidth,p),document.addEventListener("mousemove",A),document.addEventListener("mouseup",x),document.body.style.userSelect="none"}}function T(D,S,X){if(p=S,w=X,s.value=!0,y=D.composedPath().find(B=>B.className.split(" ")[0]==="f-splitter"),y){const{top:B}=y.getBoundingClientRect();d.value=D.clientY-B,l.value=D.clientY-B;const j=g();A=I=>c(I,j,e.minHeight,p),document.addEventListener("mousemove",A),document.addEventListener("mouseup",x),document.body.style.userSelect="none"}}return{actualWidth:n,actualHeight:r,onClickSplitterHorizontalResizeBar:k,onClickSplitterVerticalResizeBar:T}}const ar=i.defineComponent({name:"FSplitterPane",props:Kh,emits:[],setup(e,t){const n=i.ref(),r=i.inject("splitter"),{useResizeHandleComposition:o}=r,u=Qh(e,o),{actualHeight:a,actualWidth:s,onClickSplitterHorizontalResizeBar:l,onClickSplitterVerticalResizeBar:d}=u,f=i.ref(e.position),c=i.computed(()=>{const g={"f-splitter-pane":!0,"f-splitter-pane-main":f.value==="center","has-resize-bar":e.resizable};return g["f-splitter-pane-"+f.value]=!0,ye(g,e==null?void 0:e.customClass)}),h=i.computed(()=>e.resizeHandle?e.resizeHandle.split(",").filter(g=>["e","n","s","w"].find(x=>x===g)):[]),m=i.computed(()=>{const g={};return(s.value||s.value===0)&&(f.value==="left"||f.value==="right"||h.value.find(x=>x==="e")||h.value.find(x=>x==="w"))&&(g.width=`${s.value}px`),(a.value||a.value===0)&&(f.value==="bottom"||f.value==="top"||h.value.find(x=>x==="s")||h.value.find(x=>x==="n"))&&(g.height=`${a.value}px`),e.visible||(g.display="none"),Ae(g,e==null?void 0:e.customStyle)}),p=i.computed(()=>({"f-splitter-resize-bar":!0,"f-splitter-resize-bar-e":f.value==="left","f-splitter-resize-bar-n":f.value==="bottom","f-splitter-resize-bar-s":f.value==="top","f-splitter-resize-bar-w":f.value==="right"}));function w(g){return{e:"left",w:"right",s:"top",n:"bottom"}[g]||g}function y(g,x){x=w(x),["left","right"].find(k=>k===x)&&l(g,x,n.value),["top","bottom"].find(k=>k===x)&&d(g,x,n.value)}function A(){return h.value.length>0?h.value.map(g=>i.createVNode("span",{class:"f-splitter-resize-bar f-splitter-resize-bar-"+g,onMousedown:x=>y(x,g)},null)):i.createVNode("span",{class:p.value,onMousedown:g=>y(g,f.value)},null)}function b(){s.value=e.width,a.value=e.height,m.value}return t.expose({reset:b}),()=>i.createVNode("div",{ref:n,class:c.value,style:m.value,"data-position":f.value},[t.slots.default&&t.slots.default(),e.resizable&&A()])}});An.install=e=>{e.component(An.name,An),e.component(ar.name,ar)};const ds={previewConfig:{type:Object,default:()=>({})},onClose:{type:Function,default:()=>{}},onIframeLoad:{type:Function,default:()=>{}}},fs={content:{type:String,default:null}},Jh=e=>{const t=typeof e;return t!=="function"&&t!=="object"||e===null},ep=e=>{const t=e.flags===""?void 0:e.flags;return new RegExp(e.source,t)},sr=(e,t=new WeakMap)=>{if(e===null||Jh(e))return e;if(t.has(e))return t.get(e);if(e instanceof RegExp)return ep(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Function)return e;if(e instanceof Map){const r=new Map;return t.set(e,r),e.forEach((o,u)=>{r.set(u,sr(o,t))}),r}if(e instanceof Set){const r=new Set;t.set(e,r);for(const o of e)r.add(sr(o,t));return r}if(Array.isArray(e)){const r=[];return t.set(e,r),e.forEach(o=>{r.push(sr(o,t))}),r}const n={};t.set(e,n);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=sr(e[r],t));return n},tp=(e,t=200)=>{let n=0;return(...r)=>new Promise(o=>{n&&(clearTimeout(n),o("cancel")),n=window.setTimeout(()=>{e.apply(void 0,r),n=0,o("done")},t)})},No=()=>`${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`,cu=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),np=new Set(["__proto__","constructor","prototype"]),rp=e=>!np.has(e),Io=(e,t,n={})=>{if(Array.isArray(e)&&Array.isArray(t))return Oo(e,t,n);const{excludeKeys:r}=n,o=e,u=t;for(const a of Object.keys(u)){if(!rp(a))continue;const s=u[a],l=o[a];r&&r(a)?o[a]=s:Array.isArray(s)&&Array.isArray(l)?o[a]=Oo(l,s,n):cu(s)&&cu(l)?o[a]=Io(l,s,n):o[a]=s}return e},Oo=(e,t,n)=>{const r=e.slice();return t.forEach((o,u)=>{const a=r[u];Array.isArray(o)&&Array.isArray(a)?r[u]=Oo(a,o,n):cu(o)&&cu(a)?r[u]=Io(a,o,n):r[u]=o}),r},Y="md-editor",de="https://unpkg.com",up=`${de}/@highlightjs/cdn-assets@11.11.1/highlight.min.js`,hs={main:`${de}/prettier@3.8.1/standalone.js`,markdown:`${de}/prettier@3.8.1/plugins/markdown.js`},op={css:`${de}/cropperjs@1.6.2/dist/cropper.min.css`,js:`${de}/cropperjs@1.6.2/dist/cropper.min.js`},ip=`${de}/screenfull@5.2.0/dist/screenfull.js`,ap=`${de}/mermaid@11.12.3/dist/mermaid.min.js`,sp={js:`${de}/katex@0.16.33/dist/katex.min.js`,css:`${de}/katex@0.16.33/dist/katex.min.css`},Lo={a11y:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/a11y-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/a11y-dark.min.css`},atom:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/atom-one-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/atom-one-dark.min.css`},github:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/github.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/github-dark.min.css`},gradient:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/gradient-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/gradient-dark.min.css`},kimbie:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/kimbie-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/kimbie-dark.min.css`},paraiso:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/paraiso-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/paraiso-dark.min.css`},qtcreator:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/qtcreator-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/qtcreator-dark.min.css`},stackoverflow:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-dark.min.css`}},lp=`${de}/echarts@6.0.0/dist/echarts.min.js`,ps={"zh-CN":{toolbarTips:{bold:"加粗",underline:"下划线",italic:"斜体",strikeThrough:"删除线",title:"标题",sub:"下标",sup:"上标",quote:"引用",unorderedList:"无序列表",orderedList:"有序列表",task:"任务列表",codeRow:"行内代码",code:"块级代码",link:"链接",image:"图片",table:"表格",mermaid:"mermaid图",katex:"katex公式",revoke:"后退",next:"前进",save:"保存",prettier:"美化",pageFullscreen:"浏览器全屏",fullscreen:"屏幕全屏",preview:"预览",previewOnly:"仅预览",htmlPreview:"html代码预览",catalog:"目录",github:"源码地址"},titleItem:{h1:"一级标题",h2:"二级标题",h3:"三级标题",h4:"四级标题",h5:"五级标题",h6:"六级标题"},imgTitleItem:{link:"添加链接",upload:"上传图片",clip2upload:"裁剪上传"},linkModalTips:{linkTitle:"添加链接",imageTitle:"添加图片",descLabel:"链接描述:",descLabelPlaceHolder:"请输入描述...",urlLabel:"链接地址:",urlLabelPlaceHolder:"请输入链接...",buttonOK:"确定"},clipModalTips:{title:"裁剪图片上传",buttonUpload:"上传"},copyCode:{text:"复制代码",successTips:"已复制!",failTips:"复制失败!"},mermaid:{flow:"流程图",sequence:"时序图",gantt:"甘特图",class:"类图",state:"状态图",pie:"饼图",relationship:"关系图",journey:"旅程图"},katex:{inline:"行内公式",block:"块级公式"},footer:{markdownTotal:"字数",scrollAuto:"同步滚动"}},"en-US":{toolbarTips:{bold:"bold",underline:"underline",italic:"italic",strikeThrough:"strikeThrough",title:"title",sub:"subscript",sup:"superscript",quote:"quote",unorderedList:"unordered list",orderedList:"ordered list",task:"task list",codeRow:"inline code",code:"block-level code",link:"link",image:"image",table:"table",mermaid:"mermaid",katex:"formula",revoke:"revoke",next:"undo revoke",save:"save",prettier:"prettier",pageFullscreen:"fullscreen in page",fullscreen:"fullscreen",preview:"preview",previewOnly:"preview only",htmlPreview:"html preview",catalog:"catalog",github:"source code"},titleItem:{h1:"Lv1 Heading",h2:"Lv2 Heading",h3:"Lv3 Heading",h4:"Lv4 Heading",h5:"Lv5 Heading",h6:"Lv6 Heading"},imgTitleItem:{link:"Add Image Link",upload:"Upload Images",clip2upload:"Crop And Upload"},linkModalTips:{linkTitle:"Add Link",imageTitle:"Add Image",descLabel:"Desc:",descLabelPlaceHolder:"Enter a description...",urlLabel:"Link:",urlLabelPlaceHolder:"Enter a link...",buttonOK:"OK"},clipModalTips:{title:"Crop Image",buttonUpload:"Upload"},copyCode:{text:"Copy",successTips:"Copied!",failTips:"Copy failed!"},mermaid:{flow:"flow",sequence:"sequence",gantt:"gantt",class:"class",state:"state",pie:"pie",relationship:"relationship",journey:"journey"},katex:{inline:"inline",block:"block"},footer:{markdownTotal:"Character Count",scrollAuto:"Scroll Auto"}}},lt={editorExtensions:{highlight:{js:up,css:Lo},prettier:{standaloneJs:hs.main,parserMarkdownJs:hs.markdown},cropper:{...op},screenfull:{js:ip},mermaid:{js:ap,enableZoom:!0},katex:{...sp},echarts:{js:lp}},editorExtensionsAttrs:{},editorConfig:{languageUserDefined:{},mermaidTemplate:{},renderDelay:500,zIndex:2e4},codeMirrorExtensions:e=>e,markdownItConfig:()=>{},markdownItPlugins:e=>e,mermaidConfig:e=>e,katexConfig:e=>e,echartsConfig:e=>e},cp=({instance:e,ctx:t,props:n={}},r="default")=>{const o=(e==null?void 0:e.$slots[r])||(t==null?void 0:t.slots[r]);return(o?o(e):"")||n[r]},dp="buildFinished",Vo="errorCatcher",Po="catalogChanged",fp="pushCatalog",ms="rerender",hp="taskStateChanged";class pp{constructor(){fe(this,"pools",{})}remove(t,n,r){const o=this.pools[t]&&this.pools[t][n];o&&(this.pools[t][n]=o.filter(u=>u!==r))}clear(t){this.pools[t]={}}on(t,n){return this.pools[t]||(this.pools[t]={}),this.pools[t][n.name]||(this.pools[t][n.name]=[]),this.pools[t][n.name].push(n.callback),this.pools[t][n.name].includes(n.callback)}emit(t,n,...r){this.pools[t]||(this.pools[t]={});const o=this.pools[t][n];o&&o.forEach(u=>{try{u(...r)}catch(a){console.error(`${n} monitor event exception!`,a)}})}}const ot=new pp,mp=(e,t)=>{if(!e)return e;const n=t.split(`
33
33
  `),r=['<span rn-wrapper aria-hidden="true">'];return n.forEach(()=>{r.push("<span></span>")}),r.push("</span>"),`<span class="${Y}-code-block">${e}</span>${r.join("")}`};async function gs(e){if(typeof e=="string"){if(window.isSecureContext&&navigator.clipboard)return await navigator.clipboard.writeText(e);{const t=document.createElement("textarea");let n=!1;if(t.value=e,t.style.position="fixed",t.style.opacity=0,t.style.zIndex="-10000",t.style.top="-10000",document.body.appendChild(t),t.select(),n=document.execCommand("copy"),document.body.removeChild(t),n)return;throw new Error('Failed to copy content via "execCommand"!')}}}const gp={copy:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy ${Y}-icon"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,"collapse-tips":`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-chevron-left ${Y}-icon"><circle cx="12" cy="12" r="10"/><path d="m14 16-4-4 4-4"/></svg>`,pin:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pin ${Y}-icon"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg>`,"pin-off":`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pin-off ${Y}-icon"><path d="M12 17v5"/><path d="M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89"/><path d="m2 2 20 20"/><path d="M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11"/></svg>`,check:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check ${Y}-icon"><path d="M20 6 9 17l-5-5"/></svg>`},St=(e,t)=>typeof t[e]=="string"?t[e]:gp[e],Ht=(e,t,n="")=>{var o;const r=document.getElementById(t.id);if(r)n!==""&&(Reflect.get(window,n)?(o=t.onload)==null||o.call(r,new Event("load")):t.onload&&r.addEventListener("load",t.onload));else{const u={...t};u.onload=null;const a=yp(e,u);t.onload&&a.addEventListener("load",t.onload),document.head.appendChild(a)}},bp=(e,t)=>{var n;(n=document.getElementById(t.id))==null||n.remove(),Ht(e,t)},yp=(e,t)=>{const n=document.createElement(e);return Object.keys(t).forEach(r=>{t[r]!==void 0&&(n[r]=t[r])}),n},xp=(e,t)=>{const n=new Map;return e==null||e.forEach(r=>{let o=r.querySelector(`.${Y}-mermaid-action`);o?o.querySelector(`.${Y}-mermaid-copy`)||o.insertAdjacentHTML("beforeend",`<span class="${Y}-mermaid-copy">${St("copy",t.customIcon)}</span>`):(r.insertAdjacentHTML("beforeend",`<div class="${Y}-mermaid-action"><span class="${Y}-mermaid-copy">${St("copy",t.customIcon)}</span></div>`),o=r.querySelector(`.${Y}-mermaid-action`));const u=o.querySelector(`.${Y}-mermaid-copy`);let a=-1;const s=()=>{clearTimeout(a),gs(r.dataset.content||"").then(()=>{u.innerHTML=St("check",t.customIcon)}).catch(()=>{u.innerHTML=St("copy",t.customIcon)}).finally(()=>{a=window.setTimeout(()=>{u.innerHTML=St("copy",t.customIcon)},1500)})};u.addEventListener("click",s),n.set(r,{removeClick:()=>{u.removeEventListener("click",s)}})}),()=>{n.forEach(({removeClick:r})=>{r==null||r()}),n.clear()}},wp=(()=>{const e=t=>{if(!t)return()=>{};const n=t.firstChild;let r=1,o=0,u=0,a=!1,s,l,d,f=1;const c=()=>{n.style.transform=`translate(${o}px, ${u}px) scale(${r})`},h=x=>{x.touches.length===1?(a=!0,s=x.touches[0].clientX-o,l=x.touches[0].clientY-u):x.touches.length===2&&(d=Math.hypot(x.touches[0].clientX-x.touches[1].clientX,x.touches[0].clientY-x.touches[1].clientY),f=r)},m=x=>{if(x.preventDefault(),a&&x.touches.length===1)o=x.touches[0].clientX-s,u=x.touches[0].clientY-l,c();else if(x.touches.length===2){const k=Math.hypot(x.touches[0].clientX-x.touches[1].clientX,x.touches[0].clientY-x.touches[1].clientY)/d,T=r;r=f*(1+(k-1));const D=(x.touches[0].clientX+x.touches[1].clientX)/2,S=(x.touches[0].clientY+x.touches[1].clientY)/2,X=n.getBoundingClientRect(),z=(D-X.left)/T,B=(S-X.top)/T;o-=z*(r-T),u-=B*(r-T),c()}},p=()=>{a=!1},w=x=>{x.preventDefault();const k=.02,T=r;x.deltaY<0?r+=k:r=Math.max(.1,r-k);const D=n.getBoundingClientRect(),S=x.clientX-D.left,X=x.clientY-D.top;o-=S/T*(r-T),u-=X/T*(r-T),c()},y=x=>{a=!0,s=x.clientX-o,l=x.clientY-u},A=x=>{a&&(o=x.clientX-s,u=x.clientY-l,c())},b=()=>{a=!1},g=()=>{a=!1};return t.addEventListener("touchstart",h,{passive:!1}),t.addEventListener("touchmove",m,{passive:!1}),t.addEventListener("touchend",p),t.addEventListener("wheel",w,{passive:!1}),t.addEventListener("mousedown",y),t.addEventListener("mousemove",A),t.addEventListener("mouseup",b),t.addEventListener("mouseleave",g),()=>{t.removeEventListener("touchstart",h),t.removeEventListener("touchmove",m),t.removeEventListener("touchend",p),t.removeEventListener("wheel",w),t.removeEventListener("mousedown",y),t.removeEventListener("mousemove",A),t.removeEventListener("mouseup",b),t.removeEventListener("mouseleave",g)}};return(t,n)=>{const r=new Map;return t==null||t.forEach(o=>{let u=o.querySelector(`.${Y}-mermaid-action`);u?u.querySelector(`.${Y}-mermaid-zoom`)||u.insertAdjacentHTML("beforeend",`<span class="${Y}-mermaid-zoom">${St("pin-off",n.customIcon)}</span>`):(o.insertAdjacentHTML("beforeend",`<div class="${Y}-mermaid-action"><span class="${Y}-mermaid-zoom">${St("pin-off",n.customIcon)}</span></div>`),u=o.querySelector(`.${Y}-mermaid-action`));const a=u.querySelector(`.${Y}-mermaid-zoom`),s=()=>{const l=r.get(o);if(l!=null&&l.removeEvent)l.removeEvent(),o.removeAttribute("data-grab"),r.set(o,{removeClick:l.removeClick}),a.innerHTML=St("pin-off",n.customIcon);else{const d=e(o);o.setAttribute("data-grab",""),r.set(o,{removeEvent:d,removeClick:l==null?void 0:l.removeClick}),a.innerHTML=St("pin",n.customIcon)}};a.addEventListener("click",s),r.set(o,{removeClick:()=>a.removeEventListener("click",s)})}),()=>{r.forEach(({removeEvent:o,removeClick:u})=>{o==null||o(),u==null||u()}),r.clear()}}})(),bs=new Set([!0,!1,"alt","title"]);function ys(e,t){return(Array.isArray(e)?e:[]).filter(([n])=>n!==t)}function xs(e,t){e&&e.attrs&&(e.attrs=ys(e.attrs,t))}function vp(e,t){if(!bs.has(e))throw new TypeError(`figcaption must be one of: ${[...bs]}.`);if(e==="alt")return t.content;const n=t.attrs.find(([r])=>r==="title");return Array.isArray(n)&&n[1]?(xs(t,"title"),n[1]):void 0}function Ap(e,t){t=t||{},e.core.ruler.before("linkify","image_figures",function(n){let r=1;for(let o=1,u=n.tokens.length;o<u-1;++o){const a=n.tokens[o];if(a.type!=="inline"||!a.children||a.children.length!==1&&a.children.length!==3||a.children.length===1&&a.children[0].type!=="image")continue;if(a.children.length===3){const[d,f,c]=a.children;if(d.type!=="link_open"||f.type!=="image"||c.type!=="link_close")continue}if(o!==0&&n.tokens[o-1].type!=="paragraph_open"||o!==u-1&&n.tokens[o+1].type!=="paragraph_close")continue;const s=n.tokens[o-1];let l;if(s.type="figure_open",s.tag="figure",n.tokens[o+1].type="figure_close",n.tokens[o+1].tag="figure",t.dataType&&n.tokens[o-1].attrPush(["data-type","image"]),t.link&&a.children.length===1){[l]=a.children;const d=new n.Token("link_open","a",1);d.attrPush(["href",l.attrGet("src")]),a.children.unshift(d),a.children.push(new n.Token("link_close","a",-1))}if(l=a.children.length===1?a.children[0]:a.children[1],t.figcaption){const d=vp(t.figcaption,l);if(d){const[f]=e.parseInline(d,n.env);a.children.push(new n.Token("figcaption_open","figcaption",1)),a.children.push(...f.children),a.children.push(new n.Token("figcaption_close","figcaption",-1)),l.attrs&&(l.attrs=ys(l.attrs,"title"))}}if(t.copyAttrs&&l.attrs){const d=t.copyAttrs===!0?"":t.copyAttrs;s.attrs=l.attrs.filter(([f])=>f.match(d)).map(f=>Array.from(f))}if(t.tabindex&&(n.tokens[o-1].attrPush(["tabindex",r]),r++),t.lazy&&(l.attrs.some(([d])=>d==="loading")||l.attrs.push(["loading","lazy"])),t.async&&(l.attrs.some(([d])=>d==="decoding")||l.attrs.push(["decoding","async"])),t.classes&&typeof t.classes=="string"){let d=!1;for(let f=0,c=l.attrs.length;f<c&&!d;f++){const h=l.attrs[f];h[0]==="class"&&(h[1]=`${h[1]} ${t.classes}`,d=!0)}d||l.attrs.push(["class",t.classes])}if(t.removeSrc){const d=l.attrs.find(([f])=>f==="src");l.attrs.push(["data-src",d[1]]),xs(l,"src")}}})}const kp=/\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g;function Cp(e,t){const n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==126||t||r+2>=n)return!1;e.pos=r+1;let o=!1;for(;e.pos<n;){if(e.src.charCodeAt(e.pos)===126){o=!0;break}e.md.inline.skipToken(e)}if(!o||r+1===e.pos)return e.pos=r,!1;const u=e.src.slice(r+1,e.pos);if(u.match(/(^|[^\\])(\\\\)*\s/))return e.pos=r,!1;e.posMax=e.pos,e.pos=r+1;const a=e.push("sub_open","sub",1);a.markup="~";const s=e.push("text","",0);s.content=u.replace(kp,"$1");const l=e.push("sub_close","sub",-1);return l.markup="~",e.pos=e.posMax+1,e.posMax=n,!0}function _p(e){e.inline.ruler.after("emphasis","sub",Cp)}const Ep=/\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g;function Sp(e,t){const n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==94||t||r+2>=n)return!1;e.pos=r+1;let o=!1;for(;e.pos<n;){if(e.src.charCodeAt(e.pos)===94){o=!0;break}e.md.inline.skipToken(e)}if(!o||r+1===e.pos)return e.pos=r,!1;const u=e.src.slice(r+1,e.pos);if(u.match(/(^|[^\\])(\\\\)*\s/))return e.pos=r,!1;e.posMax=e.pos,e.pos=r+1;const a=e.push("sup_open","sup",1);a.markup="^";const s=e.push("text","",0);s.content=u.replace(Ep,"$1");const l=e.push("sup_close","sup",-1);return l.markup="^",e.pos=e.posMax+1,e.posMax=n,!0}function Dp(e){e.inline.ruler.after("emphasis","sup",Sp)}var Fp=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ws=new Set,Ro=typeof process=="object"&&process?process:{},vs=(e,t,n,r)=>{typeof Ro.emitWarning=="function"?Ro.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},du=globalThis.AbortController,As=globalThis.AbortSignal;if(typeof du>"u"){As=class{constructor(){fe(this,"onabort");fe(this,"_onabort",[]);fe(this,"reason");fe(this,"aborted",!1)}addEventListener(n,r){this._onabort.push(r)}},du=class{constructor(){fe(this,"signal",new As);t()}abort(n){var r,o;if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let u of this.signal._onabort)u(n);(o=(r=this.signal).onabort)==null||o.call(r,n)}}};let e=((Dl=Ro.env)==null?void 0:Dl.LRU_CACHE_IGNORE_AC_WARNING)!=="1",t=()=>{e&&(e=!1,vs("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var Tp=e=>!ws.has(e),$t=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),ks=e=>$t(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?fu:null:null,fu=class extends Array{constructor(t){super(t),this.fill(0)}},Np=(Dt=class{constructor(t,n){fe(this,"heap");fe(this,"length");if(!v(Dt,Dn))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(t),this.length=0}static create(t){let n=ks(t);if(!n)return[];ne(Dt,Dn,!0);let r=new Dt(t,n);return ne(Dt,Dn,!1),r}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Dn=new WeakMap,ie(Dt,Dn,!1),Dt),Ip=(On=class{constructor(t){ie(this,q);ie(this,it);ie(this,Je);ie(this,ct);ie(this,rn);ie(this,dt);ie(this,Fn);ie(this,Tn);ie(this,ft);fe(this,"ttl");fe(this,"ttlResolution");fe(this,"ttlAutopurge");fe(this,"updateAgeOnGet");fe(this,"updateAgeOnHas");fe(this,"allowStale");fe(this,"noDisposeOnSet");fe(this,"noUpdateTTL");fe(this,"maxEntrySize");fe(this,"sizeCalculation");fe(this,"noDeleteOnFetchRejection");fe(this,"noDeleteOnStaleGet");fe(this,"allowStaleOnFetchAbort");fe(this,"allowStaleOnFetchRejection");fe(this,"ignoreFetchAbort");ie(this,ke);ie(this,ht);ie(this,we);ie(this,he);ie(this,re);ie(this,$e);ie(this,et);ie(this,Re);ie(this,Se);ie(this,pt);ie(this,De);ie(this,mt);ie(this,gt);ie(this,tt);ie(this,nt);ie(this,bt);ie(this,Gt);ie(this,Ue);ie(this,Nn);ie(this,un,()=>{});ie(this,It,()=>{});ie(this,Sr,()=>{});ie(this,rt,()=>!1);ie(this,on,t=>{});ie(this,In,(t,n,r)=>{});ie(this,Dr,(t,n,r,o)=>{if(r||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});fe(this,Fl,"LRUCache");let{max:n=0,ttl:r,ttlResolution:o=1,ttlAutopurge:u,updateAgeOnGet:a,updateAgeOnHas:s,allowStale:l,dispose:d,onInsert:f,disposeAfter:c,noDisposeOnSet:h,noUpdateTTL:m,maxSize:p=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:A,memoMethod:b,noDeleteOnFetchRejection:g,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:T,ignoreFetchAbort:D,perf:S}=t;if(S!==void 0&&typeof(S==null?void 0:S.now)!="function")throw new TypeError("perf option must have a now() method if specified");if(ne(this,ft,S??Fp),n!==0&&!$t(n))throw new TypeError("max option must be a nonnegative integer");let X=n?ks(n):Array;if(!X)throw new Error("invalid max value: "+n);if(ne(this,it,n),ne(this,Je,p),this.maxEntrySize=w||v(this,Je),this.sizeCalculation=y,this.sizeCalculation){if(!v(this,Je)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(ne(this,Tn,b),A!==void 0&&typeof A!="function")throw new TypeError("fetchMethod must be a function if specified");if(ne(this,Fn,A),ne(this,Gt,!!A),ne(this,we,new Map),ne(this,he,new Array(n).fill(void 0)),ne(this,re,new Array(n).fill(void 0)),ne(this,$e,new X(n)),ne(this,et,new X(n)),ne(this,Re,0),ne(this,Se,0),ne(this,pt,Np.create(n)),ne(this,ke,0),ne(this,ht,0),typeof d=="function"&&ne(this,ct,d),typeof f=="function"&&ne(this,rn,f),typeof c=="function"?(ne(this,dt,c),ne(this,De,[])):(ne(this,dt,void 0),ne(this,De,void 0)),ne(this,bt,!!v(this,ct)),ne(this,Nn,!!v(this,rn)),ne(this,Ue,!!v(this,dt)),this.noDisposeOnSet=!!h,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!g,this.allowStaleOnFetchRejection=!!k,this.allowStaleOnFetchAbort=!!T,this.ignoreFetchAbort=!!D,this.maxEntrySize!==0){if(v(this,Je)!==0&&!$t(v(this,Je)))throw new TypeError("maxSize must be a positive integer if specified");if(!$t(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Q(this,q,Zl).call(this)}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!s,this.ttlResolution=$t(o)||o===0?o:1,this.ttlAutopurge=!!u,this.ttl=r||0,this.ttl){if(!$t(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Q(this,q,li).call(this)}if(v(this,it)===0&&this.ttl===0&&v(this,Je)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!v(this,it)&&!v(this,Je)){let z="LRU_CACHE_UNBOUNDED";Tp(z)&&(ws.add(z),vs("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",z,On))}}get perf(){return v(this,ft)}static unsafeExposeInternals(t){return{starts:v(t,gt),ttls:v(t,tt),autopurgeTimers:v(t,nt),sizes:v(t,mt),keyMap:v(t,we),keyList:v(t,he),valList:v(t,re),next:v(t,$e),prev:v(t,et),get head(){return v(t,Re)},get tail(){return v(t,Se)},free:v(t,pt),isBackgroundFetch:n=>{var r;return Q(r=t,q,pe).call(r,n)},backgroundFetch:(n,r,o,u)=>{var a;return Q(a=t,q,Bu).call(a,n,r,o,u)},moveToTail:n=>{var r;return Q(r=t,q,Nr).call(r,n)},indexes:n=>{var r;return Q(r=t,q,qt).call(r,n)},rindexes:n=>{var r;return Q(r=t,q,Zt).call(r,n)},isStale:n=>{var r;return v(r=t,rt).call(r,n)}}}get max(){return v(this,it)}get maxSize(){return v(this,Je)}get calculatedSize(){return v(this,ht)}get size(){return v(this,ke)}get fetchMethod(){return v(this,Fn)}get memoMethod(){return v(this,Tn)}get dispose(){return v(this,ct)}get onInsert(){return v(this,rn)}get disposeAfter(){return v(this,dt)}getRemainingTTL(t){return v(this,we).has(t)?1/0:0}*entries(){for(let t of Q(this,q,qt).call(this))v(this,re)[t]!==void 0&&v(this,he)[t]!==void 0&&!Q(this,q,pe).call(this,v(this,re)[t])&&(yield[v(this,he)[t],v(this,re)[t]])}*rentries(){for(let t of Q(this,q,Zt).call(this))v(this,re)[t]!==void 0&&v(this,he)[t]!==void 0&&!Q(this,q,pe).call(this,v(this,re)[t])&&(yield[v(this,he)[t],v(this,re)[t]])}*keys(){for(let t of Q(this,q,qt).call(this)){let n=v(this,he)[t];n!==void 0&&!Q(this,q,pe).call(this,v(this,re)[t])&&(yield n)}}*rkeys(){for(let t of Q(this,q,Zt).call(this)){let n=v(this,he)[t];n!==void 0&&!Q(this,q,pe).call(this,v(this,re)[t])&&(yield n)}}*values(){for(let t of Q(this,q,qt).call(this))v(this,re)[t]!==void 0&&!Q(this,q,pe).call(this,v(this,re)[t])&&(yield v(this,re)[t])}*rvalues(){for(let t of Q(this,q,Zt).call(this))v(this,re)[t]!==void 0&&!Q(this,q,pe).call(this,v(this,re)[t])&&(yield v(this,re)[t])}[(Tl=Symbol.iterator,Fl=Symbol.toStringTag,Tl)](){return this.entries()}find(t,n={}){for(let r of Q(this,q,qt).call(this)){let o=v(this,re)[r],u=Q(this,q,pe).call(this,o)?o.__staleWhileFetching:o;if(u!==void 0&&t(u,v(this,he)[r],this))return this.get(v(this,he)[r],n)}}forEach(t,n=this){for(let r of Q(this,q,qt).call(this)){let o=v(this,re)[r],u=Q(this,q,pe).call(this,o)?o.__staleWhileFetching:o;u!==void 0&&t.call(n,u,v(this,he)[r],this)}}rforEach(t,n=this){for(let r of Q(this,q,Zt).call(this)){let o=v(this,re)[r],u=Q(this,q,pe).call(this,o)?o.__staleWhileFetching:o;u!==void 0&&t.call(n,u,v(this,he)[r],this)}}purgeStale(){let t=!1;for(let n of Q(this,q,Zt).call(this,{allowStale:!0}))v(this,rt).call(this,n)&&(Q(this,q,Yt).call(this,v(this,he)[n],"expire"),t=!0);return t}info(t){let n=v(this,we).get(t);if(n===void 0)return;let r=v(this,re)[n],o=Q(this,q,pe).call(this,r)?r.__staleWhileFetching:r;if(o===void 0)return;let u={value:o};if(v(this,tt)&&v(this,gt)){let a=v(this,tt)[n],s=v(this,gt)[n];if(a&&s){let l=a-(v(this,ft).now()-s);u.ttl=l,u.start=Date.now()}}return v(this,mt)&&(u.size=v(this,mt)[n]),u}dump(){let t=[];for(let n of Q(this,q,qt).call(this,{allowStale:!0})){let r=v(this,he)[n],o=v(this,re)[n],u=Q(this,q,pe).call(this,o)?o.__staleWhileFetching:o;if(u===void 0||r===void 0)continue;let a={value:u};if(v(this,tt)&&v(this,gt)){a.ttl=v(this,tt)[n];let s=v(this,ft).now()-v(this,gt)[n];a.start=Math.floor(Date.now()-s)}v(this,mt)&&(a.size=v(this,mt)[n]),t.unshift([r,a])}return t}load(t){this.clear();for(let[n,r]of t){if(r.start){let o=Date.now()-r.start;r.start=v(this,ft).now()-o}this.set(n,r.value,r)}}set(t,n,r={}){var h,m,p,w,y,A,b;if(n===void 0)return this.delete(t),this;let{ttl:o=this.ttl,start:u,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:l}=r,{noUpdateTTL:d=this.noUpdateTTL}=r,f=v(this,Dr).call(this,t,n,r.size||0,s);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),Q(this,q,Yt).call(this,t,"set"),this;let c=v(this,ke)===0?void 0:v(this,we).get(t);if(c===void 0)c=v(this,ke)===0?v(this,Se):v(this,pt).length!==0?v(this,pt).pop():v(this,ke)===v(this,it)?Q(this,q,Mu).call(this,!1):v(this,ke),v(this,he)[c]=t,v(this,re)[c]=n,v(this,we).set(t,c),v(this,$e)[v(this,Se)]=c,v(this,et)[c]=v(this,Se),ne(this,Se,c),Ru(this,ke)._++,v(this,In).call(this,c,f,l),l&&(l.set="add"),d=!1,v(this,Nn)&&((h=v(this,rn))==null||h.call(this,n,t,"add"));else{Q(this,q,Nr).call(this,c);let g=v(this,re)[c];if(n!==g){if(v(this,Gt)&&Q(this,q,pe).call(this,g)){g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:x}=g;x!==void 0&&!a&&(v(this,bt)&&((m=v(this,ct))==null||m.call(this,x,t,"set")),v(this,Ue)&&((p=v(this,De))==null||p.push([x,t,"set"])))}else a||(v(this,bt)&&((w=v(this,ct))==null||w.call(this,g,t,"set")),v(this,Ue)&&((y=v(this,De))==null||y.push([g,t,"set"])));if(v(this,on).call(this,c),v(this,In).call(this,c,f,l),v(this,re)[c]=n,l){l.set="replace";let x=g&&Q(this,q,pe).call(this,g)?g.__staleWhileFetching:g;x!==void 0&&(l.oldValue=x)}}else l&&(l.set="update");v(this,Nn)&&((A=this.onInsert)==null||A.call(this,n,t,n===g?"update":"replace"))}if(o!==0&&!v(this,tt)&&Q(this,q,li).call(this),v(this,tt)&&(d||v(this,Sr).call(this,c,o,u),l&&v(this,It).call(this,l,c)),!a&&v(this,Ue)&&v(this,De)){let g=v(this,De),x;for(;x=g==null?void 0:g.shift();)(b=v(this,dt))==null||b.call(this,...x)}return this}pop(){var t;try{for(;v(this,ke);){let n=v(this,re)[v(this,Re)];if(Q(this,q,Mu).call(this,!0),Q(this,q,pe).call(this,n)){if(n.__staleWhileFetching)return n.__staleWhileFetching}else if(n!==void 0)return n}}finally{if(v(this,Ue)&&v(this,De)){let n=v(this,De),r;for(;r=n==null?void 0:n.shift();)(t=v(this,dt))==null||t.call(this,...r)}}}has(t,n={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:o}=n,u=v(this,we).get(t);if(u!==void 0){let a=v(this,re)[u];if(Q(this,q,pe).call(this,a)&&a.__staleWhileFetching===void 0)return!1;if(v(this,rt).call(this,u))o&&(o.has="stale",v(this,It).call(this,o,u));else return r&&v(this,un).call(this,u),o&&(o.has="hit",v(this,It).call(this,o,u)),!0}else o&&(o.has="miss");return!1}peek(t,n={}){let{allowStale:r=this.allowStale}=n,o=v(this,we).get(t);if(o===void 0||!r&&v(this,rt).call(this,o))return;let u=v(this,re)[o];return Q(this,q,pe).call(this,u)?u.__staleWhileFetching:u}async fetch(t,n={}){let{allowStale:r=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:u=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:l=0,sizeCalculation:d=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=!1,status:A,signal:b}=n;if(!v(this,Gt))return A&&(A.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:o,noDeleteOnStaleGet:u,status:A});let g={allowStale:r,updateAgeOnGet:o,noDeleteOnStaleGet:u,ttl:a,noDisposeOnSet:s,size:l,sizeCalculation:d,noUpdateTTL:f,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:p,ignoreFetchAbort:m,status:A,signal:b},x=v(this,we).get(t);if(x===void 0){A&&(A.fetch="miss");let k=Q(this,q,Bu).call(this,t,x,g,w);return k.__returned=k}else{let k=v(this,re)[x];if(Q(this,q,pe).call(this,k)){let X=r&&k.__staleWhileFetching!==void 0;return A&&(A.fetch="inflight",X&&(A.returnedStale=!0)),X?k.__staleWhileFetching:k.__returned=k}let T=v(this,rt).call(this,x);if(!y&&!T)return A&&(A.fetch="hit"),Q(this,q,Nr).call(this,x),o&&v(this,un).call(this,x),A&&v(this,It).call(this,A,x),k;let D=Q(this,q,Bu).call(this,t,x,g,w),S=D.__staleWhileFetching!==void 0&&r;return A&&(A.fetch=T?"stale":"refresh",S&&T&&(A.returnedStale=!0)),S?D.__staleWhileFetching:D.__returned=D}}async forceFetch(t,n={}){let r=await this.fetch(t,n);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,n={}){let r=v(this,Tn);if(!r)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:u,...a}=n,s=this.get(t,a);if(!u&&s!==void 0)return s;let l=r(t,s,{options:a,context:o});return this.set(t,l,a),l}get(t,n={}){let{allowStale:r=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:u=this.noDeleteOnStaleGet,status:a}=n,s=v(this,we).get(t);if(s!==void 0){let l=v(this,re)[s],d=Q(this,q,pe).call(this,l);return a&&v(this,It).call(this,a,s),v(this,rt).call(this,s)?(a&&(a.get="stale"),d?(a&&r&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),r?l.__staleWhileFetching:void 0):(u||Q(this,q,Yt).call(this,t,"expire"),a&&r&&(a.returnedStale=!0),r?l:void 0)):(a&&(a.get="hit"),d?l.__staleWhileFetching:(Q(this,q,Nr).call(this,s),o&&v(this,un).call(this,s),l))}else a&&(a.get="miss")}delete(t){return Q(this,q,Yt).call(this,t,"delete")}clear(){return Q(this,q,fi).call(this,"delete")}},it=new WeakMap,Je=new WeakMap,ct=new WeakMap,rn=new WeakMap,dt=new WeakMap,Fn=new WeakMap,Tn=new WeakMap,ft=new WeakMap,ke=new WeakMap,ht=new WeakMap,we=new WeakMap,he=new WeakMap,re=new WeakMap,$e=new WeakMap,et=new WeakMap,Re=new WeakMap,Se=new WeakMap,pt=new WeakMap,De=new WeakMap,mt=new WeakMap,gt=new WeakMap,tt=new WeakMap,nt=new WeakMap,bt=new WeakMap,Gt=new WeakMap,Ue=new WeakMap,Nn=new WeakMap,q=new WeakSet,li=function(){let t=new fu(v(this,it)),n=new fu(v(this,it));ne(this,tt,t),ne(this,gt,n);let r=this.ttlAutopurge?new Array(v(this,it)):void 0;ne(this,nt,r),ne(this,Sr,(s,l,d=v(this,ft).now())=>{n[s]=l!==0?d:0,t[s]=l,o(s,l)}),ne(this,un,s=>{n[s]=t[s]!==0?v(this,ft).now():0,o(s,t[s])});let o=this.ttlAutopurge?(s,l)=>{if(r!=null&&r[s]&&(clearTimeout(r[s]),r[s]=void 0),l&&l!==0&&r){let d=setTimeout(()=>{v(this,rt).call(this,s)&&Q(this,q,Yt).call(this,v(this,he)[s],"expire")},l+1);d.unref&&d.unref(),r[s]=d}}:()=>{};ne(this,It,(s,l)=>{if(t[l]){let d=t[l],f=n[l];if(!d||!f)return;s.ttl=d,s.start=f,s.now=u||a();let c=s.now-f;s.remainingTTL=d-c}});let u=0,a=()=>{let s=v(this,ft).now();if(this.ttlResolution>0){u=s;let l=setTimeout(()=>u=0,this.ttlResolution);l.unref&&l.unref()}return s};this.getRemainingTTL=s=>{let l=v(this,we).get(s);if(l===void 0)return 0;let d=t[l],f=n[l];if(!d||!f)return 1/0;let c=(u||a())-f;return d-c},ne(this,rt,s=>{let l=n[s],d=t[s];return!!d&&!!l&&(u||a())-l>d})},un=new WeakMap,It=new WeakMap,Sr=new WeakMap,rt=new WeakMap,Zl=function(){let t=new fu(v(this,it));ne(this,ht,0),ne(this,mt,t),ne(this,on,n=>{ne(this,ht,v(this,ht)-t[n]),t[n]=0}),ne(this,Dr,(n,r,o,u)=>{if(Q(this,q,pe).call(this,r))return 0;if(!$t(o))if(u){if(typeof u!="function")throw new TypeError("sizeCalculation must be a function");if(o=u(r,n),!$t(o))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return o}),ne(this,In,(n,r,o)=>{if(t[n]=r,v(this,Je)){let u=v(this,Je)-t[n];for(;v(this,ht)>u;)Q(this,q,Mu).call(this,!0)}ne(this,ht,v(this,ht)+t[n]),o&&(o.entrySize=r,o.totalCalculatedSize=v(this,ht))})},on=new WeakMap,In=new WeakMap,Dr=new WeakMap,qt=function*({allowStale:t=this.allowStale}={}){if(v(this,ke))for(let n=v(this,Se);!(!Q(this,q,ci).call(this,n)||((t||!v(this,rt).call(this,n))&&(yield n),n===v(this,Re)));)n=v(this,et)[n]},Zt=function*({allowStale:t=this.allowStale}={}){if(v(this,ke))for(let n=v(this,Re);!(!Q(this,q,ci).call(this,n)||((t||!v(this,rt).call(this,n))&&(yield n),n===v(this,Se)));)n=v(this,$e)[n]},ci=function(t){return t!==void 0&&v(this,we).get(v(this,he)[t])===t},Mu=function(t){var u,a,s;let n=v(this,Re),r=v(this,he)[n],o=v(this,re)[n];return v(this,Gt)&&Q(this,q,pe).call(this,o)?o.__abortController.abort(new Error("evicted")):(v(this,bt)||v(this,Ue))&&(v(this,bt)&&((u=v(this,ct))==null||u.call(this,o,r,"evict")),v(this,Ue)&&((a=v(this,De))==null||a.push([o,r,"evict"]))),v(this,on).call(this,n),(s=v(this,nt))!=null&&s[n]&&(clearTimeout(v(this,nt)[n]),v(this,nt)[n]=void 0),t&&(v(this,he)[n]=void 0,v(this,re)[n]=void 0,v(this,pt).push(n)),v(this,ke)===1?(ne(this,Re,ne(this,Se,0)),v(this,pt).length=0):ne(this,Re,v(this,$e)[n]),v(this,we).delete(r),Ru(this,ke)._--,n},Bu=function(t,n,r,o){let u=n===void 0?void 0:v(this,re)[n];if(Q(this,q,pe).call(this,u))return u;let a=new du,{signal:s}=r;s==null||s.addEventListener("abort",()=>a.abort(s.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:o},d=(w,y=!1)=>{let{aborted:A}=a.signal,b=r.ignoreFetchAbort&&w!==void 0,g=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&w!==void 0);if(r.status&&(A&&!y?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,b&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),A&&!b&&!y)return c(a.signal.reason,g);let x=m,k=v(this,re)[n];return(k===m||b&&y&&k===void 0)&&(w===void 0?x.__staleWhileFetching!==void 0?v(this,re)[n]=x.__staleWhileFetching:Q(this,q,Yt).call(this,t,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(t,w,l.options))),w},f=w=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=w),c(w,!1)),c=(w,y)=>{let{aborted:A}=a.signal,b=A&&r.allowStaleOnFetchAbort,g=b||r.allowStaleOnFetchRejection,x=g||r.noDeleteOnFetchRejection,k=m;if(v(this,re)[n]===m&&(!x||!y&&k.__staleWhileFetching===void 0?Q(this,q,Yt).call(this,t,"fetch"):b||(v(this,re)[n]=k.__staleWhileFetching)),g)return r.status&&k.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),k.__staleWhileFetching;if(k.__returned===k)throw w},h=(w,y)=>{var b;let A=(b=v(this,Fn))==null?void 0:b.call(this,t,u,l);A&&A instanceof Promise&&A.then(g=>w(g===void 0?void 0:g),y),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(w(void 0),r.allowStaleOnFetchAbort&&(w=g=>d(g,!0)))})};r.status&&(r.status.fetchDispatched=!0);let m=new Promise(h).then(d,f),p=Object.assign(m,{__abortController:a,__staleWhileFetching:u,__returned:void 0});return n===void 0?(this.set(t,p,{...l.options,status:void 0}),n=v(this,we).get(t)):v(this,re)[n]=p,p},pe=function(t){if(!v(this,Gt))return!1;let n=t;return!!n&&n instanceof Promise&&n.hasOwnProperty("__staleWhileFetching")&&n.__abortController instanceof du},di=function(t,n){v(this,et)[n]=t,v(this,$e)[t]=n},Nr=function(t){t!==v(this,Se)&&(t===v(this,Re)?ne(this,Re,v(this,$e)[t]):Q(this,q,di).call(this,v(this,et)[t],v(this,$e)[t]),Q(this,q,di).call(this,v(this,Se),t),ne(this,Se,t))},Yt=function(t,n){var o,u,a,s,l,d;let r=!1;if(v(this,ke)!==0){let f=v(this,we).get(t);if(f!==void 0)if((o=v(this,nt))!=null&&o[f]&&(clearTimeout((u=v(this,nt))==null?void 0:u[f]),v(this,nt)[f]=void 0),r=!0,v(this,ke)===1)Q(this,q,fi).call(this,n);else{v(this,on).call(this,f);let c=v(this,re)[f];if(Q(this,q,pe).call(this,c)?c.__abortController.abort(new Error("deleted")):(v(this,bt)||v(this,Ue))&&(v(this,bt)&&((a=v(this,ct))==null||a.call(this,c,t,n)),v(this,Ue)&&((s=v(this,De))==null||s.push([c,t,n]))),v(this,we).delete(t),v(this,he)[f]=void 0,v(this,re)[f]=void 0,f===v(this,Se))ne(this,Se,v(this,et)[f]);else if(f===v(this,Re))ne(this,Re,v(this,$e)[f]);else{let h=v(this,et)[f];v(this,$e)[h]=v(this,$e)[f];let m=v(this,$e)[f];v(this,et)[m]=v(this,et)[f]}Ru(this,ke)._--,v(this,pt).push(f)}}if(v(this,Ue)&&((l=v(this,De))!=null&&l.length)){let f=v(this,De),c;for(;c=f==null?void 0:f.shift();)(d=v(this,dt))==null||d.call(this,...c)}return r},fi=function(t){var n,r,o,u;for(let a of Q(this,q,Zt).call(this,{allowStale:!0})){let s=v(this,re)[a];if(Q(this,q,pe).call(this,s))s.__abortController.abort(new Error("deleted"));else{let l=v(this,he)[a];v(this,bt)&&((n=v(this,ct))==null||n.call(this,s,l,t)),v(this,Ue)&&((r=v(this,De))==null||r.push([s,l,t]))}}if(v(this,we).clear(),v(this,re).fill(void 0),v(this,he).fill(void 0),v(this,tt)&&v(this,gt)){v(this,tt).fill(0),v(this,gt).fill(0);for(let a of v(this,nt)??[])a!==void 0&&clearTimeout(a);(o=v(this,nt))==null||o.fill(void 0)}if(v(this,mt)&&v(this,mt).fill(0),ne(this,Re,0),ne(this,Se,0),v(this,pt).length=0,ne(this,ht,0),ne(this,ke,0),v(this,Ue)&&v(this,De)){let a=v(this,De),s;for(;s=a==null?void 0:a.shift();)(u=v(this,dt))==null||u.call(this,...s)}},On);/*! medium-zoom 1.1.0 | MIT License | https://github.com/francoischalifour/medium-zoom */var Jt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hu=function(t){return t.tagName==="IMG"},Op=function(t){return NodeList.prototype.isPrototypeOf(t)},pu=function(t){return t&&t.nodeType===1},Cs=function(t){var n=t.currentSrc||t.src;return n.substr(-4).toLowerCase()===".svg"},_s=function(t){try{return Array.isArray(t)?t.filter(hu):Op(t)?[].slice.call(t).filter(hu):pu(t)?[t].filter(hu):typeof t=="string"?[].slice.call(document.querySelectorAll(t)).filter(hu):[]}catch{throw new TypeError(`The provided selector is invalid.
34
34
  Expects a CSS selector, a Node element, a NodeList or an array.
35
35
  See: https://github.com/francoischalifour/medium-zoom`)}},Lp=function(t){var n=document.createElement("div");return n.classList.add("medium-zoom-overlay"),n.style.background=t,n},Vp=function(t){var n=t.getBoundingClientRect(),r=n.top,o=n.left,u=n.width,a=n.height,s=t.cloneNode(),l=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,d=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;return s.removeAttribute("id"),s.style.position="absolute",s.style.top=r+l+"px",s.style.left=o+d+"px",s.style.width=u+"px",s.style.height=a+"px",s.style.transform="",s},kn=function(t,n){var r=Jt({bubbles:!1,cancelable:!1,detail:void 0},n);if(typeof window.CustomEvent=="function")return new CustomEvent(t,r);var o=document.createEvent("CustomEvent");return o.initCustomEvent(t,r.bubbles,r.cancelable,r.detail),o},Pp=function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=window.Promise||function(j){function I(){}j(I,I)},o=function(j){var I=j.target;if(I===X){p();return}g.indexOf(I)!==-1&&w({target:I})},u=function(){if(!(k||!S.original)){var j=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(T-j)>D.scrollOffset&&setTimeout(p,150)}},a=function(j){var I=j.key||j.keyCode;(I==="Escape"||I==="Esc"||I===27)&&p()},s=function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},I=j;if(j.background&&(X.style.background=j.background),j.container&&j.container instanceof Object&&(I.container=Jt({},D.container,j.container)),j.template){var W=pu(j.template)?j.template:document.querySelector(j.template);I.template=W}return D=Jt({},D,I),g.forEach(function(_){_.dispatchEvent(kn("medium-zoom:update",{detail:{zoom:z}}))}),z},l=function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e(Jt({},D,j))},d=function(){for(var j=arguments.length,I=Array(j),W=0;W<j;W++)I[W]=arguments[W];var _=I.reduce(function(C,N){return[].concat(C,_s(N))},[]);return _.filter(function(C){return g.indexOf(C)===-1}).forEach(function(C){g.push(C),C.classList.add("medium-zoom-image")}),x.forEach(function(C){var N=C.type,F=C.listener,O=C.options;_.forEach(function(H){H.addEventListener(N,F,O)})}),z},f=function(){for(var j=arguments.length,I=Array(j),W=0;W<j;W++)I[W]=arguments[W];S.zoomed&&p();var _=I.length>0?I.reduce(function(C,N){return[].concat(C,_s(N))},[]):g;return _.forEach(function(C){C.classList.remove("medium-zoom-image"),C.dispatchEvent(kn("medium-zoom:detach",{detail:{zoom:z}}))}),g=g.filter(function(C){return _.indexOf(C)===-1}),z},c=function(j,I){var W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return g.forEach(function(_){_.addEventListener("medium-zoom:"+j,I,W)}),x.push({type:"medium-zoom:"+j,listener:I,options:W}),z},h=function(j,I){var W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return g.forEach(function(_){_.removeEventListener("medium-zoom:"+j,I,W)}),x=x.filter(function(_){return!(_.type==="medium-zoom:"+j&&_.listener.toString()===I.toString())}),z},m=function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},I=j.target,W=function(){var C={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},N=void 0,F=void 0;if(D.container)if(D.container instanceof Object)C=Jt({},C,D.container),N=C.width-C.left-C.right-D.margin*2,F=C.height-C.top-C.bottom-D.margin*2;else{var O=pu(D.container)?D.container:document.querySelector(D.container),H=O.getBoundingClientRect(),$=H.width,R=H.height,V=H.left,L=H.top;C=Jt({},C,{width:$,height:R,left:V,top:L})}N=N||C.width-D.margin*2,F=F||C.height-D.margin*2;var M=S.zoomedHd||S.original,G=Cs(M)?N:M.naturalWidth||N,J=Cs(M)?F:M.naturalHeight||F,Z=M.getBoundingClientRect(),K=Z.top,ue=Z.left,le=Z.width,Fe=Z.height,Te=Math.min(Math.max(le,G),N)/le,yt=Math.min(Math.max(Fe,J),F)/Fe,Me=Math.min(Te,yt),Ln=(-ue+(N-le)/2+D.margin+C.left)/Me,Xt=(-K+(F-Fe)/2+D.margin+C.top)/Me,Ot="scale("+Me+") translate3d("+Ln+"px, "+Xt+"px, 0)";S.zoomed.style.transform=Ot,S.zoomedHd&&(S.zoomedHd.style.transform=Ot)};return new r(function(_){if(I&&g.indexOf(I)===-1){_(z);return}var C=function $(){k=!1,S.zoomed.removeEventListener("transitionend",$),S.original.dispatchEvent(kn("medium-zoom:opened",{detail:{zoom:z}})),_(z)};if(S.zoomed){_(z);return}if(I)S.original=I;else if(g.length>0){var N=g;S.original=N[0]}else{_(z);return}if(S.original.dispatchEvent(kn("medium-zoom:open",{detail:{zoom:z}})),T=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,k=!0,S.zoomed=Vp(S.original),document.body.appendChild(X),D.template){var F=pu(D.template)?D.template:document.querySelector(D.template);S.template=document.createElement("div"),S.template.appendChild(F.content.cloneNode(!0)),document.body.appendChild(S.template)}if(S.original.parentElement&&S.original.parentElement.tagName==="PICTURE"&&S.original.currentSrc&&(S.zoomed.src=S.original.currentSrc),document.body.appendChild(S.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),S.original.classList.add("medium-zoom-image--hidden"),S.zoomed.classList.add("medium-zoom-image--opened"),S.zoomed.addEventListener("click",p),S.zoomed.addEventListener("transitionend",C),S.original.getAttribute("data-zoom-src")){S.zoomedHd=S.zoomed.cloneNode(),S.zoomedHd.removeAttribute("srcset"),S.zoomedHd.removeAttribute("sizes"),S.zoomedHd.removeAttribute("loading"),S.zoomedHd.src=S.zoomed.getAttribute("data-zoom-src"),S.zoomedHd.onerror=function(){clearInterval(O),console.warn("Unable to reach the zoom image target "+S.zoomedHd.src),S.zoomedHd=null,W()};var O=setInterval(function(){S.zoomedHd.complete&&(clearInterval(O),S.zoomedHd.classList.add("medium-zoom-image--opened"),S.zoomedHd.addEventListener("click",p),document.body.appendChild(S.zoomedHd),W())},10)}else if(S.original.hasAttribute("srcset")){S.zoomedHd=S.zoomed.cloneNode(),S.zoomedHd.removeAttribute("sizes"),S.zoomedHd.removeAttribute("loading");var H=S.zoomedHd.addEventListener("load",function(){S.zoomedHd.removeEventListener("load",H),S.zoomedHd.classList.add("medium-zoom-image--opened"),S.zoomedHd.addEventListener("click",p),document.body.appendChild(S.zoomedHd),W()})}else W()})},p=function(){return new r(function(j){if(k||!S.original){j(z);return}var I=function W(){S.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(S.zoomed),S.zoomedHd&&document.body.removeChild(S.zoomedHd),document.body.removeChild(X),S.zoomed.classList.remove("medium-zoom-image--opened"),S.template&&document.body.removeChild(S.template),k=!1,S.zoomed.removeEventListener("transitionend",W),S.original.dispatchEvent(kn("medium-zoom:closed",{detail:{zoom:z}})),S.original=null,S.zoomed=null,S.zoomedHd=null,S.template=null,j(z)};k=!0,document.body.classList.remove("medium-zoom--opened"),S.zoomed.style.transform="",S.zoomedHd&&(S.zoomedHd.style.transform=""),S.template&&(S.template.style.transition="opacity 150ms",S.template.style.opacity=0),S.original.dispatchEvent(kn("medium-zoom:close",{detail:{zoom:z}})),S.zoomed.addEventListener("transitionend",I)})},w=function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},I=j.target;return S.original?p():m({target:I})},y=function(){return D},A=function(){return g},b=function(){return S.original},g=[],x=[],k=!1,T=0,D=n,S={original:null,zoomed:null,zoomedHd:null,template:null};Object.prototype.toString.call(t)==="[object Object]"?D=t:(t||typeof t=="string")&&d(t),D=Jt({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},D);var X=Lp(D.background);document.addEventListener("click",o),document.addEventListener("keyup",a),document.addEventListener("scroll",u),window.addEventListener("resize",p);var z={open:m,close:p,toggle:w,update:s,clone:l,attach:d,detach:f,on:c,off:h,getOptions:y,getImages:A,getZoomedImage:b};return z};function Rp(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var Mp=".medium-zoom-overlay{position:fixed;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s;will-change:opacity}.medium-zoom--opened .medium-zoom-overlay{cursor:pointer;cursor:zoom-out;opacity:1}.medium-zoom-image{cursor:pointer;cursor:zoom-in;transition:transform .3s cubic-bezier(.2,0,.2,1)!important}.medium-zoom-image--hidden{visibility:hidden}.medium-zoom-image--opened{position:relative;cursor:pointer;cursor:zoom-out;will-change:transform}";Rp(Mp);const Ut={hljs:`${Y}-hljs`,hlcss:`${Y}-hlCss`,mermaidM:`${Y}-mermaid-m`,mermaid:`${Y}-mermaid`,katexjs:`${Y}-katex`,katexcss:`${Y}-katexCss`,echarts:`${Y}-echarts`},Bp=(e,{editorId:t,rootRef:n,setting:r})=>{const o=lt.editorExtensions.highlight,u=lt.editorExtensionsAttrs.highlight;i.provide("editorId",t),i.provide("rootRef",n),i.provide("theme",i.computed(()=>e.theme)),i.provide("language",i.computed(()=>e.language)),i.provide("highlight",i.computed(()=>{const{js:s}=o,l={...Lo,...o.css},{js:d,css:f={}}=u||{},c=e.codeStyleReverse&&e.codeStyleReverseList.includes(e.previewTheme)?"dark":e.theme,h=l[e.codeTheme]?l[e.codeTheme][c]:Lo.atom[c],m=l[e.codeTheme]&&f[e.codeTheme]?f[e.codeTheme][c]:f.atom?f.atom[c]:{};return{js:{src:s,...d},css:{href:h,...m}}})),i.provide("showCodeRowNumber",e.showCodeRowNumber);const a=i.computed(()=>{const s={...ps,...lt.editorConfig.languageUserDefined};return Io(sr(ps["en-US"]),s[e.language]||{})});return i.provide("usedLanguageText",a),i.provide("previewTheme",i.computed(()=>e.previewTheme)),i.provide("customIcon",i.computed(()=>e.customIcon)),i.provide("setting",i.computed(()=>r?{...r}:{preview:!0,htmlPreview:!1,previewOnly:!1,pageFullscreen:!1,fullscreen:!1})),{editorId:t}},zp=e=>{const t=i.useId();return e.id||e.editorId||`${Y}-${t}`},jp=(e,t,n)=>{const r=i.inject("editorId"),o=i.inject("rootRef"),u=i.inject("usedLanguageText"),a=i.inject("setting"),s=()=>{o.value.querySelectorAll(`#${r} .${Y}-preview .${Y}-code`).forEach(f=>{let c=-1;const h=f.querySelector(`.${Y}-copy-button:not([data-processed])`);h&&(h.onclick=m=>{m.preventDefault(),clearTimeout(c);const p=(f.querySelector("input:checked + pre code")||f.querySelector("pre code")).textContent,{text:w,successTips:y,failTips:A}=u.value.copyCode;let b=y;gs(e.formatCopiedText(p||"")).catch(()=>{b=A}).finally(()=>{h.dataset.isIcon?h.dataset.tips=b:h.innerHTML=b,c=window.setTimeout(()=>{h.dataset.isIcon?h.dataset.tips=w:h.innerHTML=w},1500)})},h.setAttribute("data-processed","true"))})},l=()=>{i.nextTick(s)},d=f=>{f&&i.nextTick(s)};i.watch([t,n],l),i.watch(()=>a.value.preview,d),i.watch(()=>a.value.htmlPreview,d),i.onMounted(s)},Hp=e=>{const t=i.inject("editorId"),n=i.inject("theme"),r=i.inject("rootRef"),{editorExtensions:o,editorExtensionsAttrs:u}=lt;let a=o.echarts.instance;const s=i.shallowRef(-1),l=()=>{!e.noEcharts&&a&&(s.value=s.value+1)};i.watch(()=>n.value,()=>{l()}),i.onMounted(()=>{var w;if(e.noEcharts||a)return;const p=o.echarts.js;Ht("script",{...(w=u.echarts)==null?void 0:w.js,src:p,id:Ut.echarts,onload(){a=window.echarts,l()}},"echarts")});let d=[],f=[],c=[];const h=(p=!1)=>{if(!d.length){p&&(f.forEach(b=>{var g;(g=b.dispose)==null||g.call(b)}),c.forEach(b=>{var g;(g=b.disconnect)==null||g.call(b)}),f=[],c=[]);return}const w=[],y=[],A=[];d.forEach((b,g)=>{var T,D;const x=f[g],k=c[g];if(p||!b||!b.isConnected||r!=null&&r.value&&!r.value.contains(b)){(T=x==null?void 0:x.dispose)==null||T.call(x),(D=k==null?void 0:k.disconnect)==null||D.call(k);return}w.push(b),x&&y.push(x),k&&A.push(k)}),d=w,f=y,c=A},m=()=>{h(),!e.noEcharts&&a&&Array.from(r.value.querySelectorAll(`#${t} div.${Y}-echarts:not([data-processed])`)).forEach(p=>{if(p.dataset.closed==="false")return!1;try{const w=new Function(`return ${p.innerText}`)(),y=a.init(p,n.value);y.setOption(w),p.setAttribute("data-processed",""),d.push(p),f.push(y);const A=new ResizeObserver(()=>{y.resize()});A.observe(p),c.push(A)}catch(w){ot.emit(t,Vo,{name:"echarts",message:w==null?void 0:w.message,error:w})}})};return i.onBeforeUnmount(()=>{h(!0)}),{reRenderEcharts:s,replaceEcharts:m}},$p=e=>{const t=i.inject("highlight"),n=i.shallowRef(lt.editorExtensions.highlight.instance);return i.onMounted(()=>{e.noHighlight||n.value||(Ht("link",{...t.value.css,rel:"stylesheet",id:Ut.hlcss}),Ht("script",{...t.value.js,id:Ut.hljs,onload(){n.value=window.hljs}},"hljs"))}),i.watch(()=>t.value.css,()=>{e.noHighlight||lt.editorExtensions.highlight.instance||bp("link",{...t.value.css,rel:"stylesheet",id:Ut.hlcss})}),n},Up=e=>{const t=i.shallowRef(lt.editorExtensions.katex.instance);return i.onMounted(()=>{var o,u;if(e.noKatex||t.value)return;const{editorExtensions:n,editorExtensionsAttrs:r}=lt;Ht("script",{...(o=r.katex)==null?void 0:o.js,src:n.katex.js,id:Ut.katexjs,onload(){t.value=window.katex}},"katex"),Ht("link",{...(u=r.katex)==null?void 0:u.css,rel:"stylesheet",href:n.katex.css,id:Ut.katexcss})}),t},mu=new Ip({max:1e3,ttl:6e5}),Wp=e=>{const t=i.inject("editorId"),n=i.inject("theme"),r=i.inject("rootRef"),{editorExtensions:o,editorExtensionsAttrs:u,mermaidConfig:a}=lt;let s=o.mermaid.instance;const l=i.shallowRef(-1),d=()=>{if(!e.noMermaid&&s){const f=n.value==="dark"?{startOnLoad:!1,theme:"dark"}:{startOnLoad:!1,theme:"base",themeVariables:{background:"#ffffff",primaryColor:"#ffffff",primaryTextColor:"#1f2329",primaryBorderColor:"#b7c0cc",secondaryColor:"#f7f8fa",tertiaryColor:"#f7f8fa",lineColor:"#596273",edgeLabelBackground:"#ffffff",clusterBkg:"#ffffff",clusterBorder:"#b7c0cc"}};s.initialize(a(f)),l.value=l.value+1}};return i.watch(()=>n.value,()=>{mu.clear(),d()}),i.onMounted(()=>{var c,h;if(e.noMermaid||s)return;const f=o.mermaid.js;/\.mjs/.test(f)?(Ht("link",{...(c=u.mermaid)==null?void 0:c.js,rel:"modulepreload",href:f,id:Ut.mermaidM}),import(f).then(m=>{s=m.default,d()}).catch(m=>{ot.emit(t,Vo,{name:"mermaid",message:`Failed to load mermaid module: ${m.message}`,error:m})})):Ht("script",{...(h=u.mermaid)==null?void 0:h.js,src:f,id:Ut.mermaid,onload(){s=window.mermaid,d()}},"mermaid")}),{reRenderRef:l,replaceMermaid:async()=>{if(!e.noMermaid&&s){const f=r.value.querySelectorAll(`div.${Y}-mermaid`),c=document.createElement("div"),h=document.body.offsetWidth>1366?document.body.offsetWidth:1366,m=document.body.offsetHeight>768?document.body.offsetHeight:768;c.style.width=h+"px",c.style.height=m+"px",c.style.position="fixed",c.style.zIndex="-10000",c.style.top="-10000";let p=f.length;p>0&&document.body.appendChild(c),await Promise.allSettled(Array.from(f).map(w=>(async y=>{var g;if(y.dataset.closed==="false")return!1;const A=y.innerText;let b=mu.get(A);if(!b){const x=No();let k={svg:""};try{k=await s.render(x,A,c),b=await e.sanitizeMermaid(k.svg);const T=document.createElement("p");T.className=`${Y}-mermaid`,T.setAttribute("data-processed",""),T.setAttribute("data-content",A),T.innerHTML=b,(g=T.children[0])==null||g.removeAttribute("height"),mu.set(A,T.innerHTML),y.dataset.line!==void 0&&(T.dataset.line=y.dataset.line),y.replaceWith(T)}catch(T){ot.emit(t,Vo,{name:"mermaid",message:T.message,error:T})}--p===0&&c.remove()}})(w)))}}}},Gp=(e,t)=>{t=t||{};const n=3,r=t.marker||"!",o=r.charCodeAt(0),u=r.length;let a="",s="";const l=(f,c,h,m,p)=>{const w=f[c];return w.type==="admonition_open"?f[c].attrPush(["class",`${Y}-admonition ${Y}-admonition-${w.info}`]):w.type==="admonition_title_open"&&f[c].attrPush(["class",`${Y}-admonition-title`]),p.renderToken(f,c,h)},d=f=>{const c=f.trim().split(" ",2);s="",a=c[0],c.length>1&&(s=f.substring(a.length+2))};e.block.ruler.before("code","admonition",(f,c,h,m)=>{let p,w,y,A=!1,b=f.bMarks[c]+f.tShift[c],g=f.eMarks[c];if(o!==f.src.charCodeAt(b))return!1;for(p=b+1;p<=g&&r[(p-b)%u]===f.src[p];p++);const x=Math.floor((p-b)/u);if(x!==n)return!1;p-=(p-b)%u;const k=f.src.slice(b,p),T=f.src.slice(p,g);if(d(T),m)return!0;for(w=c;w++,!(w>=h||(b=f.bMarks[w]+f.tShift[w],g=f.eMarks[w],b<g&&f.sCount[w]<f.blkIndent));)if(o===f.src.charCodeAt(b)&&!(f.sCount[w]-f.blkIndent>=4)){for(p=b+1;p<=g&&r[(p-b)%u]===f.src[p];p++);if(!(Math.floor((p-b)/u)<x)&&(p-=(p-b)%u,p=f.skipSpaces(p),!(p<g))){A=!0;break}}const D=f.parentType,S=f.lineMax;return f.parentType="root",f.lineMax=w,y=f.push("admonition_open","div",1),y.markup=k,y.block=!0,y.info=a,y.map=[c,w],s&&(y=f.push("admonition_title_open","p",1),y.markup=k+" "+a,y.map=[c,w],y=f.push("inline","",0),y.content=s,y.map=[c,f.line-1],y.children=[],y=f.push("admonition_title_close","p",-1),y.markup=k+" "+a),f.md.block.tokenize(f,c+1,w),y=f.push("admonition_close","div",-1),y.markup=f.src.slice(b,p),y.block=!0,f.parentType=D,f.lineMax=S,f.line=w+(A?1:0),!0},{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules.admonition_open=l,e.renderer.rules.admonition_title_open=l,e.renderer.rules.admonition_title_close=l,e.renderer.rules.admonition_close=l},Mo=(e,t)=>{const n=e.attrs?e.attrs.slice():[];return t.forEach(r=>{const o=e.attrIndex(r[0]);o<0?n.push(r):(n[o]=n[o].slice(),n[o][1]+=` ${r[1]}`)}),n},Xp=(e,t)=>{const n=e.renderer.rules.fence,r=e.utils.unescapeAll,o=/\[(\w*)(?::([\w ]*))?\]/,u=/::(open|close)/,a=c=>c.info?r(c.info).trim():"",s=c=>{const h=a(c),[m=null,p=""]=(o.exec(h)||[]).slice(1);return[m,p]},l=c=>{const h=a(c);return h?h.split(/(\s+)/g)[0]:""},d=c=>{const h=c.info.match(u)||[],m=h[1]==="open"||h[1]!=="close"&&t.codeFoldable&&c.content.trim().split(`