@farris/x-ui 0.6.0 → 0.6.2

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.
@@ -899,10 +899,7 @@ const v4 = /* @__PURE__ */ lt({
899
899
  var i;
900
900
  return (i = e.onBatchPreviewFile) == null ? void 0 : i.call(e, r);
901
901
  },
902
- onDownload: (r) => {
903
- var i;
904
- return (i = e.onDownloadFile) == null ? void 0 : i.call(e, r);
905
- }
902
+ onDownload: e.onDownloadFile
906
903
  }, null);
907
904
  }
908
905
  }), G5 = {
@@ -1,4 +1,4 @@
1
- (function(ue,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(ue=typeof globalThis<"u"?globalThis:ue||self,c(ue.FarrisX={},ue.vue))})(this,function(ue,c){"use strict";var gE=Object.defineProperty;var W6=ue=>{throw TypeError(ue)};var bE=(ue,c,l0)=>c in ue?gE(ue,c,{enumerable:!0,configurable:!0,writable:!0,value:l0}):ue[c]=l0;var Yt=(ue,c,l0)=>bE(ue,typeof c!="symbol"?c+"":c,l0),yd=(ue,c,l0)=>c.has(ue)||W6("Cannot "+l0);var $=(ue,c,l0)=>(yd(ue,c,"read from private field"),l0?l0.call(ue):c.get(ue)),Tt=(ue,c,l0)=>c.has(ue)?W6("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(ue):c.set(ue,l0),ot=(ue,c,l0,Yr)=>(yd(ue,c,"write to private field"),Yr?Yr.call(ue,l0):c.set(ue,l0),l0),et=(ue,c,l0)=>(yd(ue,c,"access private method"),l0);var dl=(ue,c,l0,Yr)=>({set _(ml){ot(ue,c,ml,l0)},get _(){return $(ue,c,Yr)}});var O3,kr,Ii,z3,R3,On,kn,Yn,Ga,Kn,Oi,zi,Zn,D0,Qn,v0,Qt,yt,nn,En,U0,B0,Jn,I0,er,tr,Dn,Cn,nr,ya,rn,Ri,$e,vd,Wa,Hr,Jo,Sn,Y6,Xa,Li,es,Sa,Ta,wd,fl,hl,e0,xd,os,_a,Ad,Pi;const l0={content:{type:Object,required:!0},outputMode:{type:String,default:"streaming"},classNames:{type:Object,default:()=>({})},customClass:{type:[Object,String,Array],default:""},customStyle:{type:[Object,String],default:""},header:{type:String,default:"sender"},placement:{type:String,default:"start"},showAvatar:{type:Boolean,default:!0},styles:{type:Object,default:()=>({})},attachments:{type:Array,default:()=>[]},onPreview:{type:Function,default:void 0},onDownload:{type:Function,default:void 0},compositeTailRender:{type:Function,default:void 0},onDynamicComponentsDetected:{type:Function,default:void 0},onShowDynamicComponent:{type:Function,default:void 0},attachmentRowClickOpensPreview:{type:Boolean,default:!0},attachmentShowDownload:{type:Boolean,default:!0},role:{type:String,default:"assistant"}},Yr={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ml="/api/runtime/attachment";function K6(){try{const e=Yr==null?void 0:Yr.VITE_ATTACHMENT_API_BASE;if(typeof e=="string"&&e.trim()!=="")return e.replace(/\/+$/,"")}catch{}return""}function Z6(e){var n;const t=e.trim();return t.startsWith("http://")||t.startsWith("https://")?t:typeof window<"u"&&((n=window.location)!=null&&n.origin)&&t.startsWith("/")?`${window.location.origin}${t}`:t}function Q6(e){return`${ml}/${encodeURIComponent(e)}/download`}function pl(e){const t=String(e??"").trim();if(!t)return"";const n=Q6(t),r=K6();return r?`${r}${n}`:n}function kd(e){const t=e.trim().match(/\/api\/runtime\/attachment\/([^/]+)\/download(?:\?|#|$)/i);if(!(t!=null&&t[1]))return"";try{return decodeURIComponent(t[1]).trim()}catch{return t[1].trim()}}function Ed(e){return String(e??"").replace(/[/\\]/g,"_").trim()||"download"}function J6(e){if(!e)return null;const t=/filename\*\s*=\s*[A-Za-z0-9-]+''([^;]+)/i.exec(e);if(t!=null&&t[1])try{const i=decodeURIComponent(t[1].trim());if(i)return i}catch{}const n=/filename\s*=\s*(?:"([^"]*)"|([^;]+))/i.exec(e),r=(n==null?void 0:n[1])??(n==null?void 0:n[2]);return r?r.trim():null}function Dd(e){const t=Z6(e);if(typeof window>"u")return t;try{const n=new URL(t);if(n.origin!==window.location.origin&&n.pathname.startsWith("/api/"))return`${n.pathname}${n.search}${n.hash}`}catch{}return t}function e5(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=Ed(t),r.rel="noopener noreferrer",r.style.display="none",document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}function t5(e){const t=document.createElement("a");t.href=Dd(e),t.rel="noopener noreferrer",t.style.display="none",document.body.appendChild(t),t.click(),t.remove()}function Qa(e){const t=String(e.fileId??"").trim();if(t)return pl(t);const n=String(e.url??"").trim();if(!n)return;const r=kd(n);if(r)return pl(r);if(n.startsWith("http://")||n.startsWith("https://")||n.startsWith("/"))return n}async function ss(e,t){const n=Ed(t),r=Dd(e);try{const i=await fetch(r,{credentials:"include",mode:"cors"});if(!i.ok)throw new Error(`download_http_${i.status}`);const a=await i.blob(),s=J6(i.headers.get("Content-Disposition"))??n;e5(a,s)}catch{t5(e)}}function un(e,t){return t&&(typeof t=="string"?t.split(" ").filter(Boolean).forEach(r=>{e[r]=!0}):Array.isArray(t)?t.forEach(n=>{n&&(e[n]=!0)}):typeof t=="object"&&Object.entries(t).forEach(([n,r])=>{n&&r&&(e[n]=!0)})),e}function ln(e,t){return t&&(typeof t=="string"?t.split(";").filter(Boolean).forEach(r=>{var a,s;const i=r.split(":");if(i.length>=2&&((a=i[0])!=null&&a.trim())&&((s=i[1])!=null&&s.trim())){const l=i[0].trim(),f=i.slice(1).join(":").trim();e[l]=f}}):typeof t=="object"&&Object.entries(t).forEach(([n,r])=>{n&&r!==void 0&&r!==null&&(e[n]=r)})),e}function n5(e){return e||null}function Cd(e){return e?/\.(jpg|jpeg|png|gif|svg|webp|bmp|ico)$/i.test(e)||e.startsWith("http")||e.startsWith("data:image"):!1}function Sd(e){return e?typeof e!="string"?e:Cd(e)?c.h("img",{src:e,alt:"icon",class:"fx-prompt--item-icon-image",onError:t=>{const n=t.target;n.style.display="none",n.parentElement.innerHTML='<i class="fx-icon fx-icon-warning"></i>'}}):e.includes("fx-icon")||e.includes("icon-")?c.h("i",{class:e}):e:null}function Td(e,t,n,r={}){const{charInterval:i=30}=r,a=c.ref({});let s=[],l=new Set;const f=()=>typeof t=="function"?t():t.value,m=()=>typeof n=="function"?n():n.value,g=()=>{s.forEach(A=>clearInterval(A)),s=[]},p=()=>{g(),a.value={},l.clear()},b=()=>{g(),a.value={},l.clear()},x=()=>{const A=e();if(!A||Object.keys(A).length===0){a.value={};return}if(!m()){a.value={...A},l=new Set(Object.keys(A));return}const T=Object.keys(A);T.forEach(S=>{a.value.hasOwnProperty(S)||(a.value[S]="")});const N=T.filter(S=>!l.has(S));if(N.length===0)return;let _=0;const C=()=>{var G;if(_>=N.length)return;const S=N[_],M=A[S];if(!M){l.add(S),_++,C();return}let O=((G=a.value[S])==null?void 0:G.length)||0;const q=setInterval(()=>{O<M.length?(a.value={...a.value,[S]:M.slice(0,O+1)},O++):(clearInterval(q),s=s.filter(j=>j!==q),l.add(S),_++,C())},i);s.push(q)};C()};return c.watch(()=>e(),()=>{f()&&x()},{immediate:!0}),c.watch(n,()=>{b(),f()&&x()}),c.watch(t,A=>{A?x():p()}),c.onMounted(()=>{f()&&x()}),{displayContent:a}}function us(){const e=c.reactive({}),t=[],n=c.ref(null);let r=null;const i=30,a=A=>{const T=e[A];return!T||T.displayedLength>=T.rawValue.length},s=c.computed(()=>Object.keys(e).length===0?!1:Object.keys(e).every(A=>a(A))),l=()=>{for(const A of t)if(!a(A))return A;return null},f=()=>{if(!n.value&&(n.value=l(),!n.value)){m();return}const A=e[n.value];A&&(A.displayedLength<A.rawValue.length?(A.displayedLength++,A.displayedValue=A.rawValue.slice(0,A.displayedLength),A.isStreaming=!0):(A.isStreaming=!1,A.displayedValue=A.rawValue,n.value=l(),n.value||m()))},m=()=>{r&&(clearInterval(r),r=null)},g=()=>{r||(r=setInterval(f,i))},p=()=>{m(),Object.keys(e).forEach(A=>{delete e[A]}),t.length=0,n.value=null},b=(A,T)=>{if(e[A]){x(A,T);return}t.push(A),e[A]={rawValue:T??"",displayedLength:0,isStreaming:!1,displayedValue:""},r||(!n.value||n.value===A)&&g()},x=(A,T)=>{const N=e[A];if(!N){b(A,T);return}N.rawValue=T??"",!r&&!a(A)&&(!n.value||n.value===A)&&g()};return c.onUnmounted(()=>{m()}),{propertyStates:e,currentProperty:n,get isAnyStreaming(){return Object.values(e).some(A=>A.isStreaming)},isAllDone:s,startStreaming:g,reset:p,registerProperty:b,updatePropertyValue:x}}function gl(){const e=c.ref(null),t=c.ref(0),n=c.ref(!1);let r=null;const i=()=>{e.value=Date.now(),n.value=!0,r=setInterval(()=>{e.value&&(t.value=Math.floor((Date.now()-e.value)/1e3))},1e3)},a=()=>{r&&(clearInterval(r),r=null),e.value&&(t.value=Math.floor((Date.now()-e.value)/1e3))};return{elapsedSeconds:t,hasEverStarted:n,start:i,stop:a,reset:()=>{a(),e.value=null,t.value=0,n.value=!1}}}const r5={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 a5(e){return e?e.startsWith("mcp:")?"tool_mcp":r5[e]??"thinking_tool":"thinking_tool"}function bl(){return{getToolIconClass:a5}}function i5(e){return e.scrollWidth>e.clientWidth}function _d(){i5(this)?this.title=this.textContent??"":this.removeAttribute("title")}function Fd(){this.removeAttribute("title")}const Nd={mounted(e){e.addEventListener("mouseenter",_d),e.addEventListener("mouseleave",Fd)},updated(e){e.removeAttribute("title")},unmounted(e){e.removeEventListener("mouseenter",_d),e.removeEventListener("mouseleave",Fd)}};function o5(e,t){const n=c.computed(()=>{var i;return ln({},(i=e.styles)==null?void 0:i.header)});function r(){return t.slots.header&&c.createVNode("div",{class:`f-chat-bubble-header ${e.placement}`,style:n.value},[t.slots.header()])}return{renderHeader:r}}function s5(e,t){var a;const n=c.ref(((a=e.content)==null?void 0:a.sender)??"发送人"),r=c.computed(()=>{var s;return ln({},(s=e.styles)==null?void 0:s.header)});function i(){return c.createVNode("div",{class:`f-chat-bubble-header ${e.placement}`,style:r.value},[n.value])}return{renderHeader:i}}const Md={file:{type:Object,required:!0},customStyle:{type:Object,default:()=>({})},onPreviewFile:{type:Function,default:void 0},onBatchPreviewFile:{type:Function,default:void 0},onDownloadFile:{type:Function,default:void 0}},Bd={role:{type:String,default:"assistant"},attachments:{type:Array,default:()=>[]},enableBatchPreview:{type:Boolean,default:!1},enableFixedWidth:{type:Boolean,default:!1},showDownloadButton:{type:Boolean,default:!0},onPreview:{type:Function,default:void 0},onBatchPreview:{type:Function,default:void 0},onDownload:{type:Function,default:void 0}};function Id(){return{getFileIcon:(i,a="file-type-",s="")=>{var m;const l={pdf:"pdf",doc:"doc",docx:"doc",xls:"xls",xlsx:"xls",csv:"xls",ppt:"ppt",pptx:"ppt",txt:"txt",zip:"zip",rar:"zip",image:"img",img:"img",md:"md",audio:"any",form:"form",report:"report",board:"board",html:"html",json:"json"};let f=i?l[i.toLowerCase()]:"";if(!f&&s){const g=((m=s.split(".").pop())==null?void 0:m.toLowerCase())||"";f=g?l[g]:""}return`${a}${f||"any"}`},formatFileName:i=>i,formatFileSize:i=>i?i<1024?i+" B":i<1048576?(i/1024).toFixed(1)+" KB":(i/1048576).toFixed(1)+" MB":"",formatFileTime:i=>{if(!i)return"";const a=new Date(i),s=a.getFullYear(),l=String(a.getMonth()+1).padStart(2,"0"),f=String(a.getDate()).padStart(2,"0");return`${s}-${l}-${f}`}}}function Fa({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()}`,c.createVNode("span",{class:n,"aria-hidden":!0},null)}const Od={modelValue:{type:Boolean,default:!1},src:{type:String,default:""},name:{type:String,default:""},zIndex:{type:Number,default:2e3}},u5=.2,l5=10,c5=3,Ja=.9,yl=72;function d5(e){return Math.min(l5,Math.max(u5,e))}const ei=c.defineComponent({name:"FXImagePreview",props:Od,emits:["update:modelValue","close"],setup(e,{emit:t}){const n=c.ref(1),r=c.ref(0),i=c.ref(0),a=c.ref(typeof window>"u"?0:window.innerWidth),s=c.ref(typeof window>"u"?0:window.innerHeight),l=c.ref(null),f=c.ref(null);let m=null;function g(G,j){const le=a.value*Ja,J=Math.max(1,s.value*Ja-yl),ae=Math.min(1,le/G,J/j);return{width:Math.max(1,Math.floor(G*ae)),height:Math.max(1,Math.floor(j*ae))}}const p=c.computed(()=>r.value<=0||i.value<=0?{width:Math.floor(a.value*Ja),height:Math.max(1,Math.floor(s.value*Ja-yl))}:g(r.value,i.value)),b=c.computed(()=>Math.max(1,Math.floor(p.value.width*n.value))),x=c.computed(()=>Math.max(1,Math.floor(p.value.height*n.value))),A=c.computed(()=>r.value<=0||i.value<=0?{maxWidth:`${Math.floor(a.value*Ja)}px`,maxHeight:`${Math.max(1,Math.floor(s.value*Ja-yl))}px`}:{width:`${b.value}px`,height:`${x.value}px`}),T=c.computed(()=>({cursor:n.value>1?"zoom-out":"zoom-in"}));function N(){t("update:modelValue",!1),t("close")}function _(G){const j=G.target;j.naturalWidth>0&&j.naturalHeight>0&&(r.value=j.naturalWidth,i.value=j.naturalHeight)}function C(){n.value=n.value===1?c5:1}function S(G){G.preventDefault();const j=G.deltaY<0?1.15:.87;n.value=d5(n.value*j)}function M(G){G.key==="Escape"&&N()}function O(){a.value=window.innerWidth,s.value=window.innerHeight}function q(){m==null||m(),m=null;const G=f.value;G&&(G.addEventListener("wheel",S,{passive:!1}),m=()=>G.removeEventListener("wheel",S))}return c.watch(()=>e.modelValue,G=>{G?(n.value=1,r.value=0,i.value=0,c.nextTick(()=>{var j;(j=l.value)==null||j.focus(),q()})):(m==null||m(),m=null)},{immediate:!0}),c.onMounted(()=>{document.addEventListener("keydown",M),window.addEventListener("resize",O)}),c.onBeforeUnmount(()=>{document.removeEventListener("keydown",M),window.removeEventListener("resize",O),m==null||m(),m=null}),()=>e.modelValue!==!0?null:c.createVNode(c.Teleport,{to:"body"},{default:()=>[c.createVNode("div",{class:"f-image-preview-overlay",role:"dialog","aria-modal":"true","aria-label":`图片预览:${e.name}`,style:{zIndex:e.zIndex},onClick:N},[c.createVNode("button",{type:"button",ref:l,class:"f-image-preview-close","aria-label":"关闭图片预览",onClick:N},[c.createVNode("i",{class:"fx-icon fx-icon-sidewindow_close"},null)]),c.createVNode("div",{class:"f-image-preview-content",onClick:G=>G.stopPropagation()},[c.createVNode("div",{ref:f,class:"f-image-preview-body",style:T.value},[c.createVNode("img",{class:"f-image-preview-image",src:e.src,alt:e.name,style:A.value,draggable:!1,onLoad:_,onClick:C},null)])])])]})}});ei.install=e=>{e.component(ei.name,ei)};const f5=new Set(["png","jpg","jpeg","gif","webp","bmp","svg","ico","avif"]);function vl(e){const t=(e.type??"").toLowerCase();return t==="image"||f5.has(t)?!0:/\.(png|jpe?g|gif|webp|bmp|svg|ico|avif)$/i.test(e.name??"")}const wl=c.defineComponent({name:"FXBubbleAttachment",props:Bd,emits:["preview","batchPreview","download"],setup(e,t){const n=c.computed(()=>e.attachments??[]),r=c.computed(()=>{var J;return((J=n.value)==null?void 0:J.length)>0}),i=c.ref([]),a=c.computed(()=>{if(e.role!=="user")return!1;const J=n.value;if(J.length!==1)return!1;const ae=J[0];return vl(ae)&&!!ae.url}),{formatFileName:s,formatFileSize:l,formatFileTime:f,getFileIcon:m}=Id(),g=c.ref(null);let p=null;function b(J){J.url&&(p=document.activeElement instanceof HTMLElement?document.activeElement:null,g.value={url:J.url,name:J.name})}function x(){g.value=null,p!=null&&p.isConnected&&p.focus(),p=null}const A=c.computed(()=>({"f-chat-bubble-attachment-info":!0,"f-utils-fill":e.enableFixedWidth})),T=c.computed(()=>({"f-chat-bubble-attachment-name":!0,"name-tip":e.enableFixedWidth}));function N(J,ae){if(!ae.pending){if(vl(ae)&&ae.url){b(ae);return}t.emit("preview",ae)}}function _(J,ae){const te=String(J.fileId??"").trim();if(te)return te;const he=String(J.url??"").trim();return he||`${J.name}:${ae}`}function C(J,ae){return i.value.includes(_(J,ae))}async function S(J,ae,te){if(J.stopPropagation(),J.preventDefault(),e.onDownload){t.emit("download",ae);return}const he=Qa(ae);if(!he)return;const ke=_(ae,te);if(!i.value.includes(ke)){i.value=[...i.value,ke];try{await ss(he,ae.name)}finally{i.value=i.value.filter(we=>we!==ke)}}}function M(J){J.stopPropagation(),J.preventDefault(),t.emit("batchPreview",n.value)}function O(J){switch(J.toLowerCase()){case"doc":case"docx":return"Word";case"xlsx":case"xls":return"Excel";case"ppt":case"pptx":return"PPT";case"txt":return"txt";case"png":case"jpg":case"jpeg":return"Image";case"pdf":return"PDF";case"md":return"Markdown";default:return""}}function q(J){if(!J)return null;const ae=O(J.type);return c.createVNode("div",{class:"file-info f-utils-fill"},[c.createVNode("span",{class:"file-name",title:J.name},[J.name]),c.createVNode("div",{class:"file-info-footer"},[c.createVNode("span",{class:`file-icon ${m(J.type,"file-type-",J.name)}`},null),ae&&c.createVNode(c.Fragment,null,[c.createVNode("span",{class:"file-type"},[O(J.type)])]),J.size&&c.createVNode(c.Fragment,null,[c.createVNode("div",{class:"file-info-divider"},null),c.createTextVNode(" "),c.createVNode("span",{class:"file-size"},[l(J.size)])])])])}function G(J,ae){const te=Qa(J),he=C(J,ae);return c.createVNode("div",{class:"f-chat-bubble-attachment-item "+m(J.type,"attachment-type-",J.name)+(J.pending?" status-working":""),key:ae,onClick:ke=>N(ke,J)},[c.createVNode("div",{class:"f-chat-bubble-attachment-main",role:"presentation"},[c.createVNode("div",{class:A.value},[c.createVNode("span",{class:"f-chat-bubble-attachment-icon file-icon "+m(J.type,"file-type-",J.name)},null),c.createVNode("span",{class:T.value,title:J.name},[s(J.name)]),J.pending===!0&&c.createVNode("div",{class:"f-chat-bubble-attachment-status status-working"},[c.createVNode(Fa,{status:"Working",variant:"attachment"},null),c.createTextVNode(" 生成中")]),J.timestamp?c.createVNode("span",{class:"f-chat-bubble-attachment-text"},[c.createTextVNode("创建时间:"),f(J.timestamp)]):J.size?c.createVNode("span",{class:"f-chat-bubble-attachment-size"},[c.createTextVNode("文件大小:"),l(J.size)]):null])]),e.showDownloadButton!==!1&&(te||e.onDownload)?c.createVNode("button",{type:"button",class:["f-chat-bubble-attachment-download-btn",{"is-downloading":he}],"aria-label":he?"正在下载":"下载附件","aria-busy":he?"true":"false",title:he?"正在下载":"下载",disabled:he,onClick:ke=>S(ke,J,ae)},[he?c.createVNode("span",{class:"f-chat-download-spinner","aria-hidden":"true"},null):c.createVNode("i",{class:"fx-icon fx-icon-sidewindow_download","aria-hidden":"true"},null)]):null])}function j(J){return J.url?c.createVNode("button",{type:"button",class:"f-chat-bubble-attachment-image","aria-label":`预览图片 ${J.name}`,title:J.name,onClick:ae=>{ae.stopPropagation(),b(J)}},[c.createVNode("img",{src:J.url,alt:J.name},null)]):null}function le(J,ae){return vl(J)&&J.url?c.createVNode("div",{class:"f-chat-bubble-attachment-image-wrap",key:ae},[j(J)]):c.createVNode("div",{class:"f-chat-bubble-attachment-toast",key:ae},[q(J)])}return()=>{var J,ae;return r.value?c.createVNode(c.Fragment,null,[c.createVNode("div",{class:{"f-chat-bubble-attachments":!0,"attachments-toast":e.role==="user","bubble-attachments-only-one-image":a.value}},[n.value.map((te,he)=>e.role==="user"?le(te,he):G(te,he)),e.enableBatchPreview&&c.createVNode("div",{class:"f-chat-bubble-attachment-preview-btn",onClick:M},[c.createVNode("span",{class:"f-chat-bubble-attachment-preview-btn-text"},[c.createTextVNode("查看全部文件")]),c.createVNode("i",{class:"fx-icon fx-icon-sort-asc-sm",style:{transform:"rotate(90deg)"}},null)])]),c.createVNode(ei,{modelValue:g.value!==null,src:((J=g.value)==null?void 0:J.url)??"",name:((ae=g.value)==null?void 0:ae.name)??"",onClose:x},null)]):null}}}),zd=c.defineComponent({name:"FXBubbleFileContentFooter",props:Md,setup(e,t){const n=c.computed(()=>e.file?Array.isArray(e.file)?[...e.file]:[e.file]:[]);return ln({},e.customStyle),()=>c.createVNode(wl,{attachments:n.value,onPreview:r=>{var i;return(i=e.onPreviewFile)==null?void 0:i.call(e,r)},onBatchPreview:r=>{var i;return(i=e.onBatchPreviewFile)==null?void 0:i.call(e,r)},onDownload:r=>{var i;return(i=e.onDownloadFile)==null?void 0:i.call(e,r)}},null)}}),Rd={pageUrl:{type:String,required:!0},customStyle:{type:Object,default:()=>({})},onNavigate:{type:Function,default:void 0}},Ld=c.defineComponent({name:"FXBubblePageEmbeddedContent",props:Rd,setup(e,t){const n=c.ref(),r=c.computed(()=>{var s,l;const a={width:"100%",height:"100%",border:"none"};return(s=e.customStyle)!=null&&s.width&&(a.width=e.customStyle.width),(l=e.customStyle)!=null&&l.height&&(a.height=`${e.customStyle.height}px`),a}),i=a=>{var s,l;((s=a.data)==null?void 0:s.type)==="navigation"&&((l=a.data)!=null&&l.url)&&e.onNavigate&&e.onNavigate(a.data.url)};return c.onMounted(()=>{window.addEventListener("message",i)}),c.onUnmounted(()=>{window.removeEventListener("message",i)}),()=>c.createVNode("iframe",{ref:n,src:e.pageUrl,style:r.value,scrolling:"auto"},null)}});function Pd(){function e(i,a){const{fileContent:s,height:l,width:f}=i;return{file:s,customStyle:{width:f||"100%",height:l||"100%"},onPreviewFile:a==null?void 0:a.onPreviewFile,onBatchPreviewFile:a==null?void 0:a.onBatchPreviewFile,onDownloadFile:a==null?void 0:a.onDownloadFile}}function t(i,a){const{pageUrl:s,height:l,width:f}=i;return{pageUrl:s,customStyle:{width:f||"100%",height:l||"100%"},onNavigate:a==null?void 0:a.onNavigate}}function n(i,a){const s=e(i,a);return c.h(zd,s)}function r(i,a){const s=t(i,a);return c.h(Ld,s)}return{renderFileEmbeddedContent:n,renderPageEmbeddedContent:r}}const Vd={title:{type:String,default:""},subtitle:{type:String,default:""},text:{type:String,default:""},textFormat:{type:String,default:"plain"},placement:{type:String,default:"start"},onDynamicComponentsDetected:{type:Function,default:void 0},onShowDynamicComponent:{type:Function,default:void 0}},xl="assistant-widget",qn="```";function eo(e,t){let n=t;for(;n<e.length&&/\s/.test(e[n]);)n+=1;return n}function Hd(e,t){let n=t;for(;n<e.length&&/[a-zA-Z0-9-]/.test(e[n]);)n+=1;return{lang:e.slice(t,n),next:n}}function qd(e){const t=e.toLowerCase();return t.length===0||t.length>xl.length?!1:xl.startsWith(t)}function h5(e){return e.toLowerCase()===xl}function m5(e,t){let n=0;for(;n<t;){const r=e.indexOf(qn,n);if(r===-1||r>=t)break;let i=r+qn.length;i=eo(e,i);const{lang:a}=Hd(e,i);if(a.length>0)return!0;n=r+qn.length}return!1}function $d(e,t){if(!e.startsWith(qn,t))return null;let n=t+qn.length;n=eo(e,n);const{lang:r,next:i}=Hd(e,n);return r.length===0?e.slice(i).trim().length===0?m5(e,t)?null:{fenceStart:t,bodyStart:i,langComplete:!1}:null:qd(r)?(n=eo(e,i),{fenceStart:t,bodyStart:n,langComplete:h5(r)}):null}function Al(e,t=0){const n=eo(e,t);return $d(e,n)}function p5(e,t,n){if(t<n)return!1;const r=e.slice(t+qn.length);return r.length===0?!0:r.startsWith("`")?!1:(/^\s*[\r\n]/.test(r)||/^\s*$/.test(r),!0)}function ls(e,t){let n=t;for(;n<=e.length;){const r=e.indexOf(qn,n);if(r===-1)return-1;if(p5(e,r,t))return r;n=r+1}return-1}function g5(e){const t=Al(e,0);if(!(t!=null&&t.langComplete))return null;const n=ls(e,t.bodyStart);return n===-1?null:e.slice(t.bodyStart,n).trim()}function Ud(e){return e.replace(/```\s*assistant-widget\s*/gi,"``` assistant-widget\n")}function b5(e){const t=e.match(/^\s*```\s*([a-zA-Z0-9-]*)$/);return t?qd(t[1]??""):!1}function y5(e,t){let n=t;for(;n<e.length;){const r=e.indexOf(qn,n);if(r===-1)return null;const i=$d(e,r);if(i)return{fenceIdx:r,open:i};n=r+qn.length}return null}function jd(e){if(!e)return!1;const t=Al(e,0);if(!(t!=null&&t.langComplete))return!1;const n=ls(e,t.bodyStart);return n===-1?!1:eo(e,n+qn.length)>=e.length}function v5(e){if(!e)return!1;if(jd(e)||b5(e))return!0;const t=Al(e,0);return t?t.langComplete?ls(e,t.bodyStart)===-1:!0:!1}function w5(e){if(!e)return[];const t=[];let n=0;for(;n<e.length;){const r=y5(e,n);if(!r){const f=e.slice(n);f&&t.push(f);break}const{fenceIdx:i,open:a}=r;if(i>n&&t.push(e.slice(n,i)),!a.langComplete){t.push(e.slice(i));break}const s=ls(e,a.bodyStart);if(s===-1){t.push(e.slice(i));break}const l=s+qn.length;t.push(Ud(e.slice(i,l))),n=l}return t.filter(r=>r.trim().length>0)}function Gd(e){const t=g5(Ud(e.trim()));if(t==null||t==="")return null;try{return JSON.parse(t)}catch(n){return console.error("Failed to parse JSON:",n),null}}function x5(e){var n;const t=Gd(e);return((n=t==null?void 0:t.renderer)==null?void 0:n.widgetImplOptions)||{}}const A5=/^```\s*dynamic-component\b[\s\S]*?```$/,k5=/^```\s*dynamic-component\b/,E5=/^```\s*dynamic-component\b\s*/,D5=/\s*```\s*$/;function C5(e){return e.replace(/```\s*dynamic-component\b/g,"``` dynamic-component")}function Wd(e){return e.replace(E5,"").replace(D5,"").trim()}function S5(e,t){let n=t;for(;n<e.length;){const r=e.indexOf("```",n);if(r<0)return null;const a=e.slice(r+3).match(/^\s*dynamic-component\b/);if(a)return{fenceStart:r,contentStart:r+3+a[0].length};n=r+3}return null}function T5(e){return e?A5.test(e)||k5.test(e):!1}function _5(e){const t=Wd(e);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!n||typeof n!="object"||Array.isArray(n))return null;const r=n;return typeof r.instanceId!="string"?null:{...r,instanceId:r.instanceId,name:typeof r.name=="string"?r.name:void 0,componentId:typeof r.componentId=="string"?r.componentId:void 0,jsUrl:typeof r.jsUrl=="string"?r.jsUrl:"",url:typeof r.url=="string"?r.url:"",title:typeof r.title=="string"?r.title:"预览",position:r.position==="inline"?"inline":"right",width:typeof r.width=="string"?r.width:void 0,isFullscreen:typeof r.isFullscreen=="boolean"?r.isFullscreen:!1,autoOpen:typeof r.autoOpen=="boolean"?r.autoOpen:!1,fileRe:typeof r.fileRe=="string"?r.fileRe:void 0,target:r.target==="preview"||r.target==="previewExtra"?r.target:r.renderArea==="previewExtra"?"previewExtra":r.renderArea==="preview"?"preview":void 0}}function F5(e){const t=Wd(e);if(!t)return null;const n=t.match(/"position"\s*:\s*"(inline|right)"/);return n?{position:n[1]}:null}function N5(e){if(!e)return[];const t=[];let n=0;for(;n<e.length;){const r=S5(e,n);if(!r){const f=e.slice(n);f&&t.push(f);break}const i=e.slice(n,r.fenceStart);i&&t.push(i);const a=e.indexOf("```",r.contentStart);if(a===-1){t.push(e.slice(r.fenceStart));break}const s=a+3,l=e.slice(r.fenceStart,s);t.push(C5(l)),n=s}return t.filter(r=>r.length>0)}var V0=(e=>(e.Text="text",e.FlowUIComplete="flowui-complete",e.AssistantWidgetComplete="assistant-widget-complete",e.AssistantWidgetPending="assistant-widget-pending",e.DynamicComponentComplete="dynamic-component-complete",e.DynamicComponentPending="dynamic-component-pending",e))(V0||{});function M5(e){var i;if(!e)return[];const t=[],n=new Set,r=w5(e);for(const a of r)if(v5(a))if(jd(a)){const s=Gd(a);t.push({type:V0.AssistantWidgetComplete,raw:a,widgetData:s,widgetUrl:(i=s==null?void 0:s.renderer)==null?void 0:i.url,widgetImplOptions:x5(a)})}else t.push({type:V0.AssistantWidgetPending,raw:a});else{const s=N5(a);for(const l of s)if(T5(l))if(l.endsWith("```")){const f=_5(l);if(f!=null&&f.instanceId){if(n.has(f.instanceId))continue;n.add(f.instanceId),t.push({type:V0.DynamicComponentComplete,raw:l,config:f})}}else{const f=F5(l);t.push({type:V0.DynamicComponentPending,raw:l,position:(f==null?void 0:f.position)??null})}else l.trim()&&t.push({type:V0.Text,raw:l})}return t}/*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */function Xd(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function B5(e){if(Array.isArray(e))return e}function I5(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,s,l=[],f=!0,m=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(f=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);f=!0);}catch(g){m=!0,i=g}finally{try{if(!f&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(m)throw i}}return l}}function O5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ (function(ue,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(ue=typeof globalThis<"u"?globalThis:ue||self,c(ue.FarrisX={},ue.vue))})(this,function(ue,c){"use strict";var gE=Object.defineProperty;var W6=ue=>{throw TypeError(ue)};var bE=(ue,c,l0)=>c in ue?gE(ue,c,{enumerable:!0,configurable:!0,writable:!0,value:l0}):ue[c]=l0;var Yt=(ue,c,l0)=>bE(ue,typeof c!="symbol"?c+"":c,l0),yd=(ue,c,l0)=>c.has(ue)||W6("Cannot "+l0);var $=(ue,c,l0)=>(yd(ue,c,"read from private field"),l0?l0.call(ue):c.get(ue)),Tt=(ue,c,l0)=>c.has(ue)?W6("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(ue):c.set(ue,l0),ot=(ue,c,l0,Yr)=>(yd(ue,c,"write to private field"),Yr?Yr.call(ue,l0):c.set(ue,l0),l0),et=(ue,c,l0)=>(yd(ue,c,"access private method"),l0);var dl=(ue,c,l0,Yr)=>({set _(ml){ot(ue,c,ml,l0)},get _(){return $(ue,c,Yr)}});var O3,kr,Ii,z3,R3,On,kn,Yn,Ga,Kn,Oi,zi,Zn,D0,Qn,v0,Qt,yt,nn,En,U0,B0,Jn,I0,er,tr,Dn,Cn,nr,ya,rn,Ri,$e,vd,Wa,Hr,Jo,Sn,Y6,Xa,Li,es,Sa,Ta,wd,fl,hl,e0,xd,os,_a,Ad,Pi;const l0={content:{type:Object,required:!0},outputMode:{type:String,default:"streaming"},classNames:{type:Object,default:()=>({})},customClass:{type:[Object,String,Array],default:""},customStyle:{type:[Object,String],default:""},header:{type:String,default:"sender"},placement:{type:String,default:"start"},showAvatar:{type:Boolean,default:!0},styles:{type:Object,default:()=>({})},attachments:{type:Array,default:()=>[]},onPreview:{type:Function,default:void 0},onDownload:{type:Function,default:void 0},compositeTailRender:{type:Function,default:void 0},onDynamicComponentsDetected:{type:Function,default:void 0},onShowDynamicComponent:{type:Function,default:void 0},attachmentRowClickOpensPreview:{type:Boolean,default:!0},attachmentShowDownload:{type:Boolean,default:!0},role:{type:String,default:"assistant"}},Yr={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ml="/api/runtime/attachment";function K6(){try{const e=Yr==null?void 0:Yr.VITE_ATTACHMENT_API_BASE;if(typeof e=="string"&&e.trim()!=="")return e.replace(/\/+$/,"")}catch{}return""}function Z6(e){var n;const t=e.trim();return t.startsWith("http://")||t.startsWith("https://")?t:typeof window<"u"&&((n=window.location)!=null&&n.origin)&&t.startsWith("/")?`${window.location.origin}${t}`:t}function Q6(e){return`${ml}/${encodeURIComponent(e)}/download`}function pl(e){const t=String(e??"").trim();if(!t)return"";const n=Q6(t),r=K6();return r?`${r}${n}`:n}function kd(e){const t=e.trim().match(/\/api\/runtime\/attachment\/([^/]+)\/download(?:\?|#|$)/i);if(!(t!=null&&t[1]))return"";try{return decodeURIComponent(t[1]).trim()}catch{return t[1].trim()}}function Ed(e){return String(e??"").replace(/[/\\]/g,"_").trim()||"download"}function J6(e){if(!e)return null;const t=/filename\*\s*=\s*[A-Za-z0-9-]+''([^;]+)/i.exec(e);if(t!=null&&t[1])try{const i=decodeURIComponent(t[1].trim());if(i)return i}catch{}const n=/filename\s*=\s*(?:"([^"]*)"|([^;]+))/i.exec(e),r=(n==null?void 0:n[1])??(n==null?void 0:n[2]);return r?r.trim():null}function Dd(e){const t=Z6(e);if(typeof window>"u")return t;try{const n=new URL(t);if(n.origin!==window.location.origin&&n.pathname.startsWith("/api/"))return`${n.pathname}${n.search}${n.hash}`}catch{}return t}function e5(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=Ed(t),r.rel="noopener noreferrer",r.style.display="none",document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}function t5(e){const t=document.createElement("a");t.href=Dd(e),t.rel="noopener noreferrer",t.style.display="none",document.body.appendChild(t),t.click(),t.remove()}function Qa(e){const t=String(e.fileId??"").trim();if(t)return pl(t);const n=String(e.url??"").trim();if(!n)return;const r=kd(n);if(r)return pl(r);if(n.startsWith("http://")||n.startsWith("https://")||n.startsWith("/"))return n}async function ss(e,t){const n=Ed(t),r=Dd(e);try{const i=await fetch(r,{credentials:"include",mode:"cors"});if(!i.ok)throw new Error(`download_http_${i.status}`);const a=await i.blob(),s=J6(i.headers.get("Content-Disposition"))??n;e5(a,s)}catch{t5(e)}}function un(e,t){return t&&(typeof t=="string"?t.split(" ").filter(Boolean).forEach(r=>{e[r]=!0}):Array.isArray(t)?t.forEach(n=>{n&&(e[n]=!0)}):typeof t=="object"&&Object.entries(t).forEach(([n,r])=>{n&&r&&(e[n]=!0)})),e}function ln(e,t){return t&&(typeof t=="string"?t.split(";").filter(Boolean).forEach(r=>{var a,s;const i=r.split(":");if(i.length>=2&&((a=i[0])!=null&&a.trim())&&((s=i[1])!=null&&s.trim())){const l=i[0].trim(),f=i.slice(1).join(":").trim();e[l]=f}}):typeof t=="object"&&Object.entries(t).forEach(([n,r])=>{n&&r!==void 0&&r!==null&&(e[n]=r)})),e}function n5(e){return e||null}function Cd(e){return e?/\.(jpg|jpeg|png|gif|svg|webp|bmp|ico)$/i.test(e)||e.startsWith("http")||e.startsWith("data:image"):!1}function Sd(e){return e?typeof e!="string"?e:Cd(e)?c.h("img",{src:e,alt:"icon",class:"fx-prompt--item-icon-image",onError:t=>{const n=t.target;n.style.display="none",n.parentElement.innerHTML='<i class="fx-icon fx-icon-warning"></i>'}}):e.includes("fx-icon")||e.includes("icon-")?c.h("i",{class:e}):e:null}function Td(e,t,n,r={}){const{charInterval:i=30}=r,a=c.ref({});let s=[],l=new Set;const f=()=>typeof t=="function"?t():t.value,m=()=>typeof n=="function"?n():n.value,g=()=>{s.forEach(A=>clearInterval(A)),s=[]},p=()=>{g(),a.value={},l.clear()},b=()=>{g(),a.value={},l.clear()},x=()=>{const A=e();if(!A||Object.keys(A).length===0){a.value={};return}if(!m()){a.value={...A},l=new Set(Object.keys(A));return}const T=Object.keys(A);T.forEach(S=>{a.value.hasOwnProperty(S)||(a.value[S]="")});const N=T.filter(S=>!l.has(S));if(N.length===0)return;let _=0;const C=()=>{var G;if(_>=N.length)return;const S=N[_],M=A[S];if(!M){l.add(S),_++,C();return}let O=((G=a.value[S])==null?void 0:G.length)||0;const q=setInterval(()=>{O<M.length?(a.value={...a.value,[S]:M.slice(0,O+1)},O++):(clearInterval(q),s=s.filter(j=>j!==q),l.add(S),_++,C())},i);s.push(q)};C()};return c.watch(()=>e(),()=>{f()&&x()},{immediate:!0}),c.watch(n,()=>{b(),f()&&x()}),c.watch(t,A=>{A?x():p()}),c.onMounted(()=>{f()&&x()}),{displayContent:a}}function us(){const e=c.reactive({}),t=[],n=c.ref(null);let r=null;const i=30,a=A=>{const T=e[A];return!T||T.displayedLength>=T.rawValue.length},s=c.computed(()=>Object.keys(e).length===0?!1:Object.keys(e).every(A=>a(A))),l=()=>{for(const A of t)if(!a(A))return A;return null},f=()=>{if(!n.value&&(n.value=l(),!n.value)){m();return}const A=e[n.value];A&&(A.displayedLength<A.rawValue.length?(A.displayedLength++,A.displayedValue=A.rawValue.slice(0,A.displayedLength),A.isStreaming=!0):(A.isStreaming=!1,A.displayedValue=A.rawValue,n.value=l(),n.value||m()))},m=()=>{r&&(clearInterval(r),r=null)},g=()=>{r||(r=setInterval(f,i))},p=()=>{m(),Object.keys(e).forEach(A=>{delete e[A]}),t.length=0,n.value=null},b=(A,T)=>{if(e[A]){x(A,T);return}t.push(A),e[A]={rawValue:T??"",displayedLength:0,isStreaming:!1,displayedValue:""},r||(!n.value||n.value===A)&&g()},x=(A,T)=>{const N=e[A];if(!N){b(A,T);return}N.rawValue=T??"",!r&&!a(A)&&(!n.value||n.value===A)&&g()};return c.onUnmounted(()=>{m()}),{propertyStates:e,currentProperty:n,get isAnyStreaming(){return Object.values(e).some(A=>A.isStreaming)},isAllDone:s,startStreaming:g,reset:p,registerProperty:b,updatePropertyValue:x}}function gl(){const e=c.ref(null),t=c.ref(0),n=c.ref(!1);let r=null;const i=()=>{e.value=Date.now(),n.value=!0,r=setInterval(()=>{e.value&&(t.value=Math.floor((Date.now()-e.value)/1e3))},1e3)},a=()=>{r&&(clearInterval(r),r=null),e.value&&(t.value=Math.floor((Date.now()-e.value)/1e3))};return{elapsedSeconds:t,hasEverStarted:n,start:i,stop:a,reset:()=>{a(),e.value=null,t.value=0,n.value=!1}}}const r5={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 a5(e){return e?e.startsWith("mcp:")?"tool_mcp":r5[e]??"thinking_tool":"thinking_tool"}function bl(){return{getToolIconClass:a5}}function i5(e){return e.scrollWidth>e.clientWidth}function _d(){i5(this)?this.title=this.textContent??"":this.removeAttribute("title")}function Fd(){this.removeAttribute("title")}const Nd={mounted(e){e.addEventListener("mouseenter",_d),e.addEventListener("mouseleave",Fd)},updated(e){e.removeAttribute("title")},unmounted(e){e.removeEventListener("mouseenter",_d),e.removeEventListener("mouseleave",Fd)}};function o5(e,t){const n=c.computed(()=>{var i;return ln({},(i=e.styles)==null?void 0:i.header)});function r(){return t.slots.header&&c.createVNode("div",{class:`f-chat-bubble-header ${e.placement}`,style:n.value},[t.slots.header()])}return{renderHeader:r}}function s5(e,t){var a;const n=c.ref(((a=e.content)==null?void 0:a.sender)??"发送人"),r=c.computed(()=>{var s;return ln({},(s=e.styles)==null?void 0:s.header)});function i(){return c.createVNode("div",{class:`f-chat-bubble-header ${e.placement}`,style:r.value},[n.value])}return{renderHeader:i}}const Md={file:{type:Object,required:!0},customStyle:{type:Object,default:()=>({})},onPreviewFile:{type:Function,default:void 0},onBatchPreviewFile:{type:Function,default:void 0},onDownloadFile:{type:Function,default:void 0}},Bd={role:{type:String,default:"assistant"},attachments:{type:Array,default:()=>[]},enableBatchPreview:{type:Boolean,default:!1},enableFixedWidth:{type:Boolean,default:!1},showDownloadButton:{type:Boolean,default:!0},onPreview:{type:Function,default:void 0},onBatchPreview:{type:Function,default:void 0},onDownload:{type:Function,default:void 0}};function Id(){return{getFileIcon:(i,a="file-type-",s="")=>{var m;const l={pdf:"pdf",doc:"doc",docx:"doc",xls:"xls",xlsx:"xls",csv:"xls",ppt:"ppt",pptx:"ppt",txt:"txt",zip:"zip",rar:"zip",image:"img",img:"img",md:"md",audio:"any",form:"form",report:"report",board:"board",html:"html",json:"json"};let f=i?l[i.toLowerCase()]:"";if(!f&&s){const g=((m=s.split(".").pop())==null?void 0:m.toLowerCase())||"";f=g?l[g]:""}return`${a}${f||"any"}`},formatFileName:i=>i,formatFileSize:i=>i?i<1024?i+" B":i<1048576?(i/1024).toFixed(1)+" KB":(i/1048576).toFixed(1)+" MB":"",formatFileTime:i=>{if(!i)return"";const a=new Date(i),s=a.getFullYear(),l=String(a.getMonth()+1).padStart(2,"0"),f=String(a.getDate()).padStart(2,"0");return`${s}-${l}-${f}`}}}function Fa({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()}`,c.createVNode("span",{class:n,"aria-hidden":!0},null)}const Od={modelValue:{type:Boolean,default:!1},src:{type:String,default:""},name:{type:String,default:""},zIndex:{type:Number,default:2e3}},u5=.2,l5=10,c5=3,Ja=.9,yl=72;function d5(e){return Math.min(l5,Math.max(u5,e))}const ei=c.defineComponent({name:"FXImagePreview",props:Od,emits:["update:modelValue","close"],setup(e,{emit:t}){const n=c.ref(1),r=c.ref(0),i=c.ref(0),a=c.ref(typeof window>"u"?0:window.innerWidth),s=c.ref(typeof window>"u"?0:window.innerHeight),l=c.ref(null),f=c.ref(null);let m=null;function g(G,j){const le=a.value*Ja,J=Math.max(1,s.value*Ja-yl),ae=Math.min(1,le/G,J/j);return{width:Math.max(1,Math.floor(G*ae)),height:Math.max(1,Math.floor(j*ae))}}const p=c.computed(()=>r.value<=0||i.value<=0?{width:Math.floor(a.value*Ja),height:Math.max(1,Math.floor(s.value*Ja-yl))}:g(r.value,i.value)),b=c.computed(()=>Math.max(1,Math.floor(p.value.width*n.value))),x=c.computed(()=>Math.max(1,Math.floor(p.value.height*n.value))),A=c.computed(()=>r.value<=0||i.value<=0?{maxWidth:`${Math.floor(a.value*Ja)}px`,maxHeight:`${Math.max(1,Math.floor(s.value*Ja-yl))}px`}:{width:`${b.value}px`,height:`${x.value}px`}),T=c.computed(()=>({cursor:n.value>1?"zoom-out":"zoom-in"}));function N(){t("update:modelValue",!1),t("close")}function _(G){const j=G.target;j.naturalWidth>0&&j.naturalHeight>0&&(r.value=j.naturalWidth,i.value=j.naturalHeight)}function C(){n.value=n.value===1?c5:1}function S(G){G.preventDefault();const j=G.deltaY<0?1.15:.87;n.value=d5(n.value*j)}function M(G){G.key==="Escape"&&N()}function O(){a.value=window.innerWidth,s.value=window.innerHeight}function q(){m==null||m(),m=null;const G=f.value;G&&(G.addEventListener("wheel",S,{passive:!1}),m=()=>G.removeEventListener("wheel",S))}return c.watch(()=>e.modelValue,G=>{G?(n.value=1,r.value=0,i.value=0,c.nextTick(()=>{var j;(j=l.value)==null||j.focus(),q()})):(m==null||m(),m=null)},{immediate:!0}),c.onMounted(()=>{document.addEventListener("keydown",M),window.addEventListener("resize",O)}),c.onBeforeUnmount(()=>{document.removeEventListener("keydown",M),window.removeEventListener("resize",O),m==null||m(),m=null}),()=>e.modelValue!==!0?null:c.createVNode(c.Teleport,{to:"body"},{default:()=>[c.createVNode("div",{class:"f-image-preview-overlay",role:"dialog","aria-modal":"true","aria-label":`图片预览:${e.name}`,style:{zIndex:e.zIndex},onClick:N},[c.createVNode("button",{type:"button",ref:l,class:"f-image-preview-close","aria-label":"关闭图片预览",onClick:N},[c.createVNode("i",{class:"fx-icon fx-icon-sidewindow_close"},null)]),c.createVNode("div",{class:"f-image-preview-content",onClick:G=>G.stopPropagation()},[c.createVNode("div",{ref:f,class:"f-image-preview-body",style:T.value},[c.createVNode("img",{class:"f-image-preview-image",src:e.src,alt:e.name,style:A.value,draggable:!1,onLoad:_,onClick:C},null)])])])]})}});ei.install=e=>{e.component(ei.name,ei)};const f5=new Set(["png","jpg","jpeg","gif","webp","bmp","svg","ico","avif"]);function vl(e){const t=(e.type??"").toLowerCase();return t==="image"||f5.has(t)?!0:/\.(png|jpe?g|gif|webp|bmp|svg|ico|avif)$/i.test(e.name??"")}const wl=c.defineComponent({name:"FXBubbleAttachment",props:Bd,emits:["preview","batchPreview","download"],setup(e,t){const n=c.computed(()=>e.attachments??[]),r=c.computed(()=>{var J;return((J=n.value)==null?void 0:J.length)>0}),i=c.ref([]),a=c.computed(()=>{if(e.role!=="user")return!1;const J=n.value;if(J.length!==1)return!1;const ae=J[0];return vl(ae)&&!!ae.url}),{formatFileName:s,formatFileSize:l,formatFileTime:f,getFileIcon:m}=Id(),g=c.ref(null);let p=null;function b(J){J.url&&(p=document.activeElement instanceof HTMLElement?document.activeElement:null,g.value={url:J.url,name:J.name})}function x(){g.value=null,p!=null&&p.isConnected&&p.focus(),p=null}const A=c.computed(()=>({"f-chat-bubble-attachment-info":!0,"f-utils-fill":e.enableFixedWidth})),T=c.computed(()=>({"f-chat-bubble-attachment-name":!0,"name-tip":e.enableFixedWidth}));function N(J,ae){if(!ae.pending){if(vl(ae)&&ae.url){b(ae);return}t.emit("preview",ae)}}function _(J,ae){const te=String(J.fileId??"").trim();if(te)return te;const he=String(J.url??"").trim();return he||`${J.name}:${ae}`}function C(J,ae){return i.value.includes(_(J,ae))}async function S(J,ae,te){if(J.stopPropagation(),J.preventDefault(),e.onDownload){t.emit("download",ae);return}const he=Qa(ae);if(!he)return;const ke=_(ae,te);if(!i.value.includes(ke)){i.value=[...i.value,ke];try{await ss(he,ae.name)}finally{i.value=i.value.filter(we=>we!==ke)}}}function M(J){J.stopPropagation(),J.preventDefault(),t.emit("batchPreview",n.value)}function O(J){switch(J.toLowerCase()){case"doc":case"docx":return"Word";case"xlsx":case"xls":return"Excel";case"ppt":case"pptx":return"PPT";case"txt":return"txt";case"png":case"jpg":case"jpeg":return"Image";case"pdf":return"PDF";case"md":return"Markdown";default:return""}}function q(J){if(!J)return null;const ae=O(J.type);return c.createVNode("div",{class:"file-info f-utils-fill"},[c.createVNode("span",{class:"file-name",title:J.name},[J.name]),c.createVNode("div",{class:"file-info-footer"},[c.createVNode("span",{class:`file-icon ${m(J.type,"file-type-",J.name)}`},null),ae&&c.createVNode(c.Fragment,null,[c.createVNode("span",{class:"file-type"},[O(J.type)])]),J.size&&c.createVNode(c.Fragment,null,[c.createVNode("div",{class:"file-info-divider"},null),c.createTextVNode(" "),c.createVNode("span",{class:"file-size"},[l(J.size)])])])])}function G(J,ae){const te=Qa(J),he=C(J,ae);return c.createVNode("div",{class:"f-chat-bubble-attachment-item "+m(J.type,"attachment-type-",J.name)+(J.pending?" status-working":""),key:ae,onClick:ke=>N(ke,J)},[c.createVNode("div",{class:"f-chat-bubble-attachment-main",role:"presentation"},[c.createVNode("div",{class:A.value},[c.createVNode("span",{class:"f-chat-bubble-attachment-icon file-icon "+m(J.type,"file-type-",J.name)},null),c.createVNode("span",{class:T.value,title:J.name},[s(J.name)]),J.pending===!0&&c.createVNode("div",{class:"f-chat-bubble-attachment-status status-working"},[c.createVNode(Fa,{status:"Working",variant:"attachment"},null),c.createTextVNode(" 生成中")]),J.timestamp?c.createVNode("span",{class:"f-chat-bubble-attachment-text"},[c.createTextVNode("创建时间:"),f(J.timestamp)]):J.size?c.createVNode("span",{class:"f-chat-bubble-attachment-size"},[c.createTextVNode("文件大小:"),l(J.size)]):null])]),e.showDownloadButton!==!1&&(te||e.onDownload)?c.createVNode("button",{type:"button",class:["f-chat-bubble-attachment-download-btn",{"is-downloading":he}],"aria-label":he?"正在下载":"下载附件","aria-busy":he?"true":"false",title:he?"正在下载":"下载",disabled:he,onClick:ke=>S(ke,J,ae)},[he?c.createVNode("span",{class:"f-chat-download-spinner","aria-hidden":"true"},null):c.createVNode("i",{class:"fx-icon fx-icon-sidewindow_download","aria-hidden":"true"},null)]):null])}function j(J){return J.url?c.createVNode("button",{type:"button",class:"f-chat-bubble-attachment-image","aria-label":`预览图片 ${J.name}`,title:J.name,onClick:ae=>{ae.stopPropagation(),b(J)}},[c.createVNode("img",{src:J.url,alt:J.name},null)]):null}function le(J,ae){return vl(J)&&J.url?c.createVNode("div",{class:"f-chat-bubble-attachment-image-wrap",key:ae},[j(J)]):c.createVNode("div",{class:"f-chat-bubble-attachment-toast",key:ae},[q(J)])}return()=>{var J,ae;return r.value?c.createVNode(c.Fragment,null,[c.createVNode("div",{class:{"f-chat-bubble-attachments":!0,"attachments-toast":e.role==="user","bubble-attachments-only-one-image":a.value}},[n.value.map((te,he)=>e.role==="user"?le(te,he):G(te,he)),e.enableBatchPreview&&c.createVNode("div",{class:"f-chat-bubble-attachment-preview-btn",onClick:M},[c.createVNode("span",{class:"f-chat-bubble-attachment-preview-btn-text"},[c.createTextVNode("查看全部文件")]),c.createVNode("i",{class:"fx-icon fx-icon-sort-asc-sm",style:{transform:"rotate(90deg)"}},null)])]),c.createVNode(ei,{modelValue:g.value!==null,src:((J=g.value)==null?void 0:J.url)??"",name:((ae=g.value)==null?void 0:ae.name)??"",onClose:x},null)]):null}}}),zd=c.defineComponent({name:"FXBubbleFileContentFooter",props:Md,setup(e,t){const n=c.computed(()=>e.file?Array.isArray(e.file)?[...e.file]:[e.file]:[]);return ln({},e.customStyle),()=>c.createVNode(wl,{attachments:n.value,onPreview:r=>{var i;return(i=e.onPreviewFile)==null?void 0:i.call(e,r)},onBatchPreview:r=>{var i;return(i=e.onBatchPreviewFile)==null?void 0:i.call(e,r)},onDownload:e.onDownloadFile},null)}}),Rd={pageUrl:{type:String,required:!0},customStyle:{type:Object,default:()=>({})},onNavigate:{type:Function,default:void 0}},Ld=c.defineComponent({name:"FXBubblePageEmbeddedContent",props:Rd,setup(e,t){const n=c.ref(),r=c.computed(()=>{var s,l;const a={width:"100%",height:"100%",border:"none"};return(s=e.customStyle)!=null&&s.width&&(a.width=e.customStyle.width),(l=e.customStyle)!=null&&l.height&&(a.height=`${e.customStyle.height}px`),a}),i=a=>{var s,l;((s=a.data)==null?void 0:s.type)==="navigation"&&((l=a.data)!=null&&l.url)&&e.onNavigate&&e.onNavigate(a.data.url)};return c.onMounted(()=>{window.addEventListener("message",i)}),c.onUnmounted(()=>{window.removeEventListener("message",i)}),()=>c.createVNode("iframe",{ref:n,src:e.pageUrl,style:r.value,scrolling:"auto"},null)}});function Pd(){function e(i,a){const{fileContent:s,height:l,width:f}=i;return{file:s,customStyle:{width:f||"100%",height:l||"100%"},onPreviewFile:a==null?void 0:a.onPreviewFile,onBatchPreviewFile:a==null?void 0:a.onBatchPreviewFile,onDownloadFile:a==null?void 0:a.onDownloadFile}}function t(i,a){const{pageUrl:s,height:l,width:f}=i;return{pageUrl:s,customStyle:{width:f||"100%",height:l||"100%"},onNavigate:a==null?void 0:a.onNavigate}}function n(i,a){const s=e(i,a);return c.h(zd,s)}function r(i,a){const s=t(i,a);return c.h(Ld,s)}return{renderFileEmbeddedContent:n,renderPageEmbeddedContent:r}}const Vd={title:{type:String,default:""},subtitle:{type:String,default:""},text:{type:String,default:""},textFormat:{type:String,default:"plain"},placement:{type:String,default:"start"},onDynamicComponentsDetected:{type:Function,default:void 0},onShowDynamicComponent:{type:Function,default:void 0}},xl="assistant-widget",qn="```";function eo(e,t){let n=t;for(;n<e.length&&/\s/.test(e[n]);)n+=1;return n}function Hd(e,t){let n=t;for(;n<e.length&&/[a-zA-Z0-9-]/.test(e[n]);)n+=1;return{lang:e.slice(t,n),next:n}}function qd(e){const t=e.toLowerCase();return t.length===0||t.length>xl.length?!1:xl.startsWith(t)}function h5(e){return e.toLowerCase()===xl}function m5(e,t){let n=0;for(;n<t;){const r=e.indexOf(qn,n);if(r===-1||r>=t)break;let i=r+qn.length;i=eo(e,i);const{lang:a}=Hd(e,i);if(a.length>0)return!0;n=r+qn.length}return!1}function $d(e,t){if(!e.startsWith(qn,t))return null;let n=t+qn.length;n=eo(e,n);const{lang:r,next:i}=Hd(e,n);return r.length===0?e.slice(i).trim().length===0?m5(e,t)?null:{fenceStart:t,bodyStart:i,langComplete:!1}:null:qd(r)?(n=eo(e,i),{fenceStart:t,bodyStart:n,langComplete:h5(r)}):null}function Al(e,t=0){const n=eo(e,t);return $d(e,n)}function p5(e,t,n){if(t<n)return!1;const r=e.slice(t+qn.length);return r.length===0?!0:r.startsWith("`")?!1:(/^\s*[\r\n]/.test(r)||/^\s*$/.test(r),!0)}function ls(e,t){let n=t;for(;n<=e.length;){const r=e.indexOf(qn,n);if(r===-1)return-1;if(p5(e,r,t))return r;n=r+1}return-1}function g5(e){const t=Al(e,0);if(!(t!=null&&t.langComplete))return null;const n=ls(e,t.bodyStart);return n===-1?null:e.slice(t.bodyStart,n).trim()}function Ud(e){return e.replace(/```\s*assistant-widget\s*/gi,"``` assistant-widget\n")}function b5(e){const t=e.match(/^\s*```\s*([a-zA-Z0-9-]*)$/);return t?qd(t[1]??""):!1}function y5(e,t){let n=t;for(;n<e.length;){const r=e.indexOf(qn,n);if(r===-1)return null;const i=$d(e,r);if(i)return{fenceIdx:r,open:i};n=r+qn.length}return null}function jd(e){if(!e)return!1;const t=Al(e,0);if(!(t!=null&&t.langComplete))return!1;const n=ls(e,t.bodyStart);return n===-1?!1:eo(e,n+qn.length)>=e.length}function v5(e){if(!e)return!1;if(jd(e)||b5(e))return!0;const t=Al(e,0);return t?t.langComplete?ls(e,t.bodyStart)===-1:!0:!1}function w5(e){if(!e)return[];const t=[];let n=0;for(;n<e.length;){const r=y5(e,n);if(!r){const f=e.slice(n);f&&t.push(f);break}const{fenceIdx:i,open:a}=r;if(i>n&&t.push(e.slice(n,i)),!a.langComplete){t.push(e.slice(i));break}const s=ls(e,a.bodyStart);if(s===-1){t.push(e.slice(i));break}const l=s+qn.length;t.push(Ud(e.slice(i,l))),n=l}return t.filter(r=>r.trim().length>0)}function Gd(e){const t=g5(Ud(e.trim()));if(t==null||t==="")return null;try{return JSON.parse(t)}catch(n){return console.error("Failed to parse JSON:",n),null}}function x5(e){var n;const t=Gd(e);return((n=t==null?void 0:t.renderer)==null?void 0:n.widgetImplOptions)||{}}const A5=/^```\s*dynamic-component\b[\s\S]*?```$/,k5=/^```\s*dynamic-component\b/,E5=/^```\s*dynamic-component\b\s*/,D5=/\s*```\s*$/;function C5(e){return e.replace(/```\s*dynamic-component\b/g,"``` dynamic-component")}function Wd(e){return e.replace(E5,"").replace(D5,"").trim()}function S5(e,t){let n=t;for(;n<e.length;){const r=e.indexOf("```",n);if(r<0)return null;const a=e.slice(r+3).match(/^\s*dynamic-component\b/);if(a)return{fenceStart:r,contentStart:r+3+a[0].length};n=r+3}return null}function T5(e){return e?A5.test(e)||k5.test(e):!1}function _5(e){const t=Wd(e);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!n||typeof n!="object"||Array.isArray(n))return null;const r=n;return typeof r.instanceId!="string"?null:{...r,instanceId:r.instanceId,name:typeof r.name=="string"?r.name:void 0,componentId:typeof r.componentId=="string"?r.componentId:void 0,jsUrl:typeof r.jsUrl=="string"?r.jsUrl:"",url:typeof r.url=="string"?r.url:"",title:typeof r.title=="string"?r.title:"预览",position:r.position==="inline"?"inline":"right",width:typeof r.width=="string"?r.width:void 0,isFullscreen:typeof r.isFullscreen=="boolean"?r.isFullscreen:!1,autoOpen:typeof r.autoOpen=="boolean"?r.autoOpen:!1,fileRe:typeof r.fileRe=="string"?r.fileRe:void 0,target:r.target==="preview"||r.target==="previewExtra"?r.target:r.renderArea==="previewExtra"?"previewExtra":r.renderArea==="preview"?"preview":void 0}}function F5(e){const t=Wd(e);if(!t)return null;const n=t.match(/"position"\s*:\s*"(inline|right)"/);return n?{position:n[1]}:null}function N5(e){if(!e)return[];const t=[];let n=0;for(;n<e.length;){const r=S5(e,n);if(!r){const f=e.slice(n);f&&t.push(f);break}const i=e.slice(n,r.fenceStart);i&&t.push(i);const a=e.indexOf("```",r.contentStart);if(a===-1){t.push(e.slice(r.fenceStart));break}const s=a+3,l=e.slice(r.fenceStart,s);t.push(C5(l)),n=s}return t.filter(r=>r.length>0)}var V0=(e=>(e.Text="text",e.FlowUIComplete="flowui-complete",e.AssistantWidgetComplete="assistant-widget-complete",e.AssistantWidgetPending="assistant-widget-pending",e.DynamicComponentComplete="dynamic-component-complete",e.DynamicComponentPending="dynamic-component-pending",e))(V0||{});function M5(e){var i;if(!e)return[];const t=[],n=new Set,r=w5(e);for(const a of r)if(v5(a))if(jd(a)){const s=Gd(a);t.push({type:V0.AssistantWidgetComplete,raw:a,widgetData:s,widgetUrl:(i=s==null?void 0:s.renderer)==null?void 0:i.url,widgetImplOptions:x5(a)})}else t.push({type:V0.AssistantWidgetPending,raw:a});else{const s=N5(a);for(const l of s)if(T5(l))if(l.endsWith("```")){const f=_5(l);if(f!=null&&f.instanceId){if(n.has(f.instanceId))continue;n.add(f.instanceId),t.push({type:V0.DynamicComponentComplete,raw:l,config:f})}}else{const f=F5(l);t.push({type:V0.DynamicComponentPending,raw:l,position:(f==null?void 0:f.position)??null})}else l.trim()&&t.push({type:V0.Text,raw:l})}return t}/*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */function Xd(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function B5(e){if(Array.isArray(e))return e}function I5(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,s,l=[],f=!0,m=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(f=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);f=!0);}catch(g){m=!0,i=g}finally{try{if(!f&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(m)throw i}}return l}}function O5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z5(e,t){return B5(e)||I5(e,t)||R5(e,t)||O5()}function R5(e,t){if(e){if(typeof e=="string")return Xd(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xd(e,t):void 0}}const Yd=Object.entries,Kd=Object.setPrototypeOf,L5=Object.isFrozen,P5=Object.getPrototypeOf,V5=Object.getOwnPropertyDescriptor;let k0=Object.freeze,T0=Object.seal,ti=Object.create,Zd=typeof Reflect<"u"&&Reflect,kl=Zd.apply,El=Zd.construct;k0||(k0=function(t){return t}),T0||(T0=function(t){return t}),kl||(kl=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a];return t.apply(n,i)}),El||(El=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new t(...r)});const Na=m0(Array.prototype.forEach),H5=m0(Array.prototype.lastIndexOf),Qd=m0(Array.prototype.pop),to=m0(Array.prototype.push),q5=m0(Array.prototype.splice),ni=Array.isArray,no=m0(String.prototype.toLowerCase),Dl=m0(String.prototype.toString),Jd=m0(String.prototype.match),ro=m0(String.prototype.replace),ef=m0(String.prototype.indexOf),$5=m0(String.prototype.trim),U5=m0(Number.prototype.toString),j5=m0(Boolean.prototype.toString),tf=typeof BigInt>"u"?null:m0(BigInt.prototype.toString),nf=typeof Symbol>"u"?null:m0(Symbol.prototype.toString),cn=m0(Object.prototype.hasOwnProperty),ao=m0(Object.prototype.toString),H0=m0(RegExp.prototype.test),Ma=G5(TypeError);function m0(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return kl(e,t,r)}}function G5(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return El(e,n)}}function Mt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:no;if(Kd&&Kd(e,null),!ni(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const a=n(i);a!==i&&(L5(t)||(t[r]=a),i=a)}e[i]=!0}return e}function W5(e){for(let t=0;t<e.length;t++)cn(e,t)||(e[t]=null);return e}function gn(e){const t=ti(null);for(const r of Yd(e)){var n=z5(r,2);const i=n[0],a=n[1];cn(e,i)&&(ni(a)?t[i]=W5(a):a&&typeof a=="object"&&a.constructor===Object?t[i]=gn(a):t[i]=a)}return t}function X5(e){switch(typeof e){case"string":return e;case"number":return U5(e);case"boolean":return j5(e);case"bigint":return tf?tf(e):"0";case"symbol":return nf?nf(e):"Symbol()";case"undefined":return ao(e);case"function":case"object":{if(e===null)return ao(e);const t=e,n=$n(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:ao(r)}return ao(e)}default:return ao(e)}}function $n(e,t){for(;e!==null;){const r=V5(e,t);if(r){if(r.get)return m0(r.get);if(typeof r.value=="function")return m0(r.value)}e=P5(e)}function n(){return null}return n}function Y5(e){try{return H0(e,""),!0}catch{return!1}}const rf=k0(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Cl=k0(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Sl=k0(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),K5=k0(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Tl=k0(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Z5=k0(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),af=k0(["#text"]),of=k0(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),_l=k0(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),sf=k0(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),cs=k0(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Q5=T0(/{{[\w\W]*|^[\w\W]*}}/g),J5=T0(/<%[\w\W]*|^[\w\W]*%>/g),ep=T0(/\${[\w\W]*/g),tp=T0(/^data-[\-\w.\u00B7-\uFFFF]+$/),np=T0(/^aria-[\-\w]+$/),uf=T0(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rp=T0(/^(?:\w+script|data):/i),ap=T0(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ip=T0(/^html$/i),op=T0(/^[a-z][.\w]*(-[.\w]+)+$/i),lf=T0(/<[/\w!]/g),cf=T0(/<[/\w]/g),sp=T0(/<\/no(script|embed|frames)/i),up=T0(/\/>/i),bn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},df=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],lp=k0(Mt({},df)),cp=function(){const e={};return Na(df,t=>{e[t]=T0(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),k0(e)}(),dp=function(){return typeof window>"u"?null:window},fp=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const a="dompurify"+(r?"#"+r:"");try{return t.createPolicy(a,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},ff=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Kr=function(t,n,r,i){return cn(t,n)&&ni(t[n])?Mt(i.base?gn(i.base):{},t[n],i.transform):r},Fl=function(t,n,r){const i=cn(t,n)?t[n]:void 0;return i&&typeof i=="object"?gn(i):r()};function hf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:dp();const t=Ie=>hf(Ie);if(t.version="3.4.14",t.removed=[],!e||!e.document||e.document.nodeType!==bn.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,i=r.currentScript;e.DocumentFragment;const a=e.HTMLTemplateElement,s=e.Node,l=e.Element,f=e.NodeFilter,m=e.NamedNodeMap;m===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const g=e.DOMParser,p=e.trustedTypes,b=l.prototype,x=$n(b,"cloneNode"),A=$n(b,"remove"),T=$n(b,"nextSibling"),N=$n(b,"childNodes"),_=$n(b,"parentNode"),C=$n(b,"shadowRoot"),S=$n(b,"attributes"),M=s&&s.prototype?$n(s.prototype,"nodeType"):null,O=s&&s.prototype?$n(s.prototype,"nodeName"):null,q=s&&s.prototype?$n(s.prototype,"ownerDocument"):null,G=function(V){return M?M(V):V.nodeType},j=function(V){return O?O(V):V.nodeName};if(typeof a=="function"){const Ie=n.createElement("template");Ie.content&&Ie.content.ownerDocument&&(n=Ie.content.ownerDocument)}let le,J="",ae,te=!1,he=0;const ke=function(){if(he>0)throw Ma('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},we=function(V){ke(),he++;try{return le.createHTML(V)}finally{he--}},U=function(V){ke(),he++;try{return le.createScriptURL(V)}finally{he--}},oe=function(){return te||(ae=fp(p,i),te=!0),ae},X=n,ye=X.implementation,Ne=X.createNodeIterator,je=X.createDocumentFragment,me=X.getElementsByTagName,be=r.importNode;let ge=ff();t.isSupported=typeof Yd=="function"&&typeof _=="function"&&ye&&ye.createHTMLDocument!==void 0;const Qe=Q5,st=J5,pe=ep,Ee=tp,Oe=np,tt=rp,rt=ap,ut=op;let xt=uf,ct=null;const At=Mt({},[...rf,...Cl,...Sl,...Tl,...af]);let ft=null;const d0=Mt({},[...of,..._l,...sf,...cs]);let Ye=Object.seal(ti(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),wt=null,P=null;const de=Object.seal(ti(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Se=!0,Ae=!0,He=!1,Pe=!0,ce=!1,xe=!0,Fe=!1,ht=!1,Et=null,Vt=null,P0=!1,Ht=!1,j0=!1,Er=!1,Vi=!0,G0=!1;const qr="user-content-";let an=!0,$r=!1,W0={},X0=null;const va=Mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let wa=null;const Hu=Mt({},["audio","video","img","source","image","track"]);let Ya=null;const a0=Mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),v="http://www.w3.org/1998/Math/MathML",k="http://www.w3.org/2000/svg",ve="http://www.w3.org/1999/xhtml";let B=ve,W=!1,qt=null;const Ke=Mt({},[v,k,ve],Dl),O0=k0(["mi","mo","mn","ms","mtext"]);let Dr=Mt({},O0);const it=k0(["annotation-xml"]);let i0=Mt({},it);const on=Mt({},["title","style","font","a","script"]);let rr=null;const K=["application/xhtml+xml","text/html"],ar="text/html";let ee=null,Ur=null;const qu=n.createElement("form"),ts=function(V){return V instanceof RegExp||V instanceof Function},xa=function(){let V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ur&&Ur===V)return;(!V||typeof V!="object")&&(V={}),V=gn(V),rr=K.indexOf(V.PARSER_MEDIA_TYPE)===-1?ar:V.PARSER_MEDIA_TYPE,ee=rr==="application/xhtml+xml"?Dl:no,ct=Kr(V,"ALLOWED_TAGS",At,{transform:ee}),ft=Kr(V,"ALLOWED_ATTR",d0,{transform:ee}),qt=Kr(V,"ALLOWED_NAMESPACES",Ke,{transform:Dl}),Ya=Kr(V,"ADD_URI_SAFE_ATTR",a0,{transform:ee,base:a0}),wa=Kr(V,"ADD_DATA_URI_TAGS",Hu,{transform:ee,base:Hu}),X0=Kr(V,"FORBID_CONTENTS",va,{transform:ee}),wt=Kr(V,"FORBID_TAGS",gn({}),{transform:ee}),P=Kr(V,"FORBID_ATTR",gn({}),{transform:ee}),W0=cn(V,"USE_PROFILES")?V.USE_PROFILES&&typeof V.USE_PROFILES=="object"?gn(V.USE_PROFILES):V.USE_PROFILES:!1,Se=V.ALLOW_ARIA_ATTR!==!1,Ae=V.ALLOW_DATA_ATTR!==!1,He=V.ALLOW_UNKNOWN_PROTOCOLS||!1,Pe=V.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ce=V.SAFE_FOR_TEMPLATES||!1,xe=V.SAFE_FOR_XML!==!1,Fe=V.WHOLE_DOCUMENT||!1,Ht=V.RETURN_DOM||!1,j0=V.RETURN_DOM_FRAGMENT||!1,Er=V.RETURN_TRUSTED_TYPE||!1,P0=V.FORCE_BODY||!1,Vi=V.SANITIZE_DOM!==!1,G0=V.SANITIZE_NAMED_PROPS||!1,an=V.KEEP_CONTENT!==!1,$r=V.IN_PLACE||!1,xt=Y5(V.ALLOWED_URI_REGEXP)?V.ALLOWED_URI_REGEXP:uf,B=typeof V.NAMESPACE=="string"?V.NAMESPACE:ve,Dr=Fl(V,"MATHML_TEXT_INTEGRATION_POINTS",()=>Mt({},O0)),i0=Fl(V,"HTML_INTEGRATION_POINTS",()=>Mt({},it));const ie=Fl(V,"CUSTOM_ELEMENT_HANDLING",()=>ti(null));if(Ye=ti(null),cn(ie,"tagNameCheck")&&ts(ie.tagNameCheck)&&(Ye.tagNameCheck=ie.tagNameCheck),cn(ie,"attributeNameCheck")&&ts(ie.attributeNameCheck)&&(Ye.attributeNameCheck=ie.attributeNameCheck),cn(ie,"allowCustomizedBuiltInElements")&&typeof ie.allowCustomizedBuiltInElements=="boolean"&&(Ye.allowCustomizedBuiltInElements=ie.allowCustomizedBuiltInElements),T0(Ye),ce&&(Ae=!1),j0&&(Ht=!0),W0&&(ct=Mt({},af),ft=ti(null),W0.html===!0&&(Mt(ct,rf),Mt(ft,of)),W0.svg===!0&&(Mt(ct,Cl),Mt(ft,_l),Mt(ft,cs)),W0.svgFilters===!0&&(Mt(ct,Sl),Mt(ft,_l),Mt(ft,cs)),W0.mathMl===!0&&(Mt(ct,Tl),Mt(ft,sf),Mt(ft,cs))),de.tagCheck=null,de.attributeCheck=null,cn(V,"ADD_TAGS")&&(typeof V.ADD_TAGS=="function"?de.tagCheck=V.ADD_TAGS:ni(V.ADD_TAGS)&&(ct===At&&(ct=gn(ct)),Mt(ct,V.ADD_TAGS,ee))),cn(V,"ADD_ATTR")&&(typeof V.ADD_ATTR=="function"?de.attributeCheck=V.ADD_ATTR:ni(V.ADD_ATTR)&&(ft===d0&&(ft=gn(ft)),Mt(ft,V.ADD_ATTR,ee))),cn(V,"ADD_FORBID_CONTENTS")&&ni(V.ADD_FORBID_CONTENTS)&&(X0===va&&(X0=gn(X0)),Mt(X0,V.ADD_FORBID_CONTENTS,ee)),an&&(ct["#text"]=!0),Fe&&Mt(ct,["html","head","body"]),ct.table&&(Mt(ct,["tbody"]),delete wt.tbody),V.TRUSTED_TYPES_POLICY){if(typeof V.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ma('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof V.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ma('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Ce=le;le=V.TRUSTED_TYPES_POLICY;try{J=we("")}catch(We){throw le=Ce,We}}else V.TRUSTED_TYPES_POLICY===null?(le=void 0,J=""):(le===void 0&&(le=oe()),le&&typeof J=="string"&&(J=we("")));k0&&k0(V),Ur=V},dt=Mt({},[...Cl,...Sl,...K5]),Hi=Mt({},[...Tl,...Z5]),qi=function(V,ie,Ce){return ie.namespaceURI===ve?V==="svg":ie.namespaceURI===v?V==="svg"&&(Ce==="annotation-xml"||Dr[Ce]):!!dt[V]},$u=function(V,ie,Ce){return ie.namespaceURI===ve?V==="math":ie.namespaceURI===k?V==="math"&&i0[Ce]:!!Hi[V]},$1=function(V,ie,Ce){return ie.namespaceURI===k&&!i0[Ce]||ie.namespaceURI===v&&!Dr[Ce]?!1:!Hi[V]&&(on[V]||!dt[V])},$i=function(V){let ie=_(V);(!ie||!ie.tagName)&&(ie={namespaceURI:B,tagName:"template"});const Ce=no(V.tagName),We=no(ie.tagName);return qt[V.namespaceURI]?V.namespaceURI===k?qi(Ce,ie,We):V.namespaceURI===v?$u(Ce,ie,We):V.namespaceURI===ve?$1(Ce,ie,We):!!(rr==="application/xhtml+xml"&&qt[V.namespaceURI]):!1},o0=function(V){to(t.removed,{element:V});try{_(V).removeChild(V)}catch{if(A(V),!_(V))throw Ma("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ui=function(V,ie,Ce){try{V.removeAttributeNode(ie)}catch{try{V.removeAttribute(Ce)}catch{}}},ji=function(V){Ka(V);const ie=N(V);if(ie){const We=[];Na(ie,at=>{to(We,at)}),Na(We,at=>{try{A(at)}catch{}})}const Ce=S(V);if(Ce)for(let We=Ce.length-1;We>=0;--We){const at=Ce[We],Je=at&&at.name;typeof Je=="string"&&Ui(V,at,Je)}},zn=function(V,ie,Ce){if(!Ce)try{Ce=ie.getAttributeNode(V)}catch{Ce=null}to(t.removed,{attribute:Ce||null,from:ie});try{Ce?ie.removeAttributeNode(Ce):ie.removeAttribute(V)}catch{try{ie.removeAttribute(V)}catch{}}if(V==="is")if(Ht||j0)try{o0(ie)}catch{}else try{ie.setAttribute(V,"")}catch{}},U1=function(V){const ie=S(V);if(ie)for(let Ce=ie.length-1;Ce>=0;--Ce){const We=ie[Ce],at=We&&We.name;typeof at!="string"||ft[ee(at)]||Ui(V,We,at)}},Ka=function(V){const ie=[V];for(;ie.length>0;){const Ce=ie.pop();G(Ce)===bn.element&&U1(Ce);const at=N(Ce);if(at)for(let Je=at.length-1;Je>=0;--Je)ie.push(at[Je])}},Gi=function(V,ie){return xe?V==="patchsrc"?!0:V==="for"&&ie!=="label"&&ie!=="output":!1},Me=function(V){if(!xe)return;const ie=[V];for(;ie.length>0;){const Ce=ie.pop(),We=G(Ce);if(We===bn.processingInstruction||We===bn.comment&&H0(cf,Ce.data)){try{A(Ce)}catch{}continue}if(We===bn.element){const Je=Ce,Lt=ee(j(Ce));try{Je.hasAttribute&&Je.hasAttribute("patchsrc")&&Je.removeAttribute("patchsrc"),Je.hasAttribute&&Je.hasAttribute("for")&&Gi("for",Lt)&&Je.removeAttribute("for")}catch{}}const at=N(Ce);if(at)for(let Je=at.length-1;Je>=0;--Je)ie.push(at[Je])}},ir=function(V){let ie=null,Ce=null;if(P0)V="<remove></remove>"+V;else{const Je=Jd(V,/^[\r\n\t ]+/);Ce=Je&&Je[0]}rr==="application/xhtml+xml"&&B===ve&&(V='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+V+"</body></html>");const We=le?we(V):V;if(B===ve)try{ie=new g().parseFromString(We,rr)}catch{}if(!ie||!ie.documentElement){ie=ye.createDocument(B,"template",null);try{ie.documentElement.innerHTML=W?J:We}catch{}}const at=ie.body||ie.documentElement;return V&&Ce&&at.insertBefore(n.createTextNode(Ce),at.childNodes[0]||null),B===ve?me.call(ie,Fe?"html":"body")[0]:Fe?ie.documentElement:at},jr=function(V){const ie=q?q(V):V.ownerDocument;return Ne.call(ie||V,V,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},Wi=function(V){return V=ro(V,Qe," "),V=ro(V,st," "),V=ro(V,pe," "),V},Tn=function(V){var ie;V.normalize();const Ce=q?q(V):V.ownerDocument,We=Ne.call(Ce||V,V,f.SHOW_TEXT|f.SHOW_COMMENT|f.SHOW_CDATA_SECTION|f.SHOW_PROCESSING_INSTRUCTION,null);let at=We.nextNode();for(;at;)at.data=Wi(at.data),at=We.nextNode();const Je=(ie=V.querySelectorAll)===null||ie===void 0?void 0:ie.call(V,"template");Je&&Na(Je,Lt=>{Aa(Lt.content)&&Tn(Lt.content)})},or=function(V){const ie=O?O(V):null;return typeof ie!="string"||ee(ie)!=="form"?!1:typeof V.nodeName!="string"||typeof V.textContent!="string"||typeof V.removeChild!="function"||V.attributes!==S(V)||typeof V.removeAttribute!="function"||typeof V.setAttribute!="function"||typeof V.namespaceURI!="string"||typeof V.insertBefore!="function"||typeof V.hasChildNodes!="function"||V.nodeType!==M(V)||V.childNodes!==N(V)},Aa=function(V){if(!M||typeof V!="object"||V===null)return!1;try{return M(V)===bn.documentFragment}catch{return!1}},St=function(V){if(!M||typeof V!="object"||V===null)return!1;try{return typeof M(V)=="number"}catch{return!1}};function _n(Ie,V,ie){Ie.length!==0&&Na(Ie,Ce=>{Ce.call(t,V,ie,Ur)})}const Xi=function(V,ie){return!!(xe&&V.hasChildNodes()&&!St(V.firstElementChild)&&H0(lf,V.textContent)&&H0(lf,V.innerHTML)||xe&&V.namespaceURI===ve&&lp[ie]&&(St(V.firstElementChild)||typeof V.textContent=="string"&&H0(cp[ie],V.textContent))||V.nodeType===bn.processingInstruction||xe&&V.nodeType===bn.comment&&H0(cf,V.data))},ka=function(V,ie){if(V instanceof RegExp)return H0(V,ie);if(V instanceof Function){for(var Ce=arguments.length,We=new Array(Ce>2?Ce-2:0),at=2;at<Ce;at++)We[at-2]=arguments[at];return!!V(ie,...We)}return!1},Uu=function(V,ie,Ce){if(!wt[ie]&&ju(ie)&&ka(Ye.tagNameCheck,ie))return!1;if(an&&!X0[ie]){const We=_(V),at=N(V);if(at&&We){const Je=at.length;for(let Lt=Je-1;Lt>=0;--Lt){const Xt=V===Ce?x(at[Lt],!0):at[Lt];We.insertBefore(Xt,T(V))}}}return o0(V),!0},ns=function(V,ie,Ce,We){return V.length===0?ie:ie===Ce||ie===We?gn(ie):ie},Wt=function(V,ie){return V===ie||_(V)!==null?!1:($r&&Ka(V),!0)},Cr=function(V,ie){if(_n(ge.beforeSanitizeElements,V,null),Wt(V,ie))return!0;if(or(V))return o0(V),!0;const Ce=ee(j(V));if(ct=ns(ge.uponSanitizeElement,ct,At,Et),_n(ge.uponSanitizeElement,V,{tagName:Ce,allowedTags:ct}),Wt(V,ie))return!0;if(Xi(V,Ce))return o0(V),!0;if(wt[Ce]||!(de.tagCheck instanceof Function&&de.tagCheck(Ce))&&!ct[Ce]){const at=Uu(V,Ce,ie);return at===!1&&_n(ge.afterSanitizeElements,V,null),at}if(G(V)===bn.element&&!$i(V)||(Ce==="noscript"||Ce==="noembed"||Ce==="noframes")&&H0(sp,V.innerHTML))return o0(V),!0;if(ce&&V.nodeType===bn.text){const at=Wi(V.textContent);V.textContent!==at&&(to(t.removed,{element:V.cloneNode()}),V.textContent=at)}return _n(ge.afterSanitizeElements,V,null),!1},Rn=function(V,ie,Ce){if(P[ie]||Gi(ie,V)||Vi&&(ie==="id"||ie==="name")&&(Ce in n||Ce in qu))return!1;const We=ft[ie]||de.attributeCheck instanceof Function&&de.attributeCheck(ie,V);return Ae&&H0(Ee,ie)||Se&&H0(Oe,ie)?!0:We?Ya[ie]||H0(xt,ro(Ce,rt,""))||(ie==="src"||ie==="xlink:href"||ie==="href")&&V!=="script"&&ef(Ce,"data:")===0&&wa[V]||He&&!H0(tt,ro(Ce,rt,""))?!0:!Ce:ju(V)&&ka(Ye.tagNameCheck,V)&&ka(Ye.attributeNameCheck,ie,V)||ie==="is"&&Ye.allowCustomizedBuiltInElements&&ka(Ye.tagNameCheck,Ce)},j1=Mt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ju=function(V){return!j1[no(V)]&&H0(ut,V)},Gu=function(V,ie,Ce,We){if(le&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!Ce)switch(p.getAttributeType(V,ie)){case"TrustedHTML":return we(We);case"TrustedScriptURL":return U(We)}return We},Yi=function(V,ie,Ce,We){try{Ce?V.setAttributeNS(Ce,ie,We):V.setAttribute(ie,We),or(V)?o0(V):Qd(t.removed)}catch{zn(ie,V)}},Za=function(V){_n(ge.beforeSanitizeAttributes,V,null);const ie=V.attributes;if(!ie||or(V))return;ft=ns(ge.uponSanitizeAttribute,ft,d0,Vt);const Ce={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ft,forceKeepAttr:void 0};let We=ie.length;const at=ee(V.nodeName);for(;We--;){const Je=ie[We],Lt=Je.name,Xt=Je.namespaceURI,z0=Je.value,R0=ee(Lt),Gr=z0;let pt=Lt==="value"?Gr:$5(Gr);if(Ce.attrName=R0,Ce.attrValue=pt,Ce.keepAttr=!0,Ce.forceKeepAttr=void 0,_n(ge.uponSanitizeAttribute,V,Ce),pt=Ce.attrValue,G0&&(R0==="id"||R0==="name")&&ef(pt,qr)!==0&&(zn(Lt,V,Je),pt=qr+pt),xe&&H0(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,pt)){zn(Lt,V,Je);continue}if(R0==="attributename"&&Jd(pt,"href")){zn(Lt,V,Je);continue}if(!Ce.forceKeepAttr){if(!Ce.keepAttr){zn(Lt,V,Je);continue}if(!Pe&&H0(up,pt)){zn(Lt,V,Je);continue}if(ce&&(pt=Wi(pt)),!Rn(at,R0,pt)){zn(Lt,V,Je);continue}pt=Gu(at,R0,Xt,pt),pt!==Gr&&Yi(V,Lt,Xt,pt)}}_n(ge.afterSanitizeAttributes,V,null)},Ue=function(V){let ie=null;const Ce=jr(V);for(_n(ge.beforeSanitizeShadowDOM,V,null);ie=Ce.nextNode();)if(_n(ge.uponSanitizeShadowNode,ie,null),Cr(ie,V),Za(ie),Aa(ie.content)&&Ue(ie.content),G(ie)===bn.element){const We=C(ie);Aa(We)&&(sr(We),Ue(We))}_n(ge.afterSanitizeShadowDOM,V,null)},sr=function(V){const ie=[{node:V,shadow:null}];for(;ie.length>0;){const Ce=ie.pop();if(Ce.shadow){Ue(Ce.shadow);continue}const We=Ce.node,Je=G(We)===bn.element,Lt=N(We);if(Lt)for(let Xt=Lt.length-1;Xt>=0;--Xt)ie.push({node:Lt[Xt],shadow:null});if(Je){const Xt=O?O(We):null;if(typeof Xt=="string"&&ee(Xt)==="template"){const z0=We.content;Aa(z0)&&ie.push({node:z0,shadow:null})}}if(Je){const Xt=C(We);Aa(Xt)&&ie.push({node:null,shadow:Xt},{node:Xt,shadow:null})}}};return t.sanitize=function(Ie){let V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=null,Ce=null,We=null,at=null;if(W=!Ie,W&&(Ie="<!-->"),typeof Ie!="string"&&!St(Ie)&&(Ie=X5(Ie),typeof Ie!="string"))throw Ma("dirty is not a string, aborting");if(!t.isSupported)return Ie;ht?(ct=Et,ft=Vt):xa(V),(ge.uponSanitizeElement.length>0||ge.uponSanitizeAttribute.length>0)&&(ct=gn(ct)),ge.uponSanitizeAttribute.length>0&&(ft=gn(ft)),t.removed=[];const Je=$r&&typeof Ie!="string"&&St(Ie);if(Je){Me(Ie);const z0=j(Ie);if(typeof z0=="string"){const R0=ee(z0);if(!ct[R0]||wt[R0])throw ji(Ie),Ma("root node is forbidden and cannot be sanitized in-place")}if(or(Ie))throw ji(Ie),Ma("root node is clobbered and cannot be sanitized in-place");try{sr(Ie)}catch(R0){throw ji(Ie),R0}}else if(St(Ie))ie=ir("<!---->"),Ce=ie.ownerDocument.importNode(Ie,!0),Ce.nodeType===bn.element&&Ce.nodeName==="BODY"||Ce.nodeName==="HTML"?ie=Ce:ie.appendChild(Ce),sr(Ce);else{if(!Ht&&!ce&&!Fe&&Ie.indexOf("<")===-1)return le&&Er?we(Ie):Ie;if(ie=ir(Ie),!ie)return Ht?null:Er?J:""}ie&&P0&&o0(ie.firstChild);const Lt=Je?Ie:ie;try{const z0=jr(Lt);for(;We=z0.nextNode();)Cr(We,Lt),Za(We),Aa(We.content)&&Ue(We.content)}catch(z0){throw Je&&(ji(Ie),Na(t.removed,R0=>{R0.element&&Ka(R0.element)})),z0}if(Je)return Na(t.removed,z0=>{z0.element&&Ka(z0.element)}),ce&&Tn(Ie),Ie;if(Ht){if(ce&&Tn(ie),j0)for(at=je.call(ie.ownerDocument);ie.firstChild;)at.appendChild(ie.firstChild);else at=ie;return(ft.shadowroot||ft.shadowrootmode)&&(at=be.call(r,at,!0)),at}let Xt=Fe?ie.outerHTML:ie.innerHTML;return Fe&&ct["!doctype"]&&ie.ownerDocument&&ie.ownerDocument.doctype&&ie.ownerDocument.doctype.name&&H0(ip,ie.ownerDocument.doctype.name)&&(Xt="<!DOCTYPE "+ie.ownerDocument.doctype.name+`>
3
3
  `+Xt),ce&&(Xt=Wi(Xt)),le&&Er?we(Xt):Xt},t.setConfig=function(){let Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xa(Ie),ht=!0,Et=ct,Vt=ft},t.clearConfig=function(){Ur=null,ht=!1,Et=null,Vt=null,le=ae,J=""},t.isValidAttribute=function(Ie,V,ie){Ur||xa({});const Ce=ee(Ie),We=ee(V);return Rn(Ce,We,ie)},t.addHook=function(Ie,V){typeof V=="function"&&cn(ge,Ie)&&to(ge[Ie],V)},t.removeHook=function(Ie,V){if(cn(ge,Ie)){if(V!==void 0){const ie=H5(ge[Ie],V);return ie===-1?void 0:q5(ge[Ie],ie,1)[0]}return Qd(ge[Ie])}},t.removeHooks=function(Ie){cn(ge,Ie)&&(ge[Ie]=[])},t.removeAllHooks=function(){ge=ff()},t}var hp=hf();class ze extends Error{constructor(t,n){var r="KaTeX parse error: "+t,i,a,s=n&&n.loc;if(s&&s.start<=s.end){var l=s.lexer.input;i=s.start,a=s.end,i===l.length?r+=" at end of input: ":r+=" at position "+(i+1)+": ";var f=l.slice(i,a).replace(/[^]/g,"$&̲"),m;i>15?m="…"+l.slice(i-15,i):m=l.slice(0,i);var g;a+15<l.length?g=l.slice(a,a+15)+"…":g=l.slice(a),r+=m+f+g}super(r),this.name="ParseError",Object.setPrototypeOf(this,ze.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}}var mp=/([A-Z])/g,Nl=e=>e.replace(mp,"-$1").toLowerCase(),pp={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},gp=/[&><"']/g,q0=e=>String(e).replace(gp,t=>pp[t]),ds=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?ds(e.body[0]):e:e.type==="font"?ds(e.body):e,bp=new Set(["mathord","textord","atom"]),Fr=e=>bp.has(ds(e).type),yp=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},Ml={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function vp(e){if("default"in e)return e.default;var t=e.type,n=Array.isArray(t)?t[0]:t;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class Bl{constructor(t){t===void 0&&(t={}),t=t||{};for(var n of Object.keys(Ml)){var r=Ml[n],i=t[n];this[n]=i!==void 0?r.processor?r.processor(i):i:vp(r)}}reportNonstrict(t,n,r){var i=this.strict;if(typeof i=="function"&&(i=i(t,n,r)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new ze("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),r);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,r){var i=this.strict;if(typeof i=="function")try{i=i(t,n,r)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var n=yp(t.url);if(n==null)return!1;t.protocol=n}var r=typeof this.trust=="function"?this.trust(t):this.trust;return!!r}}class Zr{constructor(t,n,r){this.id=t,this.size=n,this.cramped=r}sup(){return lr[wp[this.id]]}sub(){return lr[xp[this.id]]}fracNum(){return lr[Ap[this.id]]}fracDen(){return lr[kp[this.id]]}cramp(){return lr[Ep[this.id]]}text(){return lr[Dp[this.id]]}isTight(){return this.size>=2}}var Il=0,fs=1,ri=2,Nr=3,io=4,Mn=5,ai=6,K0=7,lr=[new Zr(Il,0,!1),new Zr(fs,0,!0),new Zr(ri,1,!1),new Zr(Nr,1,!0),new Zr(io,2,!1),new Zr(Mn,2,!0),new Zr(ai,3,!1),new Zr(K0,3,!0)],wp=[io,Mn,io,Mn,ai,K0,ai,K0],xp=[Mn,Mn,Mn,Mn,K0,K0,K0,K0],Ap=[ri,Nr,io,Mn,ai,K0,ai,K0],kp=[Nr,Nr,Mn,Mn,K0,K0,K0,K0],Ep=[fs,fs,Nr,Nr,Mn,Mn,K0,K0],Dp=[Il,fs,ri,Nr,ri,Nr,ri,Nr],bt={DISPLAY:lr[Il],TEXT:lr[ri],SCRIPT:lr[io],SCRIPTSCRIPT:lr[ai]},Ol=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function Cp(e){for(var t=0;t<Ol.length;t++)for(var n=Ol[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}var hs=[];Ol.forEach(e=>e.blocks.forEach(t=>hs.push(...t)));function mf(e){for(var t=0;t<hs.length;t+=2)if(e>=hs[t]&&e<=hs[t+1])return!0;return!1}var ii=80,Sp=function(t,n){return"M95,"+(622+t+n)+`
4
4
  c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14