@blueking/ai-blueking 2.2.2-beta.6 → 2.2.2-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chat-bot.vue.d.ts +2 -2
- package/dist/components/types.d.ts +3 -3
- package/dist/components/types.d.ts.map +1 -1
- package/dist/composables/use-ai-blueking-init.d.ts +11 -11
- package/dist/composables/use-ai-blueking-init.d.ts.map +1 -1
- package/dist/composables/use-event-bridge.d.ts +1 -1
- package/dist/composables/use-event-bridge.d.ts.map +1 -1
- package/dist/composables/use-session-handlers.d.ts +1 -1
- package/dist/composables/use-session-handlers.d.ts.map +1 -1
- package/dist/manager/business/chat-business-manager.d.ts.map +1 -1
- package/dist/manager/business/types.d.ts +3 -1
- package/dist/manager/business/types.d.ts.map +1 -1
- package/dist/manager/event-types.d.ts +1 -0
- package/dist/manager/event-types.d.ts.map +1 -1
- package/dist/standalone/index.es.min.js +20 -16
- package/dist/standalone/index.iife.min.js +2 -2
- package/dist/standalone/index.umd.min.js +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/vue2/index.es.min.js +20 -16
- package/dist/vue2/index.iife.min.js +3 -3
- package/dist/vue2/index.umd.min.js +3 -3
- package/dist/vue3/index.es.min.js +20 -16
- package/dist/vue3/index.iife.min.js +2 -2
- package/dist/vue3/index.umd.min.js +2 -2
- package/package.json +2 -2
|
@@ -235,7 +235,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
235
235
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,l;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,l=e},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw l}}}}function t(e,t){if(e){if(typeof e==`string`)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`)return Array.from(e);if(r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}}function n(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}var r=function(e){return typeof Element>`u`?!1:e instanceof Element},i=new Map,a;document.addEventListener(`mousedown`,function(e){return a=e}),document.addEventListener(`mouseup`,function(t){var n=e(i.values()),r;try{for(n.s();!(r=n.n()).done;){var o=r.value,s=e(o),l;try{for(s.s();!(l=s.n()).done;){var u=l.value.documentHandler;u(t,a)}}catch(e){s.e(e)}finally{s.f()}}}catch(e){n.e(e)}finally{n.f()}});function o(e,t){var n=[];return Array.isArray(t.arg)?n=t.arg:r(t.arg)&&n.push(t.arg),function(r,i){var a=t.instance.popperRef,o=r.target,s=i?.target,l=!t||!t.instance,u=!o||!s,d=e.contains(o)||e.contains(s),f=e===o,p=n.length&&n.some(function(e){return e?.contains(o)})||n.length&&n.includes(s),m=a&&(a.contains(o)||a.contains(s));l||u||d||f||p||m||t.value(r,i)}}var s={beforeMount:function(e,t){i.has(e)||i.set(e,[]),i.get(e).push({documentHandler:o(e,t),bindingFn:t.value})},updated:function(e,t){i.has(e)||i.set(e,[]);var n=i.get(e),r=n.findIndex(function(e){return e.bindingFn===t.oldValue}),a={documentHandler:o(e,t),bindingFn:t.value};r>=0?n.splice(r,1,a):n.push(a)},unmounted:function(e){i.delete(e)}};s.install=function(e){e.directive(`bkTooltips`,s)};let l=s;var u=Pd(6522),d=Pd(563),f=function(e,t){var n={content:``,target:e};return(0,u.default)(t)===`object`?(Object.assign(n,t),Object.prototype.hasOwnProperty.call(t,`popoverOption`)&&Object.assign(n,t.popoverOption)):n.content=t,n},p=function(e,t){var n=null,r=null,i=null;if(!(f(e,t).disabled||n)){var a=function(){i&&clearTimeout(i),i=null},o=function(){var e,t;r&&clearTimeout(r),(e=n)==null||e.hide(),(t=n)==null||t.close(),n=null},s=function(){o(),r&&clearTimeout(r),r=setTimeout(function(){var r=f(e,t);r.isShow=!0,r.content=typeof r.content==`function`?r.content():r.content||e.innerText,r.allowHtml=!0,Object.assign(r,{onContentMouseenter:a,onContentMouseleave:o}),n=(0,d.$bkPopover)(r)},300)},l=function(){i=setTimeout(function(){var e,t;r&&clearTimeout(r),(e=n)==null||e.hide(),(t=n)==null||t.close(),n=null},120)};return e.addEventListener(`mouseenter`,s),e.addEventListener(`mouseleave`,l),{destroyInstance:function(t){var n,r;l(),(n=t??e)==null||n.removeEventListener(`mouseenter`,s),(r=t??e)==null||r.removeEventListener(`mouseleave`,l)},instance:n}}};let m={mounted:function(e,t){p(e,t)}};var h=Pd(2439),g=Pd.n(h),_=typeof navigator<`u`&&navigator.userAgent.toLowerCase().indexOf(`firefox`)>-1,v=function(e,t){e!=null&&e.addEventListener&&e.addEventListener(_?`DOMMouseScroll`:`mousewheel`,function(e){var n=g()(e);t?.apply(this,[e,n])})};let y={beforeMount:function(e,t){v(e,t.value)}};var b=Pd(6666),x=Pd(7930),S=Pd(6609),C=Pd(9253);let w=(e=>{var t={};return Pd.d(t,e),t})({createPopper:()=>ha});function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?T(Object(n),!0).forEach(function(t){(0,b.default)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var D=new WeakMap,O={beforeMount:function(e,t){var n=A(t),r=n.trigger,i=n.showOnInit,a=M(n),o=null;if(i&&(0,S.nextTick)(function(){F(e)}),r===`hover`){var s=null;e.addEventListener(`mouseenter`,function(){o=setTimeout(function(){F(e),clearTimeout(s),clearTimeout(o)},n.delay)}),a.addEventListener(`mouseenter`,function(){clearTimeout(s)}),e.addEventListener(`mouseleave`,function(){clearTimeout(o),s=setTimeout(function(){I(e)},100)}),a.addEventListener(`mouseleave`,function(){clearTimeout(o),s=setTimeout(function(){I(e)},100)})}else r===`click`&&document.body.addEventListener(`click`,function(t){e.contains(t.target)&&!a.hasAttribute(`data-show`)?o=setTimeout(function(){F(e),clearTimeout(o)},n.delay):!e.contains(t.target)&&a.hasAttribute(`data-show`)&&I(e)});D.set(e,{opts:n,popper:a,popperInstance:null})},updated:function(e,t){D.get(e)&&(D.get(e).opts=A(t))},unmounted:function(e){I(e),D.delete(e)}};function k(){return{arrow:!0,disabled:!1,trigger:`hover`,theme:`dark`,content:``,showOnInit:!1,placement:`top`,distance:8,extCls:``,sameWidth:!1,delay:0,onShow:function(){},onHide:function(){}}}function A(e){var t=k();return(0,u.default)(e.value)===`object`?Object.assign(t,e.value):t.content=e.value,t}function j(e,t){if(typeof e==`string`)t.innerText=e;else{var n=document.createElement(`div`),r=(0,S.h)(e);(0,S.render)(r,n),t.innerHTML=n.innerHTML}}function M(e){var t=e.content,n=e.arrow,r=e.theme,i=e.extCls,a=r===`light`,o=C.bkZIndexManager.getPopperIndex(),s=document.createElement(`div`),l=document.documentElement.style.getPropertyValue(`--bk-prefix`)||`bk`;if(s.className=`${(0,C.resolveClassName)(`popper`,l)} ${a?`light`:`dark`} ${i}`,s.innerText=t,s.style.zIndex=String(o),j(t,s),n){var u=N();s.appendChild(u)}return s}function N(){var e=document.createElement(`div`),t=document.documentElement.style.getPropertyValue(`--bk-prefix`)||`bk`;return e.className=(0,C.resolveClassName)(`popper-arrow`,t),e.setAttribute(`data-popper-arrow`,``),e}function P(e,t){if(D.get(e)){var n=D.get(e).opts,r=n.placement,i=n.distance,a=n.sameWidth;return(0,w.createPopper)(e,t,{placement:r,modifiers:[{name:`offset`,options:{offset:[0,i]}},{name:`arrow`,options:{padding:5}}].concat((0,x.default)(a?[{name:`sameWidth`,enabled:!0,phase:`beforeWrite`,requires:[`computeStyles`],fn:function(e){var t=e.state;t.styles.popper.width=`${t.rects.reference.width}px`},effect:function(e){var t=e.state;t.elements.popper.style.overflowWrap=`break-word`,t.elements.popper.style.width=`${t.elements.reference.offsetWidth}px`}}]:[]))})}}function F(e){if(D.get(e)){var t=D.get(e),n=t.popper,r=t.opts,i=r.disabled,a=r.content,o=r.arrow,s=r.onShow,l=r.boundary,u=r.modifiers,d=u===void 0?[]:u;if(!i){if(j(a,n),o){var f=N();n.appendChild(f)}var p=document.body;l&&(l===`parent`?p=e.parentElement:l instanceof HTMLElement&&(p=l)),p.appendChild(n);var m=P(e,n);s(),n.setAttribute(`data-show`,``),m.setOptions(function(e){return E(E({},e),{},{modifiers:[].concat((0,x.default)(e.modifiers),(0,x.default)(d),[{name:`eventListeners`,enabled:!0}])})}),m.forceUpdate(),D.get(e).popperInstance=m}}}function I(e){if(D.get(e)){var t=D.get(e),n=t.popper,r=t.popperInstance,i=t.opts.onHide;if(n&&document.body.contains(n)){var a;n.removeAttribute(`data-show`),r?.destroy(),n==null||(a=n.parentNode)==null||a.removeChild(n),i()}}}let L=O,R=(e=>{var t={};return Pd.d(t,e),t})({vBkloading:()=>Rge}),ee=(e=>{var t={};return Pd.d(t,e),t})({overflowTitle:()=>c_e})})(),Fd.bkEllipsis,Fd.bkEllipsisInstance,Fd.bkLoading;var vxe=Fd.bkTooltips;Fd.clickoutside,Fd.mousewheel,Fd.overflowTitle;var Id=function(e){return e.ArtifactsGenerated=`artifacts_generated`,e.FlowAgent=`flow_agent`,e.KnowledgeRag=`knowledge_rag`,e.ReferenceDocument=`reference_document`,e.Info=`info`,e.Interrupt=`interrupt`,e}({}),Ld=function(e){return e.Activity=`activity`,e.Assistant=`assistant`,e.Developer=`developer`,e.Guide=`guide`,e.Hidden=`hidden`,e.HiddenAssistant=`hidden-assistant`,e.HiddenGuide=`hidden-guide`,e.HiddenSystem=`hidden-system`,e.HiddenUser=`hidden-user`,e.Info=`info`,e.Pause=`pause`,e.Placeholder=`placeholder`,e.Reasoning=`reasoning`,e.System=`system`,e.TemplateAssistant=`template-assistant`,e.TemplateGuide=`template-guide`,e.TemplateHidden=`template-hidden`,e.TemplateSystem=`template-system`,e.TemplateUser=`template-user`,e.Tool=`tool`,e.User=`user`,e.Interrupt=`interrupt`,e}({}),Rd=function(e){return e.Complete=`complete`,e.Error=`error`,e.Pending=`pending`,e.Stop=`stop`,e.Streaming=`streaming`,e}({}),zd=function(e){return e.Binary=`binary`,e.Function=`function`,e.Text=`text`,e}({}),Bd=function(e){return e.FlowNodeRetry=`flow_node_retry`,e.FlowNodeSkip=`flow_node_skip`,e.ApprovalCancel=`approval_cancel`,e}({}),yxe=()=>`temp_${Date.now()}_${Math.random().toString(36).slice(2,9)}`,bxe=e=>{let t=sn([]),n=sn(!1),r=sn(!1),i=r=>(n.value=!0,e.http?.message.getMessages(r).then(e=>{t.value=e}).finally(()=>{n.value=!1})),a=()=>f(t.value),o=e=>{t.value=t.value.map(t=>t.messageId===e.messageId?e:t)},s=e=>{t.value.push(e)},l=()=>t.value.findLast(e=>[Rd.Pending,Rd.Streaming].includes(e.status)),u=e=>t.value.find(t=>t.messageId===e),d=async n=>{let r=yxe(),i={...n,id:r,messageId:r};t.value.push(i);try{let i=await e.http?.message.plusMessage(n);if(i){let e=t.value.findIndex(e=>e.messageId===r);if(e!==-1){let r={...i,...`property`in n&&n.property?{property:n.property}:{}};t.value[e]=r}}}catch(e){let n=t.value.findIndex(e=>e.messageId===r);throw n!==-1&&(t.value[n]={...t.value[n],status:Rd.Error}),e}},f=async n=>{let i=n.reduce((e,t)=>(t.role===Ld.User&&e.push(t.id),e),[]);if(i.length<=0)return;let a=[...t.value];t.value=t.value.filter(e=>!n.includes(e)),r.value=!0;try{await e.http?.message.batchDeleteMessages(i)}catch(e){throw t.value=a,e}finally{r.value=!1}};return{list:t,isListLoading:n,isDeleteLoading:r,getMessages:i,clearMessages:a,getCurrentLoadingMessage:l,getMessageByMessageId:u,modifyMessage:o,plusMessage:s,createAndPlusMessage:d,deleteMessages:f,shareMessages:async(t,n,r)=>{let i=n.reduce((e,t)=>(t.role===Ld.User&&e.push(t.id),e),[]);if(!(i.length<=0))return e.http?.message.shareMessages(t,i,r)},getFlowAgentTaskInfo:t=>e.http?.message.getFlowAgentTaskInfo(t),getFlowAgentTaskNodeInfo:(t,n)=>e.http?.message.getFlowAgentTaskNodeInfo(t,n),reset:()=>{t.value=[],n.value=!1,r.value=!1}}},Vd=function(e){return e.ArtifactsGenerated=`artifacts_generated`,e.FlowAgentEnd=`flow_agent_end`,e.FlowAgentResult=`flow_agent_result`,e.FlowAgentStart=`flow_agent_start`,e.FlowAgentUpdate=`flow_agent_update`,e.FlowAgentRestart=`flow_agent_restart`,e.Info=`info`,e.KnowledgeRagEnd=`knowledge_rag_end`,e.KnowledgeRagResult=`knowledge_rag_result`,e.KnowledgeRagStart=`knowledge_rag_start`,e.KnowledgeRagTextContent=`knowledge_rag_text_content`,e.ReferenceDocument=`reference_document`,e.TempMessage=`temp_message`,e.ApprovalResult=`approval_result`,e}({}),Hd=function(e){return e.ActivityDelta=`ACTIVITY_DELTA`,e.ActivitySnapshot=`ACTIVITY_SNAPSHOT`,e.Custom=`CUSTOM`,e.MessagesSnapshot=`MESSAGES_SNAPSHOT`,e.Raw=`RAW`,e.RunError=`RUN_ERROR`,e.RunFinished=`RUN_FINISHED`,e.RunStarted=`RUN_STARTED`,e.StateDelta=`STATE_DELTA`,e.StateSnapshot=`STATE_SNAPSHOT`,e.StepFinished=`STEP_FINISHED`,e.StepStarted=`STEP_STARTED`,e.TextMessageChunk=`TEXT_MESSAGE_CHUNK`,e.TextMessageContent=`TEXT_MESSAGE_CONTENT`,e.TextMessageEnd=`TEXT_MESSAGE_END`,e.TextMessageStart=`TEXT_MESSAGE_START`,e.ThinkingEnd=`THINKING_END`,e.ThinkingStart=`THINKING_START`,e.ThinkingTextMessageContent=`THINKING_TEXT_MESSAGE_CONTENT`,e.ThinkingTextMessageEnd=`THINKING_TEXT_MESSAGE_END`,e.ThinkingTextMessageStart=`THINKING_TEXT_MESSAGE_START`,e.ToolCallArgs=`TOOL_CALL_ARGS`,e.ToolCallChunk=`TOOL_CALL_CHUNK`,e.ToolCallEnd=`TOOL_CALL_END`,e.ToolCallResult=`TOOL_CALL_RESULT`,e.ToolCallStart=`TOOL_CALL_START`,e}({}),xxe=function(e){return e.Blocked=`BLOCKED`,e.Created=`CREATED`,e.Failed=`FAILED`,e.Finished=`FINISHED`,e.LoopReady=`LOOP_READY`,e.Ready=`READY`,e.Revoked=`REVOKED`,e.RollBackFailed=`ROLL_BACK_FAILED`,e.RollBackSuccess=`ROLL_BACK_SUCCESS`,e.RollingBack=`ROLLING_BACK`,e.Running=`RUNNING`,e.Suspended=`SUSPENDED`,e}({}),Ud=function(e){return e.Success=`success`,e.Interrupt=`interrupt`,e}({}),Sxe=function(e){return e.Abandoned=`abandoned`,e.Approved=`approved`,e.Cancelled=`cancelled`,e.Draft=`draft`,e.Expired=`expired`,e.Rejected=`rejected`,e.Pending=`pending`,e}({}),Wd=function(e){return e.Resolved=`resolved`,e.Cancelled=`cancelled`,e}({}),Gd=class{messageModule;onDoneCallback;onErrorCallback;onMessageCallback;onStartCallback;constructor(e){this.onDoneCallback=e?.onDone,this.onErrorCallback=e?.onError,this.onMessageCallback=e?.onMessage,this.onStartCallback=e?.onStart}handleActivityDeltaEvent(e){}handleActivitySnapshotEvent(e){if(e.activityType===Id.Info){let t=this.messageModule.getMessageByMessageId(e.messageId);t?.role===Ld.Info&&(t.content=e.content);return}if(e.activityType===Id.Interrupt){let t=this.messageModule.getCurrentLoadingMessage();t?.role===Ld.Interrupt&&(t.content=e.content,t.status=Rd.Complete)}}handleArtifactsGeneratedCustomEvent(e){let t=this.messageModule.list.value.findLast(e=>e.role===Ld.Assistant);if(t){let n=e.value;t.property??={},t.property.artifacts=n.artifacts}}handleCustomEvent(e){switch(e.name){case Vd.ArtifactsGenerated:this.handleArtifactsGeneratedCustomEvent(e);break;case Vd.FlowAgentStart:this.handleFlowAgentStartCustomEvent(e);break;case Vd.FlowAgentResult:this.handleFlowAgentResultCustomEvent(e);break;case Vd.FlowAgentEnd:this.handleFlowAgentEndCustomEvent(e);break;case Vd.FlowAgentRestart:this.handleFlowAgentRestartCustomEvent(e);break;case Vd.ReferenceDocument:this.handleReferenceDocumentCustomEvent(e);break;case Vd.KnowledgeRagStart:this.handleKnowledgeRagStartCustomEvent(e);break;case Vd.KnowledgeRagTextContent:this.handleKnowledgeRagTextContentCustomEvent(e);break;case Vd.KnowledgeRagResult:this.handleKnowledgeRagResultCustomEvent(e);break;case Vd.KnowledgeRagEnd:this.handleKnowledgeRagEndCustomEvent(e);break;case Vd.TempMessage:this.handleTempMessageCustomEvent(e);break;case Vd.ApprovalResult:this.handleApprovalResultCustomEvent(e);break;case Vd.FlowAgentUpdate:this.handleFlowAgentUpdateCustomEvent(e);break;case Vd.Info:this.handleInfoCustomEvent(e);break;default:break}}handleFlowAgentEndCustomEvent(e){let t=this.messageModule.getCurrentLoadingMessage();if(t&&t.role===Ld.Activity&&t.activityType===Id.FlowAgent){t.status=Rd.Complete;let n=e.value;this.messageModule.plusMessage({role:Ld.Assistant,content:n.map(e=>e.task_outputs.join(`
|
|
236
236
|
`)).join(`
|
|
237
237
|
`),status:Rd.Complete})}}handleFlowAgentRestartCustomEvent(e){let t=e.value;this.messageModule.list.value.forEach(e=>{e.role===Ld.Activity&&e.activityType===Id.FlowAgent&&e.content[0].task_id===t[0].task_id&&(e.status=Rd.Streaming)})}handleFlowAgentResultCustomEvent(e){let t=this.messageModule.getCurrentLoadingMessage();t&&t.role===Ld.Activity&&t.activityType===Id.FlowAgent&&(t.content=e.value)}handleFlowAgentStartCustomEvent(e){let t=e.value;this.messageModule.plusMessage({role:Ld.Activity,activityType:Id.FlowAgent,content:t.map(e=>({nodes:{},task_id:e.task_id,task_name:``,task_outputs:[],task_state:xxe.Created})),status:Rd.Streaming})}handleFlowAgentUpdateCustomEvent(e){let t=e.value;this.messageModule.list.value.forEach(e=>{e.role===Ld.Activity&&e.activityType===Id.FlowAgent&&e.content[0].task_id===t[0].task_id&&(e.content=t)})}handleInfoCustomEvent(e){let t=e.value;this.messageModule.plusMessage({role:Ld.Info,messageId:t.messageId,content:t.content,status:Rd.Complete})}handleKnowledgeRagEndCustomEvent(e){let t=this.messageModule.getCurrentLoadingMessage();t&&t.role===Ld.Activity&&t.activityType===Id.KnowledgeRag&&(t.status=Rd.Complete)}handleKnowledgeRagResultCustomEvent(e){let t=this.messageModule.getCurrentLoadingMessage();t&&t.role===Ld.Activity&&t.activityType===Id.KnowledgeRag&&(t.content.referenceDocument=e.value)}handleKnowledgeRagStartCustomEvent(e){this.messageModule.plusMessage({role:Ld.Activity,activityType:Id.KnowledgeRag,content:{content:``,referenceDocument:[]},status:Rd.Streaming})}handleKnowledgeRagTextContentCustomEvent(e){let t=this.messageModule.getCurrentLoadingMessage();if(t&&t.role===Ld.Activity&&t.activityType===Id.KnowledgeRag){let n=e.value;t.content.content=n.cover?n.chunk.content:t.content.content+n.chunk.content}}handleMessagesSnapshotEvent(e){e.messages&&e.messages.length>0&&(this.messageModule.list.value=e.messages)}handleRawEvent(e){}handleReferenceDocumentCustomEvent(e){this.messageModule.plusMessage({role:Ld.Activity,activityType:Id.ReferenceDocument,content:e.value,status:Rd.Complete})}handleRunErrorEvent(e){let t=this.messageModule.getCurrentLoadingMessage();t&&(t.status=Rd.Complete),this.messageModule.plusMessage({role:Ld.Assistant,content:e.message,status:Rd.Error})}handleRunFinishedEvent(e){let t=this.messageModule.getCurrentLoadingMessage();t&&(t.status=Rd.Complete),e.outcome?.type===Ud.Interrupt&&this.messageModule.plusMessage({role:Ld.Interrupt,content:e,status:Rd.Pending}),e.outcome?.type===Ud.Success&&t?.role===Ld.Interrupt&&(t.content=e)}handleRunStartedEvent(e){}handleStateDeltaEvent(e){}handleStateSnapshotEvent(e){}handleStepFinishedEvent(e){}handleStepStartedEvent(e){}handleTempMessageCustomEvent(e){let t=e.value;this.messageModule.plusMessage({role:Ld.Assistant,content:t.message,status:t.status})}handleApprovalResultCustomEvent(e){let t=e.value,n=this.messageModule.getCurrentLoadingMessage();n&&(n.content=t,n.status=Rd.Complete)}handleTextMessageChunkEvent(e){let t=this.messageModule.getCurrentLoadingMessage();t?t.content+=e.delta||``:this.messageModule.plusMessage({role:e.role,content:e.delta||``,status:Rd.Complete,messageId:e.messageId})}handleTextMessageContentEvent(e){let t=this.messageModule.getMessageByMessageId(e.messageId);t&&(t.content+=e.delta)}handleTextMessageEndEvent(e){let t=this.messageModule.getMessageByMessageId(e.messageId);t&&(t.status=Rd.Complete)}handleTextMessageStartEvent(e){let t=this.messageModule.getMessageByMessageId(e.messageId);if(t){t.content=``,t.status=Rd.Streaming;return}this.messageModule.plusMessage({role:e.role,content:``,status:Rd.Streaming,messageId:e.messageId})}handleThinkingEndEvent(e){let t=this.messageModule.getCurrentLoadingMessage();t&&t.role===Ld.Reasoning&&(t.duration=e.duration,t.status=Rd.Complete)}handleThinkingStartEvent(e){this.messageModule.plusMessage({role:Ld.Reasoning,content:[],status:Rd.Streaming})}handleThinkingTextMessageContentEvent(e){let t=this.messageModule.getCurrentLoadingMessage();t&&t.role===Ld.Reasoning&&(t.content[t.content.length-1]+=e.delta)}handleThinkingTextMessageEndEvent(e){}handleThinkingTextMessageStartEvent(e){let t=this.messageModule.getCurrentLoadingMessage();t&&t.role===Ld.Reasoning&&t.content.push(``)}handleToolCallArgsEvent(e){this.messageModule.list.value.forEach(t=>{t.role===Ld.Assistant&&t.toolCalls&&t.toolCalls.forEach(t=>{t.id===e.toolCallId&&(t.function.arguments+=e.delta)})})}handleToolCallChunkEvent(e){}handleToolCallEndEvent(e){this.messageModule.list.value.forEach(t=>{t.role===Ld.Assistant&&t.toolCalls&&t.toolCalls.some(t=>t.id===e.toolCallId)&&(t.status=Rd.Complete)})}handleToolCallResultEvent(e){this.messageModule.plusMessage({role:Ld.Tool,content:e.content,duration:e.duration,status:e.isError?Rd.Error:Rd.Complete,toolCallId:e.toolCallId,messageId:e.messageId})}handleToolCallStartEvent(e){this.messageModule.plusMessage({role:Ld.Assistant,content:``,status:Rd.Streaming,toolCalls:[{id:e.toolCallId,type:zd.Function,function:{mcpName:e.mcpName,name:e.toolCallName,arguments:``,description:e.description}}]})}injectMessageModule(e){this.messageModule=e}onDone(){this.onDoneCallback?.()}onError(e){this.messageModule?.plusMessage({role:Ld.Assistant,content:e.message,status:Rd.Error}),this.onErrorCallback?.(e)}onMessage(e){let t=e;switch(this.onMessageCallback?.(t),t.type){case Hd.ActivityDelta:this.handleActivityDeltaEvent(t);break;case Hd.ActivitySnapshot:this.handleActivitySnapshotEvent(t);break;case Hd.Custom:this.handleCustomEvent(t);break;case Hd.MessagesSnapshot:this.handleMessagesSnapshotEvent(t);break;case Hd.Raw:this.handleRawEvent(t);break;case Hd.RunError:this.handleRunErrorEvent(t);break;case Hd.RunFinished:this.handleRunFinishedEvent(t);break;case Hd.RunStarted:this.handleRunStartedEvent(t);break;case Hd.StateDelta:this.handleStateDeltaEvent(t);break;case Hd.StateSnapshot:this.handleStateSnapshotEvent(t);break;case Hd.StepFinished:this.handleStepFinishedEvent(t);break;case Hd.StepStarted:this.handleStepStartedEvent(t);break;case Hd.TextMessageChunk:this.handleTextMessageChunkEvent(t);break;case Hd.TextMessageContent:this.handleTextMessageContentEvent(t);break;case Hd.TextMessageEnd:this.handleTextMessageEndEvent(t);break;case Hd.TextMessageStart:this.handleTextMessageStartEvent(t);break;case Hd.ThinkingEnd:this.handleThinkingEndEvent(t);break;case Hd.ThinkingStart:this.handleThinkingStartEvent(t);break;case Hd.ThinkingTextMessageContent:this.handleThinkingTextMessageContentEvent(t);break;case Hd.ThinkingTextMessageEnd:this.handleThinkingTextMessageEndEvent(t);break;case Hd.ThinkingTextMessageStart:this.handleThinkingTextMessageStartEvent(t);break;case Hd.ToolCallArgs:this.handleToolCallArgsEvent(t);break;case Hd.ToolCallChunk:this.handleToolCallChunkEvent(t);break;case Hd.ToolCallEnd:this.handleToolCallEndEvent(t);break;case Hd.ToolCallResult:this.handleToolCallResultEvent(t);break;case Hd.ToolCallStart:this.handleToolCallStartEvent(t);break;default:break}}onStart(){this.onStartCallback?.()}},Kd=function(e){return e.Running=`running`,e.Finished=`finished`,e.Failed=`failed`,e.Cancelled=`cancelled`,e}({}),Cxe=5,wxe=1e3,Txe=8e3,Exe=e=>Math.min(wxe*2**(e-1),Txe),Dxe=e=>{if(e.name===`AbortError`)return!1;let t=e.response?.status,n=e.message.match(/status code (\d+)/i),r=t??(n?Number(n[1]):void 0);if(r!==void 0){if(r===408||r===429)return!0;if(r>=400&&r<500)return!1;if(r>=500)return!0}return!0},Oxe=(e,t)=>{let n=sn(null),r=sn(!1),i=sn(!1),a=sn([]),o=sn(!1),s=t||new Gd,l=null,u=null,d=null,f=!1,p=0,m=!1,h=null,g=null,_=null,v=(t,n)=>{o.value=!0;let r=e.http?.agent.getLlms(t,n);return r?r.then(e=>(a.value=e,e)).catch(e=>{throw a.value=[],e}).finally(()=>{o.value=!1}):(o.value=!1,a.value=[],Promise.resolve([]))},y=()=>(r.value=!0,e.http?.agent.getAgentInfo().then(e=>{n.value=e}).finally(()=>{r.value=!1})),b=(t,n)=>{let r=t.promptSetting?.content?.at(-1);r?.role===Ld.Pause&&e.message?.createAndPlusMessage({role:Ld.Assistant,content:r.content,status:Rd.Complete,sessionCode:n,property:{extra:{pause:!0}}})},x=(t,n,r,i,a)=>e.http?.message.userOperation(t,n,r,i).then(()=>{n===Bd.ApprovalCancel?(M(),j(t,a)):O({sessionCode:t,config:i,model:a})}),S=(e=!1)=>{if(h&&=(clearTimeout(h),null),g){let t=g;g=null,t(e)}},C=e=>new Promise(t=>{g=t,h=setTimeout(()=>{h=null,g=null,t(!0)},e)}),w=()=>{f=!1,p=0,m=!1,S(!1)},T=()=>{let t=e.message?.list.value;if(t?.length)for(;t.length>0;){let e=t[t.length-1];if(e.role===Ld.User)break;if(e.status===Rd.Streaming||e.status===Rd.Pending){t.pop();continue}break}},E=t=>t===e.session?.current?.value?.sessionCode,D=async t=>{if(f||!E(t))return`failed`;try{await e.session?.getSession(t)}catch{}if(f||!E(t))return`failed`;if(e.session?.current.value?.status!==Kd.Running)return`finished`;if(p>=Cxe||(p+=1,i.value=!0,!await C(Exe(p))||f||!E(t)))return`failed`;if(e.session?.current.value?.status!==Kd.Running)return`finished`;T();let n=e.message?.list.value.at(-1)?.id,r=_;return O({sessionCode:t,model:r?.model,url:r?.url,config:r?.config,lastMessageId:n===void 0?void 0:String(n),isReconnect:!0}),`reconnected`},O=async({sessionCode:t,model:n,url:r,config:a,resume:o,input:u,lastMessageId:d,isReconnect:p=!1})=>{p||w(),_={sessionCode:t,model:n,url:r,config:a},s instanceof Gd&&s.injectMessageModule(e.message),u&&e.message?.list.value.push({role:Ld.User,content:u,status:Rd.Complete,sessionCode:t});let h=()=>{i.value=!1,s.onDone?.call(s),u&&e.http?.message?.getMessages(t).then(t=>{let n=e.message?.list.value.findLast(e=>e.role===Ld.User),r=t.findLast(e=>e.role===Ld.User);n&&r&&(n.id=r.id)}),j(t)},g=e=>{i.value=!1,s.onError?.call(s,e)};l=new AbortController,e.http?.fetchClient.streamRequest({url:r||`chat_completion/`,method:`POST`,data:{session_code:t,model:n,input:u,execute_kwargs:{stream:!0,persist_input:!!u,last_message_id:d,resume:o}},controller:l,onDone:()=>{if(f||m){h();return}D(t).then(e=>{if(e!==`reconnected`){if(e===`finished`){h();return}if(f||!E(t)){i.value=!1;return}g(Error(`Connection lost, please try again`))}})},onError:e=>{if(!f){if(!Dxe(e)){g(e);return}D(t).then(n=>{if(n!==`reconnected`){if(n===`finished`){h();return}if(f||!E(t)){i.value=!1;return}g(e)}})}},onMessage:e=>{e?.type===Hd.RunFinished&&(m=!0),s.onMessage?.call(s,e)},onStart:()=>{i.value=!0,s.onStart?.call(s)},...a}).catch(()=>{})},k=async(t,n,r,i,a,o)=>{await e.message?.createAndPlusMessage({role:Ld.User,content:t,status:Rd.Complete,sessionCode:n,...a&&{property:a}}),O({sessionCode:n,model:o,url:r,config:i})},A=(t,n,r,i)=>{if(e.session?.current.value?.status===Kd.Running){let a=e.message?.list.value.at(-1)?.id;O({sessionCode:t,model:i,url:n,config:r,lastMessageId:a})}},j=(t,n)=>{let r=e.message?.list.value.at(-1),i=r?.content?.outcome?.type===Ud.Interrupt?r.content.outcome.interrupts.find(e=>[Sxe.Pending,Sxe.Draft].includes(e.metadata?.ticket?.status)):void 0;r?.role===Ld.Interrupt&&i&&(M(),u=new AbortController,e.http?.session.isResumeSession(t,{controller:u}).then(r=>{r?O({sessionCode:t,model:n,resume:{interruptId:i.id,status:Wd.Resolved}}):d=setTimeout(()=>{t===e.session?.current?.value?.sessionCode&&j(t,n)},1e4)}))},M=()=>{clearTimeout(d),d=null,u?.abort?.(),u=null},N=()=>{f=!0,S(!1),l?.abort?.(),l=null};return{info:n,isInfoLoading:r,isChatting:i,models:a,isModelsLoading:o,chat:k,handleRole:b,resendMessage:async(t,n,r,i,a,o)=>{let s=e.message?.list.value||[],l=s.findIndex(e=>String(e.id)===t);if(l===-1)throw Error(`Message not found: ${t}`);let u=s[l];if(u.role!==Ld.User)throw Error(`Can only resend user messages`);let d=u.content,f=u.property,p=r??d,m=s.slice(l),h=e.message?.deleteMessages(m),g=e.message?.createAndPlusMessage({role:Ld.User,content:p,status:Rd.Complete,sessionCode:n,...f&&{property:f}});O({sessionCode:n,model:o,url:i,config:a}),Promise.all([h,g]).catch(e=>{console.error(`[resendMessage] API error:`,e)})},resumeStreamingChat:A,abortChat:N,stopChat:async t=>e.http.message?.stopChat(t),getAgentInfo:y,getLlms:v,reset:e=>{N(),s=e||new Gd,n.value=null,r.value=!1,i.value=!1,a.value=[],o.value=!1,_=null,p=0,m=!1},pollResumeSession:j,clearLongPollTimer:M,userOperationStreamRequest:x,streamRequest:O}};function kxe(e){return on(e)}function qd(e){if(e==null)return;let t=e,n=0;for(;n<32;){if(n+=1,typeof t==`function`){t=t();continue}if(kxe(t)){t=z(t);continue}break}return n>=32&&console.warn(`[chat-helper] resolveRequestValue: exceeded max unwrap depth`),t}var Axe=class{handlers=[];clear(){this.handlers=[]}eject(e){this.handlers[e]&&(this.handlers[e]=null)}forEach(e){this.handlers.forEach(t=>{t!==null&&e(t)})}use(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1}},jxe=class e{defaults;interceptors;globalErrorHandler;ignoreErrorPatterns=[];constructor(e={}){this.defaults=Qd({method:`GET`,headers:{"Content-Type":`application/json`},timeout:3e4,responseType:`json`,credentials:`include`,mode:`cors`,validateStatus:e=>e>=200&&e<300},e),this.interceptors={request:new Axe,response:new Axe}}onError(e,t){this.globalErrorHandler=e,t?.ignoreErrors&&(this.ignoreErrorPatterns=t.ignoreErrors)}shouldIgnoreError(e){let t=e.config?.url||``,n=e.config?.baseURL||``,r=n&&!t.startsWith(`http`)?n+t:t;return this.ignoreErrorPatterns.some(e=>typeof e==`string`?t.includes(e)||r.includes(e):e.test(t)||e.test(r))}dispatchError(e){this.globalErrorHandler&&!this.shouldIgnoreError(e)&&this.globalErrorHandler(e)}applyResponseErrorInterceptors(e){let t=e;return this.interceptors.response.forEach(e=>{e.rejected&&(t=e.rejected(t))}),t}create(t){return new e(Qd(this.defaults,t||{}))}delete(e,t,n){return this.request({...n,url:e,method:`DELETE`,params:t})}get(e,t,n){return this.request({...n,url:e,method:`GET`,params:t})}head(e,t,n){return this.request({...n,url:e,method:`HEAD`,params:t})}options(e,t,n){return this.request({...n,url:e,method:`OPTIONS`,params:t})}patch(e,t,n){return this.request({...n,url:e,method:`PATCH`,data:t})}post(e,t,n){return this.request({...n,url:e,method:`POST`,data:t})}prepareRequest(e,t=!1){let n=Qd(this.defaults,e);this.interceptors.request.forEach(e=>{if(e.fulfilled)try{n=e.fulfilled(n)}catch(t){throw e.rejected?e.rejected(t):t}});let r=n.url||``;n.baseURL&&!r.startsWith(`http`)&&(r=n.baseURL+r),r=Mxe(r,n.params);let i=Zd(n.data),a=new Headers(Zd(n.headers));t&&!a.has(`Accept`)&&a.set(`Accept`,`text/event-stream`),i!=null&&(n.transformRequest?i=n.transformRequest(i,Zd(n.headers)):a.get(`Content-Type`)?.includes(`application/json`)&&typeof i==`object`&&!(i instanceof FormData)&&!(i instanceof Blob)&&!(i instanceof ArrayBuffer)&&(i=JSON.stringify(i)));let o=n.controller??new AbortController,s={method:n.method,credentials:n.credentials,mode:n.mode,headers:a,body:i,signal:o.signal};return{url:r,requestConfig:n,fetchConfig:s,controller:o}}put(e,t,n){return this.request({...n,url:e,method:`PUT`,data:t})}async request(e){let{url:t,fetchConfig:n,requestConfig:r,controller:i}=this.prepareRequest(e),a=!1,o=r.timeout&&r.timeout>0?setTimeout(()=>{a=!0,i.abort()},r.timeout):void 0;try{let e=await fetch(t,n);o&&clearTimeout(o);let i,a=r.responseType||`json`;try{switch(a){case`json`:i=await e.json();break;case`text`:i=await e.text();break;case`blob`:i=await e.blob();break;case`arrayBuffer`:i=await e.arrayBuffer();break;case`formData`:i=await e.formData();break;default:i=await e.json()}}catch{i=null}r.transformResponse&&(i=r.transformResponse(i));let s={data:i,status:e.status,statusText:e.statusText,headers:e.headers,config:r};if(!(r.validateStatus||this.defaults.validateStatus)(e.status)){let{code:t,message:n}=Jd(s.data,`Request failed with status code ${e.status}`);throw Xd(n,r,t,s)}let l=s;this.interceptors.response.forEach(e=>{if(e.fulfilled)try{l=e.fulfilled(l)}catch(t){throw e.rejected?e.rejected(t):t}}),l instanceof Promise&&(l=await l);let u=l.data;if(!u)return;if(![0,`success`].includes(u.code)){let{code:e,message:t}=Jd(u,`Request failed with code ${u.code}`);throw Xd(t,r,e,l)}return u.data}catch(e){if(o&&clearTimeout(o),e instanceof Error&&e.name===`AbortError`&&!a){console.warn(`User canceled request`,e.message);return}let t=a?Xd(`timeout of ${r.timeout}ms exceeded`,r,`ECONNABORTED`,void 0):e.isAxiosError===!0?e:Xd(e.message,r,e.code,void 0);throw this.dispatchError(t),this.applyResponseErrorInterceptors(t)}}stream(e,t){return this.streamRequest({...t,url:e})}async streamRequest(e){let t=!1,n=e.onError,r=e=>{if(!t){let n=e;n.config||=s,this.dispatchError(n),t=!0}n?.(e)},i={...e,onError:r},{url:a,fetchConfig:o,requestConfig:s}=this.prepareRequest(i,!0);try{let e=await fetch(a,o);if(!(s.validateStatus||this.defaults.validateStatus)(e.status)){let t=null;try{t=await e.json()}catch{t=null}let{code:n,message:i}=Jd(t,`Request failed with status code ${e.status}`);r(Xd(i,s,n,void 0));return}i.onStart?.();let t=e.body?.pipeThrough(new window.TextDecoderStream).getReader();if(!t){r(Error(`IResponse body is not readable`));return}let n=``,l=e=>{try{return JSON.parse(e),!0}catch{return!1}};for(;;){let{value:e,done:r}=await t.read();if(r){i.onDone?.();break}(n+e.toString()).split(`
|
|
238
|
-
`).forEach(e=>{let t=e.replace(`data:`,``).trim();if(l(t)){let e=JSON.parse(t);i.onMessage?.(e),n=``}else t&&(n=t)})}}catch(e){if(e instanceof Error){if(e.name===`AbortError`){i.onDone?.();return}r(e)}throw e}}};function Mxe(e,t){if(!t)return e;let n=new URLSearchParams;Object.keys(t).forEach(e=>{let r=t[e];r!=null&&(Array.isArray(r)?r.forEach(t=>n.append(e,String(t))):n.append(e,String(r)))});let r=n.toString();return r?`${e}${e.includes(`?`)?`&`:`?`}${r}`:e}function Jd(e,t){let n=`ERR_BAD_RESPONSE`;if(!e||typeof e!=`object`)return{code:n,message:t};let r=e;return r.error?.message?{code:r.error.code??n,data:r.error.data,message:Yd(r.error.message,t)}:r.message?{code:r.code??n,data:r.data,message:Yd(r.message,t)}:r.detail?{code:r.code??n,data:r.data,message:Yd(r.detail,t)}:{code:r.code??n,data:r.data,message:t}}function Yd(e,t){if(typeof e==`string`)return e||t;try{return JSON.stringify(e)||t}catch{return t}}function Xd(e,t,n,r){let i=Error(e);return i.config=t,i.code=String(n),i.response=r,i.isAxiosError=!0,i}function Zd(e){return qd(e)}function Nxe(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Qd(e,t){let n={...e};for(let r in t){let i=t[r];if(Nxe(i)){let t=e[r];n[r]=Qd(t||{},i)}else n[r]=i}return n}new jxe;var Pxe=new Set([`POST`,`PUT`,`PATCH`,`DELETE`]),Fxe=new Set([`GET`,`HEAD`,`OPTIONS`]);function Ixe(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Lxe(e,t){let{headers:n,data:r}=t.requestData;!n&&!r||e.interceptors.request.use(e=>{let t=e,i=(e.method??`GET`).toUpperCase();if(n){let r=qd(n);if(r&&Object.keys(r).length>0){let n=qd(e.headers)??{};t={...t,headers:{...n,...r}}}}if(r){let n=qd(r);if(n&&Object.keys(n).length>0){if(Pxe.has(i)){let r=qd(e.data);r==null?t={...t,data:n}:Ixe(r)?t={...t,data:{...n,...r}}:console.warn(`[chat-helper] requestData.data 无法注入:当前请求体不是普通对象(FormData/Blob/string 等),已跳过合并。`,{method:i,existingType:typeof r})}else if(Fxe.has(i)){let r=e.params??{};t={...t,params:{...n,...r}}}}}return t})}var Rxe=e=>{let t=new jxe({baseURL:e.requestData.urlPrefix});return Lxe(t,e),e.interceptors?.request&&t.interceptors.request.use(e.interceptors.request),e.interceptors?.response&&t.interceptors.response.use(e.interceptors.response),{fetchClient:t,reset:e=>{t.defaults.baseURL=e.requestData.urlPrefix,t.interceptors.request.clear(),t.interceptors.response.clear(),Lxe(t,e),e.interceptors?.request&&t.interceptors.request.use(e.interceptors.request),e.interceptors?.response&&t.interceptors.response.use(e.interceptors.response)}}},zxe=e=>({conversationSettings:{openingRemark:e?.conversation_settings?.opening_remark,predefinedQuestions:e?.conversation_settings?.predefined_questions,commands:e?.conversation_settings?.commands?.map(e=>({id:e.id,name:e.name,alias:e.alias,icon:e.icon,components:e.components.map(e=>({type:e.type,name:e.name,key:e.key,placeholder:e.placeholder,default:e.default,required:e.required,fillBack:e.fill_back,fillRegx:e.fill_regx,rows:e.rows,min:e.min,max:e.max,options:e.options})),content:e.content,agentId:e.agent_id,status:e.status,supportUpload:e.support_upload})),enableChatSession:e?.conversation_settings?.enable_chat_session},promptSetting:e?.prompt_setting?{content:e.prompt_setting.content,supportUpload:e.prompt_setting.support_upload}:void 0,agentName:e?.agent_name,relatedSkills:e?.related_skills?.map(e=>({id:e.id,skill_name:e.skill_name,skill_code:e.skill_code,description:e.description,icon:e.icon})),chatGroup:e?.chat_group?{enabled:e.chat_group.enabled,staff:e.chat_group.staff,username:e.chat_group.username}:void 0,saasUrl:e?.saas_url,resources:e?.resources}),Bxe=e=>({id:e.id??0,llm_code:e.llm_code,llm_name:e.llm_name,llm_type:e.llm_type??`chat.completion`,icon:e.icon??``,description:e.description??``,base_model:e.base_model,max_token_size:e.max_token_size??0,property:e.property??{},space_auth_mode:e.space_auth_mode??``,user_auth_mode:e.user_auth_mode??``,tag_names:e.tag_names}),Vxe=e=>Array.isArray(e)?e.map(Bxe):[],Hxe=e=>({getAgentInfo:t=>e.get(`agent/info/`,void 0,t).then(zxe),getLlms:(t,n)=>{let r={llm_type:t?.llm_type??`chat.completion`};return t?.fuzzy&&(r.fuzzy=t.fuzzy),t?.supports&&(r.supports=t.supports),e.get(`llms/`,r,n).then(Vxe)}}),$d=e=>{let t={id:e.id,messageId:e.message_id,name:e.name,role:e.role,sessionCode:e.session_code,status:e.status};switch(e.role){case Ld.Activity:{let n=e,r=e=>e.map(e=>({name:e.name,originFileUrl:e.origin_file_url,url:e.url})),i;switch(n.activity_type){case Id.ReferenceDocument:i=r(n.content);break;case Id.KnowledgeRag:{let e=n.content;i={content:e.content,referenceDocument:r(e.reference_document)};break}case Id.FlowAgent:case Id.ArtifactsGenerated:default:i=n.content;break}return{...t,activityType:n.activity_type,content:i,property:n.property,role:n.role}}case Ld.Assistant:{let n=e;return{...t,content:n.content,property:n.property,role:n.role,toolCalls:n.tool_calls?.map(e=>({function:{arguments:e.function.arguments,name:e.function.name,description:e.function.description,mcpName:e.function.mcp_name},id:e.id,type:e.type}))}}case Ld.Developer:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Guide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Hidden:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenAssistant:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenGuide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenSystem:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenUser:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Info:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Pause:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Placeholder:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Reasoning:{let n=e;return{...t,content:n.content,duration:n.duration,role:n.role}}case Ld.System:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateAssistant:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateGuide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateHidden:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateSystem:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateUser:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Tool:{let n=e;return{...t,content:n.content,duration:n.duration,error:n.error,role:n.role,toolCallId:n.tool_call_id}}case Ld.User:{let n=e,r=n.content;return{...t,content:Array.isArray(r)?r.map(e=>{if(e.type===zd.Binary){let t=e;return{data:t.data,filename:t.filename,id:t.id,mimeType:t.mime_type,type:t.type,url:t.url}}return e}):r,property:n.property,role:n.role}}case Ld.Interrupt:return{...t,...e}}},Uxe=e=>{let t={id:e.id,message_id:e.messageId,name:e.name,role:e.role,session_code:e.sessionCode,status:e.status};switch(e.role){case Ld.Activity:{let n=e,r=e=>e.map(e=>({name:e.name,origin_file_url:e.originFileUrl,url:e.url})),i;switch(n.activityType){case Id.ReferenceDocument:i=r(n.content);break;case Id.KnowledgeRag:{let e=n.content;i={content:e.content,reference_document:r(e.referenceDocument)};break}case Id.FlowAgent:case Id.ArtifactsGenerated:default:i=n.content;break}return{...t,activity_type:n.activityType,content:i,property:n.property,role:n.role}}case Ld.Assistant:{let n=e;return{...t,property:n.property,content:n.content,role:n.role,tool_calls:n.toolCalls?.map(e=>({function:{arguments:e.function.arguments,name:e.function.name,description:e.function.description,mcp_name:e.function.mcpName},id:e.id,type:e.type}))}}case Ld.Developer:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Guide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Hidden:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenAssistant:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenGuide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenSystem:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenUser:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Info:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Pause:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Placeholder:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Reasoning:{let n=e;return{...t,content:n.content,duration:n.duration,role:n.role}}case Ld.System:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateAssistant:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateGuide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateHidden:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateSystem:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateUser:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Tool:{let n=e;return{...t,content:n.content,duration:n.duration,error:n.error,role:n.role,tool_call_id:n.toolCallId}}case Ld.User:{let n=e,r=n.content;return{...t,content:Array.isArray(r)?r.map(e=>{if(e.type===zd.Binary){let t=e;return{data:t.data,filename:t.filename,id:t.id,mime_type:t.mimeType,type:t.type,url:t.url}}return e}):r,property:n.property,role:n.role}}case Ld.Interrupt:return{...t,...e}}},Wxe=e=>({getMessages:(t,n,r)=>e.get(`session_content/content/`,{session_code:t,limit:n},r).then(e=>e.map($d)),plusMessage:(t,n)=>e.post(`session_content/`,Uxe(t),n).then($d),modifyMessage:(t,n)=>e.put(`session_content/${t.id}/`,Uxe(t),n).then($d),deleteMessage:(t,n)=>e.delete(`session_content/${t}/`,void 0,n),batchDeleteMessages:(t,n)=>e.post(`session_content/batch_delete/`,{ids:t},n),shareMessages:(t,n,r,i)=>e.post(`share/`,{session_code:t,content_ids:n,...r?{expired_at:r}:{}},i),stopChat:(t,n)=>e.post(`session_content/stop/`,{session_code:t},n),getFlowAgentTaskInfo:(t,n)=>e.get(`flow_agent/${t}/task_info/`,void 0,n),getFlowAgentTaskNodeInfo:(t,n,r)=>e.get(`flow_agent/${t}/task_node_info/${n}/`,void 0,r),retryFlowAgentTaskNode:(t,n,r,i)=>e.post(`flow_agent/${t}/node/${n}/retry/`,{task_id:r},i),skipFlowAgentTaskNode:(t,n,r,i)=>e.post(`flow_agent/${t}/node/${n}/skip/`,{task_id:r},i),userOperation:(t,n,r,i)=>e.post(`user_operation/`,{session_code:t,operation:n,payload:r},i)}),ef=e=>({sessionCode:e.session_code,sessionContentCount:e.session_content_count,sessionName:e.session_name,isTemporary:e.is_temporary,model:e.model,comment:e.comment,rate:e.rate,updatedAt:e.updated_at,createdAt:e.created_at,status:e.status,roleInfo:e.role_info?{collectionId:e.role_info.collection_id,collectionName:e.role_info.collection_name,content:e.role_info.content,variables:e.role_info.variables}:void 0,sessionProperty:{isAutoClear:e.session_property?.is_auto_clear,isAutoCalcPrompt:e.session_property?.is_auto_clac_prompt,labels:e.session_property?.labels}}),Gxe=e=>({session_code:e.sessionCode,session_content_count:e.sessionContentCount,session_name:e.sessionName,is_temporary:e.isTemporary,model:e.model,comment:e.comment,rate:e.rate,updated_at:e.updatedAt,created_at:e.createdAt,status:e.status,role_info:e.roleInfo?{collection_id:e.roleInfo.collectionId,collection_name:e.roleInfo.collectionName,content:e.roleInfo.content,variables:e.roleInfo.variables}:void 0,session_property:{is_auto_clear:e.sessionProperty?.isAutoClear,is_auto_clac_prompt:e.sessionProperty?.isAutoCalcPrompt,labels:e.sessionProperty?.labels}}),Kxe=e=>({session_code:e.sessionCode,session_content_ids:e.sessionContentIds,rate:e.rate,comment:e.comment,labels:e.labels}),qxe=e=>({sessionCode:e.session_code,sessionContentIds:e.session_content_ids,rate:e.rate,comment:e.comment,labels:e.lables}),Jxe=`upload_file`,Yxe=20,Xxe=600,Zxe=2e4,Qxe=e=>{if(Array.isArray(e))return{page:1,numPages:1,count:e.length,results:e.map(ef)};let t=Array.isArray(e?.results)?e.results:[];return{page:e?.page??1,numPages:e?.num_pages??1,count:e?.count??t.length,results:t.map(ef)}},$xe=e=>{let t=e.split(`.`).pop();if(!t||t===e)return``;let n=t.replace(/[^A-Za-z0-9]/g,``).slice(0,20).toLowerCase();return n?`.${n}`:``},eSe=e=>`${Jxe}_${`${Date.now()}_${Math.random().toString(36).slice(2,8)}`}${$xe(e.name)}`,tSe=e=>`attachment; filename="${e}"`,nSe=e=>({clearSession:(t,n)=>e.post(`chat_completion/${t}/clear/`,void 0,n),getSessions:(t,n)=>e.get(`session/`,{page:t?.page??1,page_size:t?.page_size??Yxe},n).then(Qxe),plusSession:(t,n)=>e.post(`session/`,Gxe(t),n).then(e=>ef(e)),modifySession:(t,n)=>e.put(`session/${t.sessionCode}/`,Gxe(t),n).then(e=>ef(e)),deleteSession:(t,n)=>e.delete(`session/${t}/`,void 0,n),batchDeleteSessions:(t,n)=>e.post(`session/batch_delete/`,{session_codes:t},n),getSession:(t,n)=>e.get(`session/${t}/`,void 0,n).then(e=>ef(e)),postSessionFeedback:(t,n)=>e.post(`session_feedback/`,Kxe(t),n).then(e=>qxe(e)),getSessionFeedbackReasons:(t,n)=>e.get(`session_feedback/reasons/`,{rate:t},n),renameSession:(t,n)=>e.post(`session/${t}/ai_rename/`,void 0,n).then(e=>ef(e)),uploadFile:(t,n,r)=>{let i=eSe(n),a=encodeURIComponent(i),o=qd(r?.headers)??{};return n.arrayBuffer().then(n=>e.post(`session/${t}/upload/${a}/`,n,{...r,headers:{...o,"Content-Disposition":tSe(i)}}))},getPvFileDownloadUrl:(t,n,r,i)=>{let a=r?.expiresIn??Xxe,o=r?.timeout??Zxe;return e.get(`session/${t}/pv_files/download_url/`,{expires_in:a,path:n},{...i,timeout:i?.timeout??o})},isResumeSession:(t,n)=>e.get(`session/${t}/is_resume/`,void 0,n)}),rSe=e=>({agent:Hxe(e),session:nSe(e),message:Wxe(e),fetchClient:e}),iSe=e=>{let{fetchClient:t,reset:n}=Rxe(e);return{...rSe(t),reset:n,onError:t.onError.bind(t)}},aSe=()=>({agent:null,http:null,message:null,session:null,registerAgent(e){this.agent=e},registerHttp(e){this.http=e},registerMessage(e){this.message=e},registerSession(e){this.session=e}}),oSe=20,sSe=e=>{let t=sn([]),n=sn(null),r=sn(0),i=sn(0),a=sn(0),o=sn(!1),s=sn(!1),l=sn(!1),u=sn(!1),d=sn(!1),f=sn(!1),p=sn(!1),m=sn(!1),h=pi(()=>r.value>0&&r.value<i.value),g=e=>{t.value=t.value.map(t=>t.sessionCode===e.sessionCode?{...t,...e}:t),n.value?.sessionCode===e.sessionCode&&(n.value=t.value.find(t=>t.sessionCode===e.sessionCode)??n.value)},_=n=>{s.value=!0;let o={page:n?.page??1,page_size:n?.page_size??oSe};return e.http?.session.getSessions(o).then(e=>{t.value=e.results,r.value=e.page,i.value=e.numPages,a.value=e.count}).finally(()=>{s.value=!1})},v=async(n=oSe)=>{if(!(!h.value||s.value||l.value)){l.value=!0;try{let o=await e.http?.session.getSessions({page:r.value+1,page_size:n});if(!o)return;let s=new Set(t.value.map(e=>e.sessionCode)),l=o.results.filter(e=>!s.has(e.sessionCode));t.value=[...t.value,...l],r.value=o.page,i.value=o.numPages,a.value=o.count}finally{l.value=!1}}},y=async(r,i)=>{e.agent?.abortChat();let a=i?.loadMessages!==!1,o=t.value.find(e=>e.sessionCode===r);!a&&o?n.value=o:await b(r),a?(await e.message?.getMessages(r),e.agent?.resumeStreamingChat(r),e.agent?.pollResumeSession(r)):e.message&&(e.message.list.value=[])},b=t=>(o.value=!0,e.http?.session.getSession(t).then(e=>{n.value=e}).finally(()=>{o.value=!1}));return{list:t,current:n,page:r,numPages:i,count:a,hasMore:h,isCurrentLoading:o,isListLoading:s,isLoadingMore:l,isCreateLoading:u,isUpdateLoading:d,isDeleteLoading:f,isBatchDeleteLoading:p,getSessions:_,loadMoreSessions:v,chooseSession:y,getSession:b,createSession:async(n,r)=>{u.value=!0;try{let i=await e.http?.session.plusSession(n);i&&(t.value.unshift(i),a.value+=1,await y(i.sessionCode,{loadMessages:r?.loadMessages??!1}))}finally{u.value=!1}},updateSession:t=>(d.value=!0,e.http?.session.modifySession(t).then(e=>{g(e)}).finally(()=>{d.value=!1})),deleteSession:async r=>{f.value=!0;try{await e.http?.session.deleteSession(r),t.value=t.value.filter(e=>e.sessionCode!==r),a.value=Math.max(0,a.value-1),n.value?.sessionCode===r&&t.value[0]?.sessionCode&&await y(t.value[0].sessionCode)}finally{f.value=!1}},batchDeleteSessions:async r=>{if(r.length!==0){p.value=!0;try{await e.http?.session.batchDeleteSessions(r);let i=new Set(r),o=t.value.length;t.value=t.value.filter(e=>!i.has(e.sessionCode));let s=o-t.value.length;a.value=Math.max(0,a.value-s),n.value&&i.has(n.value.sessionCode)&&(t.value.length>0?await y(t.value[0].sessionCode):(n.value=null,e.message&&(e.message.list.value=[])))}finally{p.value=!1}}},postSessionFeedback:t=>e.http?.session.postSessionFeedback(t),getSessionFeedbackReasons:t=>e.http?.session.getSessionFeedbackReasons(t),renameSession:t=>(m.value=!0,e.http?.session.renameSession(t).then(e=>{g({sessionCode:e.sessionCode,sessionName:e.sessionName})}).finally(()=>{m.value=!1})),uploadFile:(t,n)=>e.http?.session.uploadFile(t,n),getPvFileDownloadUrl:(t,n,r)=>e.http?.session.getPvFileDownloadUrl(t,n,r),reset:()=>{t.value=[],n.value=null,r.value=0,i.value=0,a.value=0,o.value=!1,s.value=!1,l.value=!1,u.value=!1,d.value=!1,f.value=!1,p.value=!1,m.value=!1}}},cSe=e=>{let t=aSe(),n=iSe(e),r=Oxe(t,e.protocol),i=bxe(t),a=sSe(t);return t.registerHttp(n),t.registerMessage(i),t.registerAgent(r),t.registerSession(a),{agent:r,session:a,message:i,http:n,reset:e=>{n.reset(e),r.reset(e.protocol),i.reset(),a.reset()},onError:n.onError}},lSe=new Set([`context_type`,`__label`,`__key`,`__value`]);function uSe(e,t){return{urlPrefix:e,headers:()=>qd(un(t)?.headers),data:()=>qd(un(t)?.data)}}function dSe(e){return e?Array.isArray(e)?e.map(e=>{if(e.__key)return e;let t=Object.entries(e).filter(([e])=>!lSe.has(e));if(t.length===0)return e;let[n,r]=t[0];return{...e,[n]:r,context_type:e.context_type??`input`,__label:e.__label??n,__key:e.__key??n,__value:e.__value??r}}):Object.entries(e).map(([e,t])=>({[e]:t,context_type:`input`,__label:e,__key:e,__value:t})):[]}function fSe(e,t){if(!t)return e;let n=t()?.context;if(!n)return e;let r=dSe(n);return r.length===0?e:pSe(e,r)}function pSe(e,t){if(t.length===0)return e??{};let n=e??{},r=n.extra??{},i=r.context??[],a=new Set(t.map(e=>e.__key).filter(Boolean)),o=i.filter(e=>{let t=e.__key;return!t||!a.has(t)});return{...n,extra:{...r,context:[...o,...t]}}}function mSe(e){return e.some(e=>{if(!(`property`in e))return!0;let{property:t}=e;return!t?.extra?.pause})}function hSe(e,t){let n=null;for(let r of e)if(r.role===`user`&&r.id!==void 0&&(n=r),r===t)break;return n}function gSe(e,t){let n=hSe(e,t);if(n?.id!==void 0)return typeof n.id==`number`?n.id:Number(n.id)}var _Se=e=>{if(e instanceof Error)return e;if(typeof e==`string`)return Error(e);if(e&&typeof e==`object`){let{message:t}=e;if(typeof t==`string`&&t)return Error(t);try{return Error(JSON.stringify(e)??String(e))}catch{return Error(String(e))}}return Error(String(e))},vSe=e=>{let t=document.cookie.match(RegExp(`(^| )${e}=([^;]*)(;|$)`));return t?t[2]:``},ySe=e=>e.endsWith(`/`)?e:`${e}/`,bSe=e=>{if(!e)return e;try{let t=new URL(e,window.location.origin);return t.protocol=window.location.protocol,ySe(t.toString())}catch(t){return console.warn(`Failed to normalize URL:`,t),ySe(e)}};async function xSe(e){if(typeof navigator<`u`&&`clipboard`in navigator)try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`-9999px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand(`copy`)}catch{return!1}finally{document.body.removeChild(t)}}function SSe(){let e=window.navigator.userAgent.toLowerCase(),t=window.navigator.platform.toLowerCase();return t.includes(`mac`)||e.includes(`mac`)?`mac`:t.includes(`win`)||e.includes(`win`)?`windows`:t.includes(`linux`)||e.includes(`linux`)?`linux`:`unknown`}function CSe(){return wSe()?`Cmd + I`:`Ctrl + I`}function wSe(){return SSe()===`mac`}function TSe(e){let t=wSe()?e.metaKey:e.ctrlKey,n=e.key.toLowerCase()===`i`;return t&&n&&!e.shiftKey&&!e.altKey}var ESe=vSe(`blueking_language`)||`zh-cn`,DSe={小鲸:`BK GPT`,关闭:`close`,发送:`Send`,请输入:`Please input`,昨天:`yesterday`,"3天前":`3 days ago`,"5天前":`5 days ago`,"1周前":`1 week ago`,更早:`Older`,删除:`Delete`,恢复默认大小:`Restore default size`,"AI 小鲸":`AI BK GPT`,新增会话:`New chat`,历史会话:`History session`,停止生成:`Stop generating`,复制:`Copy`,编辑:`Edit`,今天:`Today`,搜索会话名称:`Search session name`,重命名:`Rename`,自动生成命名:`Auto generate name`,分享会话:`Share session`,无智能体使用权限:`No permission to use this agent`,暂无使用权限:`No permission`,请输入新的会话名称:`Please enter new session name`,"确认删除会话 ?":`Confirm delete session?`,搜索为空:`No search results`,暂无对话:`No conversations`,"加载中...":`Loading...`,转人工:`Transfer to human`,缩小高度:`Shrink height`,全选:`Select all`,取消:`Cancel`,确定:`Confirm`,分享链接已复制到剪贴板:`Share link copied to clipboard`,请求失败:`Request failed`,当前已是新会话:`Already in a new session`,"正在创建会话...":`Creating session...`},OSe={重命名:`重命名`,自动生成命名:`自动生成命名`,分享会话:`分享会话`,全选:`全选`,取消:`取消`,确定:`确定`,分享链接已复制到剪贴板:`分享链接已复制到剪贴板`,请求失败:`请求失败`},tf=e=>ESe===`en`?DSe[e]||e:OSe[e]||e,kSe={class:`history-item-actions`},ASe=Ii($n({__name:`history-item`,props:{isActive:{type:Boolean},isEditing:{type:Boolean},session:{}},emits:[`click`,`delete`,`edit`,`rename-cancel`,`rename-confirm`],setup(e,{emit:t}){let n=e,r=t,i=vxe,a=sn(null),o=sn(``);Rn(()=>n.isEditing,e=>{e&&(o.value=n.session.sessionName,Dn(()=>{if(a.value)try{let e=a.value;e&&typeof e.focus==`function`&&e.focus();let t=e.$el?.querySelector(`input`);t&&typeof t.select==`function`&&t.select()}catch(e){console.warn(`Failed to focus edit input:`,e)}}))});let s=()=>{n.isEditing||r(`click`,n.session)},l=()=>{r(`edit`,n.session)},u=()=>{r(`delete`,n.session.sessionCode)},d=()=>{let e=o.value.trim();e&&e!==n.session.sessionName?r(`rename-confirm`,n.session.sessionCode,e):r(`rename-cancel`)},f=()=>{r(`rename-cancel`)},p=(e,t)=>{t.key===`Enter`?d():t.key===`Escape`&&f()};return(e,t)=>(B(),V(`div`,{class:xe([`history-item`,{active:n.isActive}]),onClick:s},[n.isEditing?(B(),Kr(z(fu),{key:1,ref_key:`editInputRef`,ref:a,modelValue:o.value,"onUpdate:modelValue":t[1]||=e=>o.value=e,style:{width:`100%`,height:`28px`},onBlur:d,onKeyup:p,onClick:t[2]||=Ni(()=>{},[`stop`])},null,8,[`modelValue`])):(B(),V(Rr,{key:0},[Xr(z(s_e),{style:{width:`calc(100% - 42px)`}},{default:Mn(()=>[$r(ke(n.session.sessionName),1)]),_:1}),H(`span`,kSe,[Nn(H(`i`,{class:`bkai-icon bkai-bianji`,onClick:Ni(l,[`stop`])},null,512),[[z(i),{content:z(tf)(`编辑`),boundary:`parent`}]]),Xr(z(Ebe),{title:z(tf)(`确认删除会话 ?`),content:`删除操作无法撤回,请谨慎操作!`,"confirm-config":{theme:`danger`},trigger:`click`,boundary:`parent`,onConfirm:u},{default:Mn(()=>[Nn(H(`i`,{class:`bkai-icon bkai-shanchu`,onClick:t[0]||=Ni(()=>{},[`stop`])},null,512),[[z(i),{content:z(tf)(`删除`),boundary:`parent`}]])]),_:1},8,[`title`])])],64))],2))}}),[[`__scopeId`,`data-v-fea14d3a`]]),jSe={class:`history-search`},MSe={class:`input-icon`},NSe=Ii($n({__name:`history-search`,props:{modelValue:{default:``},placeholder:{default:``}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=e=>{r(`update:modelValue`,e)};return(e,t)=>(B(),V(`div`,jSe,[Xr(z(fu),{"model-value":n.modelValue,behavior:`simplicity`,placeholder:n.placeholder||z(tf)(`搜索会话名称`),style:{height:`22px`},"onUpdate:modelValue":i},{suffix:Mn(()=>[H(`span`,MSe,[Xr(z(ol))])]),_:1},8,[`model-value`,`placeholder`])]))}}),[[`__scopeId`,`data-v-e7ff40b2`]]),PSe={class:`history-dropdown-header`},FSe={class:`history-dropdown-header-title`},ISe={class:`history-dropdown-content`},LSe={key:0,class:`history-dropdown-loading`},RSe={class:`history-dropdown-loading-dots`},zSe=40,BSe=Ii($n({__name:`index`,props:{sessionBusinessManager:{}},emits:[`close`,`session-delete`,`session-rename`,`session-switch`],setup(e,{emit:t}){let n=e,r=t,i=sn(``),a=sn(null),o=pi(()=>n.sessionBusinessManager.currentSession.value?.sessionCode),s=pi(()=>n.sessionBusinessManager.isLoadingMore.value),l=e=>{let t=e.target;t.scrollHeight-t.scrollTop-t.clientHeight>zSe||n.sessionBusinessManager.hasMoreSessions.value&&(n.sessionBusinessManager.isLoadingMore.value||n.sessionBusinessManager.loadMoreSessions())},u=pi(()=>{let e={today:{key:`today`,alias:tf(`今天`),sessionList:[]},yesterday:{key:`yesterday`,alias:tf(`昨天`),sessionList:[]},"3days":{key:`3days`,alias:tf(`3天前`),sessionList:[]},"5days":{key:`5days`,alias:tf(`5天前`),sessionList:[]},"1week":{key:`1week`,alias:tf(`1周前`),sessionList:[]},before:{key:`before`,alias:tf(`更早`),sessionList:[]}},t=n.sessionBusinessManager.sessionList.value.filter(e=>e.sessionName.toLowerCase().includes(i.value.toLowerCase())),r=new Date,a=new Date(r);a.setDate(a.getDate()-1);let o=new Date(r);o.setDate(r.getDate()-3);let s=new Date(r);s.setDate(r.getDate()-5);let l=new Date(r);l.setDate(r.getDate()-7);for(let n of t){let t=new Date(n.createdAt||``),i=t.toDateString();i===r.toDateString()?e.today.sessionList.push(n):i===a.toDateString()?e.yesterday.sessionList.push(n):t>=o&&t>s?e[`3days`].sessionList.push(n):t>=s&&t>l?e[`5days`].sessionList.push(n):t>=l?e[`1week`].sessionList.push(n):e.before.sessionList.push(n)}for(let t of Object.values(e))t.sessionList.sort((e,t)=>{let n=new Date(e.createdAt||0).getTime();return new Date(t.createdAt||0).getTime()-n});return Object.values(e).filter(e=>e.sessionList.length>0)}),d=e=>o.value===e,f=e=>{d(e.sessionCode)||(r(`session-switch`,e.sessionCode),r(`close`))},p=e=>{a.value=e.sessionCode},m=e=>{r(`session-delete`,e)},h=(e,t)=>{let i=n.sessionBusinessManager.sessionList.value.find(t=>t.sessionCode===e);i&&(i.sessionName=t),a.value=null,r(`session-rename`,e,t)},g=()=>{a.value=null};return(e,t)=>(B(),V(`div`,{class:`bkai-history-dropdown`,onScroll:l},[H(`div`,PSe,[H(`h1`,FSe,ke(z(tf)(`历史会话`)),1),Xr(NSe,{modelValue:i.value,"onUpdate:modelValue":t[0]||=e=>i.value=e,placeholder:z(tf)(`搜索会话名称`)},null,8,[`modelValue`,`placeholder`])]),H(`div`,ISe,[u.value.length>0?(B(),V(Rr,{key:0},[(B(!0),V(Rr,null,fr(u.value,e=>(B(),Kr(Nre,{key:e.key,"current-session-code":o.value,sessions:e.sessionList,title:e.alias},{default:Mn(()=>[(B(!0),V(Rr,null,fr(e.sessionList,e=>(B(),Kr(ASe,{key:e.sessionCode,"is-active":d(e.sessionCode),"is-editing":a.value===e.sessionCode,session:e,onClick:f,onDelete:m,onEdit:p,onRenameCancel:g,onRenameConfirm:h},null,8,[`is-active`,`is-editing`,`session`]))),128))]),_:2},1032,[`current-session-code`,`sessions`,`title`]))),128)),s.value?(B(),V(`div`,LSe,[H(`span`,RSe,[(B(),V(Rr,null,fr(3,e=>H(`i`,{key:e,class:`history-dropdown-loading-dot`,style:ge({"--dot-index":e-1})},null,4)),64))])])):ei(`v-if`,!0)],64)):(B(),Kr(z(rd),{key:1,description:i.value?z(tf)(`搜索为空`):z(tf)(`暂无对话`),scene:`part`,style:{"margin-top":`100px`},type:i.value?`search-empty`:`empty`},null,8,[`description`,`type`]))])],32))}}),[[`__scopeId`,`data-v-bf2401b6`]]),VSe=`tippy-box`,HSe=`tippy-content`,USe=`tippy-backdrop`,WSe=`tippy-arrow`,GSe=`tippy-svg-arrow`,nf={passive:!0,capture:!0},KSe=function(){return document.body};function qSe(e,t,n){return Array.isArray(e)?e[t]??(Array.isArray(n)?n[t]:n):e}function JSe(e,t){var n={}.toString.call(e);return n.indexOf(`[object`)===0&&n.indexOf(t+`]`)>-1}function YSe(e,t){return typeof e==`function`?e.apply(void 0,t):e}function XSe(e,t){if(t===0)return e;var n;return function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}}function ZSe(e){return e.split(/\s+/).filter(Boolean)}function rf(e){return[].concat(e)}function QSe(e,t){e.indexOf(t)===-1&&e.push(t)}function $Se(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function eCe(e){return e.split(`-`)[0]}function af(e){return[].slice.call(e)}function tCe(e){return Object.keys(e).reduce(function(t,n){return e[n]!==void 0&&(t[n]=e[n]),t},{})}function of(){return document.createElement(`div`)}function sf(e){return[`Element`,`Fragment`].some(function(t){return JSe(e,t)})}function nCe(e){return JSe(e,`NodeList`)}function rCe(e){return JSe(e,`MouseEvent`)}function iCe(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function aCe(e){return sf(e)?[e]:nCe(e)?af(e):Array.isArray(e)?e:af(document.querySelectorAll(e))}function cf(e,t){e.forEach(function(e){e&&(e.style.transitionDuration=t+`ms`)})}function oCe(e,t){e.forEach(function(e){e&&e.setAttribute(`data-state`,t)})}function sCe(e){var t,n=rf(e)[0];return n!=null&&(t=n.ownerDocument)!=null&&t.body?n.ownerDocument:document}function cCe(e,t){var n=t.clientX,r=t.clientY;return e.every(function(e){var t=e.popperRect,i=e.popperState,a=e.props.interactiveBorder,o=eCe(i.placement),s=i.modifiersData.offset;if(!s)return!0;var l=o===`bottom`?s.top.y:0,u=o===`top`?s.bottom.y:0,d=o===`right`?s.left.x:0,f=o===`left`?s.right.x:0,p=t.top-r+l>a,m=r-t.bottom-u>a,h=t.left-n+d>a,g=n-t.right-f>a;return p||m||h||g})}function lf(e,t,n){var r=t+`EventListener`;[`transitionend`,`webkitTransitionEnd`].forEach(function(t){e[r](t,n)})}function lCe(e,t){for(var n=t;n;){if(e.contains(n))return!0;n=n.getRootNode==null?void 0:n.getRootNode()?.host}return!1}var uf={isTouch:!1},uCe=0;function dCe(){uf.isTouch||(uf.isTouch=!0,window.performance&&document.addEventListener(`mousemove`,fCe))}function fCe(){var e=performance.now();e-uCe<20&&(uf.isTouch=!1,document.removeEventListener(`mousemove`,fCe)),uCe=e}function pCe(){var e=document.activeElement;if(iCe(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function mCe(){document.addEventListener(`touchstart`,dCe,nf),window.addEventListener(`blur`,pCe)}var hCe=typeof window<`u`&&typeof document<`u`?!!window.msCrypto:!1,df=Object.assign({appendTo:KSe,aria:{content:`auto`,expanded:`auto`},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:``,offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:`top`,plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:`mouseenter focus`,triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:`fade`,arrow:!0,content:``,inertia:!1,maxWidth:350,role:`tooltip`,theme:``,zIndex:9999}),gCe=Object.keys(df),_Ce=function(e){Object.keys(e).forEach(function(t){df[t]=e[t]})};function vCe(e){var t=(e.plugins||[]).reduce(function(t,n){var r=n.name,i=n.defaultValue;return r&&(t[r]=e[r]===void 0?df[r]??i:e[r]),t},{});return Object.assign({},e,t)}function yCe(e,t){return(t?Object.keys(vCe(Object.assign({},df,{plugins:t}))):gCe).reduce(function(t,n){var r=(e.getAttribute(`data-tippy-`+n)||``).trim();if(!r)return t;if(n===`content`)t[n]=r;else try{t[n]=JSON.parse(r)}catch{t[n]=r}return t},{})}function bCe(e,t){var n=Object.assign({},t,{content:YSe(t.content,[e])},t.ignoreAttributes?{}:yCe(e,t.plugins));return n.aria=Object.assign({},df.aria,n.aria),n.aria={expanded:n.aria.expanded===`auto`?t.interactive:n.aria.expanded,content:n.aria.content===`auto`?t.interactive?null:`describedby`:n.aria.content},n}var xCe=function(){return`innerHTML`};function ff(e,t){e[xCe()]=t}function SCe(e){var t=of();return e===!0?t.className=WSe:(t.className=GSe,sf(e)?t.appendChild(e):ff(t,e)),t}function CCe(e,t){sf(t.content)?(ff(e,``),e.appendChild(t.content)):typeof t.content!=`function`&&(t.allowHTML?ff(e,t.content):e.textContent=t.content)}function pf(e){var t=e.firstElementChild,n=af(t.children);return{box:t,content:n.find(function(e){return e.classList.contains(HSe)}),arrow:n.find(function(e){return e.classList.contains(WSe)||e.classList.contains(GSe)}),backdrop:n.find(function(e){return e.classList.contains(USe)})}}function wCe(e){var t=of(),n=of();n.className=VSe,n.setAttribute(`data-state`,`hidden`),n.setAttribute(`tabindex`,`-1`);var r=of();r.className=HSe,r.setAttribute(`data-state`,`hidden`),CCe(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props);function i(n,r){var i=pf(t),a=i.box,o=i.content,s=i.arrow;r.theme?a.setAttribute(`data-theme`,r.theme):a.removeAttribute(`data-theme`),typeof r.animation==`string`?a.setAttribute(`data-animation`,r.animation):a.removeAttribute(`data-animation`),r.inertia?a.setAttribute(`data-inertia`,``):a.removeAttribute(`data-inertia`),a.style.maxWidth=typeof r.maxWidth==`number`?r.maxWidth+`px`:r.maxWidth,r.role?a.setAttribute(`role`,r.role):a.removeAttribute(`role`),(n.content!==r.content||n.allowHTML!==r.allowHTML)&&CCe(o,e.props),r.arrow?s?n.arrow!==r.arrow&&(a.removeChild(s),a.appendChild(SCe(r.arrow))):a.appendChild(SCe(r.arrow)):s&&a.removeChild(s)}return{popper:t,onUpdate:i}}wCe.$$tippy=!0;var TCe=1,mf=[],hf=[];function ECe(e,t){var n=bCe(e,Object.assign({},df,vCe(tCe(t)))),r,i,a,o=!1,s=!1,l=!1,u=!1,d,f,p,m=[],h=XSe(de,n.interactiveDebounce),g,_=TCe++,v=null,y=$Se(n.plugins),b={id:_,reference:e,popper:of(),popperInstance:v,props:n,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:y,clearDelayTimeouts:Ce,setProps:we,setContent:Te,show:Ee,hide:De,hideWithInteractivity:Oe,enable:xe,disable:Se,unmount:ke,destroy:Ae};if(!n.render)return b;var x=n.render(b),S=x.popper,C=x.onUpdate;S.setAttribute(`data-tippy-root`,``),S.id=`tippy-`+b.id,b.popper=S,e._tippy=b,S._tippy=b;var w=y.map(function(e){return e.fn(b)}),T=e.hasAttribute(`aria-expanded`);return ce(),I(),N(),P(`onCreate`,[b]),n.showOnCreate&&ye(),S.addEventListener(`mouseenter`,function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),S.addEventListener(`mouseleave`,function(){b.props.interactive&&b.props.trigger.indexOf(`mouseenter`)>=0&&A().addEventListener(`mousemove`,h)}),b;function E(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function D(){return E()[0]===`hold`}function O(){var e;return!!((e=b.props.render)!=null&&e.$$tippy)}function k(){return g||e}function A(){var e=k().parentNode;return e?sCe(e):document}function j(){return pf(S)}function M(e){return b.state.isMounted&&!b.state.isVisible||uf.isTouch||d&&d.type===`focus`?0:qSe(b.props.delay,+!e,df.delay)}function N(e){e===void 0&&(e=!1),S.style.pointerEvents=b.props.interactive&&!e?``:`none`,S.style.zIndex=``+b.props.zIndex}function P(e,t,n){if(n===void 0&&(n=!0),w.forEach(function(n){n[e]&&n[e].apply(n,t)}),n){var r;(r=b.props)[e].apply(r,t)}}function F(){var t=b.props.aria;if(t.content){var n=`aria-`+t.content,r=S.id;rf(b.props.triggerTarget||e).forEach(function(e){var t=e.getAttribute(n);if(b.state.isVisible)e.setAttribute(n,t?t+` `+r:r);else{var i=t&&t.replace(r,``).trim();i?e.setAttribute(n,i):e.removeAttribute(n)}})}}function I(){T||!b.props.aria.expanded||rf(b.props.triggerTarget||e).forEach(function(e){b.props.interactive?e.setAttribute(`aria-expanded`,b.state.isVisible&&e===k()?`true`:`false`):e.removeAttribute(`aria-expanded`)})}function L(){A().removeEventListener(`mousemove`,h),mf=mf.filter(function(e){return e!==h})}function R(t){if(!(uf.isTouch&&(l||t.type===`mousedown`))){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!(b.props.interactive&&lCe(S,n))){if(rf(b.props.triggerTarget||e).some(function(e){return lCe(e,n)})){if(uf.isTouch||b.state.isVisible&&b.props.trigger.indexOf(`click`)>=0)return}else P(`onClickOutside`,[b,t]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),s=!0,setTimeout(function(){s=!1}),b.state.isMounted||re())}}}function ee(){l=!0}function te(){l=!1}function ne(){var e=A();e.addEventListener(`mousedown`,R,!0),e.addEventListener(`touchend`,R,nf),e.addEventListener(`touchstart`,te,nf),e.addEventListener(`touchmove`,ee,nf)}function re(){var e=A();e.removeEventListener(`mousedown`,R,!0),e.removeEventListener(`touchend`,R,nf),e.removeEventListener(`touchstart`,te,nf),e.removeEventListener(`touchmove`,ee,nf)}function ie(e,t){oe(e,function(){!b.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&t()})}function ae(e,t){oe(e,t)}function oe(e,t){var n=j().box;function r(e){e.target===n&&(lf(n,`remove`,r),t())}if(e===0)return t();lf(n,`remove`,f),lf(n,`add`,r),f=r}function se(t,n,r){r===void 0&&(r=!1),rf(b.props.triggerTarget||e).forEach(function(e){e.addEventListener(t,n,r),m.push({node:e,eventType:t,handler:n,options:r})})}function ce(){D()&&(se(`touchstart`,ue,{passive:!0}),se(`touchend`,fe,{passive:!0})),ZSe(b.props.trigger).forEach(function(e){if(e!==`manual`)switch(se(e,ue),e){case`mouseenter`:se(`mouseleave`,fe);break;case`focus`:se(hCe?`focusout`:`blur`,pe);break;case`focusin`:se(`focusout`,pe);break}})}function le(){m.forEach(function(e){var t=e.node,n=e.eventType,r=e.handler,i=e.options;t.removeEventListener(n,r,i)}),m=[]}function ue(e){var t=!1;if(!(!b.state.isEnabled||me(e)||s)){var n=d?.type===`focus`;d=e,g=e.currentTarget,I(),!b.state.isVisible&&rCe(e)&&mf.forEach(function(t){return t(e)}),e.type===`click`&&(b.props.trigger.indexOf(`mouseenter`)<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?t=!0:ye(e),e.type===`click`&&(o=!t),t&&!n&&be(e)}}function de(e){var t=e.target,r=k().contains(t)||S.contains(t);e.type===`mousemove`&&r||cCe(ve().concat(S).map(function(e){var t=e._tippy.popperInstance?.state;return t?{popperRect:e.getBoundingClientRect(),popperState:t,props:n}:null}).filter(Boolean),e)&&(L(),be(e))}function fe(e){if(!(me(e)||b.props.trigger.indexOf(`click`)>=0&&o)){if(b.props.interactive){b.hideWithInteractivity(e);return}be(e)}}function pe(e){b.props.trigger.indexOf(`focusin`)<0&&e.target!==k()||b.props.interactive&&e.relatedTarget&&S.contains(e.relatedTarget)||be(e)}function me(e){return uf.isTouch?D()!==e.type.indexOf(`touch`)>=0:!1}function he(){ge();var t=b.props,n=t.popperOptions,r=t.placement,i=t.offset,a=t.getReferenceClientRect,o=t.moveTransition,s=O()?pf(S).arrow:null,l=a?{getBoundingClientRect:a,contextElement:a.contextElement||k()}:e,u=[{name:`offset`,options:{offset:i}},{name:`preventOverflow`,options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:`flip`,options:{padding:5}},{name:`computeStyles`,options:{adaptive:!o}},{name:`$$tippy`,enabled:!0,phase:`beforeWrite`,requires:[`computeStyles`],fn:function(e){var t=e.state;if(O()){var n=j().box;[`placement`,`reference-hidden`,`escaped`].forEach(function(e){e===`placement`?n.setAttribute(`data-placement`,t.placement):t.attributes.popper[`data-popper-`+e]?n.setAttribute(`data-`+e,``):n.removeAttribute(`data-`+e)}),t.attributes.popper={}}}}];O()&&s&&u.push({name:`arrow`,options:{element:s,padding:3}}),u.push.apply(u,n?.modifiers||[]),b.popperInstance=ha(l,S,Object.assign({},n,{placement:r,onFirstUpdate:p,modifiers:u}))}function ge(){b.popperInstance&&=(b.popperInstance.destroy(),null)}function _e(){var e=b.props.appendTo,t,n=k();t=b.props.interactive&&e===KSe||e===`parent`?n.parentNode:YSe(e,[n]),t.contains(S)||t.appendChild(S),b.state.isMounted=!0,he()}function ve(){return af(S.querySelectorAll(`[data-tippy-root]`))}function ye(e){b.clearDelayTimeouts(),e&&P(`onTrigger`,[b,e]),ne();var t=M(!0),n=E(),i=n[0],a=n[1];uf.isTouch&&i===`hold`&&a&&(t=a),t?r=setTimeout(function(){b.show()},t):b.show()}function be(e){if(b.clearDelayTimeouts(),P(`onUntrigger`,[b,e]),!b.state.isVisible){re();return}if(!(b.props.trigger.indexOf(`mouseenter`)>=0&&b.props.trigger.indexOf(`click`)>=0&&[`mouseleave`,`mousemove`].indexOf(e.type)>=0&&o)){var t=M(!1);t?i=setTimeout(function(){b.state.isVisible&&b.hide()},t):a=requestAnimationFrame(function(){b.hide()})}}function xe(){b.state.isEnabled=!0}function Se(){b.hide(),b.state.isEnabled=!1}function Ce(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(a)}function we(t){if(!b.state.isDestroyed){P(`onBeforeUpdate`,[b,t]),le();var n=b.props,r=bCe(e,Object.assign({},n,tCe(t),{ignoreAttributes:!0}));b.props=r,ce(),n.interactiveDebounce!==r.interactiveDebounce&&(L(),h=XSe(de,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?rf(n.triggerTarget).forEach(function(e){e.removeAttribute(`aria-expanded`)}):r.triggerTarget&&e.removeAttribute(`aria-expanded`),I(),N(),C&&C(n,r),b.popperInstance&&(he(),ve().forEach(function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})),P(`onAfterUpdate`,[b,t])}}function Te(e){b.setProps({content:e})}function Ee(){var e=b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=uf.isTouch&&!b.props.touch,i=qSe(b.props.duration,0,df.duration);if(!(e||t||n||r)&&!k().hasAttribute(`disabled`)&&(P(`onShow`,[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,O()&&(S.style.visibility=`visible`),N(),ne(),b.state.isMounted||(S.style.transition=`none`),O()){var a=j(),o=a.box,s=a.content;cf([o,s],0)}p=function(){var e;if(!(!b.state.isVisible||u)){if(u=!0,S.offsetHeight,S.style.transition=b.props.moveTransition,O()&&b.props.animation){var t=j(),n=t.box,r=t.content;cf([n,r],i),oCe([n,r],`visible`)}F(),I(),QSe(hf,b),(e=b.popperInstance)==null||e.forceUpdate(),P(`onMount`,[b]),b.props.animation&&O()&&ae(i,function(){b.state.isShown=!0,P(`onShown`,[b])})}},_e()}}function De(){var e=!b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=qSe(b.props.duration,1,df.duration);if(!(e||t||n)&&(P(`onHide`,[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,u=!1,o=!1,O()&&(S.style.visibility=`hidden`),L(),re(),N(!0),O()){var i=j(),a=i.box,s=i.content;b.props.animation&&(cf([a,s],r),oCe([a,s],`hidden`))}F(),I(),b.props.animation?O()&&ie(r,b.unmount):b.unmount()}}function Oe(e){A().addEventListener(`mousemove`,h),QSe(mf,h),h(e)}function ke(){b.state.isVisible&&b.hide(),b.state.isMounted&&(ge(),ve().forEach(function(e){e._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),hf=hf.filter(function(e){return e!==b}),b.state.isMounted=!1,P(`onHidden`,[b]))}function Ae(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),le(),delete e._tippy,b.state.isDestroyed=!0,P(`onDestroy`,[b]))}}function gf(e,t){t===void 0&&(t={});var n=df.plugins.concat(t.plugins||[]);mCe();var r=Object.assign({},t,{plugins:n}),i=aCe(e).reduce(function(e,t){var n=t&&ECe(t,r);return n&&e.push(n),e},[]);return sf(e)?i[0]:i}gf.defaultProps=df,gf.setDefaultProps=_Ce,gf.currentInput=uf,Object.assign({},Wre,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),gf.setDefaultProps({render:wCe});function DCe(e){let{triggerRef:t,panelComponent:n,panelProps:r={},tippyOptions:i={}}=e,a=sn(null),o=null,s=()=>(o||=document.createElement(`div`),Pi(U(n,{...r,onClose:f}),o),o),l=e=>{let n=e.target,r=t.value;if(r&&r.contains(n))return;let i=document.querySelector(`.tippy-box[data-theme~="history-panel"]`);if(i&&i.contains(n))return;let o=document.querySelector(`.tippy-box[data-theme~="more-menu-light"]`);o&&o.contains(n)||a.value?.state.isVisible&&a.value.hide()},u=()=>{if(!t.value||a.value)return;let e={placement:`bottom-end`,offset:[0,8],appendTo:document.querySelector(`.ai-blueking-container-wrapper`)||document.body};a.value=gf(t.value,{content:s(),interactive:!0,trigger:`manual`,theme:`light history-panel`,arrow:!1,hideOnClick:!1,animation:`scale`,duration:200,delay:[0,0],...e,...i,onShow:()=>{a.value&&o&&a.value.setContent(s()),setTimeout(()=>{document.addEventListener(`click`,l,!1)},0)},onHidden:()=>{document.removeEventListener(`click`,l,!1)}})},d=()=>{a.value||u(),a.value?.show()},f=()=>{a.value?.hide()},p=()=>{a.value||u(),a.value?.state.isVisible?f():d()},m=e=>{e.stopPropagation(),p()},h=()=>{a.value&&=(a.value.destroy(),null),o&&=(Pi(null,o),null),document.removeEventListener(`click`,l,!1)};return cr(()=>{h()}),{show:d,hide:f,toggle:p,handleTriggerClick:m,destroy:h,isVisible:()=>a.value?.state.isVisible??!1}}function OCe(e){return e.sessionBusinessManager?DCe({triggerRef:e.triggerRef,panelComponent:BSe,panelProps:{sessionBusinessManager:e.sessionBusinessManager,onSessionSwitch:e.onSessionSwitch,onSessionDelete:e.onSessionDelete,onSessionRename:e.onSessionRename},tippyOptions:{placement:`bottom-end`,offset:[0,8],appendTo:()=>document.querySelector(`.ai-blueking-panel`)||document.body}}):{handleTriggerClick:()=>{},show:()=>{},hide:()=>{},toggle:()=>{},destroy:()=>{},isVisible:()=>!1}}var _f=`top`,vf=`bottom`,yf=`right`,bf=`left`,xf=`auto`,Sf=[_f,vf,yf,bf],Cf=`start`,wf=`end`,kCe=`clippingParents`,ACe=`viewport`,Tf=`popper`,jCe=`reference`,MCe=Sf.reduce(function(e,t){return e.concat([t+`-`+Cf,t+`-`+wf])},[]),NCe=[].concat(Sf,[xf]).reduce(function(e,t){return e.concat([t,t+`-`+Cf,t+`-`+wf])},[]),PCe=[`beforeRead`,`read`,`afterRead`,`beforeMain`,`main`,`afterMain`,`beforeWrite`,`write`,`afterWrite`];function Ef(e){return e?(e.nodeName||``).toLowerCase():null}function Df(e){if(e==null)return window;if(e.toString()!==`[object Window]`){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Of(e){return e instanceof Df(e).Element||e instanceof Element}function kf(e){return e instanceof Df(e).HTMLElement||e instanceof HTMLElement}function FCe(e){return typeof ShadowRoot>`u`?!1:e instanceof Df(e).ShadowRoot||e instanceof ShadowRoot}function ICe(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];!kf(i)||!Ef(i)||(Object.assign(i.style,n),Object.keys(r).forEach(function(e){var t=r[e];t===!1?i.removeAttribute(e):i.setAttribute(e,t===!0?``:t)}))})}function LCe(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var r=t.elements[e],i=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]=``,e},{});!kf(r)||!Ef(r)||(Object.assign(r.style,a),Object.keys(i).forEach(function(e){r.removeAttribute(e)}))})}}var RCe={name:`applyStyles`,enabled:!0,phase:`write`,fn:ICe,effect:LCe,requires:[`computeStyles`]};function Af(e){return e.split(`-`)[0]}var jf=Math.max,Mf=Math.min,Nf=Math.round;function Pf(e,t){t===void 0&&(t=!1);var n=e.getBoundingClientRect(),r=1,i=1;if(kf(e)&&t){var a=e.offsetHeight,o=e.offsetWidth;o>0&&(r=Nf(n.width)/o||1),a>0&&(i=Nf(n.height)/a||1)}return{width:n.width/r,height:n.height/i,top:n.top/i,right:n.right/r,bottom:n.bottom/i,left:n.left/r,x:n.left/r,y:n.top/i}}function Ff(e){var t=Pf(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function zCe(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&FCe(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function If(e){return Df(e).getComputedStyle(e)}function BCe(e){return[`table`,`td`,`th`].indexOf(Ef(e))>=0}function Lf(e){return((Of(e)?e.ownerDocument:e.document)||window.document).documentElement}function Rf(e){return Ef(e)===`html`?e:e.assignedSlot||e.parentNode||(FCe(e)?e.host:null)||Lf(e)}function VCe(e){return!kf(e)||If(e).position===`fixed`?null:e.offsetParent}function HCe(e){var t=navigator.userAgent.toLowerCase().indexOf(`firefox`)!==-1;if(navigator.userAgent.indexOf(`Trident`)!==-1&&kf(e)&&If(e).position===`fixed`)return null;for(var n=Rf(e);kf(n)&&[`html`,`body`].indexOf(Ef(n))<0;){var r=If(n);if(r.transform!==`none`||r.perspective!==`none`||r.contain===`paint`||[`transform`,`perspective`].indexOf(r.willChange)!==-1||t&&r.willChange===`filter`||t&&r.filter&&r.filter!==`none`)return n;n=n.parentNode}return null}function zf(e){for(var t=Df(e),n=VCe(e);n&&BCe(n)&&If(n).position===`static`;)n=VCe(n);return n&&(Ef(n)===`html`||Ef(n)===`body`&&If(n).position===`static`)?t:n||HCe(e)||t}function Bf(e){return[`top`,`bottom`].indexOf(e)>=0?`x`:`y`}function Vf(e,t,n){return jf(e,Mf(t,n))}function UCe(e,t,n){var r=Vf(e,t,n);return r>n?n:r}function WCe(){return{top:0,right:0,bottom:0,left:0}}function GCe(e){return Object.assign({},WCe(),e)}function KCe(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}var qCe=function(e,t){return e=typeof e==`function`?e(Object.assign({},t.rects,{placement:t.placement})):e,GCe(typeof e==`number`?KCe(e,Sf):e)};function JCe(e){var t,n=e.state,r=e.name,i=e.options,a=n.elements.arrow,o=n.modifiersData.popperOffsets,s=Af(n.placement),l=Bf(s),u=[bf,yf].indexOf(s)>=0?`height`:`width`;if(!(!a||!o)){var d=qCe(i.padding,n),f=Ff(a),p=l===`y`?_f:bf,m=l===`y`?vf:yf,h=n.rects.reference[u]+n.rects.reference[l]-o[l]-n.rects.popper[u],g=o[l]-n.rects.reference[l],_=zf(a),v=_?l===`y`?_.clientHeight||0:_.clientWidth||0:0,y=h/2-g/2,b=d[p],x=v-f[u]-d[m],S=v/2-f[u]/2+y,C=Vf(b,S,x),w=l;n.modifiersData[r]=(t={},t[w]=C,t.centerOffset=C-S,t)}}function YCe(e){var t=e.state,n=e.options.element,r=n===void 0?`[data-popper-arrow]`:n;r!=null&&(typeof r==`string`&&(r=t.elements.popper.querySelector(r),!r)||zCe(t.elements.popper,r)&&(t.elements.arrow=r))}var XCe={name:`arrow`,enabled:!0,phase:`main`,fn:JCe,effect:YCe,requires:[`popperOffsets`],requiresIfExists:[`preventOverflow`]};function Hf(e){return e.split(`-`)[1]}var ZCe={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`};function QCe(e){var t=e.x,n=e.y,r=window.devicePixelRatio||1;return{x:Nf(t*r)/r||0,y:Nf(n*r)/r||0}}function $Ce(e){var t,n=e.popper,r=e.popperRect,i=e.placement,a=e.variation,o=e.offsets,s=e.position,l=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,f=e.isFixed,p=d===!0?QCe(o):typeof d==`function`?d(o):o,m=p.x,h=m===void 0?0:m,g=p.y,_=g===void 0?0:g,v=o.hasOwnProperty(`x`),y=o.hasOwnProperty(`y`),b=bf,x=_f,S=window;if(u){var C=zf(n),w=`clientHeight`,T=`clientWidth`;if(C===Df(n)&&(C=Lf(n),If(C).position!==`static`&&s===`absolute`&&(w=`scrollHeight`,T=`scrollWidth`)),C=C,i===_f||(i===bf||i===yf)&&a===wf){x=vf;var E=f&&S.visualViewport?S.visualViewport.height:C[w];_-=E-r.height,_*=l?1:-1}if(i===bf||(i===_f||i===vf)&&a===wf){b=yf;var D=f&&S.visualViewport?S.visualViewport.width:C[T];h-=D-r.width,h*=l?1:-1}}var O=Object.assign({position:s},u&&ZCe);if(l){var k;return Object.assign({},O,(k={},k[x]=y?`0`:``,k[b]=v?`0`:``,k.transform=(S.devicePixelRatio||1)<=1?`translate(`+h+`px, `+_+`px)`:`translate3d(`+h+`px, `+_+`px, 0)`,k))}return Object.assign({},O,(t={},t[x]=y?_+`px`:``,t[b]=v?h+`px`:``,t.transform=``,t))}function ewe(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,a=n.adaptive,o=a===void 0?!0:a,s=n.roundOffsets,l=s===void 0?!0:s,u={placement:Af(t.placement),variation:Hf(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy===`fixed`};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,$Ce(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,$Ce(Object.assign({},u,{offsets:t.modifiersData.arrow,position:`absolute`,adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var twe={name:`computeStyles`,enabled:!0,phase:`beforeWrite`,fn:ewe,data:{}},Uf={passive:!0};function nwe(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,a=i===void 0?!0:i,o=r.resize,s=o===void 0?!0:o,l=Df(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&u.forEach(function(e){e.addEventListener(`scroll`,n.update,Uf)}),s&&l.addEventListener(`resize`,n.update,Uf),function(){a&&u.forEach(function(e){e.removeEventListener(`scroll`,n.update,Uf)}),s&&l.removeEventListener(`resize`,n.update,Uf)}}var rwe={name:`eventListeners`,enabled:!0,phase:`write`,fn:function(){},effect:nwe,data:{}},iwe={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Wf(e){return e.replace(/left|right|bottom|top/g,function(e){return iwe[e]})}var awe={start:`end`,end:`start`};function owe(e){return e.replace(/start|end/g,function(e){return awe[e]})}function Gf(e){var t=Df(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Kf(e){return Pf(Lf(e)).left+Gf(e).scrollLeft}function swe(e){var t=Df(e),n=Lf(e),r=t.visualViewport,i=n.clientWidth,a=n.clientHeight,o=0,s=0;return r&&(i=r.width,a=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(o=r.offsetLeft,s=r.offsetTop)),{width:i,height:a,x:o+Kf(e),y:s}}function cwe(e){var t=Lf(e),n=Gf(e),r=e.ownerDocument?.body,i=jf(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=jf(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),o=-n.scrollLeft+Kf(e),s=-n.scrollTop;return If(r||t).direction===`rtl`&&(o+=jf(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:a,x:o,y:s}}function qf(e){var t=If(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function lwe(e){return[`html`,`body`,`#document`].indexOf(Ef(e))>=0?e.ownerDocument.body:kf(e)&&qf(e)?e:lwe(Rf(e))}function Jf(e,t){t===void 0&&(t=[]);var n=lwe(e),r=n===e.ownerDocument?.body,i=Df(n),a=r?[i].concat(i.visualViewport||[],qf(n)?n:[]):n,o=t.concat(a);return r?o:o.concat(Jf(Rf(a)))}function Yf(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function uwe(e){var t=Pf(e);return t.top+=e.clientTop,t.left+=e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}function dwe(e,t){return t===ACe?Yf(swe(e)):Of(t)?uwe(t):Yf(cwe(Lf(e)))}function fwe(e){var t=Jf(Rf(e)),n=[`absolute`,`fixed`].indexOf(If(e).position)>=0,r=n&&kf(e)?zf(e):e;return Of(r)?t.filter(function(e){return Of(e)&&zCe(e,r)&&Ef(e)!==`body`&&(n?If(e).position!==`static`:!0)}):[]}function pwe(e,t,n){var r=t===`clippingParents`?fwe(e):[].concat(t),i=[].concat(r,[n]),a=i[0],o=i.reduce(function(t,n){var r=dwe(e,n);return t.top=jf(r.top,t.top),t.right=Mf(r.right,t.right),t.bottom=Mf(r.bottom,t.bottom),t.left=jf(r.left,t.left),t},dwe(e,a));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function mwe(e){var t=e.reference,n=e.element,r=e.placement,i=r?Af(r):null,a=r?Hf(r):null,o=t.x+t.width/2-n.width/2,s=t.y+t.height/2-n.height/2,l;switch(i){case _f:l={x:o,y:t.y-n.height};break;case vf:l={x:o,y:t.y+t.height};break;case yf:l={x:t.x+t.width,y:s};break;case bf:l={x:t.x-n.width,y:s};break;default:l={x:t.x,y:t.y}}var u=i?Bf(i):null;if(u!=null){var d=u===`y`?`height`:`width`;switch(a){case Cf:l[u]=l[u]-(t[d]/2-n[d]/2);break;case wf:l[u]=l[u]+(t[d]/2-n[d]/2);break}}return l}function Xf(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,a=n.boundary,o=a===void 0?kCe:a,s=n.rootBoundary,l=s===void 0?ACe:s,u=n.elementContext,d=u===void 0?Tf:u,f=n.altBoundary,p=f===void 0?!1:f,m=n.padding,h=m===void 0?0:m,g=GCe(typeof h==`number`?KCe(h,Sf):h),_=d===Tf?jCe:Tf,v=e.rects.popper,y=e.elements[p?_:d],b=pwe(Of(y)?y:y.contextElement||Lf(e.elements.popper),o,l),x=Pf(e.elements.reference),S=mwe({reference:x,element:v,strategy:`absolute`,placement:i}),C=Yf(Object.assign({},v,S)),w=d===Tf?C:x,T={top:b.top-w.top+g.top,bottom:w.bottom-b.bottom+g.bottom,left:b.left-w.left+g.left,right:w.right-b.right+g.right},E=e.modifiersData.offset;if(d===Tf&&E){var D=E[i];Object.keys(T).forEach(function(e){var t=[yf,vf].indexOf(e)>=0?1:-1,n=[_f,vf].indexOf(e)>=0?`y`:`x`;T[e]+=D[n]*t})}return T}function hwe(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,a=n.rootBoundary,o=n.padding,s=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?NCe:l,d=Hf(r),f=d?s?MCe:MCe.filter(function(e){return Hf(e)===d}):Sf,p=f.filter(function(e){return u.indexOf(e)>=0});p.length===0&&(p=f);var m=p.reduce(function(t,n){return t[n]=Xf(e,{placement:n,boundary:i,rootBoundary:a,padding:o})[Af(n)],t},{});return Object.keys(m).sort(function(e,t){return m[e]-m[t]})}function gwe(e){if(Af(e)===xf)return[];var t=Wf(e);return[owe(e),t,owe(t)]}function _we(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,a=i===void 0?!0:i,o=n.altAxis,s=o===void 0?!0:o,l=n.fallbackPlacements,u=n.padding,d=n.boundary,f=n.rootBoundary,p=n.altBoundary,m=n.flipVariations,h=m===void 0?!0:m,g=n.allowedAutoPlacements,_=t.options.placement,v=Af(_)===_,y=l||(v||!h?[Wf(_)]:gwe(_)),b=[_].concat(y).reduce(function(e,n){return e.concat(Af(n)===xf?hwe(t,{placement:n,boundary:d,rootBoundary:f,padding:u,flipVariations:h,allowedAutoPlacements:g}):n)},[]),x=t.rects.reference,S=t.rects.popper,C=new Map,w=!0,T=b[0],E=0;E<b.length;E++){var D=b[E],O=Af(D),k=Hf(D)===Cf,A=[_f,vf].indexOf(O)>=0,j=A?`width`:`height`,M=Xf(t,{placement:D,boundary:d,rootBoundary:f,altBoundary:p,padding:u}),N=A?k?yf:bf:k?vf:_f;x[j]>S[j]&&(N=Wf(N));var P=Wf(N),F=[];if(a&&F.push(M[O]<=0),s&&F.push(M[N]<=0,M[P]<=0),F.every(function(e){return e})){T=D,w=!1;break}C.set(D,F)}if(w)for(var I=h?3:1,L=function(e){var t=b.find(function(t){var n=C.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return T=t,`break`},R=I;R>0&&L(R)!==`break`;R--);t.placement!==T&&(t.modifiersData[r]._skip=!0,t.placement=T,t.reset=!0)}}var vwe={name:`flip`,enabled:!0,phase:`main`,fn:_we,requiresIfExists:[`offset`],data:{_skip:!1}};function ywe(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function bwe(e){return[_f,yf,vf,bf].some(function(t){return e[t]>=0})}function xwe(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,o=Xf(t,{elementContext:`reference`}),s=Xf(t,{altBoundary:!0}),l=ywe(o,r),u=ywe(s,i,a),d=bwe(l),f=bwe(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:f},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}var Swe={name:`hide`,enabled:!0,phase:`main`,requiresIfExists:[`preventOverflow`],fn:xwe};function Cwe(e,t,n){var r=Af(e),i=[bf,_f].indexOf(r)>=0?-1:1,a=typeof n==`function`?n(Object.assign({},t,{placement:e})):n,o=a[0],s=a[1];return o||=0,s=(s||0)*i,[bf,yf].indexOf(r)>=0?{x:s,y:o}:{x:o,y:s}}function wwe(e){var t=e.state,n=e.options,r=e.name,i=n.offset,a=i===void 0?[0,0]:i,o=NCe.reduce(function(e,n){return e[n]=Cwe(n,t.rects,a),e},{}),s=o[t.placement],l=s.x,u=s.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=o}var Twe={name:`offset`,enabled:!0,phase:`main`,requires:[`popperOffsets`],fn:wwe};function Ewe(e){var t=e.state,n=e.name;t.modifiersData[n]=mwe({reference:t.rects.reference,element:t.rects.popper,strategy:`absolute`,placement:t.placement})}var Dwe={name:`popperOffsets`,enabled:!0,phase:`read`,fn:Ewe,data:{}};function Owe(e){return e===`x`?`y`:`x`}function kwe(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,a=i===void 0?!0:i,o=n.altAxis,s=o===void 0?!1:o,l=n.boundary,u=n.rootBoundary,d=n.altBoundary,f=n.padding,p=n.tether,m=p===void 0?!0:p,h=n.tetherOffset,g=h===void 0?0:h,_=Xf(t,{boundary:l,rootBoundary:u,padding:f,altBoundary:d}),v=Af(t.placement),y=Hf(t.placement),b=!y,x=Bf(v),S=Owe(x),C=t.modifiersData.popperOffsets,w=t.rects.reference,T=t.rects.popper,E=typeof g==`function`?g(Object.assign({},t.rects,{placement:t.placement})):g,D=typeof E==`number`?{mainAxis:E,altAxis:E}:Object.assign({mainAxis:0,altAxis:0},E),O=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,k={x:0,y:0};if(C){if(a){var A=x===`y`?_f:bf,j=x===`y`?vf:yf,M=x===`y`?`height`:`width`,N=C[x],P=N+_[A],F=N-_[j],I=m?-T[M]/2:0,L=y===Cf?w[M]:T[M],R=y===Cf?-T[M]:-w[M],ee=t.elements.arrow,te=m&&ee?Ff(ee):{width:0,height:0},ne=t.modifiersData[`arrow#persistent`]?t.modifiersData[`arrow#persistent`].padding:WCe(),re=ne[A],ie=ne[j],ae=Vf(0,w[M],te[M]),oe=b?w[M]/2-I-ae-re-D.mainAxis:L-ae-re-D.mainAxis,se=b?-w[M]/2+I+ae+ie+D.mainAxis:R+ae+ie+D.mainAxis,ce=t.elements.arrow&&zf(t.elements.arrow),le=ce?x===`y`?ce.clientTop||0:ce.clientLeft||0:0,ue=O?.[x]??0,de=N+oe-ue-le,fe=N+se-ue,pe=Vf(m?Mf(P,de):P,N,m?jf(F,fe):F);C[x]=pe,k[x]=pe-N}if(s){var me=x===`x`?_f:bf,he=x===`x`?vf:yf,ge=C[S],_e=S===`y`?`height`:`width`,ve=ge+_[me],ye=ge-_[he],be=[_f,bf].indexOf(v)!==-1,xe=O?.[S]??0,Se=be?ve:ge-w[_e]-T[_e]-xe+D.altAxis,Ce=be?ge+w[_e]+T[_e]-xe-D.altAxis:ye,we=m&&be?UCe(Se,ge,Ce):Vf(m?Se:ve,ge,m?Ce:ye);C[S]=we,k[S]=we-ge}t.modifiersData[r]=k}}var Awe={name:`preventOverflow`,enabled:!0,phase:`main`,fn:kwe,requiresIfExists:[`offset`]};function jwe(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Mwe(e){return e===Df(e)||!kf(e)?Gf(e):jwe(e)}function Nwe(e){var t=e.getBoundingClientRect(),n=Nf(t.width)/e.offsetWidth||1,r=Nf(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Pwe(e,t,n){n===void 0&&(n=!1);var r=kf(t),i=kf(t)&&Nwe(t),a=Lf(t),o=Pf(e,i),s={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Ef(t)!==`body`||qf(a))&&(s=Mwe(t)),kf(t)?(l=Pf(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):a&&(l.x=Kf(a))),{x:o.left+s.scrollLeft-l.x,y:o.top+s.scrollTop-l.y,width:o.width,height:o.height}}function Fwe(e){var t=new Map,n=new Set,r=[];e.forEach(function(e){t.set(e.name,e)});function i(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var r=t.get(e);r&&i(r)}}),r.push(e)}return e.forEach(function(e){n.has(e.name)||i(e)}),r}function Iwe(e){var t=Fwe(e);return PCe.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}function Lwe(e){var t;return function(){return t||=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})}),t}}function Rwe(e){var t=e.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{});return Object.keys(t).map(function(e){return t[e]})}var zwe={placement:`bottom`,modifiers:[],strategy:`absolute`};function Bwe(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&typeof e.getBoundingClientRect==`function`)})}function Vwe(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,a=i===void 0?zwe:i;return function(e,t,n){n===void 0&&(n=a);var i={placement:`bottom`,orderedModifiers:[],options:Object.assign({},zwe,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},o=[],s=!1,l={state:i,setOptions:function(n){var o=typeof n==`function`?n(i.options):n;d(),i.options=Object.assign({},a,i.options,o),i.scrollParents={reference:Of(e)?Jf(e):e.contextElement?Jf(e.contextElement):[],popper:Jf(t)};var s=Iwe(Rwe([].concat(r,i.options.modifiers)));return i.orderedModifiers=s.filter(function(e){return e.enabled}),u(),l.update()},forceUpdate:function(){if(!s){var e=i.elements,t=e.reference,n=e.popper;if(Bwe(t,n)){i.rects={reference:Pwe(t,zf(n),i.options.strategy===`fixed`),popper:Ff(n)},i.reset=!1,i.placement=i.options.placement,i.orderedModifiers.forEach(function(e){return i.modifiersData[e.name]=Object.assign({},e.data)});for(var r=0;r<i.orderedModifiers.length;r++){if(i.reset===!0){i.reset=!1,r=-1;continue}var a=i.orderedModifiers[r],o=a.fn,u=a.options,d=u===void 0?{}:u,f=a.name;typeof o==`function`&&(i=o({state:i,options:d,name:f,instance:l})||i)}}}},update:Lwe(function(){return new Promise(function(e){l.forceUpdate(),e(i)})}),destroy:function(){d(),s=!0}};if(!Bwe(e,t))return l;l.setOptions(n).then(function(e){!s&&n.onFirstUpdate&&n.onFirstUpdate(e)});function u(){i.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=n===void 0?{}:n,a=e.effect;if(typeof a==`function`){var s=a({state:i,name:t,instance:l,options:r});o.push(s||function(){})}})}function d(){o.forEach(function(e){return e()}),o=[]}return l}}var Hwe=Vwe({defaultModifiers:[rwe,Dwe,twe,RCe,Twe,vwe,Awe,XCe,Swe]}),Uwe=`tippy-box`,Wwe=`tippy-content`,Gwe=`tippy-backdrop`,Kwe=`tippy-arrow`,qwe=`tippy-svg-arrow`,Zf={passive:!0,capture:!0},Jwe=function(){return document.body};function Qf(e,t,n){return Array.isArray(e)?e[t]??(Array.isArray(n)?n[t]:n):e}function $f(e,t){var n={}.toString.call(e);return n.indexOf(`[object`)===0&&n.indexOf(t+`]`)>-1}function Ywe(e,t){return typeof e==`function`?e.apply(void 0,t):e}function Xwe(e,t){if(t===0)return e;var n;return function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}}function Zwe(e){return e.split(/\s+/).filter(Boolean)}function ep(e){return[].concat(e)}function Qwe(e,t){e.indexOf(t)===-1&&e.push(t)}function $we(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function eTe(e){return e.split(`-`)[0]}function tp(e){return[].slice.call(e)}function tTe(e){return Object.keys(e).reduce(function(t,n){return e[n]!==void 0&&(t[n]=e[n]),t},{})}function np(){return document.createElement(`div`)}function rp(e){return[`Element`,`Fragment`].some(function(t){return $f(e,t)})}function nTe(e){return $f(e,`NodeList`)}function ip(e){return $f(e,`MouseEvent`)}function rTe(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function iTe(e){return rp(e)?[e]:nTe(e)?tp(e):Array.isArray(e)?e:tp(document.querySelectorAll(e))}function ap(e,t){e.forEach(function(e){e&&(e.style.transitionDuration=t+`ms`)})}function op(e,t){e.forEach(function(e){e&&e.setAttribute(`data-state`,t)})}function aTe(e){var t,n=ep(e)[0];return n!=null&&(t=n.ownerDocument)!=null&&t.body?n.ownerDocument:document}function oTe(e,t){var n=t.clientX,r=t.clientY;return e.every(function(e){var t=e.popperRect,i=e.popperState,a=e.props.interactiveBorder,o=eTe(i.placement),s=i.modifiersData.offset;if(!s)return!0;var l=o===`bottom`?s.top.y:0,u=o===`top`?s.bottom.y:0,d=o===`right`?s.left.x:0,f=o===`left`?s.right.x:0,p=t.top-r+l>a,m=r-t.bottom-u>a,h=t.left-n+d>a,g=n-t.right-f>a;return p||m||h||g})}function sp(e,t,n){var r=t+`EventListener`;[`transitionend`,`webkitTransitionEnd`].forEach(function(t){e[r](t,n)})}function sTe(e,t){for(var n=t;n;){if(e.contains(n))return!0;n=n.getRootNode==null?void 0:n.getRootNode()?.host}return!1}var cp={isTouch:!1},cTe=0;function lTe(){cp.isTouch||(cp.isTouch=!0,window.performance&&document.addEventListener(`mousemove`,uTe))}function uTe(){var e=performance.now();e-cTe<20&&(cp.isTouch=!1,document.removeEventListener(`mousemove`,uTe)),cTe=e}function dTe(){var e=document.activeElement;if(rTe(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function fTe(){document.addEventListener(`touchstart`,lTe,Zf),window.addEventListener(`blur`,dTe)}var pTe=typeof window<`u`&&typeof document<`u`?!!window.msCrypto:!1,lp=Object.assign({appendTo:Jwe,aria:{content:`auto`,expanded:`auto`},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:``,offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:`top`,plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:`mouseenter focus`,triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:`fade`,arrow:!0,content:``,inertia:!1,maxWidth:350,role:`tooltip`,theme:``,zIndex:9999}),mTe=Object.keys(lp),hTe=function(e){Object.keys(e).forEach(function(t){lp[t]=e[t]})};function gTe(e){var t=(e.plugins||[]).reduce(function(t,n){var r=n.name,i=n.defaultValue;return r&&(t[r]=e[r]===void 0?lp[r]??i:e[r]),t},{});return Object.assign({},e,t)}function _Te(e,t){return(t?Object.keys(gTe(Object.assign({},lp,{plugins:t}))):mTe).reduce(function(t,n){var r=(e.getAttribute(`data-tippy-`+n)||``).trim();if(!r)return t;if(n===`content`)t[n]=r;else try{t[n]=JSON.parse(r)}catch{t[n]=r}return t},{})}function vTe(e,t){var n=Object.assign({},t,{content:Ywe(t.content,[e])},t.ignoreAttributes?{}:_Te(e,t.plugins));return n.aria=Object.assign({},lp.aria,n.aria),n.aria={expanded:n.aria.expanded===`auto`?t.interactive:n.aria.expanded,content:n.aria.content===`auto`?t.interactive?null:`describedby`:n.aria.content},n}var yTe=function(){return`innerHTML`};function up(e,t){e[yTe()]=t}function bTe(e){var t=np();return e===!0?t.className=Kwe:(t.className=qwe,rp(e)?t.appendChild(e):up(t,e)),t}function xTe(e,t){rp(t.content)?(up(e,``),e.appendChild(t.content)):typeof t.content!=`function`&&(t.allowHTML?up(e,t.content):e.textContent=t.content)}function dp(e){var t=e.firstElementChild,n=tp(t.children);return{box:t,content:n.find(function(e){return e.classList.contains(Wwe)}),arrow:n.find(function(e){return e.classList.contains(Kwe)||e.classList.contains(qwe)}),backdrop:n.find(function(e){return e.classList.contains(Gwe)})}}function STe(e){var t=np(),n=np();n.className=Uwe,n.setAttribute(`data-state`,`hidden`),n.setAttribute(`tabindex`,`-1`);var r=np();r.className=Wwe,r.setAttribute(`data-state`,`hidden`),xTe(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props);function i(n,r){var i=dp(t),a=i.box,o=i.content,s=i.arrow;r.theme?a.setAttribute(`data-theme`,r.theme):a.removeAttribute(`data-theme`),typeof r.animation==`string`?a.setAttribute(`data-animation`,r.animation):a.removeAttribute(`data-animation`),r.inertia?a.setAttribute(`data-inertia`,``):a.removeAttribute(`data-inertia`),a.style.maxWidth=typeof r.maxWidth==`number`?r.maxWidth+`px`:r.maxWidth,r.role?a.setAttribute(`role`,r.role):a.removeAttribute(`role`),(n.content!==r.content||n.allowHTML!==r.allowHTML)&&xTe(o,e.props),r.arrow?s?n.arrow!==r.arrow&&(a.removeChild(s),a.appendChild(bTe(r.arrow))):a.appendChild(bTe(r.arrow)):s&&a.removeChild(s)}return{popper:t,onUpdate:i}}STe.$$tippy=!0;var CTe=1,fp=[],pp=[];function wTe(e,t){var n=vTe(e,Object.assign({},lp,gTe(tTe(t)))),r,i,a,o=!1,s=!1,l=!1,u=!1,d,f,p,m=[],h=Xwe(de,n.interactiveDebounce),g,_=CTe++,v=null,y=$we(n.plugins),b={id:_,reference:e,popper:np(),popperInstance:v,props:n,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:y,clearDelayTimeouts:Ce,setProps:we,setContent:Te,show:Ee,hide:De,hideWithInteractivity:Oe,enable:xe,disable:Se,unmount:ke,destroy:Ae};if(!n.render)return b;var x=n.render(b),S=x.popper,C=x.onUpdate;S.setAttribute(`data-tippy-root`,``),S.id=`tippy-`+b.id,b.popper=S,e._tippy=b,S._tippy=b;var w=y.map(function(e){return e.fn(b)}),T=e.hasAttribute(`aria-expanded`);return ce(),I(),N(),P(`onCreate`,[b]),n.showOnCreate&&ye(),S.addEventListener(`mouseenter`,function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),S.addEventListener(`mouseleave`,function(){b.props.interactive&&b.props.trigger.indexOf(`mouseenter`)>=0&&A().addEventListener(`mousemove`,h)}),b;function E(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function D(){return E()[0]===`hold`}function O(){var e;return!!((e=b.props.render)!=null&&e.$$tippy)}function k(){return g||e}function A(){var e=k().parentNode;return e?aTe(e):document}function j(){return dp(S)}function M(e){return b.state.isMounted&&!b.state.isVisible||cp.isTouch||d&&d.type===`focus`?0:Qf(b.props.delay,+!e,lp.delay)}function N(e){e===void 0&&(e=!1),S.style.pointerEvents=b.props.interactive&&!e?``:`none`,S.style.zIndex=``+b.props.zIndex}function P(e,t,n){if(n===void 0&&(n=!0),w.forEach(function(n){n[e]&&n[e].apply(n,t)}),n){var r;(r=b.props)[e].apply(r,t)}}function F(){var t=b.props.aria;if(t.content){var n=`aria-`+t.content,r=S.id;ep(b.props.triggerTarget||e).forEach(function(e){var t=e.getAttribute(n);if(b.state.isVisible)e.setAttribute(n,t?t+` `+r:r);else{var i=t&&t.replace(r,``).trim();i?e.setAttribute(n,i):e.removeAttribute(n)}})}}function I(){T||!b.props.aria.expanded||ep(b.props.triggerTarget||e).forEach(function(e){b.props.interactive?e.setAttribute(`aria-expanded`,b.state.isVisible&&e===k()?`true`:`false`):e.removeAttribute(`aria-expanded`)})}function L(){A().removeEventListener(`mousemove`,h),fp=fp.filter(function(e){return e!==h})}function R(t){if(!(cp.isTouch&&(l||t.type===`mousedown`))){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!(b.props.interactive&&sTe(S,n))){if(ep(b.props.triggerTarget||e).some(function(e){return sTe(e,n)})){if(cp.isTouch||b.state.isVisible&&b.props.trigger.indexOf(`click`)>=0)return}else P(`onClickOutside`,[b,t]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),s=!0,setTimeout(function(){s=!1}),b.state.isMounted||re())}}}function ee(){l=!0}function te(){l=!1}function ne(){var e=A();e.addEventListener(`mousedown`,R,!0),e.addEventListener(`touchend`,R,Zf),e.addEventListener(`touchstart`,te,Zf),e.addEventListener(`touchmove`,ee,Zf)}function re(){var e=A();e.removeEventListener(`mousedown`,R,!0),e.removeEventListener(`touchend`,R,Zf),e.removeEventListener(`touchstart`,te,Zf),e.removeEventListener(`touchmove`,ee,Zf)}function ie(e,t){oe(e,function(){!b.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&t()})}function ae(e,t){oe(e,t)}function oe(e,t){var n=j().box;function r(e){e.target===n&&(sp(n,`remove`,r),t())}if(e===0)return t();sp(n,`remove`,f),sp(n,`add`,r),f=r}function se(t,n,r){r===void 0&&(r=!1),ep(b.props.triggerTarget||e).forEach(function(e){e.addEventListener(t,n,r),m.push({node:e,eventType:t,handler:n,options:r})})}function ce(){D()&&(se(`touchstart`,ue,{passive:!0}),se(`touchend`,fe,{passive:!0})),Zwe(b.props.trigger).forEach(function(e){if(e!==`manual`)switch(se(e,ue),e){case`mouseenter`:se(`mouseleave`,fe);break;case`focus`:se(pTe?`focusout`:`blur`,pe);break;case`focusin`:se(`focusout`,pe);break}})}function le(){m.forEach(function(e){var t=e.node,n=e.eventType,r=e.handler,i=e.options;t.removeEventListener(n,r,i)}),m=[]}function ue(e){var t=!1;if(!(!b.state.isEnabled||me(e)||s)){var n=d?.type===`focus`;d=e,g=e.currentTarget,I(),!b.state.isVisible&&ip(e)&&fp.forEach(function(t){return t(e)}),e.type===`click`&&(b.props.trigger.indexOf(`mouseenter`)<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?t=!0:ye(e),e.type===`click`&&(o=!t),t&&!n&&be(e)}}function de(e){var t=e.target,r=k().contains(t)||S.contains(t);e.type===`mousemove`&&r||oTe(ve().concat(S).map(function(e){var t=e._tippy.popperInstance?.state;return t?{popperRect:e.getBoundingClientRect(),popperState:t,props:n}:null}).filter(Boolean),e)&&(L(),be(e))}function fe(e){if(!(me(e)||b.props.trigger.indexOf(`click`)>=0&&o)){if(b.props.interactive){b.hideWithInteractivity(e);return}be(e)}}function pe(e){b.props.trigger.indexOf(`focusin`)<0&&e.target!==k()||b.props.interactive&&e.relatedTarget&&S.contains(e.relatedTarget)||be(e)}function me(e){return cp.isTouch?D()!==e.type.indexOf(`touch`)>=0:!1}function he(){ge();var t=b.props,n=t.popperOptions,r=t.placement,i=t.offset,a=t.getReferenceClientRect,o=t.moveTransition,s=O()?dp(S).arrow:null,l=a?{getBoundingClientRect:a,contextElement:a.contextElement||k()}:e,u=[{name:`offset`,options:{offset:i}},{name:`preventOverflow`,options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:`flip`,options:{padding:5}},{name:`computeStyles`,options:{adaptive:!o}},{name:`$$tippy`,enabled:!0,phase:`beforeWrite`,requires:[`computeStyles`],fn:function(e){var t=e.state;if(O()){var n=j().box;[`placement`,`reference-hidden`,`escaped`].forEach(function(e){e===`placement`?n.setAttribute(`data-placement`,t.placement):t.attributes.popper[`data-popper-`+e]?n.setAttribute(`data-`+e,``):n.removeAttribute(`data-`+e)}),t.attributes.popper={}}}}];O()&&s&&u.push({name:`arrow`,options:{element:s,padding:3}}),u.push.apply(u,n?.modifiers||[]),b.popperInstance=Hwe(l,S,Object.assign({},n,{placement:r,onFirstUpdate:p,modifiers:u}))}function ge(){b.popperInstance&&=(b.popperInstance.destroy(),null)}function _e(){var e=b.props.appendTo,t,n=k();t=b.props.interactive&&e===Jwe||e===`parent`?n.parentNode:Ywe(e,[n]),t.contains(S)||t.appendChild(S),b.state.isMounted=!0,he()}function ve(){return tp(S.querySelectorAll(`[data-tippy-root]`))}function ye(e){b.clearDelayTimeouts(),e&&P(`onTrigger`,[b,e]),ne();var t=M(!0),n=E(),i=n[0],a=n[1];cp.isTouch&&i===`hold`&&a&&(t=a),t?r=setTimeout(function(){b.show()},t):b.show()}function be(e){if(b.clearDelayTimeouts(),P(`onUntrigger`,[b,e]),!b.state.isVisible){re();return}if(!(b.props.trigger.indexOf(`mouseenter`)>=0&&b.props.trigger.indexOf(`click`)>=0&&[`mouseleave`,`mousemove`].indexOf(e.type)>=0&&o)){var t=M(!1);t?i=setTimeout(function(){b.state.isVisible&&b.hide()},t):a=requestAnimationFrame(function(){b.hide()})}}function xe(){b.state.isEnabled=!0}function Se(){b.hide(),b.state.isEnabled=!1}function Ce(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(a)}function we(t){if(!b.state.isDestroyed){P(`onBeforeUpdate`,[b,t]),le();var n=b.props,r=vTe(e,Object.assign({},n,tTe(t),{ignoreAttributes:!0}));b.props=r,ce(),n.interactiveDebounce!==r.interactiveDebounce&&(L(),h=Xwe(de,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?ep(n.triggerTarget).forEach(function(e){e.removeAttribute(`aria-expanded`)}):r.triggerTarget&&e.removeAttribute(`aria-expanded`),I(),N(),C&&C(n,r),b.popperInstance&&(he(),ve().forEach(function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})),P(`onAfterUpdate`,[b,t])}}function Te(e){b.setProps({content:e})}function Ee(){var e=b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=cp.isTouch&&!b.props.touch,i=Qf(b.props.duration,0,lp.duration);if(!(e||t||n||r)&&!k().hasAttribute(`disabled`)&&(P(`onShow`,[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,O()&&(S.style.visibility=`visible`),N(),ne(),b.state.isMounted||(S.style.transition=`none`),O()){var a=j(),o=a.box,s=a.content;ap([o,s],0)}p=function(){var e;if(!(!b.state.isVisible||u)){if(u=!0,S.offsetHeight,S.style.transition=b.props.moveTransition,O()&&b.props.animation){var t=j(),n=t.box,r=t.content;ap([n,r],i),op([n,r],`visible`)}F(),I(),Qwe(pp,b),(e=b.popperInstance)==null||e.forceUpdate(),P(`onMount`,[b]),b.props.animation&&O()&&ae(i,function(){b.state.isShown=!0,P(`onShown`,[b])})}},_e()}}function De(){var e=!b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=Qf(b.props.duration,1,lp.duration);if(!(e||t||n)&&(P(`onHide`,[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,u=!1,o=!1,O()&&(S.style.visibility=`hidden`),L(),re(),N(!0),O()){var i=j(),a=i.box,s=i.content;b.props.animation&&(ap([a,s],r),op([a,s],`hidden`))}F(),I(),b.props.animation?O()&&ie(r,b.unmount):b.unmount()}}function Oe(e){A().addEventListener(`mousemove`,h),Qwe(fp,h),h(e)}function ke(){b.state.isVisible&&b.hide(),b.state.isMounted&&(ge(),ve().forEach(function(e){e._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),pp=pp.filter(function(e){return e!==b}),b.state.isMounted=!1,P(`onHidden`,[b]))}function Ae(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),le(),delete e._tippy,b.state.isDestroyed=!0,P(`onDestroy`,[b]))}}function mp(e,t){t===void 0&&(t={});var n=lp.plugins.concat(t.plugins||[]);fTe();var r=Object.assign({},t,{plugins:n}),i=iTe(e).reduce(function(e,t){var n=t&&wTe(t,r);return n&&e.push(n),e},[]);return rp(e)?i[0]:i}mp.defaultProps=lp,mp.setDefaultProps=hTe,mp.currentInput=cp,Object.assign({},RCe,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}});var TTe={name:`animateFill`,defaultValue:!1,fn:function(e){var t;if(!((t=e.props.render)!=null&&t.$$tippy))return{};var n=dp(e.popper),r=n.box,i=n.content,a=e.props.animateFill?ETe():null;return{onCreate:function(){a&&(r.insertBefore(a,r.firstElementChild),r.setAttribute(`data-animatefill`,``),r.style.overflow=`hidden`,e.setProps({arrow:!1,animation:`shift-away`}))},onMount:function(){if(a){var e=r.style.transitionDuration,t=Number(e.replace(`ms`,``));i.style.transitionDelay=Math.round(t/10)+`ms`,a.style.transitionDuration=e,op([a],`visible`)}},onShow:function(){a&&(a.style.transitionDuration=`0ms`)},onHide:function(){a&&op([a],`hidden`)}}}};function ETe(){var e=np();return e.className=Gwe,op([e],`hidden`),e}var hp={clientX:0,clientY:0},gp=[];function DTe(e){hp={clientX:e.clientX,clientY:e.clientY}}function OTe(e){e.addEventListener(`mousemove`,DTe)}function kTe(e){e.removeEventListener(`mousemove`,DTe)}var ATe={name:`followCursor`,defaultValue:!1,fn:function(e){var t=e.reference,n=aTe(e.props.triggerTarget||t),r=!1,i=!1,a=!0,o=e.props;function s(){return e.props.followCursor===`initial`&&e.state.isVisible}function l(){n.addEventListener(`mousemove`,f)}function u(){n.removeEventListener(`mousemove`,f)}function d(){r=!0,e.setProps({getReferenceClientRect:null}),r=!1}function f(n){var r=n.target?t.contains(n.target):!0,i=e.props.followCursor,a=n.clientX,o=n.clientY,s=t.getBoundingClientRect(),l=a-s.left,u=o-s.top;(r||!e.props.interactive)&&e.setProps({getReferenceClientRect:function(){var e=t.getBoundingClientRect(),n=a,r=o;i===`initial`&&(n=e.left+l,r=e.top+u);var s=i===`horizontal`?e.top:r,d=i===`vertical`?e.right:n,f=i===`horizontal`?e.bottom:r,p=i===`vertical`?e.left:n;return{width:d-p,height:f-s,top:s,right:d,bottom:f,left:p}}})}function p(){e.props.followCursor&&(gp.push({instance:e,doc:n}),OTe(n))}function m(){gp=gp.filter(function(t){return t.instance!==e}),gp.filter(function(e){return e.doc===n}).length===0&&kTe(n)}return{onCreate:p,onDestroy:m,onBeforeUpdate:function(){o=e.props},onAfterUpdate:function(t,n){var a=n.followCursor;r||a!==void 0&&o.followCursor!==a&&(m(),a?(p(),e.state.isMounted&&!i&&!s()&&l()):(u(),d()))},onMount:function(){e.props.followCursor&&!i&&(a&&=(f(hp),!1),s()||l())},onTrigger:function(e,t){ip(t)&&(hp={clientX:t.clientX,clientY:t.clientY}),i=t.type===`focus`},onHidden:function(){e.props.followCursor&&(d(),u(),a=!0)}}}};function jTe(e,t){return{popperOptions:Object.assign({},e.popperOptions,{modifiers:[].concat((e.popperOptions?.modifiers||[]).filter(function(e){return e.name!==t.name}),[t])})}}var MTe={name:`inlinePositioning`,defaultValue:!1,fn:function(e){var t=e.reference;function n(){return!!e.props.inlinePositioning}var r,i=-1,a=!1,o=[],s={name:`tippyInlinePositioning`,enabled:!0,phase:`afterWrite`,fn:function(t){var i=t.state;n()&&(o.indexOf(i.placement)!==-1&&(o=[]),r!==i.placement&&o.indexOf(i.placement)===-1&&(o.push(i.placement),e.setProps({getReferenceClientRect:function(){return l(i.placement)}})),r=i.placement)}};function l(e){return NTe(eTe(e),t.getBoundingClientRect(),tp(t.getClientRects()),i)}function u(t){a=!0,e.setProps(t),a=!1}function d(){a||u(jTe(e.props,s))}return{onCreate:d,onAfterUpdate:d,onTrigger:function(t,n){if(ip(n)){var r=tp(e.reference.getClientRects()),a=r.find(function(e){return e.left-2<=n.clientX&&e.right+2>=n.clientX&&e.top-2<=n.clientY&&e.bottom+2>=n.clientY}),o=r.indexOf(a);i=o>-1?o:i}},onHidden:function(){i=-1}}}};function NTe(e,t,n,r){if(n.length<2||e===null)return t;if(n.length===2&&r>=0&&n[0].left>n[1].right)return n[r]||t;switch(e){case`top`:case`bottom`:var i=n[0],a=n[n.length-1],o=e===`top`,s=i.top,l=a.bottom,u=o?i.left:a.left,d=o?i.right:a.right;return{top:s,bottom:l,left:u,right:d,width:d-u,height:l-s};case`left`:case`right`:var f=Math.min.apply(Math,n.map(function(e){return e.left})),p=Math.max.apply(Math,n.map(function(e){return e.right})),m=n.filter(function(t){return e===`left`?t.left===f:t.right===p}),h=m[0].top,g=m[m.length-1].bottom,_=f,v=p;return{top:h,bottom:g,left:_,right:v,width:v-_,height:g-h};default:return t}}var PTe={name:`sticky`,defaultValue:!1,fn:function(e){var t=e.reference,n=e.popper;function r(){return e.popperInstance?e.popperInstance.state.elements.reference:t}function i(t){return e.props.sticky===!0||e.props.sticky===t}var a=null,o=null;function s(){var t=i(`reference`)?r().getBoundingClientRect():null,l=i(`popper`)?n.getBoundingClientRect():null;(t&&FTe(a,t)||l&&FTe(o,l))&&e.popperInstance&&e.popperInstance.update(),a=t,o=l,e.state.isMounted&&requestAnimationFrame(s)}return{onMount:function(){e.props.sticky&&s()}}}};function FTe(e,t){return e&&t?e.top!==t.top||e.right!==t.right||e.bottom!==t.bottom||e.left!==t.left:!0}mp.setDefaultProps({render:STe}),mp.setDefaultProps({onShow:e=>{if(!e.props.content)return!1}});var ITe=e=>e instanceof Object&&`$`in e&&`$el`in e;function LTe(e,t={},n={mount:!0,appName:`Tippy`}){n=Object.assign({mount:!0,appName:`Tippy`},n);let r=si(),i=sn(),a=sn({isEnabled:!1,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1}),o=cn(),s=null,l=()=>s||(s=document.createDocumentFragment(),s),u=e=>{let t,i=on(e)?e.value:e;return qr(i)?(o.value||(o.value=Fi({name:n.appName,setup:()=>()=>on(e)?e.value:e}),r&&Object.assign(o.value._context,r.appContext),o.value.mount(l())),t=()=>l()):typeof i==`object`?(o.value||(o.value=Fi({name:n.appName,setup:()=>()=>U(on(e)?e.value:e)}),r&&Object.assign(o.value._context,r.appContext),o.value.mount(l())),t=()=>l()):t=i,t},d=e=>{let t={};return t=on(e)?e.value||{}:{...e},t.content&&=u(t.content),t.triggerTarget&&=on(t.triggerTarget)?t.triggerTarget.value:t.triggerTarget,(!t.plugins||!Array.isArray(t.plugins))&&(t.plugins=[]),t.plugins=t.plugins.filter(e=>e.name!==`vueTippyReactiveState`),t.plugins.push({name:`vueTippyReactiveState`,fn:()=>({onCreate(){a.value.isEnabled=!0},onMount(){a.value.isMounted=!0},onShow(){a.value.isMounted=!0,a.value.isVisible=!0},onShown(){a.value.isShown=!0},onHide(){a.value.isMounted=!1,a.value.isVisible=!1},onHidden(){a.value.isShown=!1},onUnmounted(){a.value.isMounted=!1},onDestroy(){a.value.isDestroyed=!0}})}),t},f=()=>{i.value&&i.value.setProps(d(t))},p=()=>{!i.value||!t.content||i.value.setContent(u(t.content))},m=e=>{var t;(t=i.value)==null||t.setContent(u(e))},h=e=>{var t;(t=i.value)==null||t.setProps(d(e))},g=()=>{var e;i.value&&=(i.value.destroy(),void 0),s=null,(e=o.value)==null||e.unmount(),o.value=void 0},_=()=>{var e;(e=i.value)==null||e.show()},v=()=>{var e;(e=i.value)==null||e.hide()},y=()=>{var e;(e=i.value)==null||e.disable(),a.value.isEnabled=!1},b=()=>{var e;(e=i.value)==null||e.enable(),a.value.isEnabled=!0},x=()=>{var e;(e=i.value)==null||e.unmount()},S=()=>{if(!e)return;let n=on(e)?e.value:e;typeof n==`function`&&(n=n()),ITe(n)&&(n=n.$el),n&&(i.value=mp(n,d(t)),n.$tippy=C)},C={tippy:i,refresh:f,refreshContent:p,setContent:m,setProps:h,destroy:g,hide:v,show:_,disable:y,enable:b,unmount:x,mount:S,state:a};return n.mount&&(r?r.isMounted?S():sr(S):S()),r&&lr(()=>{g()}),on(t)||Qt(t)?Rn(t,f,{immediate:!1}):on(t.content)&&Rn(t.content,p,{immediate:!1}),C}function RTe(e){return typeof e==`function`?e():z(e)}function zTe(e){let t=RTe(e);return t?.$el??t}var _p=$n({props:{to:{type:[String,Function]},tag:{type:[String,Object],default:`span`},contentTag:{type:[String,Object],default:`span`},contentClass:{type:String,default:null},appendTo:{default:()=>mp.defaultProps.appendTo},aria:{default:()=>mp.defaultProps.aria},delay:{default:()=>mp.defaultProps.delay},duration:{default:()=>mp.defaultProps.duration},getReferenceClientRect:{default:()=>mp.defaultProps.getReferenceClientRect},hideOnClick:{type:[Boolean,String],default:()=>mp.defaultProps.hideOnClick},ignoreAttributes:{type:Boolean,default:()=>mp.defaultProps.ignoreAttributes},interactive:{type:Boolean,default:()=>mp.defaultProps.interactive},interactiveBorder:{default:()=>mp.defaultProps.interactiveBorder},interactiveDebounce:{default:()=>mp.defaultProps.interactiveDebounce},moveTransition:{default:()=>mp.defaultProps.moveTransition},offset:{default:()=>mp.defaultProps.offset},onAfterUpdate:{default:()=>mp.defaultProps.onAfterUpdate},onBeforeUpdate:{default:()=>mp.defaultProps.onBeforeUpdate},onCreate:{default:()=>mp.defaultProps.onCreate},onDestroy:{default:()=>mp.defaultProps.onDestroy},onHidden:{default:()=>mp.defaultProps.onHidden},onHide:{default:()=>mp.defaultProps.onHide},onMount:{default:()=>mp.defaultProps.onMount},onShow:{default:()=>mp.defaultProps.onShow},onShown:{default:()=>mp.defaultProps.onShown},onTrigger:{default:()=>mp.defaultProps.onTrigger},onUntrigger:{default:()=>mp.defaultProps.onUntrigger},onClickOutside:{default:()=>mp.defaultProps.onClickOutside},placement:{default:()=>mp.defaultProps.placement},plugins:{default:()=>mp.defaultProps.plugins},popperOptions:{default:()=>mp.defaultProps.popperOptions},render:{default:()=>mp.defaultProps.render},showOnCreate:{type:Boolean,default:()=>mp.defaultProps.showOnCreate},touch:{type:[Boolean,String,Array],default:()=>mp.defaultProps.touch},trigger:{default:()=>mp.defaultProps.trigger},triggerTarget:{default:()=>mp.defaultProps.triggerTarget},animateFill:{type:Boolean,default:()=>mp.defaultProps.animateFill},followCursor:{type:[Boolean,String],default:()=>mp.defaultProps.followCursor},inlinePositioning:{type:Boolean,default:()=>mp.defaultProps.inlinePositioning},sticky:{type:[Boolean,String],default:()=>mp.defaultProps.sticky},allowHTML:{type:Boolean,default:()=>mp.defaultProps.allowHTML},animation:{default:()=>mp.defaultProps.animation},arrow:{default:()=>mp.defaultProps.arrow},content:{default:()=>mp.defaultProps.content},inertia:{default:()=>mp.defaultProps.inertia},maxWidth:{default:()=>mp.defaultProps.maxWidth},role:{default:()=>mp.defaultProps.role},theme:{default:()=>mp.defaultProps.theme},zIndex:{default:()=>mp.defaultProps.zIndex}},emits:[`state`],setup(e,{slots:t,emit:n,expose:r}){let i=sn(),a=sn(),o=sn(),s=sn(!1),l=()=>{let t={...e};for(let e of[`to`,`tag`,`contentTag`,`contentClass`])t.hasOwnProperty(e)&&delete t[e];return t},u=()=>zTe(i);e.to&&(typeof Element<`u`&&e.to instanceof Element?u=()=>e.to:e.to===`parent`?u=()=>{let e=i.value;return e||=i.value=a.value.parentElement,e}:(typeof e.to==`string`||e.to instanceof String)&&(u=()=>document.querySelector(e.to)));let d=LTe(u,l()),f=t.content;!f&&e.to===`parent`&&(f=t.default),sr(()=>{s.value=!0,Dn(()=>{f&&d.setContent(()=>o.value)})}),Rn(d.state,()=>{n(`state`,z(d.state))},{immediate:!0,deep:!0}),Rn(()=>e,()=>{d.setProps(l()),f&&d.setContent(()=>o.value)},{deep:!0});let p=Jt({elem:i,contentElem:o,mounted:s,...d});return r(p),()=>{let n=(e.contentTag,e.contentTag),r=f?U(n,{ref:o,style:{display:s.value?`inherit`:`none`},class:e.contentClass},f(p)):null;if(e.to===`parent`){let e=[];if(!i.value){let t=U(`span`,{ref:a,"data-v-tippy":``,style:{display:`none`}});e.push(t)}return r&&e.push(r),e}let l=t.default?t.default(p):[];if(!e.tag){let e=U(l[0],{ref:i,"data-v-tippy":``});return r?[e,r]:e}return U((e.tag,e.tag),{ref:i,"data-v-tippy":``},r?[l,r]:l)}}}),BTe=[`a11y`,`allowHTML`,`arrow`,`flip`,`flipOnUpdate`,`hideOnClick`,`ignoreAttributes`,`inertia`,`interactive`,`lazy`,`multiple`,`showOnInit`,`touch`,`touchHold`],VTe={};Object.keys(mp.defaultProps).forEach(e=>{BTe.includes(e)?VTe[e]={type:Boolean,default:function(){return mp.defaultProps[e]}}:VTe[e]={default:function(){return mp.defaultProps[e]}}});var vp={mounted(e,t,n){let r=typeof t.value==`string`?{content:t.value}:t.value||{},i=Object.keys(t.modifiers||{}),a=i.find(e=>e!==`arrow`),o=i.findIndex(e=>e===`arrow`)!==-1;a&&(r.placement=r.placement||a),o&&(r.arrow=r.arrow===void 0?!0:r.arrow),n.props&&n.props.onTippyShow&&(r.onShow=function(...e){return n.props?.onTippyShow(...e)}),n.props&&n.props.onTippyShown&&(r.onShown=function(...e){return n.props?.onTippyShown(...e)}),n.props&&n.props.onTippyHidden&&(r.onHidden=function(...e){return n.props?.onTippyHidden(...e)}),n.props&&n.props.onTippyHide&&(r.onHide=function(...e){return n.props?.onTippyHide(...e)}),n.props&&n.props.onTippyMount&&(r.onMount=function(...e){return n.props?.onTippyMount(...e)}),e.getAttribute(`title`)&&!r.content&&(r.content=e.getAttribute(`title`),e.removeAttribute(`title`)),e.getAttribute(`content`)&&!r.content&&(r.content=e.getAttribute(`content`)),LTe(e,r)},unmounted(e){e.$tippy?e.$tippy.destroy():e._tippy&&e._tippy.destroy()},updated(e,t){let n=typeof t.value==`string`?{content:t.value}:t.value||{};n.content||=null,e.getAttribute(`title`)&&!n.content&&(n.content=e.getAttribute(`title`),e.removeAttribute(`title`)),e.getAttribute(`content`)&&!n.content&&(n.content=e.getAttribute(`content`)),e.$tippy?e.$tippy.setProps(n||{}):e._tippy&&e._tippy.setProps(n||{})}},HTe=mp.setDefaultProps;HTe({ignoreAttributes:!0,plugins:[PTe,MTe,ATe,TTe]});var UTe=e=>e?e.startsWith(`image/`):!1,WTe=e=>e?URL.createObjectURL(e):``,GTe=e=>e&&(e.name.split(`.`).pop()||e.type?.split(`/`).pop())||``,KTe=e=>{if(!e)return``;let t=e.size,n=[`B`,`KB`,`M`,`GB`],r=Math.floor(Math.log2(t)/10);return`${(t/1024**r).toFixed(2)} ${n[r]}`},yp=(e,t,n)=>e<1?``:n?`${e} files were not uploaded; they may exceed ${t} MB or the upload count limit.`:`有 ${e} 个文件未上传,可能文件超过 ${t} MB或超出上传个数`;function bp(e){if(!e)return!1;let t=e.charCodeAt(0);return t>=19968&&t<=40959}function qTe(e,t){let n=t+2;if(n<e.length){let t=e[n];if(bp(t))return!1;if(t===`
|
|
238
|
+
`).forEach(e=>{let t=e.replace(`data:`,``).trim();if(l(t)){let e=JSON.parse(t);i.onMessage?.(e),n=``}else t&&(n=t)})}}catch(e){if(e instanceof Error){if(e.name===`AbortError`){i.onDone?.();return}r(e)}throw e}}};function Mxe(e,t){if(!t)return e;let n=new URLSearchParams;Object.keys(t).forEach(e=>{let r=t[e];r!=null&&(Array.isArray(r)?r.forEach(t=>n.append(e,String(t))):n.append(e,String(r)))});let r=n.toString();return r?`${e}${e.includes(`?`)?`&`:`?`}${r}`:e}function Jd(e,t){let n=`ERR_BAD_RESPONSE`;if(!e||typeof e!=`object`)return{code:n,message:t};let r=e;return r.error?.message?{code:r.error.code??n,data:r.error.data,message:Yd(r.error.message,t)}:r.message?{code:r.code??n,data:r.data,message:Yd(r.message,t)}:r.detail?{code:r.code??n,data:r.data,message:Yd(r.detail,t)}:{code:r.code??n,data:r.data,message:t}}function Yd(e,t){if(typeof e==`string`)return e||t;try{return JSON.stringify(e)||t}catch{return t}}function Xd(e,t,n,r){let i=Error(e);return i.config=t,i.code=String(n),i.response=r,i.isAxiosError=!0,i}function Zd(e){return qd(e)}function Nxe(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Qd(e,t){let n={...e};for(let r in t){let i=t[r];if(Nxe(i)){let t=e[r];n[r]=Qd(t||{},i)}else n[r]=i}return n}new jxe;var Pxe=new Set([`POST`,`PUT`,`PATCH`,`DELETE`]),Fxe=new Set([`GET`,`HEAD`,`OPTIONS`]);function Ixe(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Lxe(e,t){let{headers:n,data:r}=t.requestData;!n&&!r||e.interceptors.request.use(e=>{let t=e,i=(e.method??`GET`).toUpperCase();if(n){let r=qd(n);if(r&&Object.keys(r).length>0){let n=qd(e.headers)??{};t={...t,headers:{...n,...r}}}}if(r){let n=qd(r);if(n&&Object.keys(n).length>0){if(Pxe.has(i)){let r=qd(e.data);r==null?t={...t,data:n}:Ixe(r)?t={...t,data:{...n,...r}}:console.warn(`[chat-helper] requestData.data 无法注入:当前请求体不是普通对象(FormData/Blob/string 等),已跳过合并。`,{method:i,existingType:typeof r})}else if(Fxe.has(i)){let r=e.params??{};t={...t,params:{...n,...r}}}}}return t})}var Rxe=e=>{let t=new jxe({baseURL:e.requestData.urlPrefix});return Lxe(t,e),e.interceptors?.request&&t.interceptors.request.use(e.interceptors.request),e.interceptors?.response&&t.interceptors.response.use(e.interceptors.response),{fetchClient:t,reset:e=>{t.defaults.baseURL=e.requestData.urlPrefix,t.interceptors.request.clear(),t.interceptors.response.clear(),Lxe(t,e),e.interceptors?.request&&t.interceptors.request.use(e.interceptors.request),e.interceptors?.response&&t.interceptors.response.use(e.interceptors.response)}}},zxe=e=>({conversationSettings:{openingRemark:e?.conversation_settings?.opening_remark,predefinedQuestions:e?.conversation_settings?.predefined_questions,commands:e?.conversation_settings?.commands?.map(e=>({id:e.id,name:e.name,alias:e.alias,icon:e.icon,components:e.components.map(e=>({type:e.type,name:e.name,key:e.key,placeholder:e.placeholder,default:e.default,required:e.required,fillBack:e.fill_back,fillRegx:e.fill_regx,rows:e.rows,min:e.min,max:e.max,options:e.options})),content:e.content,agentId:e.agent_id,status:e.status,supportUpload:e.support_upload})),enableChatSession:e?.conversation_settings?.enable_chat_session},promptSetting:e?.prompt_setting?{content:e.prompt_setting.content,supportUpload:e.prompt_setting.support_upload}:void 0,agentName:e?.agent_name,relatedSkills:e?.related_skills?.map(e=>({id:e.id,skill_name:e.skill_name,skill_code:e.skill_code,description:e.description,icon:e.icon})),chatGroup:e?.chat_group?{enabled:e.chat_group.enabled,staff:e.chat_group.staff,username:e.chat_group.username}:void 0,saasUrl:e?.saas_url,resources:e?.resources}),Bxe=e=>({id:e.id??0,llm_code:e.llm_code,llm_name:e.llm_name,llm_type:e.llm_type??`chat.completion`,icon:e.icon??``,description:e.description??``,base_model:e.base_model,max_token_size:e.max_token_size??0,property:e.property??{},space_auth_mode:e.space_auth_mode??``,user_auth_mode:e.user_auth_mode??``,tag_names:e.tag_names}),Vxe=e=>Array.isArray(e)?e.map(Bxe):[],Hxe=e=>({getAgentInfo:t=>e.get(`agent/info/`,void 0,t).then(zxe),getLlms:(t,n)=>{let r={llm_type:t?.llm_type??`chat.completion`};return t?.fuzzy&&(r.fuzzy=t.fuzzy),t?.supports&&(r.supports=t.supports),e.get(`llms/`,r,n).then(Vxe)}}),$d=e=>{let t={id:e.id,messageId:e.message_id,name:e.name,role:e.role,sessionCode:e.session_code,status:e.status};switch(e.role){case Ld.Activity:{let n=e,r=e=>e.map(e=>({name:e.name,originFileUrl:e.origin_file_url,url:e.url})),i;switch(n.activity_type){case Id.ReferenceDocument:i=r(n.content);break;case Id.KnowledgeRag:{let e=n.content;i={content:e.content,referenceDocument:r(e.reference_document)};break}case Id.FlowAgent:case Id.ArtifactsGenerated:default:i=n.content;break}return{...t,activityType:n.activity_type,content:i,property:n.property,role:n.role}}case Ld.Assistant:{let n=e;return{...t,content:n.content,property:n.property,role:n.role,toolCalls:n.tool_calls?.map(e=>({function:{arguments:e.function.arguments,name:e.function.name,description:e.function.description,mcpName:e.function.mcp_name},id:e.id,type:e.type}))}}case Ld.Developer:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Guide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Hidden:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenAssistant:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenGuide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenSystem:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenUser:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Info:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Pause:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Placeholder:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Reasoning:{let n=e;return{...t,content:n.content,duration:n.duration,role:n.role}}case Ld.System:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateAssistant:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateGuide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateHidden:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateSystem:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateUser:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Tool:{let n=e;return{...t,content:n.content,duration:n.duration,error:n.error,role:n.role,toolCallId:n.tool_call_id}}case Ld.User:{let n=e,r=n.content;return{...t,content:Array.isArray(r)?r.map(e=>{if(e.type===zd.Binary){let t=e;return{data:t.data,filename:t.filename,id:t.id,mimeType:t.mime_type,type:t.type,url:t.url}}return e}):r,property:n.property,role:n.role}}case Ld.Interrupt:return{...t,...e}}},Uxe=e=>{let t={id:e.id,message_id:e.messageId,name:e.name,role:e.role,session_code:e.sessionCode,status:e.status};switch(e.role){case Ld.Activity:{let n=e,r=e=>e.map(e=>({name:e.name,origin_file_url:e.originFileUrl,url:e.url})),i;switch(n.activityType){case Id.ReferenceDocument:i=r(n.content);break;case Id.KnowledgeRag:{let e=n.content;i={content:e.content,reference_document:r(e.referenceDocument)};break}case Id.FlowAgent:case Id.ArtifactsGenerated:default:i=n.content;break}return{...t,activity_type:n.activityType,content:i,property:n.property,role:n.role}}case Ld.Assistant:{let n=e;return{...t,property:n.property,content:n.content,role:n.role,tool_calls:n.toolCalls?.map(e=>({function:{arguments:e.function.arguments,name:e.function.name,description:e.function.description,mcp_name:e.function.mcpName},id:e.id,type:e.type}))}}case Ld.Developer:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Guide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Hidden:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenAssistant:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenGuide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenSystem:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.HiddenUser:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Info:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Pause:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Placeholder:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Reasoning:{let n=e;return{...t,content:n.content,duration:n.duration,role:n.role}}case Ld.System:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateAssistant:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateGuide:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateHidden:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateSystem:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.TemplateUser:{let n=e;return{...t,content:n.content,role:n.role}}case Ld.Tool:{let n=e;return{...t,content:n.content,duration:n.duration,error:n.error,role:n.role,tool_call_id:n.toolCallId}}case Ld.User:{let n=e,r=n.content;return{...t,content:Array.isArray(r)?r.map(e=>{if(e.type===zd.Binary){let t=e;return{data:t.data,filename:t.filename,id:t.id,mime_type:t.mimeType,type:t.type,url:t.url}}return e}):r,property:n.property,role:n.role}}case Ld.Interrupt:return{...t,...e}}},Wxe=e=>({getMessages:(t,n,r)=>e.get(`session_content/content/`,{session_code:t,limit:n},r).then(e=>e.map($d)),plusMessage:(t,n)=>e.post(`session_content/`,Uxe(t),n).then($d),modifyMessage:(t,n)=>e.put(`session_content/${t.id}/`,Uxe(t),n).then($d),deleteMessage:(t,n)=>e.delete(`session_content/${t}/`,void 0,n),batchDeleteMessages:(t,n)=>e.post(`session_content/batch_delete/`,{ids:t},n),shareMessages:(t,n,r,i)=>e.post(`share/`,{session_code:t,content_ids:n,...r?{expired_at:r}:{}},i),stopChat:(t,n)=>e.post(`session_content/stop/`,{session_code:t},n),getFlowAgentTaskInfo:(t,n)=>e.get(`flow_agent/${t}/task_info/`,void 0,n),getFlowAgentTaskNodeInfo:(t,n,r)=>e.get(`flow_agent/${t}/task_node_info/${n}/`,void 0,r),retryFlowAgentTaskNode:(t,n,r,i)=>e.post(`flow_agent/${t}/node/${n}/retry/`,{task_id:r},i),skipFlowAgentTaskNode:(t,n,r,i)=>e.post(`flow_agent/${t}/node/${n}/skip/`,{task_id:r},i),userOperation:(t,n,r,i)=>e.post(`user_operation/`,{session_code:t,operation:n,payload:r},i)}),ef=e=>({sessionCode:e.session_code,sessionContentCount:e.session_content_count,sessionName:e.session_name,isTemporary:e.is_temporary,model:e.model,comment:e.comment,rate:e.rate,updatedAt:e.updated_at,createdAt:e.created_at,status:e.status,roleInfo:e.role_info?{collectionId:e.role_info.collection_id,collectionName:e.role_info.collection_name,content:e.role_info.content,variables:e.role_info.variables}:void 0,sessionProperty:{isAutoClear:e.session_property?.is_auto_clear,isAutoCalcPrompt:e.session_property?.is_auto_clac_prompt,labels:e.session_property?.labels}}),Gxe=e=>({session_code:e.sessionCode,session_content_count:e.sessionContentCount,session_name:e.sessionName,is_temporary:e.isTemporary,model:e.model,comment:e.comment,rate:e.rate,updated_at:e.updatedAt,created_at:e.createdAt,status:e.status,role_info:e.roleInfo?{collection_id:e.roleInfo.collectionId,collection_name:e.roleInfo.collectionName,content:e.roleInfo.content,variables:e.roleInfo.variables}:void 0,session_property:{is_auto_clear:e.sessionProperty?.isAutoClear,is_auto_clac_prompt:e.sessionProperty?.isAutoCalcPrompt,labels:e.sessionProperty?.labels}}),Kxe=e=>({session_code:e.sessionCode,session_content_ids:e.sessionContentIds,rate:e.rate,comment:e.comment,labels:e.labels}),qxe=e=>({sessionCode:e.session_code,sessionContentIds:e.session_content_ids,rate:e.rate,comment:e.comment,labels:e.lables}),Jxe=`upload_file`,Yxe=20,Xxe=600,Zxe=2e4,Qxe=e=>{if(Array.isArray(e))return{page:1,numPages:1,count:e.length,results:e.map(ef)};let t=Array.isArray(e?.results)?e.results:[];return{page:e?.page??1,numPages:e?.num_pages??1,count:e?.count??t.length,results:t.map(ef)}},$xe=e=>{let t=e.split(`.`).pop();if(!t||t===e)return``;let n=t.replace(/[^A-Za-z0-9]/g,``).slice(0,20).toLowerCase();return n?`.${n}`:``},eSe=e=>`${Jxe}_${`${Date.now()}_${Math.random().toString(36).slice(2,8)}`}${$xe(e.name)}`,tSe=e=>`attachment; filename="${e}"`,nSe=e=>({clearSession:(t,n)=>e.post(`chat_completion/${t}/clear/`,void 0,n),getSessions:(t,n)=>e.get(`session/`,{page:t?.page??1,page_size:t?.page_size??Yxe},n).then(Qxe),plusSession:(t,n)=>e.post(`session/`,Gxe(t),n).then(e=>ef(e)),modifySession:(t,n)=>e.put(`session/${t.sessionCode}/`,Gxe(t),n).then(e=>ef(e)),deleteSession:(t,n)=>e.delete(`session/${t}/`,void 0,n),batchDeleteSessions:(t,n)=>e.post(`session/batch_delete/`,{session_codes:t},n),getSession:(t,n)=>e.get(`session/${t}/`,void 0,n).then(e=>ef(e)),postSessionFeedback:(t,n)=>e.post(`session_feedback/`,Kxe(t),n).then(e=>qxe(e)),getSessionFeedbackReasons:(t,n)=>e.get(`session_feedback/reasons/`,{rate:t},n),renameSession:(t,n)=>e.post(`session/${t}/ai_rename/`,void 0,n).then(e=>ef(e)),uploadFile:(t,n,r)=>{let i=eSe(n),a=encodeURIComponent(i),o=qd(r?.headers)??{};return n.arrayBuffer().then(n=>e.post(`session/${t}/upload/${a}/`,n,{...r,headers:{...o,"Content-Disposition":tSe(i)}}))},getPvFileDownloadUrl:(t,n,r,i)=>{let a=r?.expiresIn??Xxe,o=r?.timeout??Zxe;return e.get(`session/${t}/pv_files/download_url/`,{expires_in:a,path:n},{...i,timeout:i?.timeout??o})},isResumeSession:(t,n)=>e.get(`session/${t}/is_resume/`,void 0,n)}),rSe=e=>({agent:Hxe(e),session:nSe(e),message:Wxe(e),fetchClient:e}),iSe=e=>{let{fetchClient:t,reset:n}=Rxe(e);return{...rSe(t),reset:n,onError:t.onError.bind(t)}},aSe=()=>({agent:null,http:null,message:null,session:null,registerAgent(e){this.agent=e},registerHttp(e){this.http=e},registerMessage(e){this.message=e},registerSession(e){this.session=e}}),oSe=20,sSe=e=>{let t=sn([]),n=sn(null),r=sn(0),i=sn(0),a=sn(0),o=sn(!1),s=sn(!1),l=sn(!1),u=sn(!1),d=sn(!1),f=sn(!1),p=sn(!1),m=sn(!1),h=pi(()=>r.value>0&&r.value<i.value),g=e=>{t.value=t.value.map(t=>t.sessionCode===e.sessionCode?{...t,...e}:t),n.value?.sessionCode===e.sessionCode&&(n.value=t.value.find(t=>t.sessionCode===e.sessionCode)??{...n.value,...e})},_=n=>{s.value=!0;let o={page:n?.page??1,page_size:n?.page_size??oSe};return e.http?.session.getSessions(o).then(e=>{t.value=e.results,r.value=e.page,i.value=e.numPages,a.value=e.count}).finally(()=>{s.value=!1})},v=async(n=oSe)=>{if(!(!h.value||s.value||l.value)){l.value=!0;try{let o=await e.http?.session.getSessions({page:r.value+1,page_size:n});if(!o)return;let s=new Set(t.value.map(e=>e.sessionCode)),l=o.results.filter(e=>!s.has(e.sessionCode));t.value=[...t.value,...l],r.value=o.page,i.value=o.numPages,a.value=o.count}finally{l.value=!1}}},y=async(r,i)=>{e.agent?.abortChat();let a=i?.loadMessages!==!1,o=t.value.find(e=>e.sessionCode===r);!a&&o?n.value=o:await b(r),a?(await e.message?.getMessages(r),e.agent?.resumeStreamingChat(r),e.agent?.pollResumeSession(r)):e.message&&(e.message.list.value=[])},b=t=>(o.value=!0,e.http?.session.getSession(t).then(e=>{n.value=e}).finally(()=>{o.value=!1}));return{list:t,current:n,page:r,numPages:i,count:a,hasMore:h,isCurrentLoading:o,isListLoading:s,isLoadingMore:l,isCreateLoading:u,isUpdateLoading:d,isDeleteLoading:f,isBatchDeleteLoading:p,getSessions:_,loadMoreSessions:v,chooseSession:y,getSession:b,createSession:async(n,r)=>{u.value=!0;try{let i=await e.http?.session.plusSession(n);i&&(t.value.unshift(i),a.value+=1,await y(i.sessionCode,{loadMessages:r?.loadMessages??!1}))}finally{u.value=!1}},updateSession:t=>(d.value=!0,e.http?.session.modifySession(t).then(e=>{g(e)}).finally(()=>{d.value=!1})),deleteSession:async r=>{f.value=!0;try{await e.http?.session.deleteSession(r),t.value=t.value.filter(e=>e.sessionCode!==r),a.value=Math.max(0,a.value-1),n.value?.sessionCode===r&&t.value[0]?.sessionCode&&await y(t.value[0].sessionCode)}finally{f.value=!1}},batchDeleteSessions:async r=>{if(r.length!==0){p.value=!0;try{await e.http?.session.batchDeleteSessions(r);let i=new Set(r),o=t.value.length;t.value=t.value.filter(e=>!i.has(e.sessionCode));let s=o-t.value.length;a.value=Math.max(0,a.value-s),n.value&&i.has(n.value.sessionCode)&&(t.value.length>0?await y(t.value[0].sessionCode):(n.value=null,e.message&&(e.message.list.value=[])))}finally{p.value=!1}}},postSessionFeedback:t=>e.http?.session.postSessionFeedback(t),getSessionFeedbackReasons:t=>e.http?.session.getSessionFeedbackReasons(t),renameSession:t=>(m.value=!0,e.http?.session.renameSession(t).then(e=>(g({sessionCode:e.sessionCode,sessionName:e.sessionName}),e)).finally(()=>{m.value=!1})),uploadFile:(t,n)=>e.http?.session.uploadFile(t,n),getPvFileDownloadUrl:(t,n,r)=>e.http?.session.getPvFileDownloadUrl(t,n,r),reset:()=>{t.value=[],n.value=null,r.value=0,i.value=0,a.value=0,o.value=!1,s.value=!1,l.value=!1,u.value=!1,d.value=!1,f.value=!1,p.value=!1,m.value=!1}}},cSe=e=>{let t=aSe(),n=iSe(e),r=Oxe(t,e.protocol),i=bxe(t),a=sSe(t);return t.registerHttp(n),t.registerMessage(i),t.registerAgent(r),t.registerSession(a),{agent:r,session:a,message:i,http:n,reset:e=>{n.reset(e),r.reset(e.protocol),i.reset(),a.reset()},onError:n.onError}},lSe=new Set([`context_type`,`__label`,`__key`,`__value`]);function uSe(e,t){return{urlPrefix:e,headers:()=>qd(un(t)?.headers),data:()=>qd(un(t)?.data)}}function dSe(e){return e?Array.isArray(e)?e.map(e=>{if(e.__key)return e;let t=Object.entries(e).filter(([e])=>!lSe.has(e));if(t.length===0)return e;let[n,r]=t[0];return{...e,[n]:r,context_type:e.context_type??`input`,__label:e.__label??n,__key:e.__key??n,__value:e.__value??r}}):Object.entries(e).map(([e,t])=>({[e]:t,context_type:`input`,__label:e,__key:e,__value:t})):[]}function fSe(e,t){if(!t)return e;let n=t()?.context;if(!n)return e;let r=dSe(n);return r.length===0?e:pSe(e,r)}function pSe(e,t){if(t.length===0)return e??{};let n=e??{},r=n.extra??{},i=r.context??[],a=new Set(t.map(e=>e.__key).filter(Boolean)),o=i.filter(e=>{let t=e.__key;return!t||!a.has(t)});return{...n,extra:{...r,context:[...o,...t]}}}function mSe(e){return e.some(e=>{if(!(`property`in e))return!0;let{property:t}=e;return!t?.extra?.pause})}function hSe(e,t){let n=null;for(let r of e)if(r.role===`user`&&r.id!==void 0&&(n=r),r===t)break;return n}function gSe(e,t){let n=hSe(e,t);if(n?.id!==void 0)return typeof n.id==`number`?n.id:Number(n.id)}var _Se=e=>{if(e instanceof Error)return e;if(typeof e==`string`)return Error(e);if(e&&typeof e==`object`){let{message:t}=e;if(typeof t==`string`&&t)return Error(t);try{return Error(JSON.stringify(e)??String(e))}catch{return Error(String(e))}}return Error(String(e))},vSe=e=>{let t=document.cookie.match(RegExp(`(^| )${e}=([^;]*)(;|$)`));return t?t[2]:``},ySe=e=>e.endsWith(`/`)?e:`${e}/`,bSe=e=>{if(!e)return e;try{let t=new URL(e,window.location.origin);return t.protocol=window.location.protocol,ySe(t.toString())}catch(t){return console.warn(`Failed to normalize URL:`,t),ySe(e)}};async function xSe(e){if(typeof navigator<`u`&&`clipboard`in navigator)try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,t.style.top=`-9999px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand(`copy`)}catch{return!1}finally{document.body.removeChild(t)}}function SSe(){let e=window.navigator.userAgent.toLowerCase(),t=window.navigator.platform.toLowerCase();return t.includes(`mac`)||e.includes(`mac`)?`mac`:t.includes(`win`)||e.includes(`win`)?`windows`:t.includes(`linux`)||e.includes(`linux`)?`linux`:`unknown`}function CSe(){return wSe()?`Cmd + I`:`Ctrl + I`}function wSe(){return SSe()===`mac`}function TSe(e){let t=wSe()?e.metaKey:e.ctrlKey,n=e.key.toLowerCase()===`i`;return t&&n&&!e.shiftKey&&!e.altKey}var ESe=vSe(`blueking_language`)||`zh-cn`,DSe={小鲸:`BK GPT`,关闭:`close`,发送:`Send`,请输入:`Please input`,昨天:`yesterday`,"3天前":`3 days ago`,"5天前":`5 days ago`,"1周前":`1 week ago`,更早:`Older`,删除:`Delete`,恢复默认大小:`Restore default size`,"AI 小鲸":`AI BK GPT`,新增会话:`New chat`,历史会话:`History session`,停止生成:`Stop generating`,复制:`Copy`,编辑:`Edit`,今天:`Today`,搜索会话名称:`Search session name`,重命名:`Rename`,自动生成命名:`Auto generate name`,分享会话:`Share session`,无智能体使用权限:`No permission to use this agent`,暂无使用权限:`No permission`,请输入新的会话名称:`Please enter new session name`,"确认删除会话 ?":`Confirm delete session?`,搜索为空:`No search results`,暂无对话:`No conversations`,"加载中...":`Loading...`,转人工:`Transfer to human`,缩小高度:`Shrink height`,全选:`Select all`,取消:`Cancel`,确定:`Confirm`,分享链接已复制到剪贴板:`Share link copied to clipboard`,请求失败:`Request failed`,当前已是新会话:`Already in a new session`,"正在创建会话...":`Creating session...`},OSe={重命名:`重命名`,自动生成命名:`自动生成命名`,分享会话:`分享会话`,全选:`全选`,取消:`取消`,确定:`确定`,分享链接已复制到剪贴板:`分享链接已复制到剪贴板`,请求失败:`请求失败`},tf=e=>ESe===`en`?DSe[e]||e:OSe[e]||e,kSe={class:`history-item-actions`},ASe=Ii($n({__name:`history-item`,props:{isActive:{type:Boolean},isEditing:{type:Boolean},session:{}},emits:[`click`,`delete`,`edit`,`rename-cancel`,`rename-confirm`],setup(e,{emit:t}){let n=e,r=t,i=vxe,a=sn(null),o=sn(``);Rn(()=>n.isEditing,e=>{e&&(o.value=n.session.sessionName,Dn(()=>{if(a.value)try{let e=a.value;e&&typeof e.focus==`function`&&e.focus();let t=e.$el?.querySelector(`input`);t&&typeof t.select==`function`&&t.select()}catch(e){console.warn(`Failed to focus edit input:`,e)}}))});let s=()=>{n.isEditing||r(`click`,n.session)},l=()=>{r(`edit`,n.session)},u=()=>{r(`delete`,n.session.sessionCode)},d=()=>{let e=o.value.trim();e&&e!==n.session.sessionName?r(`rename-confirm`,n.session.sessionCode,e):r(`rename-cancel`)},f=()=>{r(`rename-cancel`)},p=(e,t)=>{t.key===`Enter`?d():t.key===`Escape`&&f()};return(e,t)=>(B(),V(`div`,{class:xe([`history-item`,{active:n.isActive}]),onClick:s},[n.isEditing?(B(),Kr(z(fu),{key:1,ref_key:`editInputRef`,ref:a,modelValue:o.value,"onUpdate:modelValue":t[1]||=e=>o.value=e,style:{width:`100%`,height:`28px`},onBlur:d,onKeyup:p,onClick:t[2]||=Ni(()=>{},[`stop`])},null,8,[`modelValue`])):(B(),V(Rr,{key:0},[Xr(z(s_e),{style:{width:`calc(100% - 42px)`}},{default:Mn(()=>[$r(ke(n.session.sessionName),1)]),_:1}),H(`span`,kSe,[Nn(H(`i`,{class:`bkai-icon bkai-bianji`,onClick:Ni(l,[`stop`])},null,512),[[z(i),{content:z(tf)(`编辑`),boundary:`parent`}]]),Xr(z(Ebe),{title:z(tf)(`确认删除会话 ?`),content:`删除操作无法撤回,请谨慎操作!`,"confirm-config":{theme:`danger`},trigger:`click`,boundary:`parent`,onConfirm:u},{default:Mn(()=>[Nn(H(`i`,{class:`bkai-icon bkai-shanchu`,onClick:t[0]||=Ni(()=>{},[`stop`])},null,512),[[z(i),{content:z(tf)(`删除`),boundary:`parent`}]])]),_:1},8,[`title`])])],64))],2))}}),[[`__scopeId`,`data-v-fea14d3a`]]),jSe={class:`history-search`},MSe={class:`input-icon`},NSe=Ii($n({__name:`history-search`,props:{modelValue:{default:``},placeholder:{default:``}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=e=>{r(`update:modelValue`,e)};return(e,t)=>(B(),V(`div`,jSe,[Xr(z(fu),{"model-value":n.modelValue,behavior:`simplicity`,placeholder:n.placeholder||z(tf)(`搜索会话名称`),style:{height:`22px`},"onUpdate:modelValue":i},{suffix:Mn(()=>[H(`span`,MSe,[Xr(z(ol))])]),_:1},8,[`model-value`,`placeholder`])]))}}),[[`__scopeId`,`data-v-e7ff40b2`]]),PSe={class:`history-dropdown-header`},FSe={class:`history-dropdown-header-title`},ISe={class:`history-dropdown-content`},LSe={key:0,class:`history-dropdown-loading`},RSe={class:`history-dropdown-loading-dots`},zSe=40,BSe=Ii($n({__name:`index`,props:{sessionBusinessManager:{}},emits:[`close`,`session-delete`,`session-rename`,`session-switch`],setup(e,{emit:t}){let n=e,r=t,i=sn(``),a=sn(null),o=pi(()=>n.sessionBusinessManager.currentSession.value?.sessionCode),s=pi(()=>n.sessionBusinessManager.isLoadingMore.value),l=e=>{let t=e.target;t.scrollHeight-t.scrollTop-t.clientHeight>zSe||n.sessionBusinessManager.hasMoreSessions.value&&(n.sessionBusinessManager.isLoadingMore.value||n.sessionBusinessManager.loadMoreSessions())},u=pi(()=>{let e={today:{key:`today`,alias:tf(`今天`),sessionList:[]},yesterday:{key:`yesterday`,alias:tf(`昨天`),sessionList:[]},"3days":{key:`3days`,alias:tf(`3天前`),sessionList:[]},"5days":{key:`5days`,alias:tf(`5天前`),sessionList:[]},"1week":{key:`1week`,alias:tf(`1周前`),sessionList:[]},before:{key:`before`,alias:tf(`更早`),sessionList:[]}},t=n.sessionBusinessManager.sessionList.value.filter(e=>e.sessionName.toLowerCase().includes(i.value.toLowerCase())),r=new Date,a=new Date(r);a.setDate(a.getDate()-1);let o=new Date(r);o.setDate(r.getDate()-3);let s=new Date(r);s.setDate(r.getDate()-5);let l=new Date(r);l.setDate(r.getDate()-7);for(let n of t){let t=new Date(n.createdAt||``),i=t.toDateString();i===r.toDateString()?e.today.sessionList.push(n):i===a.toDateString()?e.yesterday.sessionList.push(n):t>=o&&t>s?e[`3days`].sessionList.push(n):t>=s&&t>l?e[`5days`].sessionList.push(n):t>=l?e[`1week`].sessionList.push(n):e.before.sessionList.push(n)}for(let t of Object.values(e))t.sessionList.sort((e,t)=>{let n=new Date(e.createdAt||0).getTime();return new Date(t.createdAt||0).getTime()-n});return Object.values(e).filter(e=>e.sessionList.length>0)}),d=e=>o.value===e,f=e=>{d(e.sessionCode)||(r(`session-switch`,e.sessionCode),r(`close`))},p=e=>{a.value=e.sessionCode},m=e=>{r(`session-delete`,e)},h=(e,t)=>{let i=n.sessionBusinessManager.sessionList.value.find(t=>t.sessionCode===e);i&&(i.sessionName=t),a.value=null,r(`session-rename`,e,t)},g=()=>{a.value=null};return(e,t)=>(B(),V(`div`,{class:`bkai-history-dropdown`,onScroll:l},[H(`div`,PSe,[H(`h1`,FSe,ke(z(tf)(`历史会话`)),1),Xr(NSe,{modelValue:i.value,"onUpdate:modelValue":t[0]||=e=>i.value=e,placeholder:z(tf)(`搜索会话名称`)},null,8,[`modelValue`,`placeholder`])]),H(`div`,ISe,[u.value.length>0?(B(),V(Rr,{key:0},[(B(!0),V(Rr,null,fr(u.value,e=>(B(),Kr(Nre,{key:e.key,"current-session-code":o.value,sessions:e.sessionList,title:e.alias},{default:Mn(()=>[(B(!0),V(Rr,null,fr(e.sessionList,e=>(B(),Kr(ASe,{key:e.sessionCode,"is-active":d(e.sessionCode),"is-editing":a.value===e.sessionCode,session:e,onClick:f,onDelete:m,onEdit:p,onRenameCancel:g,onRenameConfirm:h},null,8,[`is-active`,`is-editing`,`session`]))),128))]),_:2},1032,[`current-session-code`,`sessions`,`title`]))),128)),s.value?(B(),V(`div`,LSe,[H(`span`,RSe,[(B(),V(Rr,null,fr(3,e=>H(`i`,{key:e,class:`history-dropdown-loading-dot`,style:ge({"--dot-index":e-1})},null,4)),64))])])):ei(`v-if`,!0)],64)):(B(),Kr(z(rd),{key:1,description:i.value?z(tf)(`搜索为空`):z(tf)(`暂无对话`),scene:`part`,style:{"margin-top":`100px`},type:i.value?`search-empty`:`empty`},null,8,[`description`,`type`]))])],32))}}),[[`__scopeId`,`data-v-bf2401b6`]]),VSe=`tippy-box`,HSe=`tippy-content`,USe=`tippy-backdrop`,WSe=`tippy-arrow`,GSe=`tippy-svg-arrow`,nf={passive:!0,capture:!0},KSe=function(){return document.body};function qSe(e,t,n){return Array.isArray(e)?e[t]??(Array.isArray(n)?n[t]:n):e}function JSe(e,t){var n={}.toString.call(e);return n.indexOf(`[object`)===0&&n.indexOf(t+`]`)>-1}function YSe(e,t){return typeof e==`function`?e.apply(void 0,t):e}function XSe(e,t){if(t===0)return e;var n;return function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}}function ZSe(e){return e.split(/\s+/).filter(Boolean)}function rf(e){return[].concat(e)}function QSe(e,t){e.indexOf(t)===-1&&e.push(t)}function $Se(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function eCe(e){return e.split(`-`)[0]}function af(e){return[].slice.call(e)}function tCe(e){return Object.keys(e).reduce(function(t,n){return e[n]!==void 0&&(t[n]=e[n]),t},{})}function of(){return document.createElement(`div`)}function sf(e){return[`Element`,`Fragment`].some(function(t){return JSe(e,t)})}function nCe(e){return JSe(e,`NodeList`)}function rCe(e){return JSe(e,`MouseEvent`)}function iCe(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function aCe(e){return sf(e)?[e]:nCe(e)?af(e):Array.isArray(e)?e:af(document.querySelectorAll(e))}function cf(e,t){e.forEach(function(e){e&&(e.style.transitionDuration=t+`ms`)})}function oCe(e,t){e.forEach(function(e){e&&e.setAttribute(`data-state`,t)})}function sCe(e){var t,n=rf(e)[0];return n!=null&&(t=n.ownerDocument)!=null&&t.body?n.ownerDocument:document}function cCe(e,t){var n=t.clientX,r=t.clientY;return e.every(function(e){var t=e.popperRect,i=e.popperState,a=e.props.interactiveBorder,o=eCe(i.placement),s=i.modifiersData.offset;if(!s)return!0;var l=o===`bottom`?s.top.y:0,u=o===`top`?s.bottom.y:0,d=o===`right`?s.left.x:0,f=o===`left`?s.right.x:0,p=t.top-r+l>a,m=r-t.bottom-u>a,h=t.left-n+d>a,g=n-t.right-f>a;return p||m||h||g})}function lf(e,t,n){var r=t+`EventListener`;[`transitionend`,`webkitTransitionEnd`].forEach(function(t){e[r](t,n)})}function lCe(e,t){for(var n=t;n;){if(e.contains(n))return!0;n=n.getRootNode==null?void 0:n.getRootNode()?.host}return!1}var uf={isTouch:!1},uCe=0;function dCe(){uf.isTouch||(uf.isTouch=!0,window.performance&&document.addEventListener(`mousemove`,fCe))}function fCe(){var e=performance.now();e-uCe<20&&(uf.isTouch=!1,document.removeEventListener(`mousemove`,fCe)),uCe=e}function pCe(){var e=document.activeElement;if(iCe(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function mCe(){document.addEventListener(`touchstart`,dCe,nf),window.addEventListener(`blur`,pCe)}var hCe=typeof window<`u`&&typeof document<`u`?!!window.msCrypto:!1,df=Object.assign({appendTo:KSe,aria:{content:`auto`,expanded:`auto`},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:``,offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:`top`,plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:`mouseenter focus`,triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:`fade`,arrow:!0,content:``,inertia:!1,maxWidth:350,role:`tooltip`,theme:``,zIndex:9999}),gCe=Object.keys(df),_Ce=function(e){Object.keys(e).forEach(function(t){df[t]=e[t]})};function vCe(e){var t=(e.plugins||[]).reduce(function(t,n){var r=n.name,i=n.defaultValue;return r&&(t[r]=e[r]===void 0?df[r]??i:e[r]),t},{});return Object.assign({},e,t)}function yCe(e,t){return(t?Object.keys(vCe(Object.assign({},df,{plugins:t}))):gCe).reduce(function(t,n){var r=(e.getAttribute(`data-tippy-`+n)||``).trim();if(!r)return t;if(n===`content`)t[n]=r;else try{t[n]=JSON.parse(r)}catch{t[n]=r}return t},{})}function bCe(e,t){var n=Object.assign({},t,{content:YSe(t.content,[e])},t.ignoreAttributes?{}:yCe(e,t.plugins));return n.aria=Object.assign({},df.aria,n.aria),n.aria={expanded:n.aria.expanded===`auto`?t.interactive:n.aria.expanded,content:n.aria.content===`auto`?t.interactive?null:`describedby`:n.aria.content},n}var xCe=function(){return`innerHTML`};function ff(e,t){e[xCe()]=t}function SCe(e){var t=of();return e===!0?t.className=WSe:(t.className=GSe,sf(e)?t.appendChild(e):ff(t,e)),t}function CCe(e,t){sf(t.content)?(ff(e,``),e.appendChild(t.content)):typeof t.content!=`function`&&(t.allowHTML?ff(e,t.content):e.textContent=t.content)}function pf(e){var t=e.firstElementChild,n=af(t.children);return{box:t,content:n.find(function(e){return e.classList.contains(HSe)}),arrow:n.find(function(e){return e.classList.contains(WSe)||e.classList.contains(GSe)}),backdrop:n.find(function(e){return e.classList.contains(USe)})}}function wCe(e){var t=of(),n=of();n.className=VSe,n.setAttribute(`data-state`,`hidden`),n.setAttribute(`tabindex`,`-1`);var r=of();r.className=HSe,r.setAttribute(`data-state`,`hidden`),CCe(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props);function i(n,r){var i=pf(t),a=i.box,o=i.content,s=i.arrow;r.theme?a.setAttribute(`data-theme`,r.theme):a.removeAttribute(`data-theme`),typeof r.animation==`string`?a.setAttribute(`data-animation`,r.animation):a.removeAttribute(`data-animation`),r.inertia?a.setAttribute(`data-inertia`,``):a.removeAttribute(`data-inertia`),a.style.maxWidth=typeof r.maxWidth==`number`?r.maxWidth+`px`:r.maxWidth,r.role?a.setAttribute(`role`,r.role):a.removeAttribute(`role`),(n.content!==r.content||n.allowHTML!==r.allowHTML)&&CCe(o,e.props),r.arrow?s?n.arrow!==r.arrow&&(a.removeChild(s),a.appendChild(SCe(r.arrow))):a.appendChild(SCe(r.arrow)):s&&a.removeChild(s)}return{popper:t,onUpdate:i}}wCe.$$tippy=!0;var TCe=1,mf=[],hf=[];function ECe(e,t){var n=bCe(e,Object.assign({},df,vCe(tCe(t)))),r,i,a,o=!1,s=!1,l=!1,u=!1,d,f,p,m=[],h=XSe(de,n.interactiveDebounce),g,_=TCe++,v=null,y=$Se(n.plugins),b={id:_,reference:e,popper:of(),popperInstance:v,props:n,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:y,clearDelayTimeouts:Ce,setProps:we,setContent:Te,show:Ee,hide:De,hideWithInteractivity:Oe,enable:xe,disable:Se,unmount:ke,destroy:Ae};if(!n.render)return b;var x=n.render(b),S=x.popper,C=x.onUpdate;S.setAttribute(`data-tippy-root`,``),S.id=`tippy-`+b.id,b.popper=S,e._tippy=b,S._tippy=b;var w=y.map(function(e){return e.fn(b)}),T=e.hasAttribute(`aria-expanded`);return ce(),I(),N(),P(`onCreate`,[b]),n.showOnCreate&&ye(),S.addEventListener(`mouseenter`,function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),S.addEventListener(`mouseleave`,function(){b.props.interactive&&b.props.trigger.indexOf(`mouseenter`)>=0&&A().addEventListener(`mousemove`,h)}),b;function E(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function D(){return E()[0]===`hold`}function O(){var e;return!!((e=b.props.render)!=null&&e.$$tippy)}function k(){return g||e}function A(){var e=k().parentNode;return e?sCe(e):document}function j(){return pf(S)}function M(e){return b.state.isMounted&&!b.state.isVisible||uf.isTouch||d&&d.type===`focus`?0:qSe(b.props.delay,+!e,df.delay)}function N(e){e===void 0&&(e=!1),S.style.pointerEvents=b.props.interactive&&!e?``:`none`,S.style.zIndex=``+b.props.zIndex}function P(e,t,n){if(n===void 0&&(n=!0),w.forEach(function(n){n[e]&&n[e].apply(n,t)}),n){var r;(r=b.props)[e].apply(r,t)}}function F(){var t=b.props.aria;if(t.content){var n=`aria-`+t.content,r=S.id;rf(b.props.triggerTarget||e).forEach(function(e){var t=e.getAttribute(n);if(b.state.isVisible)e.setAttribute(n,t?t+` `+r:r);else{var i=t&&t.replace(r,``).trim();i?e.setAttribute(n,i):e.removeAttribute(n)}})}}function I(){T||!b.props.aria.expanded||rf(b.props.triggerTarget||e).forEach(function(e){b.props.interactive?e.setAttribute(`aria-expanded`,b.state.isVisible&&e===k()?`true`:`false`):e.removeAttribute(`aria-expanded`)})}function L(){A().removeEventListener(`mousemove`,h),mf=mf.filter(function(e){return e!==h})}function R(t){if(!(uf.isTouch&&(l||t.type===`mousedown`))){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!(b.props.interactive&&lCe(S,n))){if(rf(b.props.triggerTarget||e).some(function(e){return lCe(e,n)})){if(uf.isTouch||b.state.isVisible&&b.props.trigger.indexOf(`click`)>=0)return}else P(`onClickOutside`,[b,t]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),s=!0,setTimeout(function(){s=!1}),b.state.isMounted||re())}}}function ee(){l=!0}function te(){l=!1}function ne(){var e=A();e.addEventListener(`mousedown`,R,!0),e.addEventListener(`touchend`,R,nf),e.addEventListener(`touchstart`,te,nf),e.addEventListener(`touchmove`,ee,nf)}function re(){var e=A();e.removeEventListener(`mousedown`,R,!0),e.removeEventListener(`touchend`,R,nf),e.removeEventListener(`touchstart`,te,nf),e.removeEventListener(`touchmove`,ee,nf)}function ie(e,t){oe(e,function(){!b.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&t()})}function ae(e,t){oe(e,t)}function oe(e,t){var n=j().box;function r(e){e.target===n&&(lf(n,`remove`,r),t())}if(e===0)return t();lf(n,`remove`,f),lf(n,`add`,r),f=r}function se(t,n,r){r===void 0&&(r=!1),rf(b.props.triggerTarget||e).forEach(function(e){e.addEventListener(t,n,r),m.push({node:e,eventType:t,handler:n,options:r})})}function ce(){D()&&(se(`touchstart`,ue,{passive:!0}),se(`touchend`,fe,{passive:!0})),ZSe(b.props.trigger).forEach(function(e){if(e!==`manual`)switch(se(e,ue),e){case`mouseenter`:se(`mouseleave`,fe);break;case`focus`:se(hCe?`focusout`:`blur`,pe);break;case`focusin`:se(`focusout`,pe);break}})}function le(){m.forEach(function(e){var t=e.node,n=e.eventType,r=e.handler,i=e.options;t.removeEventListener(n,r,i)}),m=[]}function ue(e){var t=!1;if(!(!b.state.isEnabled||me(e)||s)){var n=d?.type===`focus`;d=e,g=e.currentTarget,I(),!b.state.isVisible&&rCe(e)&&mf.forEach(function(t){return t(e)}),e.type===`click`&&(b.props.trigger.indexOf(`mouseenter`)<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?t=!0:ye(e),e.type===`click`&&(o=!t),t&&!n&&be(e)}}function de(e){var t=e.target,r=k().contains(t)||S.contains(t);e.type===`mousemove`&&r||cCe(ve().concat(S).map(function(e){var t=e._tippy.popperInstance?.state;return t?{popperRect:e.getBoundingClientRect(),popperState:t,props:n}:null}).filter(Boolean),e)&&(L(),be(e))}function fe(e){if(!(me(e)||b.props.trigger.indexOf(`click`)>=0&&o)){if(b.props.interactive){b.hideWithInteractivity(e);return}be(e)}}function pe(e){b.props.trigger.indexOf(`focusin`)<0&&e.target!==k()||b.props.interactive&&e.relatedTarget&&S.contains(e.relatedTarget)||be(e)}function me(e){return uf.isTouch?D()!==e.type.indexOf(`touch`)>=0:!1}function he(){ge();var t=b.props,n=t.popperOptions,r=t.placement,i=t.offset,a=t.getReferenceClientRect,o=t.moveTransition,s=O()?pf(S).arrow:null,l=a?{getBoundingClientRect:a,contextElement:a.contextElement||k()}:e,u=[{name:`offset`,options:{offset:i}},{name:`preventOverflow`,options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:`flip`,options:{padding:5}},{name:`computeStyles`,options:{adaptive:!o}},{name:`$$tippy`,enabled:!0,phase:`beforeWrite`,requires:[`computeStyles`],fn:function(e){var t=e.state;if(O()){var n=j().box;[`placement`,`reference-hidden`,`escaped`].forEach(function(e){e===`placement`?n.setAttribute(`data-placement`,t.placement):t.attributes.popper[`data-popper-`+e]?n.setAttribute(`data-`+e,``):n.removeAttribute(`data-`+e)}),t.attributes.popper={}}}}];O()&&s&&u.push({name:`arrow`,options:{element:s,padding:3}}),u.push.apply(u,n?.modifiers||[]),b.popperInstance=ha(l,S,Object.assign({},n,{placement:r,onFirstUpdate:p,modifiers:u}))}function ge(){b.popperInstance&&=(b.popperInstance.destroy(),null)}function _e(){var e=b.props.appendTo,t,n=k();t=b.props.interactive&&e===KSe||e===`parent`?n.parentNode:YSe(e,[n]),t.contains(S)||t.appendChild(S),b.state.isMounted=!0,he()}function ve(){return af(S.querySelectorAll(`[data-tippy-root]`))}function ye(e){b.clearDelayTimeouts(),e&&P(`onTrigger`,[b,e]),ne();var t=M(!0),n=E(),i=n[0],a=n[1];uf.isTouch&&i===`hold`&&a&&(t=a),t?r=setTimeout(function(){b.show()},t):b.show()}function be(e){if(b.clearDelayTimeouts(),P(`onUntrigger`,[b,e]),!b.state.isVisible){re();return}if(!(b.props.trigger.indexOf(`mouseenter`)>=0&&b.props.trigger.indexOf(`click`)>=0&&[`mouseleave`,`mousemove`].indexOf(e.type)>=0&&o)){var t=M(!1);t?i=setTimeout(function(){b.state.isVisible&&b.hide()},t):a=requestAnimationFrame(function(){b.hide()})}}function xe(){b.state.isEnabled=!0}function Se(){b.hide(),b.state.isEnabled=!1}function Ce(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(a)}function we(t){if(!b.state.isDestroyed){P(`onBeforeUpdate`,[b,t]),le();var n=b.props,r=bCe(e,Object.assign({},n,tCe(t),{ignoreAttributes:!0}));b.props=r,ce(),n.interactiveDebounce!==r.interactiveDebounce&&(L(),h=XSe(de,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?rf(n.triggerTarget).forEach(function(e){e.removeAttribute(`aria-expanded`)}):r.triggerTarget&&e.removeAttribute(`aria-expanded`),I(),N(),C&&C(n,r),b.popperInstance&&(he(),ve().forEach(function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})),P(`onAfterUpdate`,[b,t])}}function Te(e){b.setProps({content:e})}function Ee(){var e=b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=uf.isTouch&&!b.props.touch,i=qSe(b.props.duration,0,df.duration);if(!(e||t||n||r)&&!k().hasAttribute(`disabled`)&&(P(`onShow`,[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,O()&&(S.style.visibility=`visible`),N(),ne(),b.state.isMounted||(S.style.transition=`none`),O()){var a=j(),o=a.box,s=a.content;cf([o,s],0)}p=function(){var e;if(!(!b.state.isVisible||u)){if(u=!0,S.offsetHeight,S.style.transition=b.props.moveTransition,O()&&b.props.animation){var t=j(),n=t.box,r=t.content;cf([n,r],i),oCe([n,r],`visible`)}F(),I(),QSe(hf,b),(e=b.popperInstance)==null||e.forceUpdate(),P(`onMount`,[b]),b.props.animation&&O()&&ae(i,function(){b.state.isShown=!0,P(`onShown`,[b])})}},_e()}}function De(){var e=!b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=qSe(b.props.duration,1,df.duration);if(!(e||t||n)&&(P(`onHide`,[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,u=!1,o=!1,O()&&(S.style.visibility=`hidden`),L(),re(),N(!0),O()){var i=j(),a=i.box,s=i.content;b.props.animation&&(cf([a,s],r),oCe([a,s],`hidden`))}F(),I(),b.props.animation?O()&&ie(r,b.unmount):b.unmount()}}function Oe(e){A().addEventListener(`mousemove`,h),QSe(mf,h),h(e)}function ke(){b.state.isVisible&&b.hide(),b.state.isMounted&&(ge(),ve().forEach(function(e){e._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),hf=hf.filter(function(e){return e!==b}),b.state.isMounted=!1,P(`onHidden`,[b]))}function Ae(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),le(),delete e._tippy,b.state.isDestroyed=!0,P(`onDestroy`,[b]))}}function gf(e,t){t===void 0&&(t={});var n=df.plugins.concat(t.plugins||[]);mCe();var r=Object.assign({},t,{plugins:n}),i=aCe(e).reduce(function(e,t){var n=t&&ECe(t,r);return n&&e.push(n),e},[]);return sf(e)?i[0]:i}gf.defaultProps=df,gf.setDefaultProps=_Ce,gf.currentInput=uf,Object.assign({},Wre,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),gf.setDefaultProps({render:wCe});function DCe(e){let{triggerRef:t,panelComponent:n,panelProps:r={},tippyOptions:i={}}=e,a=sn(null),o=null,s=()=>(o||=document.createElement(`div`),Pi(U(n,{...r,onClose:f}),o),o),l=e=>{let n=e.target,r=t.value;if(r&&r.contains(n))return;let i=document.querySelector(`.tippy-box[data-theme~="history-panel"]`);if(i&&i.contains(n))return;let o=document.querySelector(`.tippy-box[data-theme~="more-menu-light"]`);o&&o.contains(n)||a.value?.state.isVisible&&a.value.hide()},u=()=>{if(!t.value||a.value)return;let e={placement:`bottom-end`,offset:[0,8],appendTo:document.querySelector(`.ai-blueking-container-wrapper`)||document.body};a.value=gf(t.value,{content:s(),interactive:!0,trigger:`manual`,theme:`light history-panel`,arrow:!1,hideOnClick:!1,animation:`scale`,duration:200,delay:[0,0],...e,...i,onShow:()=>{a.value&&o&&a.value.setContent(s()),setTimeout(()=>{document.addEventListener(`click`,l,!1)},0)},onHidden:()=>{document.removeEventListener(`click`,l,!1)}})},d=()=>{a.value||u(),a.value?.show()},f=()=>{a.value?.hide()},p=()=>{a.value||u(),a.value?.state.isVisible?f():d()},m=e=>{e.stopPropagation(),p()},h=()=>{a.value&&=(a.value.destroy(),null),o&&=(Pi(null,o),null),document.removeEventListener(`click`,l,!1)};return cr(()=>{h()}),{show:d,hide:f,toggle:p,handleTriggerClick:m,destroy:h,isVisible:()=>a.value?.state.isVisible??!1}}function OCe(e){return e.sessionBusinessManager?DCe({triggerRef:e.triggerRef,panelComponent:BSe,panelProps:{sessionBusinessManager:e.sessionBusinessManager,onSessionSwitch:e.onSessionSwitch,onSessionDelete:e.onSessionDelete,onSessionRename:e.onSessionRename},tippyOptions:{placement:`bottom-end`,offset:[0,8],appendTo:()=>document.querySelector(`.ai-blueking-panel`)||document.body}}):{handleTriggerClick:()=>{},show:()=>{},hide:()=>{},toggle:()=>{},destroy:()=>{},isVisible:()=>!1}}var _f=`top`,vf=`bottom`,yf=`right`,bf=`left`,xf=`auto`,Sf=[_f,vf,yf,bf],Cf=`start`,wf=`end`,kCe=`clippingParents`,ACe=`viewport`,Tf=`popper`,jCe=`reference`,MCe=Sf.reduce(function(e,t){return e.concat([t+`-`+Cf,t+`-`+wf])},[]),NCe=[].concat(Sf,[xf]).reduce(function(e,t){return e.concat([t,t+`-`+Cf,t+`-`+wf])},[]),PCe=[`beforeRead`,`read`,`afterRead`,`beforeMain`,`main`,`afterMain`,`beforeWrite`,`write`,`afterWrite`];function Ef(e){return e?(e.nodeName||``).toLowerCase():null}function Df(e){if(e==null)return window;if(e.toString()!==`[object Window]`){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Of(e){return e instanceof Df(e).Element||e instanceof Element}function kf(e){return e instanceof Df(e).HTMLElement||e instanceof HTMLElement}function FCe(e){return typeof ShadowRoot>`u`?!1:e instanceof Df(e).ShadowRoot||e instanceof ShadowRoot}function ICe(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];!kf(i)||!Ef(i)||(Object.assign(i.style,n),Object.keys(r).forEach(function(e){var t=r[e];t===!1?i.removeAttribute(e):i.setAttribute(e,t===!0?``:t)}))})}function LCe(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var r=t.elements[e],i=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]=``,e},{});!kf(r)||!Ef(r)||(Object.assign(r.style,a),Object.keys(i).forEach(function(e){r.removeAttribute(e)}))})}}var RCe={name:`applyStyles`,enabled:!0,phase:`write`,fn:ICe,effect:LCe,requires:[`computeStyles`]};function Af(e){return e.split(`-`)[0]}var jf=Math.max,Mf=Math.min,Nf=Math.round;function Pf(e,t){t===void 0&&(t=!1);var n=e.getBoundingClientRect(),r=1,i=1;if(kf(e)&&t){var a=e.offsetHeight,o=e.offsetWidth;o>0&&(r=Nf(n.width)/o||1),a>0&&(i=Nf(n.height)/a||1)}return{width:n.width/r,height:n.height/i,top:n.top/i,right:n.right/r,bottom:n.bottom/i,left:n.left/r,x:n.left/r,y:n.top/i}}function Ff(e){var t=Pf(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function zCe(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&FCe(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function If(e){return Df(e).getComputedStyle(e)}function BCe(e){return[`table`,`td`,`th`].indexOf(Ef(e))>=0}function Lf(e){return((Of(e)?e.ownerDocument:e.document)||window.document).documentElement}function Rf(e){return Ef(e)===`html`?e:e.assignedSlot||e.parentNode||(FCe(e)?e.host:null)||Lf(e)}function VCe(e){return!kf(e)||If(e).position===`fixed`?null:e.offsetParent}function HCe(e){var t=navigator.userAgent.toLowerCase().indexOf(`firefox`)!==-1;if(navigator.userAgent.indexOf(`Trident`)!==-1&&kf(e)&&If(e).position===`fixed`)return null;for(var n=Rf(e);kf(n)&&[`html`,`body`].indexOf(Ef(n))<0;){var r=If(n);if(r.transform!==`none`||r.perspective!==`none`||r.contain===`paint`||[`transform`,`perspective`].indexOf(r.willChange)!==-1||t&&r.willChange===`filter`||t&&r.filter&&r.filter!==`none`)return n;n=n.parentNode}return null}function zf(e){for(var t=Df(e),n=VCe(e);n&&BCe(n)&&If(n).position===`static`;)n=VCe(n);return n&&(Ef(n)===`html`||Ef(n)===`body`&&If(n).position===`static`)?t:n||HCe(e)||t}function Bf(e){return[`top`,`bottom`].indexOf(e)>=0?`x`:`y`}function Vf(e,t,n){return jf(e,Mf(t,n))}function UCe(e,t,n){var r=Vf(e,t,n);return r>n?n:r}function WCe(){return{top:0,right:0,bottom:0,left:0}}function GCe(e){return Object.assign({},WCe(),e)}function KCe(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}var qCe=function(e,t){return e=typeof e==`function`?e(Object.assign({},t.rects,{placement:t.placement})):e,GCe(typeof e==`number`?KCe(e,Sf):e)};function JCe(e){var t,n=e.state,r=e.name,i=e.options,a=n.elements.arrow,o=n.modifiersData.popperOffsets,s=Af(n.placement),l=Bf(s),u=[bf,yf].indexOf(s)>=0?`height`:`width`;if(!(!a||!o)){var d=qCe(i.padding,n),f=Ff(a),p=l===`y`?_f:bf,m=l===`y`?vf:yf,h=n.rects.reference[u]+n.rects.reference[l]-o[l]-n.rects.popper[u],g=o[l]-n.rects.reference[l],_=zf(a),v=_?l===`y`?_.clientHeight||0:_.clientWidth||0:0,y=h/2-g/2,b=d[p],x=v-f[u]-d[m],S=v/2-f[u]/2+y,C=Vf(b,S,x),w=l;n.modifiersData[r]=(t={},t[w]=C,t.centerOffset=C-S,t)}}function YCe(e){var t=e.state,n=e.options.element,r=n===void 0?`[data-popper-arrow]`:n;r!=null&&(typeof r==`string`&&(r=t.elements.popper.querySelector(r),!r)||zCe(t.elements.popper,r)&&(t.elements.arrow=r))}var XCe={name:`arrow`,enabled:!0,phase:`main`,fn:JCe,effect:YCe,requires:[`popperOffsets`],requiresIfExists:[`preventOverflow`]};function Hf(e){return e.split(`-`)[1]}var ZCe={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`};function QCe(e){var t=e.x,n=e.y,r=window.devicePixelRatio||1;return{x:Nf(t*r)/r||0,y:Nf(n*r)/r||0}}function $Ce(e){var t,n=e.popper,r=e.popperRect,i=e.placement,a=e.variation,o=e.offsets,s=e.position,l=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,f=e.isFixed,p=d===!0?QCe(o):typeof d==`function`?d(o):o,m=p.x,h=m===void 0?0:m,g=p.y,_=g===void 0?0:g,v=o.hasOwnProperty(`x`),y=o.hasOwnProperty(`y`),b=bf,x=_f,S=window;if(u){var C=zf(n),w=`clientHeight`,T=`clientWidth`;if(C===Df(n)&&(C=Lf(n),If(C).position!==`static`&&s===`absolute`&&(w=`scrollHeight`,T=`scrollWidth`)),C=C,i===_f||(i===bf||i===yf)&&a===wf){x=vf;var E=f&&S.visualViewport?S.visualViewport.height:C[w];_-=E-r.height,_*=l?1:-1}if(i===bf||(i===_f||i===vf)&&a===wf){b=yf;var D=f&&S.visualViewport?S.visualViewport.width:C[T];h-=D-r.width,h*=l?1:-1}}var O=Object.assign({position:s},u&&ZCe);if(l){var k;return Object.assign({},O,(k={},k[x]=y?`0`:``,k[b]=v?`0`:``,k.transform=(S.devicePixelRatio||1)<=1?`translate(`+h+`px, `+_+`px)`:`translate3d(`+h+`px, `+_+`px, 0)`,k))}return Object.assign({},O,(t={},t[x]=y?_+`px`:``,t[b]=v?h+`px`:``,t.transform=``,t))}function ewe(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,a=n.adaptive,o=a===void 0?!0:a,s=n.roundOffsets,l=s===void 0?!0:s,u={placement:Af(t.placement),variation:Hf(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy===`fixed`};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,$Ce(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,$Ce(Object.assign({},u,{offsets:t.modifiersData.arrow,position:`absolute`,adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var twe={name:`computeStyles`,enabled:!0,phase:`beforeWrite`,fn:ewe,data:{}},Uf={passive:!0};function nwe(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,a=i===void 0?!0:i,o=r.resize,s=o===void 0?!0:o,l=Df(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&u.forEach(function(e){e.addEventListener(`scroll`,n.update,Uf)}),s&&l.addEventListener(`resize`,n.update,Uf),function(){a&&u.forEach(function(e){e.removeEventListener(`scroll`,n.update,Uf)}),s&&l.removeEventListener(`resize`,n.update,Uf)}}var rwe={name:`eventListeners`,enabled:!0,phase:`write`,fn:function(){},effect:nwe,data:{}},iwe={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Wf(e){return e.replace(/left|right|bottom|top/g,function(e){return iwe[e]})}var awe={start:`end`,end:`start`};function owe(e){return e.replace(/start|end/g,function(e){return awe[e]})}function Gf(e){var t=Df(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Kf(e){return Pf(Lf(e)).left+Gf(e).scrollLeft}function swe(e){var t=Df(e),n=Lf(e),r=t.visualViewport,i=n.clientWidth,a=n.clientHeight,o=0,s=0;return r&&(i=r.width,a=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(o=r.offsetLeft,s=r.offsetTop)),{width:i,height:a,x:o+Kf(e),y:s}}function cwe(e){var t=Lf(e),n=Gf(e),r=e.ownerDocument?.body,i=jf(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=jf(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),o=-n.scrollLeft+Kf(e),s=-n.scrollTop;return If(r||t).direction===`rtl`&&(o+=jf(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:a,x:o,y:s}}function qf(e){var t=If(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function lwe(e){return[`html`,`body`,`#document`].indexOf(Ef(e))>=0?e.ownerDocument.body:kf(e)&&qf(e)?e:lwe(Rf(e))}function Jf(e,t){t===void 0&&(t=[]);var n=lwe(e),r=n===e.ownerDocument?.body,i=Df(n),a=r?[i].concat(i.visualViewport||[],qf(n)?n:[]):n,o=t.concat(a);return r?o:o.concat(Jf(Rf(a)))}function Yf(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function uwe(e){var t=Pf(e);return t.top+=e.clientTop,t.left+=e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}function dwe(e,t){return t===ACe?Yf(swe(e)):Of(t)?uwe(t):Yf(cwe(Lf(e)))}function fwe(e){var t=Jf(Rf(e)),n=[`absolute`,`fixed`].indexOf(If(e).position)>=0,r=n&&kf(e)?zf(e):e;return Of(r)?t.filter(function(e){return Of(e)&&zCe(e,r)&&Ef(e)!==`body`&&(n?If(e).position!==`static`:!0)}):[]}function pwe(e,t,n){var r=t===`clippingParents`?fwe(e):[].concat(t),i=[].concat(r,[n]),a=i[0],o=i.reduce(function(t,n){var r=dwe(e,n);return t.top=jf(r.top,t.top),t.right=Mf(r.right,t.right),t.bottom=Mf(r.bottom,t.bottom),t.left=jf(r.left,t.left),t},dwe(e,a));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function mwe(e){var t=e.reference,n=e.element,r=e.placement,i=r?Af(r):null,a=r?Hf(r):null,o=t.x+t.width/2-n.width/2,s=t.y+t.height/2-n.height/2,l;switch(i){case _f:l={x:o,y:t.y-n.height};break;case vf:l={x:o,y:t.y+t.height};break;case yf:l={x:t.x+t.width,y:s};break;case bf:l={x:t.x-n.width,y:s};break;default:l={x:t.x,y:t.y}}var u=i?Bf(i):null;if(u!=null){var d=u===`y`?`height`:`width`;switch(a){case Cf:l[u]=l[u]-(t[d]/2-n[d]/2);break;case wf:l[u]=l[u]+(t[d]/2-n[d]/2);break}}return l}function Xf(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,a=n.boundary,o=a===void 0?kCe:a,s=n.rootBoundary,l=s===void 0?ACe:s,u=n.elementContext,d=u===void 0?Tf:u,f=n.altBoundary,p=f===void 0?!1:f,m=n.padding,h=m===void 0?0:m,g=GCe(typeof h==`number`?KCe(h,Sf):h),_=d===Tf?jCe:Tf,v=e.rects.popper,y=e.elements[p?_:d],b=pwe(Of(y)?y:y.contextElement||Lf(e.elements.popper),o,l),x=Pf(e.elements.reference),S=mwe({reference:x,element:v,strategy:`absolute`,placement:i}),C=Yf(Object.assign({},v,S)),w=d===Tf?C:x,T={top:b.top-w.top+g.top,bottom:w.bottom-b.bottom+g.bottom,left:b.left-w.left+g.left,right:w.right-b.right+g.right},E=e.modifiersData.offset;if(d===Tf&&E){var D=E[i];Object.keys(T).forEach(function(e){var t=[yf,vf].indexOf(e)>=0?1:-1,n=[_f,vf].indexOf(e)>=0?`y`:`x`;T[e]+=D[n]*t})}return T}function hwe(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,a=n.rootBoundary,o=n.padding,s=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?NCe:l,d=Hf(r),f=d?s?MCe:MCe.filter(function(e){return Hf(e)===d}):Sf,p=f.filter(function(e){return u.indexOf(e)>=0});p.length===0&&(p=f);var m=p.reduce(function(t,n){return t[n]=Xf(e,{placement:n,boundary:i,rootBoundary:a,padding:o})[Af(n)],t},{});return Object.keys(m).sort(function(e,t){return m[e]-m[t]})}function gwe(e){if(Af(e)===xf)return[];var t=Wf(e);return[owe(e),t,owe(t)]}function _we(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,a=i===void 0?!0:i,o=n.altAxis,s=o===void 0?!0:o,l=n.fallbackPlacements,u=n.padding,d=n.boundary,f=n.rootBoundary,p=n.altBoundary,m=n.flipVariations,h=m===void 0?!0:m,g=n.allowedAutoPlacements,_=t.options.placement,v=Af(_)===_,y=l||(v||!h?[Wf(_)]:gwe(_)),b=[_].concat(y).reduce(function(e,n){return e.concat(Af(n)===xf?hwe(t,{placement:n,boundary:d,rootBoundary:f,padding:u,flipVariations:h,allowedAutoPlacements:g}):n)},[]),x=t.rects.reference,S=t.rects.popper,C=new Map,w=!0,T=b[0],E=0;E<b.length;E++){var D=b[E],O=Af(D),k=Hf(D)===Cf,A=[_f,vf].indexOf(O)>=0,j=A?`width`:`height`,M=Xf(t,{placement:D,boundary:d,rootBoundary:f,altBoundary:p,padding:u}),N=A?k?yf:bf:k?vf:_f;x[j]>S[j]&&(N=Wf(N));var P=Wf(N),F=[];if(a&&F.push(M[O]<=0),s&&F.push(M[N]<=0,M[P]<=0),F.every(function(e){return e})){T=D,w=!1;break}C.set(D,F)}if(w)for(var I=h?3:1,L=function(e){var t=b.find(function(t){var n=C.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return T=t,`break`},R=I;R>0&&L(R)!==`break`;R--);t.placement!==T&&(t.modifiersData[r]._skip=!0,t.placement=T,t.reset=!0)}}var vwe={name:`flip`,enabled:!0,phase:`main`,fn:_we,requiresIfExists:[`offset`],data:{_skip:!1}};function ywe(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function bwe(e){return[_f,yf,vf,bf].some(function(t){return e[t]>=0})}function xwe(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,o=Xf(t,{elementContext:`reference`}),s=Xf(t,{altBoundary:!0}),l=ywe(o,r),u=ywe(s,i,a),d=bwe(l),f=bwe(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:f},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}var Swe={name:`hide`,enabled:!0,phase:`main`,requiresIfExists:[`preventOverflow`],fn:xwe};function Cwe(e,t,n){var r=Af(e),i=[bf,_f].indexOf(r)>=0?-1:1,a=typeof n==`function`?n(Object.assign({},t,{placement:e})):n,o=a[0],s=a[1];return o||=0,s=(s||0)*i,[bf,yf].indexOf(r)>=0?{x:s,y:o}:{x:o,y:s}}function wwe(e){var t=e.state,n=e.options,r=e.name,i=n.offset,a=i===void 0?[0,0]:i,o=NCe.reduce(function(e,n){return e[n]=Cwe(n,t.rects,a),e},{}),s=o[t.placement],l=s.x,u=s.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=o}var Twe={name:`offset`,enabled:!0,phase:`main`,requires:[`popperOffsets`],fn:wwe};function Ewe(e){var t=e.state,n=e.name;t.modifiersData[n]=mwe({reference:t.rects.reference,element:t.rects.popper,strategy:`absolute`,placement:t.placement})}var Dwe={name:`popperOffsets`,enabled:!0,phase:`read`,fn:Ewe,data:{}};function Owe(e){return e===`x`?`y`:`x`}function kwe(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,a=i===void 0?!0:i,o=n.altAxis,s=o===void 0?!1:o,l=n.boundary,u=n.rootBoundary,d=n.altBoundary,f=n.padding,p=n.tether,m=p===void 0?!0:p,h=n.tetherOffset,g=h===void 0?0:h,_=Xf(t,{boundary:l,rootBoundary:u,padding:f,altBoundary:d}),v=Af(t.placement),y=Hf(t.placement),b=!y,x=Bf(v),S=Owe(x),C=t.modifiersData.popperOffsets,w=t.rects.reference,T=t.rects.popper,E=typeof g==`function`?g(Object.assign({},t.rects,{placement:t.placement})):g,D=typeof E==`number`?{mainAxis:E,altAxis:E}:Object.assign({mainAxis:0,altAxis:0},E),O=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,k={x:0,y:0};if(C){if(a){var A=x===`y`?_f:bf,j=x===`y`?vf:yf,M=x===`y`?`height`:`width`,N=C[x],P=N+_[A],F=N-_[j],I=m?-T[M]/2:0,L=y===Cf?w[M]:T[M],R=y===Cf?-T[M]:-w[M],ee=t.elements.arrow,te=m&&ee?Ff(ee):{width:0,height:0},ne=t.modifiersData[`arrow#persistent`]?t.modifiersData[`arrow#persistent`].padding:WCe(),re=ne[A],ie=ne[j],ae=Vf(0,w[M],te[M]),oe=b?w[M]/2-I-ae-re-D.mainAxis:L-ae-re-D.mainAxis,se=b?-w[M]/2+I+ae+ie+D.mainAxis:R+ae+ie+D.mainAxis,ce=t.elements.arrow&&zf(t.elements.arrow),le=ce?x===`y`?ce.clientTop||0:ce.clientLeft||0:0,ue=O?.[x]??0,de=N+oe-ue-le,fe=N+se-ue,pe=Vf(m?Mf(P,de):P,N,m?jf(F,fe):F);C[x]=pe,k[x]=pe-N}if(s){var me=x===`x`?_f:bf,he=x===`x`?vf:yf,ge=C[S],_e=S===`y`?`height`:`width`,ve=ge+_[me],ye=ge-_[he],be=[_f,bf].indexOf(v)!==-1,xe=O?.[S]??0,Se=be?ve:ge-w[_e]-T[_e]-xe+D.altAxis,Ce=be?ge+w[_e]+T[_e]-xe-D.altAxis:ye,we=m&&be?UCe(Se,ge,Ce):Vf(m?Se:ve,ge,m?Ce:ye);C[S]=we,k[S]=we-ge}t.modifiersData[r]=k}}var Awe={name:`preventOverflow`,enabled:!0,phase:`main`,fn:kwe,requiresIfExists:[`offset`]};function jwe(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Mwe(e){return e===Df(e)||!kf(e)?Gf(e):jwe(e)}function Nwe(e){var t=e.getBoundingClientRect(),n=Nf(t.width)/e.offsetWidth||1,r=Nf(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Pwe(e,t,n){n===void 0&&(n=!1);var r=kf(t),i=kf(t)&&Nwe(t),a=Lf(t),o=Pf(e,i),s={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Ef(t)!==`body`||qf(a))&&(s=Mwe(t)),kf(t)?(l=Pf(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):a&&(l.x=Kf(a))),{x:o.left+s.scrollLeft-l.x,y:o.top+s.scrollTop-l.y,width:o.width,height:o.height}}function Fwe(e){var t=new Map,n=new Set,r=[];e.forEach(function(e){t.set(e.name,e)});function i(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var r=t.get(e);r&&i(r)}}),r.push(e)}return e.forEach(function(e){n.has(e.name)||i(e)}),r}function Iwe(e){var t=Fwe(e);return PCe.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}function Lwe(e){var t;return function(){return t||=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})}),t}}function Rwe(e){var t=e.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{});return Object.keys(t).map(function(e){return t[e]})}var zwe={placement:`bottom`,modifiers:[],strategy:`absolute`};function Bwe(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&typeof e.getBoundingClientRect==`function`)})}function Vwe(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,a=i===void 0?zwe:i;return function(e,t,n){n===void 0&&(n=a);var i={placement:`bottom`,orderedModifiers:[],options:Object.assign({},zwe,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},o=[],s=!1,l={state:i,setOptions:function(n){var o=typeof n==`function`?n(i.options):n;d(),i.options=Object.assign({},a,i.options,o),i.scrollParents={reference:Of(e)?Jf(e):e.contextElement?Jf(e.contextElement):[],popper:Jf(t)};var s=Iwe(Rwe([].concat(r,i.options.modifiers)));return i.orderedModifiers=s.filter(function(e){return e.enabled}),u(),l.update()},forceUpdate:function(){if(!s){var e=i.elements,t=e.reference,n=e.popper;if(Bwe(t,n)){i.rects={reference:Pwe(t,zf(n),i.options.strategy===`fixed`),popper:Ff(n)},i.reset=!1,i.placement=i.options.placement,i.orderedModifiers.forEach(function(e){return i.modifiersData[e.name]=Object.assign({},e.data)});for(var r=0;r<i.orderedModifiers.length;r++){if(i.reset===!0){i.reset=!1,r=-1;continue}var a=i.orderedModifiers[r],o=a.fn,u=a.options,d=u===void 0?{}:u,f=a.name;typeof o==`function`&&(i=o({state:i,options:d,name:f,instance:l})||i)}}}},update:Lwe(function(){return new Promise(function(e){l.forceUpdate(),e(i)})}),destroy:function(){d(),s=!0}};if(!Bwe(e,t))return l;l.setOptions(n).then(function(e){!s&&n.onFirstUpdate&&n.onFirstUpdate(e)});function u(){i.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=n===void 0?{}:n,a=e.effect;if(typeof a==`function`){var s=a({state:i,name:t,instance:l,options:r});o.push(s||function(){})}})}function d(){o.forEach(function(e){return e()}),o=[]}return l}}var Hwe=Vwe({defaultModifiers:[rwe,Dwe,twe,RCe,Twe,vwe,Awe,XCe,Swe]}),Uwe=`tippy-box`,Wwe=`tippy-content`,Gwe=`tippy-backdrop`,Kwe=`tippy-arrow`,qwe=`tippy-svg-arrow`,Zf={passive:!0,capture:!0},Jwe=function(){return document.body};function Qf(e,t,n){return Array.isArray(e)?e[t]??(Array.isArray(n)?n[t]:n):e}function $f(e,t){var n={}.toString.call(e);return n.indexOf(`[object`)===0&&n.indexOf(t+`]`)>-1}function Ywe(e,t){return typeof e==`function`?e.apply(void 0,t):e}function Xwe(e,t){if(t===0)return e;var n;return function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}}function Zwe(e){return e.split(/\s+/).filter(Boolean)}function ep(e){return[].concat(e)}function Qwe(e,t){e.indexOf(t)===-1&&e.push(t)}function $we(e){return e.filter(function(t,n){return e.indexOf(t)===n})}function eTe(e){return e.split(`-`)[0]}function tp(e){return[].slice.call(e)}function tTe(e){return Object.keys(e).reduce(function(t,n){return e[n]!==void 0&&(t[n]=e[n]),t},{})}function np(){return document.createElement(`div`)}function rp(e){return[`Element`,`Fragment`].some(function(t){return $f(e,t)})}function nTe(e){return $f(e,`NodeList`)}function ip(e){return $f(e,`MouseEvent`)}function rTe(e){return!!(e&&e._tippy&&e._tippy.reference===e)}function iTe(e){return rp(e)?[e]:nTe(e)?tp(e):Array.isArray(e)?e:tp(document.querySelectorAll(e))}function ap(e,t){e.forEach(function(e){e&&(e.style.transitionDuration=t+`ms`)})}function op(e,t){e.forEach(function(e){e&&e.setAttribute(`data-state`,t)})}function aTe(e){var t,n=ep(e)[0];return n!=null&&(t=n.ownerDocument)!=null&&t.body?n.ownerDocument:document}function oTe(e,t){var n=t.clientX,r=t.clientY;return e.every(function(e){var t=e.popperRect,i=e.popperState,a=e.props.interactiveBorder,o=eTe(i.placement),s=i.modifiersData.offset;if(!s)return!0;var l=o===`bottom`?s.top.y:0,u=o===`top`?s.bottom.y:0,d=o===`right`?s.left.x:0,f=o===`left`?s.right.x:0,p=t.top-r+l>a,m=r-t.bottom-u>a,h=t.left-n+d>a,g=n-t.right-f>a;return p||m||h||g})}function sp(e,t,n){var r=t+`EventListener`;[`transitionend`,`webkitTransitionEnd`].forEach(function(t){e[r](t,n)})}function sTe(e,t){for(var n=t;n;){if(e.contains(n))return!0;n=n.getRootNode==null?void 0:n.getRootNode()?.host}return!1}var cp={isTouch:!1},cTe=0;function lTe(){cp.isTouch||(cp.isTouch=!0,window.performance&&document.addEventListener(`mousemove`,uTe))}function uTe(){var e=performance.now();e-cTe<20&&(cp.isTouch=!1,document.removeEventListener(`mousemove`,uTe)),cTe=e}function dTe(){var e=document.activeElement;if(rTe(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}function fTe(){document.addEventListener(`touchstart`,lTe,Zf),window.addEventListener(`blur`,dTe)}var pTe=typeof window<`u`&&typeof document<`u`?!!window.msCrypto:!1,lp=Object.assign({appendTo:Jwe,aria:{content:`auto`,expanded:`auto`},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:``,offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:`top`,plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:`mouseenter focus`,triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:`fade`,arrow:!0,content:``,inertia:!1,maxWidth:350,role:`tooltip`,theme:``,zIndex:9999}),mTe=Object.keys(lp),hTe=function(e){Object.keys(e).forEach(function(t){lp[t]=e[t]})};function gTe(e){var t=(e.plugins||[]).reduce(function(t,n){var r=n.name,i=n.defaultValue;return r&&(t[r]=e[r]===void 0?lp[r]??i:e[r]),t},{});return Object.assign({},e,t)}function _Te(e,t){return(t?Object.keys(gTe(Object.assign({},lp,{plugins:t}))):mTe).reduce(function(t,n){var r=(e.getAttribute(`data-tippy-`+n)||``).trim();if(!r)return t;if(n===`content`)t[n]=r;else try{t[n]=JSON.parse(r)}catch{t[n]=r}return t},{})}function vTe(e,t){var n=Object.assign({},t,{content:Ywe(t.content,[e])},t.ignoreAttributes?{}:_Te(e,t.plugins));return n.aria=Object.assign({},lp.aria,n.aria),n.aria={expanded:n.aria.expanded===`auto`?t.interactive:n.aria.expanded,content:n.aria.content===`auto`?t.interactive?null:`describedby`:n.aria.content},n}var yTe=function(){return`innerHTML`};function up(e,t){e[yTe()]=t}function bTe(e){var t=np();return e===!0?t.className=Kwe:(t.className=qwe,rp(e)?t.appendChild(e):up(t,e)),t}function xTe(e,t){rp(t.content)?(up(e,``),e.appendChild(t.content)):typeof t.content!=`function`&&(t.allowHTML?up(e,t.content):e.textContent=t.content)}function dp(e){var t=e.firstElementChild,n=tp(t.children);return{box:t,content:n.find(function(e){return e.classList.contains(Wwe)}),arrow:n.find(function(e){return e.classList.contains(Kwe)||e.classList.contains(qwe)}),backdrop:n.find(function(e){return e.classList.contains(Gwe)})}}function STe(e){var t=np(),n=np();n.className=Uwe,n.setAttribute(`data-state`,`hidden`),n.setAttribute(`tabindex`,`-1`);var r=np();r.className=Wwe,r.setAttribute(`data-state`,`hidden`),xTe(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props);function i(n,r){var i=dp(t),a=i.box,o=i.content,s=i.arrow;r.theme?a.setAttribute(`data-theme`,r.theme):a.removeAttribute(`data-theme`),typeof r.animation==`string`?a.setAttribute(`data-animation`,r.animation):a.removeAttribute(`data-animation`),r.inertia?a.setAttribute(`data-inertia`,``):a.removeAttribute(`data-inertia`),a.style.maxWidth=typeof r.maxWidth==`number`?r.maxWidth+`px`:r.maxWidth,r.role?a.setAttribute(`role`,r.role):a.removeAttribute(`role`),(n.content!==r.content||n.allowHTML!==r.allowHTML)&&xTe(o,e.props),r.arrow?s?n.arrow!==r.arrow&&(a.removeChild(s),a.appendChild(bTe(r.arrow))):a.appendChild(bTe(r.arrow)):s&&a.removeChild(s)}return{popper:t,onUpdate:i}}STe.$$tippy=!0;var CTe=1,fp=[],pp=[];function wTe(e,t){var n=vTe(e,Object.assign({},lp,gTe(tTe(t)))),r,i,a,o=!1,s=!1,l=!1,u=!1,d,f,p,m=[],h=Xwe(de,n.interactiveDebounce),g,_=CTe++,v=null,y=$we(n.plugins),b={id:_,reference:e,popper:np(),popperInstance:v,props:n,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:y,clearDelayTimeouts:Ce,setProps:we,setContent:Te,show:Ee,hide:De,hideWithInteractivity:Oe,enable:xe,disable:Se,unmount:ke,destroy:Ae};if(!n.render)return b;var x=n.render(b),S=x.popper,C=x.onUpdate;S.setAttribute(`data-tippy-root`,``),S.id=`tippy-`+b.id,b.popper=S,e._tippy=b,S._tippy=b;var w=y.map(function(e){return e.fn(b)}),T=e.hasAttribute(`aria-expanded`);return ce(),I(),N(),P(`onCreate`,[b]),n.showOnCreate&&ye(),S.addEventListener(`mouseenter`,function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),S.addEventListener(`mouseleave`,function(){b.props.interactive&&b.props.trigger.indexOf(`mouseenter`)>=0&&A().addEventListener(`mousemove`,h)}),b;function E(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function D(){return E()[0]===`hold`}function O(){var e;return!!((e=b.props.render)!=null&&e.$$tippy)}function k(){return g||e}function A(){var e=k().parentNode;return e?aTe(e):document}function j(){return dp(S)}function M(e){return b.state.isMounted&&!b.state.isVisible||cp.isTouch||d&&d.type===`focus`?0:Qf(b.props.delay,+!e,lp.delay)}function N(e){e===void 0&&(e=!1),S.style.pointerEvents=b.props.interactive&&!e?``:`none`,S.style.zIndex=``+b.props.zIndex}function P(e,t,n){if(n===void 0&&(n=!0),w.forEach(function(n){n[e]&&n[e].apply(n,t)}),n){var r;(r=b.props)[e].apply(r,t)}}function F(){var t=b.props.aria;if(t.content){var n=`aria-`+t.content,r=S.id;ep(b.props.triggerTarget||e).forEach(function(e){var t=e.getAttribute(n);if(b.state.isVisible)e.setAttribute(n,t?t+` `+r:r);else{var i=t&&t.replace(r,``).trim();i?e.setAttribute(n,i):e.removeAttribute(n)}})}}function I(){T||!b.props.aria.expanded||ep(b.props.triggerTarget||e).forEach(function(e){b.props.interactive?e.setAttribute(`aria-expanded`,b.state.isVisible&&e===k()?`true`:`false`):e.removeAttribute(`aria-expanded`)})}function L(){A().removeEventListener(`mousemove`,h),fp=fp.filter(function(e){return e!==h})}function R(t){if(!(cp.isTouch&&(l||t.type===`mousedown`))){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!(b.props.interactive&&sTe(S,n))){if(ep(b.props.triggerTarget||e).some(function(e){return sTe(e,n)})){if(cp.isTouch||b.state.isVisible&&b.props.trigger.indexOf(`click`)>=0)return}else P(`onClickOutside`,[b,t]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),s=!0,setTimeout(function(){s=!1}),b.state.isMounted||re())}}}function ee(){l=!0}function te(){l=!1}function ne(){var e=A();e.addEventListener(`mousedown`,R,!0),e.addEventListener(`touchend`,R,Zf),e.addEventListener(`touchstart`,te,Zf),e.addEventListener(`touchmove`,ee,Zf)}function re(){var e=A();e.removeEventListener(`mousedown`,R,!0),e.removeEventListener(`touchend`,R,Zf),e.removeEventListener(`touchstart`,te,Zf),e.removeEventListener(`touchmove`,ee,Zf)}function ie(e,t){oe(e,function(){!b.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&t()})}function ae(e,t){oe(e,t)}function oe(e,t){var n=j().box;function r(e){e.target===n&&(sp(n,`remove`,r),t())}if(e===0)return t();sp(n,`remove`,f),sp(n,`add`,r),f=r}function se(t,n,r){r===void 0&&(r=!1),ep(b.props.triggerTarget||e).forEach(function(e){e.addEventListener(t,n,r),m.push({node:e,eventType:t,handler:n,options:r})})}function ce(){D()&&(se(`touchstart`,ue,{passive:!0}),se(`touchend`,fe,{passive:!0})),Zwe(b.props.trigger).forEach(function(e){if(e!==`manual`)switch(se(e,ue),e){case`mouseenter`:se(`mouseleave`,fe);break;case`focus`:se(pTe?`focusout`:`blur`,pe);break;case`focusin`:se(`focusout`,pe);break}})}function le(){m.forEach(function(e){var t=e.node,n=e.eventType,r=e.handler,i=e.options;t.removeEventListener(n,r,i)}),m=[]}function ue(e){var t=!1;if(!(!b.state.isEnabled||me(e)||s)){var n=d?.type===`focus`;d=e,g=e.currentTarget,I(),!b.state.isVisible&&ip(e)&&fp.forEach(function(t){return t(e)}),e.type===`click`&&(b.props.trigger.indexOf(`mouseenter`)<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?t=!0:ye(e),e.type===`click`&&(o=!t),t&&!n&&be(e)}}function de(e){var t=e.target,r=k().contains(t)||S.contains(t);e.type===`mousemove`&&r||oTe(ve().concat(S).map(function(e){var t=e._tippy.popperInstance?.state;return t?{popperRect:e.getBoundingClientRect(),popperState:t,props:n}:null}).filter(Boolean),e)&&(L(),be(e))}function fe(e){if(!(me(e)||b.props.trigger.indexOf(`click`)>=0&&o)){if(b.props.interactive){b.hideWithInteractivity(e);return}be(e)}}function pe(e){b.props.trigger.indexOf(`focusin`)<0&&e.target!==k()||b.props.interactive&&e.relatedTarget&&S.contains(e.relatedTarget)||be(e)}function me(e){return cp.isTouch?D()!==e.type.indexOf(`touch`)>=0:!1}function he(){ge();var t=b.props,n=t.popperOptions,r=t.placement,i=t.offset,a=t.getReferenceClientRect,o=t.moveTransition,s=O()?dp(S).arrow:null,l=a?{getBoundingClientRect:a,contextElement:a.contextElement||k()}:e,u=[{name:`offset`,options:{offset:i}},{name:`preventOverflow`,options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:`flip`,options:{padding:5}},{name:`computeStyles`,options:{adaptive:!o}},{name:`$$tippy`,enabled:!0,phase:`beforeWrite`,requires:[`computeStyles`],fn:function(e){var t=e.state;if(O()){var n=j().box;[`placement`,`reference-hidden`,`escaped`].forEach(function(e){e===`placement`?n.setAttribute(`data-placement`,t.placement):t.attributes.popper[`data-popper-`+e]?n.setAttribute(`data-`+e,``):n.removeAttribute(`data-`+e)}),t.attributes.popper={}}}}];O()&&s&&u.push({name:`arrow`,options:{element:s,padding:3}}),u.push.apply(u,n?.modifiers||[]),b.popperInstance=Hwe(l,S,Object.assign({},n,{placement:r,onFirstUpdate:p,modifiers:u}))}function ge(){b.popperInstance&&=(b.popperInstance.destroy(),null)}function _e(){var e=b.props.appendTo,t,n=k();t=b.props.interactive&&e===Jwe||e===`parent`?n.parentNode:Ywe(e,[n]),t.contains(S)||t.appendChild(S),b.state.isMounted=!0,he()}function ve(){return tp(S.querySelectorAll(`[data-tippy-root]`))}function ye(e){b.clearDelayTimeouts(),e&&P(`onTrigger`,[b,e]),ne();var t=M(!0),n=E(),i=n[0],a=n[1];cp.isTouch&&i===`hold`&&a&&(t=a),t?r=setTimeout(function(){b.show()},t):b.show()}function be(e){if(b.clearDelayTimeouts(),P(`onUntrigger`,[b,e]),!b.state.isVisible){re();return}if(!(b.props.trigger.indexOf(`mouseenter`)>=0&&b.props.trigger.indexOf(`click`)>=0&&[`mouseleave`,`mousemove`].indexOf(e.type)>=0&&o)){var t=M(!1);t?i=setTimeout(function(){b.state.isVisible&&b.hide()},t):a=requestAnimationFrame(function(){b.hide()})}}function xe(){b.state.isEnabled=!0}function Se(){b.hide(),b.state.isEnabled=!1}function Ce(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(a)}function we(t){if(!b.state.isDestroyed){P(`onBeforeUpdate`,[b,t]),le();var n=b.props,r=vTe(e,Object.assign({},n,tTe(t),{ignoreAttributes:!0}));b.props=r,ce(),n.interactiveDebounce!==r.interactiveDebounce&&(L(),h=Xwe(de,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?ep(n.triggerTarget).forEach(function(e){e.removeAttribute(`aria-expanded`)}):r.triggerTarget&&e.removeAttribute(`aria-expanded`),I(),N(),C&&C(n,r),b.popperInstance&&(he(),ve().forEach(function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})),P(`onAfterUpdate`,[b,t])}}function Te(e){b.setProps({content:e})}function Ee(){var e=b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=cp.isTouch&&!b.props.touch,i=Qf(b.props.duration,0,lp.duration);if(!(e||t||n||r)&&!k().hasAttribute(`disabled`)&&(P(`onShow`,[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,O()&&(S.style.visibility=`visible`),N(),ne(),b.state.isMounted||(S.style.transition=`none`),O()){var a=j(),o=a.box,s=a.content;ap([o,s],0)}p=function(){var e;if(!(!b.state.isVisible||u)){if(u=!0,S.offsetHeight,S.style.transition=b.props.moveTransition,O()&&b.props.animation){var t=j(),n=t.box,r=t.content;ap([n,r],i),op([n,r],`visible`)}F(),I(),Qwe(pp,b),(e=b.popperInstance)==null||e.forceUpdate(),P(`onMount`,[b]),b.props.animation&&O()&&ae(i,function(){b.state.isShown=!0,P(`onShown`,[b])})}},_e()}}function De(){var e=!b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=Qf(b.props.duration,1,lp.duration);if(!(e||t||n)&&(P(`onHide`,[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,u=!1,o=!1,O()&&(S.style.visibility=`hidden`),L(),re(),N(!0),O()){var i=j(),a=i.box,s=i.content;b.props.animation&&(ap([a,s],r),op([a,s],`hidden`))}F(),I(),b.props.animation?O()&&ie(r,b.unmount):b.unmount()}}function Oe(e){A().addEventListener(`mousemove`,h),Qwe(fp,h),h(e)}function ke(){b.state.isVisible&&b.hide(),b.state.isMounted&&(ge(),ve().forEach(function(e){e._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),pp=pp.filter(function(e){return e!==b}),b.state.isMounted=!1,P(`onHidden`,[b]))}function Ae(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),le(),delete e._tippy,b.state.isDestroyed=!0,P(`onDestroy`,[b]))}}function mp(e,t){t===void 0&&(t={});var n=lp.plugins.concat(t.plugins||[]);fTe();var r=Object.assign({},t,{plugins:n}),i=iTe(e).reduce(function(e,t){var n=t&&wTe(t,r);return n&&e.push(n),e},[]);return rp(e)?i[0]:i}mp.defaultProps=lp,mp.setDefaultProps=hTe,mp.currentInput=cp,Object.assign({},RCe,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}});var TTe={name:`animateFill`,defaultValue:!1,fn:function(e){var t;if(!((t=e.props.render)!=null&&t.$$tippy))return{};var n=dp(e.popper),r=n.box,i=n.content,a=e.props.animateFill?ETe():null;return{onCreate:function(){a&&(r.insertBefore(a,r.firstElementChild),r.setAttribute(`data-animatefill`,``),r.style.overflow=`hidden`,e.setProps({arrow:!1,animation:`shift-away`}))},onMount:function(){if(a){var e=r.style.transitionDuration,t=Number(e.replace(`ms`,``));i.style.transitionDelay=Math.round(t/10)+`ms`,a.style.transitionDuration=e,op([a],`visible`)}},onShow:function(){a&&(a.style.transitionDuration=`0ms`)},onHide:function(){a&&op([a],`hidden`)}}}};function ETe(){var e=np();return e.className=Gwe,op([e],`hidden`),e}var hp={clientX:0,clientY:0},gp=[];function DTe(e){hp={clientX:e.clientX,clientY:e.clientY}}function OTe(e){e.addEventListener(`mousemove`,DTe)}function kTe(e){e.removeEventListener(`mousemove`,DTe)}var ATe={name:`followCursor`,defaultValue:!1,fn:function(e){var t=e.reference,n=aTe(e.props.triggerTarget||t),r=!1,i=!1,a=!0,o=e.props;function s(){return e.props.followCursor===`initial`&&e.state.isVisible}function l(){n.addEventListener(`mousemove`,f)}function u(){n.removeEventListener(`mousemove`,f)}function d(){r=!0,e.setProps({getReferenceClientRect:null}),r=!1}function f(n){var r=n.target?t.contains(n.target):!0,i=e.props.followCursor,a=n.clientX,o=n.clientY,s=t.getBoundingClientRect(),l=a-s.left,u=o-s.top;(r||!e.props.interactive)&&e.setProps({getReferenceClientRect:function(){var e=t.getBoundingClientRect(),n=a,r=o;i===`initial`&&(n=e.left+l,r=e.top+u);var s=i===`horizontal`?e.top:r,d=i===`vertical`?e.right:n,f=i===`horizontal`?e.bottom:r,p=i===`vertical`?e.left:n;return{width:d-p,height:f-s,top:s,right:d,bottom:f,left:p}}})}function p(){e.props.followCursor&&(gp.push({instance:e,doc:n}),OTe(n))}function m(){gp=gp.filter(function(t){return t.instance!==e}),gp.filter(function(e){return e.doc===n}).length===0&&kTe(n)}return{onCreate:p,onDestroy:m,onBeforeUpdate:function(){o=e.props},onAfterUpdate:function(t,n){var a=n.followCursor;r||a!==void 0&&o.followCursor!==a&&(m(),a?(p(),e.state.isMounted&&!i&&!s()&&l()):(u(),d()))},onMount:function(){e.props.followCursor&&!i&&(a&&=(f(hp),!1),s()||l())},onTrigger:function(e,t){ip(t)&&(hp={clientX:t.clientX,clientY:t.clientY}),i=t.type===`focus`},onHidden:function(){e.props.followCursor&&(d(),u(),a=!0)}}}};function jTe(e,t){return{popperOptions:Object.assign({},e.popperOptions,{modifiers:[].concat((e.popperOptions?.modifiers||[]).filter(function(e){return e.name!==t.name}),[t])})}}var MTe={name:`inlinePositioning`,defaultValue:!1,fn:function(e){var t=e.reference;function n(){return!!e.props.inlinePositioning}var r,i=-1,a=!1,o=[],s={name:`tippyInlinePositioning`,enabled:!0,phase:`afterWrite`,fn:function(t){var i=t.state;n()&&(o.indexOf(i.placement)!==-1&&(o=[]),r!==i.placement&&o.indexOf(i.placement)===-1&&(o.push(i.placement),e.setProps({getReferenceClientRect:function(){return l(i.placement)}})),r=i.placement)}};function l(e){return NTe(eTe(e),t.getBoundingClientRect(),tp(t.getClientRects()),i)}function u(t){a=!0,e.setProps(t),a=!1}function d(){a||u(jTe(e.props,s))}return{onCreate:d,onAfterUpdate:d,onTrigger:function(t,n){if(ip(n)){var r=tp(e.reference.getClientRects()),a=r.find(function(e){return e.left-2<=n.clientX&&e.right+2>=n.clientX&&e.top-2<=n.clientY&&e.bottom+2>=n.clientY}),o=r.indexOf(a);i=o>-1?o:i}},onHidden:function(){i=-1}}}};function NTe(e,t,n,r){if(n.length<2||e===null)return t;if(n.length===2&&r>=0&&n[0].left>n[1].right)return n[r]||t;switch(e){case`top`:case`bottom`:var i=n[0],a=n[n.length-1],o=e===`top`,s=i.top,l=a.bottom,u=o?i.left:a.left,d=o?i.right:a.right;return{top:s,bottom:l,left:u,right:d,width:d-u,height:l-s};case`left`:case`right`:var f=Math.min.apply(Math,n.map(function(e){return e.left})),p=Math.max.apply(Math,n.map(function(e){return e.right})),m=n.filter(function(t){return e===`left`?t.left===f:t.right===p}),h=m[0].top,g=m[m.length-1].bottom,_=f,v=p;return{top:h,bottom:g,left:_,right:v,width:v-_,height:g-h};default:return t}}var PTe={name:`sticky`,defaultValue:!1,fn:function(e){var t=e.reference,n=e.popper;function r(){return e.popperInstance?e.popperInstance.state.elements.reference:t}function i(t){return e.props.sticky===!0||e.props.sticky===t}var a=null,o=null;function s(){var t=i(`reference`)?r().getBoundingClientRect():null,l=i(`popper`)?n.getBoundingClientRect():null;(t&&FTe(a,t)||l&&FTe(o,l))&&e.popperInstance&&e.popperInstance.update(),a=t,o=l,e.state.isMounted&&requestAnimationFrame(s)}return{onMount:function(){e.props.sticky&&s()}}}};function FTe(e,t){return e&&t?e.top!==t.top||e.right!==t.right||e.bottom!==t.bottom||e.left!==t.left:!0}mp.setDefaultProps({render:STe}),mp.setDefaultProps({onShow:e=>{if(!e.props.content)return!1}});var ITe=e=>e instanceof Object&&`$`in e&&`$el`in e;function LTe(e,t={},n={mount:!0,appName:`Tippy`}){n=Object.assign({mount:!0,appName:`Tippy`},n);let r=si(),i=sn(),a=sn({isEnabled:!1,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1}),o=cn(),s=null,l=()=>s||(s=document.createDocumentFragment(),s),u=e=>{let t,i=on(e)?e.value:e;return qr(i)?(o.value||(o.value=Fi({name:n.appName,setup:()=>()=>on(e)?e.value:e}),r&&Object.assign(o.value._context,r.appContext),o.value.mount(l())),t=()=>l()):typeof i==`object`?(o.value||(o.value=Fi({name:n.appName,setup:()=>()=>U(on(e)?e.value:e)}),r&&Object.assign(o.value._context,r.appContext),o.value.mount(l())),t=()=>l()):t=i,t},d=e=>{let t={};return t=on(e)?e.value||{}:{...e},t.content&&=u(t.content),t.triggerTarget&&=on(t.triggerTarget)?t.triggerTarget.value:t.triggerTarget,(!t.plugins||!Array.isArray(t.plugins))&&(t.plugins=[]),t.plugins=t.plugins.filter(e=>e.name!==`vueTippyReactiveState`),t.plugins.push({name:`vueTippyReactiveState`,fn:()=>({onCreate(){a.value.isEnabled=!0},onMount(){a.value.isMounted=!0},onShow(){a.value.isMounted=!0,a.value.isVisible=!0},onShown(){a.value.isShown=!0},onHide(){a.value.isMounted=!1,a.value.isVisible=!1},onHidden(){a.value.isShown=!1},onUnmounted(){a.value.isMounted=!1},onDestroy(){a.value.isDestroyed=!0}})}),t},f=()=>{i.value&&i.value.setProps(d(t))},p=()=>{!i.value||!t.content||i.value.setContent(u(t.content))},m=e=>{var t;(t=i.value)==null||t.setContent(u(e))},h=e=>{var t;(t=i.value)==null||t.setProps(d(e))},g=()=>{var e;i.value&&=(i.value.destroy(),void 0),s=null,(e=o.value)==null||e.unmount(),o.value=void 0},_=()=>{var e;(e=i.value)==null||e.show()},v=()=>{var e;(e=i.value)==null||e.hide()},y=()=>{var e;(e=i.value)==null||e.disable(),a.value.isEnabled=!1},b=()=>{var e;(e=i.value)==null||e.enable(),a.value.isEnabled=!0},x=()=>{var e;(e=i.value)==null||e.unmount()},S=()=>{if(!e)return;let n=on(e)?e.value:e;typeof n==`function`&&(n=n()),ITe(n)&&(n=n.$el),n&&(i.value=mp(n,d(t)),n.$tippy=C)},C={tippy:i,refresh:f,refreshContent:p,setContent:m,setProps:h,destroy:g,hide:v,show:_,disable:y,enable:b,unmount:x,mount:S,state:a};return n.mount&&(r?r.isMounted?S():sr(S):S()),r&&lr(()=>{g()}),on(t)||Qt(t)?Rn(t,f,{immediate:!1}):on(t.content)&&Rn(t.content,p,{immediate:!1}),C}function RTe(e){return typeof e==`function`?e():z(e)}function zTe(e){let t=RTe(e);return t?.$el??t}var _p=$n({props:{to:{type:[String,Function]},tag:{type:[String,Object],default:`span`},contentTag:{type:[String,Object],default:`span`},contentClass:{type:String,default:null},appendTo:{default:()=>mp.defaultProps.appendTo},aria:{default:()=>mp.defaultProps.aria},delay:{default:()=>mp.defaultProps.delay},duration:{default:()=>mp.defaultProps.duration},getReferenceClientRect:{default:()=>mp.defaultProps.getReferenceClientRect},hideOnClick:{type:[Boolean,String],default:()=>mp.defaultProps.hideOnClick},ignoreAttributes:{type:Boolean,default:()=>mp.defaultProps.ignoreAttributes},interactive:{type:Boolean,default:()=>mp.defaultProps.interactive},interactiveBorder:{default:()=>mp.defaultProps.interactiveBorder},interactiveDebounce:{default:()=>mp.defaultProps.interactiveDebounce},moveTransition:{default:()=>mp.defaultProps.moveTransition},offset:{default:()=>mp.defaultProps.offset},onAfterUpdate:{default:()=>mp.defaultProps.onAfterUpdate},onBeforeUpdate:{default:()=>mp.defaultProps.onBeforeUpdate},onCreate:{default:()=>mp.defaultProps.onCreate},onDestroy:{default:()=>mp.defaultProps.onDestroy},onHidden:{default:()=>mp.defaultProps.onHidden},onHide:{default:()=>mp.defaultProps.onHide},onMount:{default:()=>mp.defaultProps.onMount},onShow:{default:()=>mp.defaultProps.onShow},onShown:{default:()=>mp.defaultProps.onShown},onTrigger:{default:()=>mp.defaultProps.onTrigger},onUntrigger:{default:()=>mp.defaultProps.onUntrigger},onClickOutside:{default:()=>mp.defaultProps.onClickOutside},placement:{default:()=>mp.defaultProps.placement},plugins:{default:()=>mp.defaultProps.plugins},popperOptions:{default:()=>mp.defaultProps.popperOptions},render:{default:()=>mp.defaultProps.render},showOnCreate:{type:Boolean,default:()=>mp.defaultProps.showOnCreate},touch:{type:[Boolean,String,Array],default:()=>mp.defaultProps.touch},trigger:{default:()=>mp.defaultProps.trigger},triggerTarget:{default:()=>mp.defaultProps.triggerTarget},animateFill:{type:Boolean,default:()=>mp.defaultProps.animateFill},followCursor:{type:[Boolean,String],default:()=>mp.defaultProps.followCursor},inlinePositioning:{type:Boolean,default:()=>mp.defaultProps.inlinePositioning},sticky:{type:[Boolean,String],default:()=>mp.defaultProps.sticky},allowHTML:{type:Boolean,default:()=>mp.defaultProps.allowHTML},animation:{default:()=>mp.defaultProps.animation},arrow:{default:()=>mp.defaultProps.arrow},content:{default:()=>mp.defaultProps.content},inertia:{default:()=>mp.defaultProps.inertia},maxWidth:{default:()=>mp.defaultProps.maxWidth},role:{default:()=>mp.defaultProps.role},theme:{default:()=>mp.defaultProps.theme},zIndex:{default:()=>mp.defaultProps.zIndex}},emits:[`state`],setup(e,{slots:t,emit:n,expose:r}){let i=sn(),a=sn(),o=sn(),s=sn(!1),l=()=>{let t={...e};for(let e of[`to`,`tag`,`contentTag`,`contentClass`])t.hasOwnProperty(e)&&delete t[e];return t},u=()=>zTe(i);e.to&&(typeof Element<`u`&&e.to instanceof Element?u=()=>e.to:e.to===`parent`?u=()=>{let e=i.value;return e||=i.value=a.value.parentElement,e}:(typeof e.to==`string`||e.to instanceof String)&&(u=()=>document.querySelector(e.to)));let d=LTe(u,l()),f=t.content;!f&&e.to===`parent`&&(f=t.default),sr(()=>{s.value=!0,Dn(()=>{f&&d.setContent(()=>o.value)})}),Rn(d.state,()=>{n(`state`,z(d.state))},{immediate:!0,deep:!0}),Rn(()=>e,()=>{d.setProps(l()),f&&d.setContent(()=>o.value)},{deep:!0});let p=Jt({elem:i,contentElem:o,mounted:s,...d});return r(p),()=>{let n=(e.contentTag,e.contentTag),r=f?U(n,{ref:o,style:{display:s.value?`inherit`:`none`},class:e.contentClass},f(p)):null;if(e.to===`parent`){let e=[];if(!i.value){let t=U(`span`,{ref:a,"data-v-tippy":``,style:{display:`none`}});e.push(t)}return r&&e.push(r),e}let l=t.default?t.default(p):[];if(!e.tag){let e=U(l[0],{ref:i,"data-v-tippy":``});return r?[e,r]:e}return U((e.tag,e.tag),{ref:i,"data-v-tippy":``},r?[l,r]:l)}}}),BTe=[`a11y`,`allowHTML`,`arrow`,`flip`,`flipOnUpdate`,`hideOnClick`,`ignoreAttributes`,`inertia`,`interactive`,`lazy`,`multiple`,`showOnInit`,`touch`,`touchHold`],VTe={};Object.keys(mp.defaultProps).forEach(e=>{BTe.includes(e)?VTe[e]={type:Boolean,default:function(){return mp.defaultProps[e]}}:VTe[e]={default:function(){return mp.defaultProps[e]}}});var vp={mounted(e,t,n){let r=typeof t.value==`string`?{content:t.value}:t.value||{},i=Object.keys(t.modifiers||{}),a=i.find(e=>e!==`arrow`),o=i.findIndex(e=>e===`arrow`)!==-1;a&&(r.placement=r.placement||a),o&&(r.arrow=r.arrow===void 0?!0:r.arrow),n.props&&n.props.onTippyShow&&(r.onShow=function(...e){return n.props?.onTippyShow(...e)}),n.props&&n.props.onTippyShown&&(r.onShown=function(...e){return n.props?.onTippyShown(...e)}),n.props&&n.props.onTippyHidden&&(r.onHidden=function(...e){return n.props?.onTippyHidden(...e)}),n.props&&n.props.onTippyHide&&(r.onHide=function(...e){return n.props?.onTippyHide(...e)}),n.props&&n.props.onTippyMount&&(r.onMount=function(...e){return n.props?.onTippyMount(...e)}),e.getAttribute(`title`)&&!r.content&&(r.content=e.getAttribute(`title`),e.removeAttribute(`title`)),e.getAttribute(`content`)&&!r.content&&(r.content=e.getAttribute(`content`)),LTe(e,r)},unmounted(e){e.$tippy?e.$tippy.destroy():e._tippy&&e._tippy.destroy()},updated(e,t){let n=typeof t.value==`string`?{content:t.value}:t.value||{};n.content||=null,e.getAttribute(`title`)&&!n.content&&(n.content=e.getAttribute(`title`),e.removeAttribute(`title`)),e.getAttribute(`content`)&&!n.content&&(n.content=e.getAttribute(`content`)),e.$tippy?e.$tippy.setProps(n||{}):e._tippy&&e._tippy.setProps(n||{})}},HTe=mp.setDefaultProps;HTe({ignoreAttributes:!0,plugins:[PTe,MTe,ATe,TTe]});var UTe=e=>e?e.startsWith(`image/`):!1,WTe=e=>e?URL.createObjectURL(e):``,GTe=e=>e&&(e.name.split(`.`).pop()||e.type?.split(`/`).pop())||``,KTe=e=>{if(!e)return``;let t=e.size,n=[`B`,`KB`,`M`,`GB`],r=Math.floor(Math.log2(t)/10);return`${(t/1024**r).toFixed(2)} ${n[r]}`},yp=(e,t,n)=>e<1?``:n?`${e} files were not uploaded; they may exceed ${t} MB or the upload count limit.`:`有 ${e} 个文件未上传,可能文件超过 ${t} MB或超出上传个数`;function bp(e){if(!e)return!1;let t=e.charCodeAt(0);return t>=19968&&t<=40959}function qTe(e,t){let n=t+2;if(n<e.length){let t=e[n];if(bp(t))return!1;if(t===`
|
|
239
239
|
`)return!0;if(t===` `){let t=n+1;for(;t<e.length&&e[t]===` `;)t++;if(t<e.length&&bp(e[t]))return!1}}let r=t-1;for(;r>=0&&e[r]===` `;)r--;return r<0||e[r]===`
|
|
240
240
|
`?!0:JTe(e,n)}function JTe(e,t){if(t>=e.length){let n=t-1;if(n>=0){let t=e[n-1];if(t===` `||t===`:`||t===`:`){let t=n-1;for(;t>=0&&e[t]===` `;)t--;if(t>=0&&bp(e[t]))return!1}}return!0}let n=e[t];if(bp(n))return!1;if(n===` `||n===`
|
|
241
241
|
`){let n=-1;for(let r=t+1;r<e.length;r++){if(e[r]===`$`){if(r>0&&e[r-1]===`\\`)continue;n=r;break}if(e[r]===`
|
|
@@ -3495,5 +3495,5 @@ Use Shift + Enter to enter a new line`:`输入 "/" 唤出 Skill
|
|
|
3495
3495
|
/>
|
|
3496
3496
|
</template> `),H(`span`,{class:xe([`ai-reasoning-message-title-icon collapsed-icon`,{"is-collapsed":n.value}])},[Xr(z(Rp))],2)],2),Nn(H(`div`,CXt,[e.status===z(kp).Error?(B(),Kr(OUt,{key:0,content:e.content?.join(`
|
|
3497
3497
|
`)||``},null,8,[`content`])):(B(!0),V(Rr,{key:1},fr(Array.isArray(e.content)?e.content:[e.content],e=>(B(),Kr(b9,{key:e,content:e},null,8,[`content`]))),128))],512),[[Ti,!n.value]])]))}}),TXt={class:`ai-key-value-content`},EXt={key:0,class:`ai-key-value-title`},DXt={class:`ai-key-value-content`},OXt={class:`item-key`},kXt={class:`item-value`},AXt=$n({__name:`key-value-content`,props:{content:{},title:{}},setup(e){return(t,n)=>(B(),V(`div`,TXt,[e.title?(B(),V(`div`,EXt,[Xr(z(bDe)),$r(` `+ke(e.title),1)])):ei(`v-if`,!0),H(`div`,DXt,[(B(!0),V(Rr,null,fr(e.content,e=>(B(),V(`div`,{key:e.key,class:`key-value-item`},[H(`div`,OXt,ke(e.key),1),n[0]||=$r(` : `,-1),H(`div`,kXt,ke(e.value),1)]))),128))])]))}}),jXt={class:`ai-text-content`},MXt=$n({__name:`text-content`,props:{content:{}},setup(e){return(t,n)=>(B(),V(`div`,jXt,ke(e.content),1))}}),NXt={class:`ai-user-message`},PXt={key:0,class:`ai-user-message-binary-files`},FXt={key:1,class:`ai-user-message-content`},IXt={class:`user-edit-footer`},LXt=$n({__name:`user-message`,props:{content:{},id:{},messageId:{},name:{},onAction:{type:Function},property:{},role:{},status:{},tippyOptions:{},uid:{},messageToolsStatus:{},onInputConfirm:{type:Function},onShortcutConfirm:{type:Function}},setup(e){let t=e,n=hOe(),{copy:r}=Gp(),i=cn(!1),a=cn(``),o=er(`chatInputRef`),s=pi(()=>{let e=t.property?.extra?.cite;if(!(!e||typeof e==`string`))return e.title}),l=pi(()=>{let e=t.property?.extra?.cite;return!e||typeof e==`string`?e:e.data}),u=pi(()=>{if(!t.property?.extra)return null;let{extra:e}=t.property,{shortcut:n,cite:r,context:i}=e||{};if(n)return n;if(r&&typeof r==`object`&&r.data?.length){let e=[];for(let t of r.data){let n=i?.find(e=>e.__label===t.key);n?.__key&&e.push({formItemProps:{label:n.__label,required:!!n.fillBack},props:{default:n.__value},key:n.__key,type:`textarea`})}return{components:e,name:r.title}}return null}),d=e=>!!e.url||UTe(e.mimeType||e.file?.type),f=pi(()=>Array.isArray(t.content)?t.content?.filter(e=>e.type===Dp.Binary):[]),p=pi(()=>f.value.filter(e=>d(e))),m=pi(()=>f.value.filter(e=>!d(e))),h=pi(()=>t.content?typeof t.content==`string`?[t.content]:t.content.filter(e=>e.type===Dp.Text&&!!e.text?.trim()).map(e=>e.text):[]),g=async e=>{e.id===`edit`?(h.value.length&&(a.value=h.value[0]??``,i.value=!0),f.value.length&&(i.value=!0)):e.id===`copy`&&r(typeof t.content==`string`?t.content:JSON.stringify(t.content||``)),await t.onAction?.(e)},_=async()=>{await o.value?.triggerSendMessage?.(),i.value=!1},v=()=>{i.value=!1},y=()=>{i.value=!1},b=async e=>{t.onShortcutConfirm?.(e),i.value=!1},x=async(e,n)=>{t.onInputConfirm?.(e,n),i.value=!1};return(t,r)=>(B(),V(`div`,NXt,[l.value&&typeof l.value==`string`?(B(),Kr(rGt,{key:0,class:`ai-user-message-cite`,content:l.value},null,8,[`content`])):ei(`v-if`,!0),ei(` 非编辑状态 `),i.value?(B(),V(Rr,{key:2},[ei(` 编辑状态 `),u.value?(B(),Kr(QDe,ii({key:0},u.value,{class:`user-shortcut-render`,onClose:y,onSubmit:b}),null,16)):(B(),Kr(kKt,{key:1,ref_key:`chatInputRef`,ref:o,modelValue:a.value,"onUpdate:modelValue":r[0]||=e=>a.value=e,class:`user-edit-input`,"default-upload-files":f.value,"on-send-message":x,"support-upload":z(n)?.supportUpload.value??!1},{"send-icon":Mn(()=>[H(`div`,IXt,[Xr(z(tu),{size:`small`,onClick:v},{default:Mn(()=>[$r(ke(z(wp)(`取消`)),1)]),_:1}),Xr(z(tu),{size:`small`,theme:`primary`,onClick:_},{default:Mn(()=>[$r(ke(z(wp)(`发送`)),1)]),_:1})])]),_:1},8,[`modelValue`,`default-upload-files`,`support-upload`]))],64)):(B(),V(Rr,{key:1},[f.value.length?(B(),V(Rr,{key:0},[p.value.length?(B(),V(`div`,PXt,[Xr(PGt,{files:p.value,readonly:!0},null,8,[`files`])])):ei(`v-if`,!0),(B(!0),V(Rr,null,fr(m.value,(e,t)=>(B(),V(`div`,{key:e.url??t,class:`ai-user-message-binary-files`},[Xr(PGt,{files:[e],readonly:!0},null,8,[`files`])]))),128))],64)):ei(`v-if`,!0),l.value||h.value.length?(B(),V(`div`,FXt,[Array.isArray(l.value)?(B(),V(Rr,{key:0},[ei(` property.extra.cite 是数组时,显示结构化内容 `),Xr(AXt,{content:l.value,title:s.value},null,8,[`content`,`title`])],64)):e.content?(B(),V(Rr,{key:1},[ei(` agui user message content 显示`),(B(!0),V(Rr,null,fr(h.value,(e,t)=>(B(),Kr(MXt,{key:t,content:e},null,8,[`content`]))),128))],2112)):ei(`v-if`,!0)])):ei(`v-if`,!0),e.messageToolsStatus===z(B9).Hidden?ei(`v-if`,!0):(B(),Kr(gJt,{key:2,class:`ai-user-message-tools`,"message-tools":z(xEe),"message-tools-status":e.messageToolsStatus,"on-action":g,"tippy-options":e.tippyOptions,"update-tools":[]},null,8,[`message-tools`,`message-tools-status`,`tippy-options`]))],64))]))}}),RXt=$n({__name:`message-render`,props:{messageToolsStatus:{},onInputConfirm:{type:Function},onShortcutConfirm:{type:Function},onAction:{type:Function},tippyOptions:{},message:{},onInterruptResume:{type:Function}},setup(e){let t=e,n=vr(),r=pi(()=>{switch(t.message.role){case Op.User:return U(LXt,{...t.message,onAction:t.onAction,onInputConfirm:t.onInputConfirm,onShortcutConfirm:t.onShortcutConfirm,messageToolsStatus:t.messageToolsStatus,tippyOptions:t.tippyOptions});case Op.Assistant:return U(ZYt,t.message,{default:e=>mr(n,`default`,e,()=>[U(WUt,{content:t.message.content||``,status:t.message.status},n.codeHeader?{codeHeader:e=>n.codeHeader?.(e)}:void 0)])});case Op.Info:return U(eXt,t.message);case Op.Reasoning:return U(wXt,t.message);case Op.Tool:return U(BYt,t.message);case Op.Activity:return U(MYt,{...t.message,onInterruptResume:t.onInterruptResume});case Op.Interrupt:return U(_Xt,{...t.message,onInterruptResume:t.onInterruptResume},n.answeredQuestion?{answeredQuestion:e=>n.answeredQuestion?.(e)}:void 0);case Op.Loading:return U(yXt,t.message);default:return null}});return(e,t)=>(B(),Kr(ur(r.value)))}}),zXt=[`id`,`onMouseenter`,`onMouseleave`],BXt={class:`ai-message-fixed-bottom`},VXt=$n({__name:`message-container`,props:br({enableSelection:{type:Boolean,default:!1},messageGroups:{},messages:{},messageStatus:{},messageTools:{},messageToolsStatus:{},messageToolsTippyOptions:{},onAgentAction:{},onAgentFeedback:{},onInterruptResume:{},onUserAction:{},renderMode:{},updateTools:{},onUserInputConfirm:{},onUserShortcutConfirm:{}},{selectedUserMessages:{required:!1},selectedUserMessagesModifiers:{}}),emits:br([`stopStreaming`],[`update:selectedUserMessages`]),setup(e){let t=e,n=Or(e,`selectedUserMessages`),r=er(`messageContainerRef`),i=er(`messageContainerBottomRef`),{jumpToBottom:a,toScrollBottom:o,debouncedShowScrollBottomBtn:s}=oOe(r,i);sr(()=>{t.messageGroups?.length&&(a(),requestAnimationFrame(()=>a()))});let{copy:l}=Gp(),u=(e,t)=>{if(!t?.length)return e;let n=e.map(e=>{let n=t.find(t=>t.id===e.id);return n?{...e,...n}:e}),r=t.filter(t=>!e.some(e=>e.id===t.id));return[...n,...r].filter(e=>!e.hidden)},d=pi(()=>u(bEe,t.messageTools).filter(e=>t.renderMode!==Mp.Test||e.id!==`share`)),f=pi(()=>u(SEe,t.updateTools)),p=pi(()=>t.renderMode===Mp.Share?t.messageGroups.filter(e=>e.type!==Op.Loading):t.messageGroups),m=e=>{e.messages?.at(-1)?.role!==Op.Interrupt&&(e.isHover=!0)},h=(e,t)=>{let n=t.toElement??t.relatedTarget;n instanceof Element&&n.classList.contains(`ai-user-feedback`)||(e.isHover=!1)},g=(e,r)=>{let i=e.type===Op.User;t.messageGroups?.forEach((n,a)=>{if(n===e){n.checked=r;let e=i?t.messageGroups.at(a+1):t.messageGroups.at(a-1);e&&(e.checked=r)}}),n.value=t.messageGroups?.filter(e=>e.checked).map(e=>e.messages).flat()},_=async(e,n)=>(e.id===`copy`&&l(n.filter(e=>e.role!==Op.Reasoning).map(e=>typeof e.content==`string`?e.content:JSON.stringify(e.content||``)).join(`
|
|
3498
|
-
`)),t.onAgentAction?.(e,n)),v=async(e,n)=>{t.onUserAction?.(e,n)},y=async(e,n,r)=>{t.onUserInputConfirm?.(e,n,r)},b=async(e,n)=>{t.onUserShortcutConfirm?.(e,n)};return(n,a)=>(B(),V(`div`,{ref_key:`messageContainerRef`,ref:r,class:`ai-message-container`},[(B(!0),V(Rr,null,fr(p.value,(r,i)=>(B(),V(`div`,{id:r.uid,key:i,class:`message-group`,style:ge({backgroundColor:r.checked?`#f5f7fa`:`transparent`}),onMouseenter:e=>m(r),onMouseleave:e=>h(r,e)},[mr(n.$slots,`group`,ii({ref_for:!0},{group:r}),()=>[e.enableSelection&&r.type!==z(Op).Loading?(B(),Kr(z(yu),{key:0,class:`message-group-checkbox`,"model-value":r.checked,"onUpdate:modelValue":e=>g(r,e)},null,8,[`model-value`,`onUpdate:modelValue`])):ei(`v-if`,!0),H(`div`,{class:xe([`message-group-messages`,{"message-group-enabled-selection":e.renderMode===z(Mp).Share||e.enableSelection&&r.type!==z(Op).Loading}]),style:ge({width:e.enableSelection&&r.type!==z(Op).Loading?`calc(100% - 16px)`:`100%`})},[(B(!0),V(Rr,null,fr(r.messages,(r,i)=>mr(n.$slots,`default`,ii({key:i,ref_for:!0},{message:r,messageToolsStatus:e.messageToolsStatus,onInterruptResume:t.onInterruptResume}),()=>[(B(),Kr(RXt,{key:i,message:r,"message-tools-status":e.messageToolsStatus,"on-action":e=>v(e,r),"on-input-confirm":(e,t)=>y(r,e,t),"on-interrupt-resume":t.onInterruptResume,"on-shortcut-confirm":e=>b(r,e),"tippy-options":e.messageToolsTippyOptions},pr({_:2},[n.$slots.answeredQuestion?{name:`answeredQuestion`,fn:Mn(e=>[mr(n.$slots,`answeredQuestion`,ii({ref_for:!0},e))]),key:`0`}:void 0]),1032,[`message`,`message-tools-status`,`on-action`,`on-input-confirm`,`on-interrupt-resume`,`on-shortcut-confirm`,`tippy-options`]))])),128)),e.renderMode!==z(Mp).Share&&!(e.enableSelection&&r.type!==z(Op).Loading)&&!r.pause&&r.type===z(Op).Assistant&&e.messageToolsStatus!==z(B9).Hidden?(B(),Kr(gJt,{key:0,"message-tools":d.value,"message-tools-status":e.messageToolsStatus,"on-action":e=>_(e,r.messages),style:ge({visibility:r.isHover?`visible`:`hidden`}),"tippy-options":t.messageToolsTippyOptions,"update-tools":f.value,onFeedback:(e,n,i)=>t.onAgentFeedback?.(e,r.messages,n,i)},null,8,[`message-tools`,`message-tools-status`,`on-action`,`style`,`tippy-options`,`update-tools`,`onFeedback`])):ei(`v-if`,!0)],6)])],44,zXt))),128)),H(`div`,{ref_key:`messageContainerBottomRef`,ref:i,class:`message-container-bottom`,tabindex:`0`},null,512),H(`div`,BXt,[Nn(Xr(jDe,{loading:e.messageStatus===z(kp).StopLoading,title:e.messageStatus===z(kp).StopLoading?z(wp)(`正在停止`):z(wp)(`停止生成`),onClick:a[0]||=e=>n.$emit(`stopStreaming`)},{icon:Mn(()=>[Xr(z(aDe))]),_:1},8,[`loading`,`title`]),[[Ti,e.renderMode!==z(Mp).Share&&(e.messageStatus===z(kp).Streaming||e.messageStatus===z(kp).StopLoading||e.messageStatus===z(kp).Fetching||e.messageStatus===z(kp).Pending)]]),Nn(Xr(jDe,{title:z(wp)(`返回底部`),onClick:a[1]||=()=>z(o)(`smooth`)},{icon:Mn(()=>[Xr(z(SDe))]),_:1},8,[`title`]),[[Ti,z(s)]])])],512))}}),HXt={class:`ai-execution-summary`},UXt={class:`ai-execution-summary-header`},WXt={class:`ai-execution-summary-content`},GXt=[`onMouseenter`],KXt={class:`content-item-header`},qXt={class:`content-item-title`},JXt={class:`content-item-messages`},YXt={key:0,class:`timeline-line`},XXt={key:1,class:`ai-execution-summary-content-empty`},ZXt={class:`ai-execution-summary-content-empty-text`},QXt=$n({__name:`execution-summary`,props:{messageGroups:{}},emits:[`locateMessageGroup`,`updateKeyword`],setup(e,{emit:t}){let n=t,r=Jp(),{keyword:i}=DOe(),a=cn(void 0),o=e=>{if(!e)return``;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`},s=e=>{n(`locateMessageGroup`,e.uid,e)},l=()=>{i.value=``,n(`updateKeyword`,``)};return(t,u)=>(B(),V(`div`,HXt,[H(`div`,UXt,[Xr(z(fu),{modelValue:z(i),"onUpdate:modelValue":[u[0]||=e=>on(i)?i.value=e:null,u[1]||=e=>n(`updateKeyword`,e)],class:`ai-execution-summary-header-input`,clearable:``,placeholder:z(wp)(`搜索 关键字`)},null,8,[`modelValue`,`placeholder`])]),H(`div`,WXt,[e.messageGroups.length?(B(!0),V(Rr,{key:0},fr(e.messageGroups,(t,n)=>(B(),V(`div`,{key:t.uid,class:`ai-execution-summary-content-item`,onMouseenter:e=>a.value=t.uid,onMouseleave:u[2]||=e=>a.value=void 0},[H(`div`,KXt,[u[3]||=H(`span`,{class:`timeline-dot`},null,-1),Nn((B(),V(`span`,qXt,[$r(ke(typeof t.userMessageTitle==`number`?o(t.userMessageTitle):t.userMessageTitle),1)])),[[z(Yp),{...z(r)}]]),Nn(Xr(z(tu),{class:`content-item-locate`,text:``,theme:`primary`,onClick:e=>s(t)},{default:Mn(()=>[$r(ke(z(wp)(`在对话中定位`)),1)]),_:1},8,[`onClick`]),[[Ti,a.value===t.uid]])]),H(`div`,JXt,[(B(!0),V(Rr,null,fr(t.messages,(e,t)=>(B(),Kr(RXt,{key:t,message:e},null,8,[`message`]))),128))]),n<e.messageGroups.length-1?(B(),V(`div`,YXt)):ei(`v-if`,!0)],40,GXt))),128)):(B(),V(`div`,XXt,[Xr(z(rd),{class:`empty-exception`,type:`empty`}),H(`div`,ZXt,[$r(ke(z(i)?z(wp)(`搜索结果为空`):z(wp)(`暂无数据`))+` `,1),z(i)?(B(),Kr(z(tu),{key:0,text:``,theme:`primary`,onClick:l},{default:Mn(()=>[$r(ke(z(wp)(`清空搜索`)),1)]),_:1})):ei(`v-if`,!0)])]))])]))}}),$Xt={class:`ai-selection-footer`},eZt={class:`ai-selection-footer-left`},tZt={class:`select-all-text`},nZt={class:`ai-selection-footer-right`},rZt=$n({__name:`selection-footer`,props:{isAllSelected:{type:Boolean},loading:{type:Boolean},selectedCount:{}},emits:[`cancel`,`confirm`,`toggle-all`],setup(e,{emit:t}){let n=t;return(t,r)=>(B(),V(`div`,$Xt,[H(`div`,eZt,[Xr(z(yu),{"model-value":e.isAllSelected,"onUpdate:modelValue":r[0]||=e=>n(`toggle-all`,e)},null,8,[`model-value`]),H(`span`,tZt,ke(z(wp)(`全选`)),1)]),H(`div`,nZt,[Xr(z(tu),{disabled:e.loading,onClick:r[1]||=e=>n(`cancel`)},{default:Mn(()=>[$r(ke(z(wp)(`取消`)),1)]),_:1},8,[`disabled`]),Xr(z(tu),{disabled:e.selectedCount===0,loading:e.loading,theme:`primary`,onClick:r[2]||=e=>n(`confirm`)},{default:Mn(()=>[$r(ke(z(wp)(`确定`)),1)]),_:1},8,[`disabled`,`loading`])])]))}}),iZt=[`data-ai-size`],aZt={key:0,class:`ai-chat-container-loading`},oZt={class:`screen-wrapper`},sZt={key:1,class:`ai-welcome-content`},cZt={class:`ai-welcome-title`},lZt={key:0,class:`ai-welcome-remark`},uZt=$n({__name:`chat-container`,props:br({chatLoading:{type:Boolean},commonTippyOptions:{},executionTabVisible:{type:Boolean,default:!0},getSideRenderComponent:{},getSideTabRenderComponent:{},onArtifactClick:{},onCustomTabChange:{},openingRemark:{},placement:{default:`left`},resizeProps:{},size:{default:`small`},welcomeTitle:{},defaultUploadFiles:{},inputMaxHeight:{},messageStatus:{},models:{},modelValue:{},onSendMessage:{},onStopSending:{},onUpload:{},placeholder:{},prompts:{},resources:{},sendDisabledTip:{},shortcutId:{},shortcuts:{},skills:{},supportUpload:{type:Boolean},tippyOptions:{},messages:{},messageTools:{},messageToolsStatus:{},onAgentAction:{},onAgentFeedback:{},onInterruptResume:{},onUserAction:{},renderMode:{},updateTools:{},onUserInputConfirm:{},onUserShortcutConfirm:{}},{renderMode:{required:!1,default:Mp.Chat},renderModeModifiers:{},selectedShortcut:{required:!1},selectedShortcutModifiers:{},cite:{required:!1,default:``},citeModifiers:{},selectedModel:{required:!1},selectedModelModifiers:{}}),emits:br([`selectShortcut`,`deleteShortcut`,`update:modelValue`,`modelChange`,`stopStreaming`,`shortcutClose`,`shortcutSubmit`,`confirmShare`,`collapseChange`],[`update:renderMode`,`update:selectedShortcut`,`update:cite`,`update:selectedModel`]),setup(e,{expose:t,emit:n}){let r=hxe.TabPanel,i=e,a=Or(e,`renderMode`),o=er(`fullScreenRef`),{isFullScreen:s,enter:l,exit:u}=fOe(o);OOe({renderMode:a});let d=pi(()=>({collapsible:!1,immediate:!0,min:400,...i.resizeProps,placement:i.placement})),f=pi(()=>i.getSideRenderComponent?.(U,y.value.data?.props??{})??y.value.data?.component);mOe({size:pi(()=>i.size??`small`),supportUpload:pi(()=>i.supportUpload??!1)}),Rn(()=>i.size??`small`,e=>{typeof document<`u`&&(document.body.dataset.aiSize=e)},{immediate:!0});let p=Or(e,`selectedShortcut`),m=Or(e,`cite`),h=Or(e,`selectedModel`),g=n;AOe({tippyOptions:pi(()=>i.commonTippyOptions??{})});let{displayTabs:_,tabs:v,selectedTab:y,isCollapse:b,addCustomTab:x,ensureCustomTab:S,removeCustomTab:C,selectCustomTab:w,resetCustomTab:T}=uOe({executionTabVisible:()=>i.executionTabVisible,onTabChange:async e=>{if(e.name===`file-artifact`)return;let t=y.value.data?.props||{loading:!0,data:{}};y.value.data={...y.value.data,props:t};let n=await i.onCustomTabChange?.(e);y.value.data={...y.value.data,props:{...t,loading:!1,data:n}}}}),E=()=>{S({closable:!1,label:wp(`文件产物`),name:Up,order:-1})},D=cn(``),O=sn([]),k=cn(),A=cn((()=>{let e=i.resizeProps?.initialDivide;return typeof e==`number`?e:400})()),j=pi(()=>`calc(100% - ${A.value}px)`),{messageGroups:M,executionGroups:N,sessionArtifacts:P,isShareMode:F,isAllSelected:I,onToggleShareAll:L,onCancelShare:R,onConfirmShare:ee,pendingApprovalTipText:te,activeUserQuestionInterrupt:ne}=COe({keyword:D,messages:pi(()=>i.messages),renderMode:pi(()=>a.value),selectedUserMessages:O}),re=pi(()=>v.value.some(e=>e.name===Up)),{activeArtifactId:ie,setActiveArtifactId:ae}=tOe({getOnArtifactClick:()=>i.onArtifactClick,onOpen:()=>{x({closable:!1,label:wp(`文件产物`),name:Up,order:-1})}});Rn(P,e=>{if(!e.length){C(Up),ae(``);return}E(),e.some(e=>e.outputId===ie.value)||ae(e[0].outputId)},{immediate:!0}),Rn(b,e=>{e&&(D.value=``,A.value=0),g(`collapseChange`,e,A.value)}),Rn(()=>N.value,e=>{!e.length&&!D.value&&!re.value&&T()},{immediate:!0,deep:!1});let oe=pi(()=>i.messageStatus===kp.StopLoading?kp.StopLoading:M.value?.some(e=>e.messages.some(e=>e.id===`__loading__`))?kp.Fetching:i.messageStatus),se=()=>{p.value=null,g(`shortcutClose`)},ce=e=>{g(`shortcutSubmit`,e)},le=()=>{g(`deleteShortcut`)},ue=e=>{g(`selectShortcut`,e)},de=(e,t)=>{g(`update:modelValue`,e,t)},fe=async(e,t)=>{let n=ne.value;return i.onSendMessage?.(e,t,n?{payload:xqt(n),interrupt:n}:void 0)},pe=()=>{b.value=!b.value},me=e=>{if(!e)return;let t=document.getElementById(e);if(!t){let t=M.value.find(t=>t.messages.some(t=>t.uid===e));t&&document.getElementById(t.uid)?.scrollIntoView({behavior:`smooth`});return}t.scrollIntoView({behavior:`smooth`})},he=e=>e===`execution`?BEe:e===`file-artifact`?JEe:VEe,_e=e=>{w(v.value.find(t=>t.name===e))},ve=e=>{D.value=e},ye=async(e,t)=>{if(e.id===`share`||e.triggerSelection){k.value=e,F.value=!0;return}return i.onAgentAction?.(e,t)},be=()=>{g(`confirmShare`,ee(),k.value),Dn(()=>{F.value=!1,O.value=[],k.value=void 0})},Ce=()=>{R(),k.value=void 0},we=e=>{A.value=e};return lr(()=>{T(),typeof document<`u`&&delete document.body.dataset.aiSize}),t({selectedTab:y,addCustomTab:x,removeCustomTab:C,selectCustomTab:w,enterShareMode:()=>{F.value=!0},exitShareMode:()=>{Ce()}}),(t,n)=>(B(),V(`div`,{class:`ai-chat-container`,"data-ai-size":e.size,style:ge({"--resize-main-width":j.value,borderTopColor:z(b)?`transparent`:`#eaebf0`})},[e.chatLoading?(B(),V(`div`,aZt,[Xr(UKt)])):(B(),Kr(z(exe),ii({key:1,class:[`ai-chat-container-resize-layout`,{"ai-is-collapse":z(b)||z(_).length>0&&!D.value?.length&&z(N)?.length<1&&!re.value}]},d.value,{onResizing:we}),{aside:Mn(()=>[!z(b)&&z(_).length>0&&(z(N)?.length||D.value?.length||re.value)?(B(),V(`div`,{key:0,ref_key:`fullScreenRef`,ref:o,class:`ai-full-screen-wrapper`},[Xr(z(hxe),{active:z(y).name,class:`ai-chat-container-tab`,"label-height":40,type:`unborder-card`,onChange:_e},{setting:Mn(()=>[H(`div`,oZt,[Xr(Xp,{class:`screen-btn`,"tippy-options":{...e.commonTippyOptions,appendTo:z(s)?o.value:e.commonTippyOptions?.appendTo,content:z(s)?z(wp)(`退出全屏`):z(wp)(`全屏`)}},{default:Mn(()=>[z(s)?(B(),Kr(z(wDe),{key:1,onClick:z(u)},null,8,[`onClick`])):(B(),Kr(z(CDe),{key:0,onClick:z(l)},null,8,[`onClick`]))]),_:1},8,[`tippy-options`])])]),default:Mn(()=>[(B(!0),V(Rr,null,fr(z(_),t=>(B(),Kr(z(r),{key:t.name,class:`ai-chat-container-tab-panel`,label:()=>U(`div`,{class:`ai-execution-summary-label`,onVnodeMounted:e=>{z(y).name===t.name&&e.el?.scrollIntoView({behavior:`smooth`})}},e.getSideTabRenderComponent?.(U,t,{removeCustomTab:z(C)})??[U(he(t.name),{class:`ai-execution-summary-icon`}),Nn(U(`span`,{class:`ai-execution-summary-label-text`},t.label??``),[[z(Yp),{...e.commonTippyOptions,text:t.label??``}]]),t.closable!==!1&&t.name!==z(`execution`)?U(z(zp),{class:`ai-execution-close-icon`,onClick:()=>{z(C)(t.name)}}):null]),name:t.name},null,8,[`label`,`name`]))),128))]),_:1},8,[`active`]),z(y)?.name===z(`execution`)&&e.executionTabVisible!==!1?(B(),V(Rr,{key:0},[z(b)?ei(`v-if`,!0):(B(),Kr(QXt,{key:0,"message-groups":z(N),style:{height:`calc(100% - 40px)`},onLocateMessageGroup:me,onUpdateKeyword:ve},null,8,[`message-groups`]))],64)):z(y)?.name===z(`file-artifact`)?(B(),Kr(_qt,{key:1,"active-id":z(ie),artifacts:z(P),style:{height:`calc(100% - 40px)`},onSelect:z(ae)},null,8,[`active-id`,`artifacts`,`onSelect`])):ei(`v-if`,!0),z(y)&&z(y).name!==z(`file-artifact`)?(B(),V(`div`,{key:z(y).name,class:`ai-chat-container-message-slot`},[(B(),Kr(ur(f.value),ii({key:z(y).name},z(y)?.data?.props),{locateButton:Mn(()=>[Xr(z(tu),{class:`ai-locate-button`,size:`small`,text:``,theme:`primary`,onClick:n[0]||=e=>me(z(y)?.data?.messageUid)},{default:Mn(()=>[$r(ke(z(wp)(`在对话中定位`)),1)]),_:1})]),_:1},16))])):ei(`v-if`,!0)],512)):ei(`v-if`,!0),z(_).length>0&&(z(N)?.length||re.value)?(B(),V(`div`,{key:1,class:xe([`collapse-button`,{"is-right":e.placement===`right`,"is-collapsed":z(b)}]),onClick:pe},[Xr(z(Rp))],2)):ei(`v-if`,!0)]),main:Mn(()=>[e.messages?.length?mr(t.$slots,`default`,Se(ii({key:0},{messages:e.messages,messageStatus:e.messageStatus,messageGroups:z(M),selectedUserMessages:O.value,messageToolsStatus:e.messageToolsStatus,isShareMode:z(F),commonTippyOptions:e.commonTippyOptions,handleAgentAction:ye,onAgentFeedback:e.onAgentFeedback,onInterruptResume:e.onInterruptResume,onUserAction:e.onUserAction,onUserInputConfirm:e.onUserInputConfirm,onUserShortcutConfirm:e.onUserShortcutConfirm})),()=>[e.messages?.length?(B(),Kr(VXt,{key:0,"selected-user-messages":O.value,"onUpdate:selectedUserMessages":n[1]||=e=>O.value=e,"enable-selection":z(F),"message-groups":z(M),"message-status":oe.value,"message-tools":e.messageTools,"message-tools-status":e.messageToolsStatus,"message-tools-tippy-options":e.commonTippyOptions,messages:e.messages,"on-agent-action":ye,"on-agent-feedback":e.onAgentFeedback,"on-interrupt-resume":e.onInterruptResume,"on-user-action":e.onUserAction,"on-user-input-confirm":e.onUserInputConfirm,"on-user-shortcut-confirm":e.onUserShortcutConfirm,"render-mode":a.value,"update-tools":e.updateTools,onStopStreaming:n[2]||=e=>g(`stopStreaming`)},{group:Mn(({group:e})=>[mr(t.$slots,`group`,Se(Zr({group:e})))]),default:Mn(({message:e,messageToolsStatus:n,onInterruptResume:r})=>[mr(t.$slots,`message`,Se(Zr({message:e,messageToolsStatus:n,onInterruptResume:r})))]),_:3},8,[`selected-user-messages`,`enable-selection`,`message-groups`,`message-status`,`message-tools`,`message-tools-status`,`message-tools-tippy-options`,`messages`,`on-agent-feedback`,`on-interrupt-resume`,`on-user-action`,`on-user-input-confirm`,`on-user-shortcut-confirm`,`render-mode`,`update-tools`])):ei(`v-if`,!0)]):(B(),V(`div`,sZt,[mr(t.$slots,`welcome`,Se(Zr({openingRemark:e.openingRemark,welcomeTitle:e.welcomeTitle})),()=>[Xr(z(AEe)),H(`h2`,cZt,ke(e.welcomeTitle??z(wp)(`你好,我是小鲸`)),1),e.openingRemark?(B(),V(`div`,lZt,[Xr(WUt,{content:e.openingRemark},null,8,[`content`])])):ei(`v-if`,!0)])])),a.value===z(Mp).Share?ei(`v-if`,!0):(B(),V(Rr,{key:2},[z(F)?(B(),Kr(rZt,{key:0,"is-all-selected":z(I),loading:!1,"selected-count":O.value.length,onCancel:Ce,onConfirm:be,onToggleAll:z(L)},null,8,[`is-all-selected`,`selected-count`,`onToggleAll`])):p.value?.components?.length?(B(),Kr(QDe,ii({key:1},p.value,{class:{"is-welcome-overlay":!e.messages?.length},onClose:se,onSubmit:ce}),null,16,[`class`])):(B(),Kr(kKt,{key:2,cite:m.value,"onUpdate:cite":n[3]||=e=>m.value=e,"selected-model":h.value,"onUpdate:selectedModel":n[4]||=e=>h.value=e,"message-status":oe.value,"model-value":e.modelValue,models:e.models,"on-send-message":fe,"on-stop-sending":e.onStopSending,"on-upload":e.onUpload,placeholder:e.placeholder,prompts:e.prompts,resources:e.resources,"send-disabled-tip":z(te),"shortcut-id":p.value?.id,shortcuts:e.shortcuts,skills:e.skills,"support-upload":e.supportUpload,"tippy-options":e.commonTippyOptions,onDeleteShortcut:le,onModelChange:n[5]||=e=>g(`modelChange`,e),onSelectShortcut:ue,"onUpdate:modelValue":de},{interrupt:Mn(()=>[z(ne)?(B(),Kr(z(eJt),{key:0,interrupt:z(ne),"on-resume":e.onInterruptResume},{question:Mn(({question:e,qIndex:n,answer:r,setAnswer:i,confirm:a})=>[mr(t.$slots,`interruptQuestion`,Se(Zr({question:e,qIndex:n,answer:r,setAnswer:i,confirm:a})))]),_:3},8,[`interrupt`,`on-resume`])):ei(`v-if`,!0),z(te)?(B(),Kr(MKt,{key:1,content:z(te)},null,8,[`content`])):ei(`v-if`,!0)]),_:3},8,[`cite`,`selected-model`,`message-status`,`model-value`,`models`,`on-stop-sending`,`on-upload`,`placeholder`,`prompts`,`resources`,`send-disabled-tip`,`shortcut-id`,`shortcuts`,`skills`,`support-upload`,`tippy-options`]))],64))]),_:3},16,[`class`]))],12,iZt))}}),dZt=`data:image/png;base64,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`,fZt={class:`left-section`},pZt={class:`logo`},mZt=[`src`],hZt={key:0,class:`rename-tooltip`},gZt={class:`rename-content`},_Zt={key:0,class:`tippy-dropdown-menu`},vZt={key:1,class:`bkai-icon bkai-auto-refresh-line`},yZt={class:`right-section`},bZt=Ii($n({__name:`index`,props:{title:{default:``},agentName:{default:``},sessionName:{default:``},isCompressionHeight:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},showHistoryIcon:{type:Boolean,default:!0},showNewChatIcon:{type:Boolean,default:!0},showCompressionIcon:{type:Boolean,default:!0},showMoreIcon:{type:Boolean,default:!0},enableChatSession:{type:Boolean,default:!0},hasPermission:{type:Boolean,default:!0},chatGroup:{default:()=>({enabled:!1,staff:[],username:``})},hasSessionContents:{type:Boolean},autoGenerateLoading:{type:Boolean},dropdownMenuConfig:{default:()=>({showRename:!0,showAutoGenerate:!0,showShare:!1})},sessionBusinessManager:{default:void 0},selectedLlmCode:{default:void 0},renderMode:{default:Mp.Chat}},emits:[`close`,`toggle-compression`,`new-chat`,`history-click`,`auto-generate-name`,`help-click`,`rename`,`share`,`history-session-switch`,`history-session-delete`,`history-session-rename`,`new-chat-created`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=vxe,o=sn(null),s=sn(null),l=er(`moreMenuTippyRef`),u=sn(!1),d=sn(``),f=sn(null),p=sn(!1),m=()=>document.querySelector(`.ai-blueking-panel`)||document.body,h=null,g=()=>{!s.value||!r.sessionBusinessManager||(h=OCe({triggerRef:s,sessionBusinessManager:r.sessionBusinessManager,onSessionSwitch:e=>i(`history-session-switch`,e),onSessionDelete:e=>i(`history-session-delete`,e),onSessionRename:(e,t)=>i(`history-session-rename`,e,t)}))},_=pi(()=>r.hasPermission?r.enableChatSession?r.title||`${r.agentName||``}-${r.sessionName||``}`:r.agentName:tf(`无智能体使用权限`)),v=pi(()=>r.isCompressionHeight?`bkai-morenchicun`:`bkai-yasuo`),y=pi(()=>r.isCompressionHeight?tf(`恢复默认尺寸`):tf(`缩小高度`)),b=pi(()=>r.hasPermission),x=e=>b.value?e:tf(`暂无使用权限`),S=()=>({cursor:b.value?`pointer`:`not-allowed`}),C=sn(!1),w=async()=>{if(!C.value){C.value=!0;try{if(r.sessionBusinessManager)try{let e=await r.sessionBusinessManager.createNewSession({model:r.selectedLlmCode});e&&i(`new-chat-created`,{sessionCode:e.sessionCode,sessionName:e.sessionName,createdAt:e.createdAt})}catch(e){console.error(`Failed to create new session:`,e),cd({theme:`error`,message:tf(`创建会话失败`)})}i(`new-chat`)}finally{C.value=!1}}},T=e=>{e.stopPropagation(),r.sessionBusinessManager?(h||g(),h&&h.handleTriggerClick(e)):i(`history-click`,e)},E=()=>{i(`help-click`)},D=e=>{e.stopPropagation(),h&&h.isVisible()&&h.hide(),l.value&&(p.value?l.value.hide():l.value.show())},O=()=>{l.value?.hide(),j()},k=()=>{!r.hasSessionContents||r.autoGenerateLoading||i(`auto-generate-name`)},A=()=>{r.hasSessionContents&&(l.value?.hide(),i(`share`))},j=()=>{document.removeEventListener(`click`,F),d.value=r.sessionName||``,u.value=!0,setTimeout(()=>{document.addEventListener(`click`,F)},100),setTimeout(()=>{if(f.value)try{let e=f.value;e&&typeof e.focus==`function`&&e.focus();let t=e.$el?.querySelector(`input`);t&&typeof t.select==`function`&&t.select()}catch(e){console.warn(`Failed to focus rename input:`,e)}},100)},M=()=>{let e=d.value.trim();if(!e){N();return}i(`rename`,e),u.value=!1,d.value=``},N=()=>{u.value=!1,d.value=``},P=(e,t)=>{d.value=e,t.key===`Enter`?M():t.key===`Escape`&&N()},F=e=>{if(!u.value)return;let t=e.target,n=document.querySelector(`.rename-tooltip`);n&&!n.contains(t)&&N()};return Rn(()=>r.autoGenerateLoading,(e,t)=>{t&&!e&&p.value&&l.value?.hide()}),sr(()=>{r.sessionBusinessManager&&g(),document.addEventListener(`click`,F)}),cr(()=>{h&&=(h.destroy(),null),document.removeEventListener(`click`,F)}),t({headerRef:o,historyIconRef:s}),(t,n)=>(B(),V(`div`,{ref_key:`headerRef`,ref:o,class:xe([`ai-header drag-handle`,{draggable:r.draggable}])},[H(`div`,fZt,[H(`div`,pZt,[H(`img`,{alt:`logo`,src:z(dZt)},null,8,mZt)]),H(`div`,{class:xe([`title`,{"title-with-tooltip":u.value}])},[$r(ke(_.value)+` `,1),ei(` 重命名 tooltip 直接绑定在 title 上 `),u.value?(B(),V(`div`,hZt,[H(`div`,gZt,[Xr(z(fu),{ref_key:`renameInputRef`,ref:f,modelValue:d.value,"onUpdate:modelValue":n[0]||=e=>d.value=e,class:`rename-input`,placeholder:z(tf)(`请输入新的会话名称`),onKeyup:P},null,8,[`modelValue`,`placeholder`]),H(`div`,{class:`rename-buttons`},[H(`i`,{class:`bkai-icon bkai-check-1 rename-btn confirm-btn`,onClick:M}),H(`i`,{class:`bkai-icon bkai-close rename-btn cancel-btn`,onClick:N})])])])):ei(`v-if`,!0)],2),ei(` 更多图标下拉菜单 - 使用 vue-tippy `),r.showMoreIcon&&b.value?(B(),Kr(z(_p),{key:0,ref_key:`moreMenuTippyRef`,ref:l,arrow:!1,"append-to":m,offset:[0,4],interactive:``,placement:`bottom-start`,theme:`ai-blueking-light more-menu-light light`,trigger:`manual`,onHidden:n[1]||=e=>p.value=!1,onShown:n[2]||=e=>p.value=!0},{content:Mn(()=>[p.value?(B(),V(`div`,_Zt,[r.dropdownMenuConfig?.showRename?(B(),V(`div`,{key:0,class:`tippy-menu-item`,onClick:O},[n[7]||=H(`i`,{class:`bkai-icon bkai-bianji`},null,-1),H(`span`,null,ke(z(tf)(`重命名`)),1)])):ei(`v-if`,!0),r.dropdownMenuConfig?.showAutoGenerate?Nn((B(),V(`div`,{key:1,class:xe([`tippy-menu-item`,{disabled:!r.hasSessionContents||r.autoGenerateLoading}]),onClick:k},[r.autoGenerateLoading?(B(),Kr(z(ql),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):(B(),V(`i`,vZt)),H(`span`,null,ke(z(tf)(`自动生成命名`)),1)],2)),[[z(vp),{content:r.hasSessionContents?``:z(tf)(`请先发起会话`),theme:`ai-blueking-tooltip`,arrow:!0,delay:[300,0],appendTo:m}]]):ei(`v-if`,!0),r.dropdownMenuConfig?.showShare&&r.renderMode!==z(Mp).Test?Nn((B(),V(`div`,{key:2,class:xe([`tippy-menu-item`,{disabled:!r.hasSessionContents}]),onClick:A},[n[8]||=H(`i`,{class:`bkai-icon bkai-fenxiang`},null,-1),H(`span`,null,ke(z(tf)(`分享会话`)),1)],2)),[[z(vp),{content:r.hasSessionContents?``:z(tf)(`请先发起会话`),theme:`ai-blueking-tooltip`,arrow:!0,delay:[300,0],appendTo:m}]]):ei(`v-if`,!0)])):ei(`v-if`,!0)]),default:Mn(()=>[H(`span`,{class:`bkai-icon bkai-more`,onClick:D})]),_:1},512)):ei(`v-if`,!0)]),mr(t.$slots,`headerLeft`,{},void 0,!0),H(`div`,yZt,[ei(` 新增会话按钮 `),r.showNewChatIcon&&e.enableChatSession!==!1?Nn((B(),V(`i`,{key:0,class:xe([`bkai-icon`,`bkai-xinzengliaotian`,{disabled:!b.value||C.value||!e.hasSessionContents}]),style:ge(S()),onClick:n[3]||=t=>b.value&&!C.value&&e.hasSessionContents?w():void 0},null,6)),[[z(a),{content:C.value?z(tf)(`正在创建会话...`):e.hasSessionContents?x(z(tf)(`新增会话`)):z(tf)(`当前已是新会话`),boundary:`parent`}]]):ei(`v-if`,!0),ei(` 历史会话按钮 `),r.showHistoryIcon&&e.enableChatSession!==!1?Nn((B(),V(`i`,{key:1,ref_key:`historyIconRef`,ref:s,class:xe([`bkai-icon`,`bkai-history`,{disabled:!b.value}]),style:ge(S()),onClick:n[4]||=e=>b.value?T(e):void 0},null,6)),[[z(a),{content:x(z(tf)(`历史会话`)),boundary:`parent`}]]):ei(`v-if`,!0),e.chatGroup?.enabled?Nn((B(),V(`i`,{key:2,class:`bkai-icon bkai-zhushou`,onClick:E},null,512)),[[z(a),{content:z(tf)(`转人工`),boundary:`parent`}]]):ei(`v-if`,!0),r.showCompressionIcon?Nn((B(),V(`i`,{key:3,class:xe([`bkai-icon`,v.value]),onClick:n[5]||=e=>i(`toggle-compression`)},null,2)),[[z(a),{content:y.value,boundary:`parent`}]]):ei(`v-if`,!0),Nn(H(`i`,{class:`bkai-icon bkai-close-line-2`,onClick:n[6]||=e=>i(`close`)},null,512),[[z(a),{content:z(tf)(`关闭`),boundary:`parent`}]])])],2))}}),[[`__scopeId`,`data-v-6dcebb8e`]]);function xZt(e){let t=bSe(e);fetch(t,{method:`GET`,credentials:`include`}).catch(()=>{})}async function SZt(e,t={}){let{enableModelSelect:n=!0}=t,r=[e.agent.getAgentInfo(),e.session.getSessions()];n&&typeof e.agent.getLlms==`function`&&r.push(e.agent.getLlms().catch(e=>{console.error(`[runAgentBootstrap] Failed to load models:`,e)})),await Promise.all(r);let i=e.agent.info.value?.saasUrl;i&&xZt(i)}var CZt=class{_isGenerating;_isModelsLoading;_isStopLoading;_models;_selectedLlmCode;_selectedModelName;_selectedModelSupportsVision;agentModule;config;eventEmitter;messageModule;sessionModule;hasValidSelection(){let e=this._selectedLlmCode.value;return!!e&&this._models.value.some(t=>t.llm_code===e)}isSessionPending(){return this.sessionModule!=null&&this.sessionModule.current.value==null}applySessionModel(e){let t=this._models.value;if(t.length===0){this._selectedLlmCode.value=void 0;return}if(this.isSessionPending())return;if(e&&t.some(t=>t.llm_code===e)){this._selectedLlmCode.value=e;return}if(this.hasValidSelection())return;let n=t.find(e=>e.property?.default)??t[0];this._selectedLlmCode.value=n?.llm_code}async persistSessionModel(e){let t=this.sessionModule?.current.value;if(!(!t?.sessionCode||!e)&&t.model!==e)try{await this.sessionModule.updateSession({...t,model:e})}catch(e){console.error(`[ChatBusinessManager] Failed to persist session model:`,e),this.emit(`chat-error`,{action:`persistSessionModel`,error:e})}}resolveChatModel(e){return(e??this._selectedLlmCode.value)||void 0}autoRenameSessionIfNeeded(e){let t=this.sessionModule;if(!t||this.messageModule.list.value.length!==1)return;let n=t.renameSession(e);n&&n.then(()=>{let n=(t.list.value.find(t=>t.sessionCode===e)??(t.current?.value?.sessionCode===e?t.current.value:null))?.sessionName;n&&this.config.onSessionRenamed?.(n)}).catch(e=>{console.error(`[ChatBusinessManager] Auto rename session failed:`,e)})}emit(e,t){this.eventEmitter?.emit(e,t)}constructor(e,t,n=null,r=null,i={}){this.agentModule=e,this.messageModule=t,this.sessionModule=n,this.eventEmitter=r,this.config=i,this._isGenerating=sn(!1),this._isStopLoading=sn(!1),this._isModelsLoading=sn(!1),this._models=sn([]),this._selectedLlmCode=sn(void 0),this._selectedModelName=pi(()=>{let e=this._selectedLlmCode.value;return e?this._models.value.find(t=>t.llm_code===e)?.llm_name??``:``}),this._selectedModelSupportsVision=pi(()=>{let e=this._selectedLlmCode.value;return e?!!this._models.value.find(t=>t.llm_code===e)?.property?.support_vision:!1}),this.sessionModule&&Rn(()=>this.sessionModule.current.value?.sessionCode,()=>{this.applySessionModel(this.sessionModule.current.value?.model)})}get isGenerating(){return this._isGenerating}get isStopLoading(){return this._isStopLoading}get isMessagesLoading(){return this.messageModule.isListLoading}get models(){return this._models}get isModelsLoading(){return this._isModelsLoading}get selectedLlmCode(){return this._selectedLlmCode}get selectedModelName(){return this._selectedModelName}get selectedModelSupportsVision(){return this._selectedModelSupportsVision}get messages(){return this.messageModule.list}async loadModels(e={}){this._isModelsLoading.value=!0;try{let t=this.agentModule.models?.value;if(!e.force&&Array.isArray(t)&&t.length>0)this._models.value=[...t];else if(typeof this.agentModule.getLlms==`function`){let e=await this.agentModule.getLlms();this._models.value=Array.isArray(e)?e:[]}else this._models.value=[];this.applySessionModel(this.sessionModule?.current.value?.model)}catch(e){console.error(`[ChatBusinessManager] Failed to load models:`,e),this._models.value=[],this._selectedLlmCode.value=void 0}finally{this._isModelsLoading.value=!1}}setModels(e){this._models.value=e,this.applySessionModel(this.sessionModule?.current.value?.model)}setSelectedModelByName(e){if(!e){this._selectedLlmCode.value=void 0;return}let t=this._models.value.find(t=>t.llm_name===e);this._selectedLlmCode.value=t?.llm_code,this.persistSessionModel(t?.llm_code)}setSelectedModel(e){this._selectedLlmCode.value=e?.llm_code,this.persistSessionModel(e?.llm_code)}get openingRemark(){return this.config.openingRemark||``}get predefinedQuestions(){return this.config.predefinedQuestions||[]}async batchDeleteMessages(e){try{await this.messageModule.deleteMessages(e);let t=e.map(e=>e.id).filter(Boolean);this.emit(`messages-batch-deleted`,{messageIds:t})}catch(e){throw console.error(`Failed to batch delete messages:`,e),this.emit(`chat-error`,{action:`batch-delete-messages`,error:e}),e}}async deleteMessage(e){try{await this.messageModule.deleteMessages([e]),this.emit(`message-deleted`,{messageId:e.id})}catch(e){throw console.error(`Failed to delete message:`,e),this.emit(`chat-error`,{action:`delete-message`,error:e}),e}}handleStreamEnd(){this._isGenerating.value=!1,this.emit(`receive-end`,{})}handleStreamError(e){this._isGenerating.value=!1,this.emit(`receive-error`,{error:e})}handleStreamStart(){this._isGenerating.value=!0,this.emit(`receive-start`,{})}async regenerateFromAIMessages(e,t){try{if(!e||e.length===0)throw Error(`No AI messages provided`);let n=this.messages.value,r=hSe(n,e[0]);if(!r)throw Error(`No user message found before AI messages`);let i=r.id;if(i===void 0)throw Error(`User message has no id`);await this.regenerateMessage(String(i),t)}catch(e){throw console.error(`Failed to regenerate from AI messages:`,e),this.emit(`chat-error`,{action:`regenerate`,error:e}),e}}async regenerateMessage(e,t){try{let n=this.messages.value,r=n.findIndex(t=>String(t.id)===e);if(r===-1)throw Error(`Message not found: ${e}`);let i=n[r];if(i.role!==Ld.User)throw Error(`Can only regenerate from user messages`);let a=n.slice(r),o=typeof i.content==`string`?i.content:JSON.stringify(i.content),s=i.property;this._isGenerating.value=!0;let l=this.messageModule.deleteMessages(a);this.agentModule.chat(o,t,void 0,void 0,s,this.resolveChatModel()),this.emit(`chat-regenerate`,{messageId:e}),l.catch(e=>{console.error(`[regenerateMessage] Delete API error:`,e)})}catch(e){throw console.error(`Failed to regenerate message:`,e),this._isGenerating.value=!1,this.emit(`chat-error`,{action:`regenerate`,error:e}),e}}async resendMessageWithProperty(e,t,n,r){try{let i=this.messages.value,a=i.findIndex(t=>String(t.id)===e);if(a===-1)throw Error(`Message not found: ${e}`);if(i[a].role!==Ld.User)throw Error(`Can only resend user messages`);let o=i.slice(a);this._isGenerating.value=!0;let s=this.messageModule.deleteMessages(o);this.agentModule.chat(n,t,void 0,void 0,r,this.resolveChatModel()),this.emit(`chat-resend`,{messageId:e}),s.catch(e=>{console.error(`[resendMessageWithProperty] Delete API error:`,e)})}catch(e){throw console.error(`Failed to resend message with property:`,e),this._isGenerating.value=!1,this.emit(`chat-error`,{action:`resend`,error:e}),e}}async retryMessage(e){try{console.warn(`retryMessage not implemented yet`),this.emit(`chat-retry`,{messageId:e})}catch(e){throw console.error(`Failed to retry message:`,e),this.emit(`chat-error`,{action:`retry`,error:e}),e}}async sendMessage(e,t,n={}){try{if(!t)throw Error(`No active session. Please create or select a session first.`);this._isGenerating.value=!0,this.emit(`send-message`,{content:e}),await this.agentModule.chat(e,t,void 0,void 0,n.property,this.resolveChatModel(n.model)),this.autoRenameSessionIfNeeded(t)}catch(e){throw console.error(`Failed to send message:`,e),this._isGenerating.value=!1,this.emit(`chat-error`,{action:`send`,error:e}),e}}async stopGeneration(){let e=this.sessionModule?.current?.value?.sessionCode??``;this._isStopLoading.value=!0;try{await this.agentModule.stopChat(e),this._isGenerating.value=!1,this.emit(`stop`,{})}catch(e){throw console.error(`Failed to stop generation:`,e),this.emit(`chat-error`,{action:`stop`,error:e}),e}finally{this._isStopLoading.value=!1}}},wZt=class{agentModule;config;eventEmitter;messageModule;sessionModule;emit(e,t){this.eventEmitter?.emit(e,t)}constructor(e,t=null,n=null,r={},i=null){this.sessionModule=e,this.agentModule=t,this.eventEmitter=n,this.config=r,this.messageModule=i}get currentSession(){return this.sessionModule.current}get isCreateLoading(){return this.sessionModule.isCreateLoading}get isCurrentLoading(){return this.sessionModule.isCurrentLoading}get isDeleteLoading(){return this.sessionModule.isDeleteLoading}get isListLoading(){return this.sessionModule.isListLoading}get isLoadingMore(){return this.sessionModule.isLoadingMore}get isUpdateLoading(){return this.sessionModule.isUpdateLoading}get hasMoreSessions(){return this.sessionModule.hasMore}get sessionCount(){return this.sessionModule.count}get sessionList(){return this.sessionModule.list}async createNewSession(e){let t=this.currentSession.value;if(t?.sessionCode&&this.isCurrentSessionEmpty(t))return null;await this.loadSessions();let n=this.sessionList.value;if(n.length>0){let r=n[0];if(r.sessionCode===t?.sessionCode?this.isCurrentSessionEmpty(r):this.isSessionEmpty(r))return await this.syncSessionModelIfNeeded(e?.model,r),await this.switchSession(r.sessionCode,{loadMessages:!1}),null}return await this.createSession({name:`新会话`,sessionCode:this.generateSessionCode(),model:e?.model}),this.sessionModule.current.value}generateSessionCode(){return`new_session_${Date.now()}`}async syncSessionModelIfNeeded(e,t){if(!e)return;let n=t??this.sessionModule.current.value;!n?.sessionCode||n.model===e||await this.sessionModule.updateSession({...n,model:e})}async createSession(e={}){if(this.config.enableChatSession===!1)throw Error(`Chat session is disabled`);try{let t={sessionName:e.name||`新会话`,sessionCode:e.sessionCode||`session_${Date.now()}`,isTemporary:e.isTemporary||!1,...e.model?{model:e.model}:{},sessionProperty:{labels:e.labels}};await this.sessionModule.createSession(t);let n=this.agentModule?.info.value;n&&this.agentModule?.handleRole(n,t.sessionCode),this.emit(`session-created`,{session:this.sessionModule.current.value})}catch(e){throw console.error(`Failed to create session:`,e),this.emit(`session-error`,{action:`create`,error:e}),e}}async deleteSession(e){try{await this.sessionModule.deleteSession(e),this.emit(`session-deleted`,{sessionCode:e})}catch(e){throw console.error(`Failed to delete session:`,e),this.emit(`session-error`,{action:`delete`,error:e}),e}}async getSession(e){try{await this.sessionModule.getSession(e)}catch(e){throw console.error(`Failed to get session:`,e),this.emit(`session-error`,{action:`get`,error:e}),e}}isSessionEmpty(e){let t=this.findSession(e.sessionCode)?.sessionContentCount??e.sessionContentCount;return t==null?!1:t===0}isCurrentSessionEmpty(e){return this.messageModule&&mSe(this.messageModule.list.value)?!1:this.isSessionEmpty(e)}findSession(e){return this.sessionList.value.find(t=>t.sessionCode===e)}async loadRecentSession(e){try{if(this.currentSession.value?.sessionCode)return;e?.skipLoadSessions||await this.loadSessions();let t=this.sessionList.value;if(this.config.initialSessionCode){let e=this.findSession(this.config.initialSessionCode);await this.switchSession(this.config.initialSessionCode,{loadMessages:e?!this.isSessionEmpty(e):!0});return}if(t.length>0){let n=t[0],r=(n.sessionContentCount??0)>0,i=e?.alwaysCreateNewSession??this.config.alwaysCreateNewSession??!1;r||i?await this.createSession({name:`新会话`,sessionCode:this.generateSessionCode()}):await this.switchSession(n.sessionCode,{loadMessages:!1});return}await this.createSession({name:`新会话`,sessionCode:this.generateSessionCode()})}catch(e){throw console.error(`Failed to load recent session:`,e),e}}async loadSessions(){try{await this.sessionModule.getSessions(),this.emit(`sessions-loaded`,{sessions:this.sessionList.value})}catch(e){throw console.error(`Failed to load sessions:`,e),this.emit(`session-error`,{action:`load`,error:e}),e}}async loadMoreSessions(){try{await this.sessionModule.loadMoreSessions()}catch(e){throw console.error(`Failed to load more sessions:`,e),this.emit(`session-error`,{action:`loadMore`,error:e}),e}}async switchSession(e,t){try{await this.sessionModule.chooseSession(e,t),this.emit(`session-switched`,{session:this.sessionModule.current.value})}catch(e){throw console.error(`Failed to switch session:`,e),this.emit(`session-error`,{action:`switch`,error:e}),e}}async updateSessionName(e,t){try{let n=this.sessionList.value.find(t=>t.sessionCode===e);if(!n)throw Error(`Session not found: ${e}`);await this.sessionModule.updateSession({...n,sessionName:t}),this.emit(`session-updated`,{session:this.sessionModule.current.value})}catch(e){throw console.error(`Failed to update session name:`,e),this.emit(`session-error`,{action:`update`,error:e}),e}}},TZt=class{messageModule;sessionModule;constructor(e,t){this.messageModule=e,this.sessionModule=t}async shareMessages(e){if(e.length===0)throw Error(`No messages to share`);let t=this.sessionModule.current?.value?.sessionCode;if(!t)throw Error(`No active session`);let n=await this.messageModule.shareMessages(t,e);if(!n)throw Error(`Share failed: no result returned`);return{shareUrl:`${n.share_page}share-page/${n.share_token}`,userMessageIds:e.map(e=>String(e.id))}}},EZt=class{_agentShortcuts;_effectiveShortcuts;_propsShortcuts;eventEmitter;emit(e,t){this.eventEmitter?.emit(e,t)}constructor(e=null,t=[]){this._propsShortcuts=sn(t),this._agentShortcuts=sn([]),this.eventEmitter=e,this._effectiveShortcuts=pi(()=>this._propsShortcuts.value.length>0?this._propsShortcuts.value:this._agentShortcuts.value.length>0?this._agentShortcuts.value:[])}get count(){return this._effectiveShortcuts.value.length}get effectiveShortcuts(){return this._effectiveShortcuts}get hasShortcuts(){return this._effectiveShortcuts.value.length>0}get shortcuts(){return this._effectiveShortcuts}addShortcut(e){this._propsShortcuts.value.push(e)}clear(){this._propsShortcuts.value=[],this._agentShortcuts.value=[]}filterByTextLength(e,t){return!e||e.length>t?[]:this._effectiveShortcuts.value}filterShortcuts(e,t){return t?this._effectiveShortcuts.value.filter(n=>t(n,e)):this._effectiveShortcuts.value}getShortcutById(e){return this._effectiveShortcuts.value.find(t=>t.id===e)}handleShortcutClick(e,t,n=`main`){this.emit(`shortcut-click`,{shortcut:e,selectedText:t,source:n})}limitShortcuts(e){return this._effectiveShortcuts.value.slice(0,e)}removeShortcut(e){this._propsShortcuts.value=this._propsShortcuts.value.filter(t=>t.id!==e)}setAgentShortcuts(e){this._agentShortcuts.value=e}setShortcuts(e){this._propsShortcuts.value=e}},DZt=class{_isCompressed;_isDraggingOrResizing;_nimbusMinimized;_panelVisible;_positionAndSize;cleanupFunctions;config;containerRef=null;debugMode;listeners;onceListeners;constructor(e={}){this.config=e,this.listeners=new Map,this.onceListeners=new Map,this.debugMode=e.debug??!1,this.cleanupFunctions=[],this._panelVisible=sn(e.initialPanelVisible??!1),this._nimbusMinimized=sn(e.initialNimbusMinimized??!1),this._isDraggingOrResizing=sn(!1),this._isCompressed=sn(!1),this._positionAndSize=sn({x:0,y:0,width:400,height:window.innerHeight})}get container(){return{updatePosition:this.updatePosition.bind(this),updateSize:this.updateSize.bind(this),updatePositionAndSize:this.updatePositionAndSize.bind(this),toggleCompression:this.toggleCompression.bind(this),expandForSidePanel:this.expandForSidePanel.bind(this),collapseSidePanel:this.collapseSidePanel.bind(this),positionAndSize:pi(()=>this.containerRef?.positionAndSize?.value??this._positionAndSize.value),isCompressed:pi(()=>this._isCompressed.value),isSidePanelExpanded:pi(()=>this.containerRef?.isSidePanelExpanded?.value??!1)}}get isCompressed(){return this._isCompressed}get isDraggingOrResizing(){return this._isDraggingOrResizing}get nimbus(){return{minimize:this.minimizeNimbus.bind(this),restore:this.restoreNimbus.bind(this),toggle:this.toggleNimbus.bind(this),isMinimized:pi(()=>this._nimbusMinimized.value)}}get nimbusMinimized(){return this._nimbusMinimized}get panel(){return{show:this.showPanel.bind(this),hide:this.hidePanel.bind(this),toggle:this.togglePanel.bind(this),isVisible:pi(()=>this._panelVisible.value)}}get panelVisible(){return this._panelVisible}get state(){return{panelVisible:this._panelVisible,nimbusMinimized:this._nimbusMinimized,isDraggingOrResizing:this._isDraggingOrResizing,positionAndSize:this._positionAndSize}}collapseSidePanel(){this.containerRef?.collapseSidePanel&&this.containerRef.collapseSidePanel()}destroy(){this.listeners.clear(),this.onceListeners.clear(),this.cleanupFunctions.forEach(e=>e()),this.cleanupFunctions=[],this.debugMode&&console.debug(`[ComponentManager] Destroyed`)}emit(e,t){this.debugMode&&console.debug(`[ComponentManager] Emitting "${e}"`,t);let n=this.listeners.get(e);n&&n.forEach(n=>{try{n(t)}catch(t){console.error(`[ComponentManager] Error in listener for "${e}":`,t)}});let r=this.onceListeners.get(e);if(r&&r.size>0){let n=Array.from(r);this.onceListeners.delete(e),n.forEach(n=>{try{n(t)}catch(t){console.error(`[ComponentManager] Error in once listener for "${e}":`,t)}})}}emitInternal(e,t){this.emit(e,t)}expandForSidePanel(e){this.containerRef?.expandForSidePanel&&this.containerRef.expandForSidePanel(e)}getConfig(){return this.config}getRegisteredEvents(){let e=new Set;return this.listeners.forEach((t,n)=>e.add(n)),this.onceListeners.forEach((t,n)=>e.add(n)),Array.from(e)}handleDragging(e){this._isDraggingOrResizing.value=!0,this._positionAndSize.value=e,this.emit(`dragging`,e)}handleDragStop(e){this._isDraggingOrResizing.value=!1,this._positionAndSize.value=e,this.emit(`drag-stop`,e)}handleNimbusClick(){this.emit(`nimbus-click`,{}),this.showPanel()}handlePopupClick(){this.emit(`popup-click`,{}),this.showPanel()}handlePopupShortcutClick(e){this.emit(`popup-shortcut-click`,{shortcut:e}),this.emit(`shortcut-click`,{shortcut:e,source:`popup`})}handleResizeStop(e){this._isDraggingOrResizing.value=!1,this._positionAndSize.value=e,this.emit(`resize-stop`,e)}handleResizing(e){this._isDraggingOrResizing.value=!0,this._positionAndSize.value=e,this.emit(`resizing`,e)}handleShortcutClick(e,t){this.emit(`shortcut-click`,{shortcut:e,source:t})}hasListeners(e){return this.listenerCount(e)>0}hidePanel(){this._panelVisible.value=!1,this.emit(`panel-hide`,{})}listenerCount(e){return(this.listeners.get(e)?.size??0)+(this.onceListeners.get(e)?.size??0)}minimizeNimbus(){this._nimbusMinimized.value=!0,this.emit(`nimbus-minimize`,{})}off(e,t){t?(this.listeners.get(e)?.delete(t),this.onceListeners.get(e)?.delete(t),this.debugMode&&console.debug(`[ComponentManager] Unsubscribed from "${e}", remaining: ${this.listenerCount(e)}`)):(this.listeners.delete(e),this.onceListeners.delete(e),this.debugMode&&console.debug(`[ComponentManager] Removed all listeners for "${e}"`))}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),this.debugMode&&console.debug(`[ComponentManager] Subscribed to "${e}", total: ${this.listenerCount(e)}`),()=>{this.off(e,t)}}once(e,t){return this.onceListeners.has(e)||this.onceListeners.set(e,new Set),this.onceListeners.get(e).add(t),this.debugMode&&console.debug(`[ComponentManager] Subscribed once to "${e}"`),()=>{this.onceListeners.get(e)?.delete(t)}}restoreNimbus(){this._nimbusMinimized.value=!1,this.emit(`nimbus-restore`,{})}setCompressed(e){this._isCompressed.value=e}setContainerRef(e){this.containerRef=e,e?.isCompressed&&(this._isCompressed.value=e.isCompressed.value)}setDebugMode(e){this.debugMode=e}setDraggingOrResizing(e){this._isDraggingOrResizing.value=e}showPanel(e){this._panelVisible.value=!0,this.emit(`panel-show`,{sessionCode:e})}toggleCompression(){this.containerRef?this.containerRef.toggleCompression():this._isCompressed.value=!this._isCompressed.value}toggleNimbus(){this._nimbusMinimized.value?this.restoreNimbus():this.minimizeNimbus()}togglePanel(){this._panelVisible.value?this.hidePanel():this.showPanel()}updatePosition(e,t){this._positionAndSize.value={...this._positionAndSize.value,x:e,y:t}}updatePositionAndSize(e,t,n,r){this._positionAndSize.value={x:e,y:t,width:n,height:r}}updateSize(e,t){this._positionAndSize.value={...this._positionAndSize.value,width:e,height:t}}};function OZt(e){return new DZt(e)}var kZt={"panel-show":`show`,"panel-hide":`close`,"panel-toggle":null,"nimbus-click":null,"nimbus-minimize":null,"nimbus-restore":null,"popup-click":null,"popup-shortcut-click":null,dragging:`dragging`,resizing:`resizing`,"drag-stop":`drag-stop`,"resize-stop":`resize-stop`,"compression-toggle":null,"side-panel-expand":null,"side-panel-collapse":null,"send-message":`send-message`,"receive-start":`receive-start`,"receive-text":`receive-text`,"receive-end":`receive-end`,"receive-error":null,stop:`stop`,"chat-regenerate":null,"chat-retry":null,"message-deleted":null,"messages-batch-deleted":null,"session-created":null,"session-switched":null,"session-deleted":null,"session-updated":null,"sessions-loaded":null,"session-initialized":`session-initialized`,"session-error":null,"shortcut-click":`shortcut-click`,"chat-error":null,"sdk-error":`sdk-error`,"new-chat":`new-chat`,"new-chat-created":`new-chat-created`,"history-click":`history-click`,"auto-generate-name":`auto-generate-name`,"help-click":`help-click`,rename:`rename`,share:`share`,close:`close`,"toggle-compression":null,"transfer-messages":`transfer-messages`,"share-messages":`share-messages`,"agent-info-loaded":null,error:null};function AZt(e,t){switch(e){case`send-message`:return[t.content];case`rename`:return[t.newName];case`history-click`:return[t.event];case`dragging`:case`resizing`:case`drag-stop`:case`resize-stop`:case`shortcut-click`:case`session-initialized`:case`sdk-error`:case`transfer-messages`:case`share-messages`:case`new-chat-created`:return[t];case`panel-show`:case`panel-hide`:case`receive-start`:case`receive-text`:case`receive-end`:case`stop`:case`new-chat`:case`auto-generate-name`:case`help-click`:case`share`:case`close`:return[];default:return[t]}}var jZt=class extends Error{constructor(){super(`[ChatBot] Initialization was superseded by a newer init`),this.name=`ChatBotInitStaleError`}};function MZt(e){let{props:t,emit:n,reportError:r,managerErrorBridge:i}=e,a=cn(null),o=cn(null),s=cn(null),l=cn(null),u=sn(!1),d=sn(!t.chatHelper),f=sn(null),p=pi(()=>u.value),m=()=>t.chatHelper?!t.chatHelper.agent||!t.chatHelper.session||!t.chatHelper.message?{valid:!1,error:`[ChatBot] Invalid chatHelper: missing required modules (agent, session, message)`}:{valid:!0}:t.url?{valid:!0}:{valid:!1,error:`[ChatBot] Neither chatHelper nor url provided. Component requires at least one.`},h=()=>{let e=m();if(!e.valid)return console.error(e.error),f.value=Error(e.error),null;if(t.chatHelper)return t.chatHelper;let i=new Gd({onStart:()=>{n(`receive-start`)},onMessage:e=>{n(`receive-text`)},onDone:()=>{n(`receive-end`)},onError:e=>{r(e,`Stream error`)}}),a=cSe({requestData:uSe(bSe(t.url),()=>un(t.requestOptions)),protocol:i});return i.injectMessageModule(a.message),a},g=async(e,t)=>{if(e)try{let n=e.session.current?.value?.sessionCode??``;await e.agent.stopChat(n),t&&e.agent.abortChat()}catch{}},_=0,v=null,y=null,b=null,x=e=>{b&&=(e?b.reject(e):b.resolve(),null),v=null},S=e=>{if(e!==_)throw new jZt},C=async e=>{let p=a.value,m=d.value;u.value=!1,f.value=null,d.value=!t.chatHelper,await g(p,m),S(e),a.value=null,o.value=null,s.value=null,l.value=null;let _=h();if(!_)throw f.value??Error(`[ChatBot] Failed to create chatHelper`);let v=new wZt(_.session,_.agent,i,{enableChatSession:!0,autoSwitchToInitialSession:!!t.sessionCode,loadRecentSessionOnMount:t.autoLoad,initialSessionCode:t.sessionCode,alwaysCreateNewSession:t.alwaysCreateNewSession},_.message),y=new CZt(_.agent,_.message,_.session,i,{openingRemark:t.helloText,predefinedQuestions:t.prompts,placeholder:t.placeholder,onSessionRenamed:e=>n(`rename`,e)}),b=new EZt(null,t.shortcuts||[]);a.value=_,o.value=v,s.value=y,l.value=b;try{d.value&&(await SZt(_,{enableModelSelect:t.enableModelSelect!==!1&&!t.models?.length}),S(e),await v.loadRecentSession({skipLoadSessions:!0}),S(e)),t.enableModelSelect!==!1&&(t.models?.length?y.setModels(t.models):await y.loadModels(),S(e)),S(e),u.value=!0,n(`agent-info-loaded`,_)}catch(t){throw S(e),f.value=r(t,`Failed to initialize ChatBot`),t}},w=()=>{x(new jZt),y=null;let e=++_;v=new Promise((t,n)=>{b={resolve:t,reject:n},C(e).then(()=>{b&&=(y=Promise.resolve(),b.resolve(),null)}).catch(e=>{b&&=(b.reject(_Se(e)),null)}).finally(()=>{e===_&&(v=null)})}),v.catch(()=>{})};return Rn([()=>t.url,()=>t.chatHelper],()=>w(),{immediate:!0}),cr(()=>{x(),g(a.value,d.value)}),{chatHelper:a,isStandaloneMode:d,isInitialized:u,isReady:p,initError:f,whenReady:()=>u.value?(y||=Promise.resolve(),y):f.value?Promise.reject(f.value):v||Promise.resolve(),chatBusinessManager:s,sessionBusinessManager:o,shortcutManager:l}}function NZt(e){let{props:t,chatHelper:n,chatBusinessManager:r,sessionBusinessManager:i,shortcutManager:a,isStandaloneMode:o,isInitialized:s,selectedShortcut:l}=e,u=pi(()=>r.value?.isStopLoading.value?kp.StopLoading:((t.chatHelper||n.value)?.agent)?.isChatting?.value?kp.Streaming:kp.Complete),d=pi(()=>u.value===kp.Streaming?B9.Disabled:void 0),f=pi(()=>r.value?.messages.value??[]),p=pi(()=>r.value?.isMessagesLoading.value??!1);return{messageStatus:u,messageToolsStatus:d,messages:f,isMessagesLoading:p,isGenerating:pi(()=>r.value?.isGenerating.value??!1),currentSession:pi(()=>i.value?.currentSession.value??null),isWelcomeState:pi(()=>o.value&&!s.value?!1:!p.value&&f.value.length===0),openingRemark:pi(()=>n.value?.agent.info.value?.conversationSettings?.openingRemark||``),effectiveResources:pi(()=>t.resources?.length?t.resources:n.value?.agent.info.value?.resources??[]),effectivePrompts:pi(()=>t.prompts?.length?t.prompts:n.value?.agent.info.value?.conversationSettings?.predefinedQuestions??[]),effectiveSkills:pi(()=>t.skills?.length?t.skills:(n.value?.agent.info.value?.relatedSkills??[]).map(e=>({skill_name:e.skill_name,skill_code:e.skill_code,description:e.description,icon:e.icon}))),effectiveSupportUpload:pi(()=>l.value?.supportUpload?l.value.supportUpload.vision===!0:r.value?.selectedModelSupportsVision.value??!1),chatbotStyle:pi(()=>({height:typeof t.height==`number`?`${t.height}px`:t.height,maxWidth:typeof t.maxWidth==`number`?`${t.maxWidth}px`:t.maxWidth})),filteredShortcuts:pi(()=>a.value?.shortcuts.value??[])}}var PZt=new Set([`chat-error`,`receive-error`,`session-error`]);function FZt(e,t={}){let n=new WeakSet,r=(r,i)=>{let a=_Se(r);return n.has(a)?a:(n.add(a),console.error(i?`[ChatBot] ${i}:`:`[ChatBot] error:`,r),e(`error`,a),un(t.errorToast)!==!1&&cd({message:a.message||tf(`请求失败`),theme:`error`}),a)};return{managerErrorBridge:{emit:(e,t)=>{PZt.has(e)&&r(t?.error)}},reportError:r}}var IZt={[jp.ApprovalCancel]:Bd.ApprovalCancel,[jp.FlowNodeRetry]:Bd.FlowNodeRetry,[jp.FlowNodeSkip]:Bd.FlowNodeSkip};function LZt(e){return`operation`in e}function RZt(e){return`interruptId`in e&&`reason`in e&&e.reason===Ep.UserQuestion}function zZt(e){return e===`cancelled`?Wd.Cancelled:Wd.Resolved}function BZt(e){let t=e?.session.current?.value?.sessionCode;if(!t)throw Error(`[ChatBot] Cannot resume interrupt: no active session`);return t}function VZt(e){return{interruptId:e.interruptId,status:zZt(e.status),payload:e.payload}}function HZt(e){let{chatHelper:t,reportError:n}=e,r=async e=>{let n=t.value;if(!n)throw Error(`[ChatBot] Cannot resume interrupt: chatHelper not initialized`);if(!LZt(e))throw Error(`[ChatBot] Unsupported interrupt resume payload`);let r=BZt(n);if(e.operation===jp.ApprovalRefresh){n.agent.pollResumeSession(r);return}let i=IZt[e.operation];if(!i)throw Error(`[ChatBot] Unsupported interrupt resume operation: ${e.operation}`);let a=n.agent;if(e.operation===jp.ApprovalCancel){await a.userOperationStreamRequest(r,i,{interrupt_id:e.payload.interrupt_id});return}(e.operation===jp.FlowNodeRetry||e.operation===jp.FlowNodeSkip)&&await a.userOperationStreamRequest(r,i,{node_id:e.payload.node_id,task_id:String(e.payload.task_id)})},i=async(e,n)=>{let r=t.value;if(!r)throw Error(`[ChatBot] Cannot resume interrupt: chatHelper not initialized`);let i=BZt(r);await r.agent.streamRequest({sessionCode:i,resume:VZt(e),...n?{input:n}:{}})};return{handleInterruptResume:async(e,t)=>{try{if(LZt(e)){await r(e);return}if(RZt(e)){await i(e);return}throw Error(`[ChatBot] Unsupported interrupt resume payload`)}catch(e){n(e,`Failed to handle interrupt resume`)}},resumeUserQuestionWithInput:async(e,t)=>{try{if(!t.payload||!RZt(t.payload))throw Error(`[ChatBot] Invalid user question resume options`);let n=typeof e==`string`?e.trim():``;if(!n)throw Error(`[ChatBot] User question free text input is empty`);await i(t.payload,n)}catch(e){n(e,`Failed to resume user question with input`)}}}}function UZt(e){let{emit:t,chatHelper:n,chatBusinessManager:r,getRequestOptions:i,reportError:a,resumeUserQuestionWithInput:o,selectedShortcut:s,selectedResources:l}=e,u=cn([[]]),d=cn(``),f=(e,t)=>{u.value=e,l.value=t},p=async(e,a={})=>{if(!r.value||!n.value)throw Error(`[ChatBot] Cannot send message: chatBusinessManager not initialized`);let o=n.value.session.current?.value?.sessionCode;if(!o)throw Error(`[ChatBot] Cannot send message: no active session`);u.value=[[]],d.value=``,l.value=[],t(`send-message`,typeof e==`string`?e:``);let s=fSe(a.property,i);await r.value.sendMessage(e,o,{...a,...s?{property:s}:{}})},m=async e=>{let t=n.value?.session.current?.value?.sessionCode;if(!t)throw Error(`[ChatBot] Cannot upload: no active session`);let r=await n.value.session.uploadFile(t,e);if(!r?.download_url)throw Error(`[ChatBot] Upload failed: no download URL returned`);return r},h=async e=>{let t=n.value?.session.current?.value?.sessionCode;if(!t)throw Error(`[ChatBot] Cannot resolve artifact URL: no active session`);let r=await n.value.session.getPvFileDownloadUrl(t,e.outputId);return{download_url:r?.download_url,preview_url:r?.preview_url}},g=async(e,t,n)=>{try{if(n?.payload&&o){u.value=[[]],d.value=``,l.value=[],await o(e,n);return}let t={};d.value&&(t.cite=d.value),s.value&&(t.command=s.value.id),l.value.length&&(t.resources=l.value),await p(e,Object.keys(t).length?{property:{extra:t}}:{})}catch(e){a(e,`Failed to send message`)}},_=async()=>{await v()},v=async()=>{if(!r.value){console.error(`[ChatBot] Cannot stop generation: chatBusinessManager not initialized`);return}try{await r.value.stopGeneration(),t(`stop`)}catch(e){a(e,`Failed to stop generation`)}};return{userInput:u,cite:d,handleUpdateModelValue:f,doSendMessage:p,handleSendMessage:g,handleArtifactClick:h,handleUpload:m,handleStopSending:_,stopGeneration:v}}var WZt=e=>!e||e.id===`share`;function GZt(e){let{emit:t,chatHelper:n,isStandaloneMode:r}=e,i=async e=>{if(!(!n.value||e.length===0))try{await xSe((await new TZt(n.value.message,n.value.session).shareMessages(e)).shareUrl),cd({message:`分享链接已复制到剪贴板`,theme:`success`})}catch(e){console.error(`[ChatBot] Failed to share messages:`,e),cd({message:`分享失败,请重试`,theme:`error`})}};return{handleConfirmShare:async(e,n)=>{r.value&&WZt(n)&&await i(e),t(`confirm-share`,e,n)}}}function KZt(e){let{props:t,emit:n,shortcutManager:r,doSendMessage:i,reportError:a,selectedShortcut:o}=e,s=pi(()=>r.value?.effectiveShortcuts.value??[]),l=(e,t)=>{let n=e,r;if(r=n.enable_fill_back&&n.fill_back_component_key?n.fill_back_component_key:n.components?.find(e=>e.fillBack)?.key,r&&t){let e=n.components?.map(e=>e.key===r?{...e,default:t}:{...e,default:e.default??void 0});o.value={...n,components:e,formModel:{...n.formModel,[r]:t}}}else o.value={...n,formModel:{...n.formModel}}},u=(e,t)=>{let n=e.components||[];return{extra:{cite:{type:`structured`,title:e.alias||e.name,data:n.map(e=>({key:e.name||e.key,value:String(t[e.key]??``)}))},command:e.id,context:n.map(e=>({[e.key]:t[e.key],context_type:e.type,__label:e.name||e.key,__key:e.key,__value:t[e.key]}))}}},d=e=>{let t=e.property?.extra;return t?.shortcut?t.shortcut:t?.command?s.value.find(e=>e.id===t.command)??null:null},f=(e,t)=>{l(e,t),n(`shortcut-click`,{shortcut:e,source:`main`})},p=()=>{o.value=null};return Rn(()=>t.shortcuts,e=>{r.value?.setShortcuts(e||[])},{immediate:!0}),Rn(()=>e.chatHelper.value?.agent.info.value?.conversationSettings?.commands,e=>{e&&r.value?.setAgentShortcuts(e)},{immediate:!0}),{effectiveShortcuts:s,selectShortcutWithText:l,buildShortcutProperty:u,getShortcutFromMessage:d,handleSelectShortcut:f,handleCloseShortcut:p,handleShortcutSubmit:async e=>{if(!o.value){console.error(`[ChatBot] No selected shortcut`);return}let t=u(o.value,e),n=o.value.name,r=o.value;p();try{await i(n,{property:t})}catch(e){o.value=r,a(e,`Failed to submit shortcut`)}},sendShortcutDirectly:async(e,t)=>{let n=e,r={...n.formModel},o=n.components||[];for(let e of o)e.key in r||(r[e.key]=e.default??``);let s;s=n.enable_fill_back&&n.fill_back_component_key?n.fill_back_component_key:o.find(e=>e.fillBack)?.key,s&&t&&(r[s]=t);let l=u(n,r),d=n.name;try{await i(d,{property:l})}catch(e){a(e,`Failed to send shortcut directly`)}}}}function qZt(e){let{emit:t,chatHelper:n,chatBusinessManager:r,cite:i,focusInput:a,getShortcutFromMessage:o,buildShortcutProperty:s,getRequestOptions:l,reportError:u,stopGeneration:d}=e,f=async e=>{if(!r.value||!n.value){console.error(`[ChatBot] Cannot delete messages: chatBusinessManager not initialized`);return}try{let t=r.value.messages.value,i=hSe(t,e[0]);if(!i){console.error(`[ChatBot] No user message found before AI messages`);return}let a=[i,...e];await n.value.message.deleteMessages(a)}catch(e){u(e,`Failed to delete messages`)}},p=async e=>{if(!r.value||!n.value){console.error(`[ChatBot] Cannot regenerate: chatBusinessManager not initialized`);return}let t=n.value.session.current?.value?.sessionCode;if(!t){console.error(`[ChatBot] Cannot regenerate: no active session`);return}try{await r.value.regenerateFromAIMessages(e,t)}catch(e){u(e,`Failed to regenerate`)}},m=async e=>{if(!r.value||!n.value){console.error(`[ChatBot] Cannot delete message: chatHelper not initialized`);return}try{let t=r.value.messages.value,i=t.findIndex(t=>t===e);if(i===-1){console.error(`[ChatBot] User message not found in messages list`);return}let a=[];for(let e=i+1;e<t.length;e++){let n=t[e];if(n.role===Op.User)break;a.push(n)}let o=[e,...a];await n.value.message.deleteMessages(o)}catch(e){u(e,`Failed to delete user message`)}};return{handleAgentAction:async(e,r)=>{if(e.id===`cite`){i.value=r.filter(e=>e.role!==Op.Reasoning).map(e=>typeof e.content==`string`?e.content:JSON.stringify(e.content||``)).join(`
|
|
3499
|
-
`),a();return}if(e.id===`rebuild`){await p(r);return}if(e.id===`delete`){await f(r);return}if(e.id===`like`||e.id===`unlike`){let t=e.id===`like`?5:0;try{return await n.value?.session.getSessionFeedbackReasons(t)||[]}catch(e){return console.error(`[ChatBot] Failed to get feedback reasons:`,e),[]}}t(`agent-action`,e,r)},handleAgentFeedback:async(e,i,a,o)=>{if(!n.value){console.error(`[ChatBot] Cannot submit feedback: chatHelper not initialized`);return}let s=n.value.session.current?.value?.sessionCode;if(!s){console.error(`[ChatBot] Cannot submit feedback: no active session`);return}let l=gSe(r.value?.messages.value||[],i[0]);if(l===void 0){console.error(`[ChatBot] Cannot submit feedback: no user message found`);return}let d=e.id===`like`?5:0;try{await n.value.session.postSessionFeedback({sessionCode:s,sessionContentIds:[l],rate:d,labels:a,comment:o}),t(`feedback`,e,i[0],a,o)}catch(e){u(e,`Failed to submit feedback`)}},handleUserAction:async(e,t)=>{if(e.id===`delete`){await m(t);return}if(e.id===`cite`){i.value=typeof t.content==`string`?t.content:JSON.stringify(t.content||``),a();return}console.log(`handleUserAction`,e,t)},handleUserInputConfirm:async(e,t,i)=>{if(!n.value){console.error(`[ChatBot] Cannot edit message: chatHelper not initialized`);return}let a=n.value.session.current?.value?.sessionCode;if(!a){console.error(`[ChatBot] Cannot edit message: no active session`);return}let o=e.id;if(o===void 0){console.error(`[ChatBot] Cannot edit message: message has no id`);return}try{let n=e.property,i=fSe(n,l);await r.value?.resendMessageWithProperty(String(o),a,typeof t==`string`?t:``,i)}catch(e){u(e,`Failed to edit and resend message`)}},handleUserShortcutConfirm:async(e,t)=>{if(!r.value||!n.value){console.error(`[ChatBot] Cannot edit shortcut message: chatHelper not initialized`);return}let i=n.value.session.current?.value?.sessionCode;if(!i){console.error(`[ChatBot] Cannot edit shortcut message: no active session`);return}let a=e.id;if(a===void 0){console.error(`[ChatBot] Cannot edit shortcut message: message has no id`);return}try{let n=o(e);if(!n){console.error(`[ChatBot] Cannot edit shortcut message: shortcut not found`);return}let u=fSe(s(n,t),l),d=String(t.input??``);await r.value.resendMessageWithProperty(String(a),i,d,u)}catch(e){u(e,`Failed to edit shortcut message`)}},handleStopStreaming:d}}var JZt=$n({__name:`chat-bot`,props:{autoLoad:{type:Boolean,default:!0},alwaysCreateNewSession:{type:Boolean},chatHelper:{default:void 0},enableSelection:{type:Boolean,default:!1},enableModelSelect:{type:Boolean,default:!0},errorToast:{type:Boolean,default:!0},models:{default:void 0},executionTabVisible:{type:Boolean},renderMode:{default:Mp.Chat},extCls:{},height:{},helloText:{},useAgentName:{type:Boolean,default:!1},maxWidth:{},messageToolsTippyOptions:{},messageTools:{},updateTools:{},placeholder:{},prompts:{},requestOptions:{},resources:{default:()=>[]},sessionCode:{},shareLoading:{type:Boolean,default:!1},shortcuts:{default:()=>[]},skills:{},url:{default:``},placement:{default:`left`},resizeProps:{},size:{},getSideRenderComponent:{},getSideTabRenderComponent:{},onCustomTabChange:{}},emits:[`agent-action`,`agent-info-loaded`,`cancel-share`,`confirm-share`,`error`,`execution-panel-change`,`feedback`,`receive-end`,`receive-start`,`receive-text`,`rename`,`request-share`,`send-message`,`session-switched`,`shortcut-click`,`stop`],setup(e,{expose:t,emit:n}){let r=e,i={initialDivide:560,min:400},a=pi(()=>({...i,...r.resizeProps})),o=n,s=vr(),l=sn(),u=sn(),d=cn([]),f=sn(null),p=pi({get:()=>r.renderMode??Mp.Chat,set:()=>{}}),m=pi(()=>w.value?.selectedLlmCode.value),h=()=>{u.value?.focus?.()},{reportError:g,managerErrorBridge:_}=FZt(o,{errorToast:()=>r.errorToast}),{chatHelper:v,isStandaloneMode:y,isInitialized:b,isReady:x,initError:S,whenReady:C,chatBusinessManager:w,sessionBusinessManager:T,shortcutManager:E}=MZt({props:r,emit:o,reportError:g,managerErrorBridge:_}),{handleInterruptResume:D,resumeUserQuestionWithInput:O}=HZt({chatHelper:v,reportError:g}),{userInput:k,cite:A,handleUpdateModelValue:j,doSendMessage:M,handleSendMessage:N,handleUpload:P,handleArtifactClick:F,handleStopSending:I,stopGeneration:L}=UZt({emit:o,chatHelper:v,chatBusinessManager:w,getRequestOptions:()=>r.requestOptions,reportError:g,resumeUserQuestionWithInput:O,selectedShortcut:f,selectedResources:d}),{handleSelectShortcut:R,handleCloseShortcut:ee,handleShortcutSubmit:te,selectShortcutWithText:ne,getShortcutFromMessage:re,buildShortcutProperty:ie,sendShortcutDirectly:ae}=KZt({props:r,emit:o,chatHelper:v,shortcutManager:E,doSendMessage:M,reportError:g,selectedShortcut:f}),{messageStatus:oe,messageToolsStatus:se,messages:ce,isMessagesLoading:le,isGenerating:ue,currentSession:de,isWelcomeState:fe,openingRemark:pe,effectiveResources:me,effectivePrompts:he,effectiveSkills:_e,effectiveSupportUpload:ve,chatbotStyle:ye,filteredShortcuts:be}=NZt({props:r,chatHelper:v,chatBusinessManager:w,sessionBusinessManager:T,shortcutManager:E,isStandaloneMode:y,isInitialized:b,selectedShortcut:f}),{handleAgentAction:Ce,handleAgentFeedback:we,handleUserAction:Te,handleUserInputConfirm:Ee,handleUserShortcutConfirm:De,handleStopStreaming:Oe}=qZt({emit:o,chatHelper:v,chatBusinessManager:w,cite:A,focusInput:h,getShortcutFromMessage:re,buildShortcutProperty:ie,getRequestOptions:()=>r.requestOptions,reportError:g,stopGeneration:L}),ke=pi(()=>!b.value||le.value),Ae=pi(()=>{if(r.useAgentName)return v.value?.agent.info.value?.agentName||void 0}),je=pi(()=>{if(r.enableModelSelect===!1)return;let e=w.value?.models.value??[];return e.length>0?e:void 0}),Me=pi({get:()=>w.value?.selectedModelName.value??``,set:e=>{w.value?.setSelectedModelByName(e)}}),Ne=e=>{w.value?.setSelectedModel(e)};Rn(()=>r.models,e=>{r.enableModelSelect===!1||!w.value||e?.length&&w.value.setModels(e)});let{handleConfirmShare:Pe}=GZt({emit:o,chatHelper:v,isStandaloneMode:y}),Fe=(e,t)=>{o(`execution-panel-change`,e,t)},Ie=async e=>{if(r.onCustomTabChange)return r.onCustomTabChange(e);let t=e.data?.props;if(t?.task_id!=null&&t?.node_id)return v.value?.message.getFlowAgentTaskNodeInfo(t.task_id,t.node_id)};return t({sendMessage:e=>N(e,[[]]),stopGeneration:L,switchSession:async e=>{if(!T.value){console.error(`[ChatBot] Cannot switch session: sessionBusinessManager not initialized`);return}try{await T.value.switchSession(e),o(`session-switched`,T.value.currentSession.value)}catch(e){g(e,`Failed to switch session`)}},messages:ce,currentSession:de,isGenerating:ue,get isReady(){return x.value},whenReady:C,getChatHelper:()=>v.value,setCiteText:e=>{A.value=e},focusInput:h,enterShareMode:()=>l.value?.enterShareMode(),exitShareMode:()=>l.value?.exitShareMode(),selectShortcut:(e,t)=>{ne(e,t)},sendShortcut:(e,t)=>ae(e,t),updateAgentInfo:async()=>{let e=v.value;if(!e)return null;try{await e.agent.getAgentInfo();let t=e.agent.info.value??null;return t?.conversationSettings?.commands&&E.value?.setAgentShortcuts(t.conversationSettings.commands),t}catch(e){return g(e,`Failed to update agentInfo`),null}},selectedLlmCode:m}),(t,n)=>(B(),V(`div`,{class:xe([`ai-chatbot`,r.extCls,{"welcome-state":z(fe)}]),style:ge(z(ye))},[Xr(z(uZt),{ref_key:`chatContainerRef`,ref:l,cite:z(A),"onUpdate:cite":n[0]||=e=>on(A)?A.value=e:null,"selected-shortcut":f.value,"onUpdate:selectedShortcut":n[1]||=e=>f.value=e,"selected-model":Me.value,"onUpdate:selectedModel":n[2]||=e=>Me.value=e,"render-mode":p.value,"onUpdate:renderMode":n[3]||=e=>p.value=e,"chat-loading":ke.value,"common-tippy-options":e.messageToolsTippyOptions,"execution-tab-visible":r.executionTabVisible,"message-status":z(oe),"message-tools":r.messageTools,"message-tools-status":z(se),messages:z(ce),"model-value":z(k),models:je.value,"on-agent-action":z(Ce),"on-agent-feedback":z(we),"on-interrupt-resume":z(D),"get-side-render-component":r.getSideRenderComponent,"get-side-tab-render-component":r.getSideTabRenderComponent,"on-custom-tab-change":Ie,"on-send-message":z(N),"on-stop-sending":z(I),"on-artifact-click":z(F),"on-upload":z(P),"on-user-action":z(Te),"on-user-input-confirm":z(Ee),"on-user-shortcut-confirm":z(De),"opening-remark":z(pe),placeholder:r.placeholder,placement:r.placement,"welcome-title":Ae.value,prompts:z(he),"resize-props":a.value,size:r.size,resources:z(me),"shortcut-id":f.value?.id,shortcuts:z(be),skills:z(_e),"support-upload":z(ve),"update-tools":r.updateTools,onCollapseChange:Fe,onConfirmShare:z(Pe),onDeleteShortcut:z(ee),onModelChange:Ne,onSelectShortcut:z(R),onShortcutClose:z(ee),onShortcutSubmit:z(te),onStopStreaming:z(Oe),"onUpdate:modelValue":z(j)},pr({message:Mn(({message:n,messageToolsStatus:r,onInterruptResume:i})=>[ei(` 消费方提供了 #message slot 时,优先使用消费方的渲染 `),z(s).message?mr(t.$slots,`message`,{key:0,message:n,messageToolsStatus:r,onInterruptResume:i}):(B(),V(Rr,{key:1},[ei(` 否则使用默认的 MessageRender `),Xr(z(RXt),{message:n,"message-tools-status":r,"on-action":e=>z(Te)(e,n),"on-input-confirm":(e,t)=>z(Ee)(n,e,t),"on-interrupt-resume":i,"on-shortcut-confirm":e=>z(De)(n,e),"tippy-options":e.messageToolsTippyOptions},pr({_:2},[t.$slots.codeHeader?{name:`codeHeader`,fn:Mn(e=>[mr(t.$slots,`codeHeader`,Se(Zr(e)))]),key:`0`}:void 0]),1032,[`message`,`message-tools-status`,`on-action`,`on-input-confirm`,`on-interrupt-resume`,`on-shortcut-confirm`,`tippy-options`])],2112))]),_:2},[t.$slots.welcome?{name:`welcome`,fn:Mn(e=>[mr(t.$slots,`welcome`,Se(Zr(e)))]),key:`0`}:void 0]),1032,`cite.selected-shortcut.selected-model.render-mode.chat-loading.common-tippy-options.execution-tab-visible.message-status.message-tools.message-tools-status.messages.model-value.models.on-agent-action.on-agent-feedback.on-interrupt-resume.get-side-render-component.get-side-tab-render-component.on-send-message.on-stop-sending.on-artifact-click.on-upload.on-user-action.on-user-input-confirm.on-user-shortcut-confirm.opening-remark.placeholder.placement.welcome-title.prompts.resize-props.size.resources.shortcut-id.shortcuts.skills.support-upload.update-tools.onConfirmShare.onDeleteShortcut.onSelectShortcut.onShortcutClose.onShortcutSubmit.onStopStreaming.onUpdate:modelValue`.split(`.`))],6))}});function YZt(e,t){let{name:n,props:r,emitNames:i,exposeKeys:a,slots:o=[],deepWatchProps:s=[],methods:l={}}=t,u=Object.keys(r);return{name:n,render(e){return e(`div`,{style:{width:`100%`,height:`100%`}})},props:r,data(){return{app:null,componentInstance:null,unWatchStack:[]}},created(){let t=this.$emit.bind(this),n=this,r=()=>Fi({setup(){return()=>{let r={};for(let e of u)r[e]=n[e];let a={};for(let e of o){let t=n.$scopedSlots?.[e];t!==void 0&&(a[e]=e=>t(e))}let s=Object.keys(a).length>0?a:void 0;return U(Tle,{prefix:QZt()},{default:()=>U(e,{...n.$attrs,...r,...ZZt(t,i),ref:e=>{n.componentInstance=e}},s)})}}});n.app=r();for(let e of s)n.unWatchStack.push(n.$watch(e,()=>{n.app&&(n.app.unmount(),n.app=r(),n.app.mount(n.$el))},{deep:!0}))},mounted(){let e=this;e.app?.mount(e.$el),e.$nextTick(()=>{let t=e.componentInstance;if(t)for(let n of a){let r=t[n];typeof r==`function`?e[n]=r.bind(t):e[n]=r}})},beforeDestroy(){let e=this;e.unWatchStack.forEach(e=>e?.()),e.unWatchStack=[],e.app&&=(e.app.unmount(),null),e.componentInstance=null},methods:l}}function XZt(e){return`on`+e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function ZZt(e,t){let n={};for(let r of t)n[XZt(r)]=(...t)=>{e(r,...t)};return n}function QZt(){return`ai-bk`}var K9=function(e){return e.ERROR=`error`,e.IDLE=`idle`,e.LOADING_AGENT=`loading_agent`,e.READY=`ready`,e}({});function $Zt(e){let{url:t,requestOptions:n,autoInit:r=!0,protocolCallbacks:i,enableModelSelect:a=!0}=e,o=un(t);if(!o)throw Error(`[useChatBootstrap] url is required`);let s=sn(K9.IDLE),l=sn(null),u=sn(!1),d=new Map,f=new Gd({onStart:()=>{i?.onStart?.()},onMessage:e=>{i?.onMessage?.(e)},onDone:()=>{i?.onDone?.()},onError:e=>{i?.onError?.(e)}}),p=cSe({requestData:uSe(o,n),protocol:f});f.injectMessageModule(p.message);let m=pi(()=>s.value===K9.LOADING_AGENT),h=pi(()=>s.value===K9.READY),g=pi(()=>p.agent.info.value??null),_=pi(()=>g.value?.agentName??``),v=pi(()=>p.session.current.value??null),y=pi(()=>p.session.list.value??[]),b=null,x=0,S=async e=>{l.value=null;try{if(s.value=K9.LOADING_AGENT,await SZt(p,{enableModelSelect:a}),e!==x)return;s.value=K9.READY,u.value=!0}catch(t){if(e!==x)return;throw console.error(`[useChatBootstrap] Initialization failed:`,t),l.value=t,s.value=K9.ERROR,t}},C=async()=>{if(u.value)return;if(b)return b;let e=x;return b=S(e).finally(()=>{e===x&&(b=null)}),b},w=()=>{x+=1,s.value=K9.IDLE,l.value=null,u.value=!1,b=null},T=async()=>{w(),await C()},E=async e=>{w();let t=p.http;t?.updateConfig?t.updateConfig({urlPrefix:e}):console.warn(`[useChatBootstrap] chatHelper.http.updateConfig is not implemented yet, URL change may not take effect`),await C()};return Rn(()=>un(t),(e,t)=>{e&&e!==t&&t&&E(e).catch(()=>{})}),r&&Promise.resolve().then(()=>{C().catch(()=>{})}),{chatHelper:p,protocol:f,phase:s,isInitializing:m,isReady:h,error:l,agentInfo:g,agentName:_,currentSession:v,sessionList:y,initialize:C,retry:T,updateConfig:E,registerExtension:(e,t)=>{d.set(e,t)},getExtension:e=>d.get(e)}}function eQt(e){return{sendMessage:t=>e(`send-message`,{content:t}),receiveStart:()=>e(`receive-start`,{}),receiveText:()=>e(`receive-text`,{}),receiveEnd:()=>e(`receive-end`,{}),stop:()=>e(`stop`,{}),newChat:()=>e(`new-chat`,{}),newChatCreated:t=>e(`new-chat-created`,{session:t}),historyClick:t=>e(`history-click`,{event:t}),autoGenerateName:()=>e(`auto-generate-name`,{}),helpClick:()=>e(`help-click`,{}),rename:t=>e(`rename`,{newName:t}),share:()=>e(`share`,{}),transferMessages:t=>e(`transfer-messages`,{messageIds:t}),shareMessages:t=>e(`share-messages`,{messageIds:t})}}function tQt(e){let{componentManager:t,emit:n,debug:r=!1}=e,i=[],a=()=>{for(let[e,a]of Object.entries(kZt)){if(a===null)continue;let o=t.on(e,t=>{let i=AZt(e,t);r&&console.debug(`[useEventBridge] ${e} -> ${a}`,i),n(a,...i)});i.push(o)}},o=(e,n)=>{r&&console.debug(`[useEventBridge] Forwarding to manager: ${e}`,n),t.emit(e,n)},s=(e,...t)=>{r&&console.debug(`[useEventBridge] Direct emit: ${e}`,t),n(e,...t)},l=()=>{i.forEach(e=>e()),i.length=0};return a(),lr(()=>{l()}),{forwardToManager:o,emitDirect:s,cleanup:l}}function nQt(e){let{props:t,emit:n}=e,r=sn(),i=sn(),a=pi(()=>bSe(t.url??``)),o=OZt({initialPanelVisible:!1,initialNimbusMinimized:t.defaultMinimize,enablePopup:t.enablePopup,enableNimbus:!t.hideNimbus,enableDraggable:t.draggable}),s=o.panelVisible,l=o.nimbusMinimized,{forwardToManager:u}=tQt({componentManager:o,emit:n}),d=eQt(u),f=new WeakSet,p=null,m=null,h=()=>{p&&=(clearTimeout(p.timer),null)},g=e=>{let{apiName:n,error:r,action:i,source:a,shouldToast:s=!0}=e,l=r instanceof Error?r.message:String(r),u=r instanceof Error?r:null;u&&f.has(u)||(u&&f.add(u),a!==`http`&&u&&p?.error===u&&h(),console.error(`[AIBlueking] ${n} error:`,r),s&&t.errorToast!==!1&&cd({message:l||tf(`请求失败`),theme:`error`}),o.emitInternal(`sdk-error`,{apiName:n,action:i,source:a,code:-1,message:l,data:r}))},_=e=>{h();let t=m??(x.value?`chat`:`init`);p={error:e,timer:setTimeout(()=>{p=null,g({apiName:t,error:e,source:`http`})},0)}},v=async(e,t)=>{let n=m;m=e;try{return await t()}finally{m=n}},y=e=>{g({apiName:`chat`,error:e,source:`business`})},{chatHelper:b,isReady:x,error:S,agentInfo:C,agentName:w,currentSession:T,initialize:E}=$Zt({url:a,requestOptions:()=>un(t.requestOptions),autoInit:!0,enableModelSelect:t.enableModelSelect!==!1,protocolCallbacks:{onStart:()=>{d.receiveStart()},onMessage:()=>{d.receiveText()},onDone:()=>{d.receiveEnd()},onError:e=>{g({apiName:`chat`,error:e,source:`protocol`})}}}),D=b;D.onError?.(e=>{_(e)},{ignoreErrors:t.ignoreErrors});let O=new wZt(D.session,D.agent,null,{enableChatSession:t.enableChatSession,initialSessionCode:t.initialSessionCode,alwaysCreateNewSession:t.alwaysCreateNewSession},D.message),k=new TZt(D.message,D.session),A=new EZt(null,t.shortcuts||[]),j=null,M=()=>t.loadRecentSessionOnMount?(j||=O.loadRecentSession({skipLoadSessions:!0}).finally(()=>{j=null}),j):Promise.resolve(),N=async()=>{await v(`init`,async()=>{await E(),await M()})},P={appendTo:e=>{let t=e.closest(`.draggable-container-content`);return console.log(`[ai-blueking] appendTo called, ref:`,e),console.log(`[ai-blueking] appendTo closest result:`,t),t??document.body}},F=pi(()=>o.isCompressed.value),I=pi(()=>w.value),L=pi(()=>D.message.list.value.length===0),R=pi(()=>t.resources?.length?t.resources:C.value?.resources??[]),ee=pi(()=>t.prompts?.length?t.prompts:C.value?.conversationSettings?.predefinedQuestions??[]),te=pi(()=>(C.value?.relatedSkills??[]).map(e=>({skill_name:e.skill_name,skill_code:e.skill_code,description:e.description,icon:e.icon})));Rn(()=>S.value,e=>{e&&(h(),g({apiName:`init`,error:e,source:`http`}))});let ne=e=>{e.conversationSettings?.commands&&A.setAgentShortcuts(e.conversationSettings.commands)},re=async()=>{try{await D.agent.getAgentInfo();let e=C.value;return e&&ne(e),e}catch(e){return g({apiName:`getAgentInfo`,error:e,source:`http`}),null}};Rn(()=>x.value,async e=>{if(e&&C.value&&(ne(C.value),C.value.conversationSettings&&u(`session-initialized`,{openingRemark:C.value.conversationSettings.openingRemark||``,predefinedQuestions:C.value.conversationSettings.predefinedQuestions||[]}),t.loadRecentSessionOnMount))try{await M()}catch(e){console.error(`[AIBlueking] Failed to load recent session:`,e)}},{immediate:!0}),Rn(()=>t.shortcuts,e=>{A.setShortcuts(e||[])},{immediate:!0});let ie=e=>{TSe(e)&&(e.preventDefault(),s.value?o.hidePanel():o.showPanel())};return sr(async()=>{r.value&&o.setContainerRef(r.value),window.addEventListener(`keydown`,ie)}),cr(()=>{h(),window.removeEventListener(`keydown`,ie),o.destroy()}),{chatHelper:D,componentManager:o,sessionBusinessManager:O,shareBusinessManager:k,shortcutManager:A,forwarders:d,forwardToManager:u,chatBotRef:i,draggableContainerRef:r,panelVisible:s,nimbusMinimized:l,normalizedUrl:a,agentInfo:C,agentName:I,currentSession:T,isCompressed:F,isWelcomeState:L,messageToolsTippyOptions:P,agentResources:R,agentPrompts:ee,agentSkills:te,handleError:y,reportSdkError:g,ensureSessionReady:N,updateAgentInfo:re}}function rQt(e){let{shortcutManager:t,chatBotRef:n,forwardToManager:r,show:i,props:a}=e,o=sn(!1),s=sn(``);return{aiSelectionVisible:o,selectedText:s,filteredPopupShortcuts:pi(()=>{let e=t.effectiveShortcuts.value;return typeof a.shortcutFilter==`function`&&s.value?e.filter(e=>a.shortcutFilter?.(e,s.value)):e}),handleSelectionChange:e=>{s.value=e},handleAiSelectionShortcut:async(e,t)=>{o.value=!1,await i(),n.value&&(e.components?.length?n.value.selectShortcut(e,t):(n.value.selectShortcut(e),n.value.setCiteText(t),n.value.focusInput())),r(`shortcut-click`,{shortcut:e,source:`popup`})}}}function iQt(e,t=!1){let n=window.innerHeight-48-40,r=window.innerWidth-48-16,i=sn(r),a=sn(n),o=sn(0),s=sn(t),l=sn(!1),u=sn(!1),d=0,f=e=>{e?i.value=window.innerWidth-12:i.value=r},p=(e,t)=>{a.value=t,o.value=t-n},m=()=>{Dn(()=>{a.value=window.innerHeight-48-40+o.value,s.value?i.value=window.innerWidth-12:i.value=window.innerWidth-48-16})};return sr(()=>{window.addEventListener(`resize`,m),m()}),lr(()=>{window.removeEventListener(`resize`,m)}),{nimbusWidth:48,nimbusHeight:48,nimbusLeft:i,nimbusTop:a,isMinimize:s,isHovering:l,isDragging:u,handleNimbusDragging:p,handleNimbusMinimize:f,handleClick:()=>{if(u.value){u.value=!1;return}e(`click`)},handleMinimize:()=>{s.value=!s.value,e(`minimize`,s.value),s.value?i.value=window.innerWidth-12:i.value=window.innerWidth-60},handleDragging:(e,t)=>{i.value=e,a.value=t},handleMouseEnter:()=>{l.value=!0},handleMouseLeave:()=>{l.value=!1},handleMouseDown:()=>{d=Date.now(),u.value=!1},handleMouseUp:()=>{Date.now()-d>200&&(u.value=!0)}}}var aQt=560;function oQt(e){let{componentManager:t,chatBotRef:n,forwarders:r,forwardToManager:i,beforeNimbusClick:a,ensureSessionReady:o}=e,s=async e=>{t.showPanel(e),o&&await o(),e&&n.value&&await n.value.switchSession(e)},l=async e=>{await s(e)},u=()=>{t.hidePanel()};return{show:s,handleShow:l,hide:u,handleClose:()=>{u()},handleNimbusClick:async()=>{if(a&&await a()===!1){t.emit(`nimbus-click`,{});return}t.handleNimbusClick()},handleDragging:e=>{t.handleDragging(e)},handleResizing:e=>{t.handleResizing(e)},handleDragStop:e=>{t.handleDragStop(e)},handleResizeStop:e=>{t.handleResizeStop(e)},handleToggleCompression:()=>{t.container.toggleCompression()},handleCompressionChange:e=>{t.setCompressed(e)},handleExecutionPanelChange:(e,n)=>{if(e)t.collapseSidePanel();else{let e=Math.max(aQt,n??0);t.expandForSidePanel(e)}},sendMessage:async e=>{n.value&&await n.value.sendMessage(e)},handleReceiveStart:()=>{r.receiveStart()},handleReceiveText:()=>{r.receiveText()},handleReceiveEnd:()=>{r.receiveEnd()},handleStop:()=>{r.stop()},stopGeneration:()=>{n.value&&n.value.stopGeneration()},updatePosition:(e,n)=>{t.container.updatePosition(e,n)},updateSize:(e,n)=>{t.container.updateSize(e,n)},updatePositionAndSize:(e,n,r,i)=>{t.container.updatePositionAndSize(e,n,r,i)},setCiteText:e=>{n.value&&n.value.setCiteText(e)},focusInput:()=>{n.value&&n.value.focusInput()},selectShortcut:(e,t)=>{n.value&&n.value.selectShortcut(e,t)},sendShortcut:(e,t)=>n.value?n.value.sendShortcut(e,t):Promise.resolve(),getChatHelper:()=>n.value?n.value.getChatHelper():null,handleShortcutClick:e=>{i(`shortcut-click`,e)}}}function sQt(e){let{chatHelper:t,sessionBusinessManager:n,chatBotRef:r,forwarders:i,reportSdkError:a,currentSession:o}=e,s=sn(``),l=sn(!0),u=sn(!1),d=sn(!1),f=()=>mSe(t.message.list.value);Rn(()=>o.value,e=>{e&&(s.value=e.sessionName||``,u.value=(e.sessionContentCount??0)>0||f())},{immediate:!0}),Rn(()=>t.message.list.value.length,()=>{u.value=f()});let p=async()=>{r.value?.exitShareMode(),i.newChat()},m=e=>{i.newChatCreated(e)},h=e=>{i.historyClick(e)},g=async e=>{try{r.value?.exitShareMode(),await n.switchSession(e)}catch(e){console.error(`[AIBlueking] Failed to switch history session:`,e),a({apiName:`session`,action:`historySwitch`,error:e,source:`business`})}},_=async e=>{try{await n.deleteSession(e)}catch(e){console.error(`[AIBlueking] Failed to delete history session:`,e),a({apiName:`session`,action:`historyDelete`,error:e,source:`business`})}},v=async(e,t)=>{try{await n.updateSessionName(e,t)}catch(e){console.error(`[AIBlueking] Failed to rename history session:`,e),a({apiName:`session`,action:`historyRename`,error:e,source:`business`})}},y=async()=>{let e=t.session.current?.value?.sessionCode;if(!e){console.error(`[AIBlueking] Cannot auto-generate name: no active session`);return}d.value=!0;try{await t.session.renameSession(e);let n=t.session.list.value.find(t=>t.sessionCode===e);n&&(s.value=n.sessionName||``)}catch(e){console.error(`[AIBlueking] Failed to auto-generate session name:`,e),a({apiName:`session`,action:`autoGenerateName`,error:e,source:`business`})}finally{d.value=!1}i.autoGenerateName()},b=()=>{i.helpClick()},x=async e=>{let n=t.session.current?.value;if(!n){console.error(`[AIBlueking] Cannot rename: no active session`);return}try{await t.session.updateSession({...n,sessionName:e}),s.value=e}catch(e){console.error(`[AIBlueking] Failed to rename session:`,e),a({apiName:`session`,action:`rename`,error:e,source:`business`})}i.rename(e)},S=e=>{s.value=e,i.rename(e)},C=e=>{e&&(s.value=e.sessionName||``,u.value=(e.sessionContentCount??0)>0||f())},w=()=>r.value?.selectedLlmCode;return{sessionName:s,hasPermission:l,hasSessionContents:u,autoGenerateLoading:d,handleNewChat:p,handleNewChatCreated:m,handleHistoryClick:h,handleHistorySessionSwitch:g,handleHistorySessionDelete:_,handleHistorySessionRename:v,handleAutoGenerateName:y,handleHelpClick:b,handleRename:x,handleSessionRenamed:S,handleSessionSwitched:C,addNewSession:async e=>{e?await n.createSession({...e,model:e.model??w()}):await n.createNewSession({model:w()})},switchToSession:async e=>{r.value&&await r.value.switchSession(e)},updateSessionName:async(e,t)=>{try{await n.updateSessionName(e,t),s.value=t}catch(e){console.error(`[AIBlueking] Failed to update session name:`,e),a({apiName:`session`,action:`updateSessionName`,error:e,source:`business`})}}}}function cQt(e){let{shareBusinessManager:t,chatBotRef:n,emit:r,forwarders:i,reportSdkError:a}=e,o=sn(!1);return{isShareLoading:o,handleShare:()=>{n.value?.enterShareMode(),i.share()},handleCancelShare:()=>{n.value?.exitShareMode()},handleConfirmShare:async(e,s)=>{if(!WZt(s)){n.value?.exitShareMode(),r(`confirm-share`,e,s);return}o.value=!0;try{let{shareUrl:a,userMessageIds:o}=await t.shareMessages(e);await xSe(a),cd({message:tf(`分享链接已复制到剪贴板`),theme:`success`}),n.value?.exitShareMode(),i.shareMessages(o),r(`confirm-share`,e,s)}catch(e){console.error(`[AIBlueking] Failed to share messages:`,e),a({apiName:`share`,action:`confirmShare`,error:e,source:`business`})}finally{o.value=!1}}}}function lQt(e={}){let t=sn([]),n=(n,r,i={})=>{try{let a=typeof n==`string`?document.querySelector(n):n;if(!a)return console.warn(`Tooltip target not found: ${n}`),null;let o=gf(a,{content:r,placement:`top`,arrow:!0,delay:[300,0],theme:`ai-blueking-tooltip`,...e,...i});return t.value.push(o),o}catch(e){return console.error(`Failed to create tooltip:`,e),null}},r=(e,t,r={})=>{let i=document.querySelectorAll(e),a=[];return i.forEach(e=>{let i=n(e,t,r);i&&a.push(i)}),a},i=e=>{let t=[];return e.forEach(({element:e,content:r,options:i})=>{let a=n(e,r,i);a&&t.push(a)}),t},a=()=>{t.value.forEach(e=>{e.destroy()}),t.value=[]};return cr(()=>{a()}),{instances:t,createTooltip:n,createTooltipsForSelector:r,createMultipleTooltips:i,destroyAll:a,updateContent:(e,t)=>{e.setContent(t)},destroyInstance:e=>{e.destroy()}}}var uQt={url:``,title:``,extCls:``,hideNimbus:!1,hideHeader:!1,enablePopup:!0,draggable:!0,enableChatSession:!0,enableModelSelect:!0,renderMode:Mp.Chat,defaultWidth:400,defaultHeight:void 0,defaultTop:0,defaultLeft:void 0,maxWidth:1e3,miniPadding:0,nimbusSize:`normal`,defaultMinimize:!1,shortcuts:()=>[],shortcutLimit:3,shortcutFilter:void 0,hideDefaultTrigger:!1,requestOptions:()=>({}),teleportTo:`body`,placeholder:void 0,helloText:tf(`你好,我是小鲸`),useAgentName:!1,disabledInput:!1,showHistoryIcon:!0,showNewChatIcon:!0,showCompressionIcon:!0,showMoreIcon:!0,initialSessionCode:``,autoSwitchToInitialSession:!1,alwaysCreateNewSession:!1,loadRecentSessionOnMount:!0,prompts:()=>[],dropdownMenuConfig:()=>({showRename:!0,showAutoGenerate:!0,showShare:!0}),defaultChatInputPosition:void 0,errorToast:!0,ignoreErrors:()=>[]};function dQt(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function q9(e,t,n,r=1){let[i,a]=typeof r==`number`?[r,r]:r;return[Math.round(t/i/e[0])*e[0],Math.round(n/a/e[1])*e[1]]}function fQt(e,t,n){return e-t-n}function pQt(e,t,n){return e-t-n}function J9(e,t,n){return t!==null&&e<t?t:n!==null&&n<e?n:e}function mQt(e,t,n){let r=e,i=[`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`].find(e=>dQt(r[e]));if(!dQt(r[i]))return!1;do{if(r[i](t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function hQt(e){let t=window.getComputedStyle(e);return[parseFloat(t.getPropertyValue(`width`),10),parseFloat(t.getPropertyValue(`height`),10)]}function Y9(e,t,n){e&&(e.attachEvent?e.attachEvent(`on`+t,n):e.addEventListener?e.addEventListener(t,n,!0):e[`on`+t]=n)}function X9(e,t,n){e&&(e.detachEvent?e.detachEvent(`on`+t,n):e.removeEventListener?e.removeEventListener(t,n,!0):e[`on`+t]=null)}var gQt=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Z9={mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`},touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`}},_Qt={userSelect:`none`,MozUserSelect:`none`,WebkitUserSelect:`none`,MsUserSelect:`none`},vQt={userSelect:`auto`,MozUserSelect:`auto`,WebkitUserSelect:`auto`,MsUserSelect:`auto`},Q9=Z9.mouse,yQt={replace:!0,name:`vue-draggable-resizable`,props:{className:{type:String,default:`vdr`},classNameDraggable:{type:String,default:`draggable`},classNameResizable:{type:String,default:`resizable`},classNameDragging:{type:String,default:`dragging`},classNameResizing:{type:String,default:`resizing`},classNameActive:{type:String,default:`active`},classNameHandle:{type:String,default:`handle`},disableUserSelect:{type:Boolean,default:!0},enableNativeDrag:{type:Boolean,default:!1},preventDeactivation:{type:Boolean,default:!1},active:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},lockAspectRatio:{type:Boolean,default:!1},w:{type:[Number,String],default:200,validator:e=>typeof e==`number`?e>0:e===`auto`},h:{type:[Number,String],default:200,validator:e=>typeof e==`number`?e>0:e===`auto`},minWidth:{type:Number,default:0,validator:e=>e>=0},minHeight:{type:Number,default:0,validator:e=>e>=0},maxWidth:{type:Number,default:null,validator:e=>e>=0},maxHeight:{type:Number,default:null,validator:e=>e>=0},x:{type:Number,default:0},y:{type:Number,default:0},z:{type:[String,Number],default:`auto`,validator:e=>typeof e==`string`?e===`auto`:e>=0},handles:{type:Array,default:()=>[`tl`,`tm`,`tr`,`mr`,`br`,`bm`,`bl`,`ml`],validator:e=>{let t=new Set([`tl`,`tm`,`tr`,`mr`,`br`,`bm`,`bl`,`ml`]);return new Set(e.filter(e=>t.has(e))).size===e.length}},dragHandle:{type:String,default:null},dragCancel:{type:String,default:null},axis:{type:String,default:`both`,validator:e=>[`x`,`y`,`both`].includes(e)},grid:{type:Array,default:()=>[1,1]},parent:{type:Boolean,default:!1},scale:{type:[Number,Array],default:1,validator:e=>typeof e==`number`?e>0:e.length===2&&e[0]>0&&e[1]>0},onDragStart:{type:Function,default:()=>!0},onDrag:{type:Function,default:()=>!0},onResizeStart:{type:Function,default:()=>!0},onResize:{type:Function,default:()=>!0}},data:function(){return{left:this.x,top:this.y,right:null,bottom:null,width:null,height:null,widthTouched:!1,heightTouched:!1,aspectFactor:null,parentWidth:null,parentHeight:null,handle:null,enabled:this.active,resizing:!1,dragging:!1,dragEnable:!1,resizeEnable:!1,zIndex:this.z}},created:function(){this.maxWidth&&this.minWidth>this.maxWidth&&console.warn(`[Vdr warn]: Invalid prop: minWidth cannot be greater than maxWidth`),this.maxHeight&&this.minHeight>this.maxHeight&&console.warn(`[Vdr warn]: Invalid prop: minHeight cannot be greater than maxHeight`),this.resetBoundsAndMouseState()},mounted:function(){this.enableNativeDrag||(this.$el.ondragstart=()=>!1);let[e,t]=this.getParentSize();this.parentWidth=e,this.parentHeight=t;let[n,r]=hQt(this.$el);this.aspectFactor=(this.w===`auto`?n:this.w)/(this.h===`auto`?r:this.h),this.width=this.w===`auto`?n:this.w,this.height=this.h===`auto`?r:this.h,this.right=this.parentWidth-this.width-this.left,this.bottom=this.parentHeight-this.height-this.top,this.active&&this.$emit(`activated`),Y9(document.documentElement,`mousedown`,this.deselect),Y9(document.documentElement,`touchend touchcancel`,this.deselect),Y9(window,`resize`,this.checkParentSize)},beforeUnmount:function(){X9(document.documentElement,`mousedown`,this.deselect),X9(document.documentElement,`touchstart`,this.handleUp),X9(document.documentElement,`mousemove`,this.move),X9(document.documentElement,`touchmove`,this.move),X9(document.documentElement,`mouseup`,this.handleUp),X9(document.documentElement,`touchend touchcancel`,this.deselect),X9(window,`resize`,this.checkParentSize)},methods:{resetBoundsAndMouseState(){this.mouseClickPosition={mouseX:0,mouseY:0,x:0,y:0,w:0,h:0},this.bounds={minLeft:null,maxLeft:null,minRight:null,maxRight:null,minTop:null,maxTop:null,minBottom:null,maxBottom:null}},checkParentSize(){if(this.parent){let[e,t]=this.getParentSize();this.parentWidth=e,this.parentHeight=t,this.right=this.parentWidth-this.width-this.left,this.bottom=this.parentHeight-this.height-this.top}},getParentSize(){if(this.parent){let e=window.getComputedStyle(this.$el.parentNode,null);return[parseInt(e.getPropertyValue(`width`),10),parseInt(e.getPropertyValue(`height`),10)]}return[null,null]},elementTouchDown(e){Q9=Z9.touch,this.elementDown(e)},elementMouseDown(e){Q9=Z9.mouse,this.elementDown(e)},elementDown(e){if(e instanceof MouseEvent&&e.button!==0)return;let t=e.target||e.srcElement;if(this.$el.contains(t)){if(this.onDragStart(e)===!1)return;if(this.dragHandle&&!mQt(t,this.dragHandle,this.$el)||this.dragCancel&&mQt(t,this.dragCancel,this.$el)){this.dragging=!1;return}this.enabled||(this.enabled=!0,this.$emit(`activated`),this.$emit(`update:active`,!0)),this.draggable&&(this.dragEnable=!0),this.mouseClickPosition.mouseX=e.touches?e.touches[0].pageX:e.pageX,this.mouseClickPosition.mouseY=e.touches?e.touches[0].pageY:e.pageY,this.mouseClickPosition.left=this.left,this.mouseClickPosition.right=this.right,this.mouseClickPosition.top=this.top,this.mouseClickPosition.bottom=this.bottom,this.parent&&(this.bounds=this.calcDragLimits()),Y9(document.documentElement,Q9.move,this.move),Y9(document.documentElement,Q9.stop,this.handleUp)}},calcDragLimits(){return{minLeft:this.left%this.grid[0],maxLeft:Math.floor((this.parentWidth-this.width-this.left)/this.grid[0])*this.grid[0]+this.left,minRight:this.right%this.grid[0],maxRight:Math.floor((this.parentWidth-this.width-this.right)/this.grid[0])*this.grid[0]+this.right,minTop:this.top%this.grid[1],maxTop:Math.floor((this.parentHeight-this.height-this.top)/this.grid[1])*this.grid[1]+this.top,minBottom:this.bottom%this.grid[1],maxBottom:Math.floor((this.parentHeight-this.height-this.bottom)/this.grid[1])*this.grid[1]+this.bottom}},deselect(e){let t=e.target||e.srcElement,n=RegExp(this.className+`-([trmbl]{2})`,``);!this.$el.contains(t)&&!n.test(t.className)&&(this.enabled&&!this.preventDeactivation&&(this.enabled=!1,this.$emit(`deactivated`),this.$emit(`update:active`,!1)),X9(document.documentElement,Q9.move,this.handleResize)),this.resetBoundsAndMouseState()},handleTouchDown(e,t){Q9=Z9.touch,this.handleDown(e,t)},handleDown(e,t){t instanceof MouseEvent&&t.which!==1||this.onResizeStart(e,t)!==!1&&(t.stopPropagation&&t.stopPropagation(),this.lockAspectRatio&&!e.includes(`m`)?this.handle=`m`+e.substring(1):this.handle=e,this.resizeEnable=!0,this.mouseClickPosition.mouseX=t.touches?t.touches[0].pageX:t.pageX,this.mouseClickPosition.mouseY=t.touches?t.touches[0].pageY:t.pageY,this.mouseClickPosition.left=this.left,this.mouseClickPosition.right=this.right,this.mouseClickPosition.top=this.top,this.mouseClickPosition.bottom=this.bottom,this.bounds=this.calcResizeLimits(),Y9(document.documentElement,Q9.move,this.handleResize),Y9(document.documentElement,Q9.stop,this.handleUp))},calcResizeLimits(){let e=this.minW,t=this.minH,n=this.maxW,r=this.maxH,i=this.aspectFactor,[a,o]=this.grid,s=this.width,l=this.height,u=this.left,d=this.top,f=this.right,p=this.bottom;this.lockAspectRatio&&(e/t>i?t=e/i:e=i*t,n&&r?(n=Math.min(n,i*r),r=Math.min(r,n/i)):n?r=n/i:r&&(n=i*r)),n-=n%a,r-=r%o;let m={minLeft:null,maxLeft:null,minTop:null,maxTop:null,minRight:null,maxRight:null,minBottom:null,maxBottom:null};return this.parent?(m.minLeft=u%a,m.maxLeft=u+Math.floor((s-e)/a)*a,m.minTop=d%o,m.maxTop=d+Math.floor((l-t)/o)*o,m.minRight=f%a,m.maxRight=f+Math.floor((s-e)/a)*a,m.minBottom=p%o,m.maxBottom=p+Math.floor((l-t)/o)*o,n&&(m.minLeft=Math.max(m.minLeft,this.parentWidth-f-n),m.minRight=Math.max(m.minRight,this.parentWidth-u-n)),r&&(m.minTop=Math.max(m.minTop,this.parentHeight-p-r),m.minBottom=Math.max(m.minBottom,this.parentHeight-d-r)),this.lockAspectRatio&&(m.minLeft=Math.max(m.minLeft,u-d*i),m.minTop=Math.max(m.minTop,d-u/i),m.minRight=Math.max(m.minRight,f-p*i),m.minBottom=Math.max(m.minBottom,p-f/i))):(m.minLeft=null,m.maxLeft=u+Math.floor((s-e)/a)*a,m.minTop=null,m.maxTop=d+Math.floor((l-t)/o)*o,m.minRight=null,m.maxRight=f+Math.floor((s-e)/a)*a,m.minBottom=null,m.maxBottom=p+Math.floor((l-t)/o)*o,n&&(m.minLeft=-(f+n),m.minRight=-(u+n)),r&&(m.minTop=-(p+r),m.minBottom=-(d+r)),this.lockAspectRatio&&n&&r&&(m.minLeft=Math.min(m.minLeft,-(f+n)),m.minTop=Math.min(m.minTop,-(r+p)),m.minRight=Math.min(m.minRight,-u-n),m.minBottom=Math.min(m.minBottom,-d-r))),m},move(e){this.resizing?this.handleResize(e):this.dragEnable&&this.handleDrag(e)},handleDrag(e){let t=this.axis,n=this.grid,r=this.bounds,i=this.mouseClickPosition,[a,o]=q9(n,t&&t!==`y`?i.mouseX-(e.touches?e.touches[0].pageX:e.pageX):0,t&&t!==`x`?i.mouseY-(e.touches?e.touches[0].pageY:e.pageY):0,this.scale),s=J9(i.left-a,r.minLeft,r.maxLeft),l=J9(i.top-o,r.minTop,r.maxTop);if(this.onDrag(s,l)===!1)return;let u=J9(i.right+a,r.minRight,r.maxRight),d=J9(i.bottom+o,r.minBottom,r.maxBottom);this.left=s,this.top=l,this.right=u,this.bottom=d,this.$emit(`dragging`,this.left,this.top),this.dragging=!0},moveHorizontally(e){let[t,n]=q9(this.grid,e,this.top,1),r=J9(t,this.bounds.minLeft,this.bounds.maxLeft);this.left=r,this.right=this.parentWidth-this.width-r},moveVertically(e){let[t,n]=q9(this.grid,this.left,e,1),r=J9(n,this.bounds.minTop,this.bounds.maxTop);this.top=r,this.bottom=this.parentHeight-this.height-r},handleResize(e){let t=this.left,n=this.top,r=this.right,i=this.bottom,a=this.mouseClickPosition,o=this.aspectFactor,s=a.mouseX-(e.touches?e.touches[0].pageX:e.pageX),l=a.mouseY-(e.touches?e.touches[0].pageY:e.pageY);!this.widthTouched&&s&&(this.widthTouched=!0),!this.heightTouched&&l&&(this.heightTouched=!0);let[u,d]=q9(this.grid,s,l,this.scale);this.handle.includes(`b`)?(i=J9(a.bottom+d,this.bounds.minBottom,this.bounds.maxBottom),this.lockAspectRatio&&this.resizingOnY&&(r=this.right-(this.bottom-i)*o)):this.handle.includes(`t`)&&(n=J9(a.top-d,this.bounds.minTop,this.bounds.maxTop),this.lockAspectRatio&&this.resizingOnY&&(t=this.left-(this.top-n)*o)),this.handle.includes(`r`)?(r=J9(a.right+u,this.bounds.minRight,this.bounds.maxRight),this.lockAspectRatio&&this.resizingOnX&&(i=this.bottom-(this.right-r)/o)):this.handle.includes(`l`)&&(t=J9(a.left-u,this.bounds.minLeft,this.bounds.maxLeft),this.lockAspectRatio&&this.resizingOnX&&(n=this.top-(this.left-t)/o));let f=fQt(this.parentWidth,t,r),p=pQt(this.parentHeight,n,i);this.onResize(this.handle,t,n,f,p)!==!1&&(this.left=t,this.top=n,this.right=r,this.bottom=i,this.width=f,this.height=p,this.$emit(`resizing`,this.left,this.top,this.width,this.height),this.resizing=!0)},changeWidth(e){let[t,n]=q9(this.grid,e,0,1),r=J9(this.parentWidth-t-this.left,this.bounds.minRight,this.bounds.maxRight),i=this.bottom;this.lockAspectRatio&&(i=this.bottom-(this.right-r)/this.aspectFactor);let a=fQt(this.parentWidth,this.left,r),o=pQt(this.parentHeight,this.top,i);this.right=r,this.bottom=i,this.width=a,this.height=o},changeHeight(e){let[t,n]=q9(this.grid,0,e,1),r=J9(this.parentHeight-n-this.top,this.bounds.minBottom,this.bounds.maxBottom),i=this.right;this.lockAspectRatio&&(i=this.right-(this.bottom-r)*this.aspectFactor);let a=fQt(this.parentWidth,this.left,i),o=pQt(this.parentHeight,this.top,r);this.right=i,this.bottom=r,this.width=a,this.height=o},handleUp(e){this.handle=null,this.resetBoundsAndMouseState(),this.dragEnable=!1,this.resizeEnable=!1,this.resizing&&(this.resizing=!1,this.$emit(`resizeStop`,this.left,this.top,this.width,this.height)),this.dragging&&(this.dragging=!1,this.$emit(`dragStop`,this.left,this.top)),X9(document.documentElement,Q9.move,this.handleResize)}},computed:{style(){return{transform:`translate(${this.left}px, ${this.top}px)`,width:this.computedWidth,height:this.computedHeight,zIndex:this.zIndex,...this.dragging&&this.disableUserSelect?_Qt:vQt}},actualHandles(){return this.resizable?this.handles:[]},computedWidth(){return this.w===`auto`&&!this.widthTouched?`auto`:this.width+`px`},computedHeight(){return this.h===`auto`&&!this.heightTouched?`auto`:this.height+`px`},minW(){return this.minWidth},minH(){return this.minHeight},maxW(){return this.maxWidth},maxH(){return this.maxHeight},resizingOnX(){return!!this.handle&&(this.handle.includes(`l`)||this.handle.includes(`r`))},resizingOnY(){return!!this.handle&&(this.handle.includes(`t`)||this.handle.includes(`b`))},isCornerHandle(){return!!this.handle&&[`tl`,`tr`,`br`,`bl`].includes(this.handle)}},watch:{active(e){this.enabled=e,e?this.$emit(`activated`):this.$emit(`deactivated`)},z(e){(e>=0||e===`auto`)&&(this.zIndex=e)},x(e){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcDragLimits()),this.moveHorizontally(e))},y(e){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcDragLimits()),this.moveVertically(e))},lockAspectRatio(e){e?this.aspectFactor=this.width/this.height:this.aspectFactor=void 0},w(e){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcResizeLimits()),this.changeWidth(e))},h(e){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcResizeLimits()),this.changeHeight(e))}}},bQt=[`onMousedown`,`onTouchstart`];function xQt(e,t,n,r,i,a){return B(),V(`div`,{style:ge(a.style),class:xe([{[n.classNameActive]:e.enabled,[n.classNameDragging]:e.dragging,[n.classNameResizing]:e.resizing,[n.classNameDraggable]:n.draggable,[n.classNameResizable]:n.resizable},n.className]),onMousedown:t[0]||=(...e)=>a.elementMouseDown&&a.elementMouseDown(...e),onTouchstart:t[1]||=(...e)=>a.elementTouchDown&&a.elementTouchDown(...e)},[(B(!0),V(Rr,null,fr(a.actualHandles,t=>(B(),V(`div`,{key:t,class:xe([n.classNameHandle,n.classNameHandle+`-`+t]),style:ge({display:e.enabled?`block`:`none`}),onMousedown:Ni(e=>a.handleDown(t,e),[`stop`,`prevent`]),onTouchstart:Ni(e=>a.handleTouchDown(t,e),[`stop`,`prevent`])},[mr(e.$slots,t)],46,bQt))),128)),mr(e.$slots,`default`)],38)}var SQt=gQt(yQt,[[`render`,xQt]]);function CQt(e){CQt.installed||(CQt.installed=!0,e.component(`VueDraggableResizable`,SQt))}var wQt={install:CQt},$9=null;typeof window<`u`?$9=window.Vue:typeof global<`u`&&($9=global.Vue),$9&&$9.use(wQt);function TQt(e={},t){let n=e.initWidth||400,r=e.minWidth||400,i=e.minHeight||400,a=e.maxWidthPercent||40,o=e.compressedHeight||800,s=e.compressedPadding===void 0?0:e.compressedPadding,l=sn(e.defaultLeft===void 0?window.innerWidth-n:e.defaultLeft),u=sn(e.defaultTop===void 0?0:e.defaultTop),d=sn(e.defaultHeight===void 0?window.innerHeight-(e.defaultTop===void 0?0:e.defaultTop):e.defaultHeight),f=sn(n),p=sn(u.value),m=sn(l.value),h=sn(f.value),g=sn(d.value),_=sn(Math.max(window.innerWidth*(a/100),h.value)),v=sn(!1),y=sn(0),b=null,x=null,S=sn(!1),C=e=>{let t=window.innerWidth,n={...e};return n.width>t&&(n.width=t),n.x+n.width>t&&(n.x=t-n.width),n.x<0&&(n.x=0),n},w=()=>({x:m.value,y:p.value,width:h.value,height:g.value}),T=(e,n)=>{m.value=e,p.value=n,y.value=e-(window.innerWidth-h.value),t?.onDragging?.(w())},E=(e,n,r,i)=>{m.value=e,p.value=n,h.value=Math.min(r,_.value),g.value=i,t?.onResizing?.(w())},D=(e,n)=>{m.value=e,p.value=n,y.value=e-(window.innerWidth-h.value),S.value&&(x=w()),t?.onDragStop?.(w())},O=(e,n,r,i)=>{m.value=e,p.value=n,h.value=Math.min(r,_.value),g.value=i,S.value&&(x=w()),t?.onResizeStop?.(w())},k=()=>{_.value=Math.max(window.innerWidth*(a/100),h.value),Dn(()=>{if(v.value)m.value=window.innerWidth-h.value-s,p.value=window.innerHeight-o-s;else{let e=window.innerWidth-h.value-y.value;m.value=Math.max(0,e),setTimeout(()=>{g.value=window.innerHeight-p.value},0)}h.value>_.value&&(h.value=_.value)})},A=()=>{v.value?(p.value=u.value,Dn(()=>{g.value=d.value,m.value=l.value,h.value=f.value})):(p.value=window.innerHeight-o-s,m.value=l.value-s,h.value=n,g.value=o),v.value=!v.value},j=(e,t)=>{m.value=e,p.value=t,y.value=e-(window.innerWidth-h.value)},M=(e,t)=>{h.value=Math.max(r,Math.min(e,_.value)),g.value=Math.max(i,t)};return sr(()=>{window.addEventListener(`resize`,k)}),cr(()=>{window.removeEventListener(`resize`,k)}),{minWidth:r,minHeight:i,maxWidth:_,top:p,left:m,width:h,height:g,isCompressed:v,isSidePanelExpanded:S,handleDragging:T,handleResizing:E,handleDragStop:D,handleResizeStop:O,toggleCompression:A,updatePosition:j,updateSize:M,updatePositionAndSize:(e,t,n,r)=>{j(e,t),M(n,r)},expandForSidePanel:e=>{if(S.value)return;let t=w();b={...t},S.value=!0;let n=t.x+t.width,r=x?.width??t.width+e,i=C({x:n-r,y:t.y,width:r,height:t.height});j(i.x,i.y),Dn(()=>{M(i.width,i.height)})},collapseSidePanel:()=>{if(!S.value)return;let e=w();x={...e},S.value=!1;let t=e.x+e.width,n=b?.width??e.width,r=C({x:t-n,y:e.y,width:n,height:e.height});M(r.width,r.height),Dn(()=>{j(r.x,r.y)})}}}var EQt={class:`draggable-container-content`},DQt=Ii($n({__name:`draggable-container`,props:{className:{default:``},compressedHeight:{default:800},compressedPadding:{default:0},defaultHeight:{default:void 0},defaultWidth:{default:400},defaultX:{default:void 0},defaultY:{default:0},draggable:{type:Boolean,default:!0},dragHandle:{default:`.drag-handle`},maxWidth:{default:void 0},maxWidthPercent:{default:80},minHeight:{default:400},minWidth:{default:400},resizable:{type:Boolean,default:!0},teleportTo:{default:`body`},visible:{type:Boolean,default:!1}},emits:[`dragging`,`resizing`,`drag-stop`,`resize-stop`,`compression-change`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=sn(!1),{minWidth:o,minHeight:s,maxWidth:l,top:u,left:d,width:f,height:p,isCompressed:m,isSidePanelExpanded:h,handleDragging:g,handleResizing:_,handleDragStop:v,handleResizeStop:y,toggleCompression:b,updatePosition:x,updateSize:S,updatePositionAndSize:C,expandForSidePanel:w,collapseSidePanel:T}=TQt({initWidth:r.defaultWidth,minWidth:r.minWidth,minHeight:r.minHeight,maxWidthPercent:r.maxWidthPercent,compressedHeight:r.compressedHeight,defaultHeight:r.defaultHeight,defaultTop:r.defaultY,defaultLeft:r.defaultX,compressedPadding:r.compressedPadding},{onDragStop:e=>i(`drag-stop`,e),onResizeStop:e=>i(`resize-stop`,e),onDragging:e=>i(`dragging`,e),onResizing:e=>i(`resizing`,e)}),E=pi(()=>({"--draggable-max-width":typeof r.maxWidth==`number`?`${r.maxWidth}px`:r.maxWidth??`${l.value}px`})),D=pi(()=>({x:d.value,y:u.value,width:f.value,height:p.value})),O=()=>{document.querySelectorAll(`iframe`).forEach(e=>{e.style.pointerEvents=`none`})},k=()=>{document.querySelectorAll(`iframe`).forEach(e=>{e.style.pointerEvents=``})},A=(e,t)=>{a.value||(a.value=!0,O()),g(e,t)},j=(e,t,n,r)=>{a.value||(a.value=!0,O()),_(e,t,n,r)},M=(e,t)=>{v(e,t),a.value=!1,k()},N=(e,t,n,r)=>{y(e,t,n,r),a.value=!1,k()};return Rn(m,e=>{i(`compression-change`,e)}),t({updatePosition:x,updateSize:S,updatePositionAndSize:C,toggleCompression:b,expandForSidePanel:w,collapseSidePanel:T,positionAndSize:D,isCompressed:m,isSidePanelExpanded:h}),(e,t)=>Nn((B(),Kr(z(SQt),{ref:`draggableRef`,active:r.visible,class:xe([`draggable-container-wrapper`,r.className]),"class-name":`draggable-container-inner`,"drag-handle":r.dragHandle,draggable:r.draggable,h:z(p),"max-width":z(l),"min-height":z(s),"min-width":z(o),parent:!0,"prevent-deactivation":!0,resizable:r.resizable,style:ge(E.value),w:z(f),x:z(d),y:z(u),onDragStop:M,onDragging:A,onResizeStop:N,onResizing:j},{default:Mn(()=>[H(`div`,EQt,[mr(e.$slots,`default`,{},void 0,!0)])]),_:3},8,[`active`,`class`,`drag-handle`,`draggable`,`h`,`max-width`,`min-height`,`min-width`,`resizable`,`style`,`w`,`x`,`y`])),[[Ti,r.visible]])}}),[[`__scopeId`,`data-v-1118456b`]]),OQt={class:`nimbus-bkai-wrapper`},kQt=[`width`,`height`,`src`],AQt=Ii($n({name:`NimbusButton`,__name:`nimbus`,props:{isPanelShow:{type:Boolean},isMinimize:{type:Boolean},size:{default:`normal`}},emits:[`click`,`minimize`,`update:isMinimize`],setup(e,{emit:t}){Kne(e=>({v05a8b16e:`${a.value.container}px`,v4e1cf4ca:`${a.value.wrapper}px`,v5ab0c513:`${a.value.mini.right}px`,v40c13a80:`${a.value.mini.size}px`,v0d35a9ef:`${a.value.mini.fontSize}px`}));let n=e,r=t,i={small:{container:40,wrapper:32,img:24,mini:{size:14,fontSize:10,right:-4}},normal:{container:48,wrapper:40,img:32,mini:{size:16,fontSize:12,right:-6}},large:{container:56,wrapper:48,img:40,mini:{size:18,fontSize:14,right:-6}}},a=pi(()=>i[n.size]),o=sn(null),s=sn(null),{nimbusLeft:l,nimbusTop:u,isMinimize:d,handleClick:f,handleMinimize:p,handleDragging:m,handleMouseEnter:h,handleMouseLeave:g,handleMouseDown:_,handleMouseUp:v}=iQt(r,n.isMinimize);Rn(d,e=>{r(`update:isMinimize`,e)});let y=pi(()=>d.value?tf(`恢复默认大小`):tf(`最小化,将缩成锚点`)),{createTooltip:b,destroyAll:x}=lQt({theme:`ai-blueking`,delay:[0,0]}),S=()=>{Dn(()=>{C()})},C=()=>{x(),o.value&&!d.value&&b(o.value,CSe(),{placement:`left`}),s.value&&b(s.value,y.value,{placement:`top`})};return Rn(()=>d.value,()=>{Dn(()=>{C()})}),sr(()=>{Dn(()=>{C()}),window.addEventListener(`resize`,S)}),cr(()=>{window.removeEventListener(`resize`,S)}),(t,n)=>(B(),Kr(z(SQt),{active:!e.isPanelShow,axis:`y`,draggable:!0,h:a.value.container,parent:!0,"prevent-deactivation":!0,resizable:!1,w:a.value.container,x:z(l),y:z(u),onDragging:z(m)},{default:Mn(()=>[H(`div`,{ref_key:`nimbusContainerRef`,ref:o,class:xe([`nimbus-container`,{"is-minimize":z(d)}]),onClick:n[1]||=(...e)=>z(f)&&z(f)(...e),onMousedown:n[2]||=(...e)=>z(_)&&z(_)(...e),onMouseenter:n[3]||=(...e)=>z(h)&&z(h)(...e),onMouseleave:n[4]||=(...e)=>z(g)&&z(g)(...e),onMouseup:n[5]||=(...e)=>z(v)&&z(v)(...e)},[H(`div`,OQt,[H(`img`,{width:a.value.img,height:a.value.img,src:z(dZt),alt:`nimbus`},null,8,kQt)]),H(`i`,{ref_key:`minimizeButtonRef`,ref:s,class:xe([`nimbus-mini bkai-icon`,z(d)?`bkai-yinyong`:`bkai-minus-line`]),onClick:n[0]||=Ni((...e)=>z(p)&&z(p)(...e),[`stop`])},null,2)],34)]),_:1},8,[`active`,`h`,`w`,`x`,`y`,`onDragging`]))}}),[[`__scopeId`,`data-v-26b6f3ea`]]),jQt=Ii($n({inheritAttrs:!1,__name:`ai-blueking`,props:fte({alwaysCreateNewSession:{type:Boolean},autoSwitchToInitialSession:{type:Boolean},defaultChatInputPosition:{},defaultHeight:{},defaultLeft:{},defaultMinimize:{type:Boolean},defaultTop:{},defaultWidth:{},disabledInput:{type:Boolean},draggable:{type:Boolean},dropdownMenuConfig:{},enableChatSession:{type:Boolean},enableModelSelect:{type:Boolean},models:{},enablePopup:{type:Boolean},errorToast:{type:Boolean},executionTabVisible:{type:Boolean},extCls:{},getSideRenderComponent:{type:Function},getSideTabRenderComponent:{type:Function},helloText:{},messageTools:{},updateTools:{},hideDefaultTrigger:{type:Boolean},hideHeader:{type:Boolean},hideNimbus:{type:Boolean},ignoreErrors:{},initialSessionCode:{},loadRecentSessionOnMount:{type:Boolean},maxWidth:{},miniPadding:{},nimbusSize:{},onCustomTabChange:{type:Function},placeholder:{},prompts:{},renderMode:{},requestOptions:{},resources:{},shortcutLimit:{},shortcuts:{},showCompressionIcon:{type:Boolean},showHistoryIcon:{type:Boolean},showMoreIcon:{type:Boolean},showNewChatIcon:{type:Boolean},teleportTo:{},title:{},url:{},useAgentName:{type:Boolean},beforeNimbusClick:{type:Function},shortcutFilter:{type:Function},resizeProps:{},size:{}},uQt),emits:[`show`,`close`,`dragging`,`resizing`,`drag-stop`,`resize-stop`,`send-message`,`receive-start`,`receive-text`,`receive-end`,`stop`,`shortcut-click`,`session-initialized`,`sdk-error`,`transfer-messages`,`share-messages`,`confirm-share`,`agent-action`,`new-chat`,`new-chat-created`,`history-click`,`auto-generate-name`,`help-click`,`rename`,`share`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=ute(),{chatHelper:o,componentManager:s,sessionBusinessManager:l,shareBusinessManager:u,shortcutManager:d,forwarders:f,forwardToManager:p,chatBotRef:m,draggableContainerRef:h,panelVisible:g,nimbusMinimized:_,normalizedUrl:v,agentName:y,currentSession:b,isCompressed:x,isWelcomeState:S,messageToolsTippyOptions:C,agentResources:w,agentPrompts:T,agentSkills:E,handleError:D,reportSdkError:O,ensureSessionReady:k,updateAgentInfo:A}=nQt({props:r,emit:i}),j=pi(()=>m.value?.selectedLlmCode),{show:M,hide:N,handleShow:P,handleClose:F,handleNimbusClick:I,handleDragging:L,handleResizing:R,handleDragStop:ee,handleResizeStop:te,handleToggleCompression:ne,handleCompressionChange:re,handleExecutionPanelChange:ie,sendMessage:ae,handleReceiveStart:oe,handleReceiveText:se,handleReceiveEnd:ce,handleStop:le,stopGeneration:ue,setCiteText:de,focusInput:fe,selectShortcut:pe,sendShortcut:me,getChatHelper:he,updatePosition:_e,updateSize:ve,updatePositionAndSize:ye,handleShortcutClick:be}=oQt({componentManager:s,chatBotRef:m,forwarders:f,forwardToManager:p,beforeNimbusClick:r.beforeNimbusClick,ensureSessionReady:k}),{sessionName:Ce,hasPermission:we,hasSessionContents:Te,autoGenerateLoading:Ee,handleNewChat:De,handleNewChatCreated:Oe,handleHistoryClick:ke,handleHistorySessionSwitch:Ae,handleHistorySessionDelete:je,handleHistorySessionRename:Me,handleAutoGenerateName:Ne,handleHelpClick:Pe,handleRename:Fe,handleSessionRenamed:Ie,handleSessionSwitched:Le,addNewSession:Re,switchToSession:ze,updateSessionName:Be}=sQt({chatHelper:o,sessionBusinessManager:l,chatBotRef:m,forwarders:f,reportSdkError:O,currentSession:b}),{isShareLoading:Ve,handleShare:He,handleCancelShare:Ue,handleConfirmShare:We}=cQt({shareBusinessManager:u,chatBotRef:m,emit:(e,t,n)=>i(e,t,n),forwarders:f,reportSdkError:O}),{aiSelectionVisible:Ge,filteredPopupShortcuts:Ke,handleSelectionChange:qe,handleAiSelectionShortcut:Je}=rQt({shortcutManager:d,chatBotRef:m,forwardToManager:p,show:M,props:r}),Ye=e=>{Te.value=!0,f.sendMessage(e)};return t({show:M,handleShow:P,handleClose:F,hide:N,sendMessage:ae,selectShortcut:pe,sendShortcut:me,getChatHelper:he,stopGeneration:ue,addNewSession:Re,switchToSession:ze,updateSessionName:Be,updatePosition:_e,updateSize:ve,updatePositionAndSize:ye,setCiteText:de,focusInput:fe,updateAgentInfo:A}),(e,t)=>(B(),Kr(Wn,{to:r.teleportTo},[H(`div`,{class:xe([`ai-blueking-v2`,r.extCls,z(a).class])},[ei(` 可拖拽容器 `),Xr(z(DQt),{ref_key:`draggableContainerRef`,ref:h,"compressed-padding":r.miniPadding,"default-height":r.defaultHeight,"default-width":r.defaultWidth,"default-x":r.defaultLeft,"default-y":r.defaultTop,"drag-handle":`.drag-handle`,draggable:r.draggable,"max-width":r.maxWidth,"max-width-percent":80,visible:z(g),onCompressionChange:z(re),onDragStop:z(ee),onDragging:z(L),onResizeStop:z(te),onResizing:z(R)},{default:Mn(()=>[H(`div`,{class:xe([`ai-blueking-panel`,{"has-messages":!z(S)}])},[ei(` 独立的 Header 组件 `),r.hideHeader?ei(`v-if`,!0):(B(),Kr(bZt,{key:0,"agent-name":z(y),"chat-helper":z(o),draggable:r.draggable,"dropdown-menu-config":r.dropdownMenuConfig,"enable-chat-session":r.enableChatSession,"has-permission":z(we),"has-session-contents":z(Te),"auto-generate-loading":z(Ee),"is-compression-height":z(x),"render-mode":r.renderMode,"session-business-manager":z(l),"selected-llm-code":j.value,"session-name":z(Ce),"show-compression-icon":r.showCompressionIcon,"show-history-icon":r.showHistoryIcon,"show-more-icon":r.showMoreIcon,"show-new-chat-icon":r.showNewChatIcon,title:r.title,onAutoGenerateName:z(Ne),onClose:z(F),onHelpClick:z(Pe),onHistoryClick:z(ke),onHistorySessionDelete:z(je),onHistorySessionRename:z(Me),onHistorySessionSwitch:z(Ae),onNewChat:z(De),onNewChatCreated:z(Oe),onRename:z(Fe),onShare:z(He),onToggleCompression:z(ne)},pr({_:2},[e.$slots.headerLeft?{name:`headerLeft`,fn:Mn(()=>[mr(e.$slots,`headerLeft`,{},void 0,!0)]),key:`0`}:void 0]),1032,`agent-name.chat-helper.draggable.dropdown-menu-config.enable-chat-session.has-permission.has-session-contents.auto-generate-loading.is-compression-height.render-mode.session-business-manager.selected-llm-code.session-name.show-compression-icon.show-history-icon.show-more-icon.show-new-chat-icon.title.onAutoGenerateName.onClose.onHelpClick.onHistoryClick.onHistorySessionDelete.onHistorySessionRename.onHistorySessionSwitch.onNewChat.onNewChatCreated.onRename.onShare.onToggleCompression`.split(`.`))),ei(` ChatBot 核心组件(仅聊天区域) `),Xr(JZt,{ref_key:`chatBotRef`,ref:m,"always-create-new-session":r.alwaysCreateNewSession,"auto-load":r.loadRecentSessionOnMount,"chat-helper":z(o),"enable-model-select":r.enableModelSelect,"error-toast":!1,"execution-tab-visible":r.executionTabVisible,"hello-text":r.helloText,"message-tools":r.messageTools,"message-tools-tippy-options":z(C),models:r.models,placeholder:r.placeholder,prompts:z(T),"render-mode":r.renderMode,"request-options":r.requestOptions,"use-agent-name":r.useAgentName,"get-side-render-component":r.getSideRenderComponent,"get-side-tab-render-component":r.getSideTabRenderComponent,"on-custom-tab-change":r.onCustomTabChange,"resize-props":r.resizeProps,size:r.size,resources:z(w),"session-code":r.initialSessionCode,"share-loading":z(Ve),shortcuts:r.shortcuts,skills:z(E),style:ge({height:r.hideHeader?`100%`:`calc(100% - 48px)`}),"update-tools":r.updateTools,url:z(v),onAgentAction:t[0]||=(e,t)=>i(`agent-action`,e,t),onCancelShare:z(Ue),onConfirmShare:t[1]||=(e,t)=>z(We)(e,t),onError:t[2]||=e=>z(D)(e),onExecutionPanelChange:z(ie),onReceiveEnd:z(ce),onReceiveStart:z(oe),onReceiveText:z(se),onRename:z(Ie),onRequestShare:z(He),onSendMessage:t[3]||=e=>Ye(e),onSessionSwitched:t[4]||=e=>z(Le)(e),onShortcutClick:z(be),onStop:z(le)},pr({_:2},[e.$slots.welcome?{name:`welcome`,fn:Mn(t=>[mr(e.$slots,`welcome`,Se(Zr(t)),void 0,!0)]),key:`0`}:void 0,e.$slots.codeHeader?{name:`codeHeader`,fn:Mn(t=>[mr(e.$slots,`codeHeader`,Se(Zr(t)),void 0,!0)]),key:`1`}:void 0,e.$slots.message?{name:`message`,fn:Mn(({message:t,messageToolsStatus:n,onInterruptResume:r})=>[mr(e.$slots,`message`,{message:t,messageToolsStatus:n,onInterruptResume:r},void 0,!0)]),key:`2`}:void 0]),1032,`always-create-new-session.auto-load.chat-helper.enable-model-select.execution-tab-visible.hello-text.message-tools.message-tools-tippy-options.models.placeholder.prompts.render-mode.request-options.use-agent-name.get-side-render-component.get-side-tab-render-component.on-custom-tab-change.resize-props.size.resources.session-code.share-loading.shortcuts.skills.style.update-tools.url.onCancelShare.onExecutionPanelChange.onReceiveEnd.onReceiveStart.onReceiveText.onRename.onRequestShare.onShortcutClick.onStop`.split(`.`))],2)]),_:3},8,[`compressed-padding`,`default-height`,`default-width`,`default-x`,`default-y`,`draggable`,`max-width`,`visible`,`onCompressionChange`,`onDragStop`,`onDragging`,`onResizeStop`,`onResizing`]),ei(` Nimbus 悬浮球 `),r.hideNimbus?ei(`v-if`,!0):(B(),Kr(AQt,{key:0,"is-minimize":z(_),"onUpdate:isMinimize":t[5]||=e=>on(_)?_.value=e:null,"is-panel-show":z(g),"onUpdate:isPanelShow":t[6]||=e=>on(g)?g.value=e:null,"default-minimize":r.defaultMinimize,size:r.nimbusSize,onClick:z(I)},null,8,[`is-minimize`,`is-panel-show`,`default-minimize`,`size`,`onClick`])),ei(` 划词选择弹窗(使用 chat-x 的 AiSelection 组件) `),r.enablePopup?(B(),Kr(z(VDe),{key:1,visible:z(Ge),"onUpdate:visible":t[7]||=e=>on(Ge)?Ge.value=e:null,"exclude-selectors":[`.draggable-container-wrapper`],"max-shortcut-count":r.shortcutLimit,shortcuts:z(Ke),onSelectShortcut:z(Je),onSelectionChange:z(qe)},null,8,[`visible`,`max-shortcut-count`,`shortcuts`,`onSelectShortcut`,`onSelectionChange`])):ei(`v-if`,!0)],2)],8,[`to`]))}}),[[`__scopeId`,`data-v-2d3264be`]]),MQt=[`close`,`show`,`stop`,`shortcut-click`,`send-message`,`receive-start`,`receive-end`,`receive-text`,`session-initialized`,`drag-stop`,`resize-stop`,`dragging`,`resizing`,`transfer-messages`,`share-messages`,`confirm-share`,`agent-action`,`sdk-error`,`new-chat`,`new-chat-created`,`history-click`,`auto-generate-name`,`help-click`,`rename`,`share`],NQt=[`show`,`handleShow`,`handleClose`,`hide`,`sendMessage`,`stopGeneration`,`addNewSession`,`switchToSession`,`updateSessionName`,`updatePosition`,`updateSize`,`updatePositionAndSize`,`setCiteText`,`focusInput`,`getChatHelper`,`selectShortcut`,`sendShortcut`],PQt=YZt(jQt,{name:`AIBluekingV2`,props:{extCls:{type:String,default:``},shortcuts:{type:Array,default:()=>[]},enablePopup:{type:Boolean,default:!0},url:{type:String,default:``},prompts:{type:Array,default:()=>[]},teleportTo:{type:String,default:`body`},title:{type:String,default:``},helloText:{type:String,default:()=>tf(`你好,我是小鲸`)},useAgentName:{type:Boolean,default:!1},requestOptions:{type:Object,default:()=>({})},defaultMinimize:{type:Boolean,default:!1},hideHeader:{type:Boolean,default:!1},hideNimbus:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},defaultWidth:{type:Number,default:400},defaultHeight:{type:Number,default:void 0},defaultLeft:{type:Number,default:void 0},defaultTop:{type:Number,default:0},disabledInput:{type:Boolean,default:!1},showCompressionIcon:{type:Boolean,default:!0},showMoreIcon:{type:Boolean,default:!0},showHistoryIcon:{type:Boolean,default:!0},showNewChatIcon:{type:Boolean,default:!0},defaultChatInputPosition:{type:String,default:void 0},maxWidth:{type:[Number,String],default:1e3},initialSessionCode:{type:String,default:``},autoSwitchToInitialSession:{type:Boolean,default:!1},alwaysCreateNewSession:{type:Boolean,default:!1},loadRecentSessionOnMount:{type:Boolean,default:!0},shortcutLimit:{type:Number,default:3},shortcutFilter:{type:Function,default:void 0},placeholder:{type:String,default:void 0},enableChatSession:{type:Boolean,default:!0},nimbusSize:{type:String,default:`normal`},miniPadding:{type:Number,default:0},dropdownMenuConfig:{type:Object,default:()=>({showRename:!0,showAutoGenerate:!0,showShare:!0})},resources:{type:Array,default:void 0},messageTools:{type:Array,default:void 0},updateTools:{type:Array,default:void 0},hideDefaultTrigger:{type:Boolean,default:!1},beforeNimbusClick:{type:Function,default:void 0},getSideRenderComponent:{type:Function,default:void 0},getSideTabRenderComponent:{type:Function,default:void 0},onCustomTabChange:{type:Function,default:void 0},executionTabVisible:{type:Boolean,default:void 0},resizeProps:{type:Object,default:void 0},size:{type:String,default:void 0}},emitNames:[...MQt],exposeKeys:[...NQt],slots:[`codeHeader`,`headerLeft`,`message`,`welcome`],deepWatchProps:[`requestOptions`,`shortcuts`,`beforeNimbusClick`],methods:{show(){return console.warn(`AIBluekingV2: show method not ready`),Promise.resolve()},handleShow(){return console.warn(`AIBluekingV2: handleShow method not ready`),Promise.resolve()},handleClose(){console.warn(`AIBluekingV2: handleClose method not ready`)},hide(){console.warn(`AIBluekingV2: hide method not ready`)},sendMessage(){return console.warn(`AIBluekingV2: sendMessage method not ready`),Promise.resolve()},stopGeneration(){console.warn(`AIBluekingV2: stopGeneration method not ready`)},addNewSession(){return console.warn(`AIBluekingV2: addNewSession method not ready`),Promise.resolve()},switchToSession(){return console.warn(`AIBluekingV2: switchToSession method not ready`),Promise.resolve()},updateSessionName(){return console.warn(`AIBluekingV2: updateSessionName method not ready`),Promise.resolve()},updatePosition(){console.warn(`AIBluekingV2: updatePosition method not ready`)},updateSize(){console.warn(`AIBluekingV2: updateSize method not ready`)},updatePositionAndSize(){console.warn(`AIBluekingV2: updatePositionAndSize method not ready`)},setCiteText(){console.warn(`AIBluekingV2: setCiteText method not ready`)},focusInput(){console.warn(`AIBluekingV2: focusInput method not ready`)},getChatHelper(){return console.warn(`AIBluekingV2: getChatHelper method not ready`),null},selectShortcut(){console.warn(`AIBluekingV2: selectShortcut method not ready`)},sendShortcut(){return console.warn(`AIBluekingV2: sendShortcut method not ready`),Promise.resolve()}}}),FQt=[`send-message`,`error`,`stop`,`receive-start`,`receive-end`,`receive-text`,`shortcut-click`,`session-switched`,`agent-info-loaded`,`request-share`,`confirm-share`,`cancel-share`,`execution-panel-change`,`feedback`,`agent-action`,`rename`],IQt=[`sendMessage`,`stopGeneration`,`focusInput`,`setCiteText`,`switchSession`,`selectShortcut`,`sendShortcut`,`enterShareMode`,`exitShareMode`,`getChatHelper`,`currentSession`,`isGenerating`,`messages`,`isReady`,`whenReady`];return e.ChatBotV2=YZt(JZt,{name:`ChatBotV2`,props:{chatHelper:{type:Object,default:void 0},url:{type:String,default:``},height:{type:[Number,String],default:void 0},maxWidth:{type:[Number,String],default:void 0},extCls:{type:String,default:``},helloText:{type:String,default:void 0},useAgentName:{type:Boolean,default:!1},placeholder:{type:String,default:void 0},shortcuts:{type:Array,default:()=>[]},prompts:{type:Array,default:()=>[]},resources:{type:Array,default:()=>[]},requestOptions:{type:Object,default:()=>({})},messageToolsTippyOptions:{type:Object,default:void 0},messageTools:{type:Array,default:void 0},updateTools:{type:Array,default:void 0},enableSelection:{type:Boolean,default:!1},shareLoading:{type:Boolean,default:!1},autoLoad:{type:Boolean,default:!0},alwaysCreateNewSession:{type:Boolean,default:!1},sessionCode:{type:String,default:void 0},resizeProps:{type:Object,default:void 0},size:{type:String,default:void 0},getSideRenderComponent:{type:Function,default:void 0},getSideTabRenderComponent:{type:Function,default:void 0},onCustomTabChange:{type:Function,default:void 0},executionTabVisible:{type:Boolean,default:void 0}},emitNames:[...FQt],exposeKeys:[...IQt],slots:[`codeHeader`,`message`,`welcome`],deepWatchProps:[`requestOptions`,`shortcuts`,`beforeNimbusClick`]}),e.default=PQt,e.h=U,e})({});
|
|
3498
|
+
`)),t.onAgentAction?.(e,n)),v=async(e,n)=>{t.onUserAction?.(e,n)},y=async(e,n,r)=>{t.onUserInputConfirm?.(e,n,r)},b=async(e,n)=>{t.onUserShortcutConfirm?.(e,n)};return(n,a)=>(B(),V(`div`,{ref_key:`messageContainerRef`,ref:r,class:`ai-message-container`},[(B(!0),V(Rr,null,fr(p.value,(r,i)=>(B(),V(`div`,{id:r.uid,key:i,class:`message-group`,style:ge({backgroundColor:r.checked?`#f5f7fa`:`transparent`}),onMouseenter:e=>m(r),onMouseleave:e=>h(r,e)},[mr(n.$slots,`group`,ii({ref_for:!0},{group:r}),()=>[e.enableSelection&&r.type!==z(Op).Loading?(B(),Kr(z(yu),{key:0,class:`message-group-checkbox`,"model-value":r.checked,"onUpdate:modelValue":e=>g(r,e)},null,8,[`model-value`,`onUpdate:modelValue`])):ei(`v-if`,!0),H(`div`,{class:xe([`message-group-messages`,{"message-group-enabled-selection":e.renderMode===z(Mp).Share||e.enableSelection&&r.type!==z(Op).Loading}]),style:ge({width:e.enableSelection&&r.type!==z(Op).Loading?`calc(100% - 16px)`:`100%`})},[(B(!0),V(Rr,null,fr(r.messages,(r,i)=>mr(n.$slots,`default`,ii({key:i,ref_for:!0},{message:r,messageToolsStatus:e.messageToolsStatus,onInterruptResume:t.onInterruptResume}),()=>[(B(),Kr(RXt,{key:i,message:r,"message-tools-status":e.messageToolsStatus,"on-action":e=>v(e,r),"on-input-confirm":(e,t)=>y(r,e,t),"on-interrupt-resume":t.onInterruptResume,"on-shortcut-confirm":e=>b(r,e),"tippy-options":e.messageToolsTippyOptions},pr({_:2},[n.$slots.answeredQuestion?{name:`answeredQuestion`,fn:Mn(e=>[mr(n.$slots,`answeredQuestion`,ii({ref_for:!0},e))]),key:`0`}:void 0]),1032,[`message`,`message-tools-status`,`on-action`,`on-input-confirm`,`on-interrupt-resume`,`on-shortcut-confirm`,`tippy-options`]))])),128)),e.renderMode!==z(Mp).Share&&!(e.enableSelection&&r.type!==z(Op).Loading)&&!r.pause&&r.type===z(Op).Assistant&&e.messageToolsStatus!==z(B9).Hidden?(B(),Kr(gJt,{key:0,"message-tools":d.value,"message-tools-status":e.messageToolsStatus,"on-action":e=>_(e,r.messages),style:ge({visibility:r.isHover?`visible`:`hidden`}),"tippy-options":t.messageToolsTippyOptions,"update-tools":f.value,onFeedback:(e,n,i)=>t.onAgentFeedback?.(e,r.messages,n,i)},null,8,[`message-tools`,`message-tools-status`,`on-action`,`style`,`tippy-options`,`update-tools`,`onFeedback`])):ei(`v-if`,!0)],6)])],44,zXt))),128)),H(`div`,{ref_key:`messageContainerBottomRef`,ref:i,class:`message-container-bottom`,tabindex:`0`},null,512),H(`div`,BXt,[Nn(Xr(jDe,{loading:e.messageStatus===z(kp).StopLoading,title:e.messageStatus===z(kp).StopLoading?z(wp)(`正在停止`):z(wp)(`停止生成`),onClick:a[0]||=e=>n.$emit(`stopStreaming`)},{icon:Mn(()=>[Xr(z(aDe))]),_:1},8,[`loading`,`title`]),[[Ti,e.renderMode!==z(Mp).Share&&(e.messageStatus===z(kp).Streaming||e.messageStatus===z(kp).StopLoading||e.messageStatus===z(kp).Fetching||e.messageStatus===z(kp).Pending)]]),Nn(Xr(jDe,{title:z(wp)(`返回底部`),onClick:a[1]||=()=>z(o)(`smooth`)},{icon:Mn(()=>[Xr(z(SDe))]),_:1},8,[`title`]),[[Ti,z(s)]])])],512))}}),HXt={class:`ai-execution-summary`},UXt={class:`ai-execution-summary-header`},WXt={class:`ai-execution-summary-content`},GXt=[`onMouseenter`],KXt={class:`content-item-header`},qXt={class:`content-item-title`},JXt={class:`content-item-messages`},YXt={key:0,class:`timeline-line`},XXt={key:1,class:`ai-execution-summary-content-empty`},ZXt={class:`ai-execution-summary-content-empty-text`},QXt=$n({__name:`execution-summary`,props:{messageGroups:{}},emits:[`locateMessageGroup`,`updateKeyword`],setup(e,{emit:t}){let n=t,r=Jp(),{keyword:i}=DOe(),a=cn(void 0),o=e=>{if(!e)return``;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`},s=e=>{n(`locateMessageGroup`,e.uid,e)},l=()=>{i.value=``,n(`updateKeyword`,``)};return(t,u)=>(B(),V(`div`,HXt,[H(`div`,UXt,[Xr(z(fu),{modelValue:z(i),"onUpdate:modelValue":[u[0]||=e=>on(i)?i.value=e:null,u[1]||=e=>n(`updateKeyword`,e)],class:`ai-execution-summary-header-input`,clearable:``,placeholder:z(wp)(`搜索 关键字`)},null,8,[`modelValue`,`placeholder`])]),H(`div`,WXt,[e.messageGroups.length?(B(!0),V(Rr,{key:0},fr(e.messageGroups,(t,n)=>(B(),V(`div`,{key:t.uid,class:`ai-execution-summary-content-item`,onMouseenter:e=>a.value=t.uid,onMouseleave:u[2]||=e=>a.value=void 0},[H(`div`,KXt,[u[3]||=H(`span`,{class:`timeline-dot`},null,-1),Nn((B(),V(`span`,qXt,[$r(ke(typeof t.userMessageTitle==`number`?o(t.userMessageTitle):t.userMessageTitle),1)])),[[z(Yp),{...z(r)}]]),Nn(Xr(z(tu),{class:`content-item-locate`,text:``,theme:`primary`,onClick:e=>s(t)},{default:Mn(()=>[$r(ke(z(wp)(`在对话中定位`)),1)]),_:1},8,[`onClick`]),[[Ti,a.value===t.uid]])]),H(`div`,JXt,[(B(!0),V(Rr,null,fr(t.messages,(e,t)=>(B(),Kr(RXt,{key:t,message:e},null,8,[`message`]))),128))]),n<e.messageGroups.length-1?(B(),V(`div`,YXt)):ei(`v-if`,!0)],40,GXt))),128)):(B(),V(`div`,XXt,[Xr(z(rd),{class:`empty-exception`,type:`empty`}),H(`div`,ZXt,[$r(ke(z(i)?z(wp)(`搜索结果为空`):z(wp)(`暂无数据`))+` `,1),z(i)?(B(),Kr(z(tu),{key:0,text:``,theme:`primary`,onClick:l},{default:Mn(()=>[$r(ke(z(wp)(`清空搜索`)),1)]),_:1})):ei(`v-if`,!0)])]))])]))}}),$Xt={class:`ai-selection-footer`},eZt={class:`ai-selection-footer-left`},tZt={class:`select-all-text`},nZt={class:`ai-selection-footer-right`},rZt=$n({__name:`selection-footer`,props:{isAllSelected:{type:Boolean},loading:{type:Boolean},selectedCount:{}},emits:[`cancel`,`confirm`,`toggle-all`],setup(e,{emit:t}){let n=t;return(t,r)=>(B(),V(`div`,$Xt,[H(`div`,eZt,[Xr(z(yu),{"model-value":e.isAllSelected,"onUpdate:modelValue":r[0]||=e=>n(`toggle-all`,e)},null,8,[`model-value`]),H(`span`,tZt,ke(z(wp)(`全选`)),1)]),H(`div`,nZt,[Xr(z(tu),{disabled:e.loading,onClick:r[1]||=e=>n(`cancel`)},{default:Mn(()=>[$r(ke(z(wp)(`取消`)),1)]),_:1},8,[`disabled`]),Xr(z(tu),{disabled:e.selectedCount===0,loading:e.loading,theme:`primary`,onClick:r[2]||=e=>n(`confirm`)},{default:Mn(()=>[$r(ke(z(wp)(`确定`)),1)]),_:1},8,[`disabled`,`loading`])])]))}}),iZt=[`data-ai-size`],aZt={key:0,class:`ai-chat-container-loading`},oZt={class:`screen-wrapper`},sZt={key:1,class:`ai-welcome-content`},cZt={class:`ai-welcome-title`},lZt={key:0,class:`ai-welcome-remark`},uZt=$n({__name:`chat-container`,props:br({chatLoading:{type:Boolean},commonTippyOptions:{},executionTabVisible:{type:Boolean,default:!0},getSideRenderComponent:{},getSideTabRenderComponent:{},onArtifactClick:{},onCustomTabChange:{},openingRemark:{},placement:{default:`left`},resizeProps:{},size:{default:`small`},welcomeTitle:{},defaultUploadFiles:{},inputMaxHeight:{},messageStatus:{},models:{},modelValue:{},onSendMessage:{},onStopSending:{},onUpload:{},placeholder:{},prompts:{},resources:{},sendDisabledTip:{},shortcutId:{},shortcuts:{},skills:{},supportUpload:{type:Boolean},tippyOptions:{},messages:{},messageTools:{},messageToolsStatus:{},onAgentAction:{},onAgentFeedback:{},onInterruptResume:{},onUserAction:{},renderMode:{},updateTools:{},onUserInputConfirm:{},onUserShortcutConfirm:{}},{renderMode:{required:!1,default:Mp.Chat},renderModeModifiers:{},selectedShortcut:{required:!1},selectedShortcutModifiers:{},cite:{required:!1,default:``},citeModifiers:{},selectedModel:{required:!1},selectedModelModifiers:{}}),emits:br([`selectShortcut`,`deleteShortcut`,`update:modelValue`,`modelChange`,`stopStreaming`,`shortcutClose`,`shortcutSubmit`,`confirmShare`,`collapseChange`],[`update:renderMode`,`update:selectedShortcut`,`update:cite`,`update:selectedModel`]),setup(e,{expose:t,emit:n}){let r=hxe.TabPanel,i=e,a=Or(e,`renderMode`),o=er(`fullScreenRef`),{isFullScreen:s,enter:l,exit:u}=fOe(o);OOe({renderMode:a});let d=pi(()=>({collapsible:!1,immediate:!0,min:400,...i.resizeProps,placement:i.placement})),f=pi(()=>i.getSideRenderComponent?.(U,y.value.data?.props??{})??y.value.data?.component);mOe({size:pi(()=>i.size??`small`),supportUpload:pi(()=>i.supportUpload??!1)}),Rn(()=>i.size??`small`,e=>{typeof document<`u`&&(document.body.dataset.aiSize=e)},{immediate:!0});let p=Or(e,`selectedShortcut`),m=Or(e,`cite`),h=Or(e,`selectedModel`),g=n;AOe({tippyOptions:pi(()=>i.commonTippyOptions??{})});let{displayTabs:_,tabs:v,selectedTab:y,isCollapse:b,addCustomTab:x,ensureCustomTab:S,removeCustomTab:C,selectCustomTab:w,resetCustomTab:T}=uOe({executionTabVisible:()=>i.executionTabVisible,onTabChange:async e=>{if(e.name===`file-artifact`)return;let t=y.value.data?.props||{loading:!0,data:{}};y.value.data={...y.value.data,props:t};let n=await i.onCustomTabChange?.(e);y.value.data={...y.value.data,props:{...t,loading:!1,data:n}}}}),E=()=>{S({closable:!1,label:wp(`文件产物`),name:Up,order:-1})},D=cn(``),O=sn([]),k=cn(),A=cn((()=>{let e=i.resizeProps?.initialDivide;return typeof e==`number`?e:400})()),j=pi(()=>`calc(100% - ${A.value}px)`),{messageGroups:M,executionGroups:N,sessionArtifacts:P,isShareMode:F,isAllSelected:I,onToggleShareAll:L,onCancelShare:R,onConfirmShare:ee,pendingApprovalTipText:te,activeUserQuestionInterrupt:ne}=COe({keyword:D,messages:pi(()=>i.messages),renderMode:pi(()=>a.value),selectedUserMessages:O}),re=pi(()=>v.value.some(e=>e.name===Up)),{activeArtifactId:ie,setActiveArtifactId:ae}=tOe({getOnArtifactClick:()=>i.onArtifactClick,onOpen:()=>{x({closable:!1,label:wp(`文件产物`),name:Up,order:-1})}});Rn(P,e=>{if(!e.length){C(Up),ae(``);return}E(),e.some(e=>e.outputId===ie.value)||ae(e[0].outputId)},{immediate:!0}),Rn(b,e=>{e&&(D.value=``,A.value=0),g(`collapseChange`,e,A.value)}),Rn(()=>N.value,e=>{!e.length&&!D.value&&!re.value&&T()},{immediate:!0,deep:!1});let oe=pi(()=>i.messageStatus===kp.StopLoading?kp.StopLoading:M.value?.some(e=>e.messages.some(e=>e.id===`__loading__`))?kp.Fetching:i.messageStatus),se=()=>{p.value=null,g(`shortcutClose`)},ce=e=>{g(`shortcutSubmit`,e)},le=()=>{g(`deleteShortcut`)},ue=e=>{g(`selectShortcut`,e)},de=(e,t)=>{g(`update:modelValue`,e,t)},fe=async(e,t)=>{let n=ne.value;return i.onSendMessage?.(e,t,n?{payload:xqt(n),interrupt:n}:void 0)},pe=()=>{b.value=!b.value},me=e=>{if(!e)return;let t=document.getElementById(e);if(!t){let t=M.value.find(t=>t.messages.some(t=>t.uid===e));t&&document.getElementById(t.uid)?.scrollIntoView({behavior:`smooth`});return}t.scrollIntoView({behavior:`smooth`})},he=e=>e===`execution`?BEe:e===`file-artifact`?JEe:VEe,_e=e=>{w(v.value.find(t=>t.name===e))},ve=e=>{D.value=e},ye=async(e,t)=>{if(e.id===`share`||e.triggerSelection){k.value=e,F.value=!0;return}return i.onAgentAction?.(e,t)},be=()=>{g(`confirmShare`,ee(),k.value),Dn(()=>{F.value=!1,O.value=[],k.value=void 0})},Ce=()=>{R(),k.value=void 0},we=e=>{A.value=e};return lr(()=>{T(),typeof document<`u`&&delete document.body.dataset.aiSize}),t({selectedTab:y,addCustomTab:x,removeCustomTab:C,selectCustomTab:w,enterShareMode:()=>{F.value=!0},exitShareMode:()=>{Ce()}}),(t,n)=>(B(),V(`div`,{class:`ai-chat-container`,"data-ai-size":e.size,style:ge({"--resize-main-width":j.value,borderTopColor:z(b)?`transparent`:`#eaebf0`})},[e.chatLoading?(B(),V(`div`,aZt,[Xr(UKt)])):(B(),Kr(z(exe),ii({key:1,class:[`ai-chat-container-resize-layout`,{"ai-is-collapse":z(b)||z(_).length>0&&!D.value?.length&&z(N)?.length<1&&!re.value}]},d.value,{onResizing:we}),{aside:Mn(()=>[!z(b)&&z(_).length>0&&(z(N)?.length||D.value?.length||re.value)?(B(),V(`div`,{key:0,ref_key:`fullScreenRef`,ref:o,class:`ai-full-screen-wrapper`},[Xr(z(hxe),{active:z(y).name,class:`ai-chat-container-tab`,"label-height":40,type:`unborder-card`,onChange:_e},{setting:Mn(()=>[H(`div`,oZt,[Xr(Xp,{class:`screen-btn`,"tippy-options":{...e.commonTippyOptions,appendTo:z(s)?o.value:e.commonTippyOptions?.appendTo,content:z(s)?z(wp)(`退出全屏`):z(wp)(`全屏`)}},{default:Mn(()=>[z(s)?(B(),Kr(z(wDe),{key:1,onClick:z(u)},null,8,[`onClick`])):(B(),Kr(z(CDe),{key:0,onClick:z(l)},null,8,[`onClick`]))]),_:1},8,[`tippy-options`])])]),default:Mn(()=>[(B(!0),V(Rr,null,fr(z(_),t=>(B(),Kr(z(r),{key:t.name,class:`ai-chat-container-tab-panel`,label:()=>U(`div`,{class:`ai-execution-summary-label`,onVnodeMounted:e=>{z(y).name===t.name&&e.el?.scrollIntoView({behavior:`smooth`})}},e.getSideTabRenderComponent?.(U,t,{removeCustomTab:z(C)})??[U(he(t.name),{class:`ai-execution-summary-icon`}),Nn(U(`span`,{class:`ai-execution-summary-label-text`},t.label??``),[[z(Yp),{...e.commonTippyOptions,text:t.label??``}]]),t.closable!==!1&&t.name!==z(`execution`)?U(z(zp),{class:`ai-execution-close-icon`,onClick:()=>{z(C)(t.name)}}):null]),name:t.name},null,8,[`label`,`name`]))),128))]),_:1},8,[`active`]),z(y)?.name===z(`execution`)&&e.executionTabVisible!==!1?(B(),V(Rr,{key:0},[z(b)?ei(`v-if`,!0):(B(),Kr(QXt,{key:0,"message-groups":z(N),style:{height:`calc(100% - 40px)`},onLocateMessageGroup:me,onUpdateKeyword:ve},null,8,[`message-groups`]))],64)):z(y)?.name===z(`file-artifact`)?(B(),Kr(_qt,{key:1,"active-id":z(ie),artifacts:z(P),style:{height:`calc(100% - 40px)`},onSelect:z(ae)},null,8,[`active-id`,`artifacts`,`onSelect`])):ei(`v-if`,!0),z(y)&&z(y).name!==z(`file-artifact`)?(B(),V(`div`,{key:z(y).name,class:`ai-chat-container-message-slot`},[(B(),Kr(ur(f.value),ii({key:z(y).name},z(y)?.data?.props),{locateButton:Mn(()=>[Xr(z(tu),{class:`ai-locate-button`,size:`small`,text:``,theme:`primary`,onClick:n[0]||=e=>me(z(y)?.data?.messageUid)},{default:Mn(()=>[$r(ke(z(wp)(`在对话中定位`)),1)]),_:1})]),_:1},16))])):ei(`v-if`,!0)],512)):ei(`v-if`,!0),z(_).length>0&&(z(N)?.length||re.value)?(B(),V(`div`,{key:1,class:xe([`collapse-button`,{"is-right":e.placement===`right`,"is-collapsed":z(b)}]),onClick:pe},[Xr(z(Rp))],2)):ei(`v-if`,!0)]),main:Mn(()=>[e.messages?.length?mr(t.$slots,`default`,Se(ii({key:0},{messages:e.messages,messageStatus:e.messageStatus,messageGroups:z(M),selectedUserMessages:O.value,messageToolsStatus:e.messageToolsStatus,isShareMode:z(F),commonTippyOptions:e.commonTippyOptions,handleAgentAction:ye,onAgentFeedback:e.onAgentFeedback,onInterruptResume:e.onInterruptResume,onUserAction:e.onUserAction,onUserInputConfirm:e.onUserInputConfirm,onUserShortcutConfirm:e.onUserShortcutConfirm})),()=>[e.messages?.length?(B(),Kr(VXt,{key:0,"selected-user-messages":O.value,"onUpdate:selectedUserMessages":n[1]||=e=>O.value=e,"enable-selection":z(F),"message-groups":z(M),"message-status":oe.value,"message-tools":e.messageTools,"message-tools-status":e.messageToolsStatus,"message-tools-tippy-options":e.commonTippyOptions,messages:e.messages,"on-agent-action":ye,"on-agent-feedback":e.onAgentFeedback,"on-interrupt-resume":e.onInterruptResume,"on-user-action":e.onUserAction,"on-user-input-confirm":e.onUserInputConfirm,"on-user-shortcut-confirm":e.onUserShortcutConfirm,"render-mode":a.value,"update-tools":e.updateTools,onStopStreaming:n[2]||=e=>g(`stopStreaming`)},{group:Mn(({group:e})=>[mr(t.$slots,`group`,Se(Zr({group:e})))]),default:Mn(({message:e,messageToolsStatus:n,onInterruptResume:r})=>[mr(t.$slots,`message`,Se(Zr({message:e,messageToolsStatus:n,onInterruptResume:r})))]),_:3},8,[`selected-user-messages`,`enable-selection`,`message-groups`,`message-status`,`message-tools`,`message-tools-status`,`message-tools-tippy-options`,`messages`,`on-agent-feedback`,`on-interrupt-resume`,`on-user-action`,`on-user-input-confirm`,`on-user-shortcut-confirm`,`render-mode`,`update-tools`])):ei(`v-if`,!0)]):(B(),V(`div`,sZt,[mr(t.$slots,`welcome`,Se(Zr({openingRemark:e.openingRemark,welcomeTitle:e.welcomeTitle})),()=>[Xr(z(AEe)),H(`h2`,cZt,ke(e.welcomeTitle??z(wp)(`你好,我是小鲸`)),1),e.openingRemark?(B(),V(`div`,lZt,[Xr(WUt,{content:e.openingRemark},null,8,[`content`])])):ei(`v-if`,!0)])])),a.value===z(Mp).Share?ei(`v-if`,!0):(B(),V(Rr,{key:2},[z(F)?(B(),Kr(rZt,{key:0,"is-all-selected":z(I),loading:!1,"selected-count":O.value.length,onCancel:Ce,onConfirm:be,onToggleAll:z(L)},null,8,[`is-all-selected`,`selected-count`,`onToggleAll`])):p.value?.components?.length?(B(),Kr(QDe,ii({key:1},p.value,{class:{"is-welcome-overlay":!e.messages?.length},onClose:se,onSubmit:ce}),null,16,[`class`])):(B(),Kr(kKt,{key:2,cite:m.value,"onUpdate:cite":n[3]||=e=>m.value=e,"selected-model":h.value,"onUpdate:selectedModel":n[4]||=e=>h.value=e,"message-status":oe.value,"model-value":e.modelValue,models:e.models,"on-send-message":fe,"on-stop-sending":e.onStopSending,"on-upload":e.onUpload,placeholder:e.placeholder,prompts:e.prompts,resources:e.resources,"send-disabled-tip":z(te),"shortcut-id":p.value?.id,shortcuts:e.shortcuts,skills:e.skills,"support-upload":e.supportUpload,"tippy-options":e.commonTippyOptions,onDeleteShortcut:le,onModelChange:n[5]||=e=>g(`modelChange`,e),onSelectShortcut:ue,"onUpdate:modelValue":de},{interrupt:Mn(()=>[z(ne)?(B(),Kr(z(eJt),{key:0,interrupt:z(ne),"on-resume":e.onInterruptResume},{question:Mn(({question:e,qIndex:n,answer:r,setAnswer:i,confirm:a})=>[mr(t.$slots,`interruptQuestion`,Se(Zr({question:e,qIndex:n,answer:r,setAnswer:i,confirm:a})))]),_:3},8,[`interrupt`,`on-resume`])):ei(`v-if`,!0),z(te)?(B(),Kr(MKt,{key:1,content:z(te)},null,8,[`content`])):ei(`v-if`,!0)]),_:3},8,[`cite`,`selected-model`,`message-status`,`model-value`,`models`,`on-stop-sending`,`on-upload`,`placeholder`,`prompts`,`resources`,`send-disabled-tip`,`shortcut-id`,`shortcuts`,`skills`,`support-upload`,`tippy-options`]))],64))]),_:3},16,[`class`]))],12,iZt))}}),dZt=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAAGVn0euAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAYKADAAQAAAABAAAAYAAAAACpM19OAAAj4UlEQVR4Ae1dB4AURbqu7pnZyOICShIVBI5TDPgwR0yn5yknKigIy+5KMCJ4ohgQMGdP8BQDsAsqHsZTnnqcPlEU1DNwnnqKYATxRDIsuxO63/f91dXTMzuzzBLEd28Leqq66q+//lR/he7qVWpbh35lsYVBnHbwJpjuPqB2Be/3s9X+jH9TFnMZZwxdBkVXdhkc+02w8E8VifoVOg+Kurze/tRxuw2OuodU1tUHMlgI2GdczH1/kSPXR1847ieLE+6AC2uk0v7DoxKn8DDkt7aaMOFOtWaNq8YjXr/WVS3DupEehXHBLRWInXc/rXbV22/NU+vWOurNN+epmnWoENEV9g9WWDIjzyoOuWo9AG694xlVi/ihe55SsfUJtOAI5h5FCYnD8oufj6ryrVcLNrknHmyrkO2qSEgpx3ZUK7SAf5Y11rIIKz+mEuM/jNzgtgDdpd4l6ZCjGO99Vat68MG6v5R09/61NfVoGe/6+vITBqg2HLoJevnK3DO+61v3CXPvi7VbpVsSj8XW7b2HUsNPDamrQ3VuKXRzVlF+wYhJVj9TwRcTtT1rbBgyVyqM3BBS190VVS0i7psfRMNHLnwwT2CFpD3LYmM6trXU8lWuWvzlCrV6jaO+/GqFumpoRLUMOUfu72mZrdgdyzd1tFz3liP3sdRaGNuI84eoDYiHDhuqatdrTRvDYwWfpIMr6tzKk21VBLoLYRqFaJvxFwuiqhtaOHZsiyRJrEmbef31mIoCa3yDqxIbHOXiYr4BTmmBNxeN2PgWbOjwUtoOACklY1c9r2npU0PYX07YYrL69nXzrKJ4ncfKglnVkcOZ3nNgbNyXj0YmGBZzauCSo39yPUBHWRZ0Y/We9HrLFwwSNlZYGFuUb1l7FECxBTCqAmWPu6E6dH2DDRjfYxCZ2EatAstV/6zOt24uc1vZduKnMVW0V6VeqUwsOWFqqLOBzdiAQdyji6VuroSRaz+miJiB5j1kQlQaKYArem5yoY+n7Xnx73+YEm4vgPjxC0yGQT71ct2PCEDENthmHMIF4pF2JT3pATQEof1pYrF10sW1IsqX7ytgNQnSmzsPqluOakXIac7cy84KqR/Q74jswvLTBbBqxrPSaQcO7CP3Tz/+jJTT65ILhgPQY8jty/pWfv2WDOWkkl3s4tNtQUjJRnAxTl5oHBxFIKu3X9EcjLqtuTXzOnRqwPWfsBN+dfD9EccGZh1SWesU2Mp65sWEOvUoW5DHIY48tJxQDly/gtMHIGKKjRyw3zNg7FgOBtrpO/3rtxTMZLo/xkBygsZExrSaQogieM+05LHMdh4+7roWwy0LN03hP0cCvXq5vhVm4yqrFWWrYPL7DY5ehM55H+9tK97piarCr01Zo+J9zqkd0X1A9C5W6n5u3d6YXc4zCG4sjz9k0oyPw0zzlLL45GDeZjkYAVcNF60mvt7KMm574hs7p9TrPzB2IvrDnHxgLgBsAfxFfjjcavwUa1UKYLBlk24/zC0q3BR7Bfc90XFnLnk0r9yUpcf3VsTdfHSz86voVHTwEybDxJg7TwFspbkPxnnorEUF8fbvP1S8/Nby+DfwIhddMS08+6+D3OKTZlgbg7AZGzCOzwCOHRhSR3S31FPzHDXjpYTnMuBGLGvBq4/ky1BpYNPjeg0Ekb94M8YEz7NwRktgXptqXXXZ7THto2znlKceKH6JiNtVxh+37dAVyx6xlvKewfOD+ib4y4nbhk1KbajVVw1iIubFSvdeERG3XmRbL5p6rSNO/11Cse/MPeOUBgz1V/UPqfVEjmvjJlfVeohr0Yi5YlGFaZr2tCNH1owksnYRR7XFhCoYUhowBe1aErmrNgLx0PIKHymRDyqrUDGsQ+pQdkllnioSl+7cw7ptMDa0Cev1hMHlDZnRtSaDMSmnzC/2hktyEAYpZd5wGfXuuUThYMOxgkFTn5kDjsUyHhOwBgjqsFBrvlML3kq6DhyVlur7GKZbnHIlAFPozWYJR+rTRSQccLg08o+AmjqIIgHKrr1hiozDMn8DR3fcPAVjsQPEmH9x8Mb/QsCbQb9dXir1bNTXARvJt1VdEXJehL1TDJpSxi4oxhQaiB0o14nhQtrFxSGTdRgy6cBvgACfVucVcBzeuC6h4kBEpDE0RFHIhTzGDi4XaRfK1uN2UgdtvcUj8THU8+eg6B5Mm0bNmx9X+3a2VBtYVAKiCIEUh8pELMtJxOtWOUJ9Pohi2HtM/Tk+qtYPfS+oeRrWcQYtJN/SEyuxFpokZY58mU3gPh/3wkXY6tfr2tIn07FlbMAAjbx0o0vqfORAXIAlcSEUzOmiXGwAejBw+cr9qNtVrWQnwuBpipsksF0l0Lfcbbs1DcCud1zoNzjmWm58OeKjs1HR4TwXniR72GEMXFQRf5Bzt50xrLVS6m+j+rqF6WTuPyh6futobGV6fvC+QT8UBGwofeqp2OiDM+UQi/D3F2Y3P/i001bt7jrhb3SexXHpsednlwxMx1N9Xnzw4Cnh6mB+X0g9EY+v5KYkXJysESPKemBKdfjCIBzT24SBINJ7enw/G7uO7wPxWEw2mg1/v339LbpghbT05Zh5WnZ8acSySkk8xyq5gBAMnfeHqvDUYJWtYqDzoNizGNn0JkAQa+Z03Lat47+ojryRqfiWytgJV02NcP7uh8cqEj9hht7KKrBL+t1vbfALAolGM4B5DXeZKZycAzc7/P0H2JpOu5fPn1ogS6Zby9zdlZV4dUx1uGs60oWVsWN7TI28lp5v7nNmwEzITEUT331BSO3bKTMazskYGI15IK6+/I7EY/MEGWQihHSerapfmFxYTrgtCV4T2at2Hlh3O3rn6CDEeb+11WmHYYtFz4L8Iq8Tc74kRBsGCMCGvEmmuvTmqDDiawWMzLy/KIWWzkOjj6Pr9zfIFz9MtuuHjJkGrPPA2DPYNdMbW17mo1fVmwL6jHBzjQh5CfFkBDf01YxNGVF9vthRz74Y88yJGsETi0nFBJFw5IWYlQbCm/fn+2WBbMEZvPfTXc51m7t2LGU1MnmkNn0j+SBRJi3EAksmwrUGkkz+6zM8l3krrvfkQB40Er3zj8VcxKszR2yCM9M0u2jw6YnJ7UyfSCTqi9MrBfH/HQQ893hbllMmj6gfuf8u9e78eSZLTX/8WV/6LL9v0t1qfqD8mT/rcs2cq7p2stR7C3Sf4MYiGMgzyNpiESmjBzJkkDEFabHPALZLX4bcTkor9293b20JA5QwJckrSDwBudoykmd5kHiWc6Fk6pJBEs2FqXRozQDBJMjaxdMAirIG0iNhyYz8k5FY592mRELMx45eX8I0uZDldd3ND/twRcUlKooyvZrTK7k7bnvILy9GeRyLLC7E9AoPMRZeXFVwycKLzJjQFktIMiFXnn6KZ8qCMQVRL3QeGK2C/gYn/beW0nm/C6FD6s0JI0nCUAoSI22hnD2FwmMscF5MibNBA8t6781N9Ujn39KcIOr5CWuwoyxJ1HJV73Gl+oaFgeCbUCBPebtY5T3Koz3gqz8Udwcks16Oq95HhVR+hESAGAhMVpxAzR0JwtETcS9bd3fYL5vlJSFpQpQ1pqIiecGPNGMTKPlgJzb56XFGBgzQwqq8hScMc0vjTt0aujkCv4blMhs67pAQYpCBtDFVGaKNUbIMgWWOEKalT3gyJaWIuSDlkw/BL/lwPhBN+7C7m2O73wkSV62SOMMPquQWThu+aQEIP1QaA5HB0bRjB1vtglk7GRNzwg81YMxL5+vnJ9Qc82vwLHz9DwlNOOxMM6HUqeN3shvzQCBnBgybZRfXnI3GniBRhgkjPeb5aVTg85aUPJZT2syX2AIOzZDGpfsP02SU9SO2NXa/MS1uNO2nxwDdujBm1IZRIGgCCCrRxCYZEyKEqQBjICwMIzGM+oQDjszQTIVB1vOYJUynK/5vPOHfOmk21W6SQJMEmiTQKAmcUxE7vFEVMgBjqNhxwXGsR/HmiJk2bREhO4yBfoPjWO+6nfCOzepslHcZXNc9W5nJb3AyZ4C2ZXxmeW3XsGP/DXPWPTy8JdwjxQyvfNb00HRM//QsEIWuY41ANLyh9n92DTxdVfCFsynyK+yHck9U7azjG2dND1cHiSfRWBkMO3BwvDfT2QJmGVsZ8CZf90XRhUDUPJyX12NhlbXGYNzn3Lo/YzpzMt7JOfNfjxek7LoR5iY8IQfR114zLXSTqWPiY8pif4kotze2GNVL1ZwNZQ5ZCzKD18897dT1eOHGxYt+GlVBYbPwk09aCWz4rkNeCWugXM2erVdaQQzTKhPjK6aGxgfzmO4D4tGze8vkEPfs5TU14SLgxVPa1LDVfaDTOkhZWZdqtBDouuinI3utPslZFxPi9dIls5zauPafDDnnVLi7hZ34KBA0SmarQCU7FRCMzFiLEzXXDI4vjoTcC8ZNDb/KRQ/rZsZssDYynrjf0g4JO4QNRHc+OtfckQvbX9NIFOryisTFIdedJNNqVGZMDWAV+83GjqEu48dbXPj5YZswgLdFT8ALoIOA9Rhc7XCth2i+sFzr+ZrC8L3fP2Q1aov9wWFupCaaiAoToBD94O4hU0N/8KkOJLaYgT3PrdsXT9Q/BK6cBiLsVsxePCP/tEDbfvLWisTwMdNCD/oZSMysdNu7bmJZWFnf9JsW6hgsC6YbzUC3cza2j0ci3wJJToSbxrgCo0fBKmvmwur8ASb/lor42SjCK8bWJ0Uldk+8PVxnyuZUJlbN393eGWaTdWOoUQxgs/dy9J07TAO5xGzALB8DS05nwdR8XwC3Do6vyLdCXUcFXDBxf1jpnnvAVOuxhtqhmeUU8HzgA3iUAzIBQ7Cq8mRb7benpbp1sNRK7O99vhQbsm846gt5JpDcdeA6OWxb9rFDat2CRKz1S9NKVuDl+EPTiWc7zVw1J1N7wbycNADiq1GpLFiR6b12xztjF/uC9IsNUjLG9Cdf4TjBw9yFTmpDXCNc1YsPJt9p9RE0ImHaylqly6C6vtiSmpUOwPeiigtSc0lwMPDWXMy/c3pcLfrK8bdaZNsF+15PT+b2VmrYdYjbIeHE30Xnn7t8ap7fZ1KhchgHMj1aehabKMFgCOdzAyEYP4wZGHN/1NzPfTehnn81AW2wU3OLhVpRMx+7vyiFyC5Dk4dWMK7MXPJwZiagxOyhc1m03vzliWvDKoahhBcf9/GqwztEvOJIx7FJKjHTuGKY7sRAC6840kf9l6326ojRFS2b/R+kMbVODcXYqW7mXSWh+uUGukEGIKTjDSDjS88ICYGG8CiI5kVmgsRGQSwvEpzwyshYzGNy8BlhjKz6wYY2I1edP2LjC8G2SvA6WDPvKoamsoWsDOw5MOrNb5JV6WUo6SDhRhuUtJF8AsTyMmWSj3qOl58A7KAzI2I+NCPp0Mo9NdkSPJBIn7FSZCZbyMoA7Fqe4ZqKfMRkJBsFAeYyJqI1kNQG7yl9wwzjOI5WkXjmt9tF74vqPgAm0FHG42VV014zdOtivF7Fi8xkC1kZQIUUz3DIr/EEDg3L5Wnh3z/+pC4cUqEm3nOXL32jBcY//rhCVVRUqNvvvMsnPMjYrnhsRemTeGoi2myjr/ViDL6mD/D8VbaQ6k6yQSGfhAcDOb/sgiGStQAnwFwM9hdefJlsr/N5AMuHDx8q5TwhBpNXl43Q5XywwfK9u4XU2yvxqBVpMSPL5errFlZCx0WV7IQThsHXANzl2sBV71lZ0O6NlDUK/fv2/HkBG9fmEyx/E8fdHJiQXBAGTaoFnhppDfgDXFdTJ+iF2A+yhaAGmmcDYj41QH9PXIgQ15cOvQysQS68mMlqKYG2z1zC8FlaMSyefUBLX7bcuUyWQA+URJF1LifaM3Ugk1S7NwWM6VH4ZIVvX7JzpJO3E96UpXQlH1ymC41vzrpogeXGxEhWYDATZpAlgX1AXoA1GVlivx0nkeicBQYEw3OgcRmMIGXTEflo1YTLx9wm3oVEJgiDi49WTZhwNcuJB0x6poQXdaUD66m2ZsbAsw/440ADXsg3oa8eL/wGfYBe4F6DhLE31Kt16zGw4KUwStB0wutvmQ5z0B0SypE+QPuiVGgmf7yjSqflnoSna4BPZMx0Qo8HAJUgJiTGytt0fWsY/voa4A1eQZ4ITXREEgZjiNcNzP0Ap/jEh2s/rn28SWviKGGHFyWM2KXNk2iROmLmMR0oMwOZ54XYrAR23FzGAV8DpiI1gXSk8yC3dcSK/ttoYMVKEgWx4r8RjKyTeM8MXxOQFns77qUESa01aEhyMLcFcUamMpUAjG4HCS+Q+FxCigaCFZbMsH7kAKMRc6TEcbG3cCyLNg4J+hfmPEFps1xLmbE2K1OuIH1yQc0wzbGDEgyakaFB+oA3mdvSkRjvfFtHknCeKGMjUbzM8ekizQQJdUCIeB4QYswmJZ8Eg1kRvUPz0UzxsT6ZcPDuBPHLSAz82DrxQ8o4EFLL/YK0RFYNEO69KZG3MGtcTuKlIZjFMuzDffElvDyIE+KFEWohQBzyDJHa/j27J0PeRfNb96P3oBt4iZ/eyAR04lWcD/FqbrkHm/z0OGl06SWB+5OG1bqyMEeemcMX422SnvuG5IE0Hq2Lq+U4gfbkbX1KhmlzRDI9TdjvPo5JvaCp/n5C5pc6gCpjqNeJM0E1L84vim6qrdG2qideCdj+hwsTqrTEUp12gyuFG4Gc9XsQtHMiApHsz3InHdvcK7X0c/26Gbda9OqMDCc1wFq5BEGfC+BpmOoWh2s3pmgCDZpOzljMAMgEBvfBMuYJsYgFVspNfU08NRGynKtsJ/TUseN3WpwLXTkzYJBVXFzzAwho4zPiESSmRYbEcyFOY8T4ec1UJubABIWQyvjKvGiL9t3HW1HTfnrcaAaI4PxLag6O2O47WqqGGB2LObBDGu0gTaJ8M6EmPK+WnRlqgtqh1rDeDsWa7T+6bcpBOMMI+1qjw+RJRe9OuhevSFqJVnB9L4uXEsl53gTEa/eoGfGZAoxI2GPOeB4hVBjVBBvC89A/yORObvj1RhPZVKFJAk0SaJJAkwSaJNAkgSYJbE8JDBjgtsBEH1OVHRe2aCa348jdti3Hw/ELzh6cSHmutW1b2Dy2/7cKwBtid2O5exMWwI+eXR6VDz9sXlypELtvgx60Q7tfKjvb/45L+qLa+Fg4Hb70EtyBYuNxfMJo9J+r8v6YKyU4pVOG9eKixY/lvZ1rnXS4/3gFlJe7pQkr1s1NWMfjWMtQbPt0pBB4ModH6+qllfWVYzkTsXP7Wl048vWTD1kpxwClAn743ZySTbGlWNgv/df0vP1MfmPj/3gFZBLImIr4EMj+ITAPA5aA50DuKbdNi/w1E3x63uHYsnes2KchZeE8CR9VWZ9YdvjAuVUWto0bF34RCjjijI34YKZ1vU+6Z5mw2K9DcXX0G38p+s4vQ+LIPhtOVrb9HEw4X/I9a0aER3fW0fOeKXorCJ8pfTfO64fjic8xDnx5SVXoUPP2YybYZJ5rnVSWeATbPZXUHAdQ9ADFJ1+M8X/ck9WRJB/JillTvwgFDDpxzWoQUso9YWFDYtJM8pDnWsNmvFL6MHPKTljzBB7Nne2XMdPAMbbcp2fMaXGWZG/m5+nz3CPwBctvT59mpSg4WI2fQmvdMVZmu9YECBwH5TzBoy2mpQdA83hZU+5DklaLbVuNundaCAeBTScLYk2mfxEKGNbTjbQJ//siHDA9GRw1c1zXsW27peM4e6NngDcw59oHgZcT8EDlFrBLvqLIXohixC5PLa62HPfh8e+2nZ1kr/Epjhm2XdcmlAgfCJxHwbrPgXXvJMIOCFnf621oipjb0RRmUkHsFdZ3IP55fNNoTsgNLY5H1LIxaWPKL0IBDYnpNVjgNz8umw93g89jqUPB7MTyz3Yb3VCd7VE2Hm/fWk6iCgI+0RcyNGRTKZCi5IFAGMQsFbWHjnjMqveSSSa6dqgCOuJzPKFErB+8TD+YDx/epU8NM9GcKY8PPd4B/8/godfjfCycCWhzeTeWubsWbVKrLsvwar+pOwvnfFY3S7yKT4IeQ6F7gzAVUD1oWqjcwOUa/6wK2LOs9leWa08AcfDh0mNzpbNRcLRIPghF9CYeb4/9uCoyd3MIbocx4LtwH+DVgRXhhH346LSvIabXf7YicQXw30afj0d5fU6ZEn4uHSaXe+DYvqHLwFgvDJo416Fab8+WIAdxA/6giG5FvwxLxSVuYi3Gjf7vTS14KUjHbXAtGGt6w1ffAFCeQmL4Cou1a2wr9PqVU63vdVb93zfPS8zAGLHo8KmhG+qX5pazXRTAz4knYvFpmNWcmRsZWw5FgcurAeCEzKR8JyKlTCuEMDiUU11YmDf8pcDhBFJw6+DERbbtfsNvgvJ+c+GzSvdAwHz+66nW+s3BZivfpgroibMuazfF/hu++MRsDWbK79nVUr32t9Vhe+PzTXjVEPUzBhLLMkM002vA+oJPHDX/n476x2L9qQdt+VAMyvEVKc8dmcFSK0wU5aoFdmHBsemKQLWfLRhetrpBfEvmRojmmlwQtcNXJIecYit+5X5LQ7oyiIduiBr6+6eOmjnHUStWOvKijCyaUCaKQQx3k0yjCl4CuPy5yUUpb1YT388RSPJWhe593Wa1BfHPwPmum0N06qG2GgrBY5GyRQFykykfYxIuAmfsYTMxM5h28JLPrL/G1et/TySniiiQxRLdEy6TxmC9NhJ39noUnyf20GWMeI4ERw7+gUJ8uSQlrMLLWvsHPwKcUprlxqc5S3mD2V0H1e2FTRQS0+D08bf4ix38YyIiOLTImIECNHk6J/NvkEimteCJhEuyYGzKNB5Tj/Gzf0uo+R9AEUjrebtxSWkKse1jq+4rnKsx1P/de1gdBmW7Xf0S5jjLP30ov33mssy5hsbMpQ3k4ot+x0F8rzYAolrjz17cVBGSt3sbgksvCxJl3AphdD78vGf6Wvgm34sBZOqnx7U4D/jgo1G1Bp+BpOWzBxBGjxlUjB4foNZeD08qfD2dLt4fdH4dVt0aM1foTDNmYPrdB/TfD5CMHH4MjTmAJkG6nFvTwbXDXyOH0+2MoXN7S/Ej4Y0JJEYIwo8mTAuIOPx88Orx78Hoew1v6jUcz3gqqpb/QGFrgcuADATY1cQ/GR/iiTxn18l3ltRb0B17Ib4j5jWmoXmrM6iI1+5v3Bm+nF6wTBcihD8DeVmly8OIo/D3L9IPqJBM7TA0RqbpErgJRyY8NjwL9/mUfI/nFOH7ecDBtK8Y3HCgJQa6G/o5bbUa54A+EfXs7Jhatky7IYIEZ07YuwnnRa2nkH00rpTA9+eTlGp8ehORYLonpFTYzE2jh0PtelSvbHgphDLslvBsFs9imZjpOi+PMS++t89zW3xnn2ex5NAZ3k/Wx/uQx/zghTJzyoJ1dZnGo48K6jTfvuW9/ya61DNnAuCpgfPEY3DqDtybNxP51qG8eYheIW8jhtRR+ExVyt/iIs98+5wvcPPiQTYTywk95DU2NL4HWO6QhhR98kG2yseXEdOtn4TR0hholatW/aTGXTlKbdyQuoYpblaibrr9HtWqpV6UGgthXW3h2gJZf/Toy+rVb4b6d995t9oZ9dkOJkK6F7BhyIc46GZI44E9Quqjf3Bg1j2BbckFGIlthw/s57CqCTz+iKdlEihu0mXEznRjg4eqEdVcdVhD0Lvtog82meOSJvYtWSxcqRuuGV1PeMRLhYy/erT0ClqwtnTPsr3ewvyrr7oiY/0NqH8lysx5DMZx9Aj2CjkF4+FgL2iDz0On9wDpFRCy7h32Mem80gWZHsDzF0z7Bwu3RQ/AeaWv0GjH9IZzvW+Nl/yN9XNyoH2wthTjo5m3ds3qrCjXoIyCF2sFDm21AWtGHmGyhdWrV8sRDG3xADZ0oAKt1OArxV9BoqBphRwD2DMkDQK9wbjelFLOUAFfpmBmR5nKsuVlcEH8WzXundkqbC5/FQ6V7cyPvXgMYZ0gzJBxBjJIt7C5QMv1FQhg1qer0C7FYMuOheMKDFkWfZydUGZUfHrMt8nrT0mNS3LhqFKDPnWUrf1cOEvFR3mkhCUzIncB/eMpmTnekKxlK+iC6DI4COJvZiE27kcPtvr+gIOOyor1wIOPkh7Ak008niinoBDzyKO4FqQPAUy2cNghR8qBOgeno+iuzAkpcxiJdOiDeMlX+vkqf3AglrR039RWxN3ADWlXhHPN4pLM4exU2FzusqlS7VlWNwAPuB/LFYnZZ2mPBXq/XtgERj9nN2YD5iIuwxPz1q1doWY/N0Mt+eJjFqkuXfdRv+8zSLUs3dl3E6auxPhJ3rtq9dqV6qmnZ6jPF+n6v/5Vd3XOmWWo3yq1vldPWxutm1hAG7rDvDlR6ZWkSy7ks9ykL7k19dtNVWPxV9y8oDkkj8RHjK4qvyH51908sAYjXbMBkM5ldXwA/iBw75QORoYMobKnAo6YdzR2NvfaA2UB0gzTLDeNsi7TcgXSzNdzd42DrEkesrUQk3WC+aYe26LyGUy5aSf9/p3/ierNORRo2rRL8sYAZT5TLMjw89Q4fK5YFEgSOU4Bkr7SC2dt65NuS6bn82EKL9VpwKY9LDt0Os5U9Uezh/gbWSjjBpth4J2PcAIOfwOoDV59Ja3Mp3WIXPFjhKEztJAoGPLBP7BHdgwMDyczzTzioZeVaaAHxLPtUo6G8Lk0D1bHxCnwqCMB9wa3pFCHc34svAKDsFY22+KYkx64DtAjEWmkmvQoRzhNeXqNhu8zDMLZK3hnie8FxL3dB9dNA/HlevagiTVpxq+966gj8OeHO+DbEJppMOZJmRH+S6CCKCTDKhlnGfNZk72I/8XKdFLxoCiScglKpImBeRKzMu71e88QkxRo8Zh2BBTKxd83kHpUhKGLZ9SEDo1QQM0PzzGn9gCPNgDodgxkbnGjFBBE+Ul1fsWB5bV7gvqjzSyCDGjLQYzEe/9MqG9b2OrQ/bRP5clbwiCSmII3TBuGtcVSmPyH4PUAMifwQgQQeEI2eRS2EQBFzbTpUewlgh91+f4KlWNguQ4Qny8xe4K2a21MKeqSlnn6l/UzhizZGWG9TNK1xeG9qoJjMFuYLIsZYNInH71DhsDKE5Fr8aep58xLqK+/Q2f1FkFyEB1pakIOoyOW49MyY2EaLFJLkK5MR5lmnl+OviFpNMJ8agGxzHI4w/HSrE84gSEcLrZpMQZc3UZHaNQHHfU3RPgn2/SWBGdF7IO6H6GGBMyCZpqFV3pcElYzDVyuMc1hq0OvIXVnwV8+qZf0tHZt6VwY0r9yY8xYWUtMEvbqHFIR/MkbWj/E4lkd4HBnegTT4oJokahPixVrQexbJ2RjdjSJh+W8fFiDD3RIHuoGcS5bFFdxbG5qGtl2kk7jTvtcjw+9sxsGwtLbVnYIh9TtyOrFdoF1LvaeruhwZaulAbCckuRzm4Tx+Kbou9/XPYlB9AwjCApTLiMc3qM15pHBEpzW3Q2PNpqXMDcgQA+GhBGW7BsB0q+IcJChFUuh6ktgpQ4Uxhi/FCplZJTC/GiNo376Fr6cikUhnoYB1msfAEEafzeucV/aB/pGBdKzTUPfivW7OPmRl6CInsIcWmAjZMpYrhkzmE/rE4YJg4xm+FM5zfENgQKsQcPoJXnwBxGMVDzNLo8yIUxjnYIXP75VCw4tfFMm7iyOP+JY46oaPIjh31RkO7pN0/u0Uv38QPlJ40rReVN7AJrZZoF0bqfgWgMu2nQLxqwrjTBoZWaQEwGgIFUpWpgGhmVaKNo10GKTCjMWq63XWDHbSsGJDKnH2GufbVOmHE9ThM720mg0yjY48UrLGiB6BXB/sWO1zxw4vnF/iCxd2KR3u4fykatLw4m8m8HwcDFkj1EzLlAIRujiCuAvjIUGy9KFEbz3BUlXIvg9KxfcWvimPdOWESpdlVas7j1GMb7CDL2QlOA2+BnDKODmPsSHZXp33ZFjQGO0OGLExp6Ya18EIfcH4/IMj8IQy/St1BMk8ikQ42a0gjzhIp+CkzIKEbBaaIwJwx6TqkxRrNdWUtnJtpLlyCN+GkMK3tReLOWe0kHLqE6jW+V8xAnohU7GOzzw4/bdO9QcELLdY7DSwqMSaxf4/J0hfHyr0N0FwigUJXHwxVQRjLsUkBE40m7SOkVIWERDiFSAWKkuFyXRlbE+3BAV5Slf18e9pzhdXyuL31GTb6kBFjVdfY/miQO4OMYTz6rdRrdqhWRTaJJAkwSaJNAkgSYJNEmgSQJNEmhQAv8Lix8k/gNx6O4AAAAASUVORK5CYII=`,fZt={class:`left-section`},pZt={class:`logo`},mZt=[`src`],hZt={key:0,class:`rename-tooltip`},gZt={class:`rename-content`},_Zt={key:0,class:`tippy-dropdown-menu`},vZt={key:1,class:`bkai-icon bkai-auto-refresh-line`},yZt={class:`right-section`},bZt=Ii($n({__name:`index`,props:{title:{default:``},agentName:{default:``},sessionName:{default:``},isCompressionHeight:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},showHistoryIcon:{type:Boolean,default:!0},showNewChatIcon:{type:Boolean,default:!0},showCompressionIcon:{type:Boolean,default:!0},showMoreIcon:{type:Boolean,default:!0},enableChatSession:{type:Boolean,default:!0},hasPermission:{type:Boolean,default:!0},chatGroup:{default:()=>({enabled:!1,staff:[],username:``})},hasSessionContents:{type:Boolean},autoGenerateLoading:{type:Boolean},dropdownMenuConfig:{default:()=>({showRename:!0,showAutoGenerate:!0,showShare:!1})},sessionBusinessManager:{default:void 0},selectedLlmCode:{default:void 0},renderMode:{default:Mp.Chat}},emits:[`close`,`toggle-compression`,`new-chat`,`history-click`,`auto-generate-name`,`help-click`,`rename`,`share`,`history-session-switch`,`history-session-delete`,`history-session-rename`,`new-chat-created`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=vxe,o=sn(null),s=sn(null),l=er(`moreMenuTippyRef`),u=sn(!1),d=sn(``),f=sn(null),p=sn(!1),m=()=>document.querySelector(`.ai-blueking-panel`)||document.body,h=null,g=()=>{!s.value||!r.sessionBusinessManager||(h=OCe({triggerRef:s,sessionBusinessManager:r.sessionBusinessManager,onSessionSwitch:e=>i(`history-session-switch`,e),onSessionDelete:e=>i(`history-session-delete`,e),onSessionRename:(e,t)=>i(`history-session-rename`,e,t)}))},_=pi(()=>r.hasPermission?r.enableChatSession?r.title||`${r.agentName||``}-${r.sessionName||``}`:r.agentName:tf(`无智能体使用权限`)),v=pi(()=>r.isCompressionHeight?`bkai-morenchicun`:`bkai-yasuo`),y=pi(()=>r.isCompressionHeight?tf(`恢复默认尺寸`):tf(`缩小高度`)),b=pi(()=>r.hasPermission),x=e=>b.value?e:tf(`暂无使用权限`),S=()=>({cursor:b.value?`pointer`:`not-allowed`}),C=sn(!1),w=async()=>{if(!C.value){C.value=!0;try{if(r.sessionBusinessManager)try{let e=await r.sessionBusinessManager.createNewSession({model:r.selectedLlmCode});e&&i(`new-chat-created`,{sessionCode:e.sessionCode,sessionName:e.sessionName,createdAt:e.createdAt})}catch(e){console.error(`Failed to create new session:`,e),cd({theme:`error`,message:tf(`创建会话失败`)})}i(`new-chat`)}finally{C.value=!1}}},T=e=>{e.stopPropagation(),r.sessionBusinessManager?(h||g(),h&&h.handleTriggerClick(e)):i(`history-click`,e)},E=()=>{i(`help-click`)},D=e=>{e.stopPropagation(),h&&h.isVisible()&&h.hide(),l.value&&(p.value?l.value.hide():l.value.show())},O=()=>{l.value?.hide(),j()},k=()=>{!r.hasSessionContents||r.autoGenerateLoading||i(`auto-generate-name`)},A=()=>{r.hasSessionContents&&(l.value?.hide(),i(`share`))},j=()=>{document.removeEventListener(`click`,F),d.value=r.sessionName||``,u.value=!0,setTimeout(()=>{document.addEventListener(`click`,F)},100),setTimeout(()=>{if(f.value)try{let e=f.value;e&&typeof e.focus==`function`&&e.focus();let t=e.$el?.querySelector(`input`);t&&typeof t.select==`function`&&t.select()}catch(e){console.warn(`Failed to focus rename input:`,e)}},100)},M=()=>{let e=d.value.trim();if(!e){N();return}i(`rename`,e),u.value=!1,d.value=``},N=()=>{u.value=!1,d.value=``},P=(e,t)=>{d.value=e,t.key===`Enter`?M():t.key===`Escape`&&N()},F=e=>{if(!u.value)return;let t=e.target,n=document.querySelector(`.rename-tooltip`);n&&!n.contains(t)&&N()};return Rn(()=>r.autoGenerateLoading,(e,t)=>{t&&!e&&p.value&&l.value?.hide()}),sr(()=>{r.sessionBusinessManager&&g(),document.addEventListener(`click`,F)}),cr(()=>{h&&=(h.destroy(),null),document.removeEventListener(`click`,F)}),t({headerRef:o,historyIconRef:s}),(t,n)=>(B(),V(`div`,{ref_key:`headerRef`,ref:o,class:xe([`ai-header drag-handle`,{draggable:r.draggable}])},[H(`div`,fZt,[H(`div`,pZt,[H(`img`,{alt:`logo`,src:z(dZt)},null,8,mZt)]),H(`div`,{class:xe([`title`,{"title-with-tooltip":u.value}])},[$r(ke(_.value)+` `,1),ei(` 重命名 tooltip 直接绑定在 title 上 `),u.value?(B(),V(`div`,hZt,[H(`div`,gZt,[Xr(z(fu),{ref_key:`renameInputRef`,ref:f,modelValue:d.value,"onUpdate:modelValue":n[0]||=e=>d.value=e,class:`rename-input`,placeholder:z(tf)(`请输入新的会话名称`),onKeyup:P},null,8,[`modelValue`,`placeholder`]),H(`div`,{class:`rename-buttons`},[H(`i`,{class:`bkai-icon bkai-check-1 rename-btn confirm-btn`,onClick:M}),H(`i`,{class:`bkai-icon bkai-close rename-btn cancel-btn`,onClick:N})])])])):ei(`v-if`,!0)],2),ei(` 更多图标下拉菜单 - 使用 vue-tippy `),r.showMoreIcon&&b.value?(B(),Kr(z(_p),{key:0,ref_key:`moreMenuTippyRef`,ref:l,arrow:!1,"append-to":m,offset:[0,4],interactive:``,placement:`bottom-start`,theme:`ai-blueking-light more-menu-light light`,trigger:`manual`,onHidden:n[1]||=e=>p.value=!1,onShown:n[2]||=e=>p.value=!0},{content:Mn(()=>[p.value?(B(),V(`div`,_Zt,[r.dropdownMenuConfig?.showRename?(B(),V(`div`,{key:0,class:`tippy-menu-item`,onClick:O},[n[7]||=H(`i`,{class:`bkai-icon bkai-bianji`},null,-1),H(`span`,null,ke(z(tf)(`重命名`)),1)])):ei(`v-if`,!0),r.dropdownMenuConfig?.showAutoGenerate?Nn((B(),V(`div`,{key:1,class:xe([`tippy-menu-item`,{disabled:!r.hasSessionContents||r.autoGenerateLoading}]),onClick:k},[r.autoGenerateLoading?(B(),Kr(z(ql),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):(B(),V(`i`,vZt)),H(`span`,null,ke(z(tf)(`自动生成命名`)),1)],2)),[[z(vp),{content:r.hasSessionContents?``:z(tf)(`请先发起会话`),theme:`ai-blueking-tooltip`,arrow:!0,delay:[300,0],appendTo:m}]]):ei(`v-if`,!0),r.dropdownMenuConfig?.showShare&&r.renderMode!==z(Mp).Test?Nn((B(),V(`div`,{key:2,class:xe([`tippy-menu-item`,{disabled:!r.hasSessionContents}]),onClick:A},[n[8]||=H(`i`,{class:`bkai-icon bkai-fenxiang`},null,-1),H(`span`,null,ke(z(tf)(`分享会话`)),1)],2)),[[z(vp),{content:r.hasSessionContents?``:z(tf)(`请先发起会话`),theme:`ai-blueking-tooltip`,arrow:!0,delay:[300,0],appendTo:m}]]):ei(`v-if`,!0)])):ei(`v-if`,!0)]),default:Mn(()=>[H(`span`,{class:`bkai-icon bkai-more`,onClick:D})]),_:1},512)):ei(`v-if`,!0)]),mr(t.$slots,`headerLeft`,{},void 0,!0),H(`div`,yZt,[ei(` 新增会话按钮 `),r.showNewChatIcon&&e.enableChatSession!==!1?Nn((B(),V(`i`,{key:0,class:xe([`bkai-icon`,`bkai-xinzengliaotian`,{disabled:!b.value||C.value||!e.hasSessionContents}]),style:ge(S()),onClick:n[3]||=t=>b.value&&!C.value&&e.hasSessionContents?w():void 0},null,6)),[[z(a),{content:C.value?z(tf)(`正在创建会话...`):e.hasSessionContents?x(z(tf)(`新增会话`)):z(tf)(`当前已是新会话`),boundary:`parent`}]]):ei(`v-if`,!0),ei(` 历史会话按钮 `),r.showHistoryIcon&&e.enableChatSession!==!1?Nn((B(),V(`i`,{key:1,ref_key:`historyIconRef`,ref:s,class:xe([`bkai-icon`,`bkai-history`,{disabled:!b.value}]),style:ge(S()),onClick:n[4]||=e=>b.value?T(e):void 0},null,6)),[[z(a),{content:x(z(tf)(`历史会话`)),boundary:`parent`}]]):ei(`v-if`,!0),e.chatGroup?.enabled?Nn((B(),V(`i`,{key:2,class:`bkai-icon bkai-zhushou`,onClick:E},null,512)),[[z(a),{content:z(tf)(`转人工`),boundary:`parent`}]]):ei(`v-if`,!0),r.showCompressionIcon?Nn((B(),V(`i`,{key:3,class:xe([`bkai-icon`,v.value]),onClick:n[5]||=e=>i(`toggle-compression`)},null,2)),[[z(a),{content:y.value,boundary:`parent`}]]):ei(`v-if`,!0),Nn(H(`i`,{class:`bkai-icon bkai-close-line-2`,onClick:n[6]||=e=>i(`close`)},null,512),[[z(a),{content:z(tf)(`关闭`),boundary:`parent`}]])])],2))}}),[[`__scopeId`,`data-v-6dcebb8e`]]);function xZt(e){let t=bSe(e);fetch(t,{method:`GET`,credentials:`include`}).catch(()=>{})}async function SZt(e,t={}){let{enableModelSelect:n=!0}=t,r=[e.agent.getAgentInfo(),e.session.getSessions()];n&&typeof e.agent.getLlms==`function`&&r.push(e.agent.getLlms().catch(e=>{console.error(`[runAgentBootstrap] Failed to load models:`,e)})),await Promise.all(r);let i=e.agent.info.value?.saasUrl;i&&xZt(i)}var CZt=class{_isGenerating;_isModelsLoading;_isStopLoading;_models;_selectedLlmCode;_selectedModelName;_selectedModelSupportsVision;agentModule;config;eventEmitter;messageModule;sessionModule;hasValidSelection(){let e=this._selectedLlmCode.value;return!!e&&this._models.value.some(t=>t.llm_code===e)}isSessionPending(){return this.sessionModule!=null&&this.sessionModule.current.value==null}applySessionModel(e){let t=this._models.value;if(t.length===0){this._selectedLlmCode.value=void 0;return}if(this.isSessionPending())return;if(e&&t.some(t=>t.llm_code===e)){this._selectedLlmCode.value=e;return}if(this.hasValidSelection())return;let n=t.find(e=>e.property?.default)??t[0];this._selectedLlmCode.value=n?.llm_code}async persistSessionModel(e){let t=this.sessionModule?.current.value;if(!(!t?.sessionCode||!e)&&t.model!==e)try{await this.sessionModule.updateSession({...t,model:e})}catch(e){console.error(`[ChatBusinessManager] Failed to persist session model:`,e),this.emit(`chat-error`,{action:`persistSessionModel`,error:e})}}resolveChatModel(e){return(e??this._selectedLlmCode.value)||void 0}autoRenameSessionIfNeeded(e){let t=this.sessionModule;if(!t||this.messageModule.list.value.length!==1)return;let n=t.renameSession(e);n&&n.then(n=>{let r=t.list.value.find(t=>t.sessionCode===e)??(t.current?.value?.sessionCode===e?t.current.value:null),i=n?.sessionName??r?.sessionName;i&&this.config.onSessionRenamed?.(i,e)}).catch(e=>{console.error(`[ChatBusinessManager] Auto rename session failed:`,e)})}emit(e,t){this.eventEmitter?.emit(e,t)}constructor(e,t,n=null,r=null,i={}){this.agentModule=e,this.messageModule=t,this.sessionModule=n,this.eventEmitter=r,this.config=i,this._isGenerating=sn(!1),this._isStopLoading=sn(!1),this._isModelsLoading=sn(!1),this._models=sn([]),this._selectedLlmCode=sn(void 0),this._selectedModelName=pi(()=>{let e=this._selectedLlmCode.value;return e?this._models.value.find(t=>t.llm_code===e)?.llm_name??``:``}),this._selectedModelSupportsVision=pi(()=>{let e=this._selectedLlmCode.value;return e?!!this._models.value.find(t=>t.llm_code===e)?.property?.support_vision:!1}),this.sessionModule&&Rn(()=>this.sessionModule.current.value?.sessionCode,()=>{this.applySessionModel(this.sessionModule.current.value?.model)})}get isGenerating(){return this._isGenerating}get isStopLoading(){return this._isStopLoading}get isMessagesLoading(){return this.messageModule.isListLoading}get models(){return this._models}get isModelsLoading(){return this._isModelsLoading}get selectedLlmCode(){return this._selectedLlmCode}get selectedModelName(){return this._selectedModelName}get selectedModelSupportsVision(){return this._selectedModelSupportsVision}get messages(){return this.messageModule.list}async loadModels(e={}){this._isModelsLoading.value=!0;try{let t=this.agentModule.models?.value;if(!e.force&&Array.isArray(t)&&t.length>0)this._models.value=[...t];else if(typeof this.agentModule.getLlms==`function`){let e=await this.agentModule.getLlms();this._models.value=Array.isArray(e)?e:[]}else this._models.value=[];this.applySessionModel(this.sessionModule?.current.value?.model)}catch(e){console.error(`[ChatBusinessManager] Failed to load models:`,e),this._models.value=[],this._selectedLlmCode.value=void 0}finally{this._isModelsLoading.value=!1}}setModels(e){this._models.value=e,this.applySessionModel(this.sessionModule?.current.value?.model)}setSelectedModelByName(e){if(!e){this._selectedLlmCode.value=void 0;return}let t=this._models.value.find(t=>t.llm_name===e);this._selectedLlmCode.value=t?.llm_code,this.persistSessionModel(t?.llm_code)}setSelectedModel(e){this._selectedLlmCode.value=e?.llm_code,this.persistSessionModel(e?.llm_code)}get openingRemark(){return this.config.openingRemark||``}get predefinedQuestions(){return this.config.predefinedQuestions||[]}async batchDeleteMessages(e){try{await this.messageModule.deleteMessages(e);let t=e.map(e=>e.id).filter(Boolean);this.emit(`messages-batch-deleted`,{messageIds:t})}catch(e){throw console.error(`Failed to batch delete messages:`,e),this.emit(`chat-error`,{action:`batch-delete-messages`,error:e}),e}}async deleteMessage(e){try{await this.messageModule.deleteMessages([e]),this.emit(`message-deleted`,{messageId:e.id})}catch(e){throw console.error(`Failed to delete message:`,e),this.emit(`chat-error`,{action:`delete-message`,error:e}),e}}handleStreamEnd(){this._isGenerating.value=!1,this.emit(`receive-end`,{})}handleStreamError(e){this._isGenerating.value=!1,this.emit(`receive-error`,{error:e})}handleStreamStart(){this._isGenerating.value=!0,this.emit(`receive-start`,{})}async regenerateFromAIMessages(e,t){try{if(!e||e.length===0)throw Error(`No AI messages provided`);let n=this.messages.value,r=hSe(n,e[0]);if(!r)throw Error(`No user message found before AI messages`);let i=r.id;if(i===void 0)throw Error(`User message has no id`);await this.regenerateMessage(String(i),t)}catch(e){throw console.error(`Failed to regenerate from AI messages:`,e),this.emit(`chat-error`,{action:`regenerate`,error:e}),e}}async regenerateMessage(e,t){try{let n=this.messages.value,r=n.findIndex(t=>String(t.id)===e);if(r===-1)throw Error(`Message not found: ${e}`);let i=n[r];if(i.role!==Ld.User)throw Error(`Can only regenerate from user messages`);let a=n.slice(r),o=typeof i.content==`string`?i.content:JSON.stringify(i.content),s=i.property;this._isGenerating.value=!0;let l=this.messageModule.deleteMessages(a);this.agentModule.chat(o,t,void 0,void 0,s,this.resolveChatModel()),this.emit(`chat-regenerate`,{messageId:e}),l.catch(e=>{console.error(`[regenerateMessage] Delete API error:`,e)})}catch(e){throw console.error(`Failed to regenerate message:`,e),this._isGenerating.value=!1,this.emit(`chat-error`,{action:`regenerate`,error:e}),e}}async resendMessageWithProperty(e,t,n,r){try{let i=this.messages.value,a=i.findIndex(t=>String(t.id)===e);if(a===-1)throw Error(`Message not found: ${e}`);if(i[a].role!==Ld.User)throw Error(`Can only resend user messages`);let o=i.slice(a);this._isGenerating.value=!0;let s=this.messageModule.deleteMessages(o);this.agentModule.chat(n,t,void 0,void 0,r,this.resolveChatModel()),this.emit(`chat-resend`,{messageId:e}),s.catch(e=>{console.error(`[resendMessageWithProperty] Delete API error:`,e)})}catch(e){throw console.error(`Failed to resend message with property:`,e),this._isGenerating.value=!1,this.emit(`chat-error`,{action:`resend`,error:e}),e}}async retryMessage(e){try{console.warn(`retryMessage not implemented yet`),this.emit(`chat-retry`,{messageId:e})}catch(e){throw console.error(`Failed to retry message:`,e),this.emit(`chat-error`,{action:`retry`,error:e}),e}}async sendMessage(e,t,n={}){try{if(!t)throw Error(`No active session. Please create or select a session first.`);this._isGenerating.value=!0,this.emit(`send-message`,{content:e}),await this.agentModule.chat(e,t,void 0,void 0,n.property,this.resolveChatModel(n.model)),this.autoRenameSessionIfNeeded(t)}catch(e){throw console.error(`Failed to send message:`,e),this._isGenerating.value=!1,this.emit(`chat-error`,{action:`send`,error:e}),e}}async stopGeneration(){let e=this.sessionModule?.current?.value?.sessionCode??``;this._isStopLoading.value=!0;try{await this.agentModule.stopChat(e),this._isGenerating.value=!1,this.emit(`stop`,{})}catch(e){throw console.error(`Failed to stop generation:`,e),this.emit(`chat-error`,{action:`stop`,error:e}),e}finally{this._isStopLoading.value=!1}}},wZt=class{agentModule;config;eventEmitter;messageModule;sessionModule;emit(e,t){this.eventEmitter?.emit(e,t)}constructor(e,t=null,n=null,r={},i=null){this.sessionModule=e,this.agentModule=t,this.eventEmitter=n,this.config=r,this.messageModule=i}get currentSession(){return this.sessionModule.current}get isCreateLoading(){return this.sessionModule.isCreateLoading}get isCurrentLoading(){return this.sessionModule.isCurrentLoading}get isDeleteLoading(){return this.sessionModule.isDeleteLoading}get isListLoading(){return this.sessionModule.isListLoading}get isLoadingMore(){return this.sessionModule.isLoadingMore}get isUpdateLoading(){return this.sessionModule.isUpdateLoading}get hasMoreSessions(){return this.sessionModule.hasMore}get sessionCount(){return this.sessionModule.count}get sessionList(){return this.sessionModule.list}async createNewSession(e){let t=this.currentSession.value;if(t?.sessionCode&&this.isCurrentSessionEmpty(t))return null;await this.loadSessions();let n=this.sessionList.value;if(n.length>0){let r=n[0];if(r.sessionCode===t?.sessionCode?this.isCurrentSessionEmpty(r):this.isSessionEmpty(r))return await this.syncSessionModelIfNeeded(e?.model,r),await this.switchSession(r.sessionCode,{loadMessages:!1}),null}return await this.createSession({name:`新会话`,sessionCode:this.generateSessionCode(),model:e?.model}),this.sessionModule.current.value}generateSessionCode(){return`new_session_${Date.now()}`}async syncSessionModelIfNeeded(e,t){if(!e)return;let n=t??this.sessionModule.current.value;!n?.sessionCode||n.model===e||await this.sessionModule.updateSession({...n,model:e})}async createSession(e={}){if(this.config.enableChatSession===!1)throw Error(`Chat session is disabled`);try{let t={sessionName:e.name||`新会话`,sessionCode:e.sessionCode||`session_${Date.now()}`,isTemporary:e.isTemporary||!1,...e.model?{model:e.model}:{},sessionProperty:{labels:e.labels}};await this.sessionModule.createSession(t);let n=this.agentModule?.info.value;n&&this.agentModule?.handleRole(n,t.sessionCode),this.emit(`session-created`,{session:this.sessionModule.current.value})}catch(e){throw console.error(`Failed to create session:`,e),this.emit(`session-error`,{action:`create`,error:e}),e}}async deleteSession(e){try{await this.sessionModule.deleteSession(e),this.emit(`session-deleted`,{sessionCode:e})}catch(e){throw console.error(`Failed to delete session:`,e),this.emit(`session-error`,{action:`delete`,error:e}),e}}async getSession(e){try{await this.sessionModule.getSession(e)}catch(e){throw console.error(`Failed to get session:`,e),this.emit(`session-error`,{action:`get`,error:e}),e}}isSessionEmpty(e){let t=this.findSession(e.sessionCode)?.sessionContentCount??e.sessionContentCount;return t==null?!1:t===0}isCurrentSessionEmpty(e){return this.messageModule&&mSe(this.messageModule.list.value)?!1:this.isSessionEmpty(e)}findSession(e){return this.sessionList.value.find(t=>t.sessionCode===e)}async loadRecentSession(e){try{if(this.currentSession.value?.sessionCode)return;e?.skipLoadSessions||await this.loadSessions();let t=this.sessionList.value;if(this.config.initialSessionCode){let e=this.findSession(this.config.initialSessionCode);await this.switchSession(this.config.initialSessionCode,{loadMessages:e?!this.isSessionEmpty(e):!0});return}if(t.length>0){let n=t[0],r=(n.sessionContentCount??0)>0,i=e?.alwaysCreateNewSession??this.config.alwaysCreateNewSession??!1;r||i?await this.createSession({name:`新会话`,sessionCode:this.generateSessionCode()}):await this.switchSession(n.sessionCode,{loadMessages:!1});return}await this.createSession({name:`新会话`,sessionCode:this.generateSessionCode()})}catch(e){throw console.error(`Failed to load recent session:`,e),e}}async loadSessions(){try{await this.sessionModule.getSessions(),this.emit(`sessions-loaded`,{sessions:this.sessionList.value})}catch(e){throw console.error(`Failed to load sessions:`,e),this.emit(`session-error`,{action:`load`,error:e}),e}}async loadMoreSessions(){try{await this.sessionModule.loadMoreSessions()}catch(e){throw console.error(`Failed to load more sessions:`,e),this.emit(`session-error`,{action:`loadMore`,error:e}),e}}async switchSession(e,t){try{await this.sessionModule.chooseSession(e,t),this.emit(`session-switched`,{session:this.sessionModule.current.value})}catch(e){throw console.error(`Failed to switch session:`,e),this.emit(`session-error`,{action:`switch`,error:e}),e}}async updateSessionName(e,t){try{let n=this.sessionList.value.find(t=>t.sessionCode===e);if(!n)throw Error(`Session not found: ${e}`);await this.sessionModule.updateSession({...n,sessionName:t}),this.emit(`session-updated`,{session:this.sessionModule.current.value})}catch(e){throw console.error(`Failed to update session name:`,e),this.emit(`session-error`,{action:`update`,error:e}),e}}},TZt=class{messageModule;sessionModule;constructor(e,t){this.messageModule=e,this.sessionModule=t}async shareMessages(e){if(e.length===0)throw Error(`No messages to share`);let t=this.sessionModule.current?.value?.sessionCode;if(!t)throw Error(`No active session`);let n=await this.messageModule.shareMessages(t,e);if(!n)throw Error(`Share failed: no result returned`);return{shareUrl:`${n.share_page}share-page/${n.share_token}`,userMessageIds:e.map(e=>String(e.id))}}},EZt=class{_agentShortcuts;_effectiveShortcuts;_propsShortcuts;eventEmitter;emit(e,t){this.eventEmitter?.emit(e,t)}constructor(e=null,t=[]){this._propsShortcuts=sn(t),this._agentShortcuts=sn([]),this.eventEmitter=e,this._effectiveShortcuts=pi(()=>this._propsShortcuts.value.length>0?this._propsShortcuts.value:this._agentShortcuts.value.length>0?this._agentShortcuts.value:[])}get count(){return this._effectiveShortcuts.value.length}get effectiveShortcuts(){return this._effectiveShortcuts}get hasShortcuts(){return this._effectiveShortcuts.value.length>0}get shortcuts(){return this._effectiveShortcuts}addShortcut(e){this._propsShortcuts.value.push(e)}clear(){this._propsShortcuts.value=[],this._agentShortcuts.value=[]}filterByTextLength(e,t){return!e||e.length>t?[]:this._effectiveShortcuts.value}filterShortcuts(e,t){return t?this._effectiveShortcuts.value.filter(n=>t(n,e)):this._effectiveShortcuts.value}getShortcutById(e){return this._effectiveShortcuts.value.find(t=>t.id===e)}handleShortcutClick(e,t,n=`main`){this.emit(`shortcut-click`,{shortcut:e,selectedText:t,source:n})}limitShortcuts(e){return this._effectiveShortcuts.value.slice(0,e)}removeShortcut(e){this._propsShortcuts.value=this._propsShortcuts.value.filter(t=>t.id!==e)}setAgentShortcuts(e){this._agentShortcuts.value=e}setShortcuts(e){this._propsShortcuts.value=e}},DZt=class{_isCompressed;_isDraggingOrResizing;_nimbusMinimized;_panelVisible;_positionAndSize;cleanupFunctions;config;containerRef=null;debugMode;listeners;onceListeners;constructor(e={}){this.config=e,this.listeners=new Map,this.onceListeners=new Map,this.debugMode=e.debug??!1,this.cleanupFunctions=[],this._panelVisible=sn(e.initialPanelVisible??!1),this._nimbusMinimized=sn(e.initialNimbusMinimized??!1),this._isDraggingOrResizing=sn(!1),this._isCompressed=sn(!1),this._positionAndSize=sn({x:0,y:0,width:400,height:window.innerHeight})}get container(){return{updatePosition:this.updatePosition.bind(this),updateSize:this.updateSize.bind(this),updatePositionAndSize:this.updatePositionAndSize.bind(this),toggleCompression:this.toggleCompression.bind(this),expandForSidePanel:this.expandForSidePanel.bind(this),collapseSidePanel:this.collapseSidePanel.bind(this),positionAndSize:pi(()=>this.containerRef?.positionAndSize?.value??this._positionAndSize.value),isCompressed:pi(()=>this._isCompressed.value),isSidePanelExpanded:pi(()=>this.containerRef?.isSidePanelExpanded?.value??!1)}}get isCompressed(){return this._isCompressed}get isDraggingOrResizing(){return this._isDraggingOrResizing}get nimbus(){return{minimize:this.minimizeNimbus.bind(this),restore:this.restoreNimbus.bind(this),toggle:this.toggleNimbus.bind(this),isMinimized:pi(()=>this._nimbusMinimized.value)}}get nimbusMinimized(){return this._nimbusMinimized}get panel(){return{show:this.showPanel.bind(this),hide:this.hidePanel.bind(this),toggle:this.togglePanel.bind(this),isVisible:pi(()=>this._panelVisible.value)}}get panelVisible(){return this._panelVisible}get state(){return{panelVisible:this._panelVisible,nimbusMinimized:this._nimbusMinimized,isDraggingOrResizing:this._isDraggingOrResizing,positionAndSize:this._positionAndSize}}collapseSidePanel(){this.containerRef?.collapseSidePanel&&this.containerRef.collapseSidePanel()}destroy(){this.listeners.clear(),this.onceListeners.clear(),this.cleanupFunctions.forEach(e=>e()),this.cleanupFunctions=[],this.debugMode&&console.debug(`[ComponentManager] Destroyed`)}emit(e,t){this.debugMode&&console.debug(`[ComponentManager] Emitting "${e}"`,t);let n=this.listeners.get(e);n&&n.forEach(n=>{try{n(t)}catch(t){console.error(`[ComponentManager] Error in listener for "${e}":`,t)}});let r=this.onceListeners.get(e);if(r&&r.size>0){let n=Array.from(r);this.onceListeners.delete(e),n.forEach(n=>{try{n(t)}catch(t){console.error(`[ComponentManager] Error in once listener for "${e}":`,t)}})}}emitInternal(e,t){this.emit(e,t)}expandForSidePanel(e){this.containerRef?.expandForSidePanel&&this.containerRef.expandForSidePanel(e)}getConfig(){return this.config}getRegisteredEvents(){let e=new Set;return this.listeners.forEach((t,n)=>e.add(n)),this.onceListeners.forEach((t,n)=>e.add(n)),Array.from(e)}handleDragging(e){this._isDraggingOrResizing.value=!0,this._positionAndSize.value=e,this.emit(`dragging`,e)}handleDragStop(e){this._isDraggingOrResizing.value=!1,this._positionAndSize.value=e,this.emit(`drag-stop`,e)}handleNimbusClick(){this.emit(`nimbus-click`,{}),this.showPanel()}handlePopupClick(){this.emit(`popup-click`,{}),this.showPanel()}handlePopupShortcutClick(e){this.emit(`popup-shortcut-click`,{shortcut:e}),this.emit(`shortcut-click`,{shortcut:e,source:`popup`})}handleResizeStop(e){this._isDraggingOrResizing.value=!1,this._positionAndSize.value=e,this.emit(`resize-stop`,e)}handleResizing(e){this._isDraggingOrResizing.value=!0,this._positionAndSize.value=e,this.emit(`resizing`,e)}handleShortcutClick(e,t){this.emit(`shortcut-click`,{shortcut:e,source:t})}hasListeners(e){return this.listenerCount(e)>0}hidePanel(){this._panelVisible.value=!1,this.emit(`panel-hide`,{})}listenerCount(e){return(this.listeners.get(e)?.size??0)+(this.onceListeners.get(e)?.size??0)}minimizeNimbus(){this._nimbusMinimized.value=!0,this.emit(`nimbus-minimize`,{})}off(e,t){t?(this.listeners.get(e)?.delete(t),this.onceListeners.get(e)?.delete(t),this.debugMode&&console.debug(`[ComponentManager] Unsubscribed from "${e}", remaining: ${this.listenerCount(e)}`)):(this.listeners.delete(e),this.onceListeners.delete(e),this.debugMode&&console.debug(`[ComponentManager] Removed all listeners for "${e}"`))}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),this.debugMode&&console.debug(`[ComponentManager] Subscribed to "${e}", total: ${this.listenerCount(e)}`),()=>{this.off(e,t)}}once(e,t){return this.onceListeners.has(e)||this.onceListeners.set(e,new Set),this.onceListeners.get(e).add(t),this.debugMode&&console.debug(`[ComponentManager] Subscribed once to "${e}"`),()=>{this.onceListeners.get(e)?.delete(t)}}restoreNimbus(){this._nimbusMinimized.value=!1,this.emit(`nimbus-restore`,{})}setCompressed(e){this._isCompressed.value=e}setContainerRef(e){this.containerRef=e,e?.isCompressed&&(this._isCompressed.value=e.isCompressed.value)}setDebugMode(e){this.debugMode=e}setDraggingOrResizing(e){this._isDraggingOrResizing.value=e}showPanel(e){this._panelVisible.value=!0,this.emit(`panel-show`,{sessionCode:e})}toggleCompression(){this.containerRef?this.containerRef.toggleCompression():this._isCompressed.value=!this._isCompressed.value}toggleNimbus(){this._nimbusMinimized.value?this.restoreNimbus():this.minimizeNimbus()}togglePanel(){this._panelVisible.value?this.hidePanel():this.showPanel()}updatePosition(e,t){this._positionAndSize.value={...this._positionAndSize.value,x:e,y:t}}updatePositionAndSize(e,t,n,r){this._positionAndSize.value={x:e,y:t,width:n,height:r}}updateSize(e,t){this._positionAndSize.value={...this._positionAndSize.value,width:e,height:t}}};function OZt(e){return new DZt(e)}var kZt={"panel-show":`show`,"panel-hide":`close`,"panel-toggle":null,"nimbus-click":null,"nimbus-minimize":null,"nimbus-restore":null,"popup-click":null,"popup-shortcut-click":null,dragging:`dragging`,resizing:`resizing`,"drag-stop":`drag-stop`,"resize-stop":`resize-stop`,"compression-toggle":null,"side-panel-expand":null,"side-panel-collapse":null,"send-message":`send-message`,"receive-start":`receive-start`,"receive-text":`receive-text`,"receive-end":`receive-end`,"receive-error":null,stop:`stop`,"chat-regenerate":null,"chat-retry":null,"message-deleted":null,"messages-batch-deleted":null,"session-created":null,"session-switched":null,"session-deleted":null,"session-updated":null,"sessions-loaded":null,"session-initialized":`session-initialized`,"session-error":null,"shortcut-click":`shortcut-click`,"chat-error":null,"sdk-error":`sdk-error`,"new-chat":`new-chat`,"new-chat-created":`new-chat-created`,"history-click":`history-click`,"auto-generate-name":`auto-generate-name`,"help-click":`help-click`,rename:`rename`,share:`share`,close:`close`,"toggle-compression":null,"transfer-messages":`transfer-messages`,"share-messages":`share-messages`,"agent-info-loaded":null,error:null};function AZt(e,t){switch(e){case`send-message`:return[t.content];case`rename`:return[t.newName,t.sessionCode];case`history-click`:return[t.event];case`dragging`:case`resizing`:case`drag-stop`:case`resize-stop`:case`shortcut-click`:case`session-initialized`:case`sdk-error`:case`transfer-messages`:case`share-messages`:case`new-chat-created`:return[t];case`panel-show`:case`panel-hide`:case`receive-start`:case`receive-text`:case`receive-end`:case`stop`:case`new-chat`:case`auto-generate-name`:case`help-click`:case`share`:case`close`:return[];default:return[t]}}var jZt=class extends Error{constructor(){super(`[ChatBot] Initialization was superseded by a newer init`),this.name=`ChatBotInitStaleError`}};function MZt(e){let{props:t,emit:n,reportError:r,managerErrorBridge:i}=e,a=cn(null),o=cn(null),s=cn(null),l=cn(null),u=sn(!1),d=sn(!t.chatHelper),f=sn(null),p=pi(()=>u.value),m=()=>t.chatHelper?!t.chatHelper.agent||!t.chatHelper.session||!t.chatHelper.message?{valid:!1,error:`[ChatBot] Invalid chatHelper: missing required modules (agent, session, message)`}:{valid:!0}:t.url?{valid:!0}:{valid:!1,error:`[ChatBot] Neither chatHelper nor url provided. Component requires at least one.`},h=()=>{let e=m();if(!e.valid)return console.error(e.error),f.value=Error(e.error),null;if(t.chatHelper)return t.chatHelper;let i=new Gd({onStart:()=>{n(`receive-start`)},onMessage:e=>{n(`receive-text`)},onDone:()=>{n(`receive-end`)},onError:e=>{r(e,`Stream error`)}}),a=cSe({requestData:uSe(bSe(t.url),()=>un(t.requestOptions)),protocol:i});return i.injectMessageModule(a.message),a},g=async(e,t)=>{if(e)try{let n=e.session.current?.value?.sessionCode??``;await e.agent.stopChat(n),t&&e.agent.abortChat()}catch{}},_=0,v=null,y=null,b=null,x=e=>{b&&=(e?b.reject(e):b.resolve(),null),v=null},S=e=>{if(e!==_)throw new jZt},C=async e=>{let p=a.value,m=d.value;u.value=!1,f.value=null,d.value=!t.chatHelper,await g(p,m),S(e),a.value=null,o.value=null,s.value=null,l.value=null;let _=h();if(!_)throw f.value??Error(`[ChatBot] Failed to create chatHelper`);let v=new wZt(_.session,_.agent,i,{enableChatSession:!0,autoSwitchToInitialSession:!!t.sessionCode,loadRecentSessionOnMount:t.autoLoad,initialSessionCode:t.sessionCode,alwaysCreateNewSession:t.alwaysCreateNewSession},_.message),y=new CZt(_.agent,_.message,_.session,i,{openingRemark:t.helloText,predefinedQuestions:t.prompts,placeholder:t.placeholder,onSessionRenamed:(e,t)=>n(`rename`,e,t)}),b=new EZt(null,t.shortcuts||[]);a.value=_,o.value=v,s.value=y,l.value=b;try{d.value&&(await SZt(_,{enableModelSelect:t.enableModelSelect!==!1&&!t.models?.length}),S(e),await v.loadRecentSession({skipLoadSessions:!0}),S(e)),t.enableModelSelect!==!1&&(t.models?.length?y.setModels(t.models):await y.loadModels(),S(e)),S(e),u.value=!0,n(`agent-info-loaded`,_)}catch(t){throw S(e),f.value=r(t,`Failed to initialize ChatBot`),t}},w=()=>{x(new jZt),y=null;let e=++_;v=new Promise((t,n)=>{b={resolve:t,reject:n},C(e).then(()=>{b&&=(y=Promise.resolve(),b.resolve(),null)}).catch(e=>{b&&=(b.reject(_Se(e)),null)}).finally(()=>{e===_&&(v=null)})}),v.catch(()=>{})};return Rn([()=>t.url,()=>t.chatHelper],()=>w(),{immediate:!0}),cr(()=>{x(),g(a.value,d.value)}),{chatHelper:a,isStandaloneMode:d,isInitialized:u,isReady:p,initError:f,whenReady:()=>u.value?(y||=Promise.resolve(),y):f.value?Promise.reject(f.value):v||Promise.resolve(),chatBusinessManager:s,sessionBusinessManager:o,shortcutManager:l}}function NZt(e){let{props:t,chatHelper:n,chatBusinessManager:r,sessionBusinessManager:i,shortcutManager:a,isStandaloneMode:o,isInitialized:s,selectedShortcut:l}=e,u=pi(()=>r.value?.isStopLoading.value?kp.StopLoading:((t.chatHelper||n.value)?.agent)?.isChatting?.value?kp.Streaming:kp.Complete),d=pi(()=>u.value===kp.Streaming?B9.Disabled:void 0),f=pi(()=>r.value?.messages.value??[]),p=pi(()=>r.value?.isMessagesLoading.value??!1);return{messageStatus:u,messageToolsStatus:d,messages:f,isMessagesLoading:p,isGenerating:pi(()=>r.value?.isGenerating.value??!1),currentSession:pi(()=>i.value?.currentSession.value??null),isWelcomeState:pi(()=>o.value&&!s.value?!1:!p.value&&f.value.length===0),openingRemark:pi(()=>n.value?.agent.info.value?.conversationSettings?.openingRemark||``),effectiveResources:pi(()=>t.resources?.length?t.resources:n.value?.agent.info.value?.resources??[]),effectivePrompts:pi(()=>t.prompts?.length?t.prompts:n.value?.agent.info.value?.conversationSettings?.predefinedQuestions??[]),effectiveSkills:pi(()=>t.skills?.length?t.skills:(n.value?.agent.info.value?.relatedSkills??[]).map(e=>({skill_name:e.skill_name,skill_code:e.skill_code,description:e.description,icon:e.icon}))),effectiveSupportUpload:pi(()=>l.value?.supportUpload?l.value.supportUpload.vision===!0:r.value?.selectedModelSupportsVision.value??!1),chatbotStyle:pi(()=>({height:typeof t.height==`number`?`${t.height}px`:t.height,maxWidth:typeof t.maxWidth==`number`?`${t.maxWidth}px`:t.maxWidth})),filteredShortcuts:pi(()=>a.value?.shortcuts.value??[])}}var PZt=new Set([`chat-error`,`receive-error`,`session-error`]);function FZt(e,t={}){let n=new WeakSet,r=(r,i)=>{let a=_Se(r);return n.has(a)?a:(n.add(a),console.error(i?`[ChatBot] ${i}:`:`[ChatBot] error:`,r),e(`error`,a),un(t.errorToast)!==!1&&cd({message:a.message||tf(`请求失败`),theme:`error`}),a)};return{managerErrorBridge:{emit:(e,t)=>{PZt.has(e)&&r(t?.error)}},reportError:r}}var IZt={[jp.ApprovalCancel]:Bd.ApprovalCancel,[jp.FlowNodeRetry]:Bd.FlowNodeRetry,[jp.FlowNodeSkip]:Bd.FlowNodeSkip};function LZt(e){return`operation`in e}function RZt(e){return`interruptId`in e&&`reason`in e&&e.reason===Ep.UserQuestion}function zZt(e){return e===`cancelled`?Wd.Cancelled:Wd.Resolved}function BZt(e){let t=e?.session.current?.value?.sessionCode;if(!t)throw Error(`[ChatBot] Cannot resume interrupt: no active session`);return t}function VZt(e){return{interruptId:e.interruptId,status:zZt(e.status),payload:e.payload}}function HZt(e){let{chatHelper:t,reportError:n}=e,r=async e=>{let n=t.value;if(!n)throw Error(`[ChatBot] Cannot resume interrupt: chatHelper not initialized`);if(!LZt(e))throw Error(`[ChatBot] Unsupported interrupt resume payload`);let r=BZt(n);if(e.operation===jp.ApprovalRefresh){n.agent.pollResumeSession(r);return}let i=IZt[e.operation];if(!i)throw Error(`[ChatBot] Unsupported interrupt resume operation: ${e.operation}`);let a=n.agent;if(e.operation===jp.ApprovalCancel){await a.userOperationStreamRequest(r,i,{interrupt_id:e.payload.interrupt_id});return}(e.operation===jp.FlowNodeRetry||e.operation===jp.FlowNodeSkip)&&await a.userOperationStreamRequest(r,i,{node_id:e.payload.node_id,task_id:String(e.payload.task_id)})},i=async(e,n)=>{let r=t.value;if(!r)throw Error(`[ChatBot] Cannot resume interrupt: chatHelper not initialized`);let i=BZt(r);await r.agent.streamRequest({sessionCode:i,resume:VZt(e),...n?{input:n}:{}})};return{handleInterruptResume:async(e,t)=>{try{if(LZt(e)){await r(e);return}if(RZt(e)){await i(e);return}throw Error(`[ChatBot] Unsupported interrupt resume payload`)}catch(e){n(e,`Failed to handle interrupt resume`)}},resumeUserQuestionWithInput:async(e,t)=>{try{if(!t.payload||!RZt(t.payload))throw Error(`[ChatBot] Invalid user question resume options`);let n=typeof e==`string`?e.trim():``;if(!n)throw Error(`[ChatBot] User question free text input is empty`);await i(t.payload,n)}catch(e){n(e,`Failed to resume user question with input`)}}}}function UZt(e){let{emit:t,chatHelper:n,chatBusinessManager:r,getRequestOptions:i,reportError:a,resumeUserQuestionWithInput:o,selectedShortcut:s,selectedResources:l}=e,u=cn([[]]),d=cn(``),f=(e,t)=>{u.value=e,l.value=t},p=async(e,a={})=>{if(!r.value||!n.value)throw Error(`[ChatBot] Cannot send message: chatBusinessManager not initialized`);let o=n.value.session.current?.value?.sessionCode;if(!o)throw Error(`[ChatBot] Cannot send message: no active session`);u.value=[[]],d.value=``,l.value=[],t(`send-message`,typeof e==`string`?e:``);let s=fSe(a.property,i);await r.value.sendMessage(e,o,{...a,...s?{property:s}:{}})},m=async e=>{let t=n.value?.session.current?.value?.sessionCode;if(!t)throw Error(`[ChatBot] Cannot upload: no active session`);let r=await n.value.session.uploadFile(t,e);if(!r?.download_url)throw Error(`[ChatBot] Upload failed: no download URL returned`);return r},h=async e=>{let t=n.value?.session.current?.value?.sessionCode;if(!t)throw Error(`[ChatBot] Cannot resolve artifact URL: no active session`);let r=await n.value.session.getPvFileDownloadUrl(t,e.outputId);return{download_url:r?.download_url,preview_url:r?.preview_url}},g=async(e,t,n)=>{try{if(n?.payload&&o){u.value=[[]],d.value=``,l.value=[],await o(e,n);return}let t={};d.value&&(t.cite=d.value),s.value&&(t.command=s.value.id),l.value.length&&(t.resources=l.value),await p(e,Object.keys(t).length?{property:{extra:t}}:{})}catch(e){a(e,`Failed to send message`)}},_=async()=>{await v()},v=async()=>{if(!r.value){console.error(`[ChatBot] Cannot stop generation: chatBusinessManager not initialized`);return}try{await r.value.stopGeneration(),t(`stop`)}catch(e){a(e,`Failed to stop generation`)}};return{userInput:u,cite:d,handleUpdateModelValue:f,doSendMessage:p,handleSendMessage:g,handleArtifactClick:h,handleUpload:m,handleStopSending:_,stopGeneration:v}}var WZt=e=>!e||e.id===`share`;function GZt(e){let{emit:t,chatHelper:n,isStandaloneMode:r}=e,i=async e=>{if(!(!n.value||e.length===0))try{await xSe((await new TZt(n.value.message,n.value.session).shareMessages(e)).shareUrl),cd({message:`分享链接已复制到剪贴板`,theme:`success`})}catch(e){console.error(`[ChatBot] Failed to share messages:`,e),cd({message:`分享失败,请重试`,theme:`error`})}};return{handleConfirmShare:async(e,n)=>{r.value&&WZt(n)&&await i(e),t(`confirm-share`,e,n)}}}function KZt(e){let{props:t,emit:n,shortcutManager:r,doSendMessage:i,reportError:a,selectedShortcut:o}=e,s=pi(()=>r.value?.effectiveShortcuts.value??[]),l=(e,t)=>{let n=e,r;if(r=n.enable_fill_back&&n.fill_back_component_key?n.fill_back_component_key:n.components?.find(e=>e.fillBack)?.key,r&&t){let e=n.components?.map(e=>e.key===r?{...e,default:t}:{...e,default:e.default??void 0});o.value={...n,components:e,formModel:{...n.formModel,[r]:t}}}else o.value={...n,formModel:{...n.formModel}}},u=(e,t)=>{let n=e.components||[];return{extra:{cite:{type:`structured`,title:e.alias||e.name,data:n.map(e=>({key:e.name||e.key,value:String(t[e.key]??``)}))},command:e.id,context:n.map(e=>({[e.key]:t[e.key],context_type:e.type,__label:e.name||e.key,__key:e.key,__value:t[e.key]}))}}},d=e=>{let t=e.property?.extra;return t?.shortcut?t.shortcut:t?.command?s.value.find(e=>e.id===t.command)??null:null},f=(e,t)=>{l(e,t),n(`shortcut-click`,{shortcut:e,source:`main`})},p=()=>{o.value=null};return Rn(()=>t.shortcuts,e=>{r.value?.setShortcuts(e||[])},{immediate:!0}),Rn(()=>e.chatHelper.value?.agent.info.value?.conversationSettings?.commands,e=>{e&&r.value?.setAgentShortcuts(e)},{immediate:!0}),{effectiveShortcuts:s,selectShortcutWithText:l,buildShortcutProperty:u,getShortcutFromMessage:d,handleSelectShortcut:f,handleCloseShortcut:p,handleShortcutSubmit:async e=>{if(!o.value){console.error(`[ChatBot] No selected shortcut`);return}let t=u(o.value,e),n=o.value.name,r=o.value;p();try{await i(n,{property:t})}catch(e){o.value=r,a(e,`Failed to submit shortcut`)}},sendShortcutDirectly:async(e,t)=>{let n=e,r={...n.formModel},o=n.components||[];for(let e of o)e.key in r||(r[e.key]=e.default??``);let s;s=n.enable_fill_back&&n.fill_back_component_key?n.fill_back_component_key:o.find(e=>e.fillBack)?.key,s&&t&&(r[s]=t);let l=u(n,r),d=n.name;try{await i(d,{property:l})}catch(e){a(e,`Failed to send shortcut directly`)}}}}function qZt(e){let{emit:t,chatHelper:n,chatBusinessManager:r,cite:i,focusInput:a,getShortcutFromMessage:o,buildShortcutProperty:s,getRequestOptions:l,reportError:u,stopGeneration:d}=e,f=async e=>{if(!r.value||!n.value){console.error(`[ChatBot] Cannot delete messages: chatBusinessManager not initialized`);return}try{let t=r.value.messages.value,i=hSe(t,e[0]);if(!i){console.error(`[ChatBot] No user message found before AI messages`);return}let a=[i,...e];await n.value.message.deleteMessages(a)}catch(e){u(e,`Failed to delete messages`)}},p=async e=>{if(!r.value||!n.value){console.error(`[ChatBot] Cannot regenerate: chatBusinessManager not initialized`);return}let t=n.value.session.current?.value?.sessionCode;if(!t){console.error(`[ChatBot] Cannot regenerate: no active session`);return}try{await r.value.regenerateFromAIMessages(e,t)}catch(e){u(e,`Failed to regenerate`)}},m=async e=>{if(!r.value||!n.value){console.error(`[ChatBot] Cannot delete message: chatHelper not initialized`);return}try{let t=r.value.messages.value,i=t.findIndex(t=>t===e);if(i===-1){console.error(`[ChatBot] User message not found in messages list`);return}let a=[];for(let e=i+1;e<t.length;e++){let n=t[e];if(n.role===Op.User)break;a.push(n)}let o=[e,...a];await n.value.message.deleteMessages(o)}catch(e){u(e,`Failed to delete user message`)}};return{handleAgentAction:async(e,r)=>{if(e.id===`cite`){i.value=r.filter(e=>e.role!==Op.Reasoning).map(e=>typeof e.content==`string`?e.content:JSON.stringify(e.content||``)).join(`
|
|
3499
|
+
`),a();return}if(e.id===`rebuild`){await p(r);return}if(e.id===`delete`){await f(r);return}if(e.id===`like`||e.id===`unlike`){let t=e.id===`like`?5:0;try{return await n.value?.session.getSessionFeedbackReasons(t)||[]}catch(e){return console.error(`[ChatBot] Failed to get feedback reasons:`,e),[]}}t(`agent-action`,e,r)},handleAgentFeedback:async(e,i,a,o)=>{if(!n.value){console.error(`[ChatBot] Cannot submit feedback: chatHelper not initialized`);return}let s=n.value.session.current?.value?.sessionCode;if(!s){console.error(`[ChatBot] Cannot submit feedback: no active session`);return}let l=gSe(r.value?.messages.value||[],i[0]);if(l===void 0){console.error(`[ChatBot] Cannot submit feedback: no user message found`);return}let d=e.id===`like`?5:0;try{await n.value.session.postSessionFeedback({sessionCode:s,sessionContentIds:[l],rate:d,labels:a,comment:o}),t(`feedback`,e,i[0],a,o)}catch(e){u(e,`Failed to submit feedback`)}},handleUserAction:async(e,t)=>{if(e.id===`delete`){await m(t);return}if(e.id===`cite`){i.value=typeof t.content==`string`?t.content:JSON.stringify(t.content||``),a();return}console.log(`handleUserAction`,e,t)},handleUserInputConfirm:async(e,t,i)=>{if(!n.value){console.error(`[ChatBot] Cannot edit message: chatHelper not initialized`);return}let a=n.value.session.current?.value?.sessionCode;if(!a){console.error(`[ChatBot] Cannot edit message: no active session`);return}let o=e.id;if(o===void 0){console.error(`[ChatBot] Cannot edit message: message has no id`);return}try{let n=e.property,i=fSe(n,l);await r.value?.resendMessageWithProperty(String(o),a,typeof t==`string`?t:``,i)}catch(e){u(e,`Failed to edit and resend message`)}},handleUserShortcutConfirm:async(e,t)=>{if(!r.value||!n.value){console.error(`[ChatBot] Cannot edit shortcut message: chatHelper not initialized`);return}let i=n.value.session.current?.value?.sessionCode;if(!i){console.error(`[ChatBot] Cannot edit shortcut message: no active session`);return}let a=e.id;if(a===void 0){console.error(`[ChatBot] Cannot edit shortcut message: message has no id`);return}try{let n=o(e);if(!n){console.error(`[ChatBot] Cannot edit shortcut message: shortcut not found`);return}let u=fSe(s(n,t),l),d=String(t.input??``);await r.value.resendMessageWithProperty(String(a),i,d,u)}catch(e){u(e,`Failed to edit shortcut message`)}},handleStopStreaming:d}}var JZt=$n({__name:`chat-bot`,props:{autoLoad:{type:Boolean,default:!0},alwaysCreateNewSession:{type:Boolean},chatHelper:{default:void 0},enableSelection:{type:Boolean,default:!1},enableModelSelect:{type:Boolean,default:!0},errorToast:{type:Boolean,default:!0},models:{default:void 0},executionTabVisible:{type:Boolean},renderMode:{default:Mp.Chat},extCls:{},height:{},helloText:{},useAgentName:{type:Boolean,default:!1},maxWidth:{},messageToolsTippyOptions:{},messageTools:{},updateTools:{},placeholder:{},prompts:{},requestOptions:{},resources:{default:()=>[]},sessionCode:{},shareLoading:{type:Boolean,default:!1},shortcuts:{default:()=>[]},skills:{},url:{default:``},placement:{default:`left`},resizeProps:{},size:{},getSideRenderComponent:{},getSideTabRenderComponent:{},onCustomTabChange:{}},emits:[`agent-action`,`agent-info-loaded`,`cancel-share`,`confirm-share`,`error`,`execution-panel-change`,`feedback`,`receive-end`,`receive-start`,`receive-text`,`rename`,`request-share`,`send-message`,`session-switched`,`shortcut-click`,`stop`],setup(e,{expose:t,emit:n}){let r=e,i={initialDivide:560,min:400},a=pi(()=>({...i,...r.resizeProps})),o=n,s=vr(),l=sn(),u=sn(),d=cn([]),f=sn(null),p=pi({get:()=>r.renderMode??Mp.Chat,set:()=>{}}),m=pi(()=>w.value?.selectedLlmCode.value),h=()=>{u.value?.focus?.()},{reportError:g,managerErrorBridge:_}=FZt(o,{errorToast:()=>r.errorToast}),{chatHelper:v,isStandaloneMode:y,isInitialized:b,isReady:x,initError:S,whenReady:C,chatBusinessManager:w,sessionBusinessManager:T,shortcutManager:E}=MZt({props:r,emit:o,reportError:g,managerErrorBridge:_}),{handleInterruptResume:D,resumeUserQuestionWithInput:O}=HZt({chatHelper:v,reportError:g}),{userInput:k,cite:A,handleUpdateModelValue:j,doSendMessage:M,handleSendMessage:N,handleUpload:P,handleArtifactClick:F,handleStopSending:I,stopGeneration:L}=UZt({emit:o,chatHelper:v,chatBusinessManager:w,getRequestOptions:()=>r.requestOptions,reportError:g,resumeUserQuestionWithInput:O,selectedShortcut:f,selectedResources:d}),{handleSelectShortcut:R,handleCloseShortcut:ee,handleShortcutSubmit:te,selectShortcutWithText:ne,getShortcutFromMessage:re,buildShortcutProperty:ie,sendShortcutDirectly:ae}=KZt({props:r,emit:o,chatHelper:v,shortcutManager:E,doSendMessage:M,reportError:g,selectedShortcut:f}),{messageStatus:oe,messageToolsStatus:se,messages:ce,isMessagesLoading:le,isGenerating:ue,currentSession:de,isWelcomeState:fe,openingRemark:pe,effectiveResources:me,effectivePrompts:he,effectiveSkills:_e,effectiveSupportUpload:ve,chatbotStyle:ye,filteredShortcuts:be}=NZt({props:r,chatHelper:v,chatBusinessManager:w,sessionBusinessManager:T,shortcutManager:E,isStandaloneMode:y,isInitialized:b,selectedShortcut:f}),{handleAgentAction:Ce,handleAgentFeedback:we,handleUserAction:Te,handleUserInputConfirm:Ee,handleUserShortcutConfirm:De,handleStopStreaming:Oe}=qZt({emit:o,chatHelper:v,chatBusinessManager:w,cite:A,focusInput:h,getShortcutFromMessage:re,buildShortcutProperty:ie,getRequestOptions:()=>r.requestOptions,reportError:g,stopGeneration:L}),ke=pi(()=>!b.value||le.value),Ae=pi(()=>{if(r.useAgentName)return v.value?.agent.info.value?.agentName||void 0}),je=pi(()=>{if(r.enableModelSelect===!1)return;let e=w.value?.models.value??[];return e.length>0?e:void 0}),Me=pi({get:()=>w.value?.selectedModelName.value??``,set:e=>{w.value?.setSelectedModelByName(e)}}),Ne=e=>{w.value?.setSelectedModel(e)};Rn(()=>r.models,e=>{r.enableModelSelect===!1||!w.value||e?.length&&w.value.setModels(e)});let{handleConfirmShare:Pe}=GZt({emit:o,chatHelper:v,isStandaloneMode:y}),Fe=(e,t)=>{o(`execution-panel-change`,e,t)},Ie=async e=>{if(r.onCustomTabChange)return r.onCustomTabChange(e);let t=e.data?.props;if(t?.task_id!=null&&t?.node_id)return v.value?.message.getFlowAgentTaskNodeInfo(t.task_id,t.node_id)};return t({sendMessage:e=>N(e,[[]]),stopGeneration:L,switchSession:async e=>{if(!T.value){console.error(`[ChatBot] Cannot switch session: sessionBusinessManager not initialized`);return}try{await T.value.switchSession(e),o(`session-switched`,T.value.currentSession.value)}catch(e){g(e,`Failed to switch session`)}},messages:ce,currentSession:de,isGenerating:ue,get isReady(){return x.value},whenReady:C,getChatHelper:()=>v.value,setCiteText:e=>{A.value=e},focusInput:h,enterShareMode:()=>l.value?.enterShareMode(),exitShareMode:()=>l.value?.exitShareMode(),selectShortcut:(e,t)=>{ne(e,t)},sendShortcut:(e,t)=>ae(e,t),updateAgentInfo:async()=>{let e=v.value;if(!e)return null;try{await e.agent.getAgentInfo();let t=e.agent.info.value??null;return t?.conversationSettings?.commands&&E.value?.setAgentShortcuts(t.conversationSettings.commands),t}catch(e){return g(e,`Failed to update agentInfo`),null}},selectedLlmCode:m}),(t,n)=>(B(),V(`div`,{class:xe([`ai-chatbot`,r.extCls,{"welcome-state":z(fe)}]),style:ge(z(ye))},[Xr(z(uZt),{ref_key:`chatContainerRef`,ref:l,cite:z(A),"onUpdate:cite":n[0]||=e=>on(A)?A.value=e:null,"selected-shortcut":f.value,"onUpdate:selectedShortcut":n[1]||=e=>f.value=e,"selected-model":Me.value,"onUpdate:selectedModel":n[2]||=e=>Me.value=e,"render-mode":p.value,"onUpdate:renderMode":n[3]||=e=>p.value=e,"chat-loading":ke.value,"common-tippy-options":e.messageToolsTippyOptions,"execution-tab-visible":r.executionTabVisible,"message-status":z(oe),"message-tools":r.messageTools,"message-tools-status":z(se),messages:z(ce),"model-value":z(k),models:je.value,"on-agent-action":z(Ce),"on-agent-feedback":z(we),"on-interrupt-resume":z(D),"get-side-render-component":r.getSideRenderComponent,"get-side-tab-render-component":r.getSideTabRenderComponent,"on-custom-tab-change":Ie,"on-send-message":z(N),"on-stop-sending":z(I),"on-artifact-click":z(F),"on-upload":z(P),"on-user-action":z(Te),"on-user-input-confirm":z(Ee),"on-user-shortcut-confirm":z(De),"opening-remark":z(pe),placeholder:r.placeholder,placement:r.placement,"welcome-title":Ae.value,prompts:z(he),"resize-props":a.value,size:r.size,resources:z(me),"shortcut-id":f.value?.id,shortcuts:z(be),skills:z(_e),"support-upload":z(ve),"update-tools":r.updateTools,onCollapseChange:Fe,onConfirmShare:z(Pe),onDeleteShortcut:z(ee),onModelChange:Ne,onSelectShortcut:z(R),onShortcutClose:z(ee),onShortcutSubmit:z(te),onStopStreaming:z(Oe),"onUpdate:modelValue":z(j)},pr({message:Mn(({message:n,messageToolsStatus:r,onInterruptResume:i})=>[ei(` 消费方提供了 #message slot 时,优先使用消费方的渲染 `),z(s).message?mr(t.$slots,`message`,{key:0,message:n,messageToolsStatus:r,onInterruptResume:i}):(B(),V(Rr,{key:1},[ei(` 否则使用默认的 MessageRender `),Xr(z(RXt),{message:n,"message-tools-status":r,"on-action":e=>z(Te)(e,n),"on-input-confirm":(e,t)=>z(Ee)(n,e,t),"on-interrupt-resume":i,"on-shortcut-confirm":e=>z(De)(n,e),"tippy-options":e.messageToolsTippyOptions},pr({_:2},[t.$slots.codeHeader?{name:`codeHeader`,fn:Mn(e=>[mr(t.$slots,`codeHeader`,Se(Zr(e)))]),key:`0`}:void 0]),1032,[`message`,`message-tools-status`,`on-action`,`on-input-confirm`,`on-interrupt-resume`,`on-shortcut-confirm`,`tippy-options`])],2112))]),_:2},[t.$slots.welcome?{name:`welcome`,fn:Mn(e=>[mr(t.$slots,`welcome`,Se(Zr(e)))]),key:`0`}:void 0]),1032,`cite.selected-shortcut.selected-model.render-mode.chat-loading.common-tippy-options.execution-tab-visible.message-status.message-tools.message-tools-status.messages.model-value.models.on-agent-action.on-agent-feedback.on-interrupt-resume.get-side-render-component.get-side-tab-render-component.on-send-message.on-stop-sending.on-artifact-click.on-upload.on-user-action.on-user-input-confirm.on-user-shortcut-confirm.opening-remark.placeholder.placement.welcome-title.prompts.resize-props.size.resources.shortcut-id.shortcuts.skills.support-upload.update-tools.onConfirmShare.onDeleteShortcut.onSelectShortcut.onShortcutClose.onShortcutSubmit.onStopStreaming.onUpdate:modelValue`.split(`.`))],6))}});function YZt(e,t){let{name:n,props:r,emitNames:i,exposeKeys:a,slots:o=[],deepWatchProps:s=[],methods:l={}}=t,u=Object.keys(r);return{name:n,render(e){return e(`div`,{style:{width:`100%`,height:`100%`}})},props:r,data(){return{app:null,componentInstance:null,unWatchStack:[]}},created(){let t=this.$emit.bind(this),n=this,r=()=>Fi({setup(){return()=>{let r={};for(let e of u)r[e]=n[e];let a={};for(let e of o){let t=n.$scopedSlots?.[e];t!==void 0&&(a[e]=e=>t(e))}let s=Object.keys(a).length>0?a:void 0;return U(Tle,{prefix:QZt()},{default:()=>U(e,{...n.$attrs,...r,...ZZt(t,i),ref:e=>{n.componentInstance=e}},s)})}}});n.app=r();for(let e of s)n.unWatchStack.push(n.$watch(e,()=>{n.app&&(n.app.unmount(),n.app=r(),n.app.mount(n.$el))},{deep:!0}))},mounted(){let e=this;e.app?.mount(e.$el),e.$nextTick(()=>{let t=e.componentInstance;if(t)for(let n of a){let r=t[n];typeof r==`function`?e[n]=r.bind(t):e[n]=r}})},beforeDestroy(){let e=this;e.unWatchStack.forEach(e=>e?.()),e.unWatchStack=[],e.app&&=(e.app.unmount(),null),e.componentInstance=null},methods:l}}function XZt(e){return`on`+e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function ZZt(e,t){let n={};for(let r of t)n[XZt(r)]=(...t)=>{e(r,...t)};return n}function QZt(){return`ai-bk`}var K9=function(e){return e.ERROR=`error`,e.IDLE=`idle`,e.LOADING_AGENT=`loading_agent`,e.READY=`ready`,e}({});function $Zt(e){let{url:t,requestOptions:n,autoInit:r=!0,protocolCallbacks:i,enableModelSelect:a=!0}=e,o=un(t);if(!o)throw Error(`[useChatBootstrap] url is required`);let s=sn(K9.IDLE),l=sn(null),u=sn(!1),d=new Map,f=new Gd({onStart:()=>{i?.onStart?.()},onMessage:e=>{i?.onMessage?.(e)},onDone:()=>{i?.onDone?.()},onError:e=>{i?.onError?.(e)}}),p=cSe({requestData:uSe(o,n),protocol:f});f.injectMessageModule(p.message);let m=pi(()=>s.value===K9.LOADING_AGENT),h=pi(()=>s.value===K9.READY),g=pi(()=>p.agent.info.value??null),_=pi(()=>g.value?.agentName??``),v=pi(()=>p.session.current.value??null),y=pi(()=>p.session.list.value??[]),b=null,x=0,S=async e=>{l.value=null;try{if(s.value=K9.LOADING_AGENT,await SZt(p,{enableModelSelect:a}),e!==x)return;s.value=K9.READY,u.value=!0}catch(t){if(e!==x)return;throw console.error(`[useChatBootstrap] Initialization failed:`,t),l.value=t,s.value=K9.ERROR,t}},C=async()=>{if(u.value)return;if(b)return b;let e=x;return b=S(e).finally(()=>{e===x&&(b=null)}),b},w=()=>{x+=1,s.value=K9.IDLE,l.value=null,u.value=!1,b=null},T=async()=>{w(),await C()},E=async e=>{w();let t=p.http;t?.updateConfig?t.updateConfig({urlPrefix:e}):console.warn(`[useChatBootstrap] chatHelper.http.updateConfig is not implemented yet, URL change may not take effect`),await C()};return Rn(()=>un(t),(e,t)=>{e&&e!==t&&t&&E(e).catch(()=>{})}),r&&Promise.resolve().then(()=>{C().catch(()=>{})}),{chatHelper:p,protocol:f,phase:s,isInitializing:m,isReady:h,error:l,agentInfo:g,agentName:_,currentSession:v,sessionList:y,initialize:C,retry:T,updateConfig:E,registerExtension:(e,t)=>{d.set(e,t)},getExtension:e=>d.get(e)}}function eQt(e){return{sendMessage:t=>e(`send-message`,{content:t}),receiveStart:()=>e(`receive-start`,{}),receiveText:()=>e(`receive-text`,{}),receiveEnd:()=>e(`receive-end`,{}),stop:()=>e(`stop`,{}),newChat:()=>e(`new-chat`,{}),newChatCreated:t=>e(`new-chat-created`,{session:t}),historyClick:t=>e(`history-click`,{event:t}),autoGenerateName:()=>e(`auto-generate-name`,{}),helpClick:()=>e(`help-click`,{}),rename:(t,n)=>e(`rename`,{newName:t,sessionCode:n}),share:()=>e(`share`,{}),transferMessages:t=>e(`transfer-messages`,{messageIds:t}),shareMessages:t=>e(`share-messages`,{messageIds:t})}}function tQt(e){let{componentManager:t,emit:n,debug:r=!1}=e,i=[],a=()=>{for(let[e,a]of Object.entries(kZt)){if(a===null)continue;let o=t.on(e,t=>{let i=AZt(e,t);r&&console.debug(`[useEventBridge] ${e} -> ${a}`,i),n(a,...i)});i.push(o)}},o=(e,n)=>{r&&console.debug(`[useEventBridge] Forwarding to manager: ${e}`,n),t.emit(e,n)},s=(e,...t)=>{r&&console.debug(`[useEventBridge] Direct emit: ${e}`,t),n(e,...t)},l=()=>{i.forEach(e=>e()),i.length=0};return a(),lr(()=>{l()}),{forwardToManager:o,emitDirect:s,cleanup:l}}function nQt(e){let{props:t,emit:n}=e,r=sn(),i=sn(),a=pi(()=>bSe(t.url??``)),o=OZt({initialPanelVisible:!1,initialNimbusMinimized:t.defaultMinimize,enablePopup:t.enablePopup,enableNimbus:!t.hideNimbus,enableDraggable:t.draggable}),s=o.panelVisible,l=o.nimbusMinimized,{forwardToManager:u}=tQt({componentManager:o,emit:n}),d=eQt(u),f=new WeakSet,p=null,m=null,h=()=>{p&&=(clearTimeout(p.timer),null)},g=e=>{let{apiName:n,error:r,action:i,source:a,shouldToast:s=!0}=e,l=r instanceof Error?r.message:String(r),u=r instanceof Error?r:null;u&&f.has(u)||(u&&f.add(u),a!==`http`&&u&&p?.error===u&&h(),console.error(`[AIBlueking] ${n} error:`,r),s&&t.errorToast!==!1&&cd({message:l||tf(`请求失败`),theme:`error`}),o.emitInternal(`sdk-error`,{apiName:n,action:i,source:a,code:-1,message:l,data:r}))},_=e=>{h();let t=m??(x.value?`chat`:`init`);p={error:e,timer:setTimeout(()=>{p=null,g({apiName:t,error:e,source:`http`})},0)}},v=async(e,t)=>{let n=m;m=e;try{return await t()}finally{m=n}},y=e=>{g({apiName:`chat`,error:e,source:`business`})},{chatHelper:b,isReady:x,error:S,agentInfo:C,agentName:w,currentSession:T,initialize:E}=$Zt({url:a,requestOptions:()=>un(t.requestOptions),autoInit:!0,enableModelSelect:t.enableModelSelect!==!1,protocolCallbacks:{onStart:()=>{d.receiveStart()},onMessage:()=>{d.receiveText()},onDone:()=>{d.receiveEnd()},onError:e=>{g({apiName:`chat`,error:e,source:`protocol`})}}}),D=b;D.onError?.(e=>{_(e)},{ignoreErrors:t.ignoreErrors});let O=new wZt(D.session,D.agent,null,{enableChatSession:t.enableChatSession,initialSessionCode:t.initialSessionCode,alwaysCreateNewSession:t.alwaysCreateNewSession},D.message),k=new TZt(D.message,D.session),A=new EZt(null,t.shortcuts||[]),j=null,M=()=>t.loadRecentSessionOnMount?(j||=O.loadRecentSession({skipLoadSessions:!0}).finally(()=>{j=null}),j):Promise.resolve(),N=async()=>{await v(`init`,async()=>{await E(),await M()})},P={appendTo:e=>{let t=e.closest(`.draggable-container-content`);return console.log(`[ai-blueking] appendTo called, ref:`,e),console.log(`[ai-blueking] appendTo closest result:`,t),t??document.body}},F=pi(()=>o.isCompressed.value),I=pi(()=>w.value),L=pi(()=>D.message.list.value.length===0),R=pi(()=>t.resources?.length?t.resources:C.value?.resources??[]),ee=pi(()=>t.prompts?.length?t.prompts:C.value?.conversationSettings?.predefinedQuestions??[]),te=pi(()=>(C.value?.relatedSkills??[]).map(e=>({skill_name:e.skill_name,skill_code:e.skill_code,description:e.description,icon:e.icon})));Rn(()=>S.value,e=>{e&&(h(),g({apiName:`init`,error:e,source:`http`}))});let ne=e=>{e.conversationSettings?.commands&&A.setAgentShortcuts(e.conversationSettings.commands)},re=async()=>{try{await D.agent.getAgentInfo();let e=C.value;return e&&ne(e),e}catch(e){return g({apiName:`getAgentInfo`,error:e,source:`http`}),null}};Rn(()=>x.value,async e=>{if(e&&C.value&&(ne(C.value),C.value.conversationSettings&&u(`session-initialized`,{openingRemark:C.value.conversationSettings.openingRemark||``,predefinedQuestions:C.value.conversationSettings.predefinedQuestions||[]}),t.loadRecentSessionOnMount))try{await M()}catch(e){console.error(`[AIBlueking] Failed to load recent session:`,e)}},{immediate:!0}),Rn(()=>t.shortcuts,e=>{A.setShortcuts(e||[])},{immediate:!0});let ie=e=>{TSe(e)&&(e.preventDefault(),s.value?o.hidePanel():o.showPanel())};return sr(async()=>{r.value&&o.setContainerRef(r.value),window.addEventListener(`keydown`,ie)}),cr(()=>{h(),window.removeEventListener(`keydown`,ie),o.destroy()}),{chatHelper:D,componentManager:o,sessionBusinessManager:O,shareBusinessManager:k,shortcutManager:A,forwarders:d,forwardToManager:u,chatBotRef:i,draggableContainerRef:r,panelVisible:s,nimbusMinimized:l,normalizedUrl:a,agentInfo:C,agentName:I,currentSession:T,isCompressed:F,isWelcomeState:L,messageToolsTippyOptions:P,agentResources:R,agentPrompts:ee,agentSkills:te,handleError:y,reportSdkError:g,ensureSessionReady:N,updateAgentInfo:re}}function rQt(e){let{shortcutManager:t,chatBotRef:n,forwardToManager:r,show:i,props:a}=e,o=sn(!1),s=sn(``);return{aiSelectionVisible:o,selectedText:s,filteredPopupShortcuts:pi(()=>{let e=t.effectiveShortcuts.value;return typeof a.shortcutFilter==`function`&&s.value?e.filter(e=>a.shortcutFilter?.(e,s.value)):e}),handleSelectionChange:e=>{s.value=e},handleAiSelectionShortcut:async(e,t)=>{o.value=!1,await i(),n.value&&(e.components?.length?n.value.selectShortcut(e,t):(n.value.selectShortcut(e),n.value.setCiteText(t),n.value.focusInput())),r(`shortcut-click`,{shortcut:e,source:`popup`})}}}function iQt(e,t=!1){let n=window.innerHeight-48-40,r=window.innerWidth-48-16,i=sn(r),a=sn(n),o=sn(0),s=sn(t),l=sn(!1),u=sn(!1),d=0,f=e=>{e?i.value=window.innerWidth-12:i.value=r},p=(e,t)=>{a.value=t,o.value=t-n},m=()=>{Dn(()=>{a.value=window.innerHeight-48-40+o.value,s.value?i.value=window.innerWidth-12:i.value=window.innerWidth-48-16})};return sr(()=>{window.addEventListener(`resize`,m),m()}),lr(()=>{window.removeEventListener(`resize`,m)}),{nimbusWidth:48,nimbusHeight:48,nimbusLeft:i,nimbusTop:a,isMinimize:s,isHovering:l,isDragging:u,handleNimbusDragging:p,handleNimbusMinimize:f,handleClick:()=>{if(u.value){u.value=!1;return}e(`click`)},handleMinimize:()=>{s.value=!s.value,e(`minimize`,s.value),s.value?i.value=window.innerWidth-12:i.value=window.innerWidth-60},handleDragging:(e,t)=>{i.value=e,a.value=t},handleMouseEnter:()=>{l.value=!0},handleMouseLeave:()=>{l.value=!1},handleMouseDown:()=>{d=Date.now(),u.value=!1},handleMouseUp:()=>{Date.now()-d>200&&(u.value=!0)}}}var aQt=560;function oQt(e){let{componentManager:t,chatBotRef:n,forwarders:r,forwardToManager:i,beforeNimbusClick:a,ensureSessionReady:o}=e,s=async e=>{t.showPanel(e),o&&await o(),e&&n.value&&await n.value.switchSession(e)},l=async e=>{await s(e)},u=()=>{t.hidePanel()};return{show:s,handleShow:l,hide:u,handleClose:()=>{u()},handleNimbusClick:async()=>{if(a&&await a()===!1){t.emit(`nimbus-click`,{});return}t.handleNimbusClick()},handleDragging:e=>{t.handleDragging(e)},handleResizing:e=>{t.handleResizing(e)},handleDragStop:e=>{t.handleDragStop(e)},handleResizeStop:e=>{t.handleResizeStop(e)},handleToggleCompression:()=>{t.container.toggleCompression()},handleCompressionChange:e=>{t.setCompressed(e)},handleExecutionPanelChange:(e,n)=>{if(e)t.collapseSidePanel();else{let e=Math.max(aQt,n??0);t.expandForSidePanel(e)}},sendMessage:async e=>{n.value&&await n.value.sendMessage(e)},handleReceiveStart:()=>{r.receiveStart()},handleReceiveText:()=>{r.receiveText()},handleReceiveEnd:()=>{r.receiveEnd()},handleStop:()=>{r.stop()},stopGeneration:()=>{n.value&&n.value.stopGeneration()},updatePosition:(e,n)=>{t.container.updatePosition(e,n)},updateSize:(e,n)=>{t.container.updateSize(e,n)},updatePositionAndSize:(e,n,r,i)=>{t.container.updatePositionAndSize(e,n,r,i)},setCiteText:e=>{n.value&&n.value.setCiteText(e)},focusInput:()=>{n.value&&n.value.focusInput()},selectShortcut:(e,t)=>{n.value&&n.value.selectShortcut(e,t)},sendShortcut:(e,t)=>n.value?n.value.sendShortcut(e,t):Promise.resolve(),getChatHelper:()=>n.value?n.value.getChatHelper():null,handleShortcutClick:e=>{i(`shortcut-click`,e)}}}function sQt(e){let{chatHelper:t,sessionBusinessManager:n,chatBotRef:r,forwarders:i,reportSdkError:a,currentSession:o}=e,s=sn(``),l=sn(!0),u=sn(!1),d=sn(!1),f=()=>mSe(t.message.list.value);Rn(()=>o.value,e=>{e&&(s.value=e.sessionName||``,u.value=(e.sessionContentCount??0)>0||f())},{immediate:!0}),Rn(()=>t.message.list.value.length,()=>{u.value=f()});let p=async()=>{r.value?.exitShareMode(),i.newChat()},m=e=>{i.newChatCreated(e)},h=e=>{i.historyClick(e)},g=async e=>{try{r.value?.exitShareMode(),await n.switchSession(e)}catch(e){console.error(`[AIBlueking] Failed to switch history session:`,e),a({apiName:`session`,action:`historySwitch`,error:e,source:`business`})}},_=async e=>{try{await n.deleteSession(e)}catch(e){console.error(`[AIBlueking] Failed to delete history session:`,e),a({apiName:`session`,action:`historyDelete`,error:e,source:`business`})}},v=async(e,t)=>{try{await n.updateSessionName(e,t)}catch(e){console.error(`[AIBlueking] Failed to rename history session:`,e),a({apiName:`session`,action:`historyRename`,error:e,source:`business`})}},y=async()=>{let e=t.session.current?.value?.sessionCode;if(!e){console.error(`[AIBlueking] Cannot auto-generate name: no active session`);return}d.value=!0;try{await t.session.renameSession(e);let n=t.session.list.value.find(t=>t.sessionCode===e);n&&(s.value=n.sessionName||``)}catch(e){console.error(`[AIBlueking] Failed to auto-generate session name:`,e),a({apiName:`session`,action:`autoGenerateName`,error:e,source:`business`})}finally{d.value=!1}i.autoGenerateName()},b=()=>{i.helpClick()},x=async e=>{let n=t.session.current?.value;if(!n){console.error(`[AIBlueking] Cannot rename: no active session`);return}try{await t.session.updateSession({...n,sessionName:e}),s.value=e}catch(e){console.error(`[AIBlueking] Failed to rename session:`,e),a({apiName:`session`,action:`rename`,error:e,source:`business`})}i.rename(e,n.sessionCode)},S=(e,t)=>{o.value?.sessionCode===t&&(s.value=e),i.rename(e,t)},C=e=>{e&&(s.value=e.sessionName||``,u.value=(e.sessionContentCount??0)>0||f())},w=()=>r.value?.selectedLlmCode;return{sessionName:s,hasPermission:l,hasSessionContents:u,autoGenerateLoading:d,handleNewChat:p,handleNewChatCreated:m,handleHistoryClick:h,handleHistorySessionSwitch:g,handleHistorySessionDelete:_,handleHistorySessionRename:v,handleAutoGenerateName:y,handleHelpClick:b,handleRename:x,handleSessionRenamed:S,handleSessionSwitched:C,addNewSession:async e=>{e?await n.createSession({...e,model:e.model??w()}):await n.createNewSession({model:w()})},switchToSession:async e=>{r.value&&await r.value.switchSession(e)},updateSessionName:async(e,t)=>{try{await n.updateSessionName(e,t),s.value=t}catch(e){console.error(`[AIBlueking] Failed to update session name:`,e),a({apiName:`session`,action:`updateSessionName`,error:e,source:`business`})}}}}function cQt(e){let{shareBusinessManager:t,chatBotRef:n,emit:r,forwarders:i,reportSdkError:a}=e,o=sn(!1);return{isShareLoading:o,handleShare:()=>{n.value?.enterShareMode(),i.share()},handleCancelShare:()=>{n.value?.exitShareMode()},handleConfirmShare:async(e,s)=>{if(!WZt(s)){n.value?.exitShareMode(),r(`confirm-share`,e,s);return}o.value=!0;try{let{shareUrl:a,userMessageIds:o}=await t.shareMessages(e);await xSe(a),cd({message:tf(`分享链接已复制到剪贴板`),theme:`success`}),n.value?.exitShareMode(),i.shareMessages(o),r(`confirm-share`,e,s)}catch(e){console.error(`[AIBlueking] Failed to share messages:`,e),a({apiName:`share`,action:`confirmShare`,error:e,source:`business`})}finally{o.value=!1}}}}function lQt(e={}){let t=sn([]),n=(n,r,i={})=>{try{let a=typeof n==`string`?document.querySelector(n):n;if(!a)return console.warn(`Tooltip target not found: ${n}`),null;let o=gf(a,{content:r,placement:`top`,arrow:!0,delay:[300,0],theme:`ai-blueking-tooltip`,...e,...i});return t.value.push(o),o}catch(e){return console.error(`Failed to create tooltip:`,e),null}},r=(e,t,r={})=>{let i=document.querySelectorAll(e),a=[];return i.forEach(e=>{let i=n(e,t,r);i&&a.push(i)}),a},i=e=>{let t=[];return e.forEach(({element:e,content:r,options:i})=>{let a=n(e,r,i);a&&t.push(a)}),t},a=()=>{t.value.forEach(e=>{e.destroy()}),t.value=[]};return cr(()=>{a()}),{instances:t,createTooltip:n,createTooltipsForSelector:r,createMultipleTooltips:i,destroyAll:a,updateContent:(e,t)=>{e.setContent(t)},destroyInstance:e=>{e.destroy()}}}var uQt={url:``,title:``,extCls:``,hideNimbus:!1,hideHeader:!1,enablePopup:!0,draggable:!0,enableChatSession:!0,enableModelSelect:!0,renderMode:Mp.Chat,defaultWidth:400,defaultHeight:void 0,defaultTop:0,defaultLeft:void 0,maxWidth:1e3,miniPadding:0,nimbusSize:`normal`,defaultMinimize:!1,shortcuts:()=>[],shortcutLimit:3,shortcutFilter:void 0,hideDefaultTrigger:!1,requestOptions:()=>({}),teleportTo:`body`,placeholder:void 0,helloText:tf(`你好,我是小鲸`),useAgentName:!1,disabledInput:!1,showHistoryIcon:!0,showNewChatIcon:!0,showCompressionIcon:!0,showMoreIcon:!0,initialSessionCode:``,autoSwitchToInitialSession:!1,alwaysCreateNewSession:!1,loadRecentSessionOnMount:!0,prompts:()=>[],dropdownMenuConfig:()=>({showRename:!0,showAutoGenerate:!0,showShare:!0}),defaultChatInputPosition:void 0,errorToast:!0,ignoreErrors:()=>[]};function dQt(e){return typeof e==`function`||Object.prototype.toString.call(e)===`[object Function]`}function q9(e,t,n,r=1){let[i,a]=typeof r==`number`?[r,r]:r;return[Math.round(t/i/e[0])*e[0],Math.round(n/a/e[1])*e[1]]}function fQt(e,t,n){return e-t-n}function pQt(e,t,n){return e-t-n}function J9(e,t,n){return t!==null&&e<t?t:n!==null&&n<e?n:e}function mQt(e,t,n){let r=e,i=[`matches`,`webkitMatchesSelector`,`mozMatchesSelector`,`msMatchesSelector`,`oMatchesSelector`].find(e=>dQt(r[e]));if(!dQt(r[i]))return!1;do{if(r[i](t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function hQt(e){let t=window.getComputedStyle(e);return[parseFloat(t.getPropertyValue(`width`),10),parseFloat(t.getPropertyValue(`height`),10)]}function Y9(e,t,n){e&&(e.attachEvent?e.attachEvent(`on`+t,n):e.addEventListener?e.addEventListener(t,n,!0):e[`on`+t]=n)}function X9(e,t,n){e&&(e.detachEvent?e.detachEvent(`on`+t,n):e.removeEventListener?e.removeEventListener(t,n,!0):e[`on`+t]=null)}var gQt=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Z9={mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`},touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`}},_Qt={userSelect:`none`,MozUserSelect:`none`,WebkitUserSelect:`none`,MsUserSelect:`none`},vQt={userSelect:`auto`,MozUserSelect:`auto`,WebkitUserSelect:`auto`,MsUserSelect:`auto`},Q9=Z9.mouse,yQt={replace:!0,name:`vue-draggable-resizable`,props:{className:{type:String,default:`vdr`},classNameDraggable:{type:String,default:`draggable`},classNameResizable:{type:String,default:`resizable`},classNameDragging:{type:String,default:`dragging`},classNameResizing:{type:String,default:`resizing`},classNameActive:{type:String,default:`active`},classNameHandle:{type:String,default:`handle`},disableUserSelect:{type:Boolean,default:!0},enableNativeDrag:{type:Boolean,default:!1},preventDeactivation:{type:Boolean,default:!1},active:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},lockAspectRatio:{type:Boolean,default:!1},w:{type:[Number,String],default:200,validator:e=>typeof e==`number`?e>0:e===`auto`},h:{type:[Number,String],default:200,validator:e=>typeof e==`number`?e>0:e===`auto`},minWidth:{type:Number,default:0,validator:e=>e>=0},minHeight:{type:Number,default:0,validator:e=>e>=0},maxWidth:{type:Number,default:null,validator:e=>e>=0},maxHeight:{type:Number,default:null,validator:e=>e>=0},x:{type:Number,default:0},y:{type:Number,default:0},z:{type:[String,Number],default:`auto`,validator:e=>typeof e==`string`?e===`auto`:e>=0},handles:{type:Array,default:()=>[`tl`,`tm`,`tr`,`mr`,`br`,`bm`,`bl`,`ml`],validator:e=>{let t=new Set([`tl`,`tm`,`tr`,`mr`,`br`,`bm`,`bl`,`ml`]);return new Set(e.filter(e=>t.has(e))).size===e.length}},dragHandle:{type:String,default:null},dragCancel:{type:String,default:null},axis:{type:String,default:`both`,validator:e=>[`x`,`y`,`both`].includes(e)},grid:{type:Array,default:()=>[1,1]},parent:{type:Boolean,default:!1},scale:{type:[Number,Array],default:1,validator:e=>typeof e==`number`?e>0:e.length===2&&e[0]>0&&e[1]>0},onDragStart:{type:Function,default:()=>!0},onDrag:{type:Function,default:()=>!0},onResizeStart:{type:Function,default:()=>!0},onResize:{type:Function,default:()=>!0}},data:function(){return{left:this.x,top:this.y,right:null,bottom:null,width:null,height:null,widthTouched:!1,heightTouched:!1,aspectFactor:null,parentWidth:null,parentHeight:null,handle:null,enabled:this.active,resizing:!1,dragging:!1,dragEnable:!1,resizeEnable:!1,zIndex:this.z}},created:function(){this.maxWidth&&this.minWidth>this.maxWidth&&console.warn(`[Vdr warn]: Invalid prop: minWidth cannot be greater than maxWidth`),this.maxHeight&&this.minHeight>this.maxHeight&&console.warn(`[Vdr warn]: Invalid prop: minHeight cannot be greater than maxHeight`),this.resetBoundsAndMouseState()},mounted:function(){this.enableNativeDrag||(this.$el.ondragstart=()=>!1);let[e,t]=this.getParentSize();this.parentWidth=e,this.parentHeight=t;let[n,r]=hQt(this.$el);this.aspectFactor=(this.w===`auto`?n:this.w)/(this.h===`auto`?r:this.h),this.width=this.w===`auto`?n:this.w,this.height=this.h===`auto`?r:this.h,this.right=this.parentWidth-this.width-this.left,this.bottom=this.parentHeight-this.height-this.top,this.active&&this.$emit(`activated`),Y9(document.documentElement,`mousedown`,this.deselect),Y9(document.documentElement,`touchend touchcancel`,this.deselect),Y9(window,`resize`,this.checkParentSize)},beforeUnmount:function(){X9(document.documentElement,`mousedown`,this.deselect),X9(document.documentElement,`touchstart`,this.handleUp),X9(document.documentElement,`mousemove`,this.move),X9(document.documentElement,`touchmove`,this.move),X9(document.documentElement,`mouseup`,this.handleUp),X9(document.documentElement,`touchend touchcancel`,this.deselect),X9(window,`resize`,this.checkParentSize)},methods:{resetBoundsAndMouseState(){this.mouseClickPosition={mouseX:0,mouseY:0,x:0,y:0,w:0,h:0},this.bounds={minLeft:null,maxLeft:null,minRight:null,maxRight:null,minTop:null,maxTop:null,minBottom:null,maxBottom:null}},checkParentSize(){if(this.parent){let[e,t]=this.getParentSize();this.parentWidth=e,this.parentHeight=t,this.right=this.parentWidth-this.width-this.left,this.bottom=this.parentHeight-this.height-this.top}},getParentSize(){if(this.parent){let e=window.getComputedStyle(this.$el.parentNode,null);return[parseInt(e.getPropertyValue(`width`),10),parseInt(e.getPropertyValue(`height`),10)]}return[null,null]},elementTouchDown(e){Q9=Z9.touch,this.elementDown(e)},elementMouseDown(e){Q9=Z9.mouse,this.elementDown(e)},elementDown(e){if(e instanceof MouseEvent&&e.button!==0)return;let t=e.target||e.srcElement;if(this.$el.contains(t)){if(this.onDragStart(e)===!1)return;if(this.dragHandle&&!mQt(t,this.dragHandle,this.$el)||this.dragCancel&&mQt(t,this.dragCancel,this.$el)){this.dragging=!1;return}this.enabled||(this.enabled=!0,this.$emit(`activated`),this.$emit(`update:active`,!0)),this.draggable&&(this.dragEnable=!0),this.mouseClickPosition.mouseX=e.touches?e.touches[0].pageX:e.pageX,this.mouseClickPosition.mouseY=e.touches?e.touches[0].pageY:e.pageY,this.mouseClickPosition.left=this.left,this.mouseClickPosition.right=this.right,this.mouseClickPosition.top=this.top,this.mouseClickPosition.bottom=this.bottom,this.parent&&(this.bounds=this.calcDragLimits()),Y9(document.documentElement,Q9.move,this.move),Y9(document.documentElement,Q9.stop,this.handleUp)}},calcDragLimits(){return{minLeft:this.left%this.grid[0],maxLeft:Math.floor((this.parentWidth-this.width-this.left)/this.grid[0])*this.grid[0]+this.left,minRight:this.right%this.grid[0],maxRight:Math.floor((this.parentWidth-this.width-this.right)/this.grid[0])*this.grid[0]+this.right,minTop:this.top%this.grid[1],maxTop:Math.floor((this.parentHeight-this.height-this.top)/this.grid[1])*this.grid[1]+this.top,minBottom:this.bottom%this.grid[1],maxBottom:Math.floor((this.parentHeight-this.height-this.bottom)/this.grid[1])*this.grid[1]+this.bottom}},deselect(e){let t=e.target||e.srcElement,n=RegExp(this.className+`-([trmbl]{2})`,``);!this.$el.contains(t)&&!n.test(t.className)&&(this.enabled&&!this.preventDeactivation&&(this.enabled=!1,this.$emit(`deactivated`),this.$emit(`update:active`,!1)),X9(document.documentElement,Q9.move,this.handleResize)),this.resetBoundsAndMouseState()},handleTouchDown(e,t){Q9=Z9.touch,this.handleDown(e,t)},handleDown(e,t){t instanceof MouseEvent&&t.which!==1||this.onResizeStart(e,t)!==!1&&(t.stopPropagation&&t.stopPropagation(),this.lockAspectRatio&&!e.includes(`m`)?this.handle=`m`+e.substring(1):this.handle=e,this.resizeEnable=!0,this.mouseClickPosition.mouseX=t.touches?t.touches[0].pageX:t.pageX,this.mouseClickPosition.mouseY=t.touches?t.touches[0].pageY:t.pageY,this.mouseClickPosition.left=this.left,this.mouseClickPosition.right=this.right,this.mouseClickPosition.top=this.top,this.mouseClickPosition.bottom=this.bottom,this.bounds=this.calcResizeLimits(),Y9(document.documentElement,Q9.move,this.handleResize),Y9(document.documentElement,Q9.stop,this.handleUp))},calcResizeLimits(){let e=this.minW,t=this.minH,n=this.maxW,r=this.maxH,i=this.aspectFactor,[a,o]=this.grid,s=this.width,l=this.height,u=this.left,d=this.top,f=this.right,p=this.bottom;this.lockAspectRatio&&(e/t>i?t=e/i:e=i*t,n&&r?(n=Math.min(n,i*r),r=Math.min(r,n/i)):n?r=n/i:r&&(n=i*r)),n-=n%a,r-=r%o;let m={minLeft:null,maxLeft:null,minTop:null,maxTop:null,minRight:null,maxRight:null,minBottom:null,maxBottom:null};return this.parent?(m.minLeft=u%a,m.maxLeft=u+Math.floor((s-e)/a)*a,m.minTop=d%o,m.maxTop=d+Math.floor((l-t)/o)*o,m.minRight=f%a,m.maxRight=f+Math.floor((s-e)/a)*a,m.minBottom=p%o,m.maxBottom=p+Math.floor((l-t)/o)*o,n&&(m.minLeft=Math.max(m.minLeft,this.parentWidth-f-n),m.minRight=Math.max(m.minRight,this.parentWidth-u-n)),r&&(m.minTop=Math.max(m.minTop,this.parentHeight-p-r),m.minBottom=Math.max(m.minBottom,this.parentHeight-d-r)),this.lockAspectRatio&&(m.minLeft=Math.max(m.minLeft,u-d*i),m.minTop=Math.max(m.minTop,d-u/i),m.minRight=Math.max(m.minRight,f-p*i),m.minBottom=Math.max(m.minBottom,p-f/i))):(m.minLeft=null,m.maxLeft=u+Math.floor((s-e)/a)*a,m.minTop=null,m.maxTop=d+Math.floor((l-t)/o)*o,m.minRight=null,m.maxRight=f+Math.floor((s-e)/a)*a,m.minBottom=null,m.maxBottom=p+Math.floor((l-t)/o)*o,n&&(m.minLeft=-(f+n),m.minRight=-(u+n)),r&&(m.minTop=-(p+r),m.minBottom=-(d+r)),this.lockAspectRatio&&n&&r&&(m.minLeft=Math.min(m.minLeft,-(f+n)),m.minTop=Math.min(m.minTop,-(r+p)),m.minRight=Math.min(m.minRight,-u-n),m.minBottom=Math.min(m.minBottom,-d-r))),m},move(e){this.resizing?this.handleResize(e):this.dragEnable&&this.handleDrag(e)},handleDrag(e){let t=this.axis,n=this.grid,r=this.bounds,i=this.mouseClickPosition,[a,o]=q9(n,t&&t!==`y`?i.mouseX-(e.touches?e.touches[0].pageX:e.pageX):0,t&&t!==`x`?i.mouseY-(e.touches?e.touches[0].pageY:e.pageY):0,this.scale),s=J9(i.left-a,r.minLeft,r.maxLeft),l=J9(i.top-o,r.minTop,r.maxTop);if(this.onDrag(s,l)===!1)return;let u=J9(i.right+a,r.minRight,r.maxRight),d=J9(i.bottom+o,r.minBottom,r.maxBottom);this.left=s,this.top=l,this.right=u,this.bottom=d,this.$emit(`dragging`,this.left,this.top),this.dragging=!0},moveHorizontally(e){let[t,n]=q9(this.grid,e,this.top,1),r=J9(t,this.bounds.minLeft,this.bounds.maxLeft);this.left=r,this.right=this.parentWidth-this.width-r},moveVertically(e){let[t,n]=q9(this.grid,this.left,e,1),r=J9(n,this.bounds.minTop,this.bounds.maxTop);this.top=r,this.bottom=this.parentHeight-this.height-r},handleResize(e){let t=this.left,n=this.top,r=this.right,i=this.bottom,a=this.mouseClickPosition,o=this.aspectFactor,s=a.mouseX-(e.touches?e.touches[0].pageX:e.pageX),l=a.mouseY-(e.touches?e.touches[0].pageY:e.pageY);!this.widthTouched&&s&&(this.widthTouched=!0),!this.heightTouched&&l&&(this.heightTouched=!0);let[u,d]=q9(this.grid,s,l,this.scale);this.handle.includes(`b`)?(i=J9(a.bottom+d,this.bounds.minBottom,this.bounds.maxBottom),this.lockAspectRatio&&this.resizingOnY&&(r=this.right-(this.bottom-i)*o)):this.handle.includes(`t`)&&(n=J9(a.top-d,this.bounds.minTop,this.bounds.maxTop),this.lockAspectRatio&&this.resizingOnY&&(t=this.left-(this.top-n)*o)),this.handle.includes(`r`)?(r=J9(a.right+u,this.bounds.minRight,this.bounds.maxRight),this.lockAspectRatio&&this.resizingOnX&&(i=this.bottom-(this.right-r)/o)):this.handle.includes(`l`)&&(t=J9(a.left-u,this.bounds.minLeft,this.bounds.maxLeft),this.lockAspectRatio&&this.resizingOnX&&(n=this.top-(this.left-t)/o));let f=fQt(this.parentWidth,t,r),p=pQt(this.parentHeight,n,i);this.onResize(this.handle,t,n,f,p)!==!1&&(this.left=t,this.top=n,this.right=r,this.bottom=i,this.width=f,this.height=p,this.$emit(`resizing`,this.left,this.top,this.width,this.height),this.resizing=!0)},changeWidth(e){let[t,n]=q9(this.grid,e,0,1),r=J9(this.parentWidth-t-this.left,this.bounds.minRight,this.bounds.maxRight),i=this.bottom;this.lockAspectRatio&&(i=this.bottom-(this.right-r)/this.aspectFactor);let a=fQt(this.parentWidth,this.left,r),o=pQt(this.parentHeight,this.top,i);this.right=r,this.bottom=i,this.width=a,this.height=o},changeHeight(e){let[t,n]=q9(this.grid,0,e,1),r=J9(this.parentHeight-n-this.top,this.bounds.minBottom,this.bounds.maxBottom),i=this.right;this.lockAspectRatio&&(i=this.right-(this.bottom-r)*this.aspectFactor);let a=fQt(this.parentWidth,this.left,i),o=pQt(this.parentHeight,this.top,r);this.right=i,this.bottom=r,this.width=a,this.height=o},handleUp(e){this.handle=null,this.resetBoundsAndMouseState(),this.dragEnable=!1,this.resizeEnable=!1,this.resizing&&(this.resizing=!1,this.$emit(`resizeStop`,this.left,this.top,this.width,this.height)),this.dragging&&(this.dragging=!1,this.$emit(`dragStop`,this.left,this.top)),X9(document.documentElement,Q9.move,this.handleResize)}},computed:{style(){return{transform:`translate(${this.left}px, ${this.top}px)`,width:this.computedWidth,height:this.computedHeight,zIndex:this.zIndex,...this.dragging&&this.disableUserSelect?_Qt:vQt}},actualHandles(){return this.resizable?this.handles:[]},computedWidth(){return this.w===`auto`&&!this.widthTouched?`auto`:this.width+`px`},computedHeight(){return this.h===`auto`&&!this.heightTouched?`auto`:this.height+`px`},minW(){return this.minWidth},minH(){return this.minHeight},maxW(){return this.maxWidth},maxH(){return this.maxHeight},resizingOnX(){return!!this.handle&&(this.handle.includes(`l`)||this.handle.includes(`r`))},resizingOnY(){return!!this.handle&&(this.handle.includes(`t`)||this.handle.includes(`b`))},isCornerHandle(){return!!this.handle&&[`tl`,`tr`,`br`,`bl`].includes(this.handle)}},watch:{active(e){this.enabled=e,e?this.$emit(`activated`):this.$emit(`deactivated`)},z(e){(e>=0||e===`auto`)&&(this.zIndex=e)},x(e){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcDragLimits()),this.moveHorizontally(e))},y(e){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcDragLimits()),this.moveVertically(e))},lockAspectRatio(e){e?this.aspectFactor=this.width/this.height:this.aspectFactor=void 0},w(e){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcResizeLimits()),this.changeWidth(e))},h(e){this.resizing||this.dragging||(this.parent&&(this.bounds=this.calcResizeLimits()),this.changeHeight(e))}}},bQt=[`onMousedown`,`onTouchstart`];function xQt(e,t,n,r,i,a){return B(),V(`div`,{style:ge(a.style),class:xe([{[n.classNameActive]:e.enabled,[n.classNameDragging]:e.dragging,[n.classNameResizing]:e.resizing,[n.classNameDraggable]:n.draggable,[n.classNameResizable]:n.resizable},n.className]),onMousedown:t[0]||=(...e)=>a.elementMouseDown&&a.elementMouseDown(...e),onTouchstart:t[1]||=(...e)=>a.elementTouchDown&&a.elementTouchDown(...e)},[(B(!0),V(Rr,null,fr(a.actualHandles,t=>(B(),V(`div`,{key:t,class:xe([n.classNameHandle,n.classNameHandle+`-`+t]),style:ge({display:e.enabled?`block`:`none`}),onMousedown:Ni(e=>a.handleDown(t,e),[`stop`,`prevent`]),onTouchstart:Ni(e=>a.handleTouchDown(t,e),[`stop`,`prevent`])},[mr(e.$slots,t)],46,bQt))),128)),mr(e.$slots,`default`)],38)}var SQt=gQt(yQt,[[`render`,xQt]]);function CQt(e){CQt.installed||(CQt.installed=!0,e.component(`VueDraggableResizable`,SQt))}var wQt={install:CQt},$9=null;typeof window<`u`?$9=window.Vue:typeof global<`u`&&($9=global.Vue),$9&&$9.use(wQt);function TQt(e={},t){let n=e.initWidth||400,r=e.minWidth||400,i=e.minHeight||400,a=e.maxWidthPercent||40,o=e.compressedHeight||800,s=e.compressedPadding===void 0?0:e.compressedPadding,l=sn(e.defaultLeft===void 0?window.innerWidth-n:e.defaultLeft),u=sn(e.defaultTop===void 0?0:e.defaultTop),d=sn(e.defaultHeight===void 0?window.innerHeight-(e.defaultTop===void 0?0:e.defaultTop):e.defaultHeight),f=sn(n),p=sn(u.value),m=sn(l.value),h=sn(f.value),g=sn(d.value),_=sn(Math.max(window.innerWidth*(a/100),h.value)),v=sn(!1),y=sn(0),b=null,x=null,S=sn(!1),C=e=>{let t=window.innerWidth,n={...e};return n.width>t&&(n.width=t),n.x+n.width>t&&(n.x=t-n.width),n.x<0&&(n.x=0),n},w=()=>({x:m.value,y:p.value,width:h.value,height:g.value}),T=(e,n)=>{m.value=e,p.value=n,y.value=e-(window.innerWidth-h.value),t?.onDragging?.(w())},E=(e,n,r,i)=>{m.value=e,p.value=n,h.value=Math.min(r,_.value),g.value=i,t?.onResizing?.(w())},D=(e,n)=>{m.value=e,p.value=n,y.value=e-(window.innerWidth-h.value),S.value&&(x=w()),t?.onDragStop?.(w())},O=(e,n,r,i)=>{m.value=e,p.value=n,h.value=Math.min(r,_.value),g.value=i,S.value&&(x=w()),t?.onResizeStop?.(w())},k=()=>{_.value=Math.max(window.innerWidth*(a/100),h.value),Dn(()=>{if(v.value)m.value=window.innerWidth-h.value-s,p.value=window.innerHeight-o-s;else{let e=window.innerWidth-h.value-y.value;m.value=Math.max(0,e),setTimeout(()=>{g.value=window.innerHeight-p.value},0)}h.value>_.value&&(h.value=_.value)})},A=()=>{v.value?(p.value=u.value,Dn(()=>{g.value=d.value,m.value=l.value,h.value=f.value})):(p.value=window.innerHeight-o-s,m.value=l.value-s,h.value=n,g.value=o),v.value=!v.value},j=(e,t)=>{m.value=e,p.value=t,y.value=e-(window.innerWidth-h.value)},M=(e,t)=>{h.value=Math.max(r,Math.min(e,_.value)),g.value=Math.max(i,t)};return sr(()=>{window.addEventListener(`resize`,k)}),cr(()=>{window.removeEventListener(`resize`,k)}),{minWidth:r,minHeight:i,maxWidth:_,top:p,left:m,width:h,height:g,isCompressed:v,isSidePanelExpanded:S,handleDragging:T,handleResizing:E,handleDragStop:D,handleResizeStop:O,toggleCompression:A,updatePosition:j,updateSize:M,updatePositionAndSize:(e,t,n,r)=>{j(e,t),M(n,r)},expandForSidePanel:e=>{if(S.value)return;let t=w();b={...t},S.value=!0;let n=t.x+t.width,r=x?.width??t.width+e,i=C({x:n-r,y:t.y,width:r,height:t.height});j(i.x,i.y),Dn(()=>{M(i.width,i.height)})},collapseSidePanel:()=>{if(!S.value)return;let e=w();x={...e},S.value=!1;let t=e.x+e.width,n=b?.width??e.width,r=C({x:t-n,y:e.y,width:n,height:e.height});M(r.width,r.height),Dn(()=>{j(r.x,r.y)})}}}var EQt={class:`draggable-container-content`},DQt=Ii($n({__name:`draggable-container`,props:{className:{default:``},compressedHeight:{default:800},compressedPadding:{default:0},defaultHeight:{default:void 0},defaultWidth:{default:400},defaultX:{default:void 0},defaultY:{default:0},draggable:{type:Boolean,default:!0},dragHandle:{default:`.drag-handle`},maxWidth:{default:void 0},maxWidthPercent:{default:80},minHeight:{default:400},minWidth:{default:400},resizable:{type:Boolean,default:!0},teleportTo:{default:`body`},visible:{type:Boolean,default:!1}},emits:[`dragging`,`resizing`,`drag-stop`,`resize-stop`,`compression-change`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=sn(!1),{minWidth:o,minHeight:s,maxWidth:l,top:u,left:d,width:f,height:p,isCompressed:m,isSidePanelExpanded:h,handleDragging:g,handleResizing:_,handleDragStop:v,handleResizeStop:y,toggleCompression:b,updatePosition:x,updateSize:S,updatePositionAndSize:C,expandForSidePanel:w,collapseSidePanel:T}=TQt({initWidth:r.defaultWidth,minWidth:r.minWidth,minHeight:r.minHeight,maxWidthPercent:r.maxWidthPercent,compressedHeight:r.compressedHeight,defaultHeight:r.defaultHeight,defaultTop:r.defaultY,defaultLeft:r.defaultX,compressedPadding:r.compressedPadding},{onDragStop:e=>i(`drag-stop`,e),onResizeStop:e=>i(`resize-stop`,e),onDragging:e=>i(`dragging`,e),onResizing:e=>i(`resizing`,e)}),E=pi(()=>({"--draggable-max-width":typeof r.maxWidth==`number`?`${r.maxWidth}px`:r.maxWidth??`${l.value}px`})),D=pi(()=>({x:d.value,y:u.value,width:f.value,height:p.value})),O=()=>{document.querySelectorAll(`iframe`).forEach(e=>{e.style.pointerEvents=`none`})},k=()=>{document.querySelectorAll(`iframe`).forEach(e=>{e.style.pointerEvents=``})},A=(e,t)=>{a.value||(a.value=!0,O()),g(e,t)},j=(e,t,n,r)=>{a.value||(a.value=!0,O()),_(e,t,n,r)},M=(e,t)=>{v(e,t),a.value=!1,k()},N=(e,t,n,r)=>{y(e,t,n,r),a.value=!1,k()};return Rn(m,e=>{i(`compression-change`,e)}),t({updatePosition:x,updateSize:S,updatePositionAndSize:C,toggleCompression:b,expandForSidePanel:w,collapseSidePanel:T,positionAndSize:D,isCompressed:m,isSidePanelExpanded:h}),(e,t)=>Nn((B(),Kr(z(SQt),{ref:`draggableRef`,active:r.visible,class:xe([`draggable-container-wrapper`,r.className]),"class-name":`draggable-container-inner`,"drag-handle":r.dragHandle,draggable:r.draggable,h:z(p),"max-width":z(l),"min-height":z(s),"min-width":z(o),parent:!0,"prevent-deactivation":!0,resizable:r.resizable,style:ge(E.value),w:z(f),x:z(d),y:z(u),onDragStop:M,onDragging:A,onResizeStop:N,onResizing:j},{default:Mn(()=>[H(`div`,EQt,[mr(e.$slots,`default`,{},void 0,!0)])]),_:3},8,[`active`,`class`,`drag-handle`,`draggable`,`h`,`max-width`,`min-height`,`min-width`,`resizable`,`style`,`w`,`x`,`y`])),[[Ti,r.visible]])}}),[[`__scopeId`,`data-v-1118456b`]]),OQt={class:`nimbus-bkai-wrapper`},kQt=[`width`,`height`,`src`],AQt=Ii($n({name:`NimbusButton`,__name:`nimbus`,props:{isPanelShow:{type:Boolean},isMinimize:{type:Boolean},size:{default:`normal`}},emits:[`click`,`minimize`,`update:isMinimize`],setup(e,{emit:t}){Kne(e=>({v05a8b16e:`${a.value.container}px`,v4e1cf4ca:`${a.value.wrapper}px`,v5ab0c513:`${a.value.mini.right}px`,v40c13a80:`${a.value.mini.size}px`,v0d35a9ef:`${a.value.mini.fontSize}px`}));let n=e,r=t,i={small:{container:40,wrapper:32,img:24,mini:{size:14,fontSize:10,right:-4}},normal:{container:48,wrapper:40,img:32,mini:{size:16,fontSize:12,right:-6}},large:{container:56,wrapper:48,img:40,mini:{size:18,fontSize:14,right:-6}}},a=pi(()=>i[n.size]),o=sn(null),s=sn(null),{nimbusLeft:l,nimbusTop:u,isMinimize:d,handleClick:f,handleMinimize:p,handleDragging:m,handleMouseEnter:h,handleMouseLeave:g,handleMouseDown:_,handleMouseUp:v}=iQt(r,n.isMinimize);Rn(d,e=>{r(`update:isMinimize`,e)});let y=pi(()=>d.value?tf(`恢复默认大小`):tf(`最小化,将缩成锚点`)),{createTooltip:b,destroyAll:x}=lQt({theme:`ai-blueking`,delay:[0,0]}),S=()=>{Dn(()=>{C()})},C=()=>{x(),o.value&&!d.value&&b(o.value,CSe(),{placement:`left`}),s.value&&b(s.value,y.value,{placement:`top`})};return Rn(()=>d.value,()=>{Dn(()=>{C()})}),sr(()=>{Dn(()=>{C()}),window.addEventListener(`resize`,S)}),cr(()=>{window.removeEventListener(`resize`,S)}),(t,n)=>(B(),Kr(z(SQt),{active:!e.isPanelShow,axis:`y`,draggable:!0,h:a.value.container,parent:!0,"prevent-deactivation":!0,resizable:!1,w:a.value.container,x:z(l),y:z(u),onDragging:z(m)},{default:Mn(()=>[H(`div`,{ref_key:`nimbusContainerRef`,ref:o,class:xe([`nimbus-container`,{"is-minimize":z(d)}]),onClick:n[1]||=(...e)=>z(f)&&z(f)(...e),onMousedown:n[2]||=(...e)=>z(_)&&z(_)(...e),onMouseenter:n[3]||=(...e)=>z(h)&&z(h)(...e),onMouseleave:n[4]||=(...e)=>z(g)&&z(g)(...e),onMouseup:n[5]||=(...e)=>z(v)&&z(v)(...e)},[H(`div`,OQt,[H(`img`,{width:a.value.img,height:a.value.img,src:z(dZt),alt:`nimbus`},null,8,kQt)]),H(`i`,{ref_key:`minimizeButtonRef`,ref:s,class:xe([`nimbus-mini bkai-icon`,z(d)?`bkai-yinyong`:`bkai-minus-line`]),onClick:n[0]||=Ni((...e)=>z(p)&&z(p)(...e),[`stop`])},null,2)],34)]),_:1},8,[`active`,`h`,`w`,`x`,`y`,`onDragging`]))}}),[[`__scopeId`,`data-v-26b6f3ea`]]),jQt=Ii($n({inheritAttrs:!1,__name:`ai-blueking`,props:fte({alwaysCreateNewSession:{type:Boolean},autoSwitchToInitialSession:{type:Boolean},defaultChatInputPosition:{},defaultHeight:{},defaultLeft:{},defaultMinimize:{type:Boolean},defaultTop:{},defaultWidth:{},disabledInput:{type:Boolean},draggable:{type:Boolean},dropdownMenuConfig:{},enableChatSession:{type:Boolean},enableModelSelect:{type:Boolean},models:{},enablePopup:{type:Boolean},errorToast:{type:Boolean},executionTabVisible:{type:Boolean},extCls:{},getSideRenderComponent:{type:Function},getSideTabRenderComponent:{type:Function},helloText:{},messageTools:{},updateTools:{},hideDefaultTrigger:{type:Boolean},hideHeader:{type:Boolean},hideNimbus:{type:Boolean},ignoreErrors:{},initialSessionCode:{},loadRecentSessionOnMount:{type:Boolean},maxWidth:{},miniPadding:{},nimbusSize:{},onCustomTabChange:{type:Function},placeholder:{},prompts:{},renderMode:{},requestOptions:{},resources:{},shortcutLimit:{},shortcuts:{},showCompressionIcon:{type:Boolean},showHistoryIcon:{type:Boolean},showMoreIcon:{type:Boolean},showNewChatIcon:{type:Boolean},teleportTo:{},title:{},url:{},useAgentName:{type:Boolean},beforeNimbusClick:{type:Function},shortcutFilter:{type:Function},resizeProps:{},size:{}},uQt),emits:[`show`,`close`,`dragging`,`resizing`,`drag-stop`,`resize-stop`,`send-message`,`receive-start`,`receive-text`,`receive-end`,`stop`,`shortcut-click`,`session-initialized`,`sdk-error`,`transfer-messages`,`share-messages`,`confirm-share`,`agent-action`,`new-chat`,`new-chat-created`,`history-click`,`auto-generate-name`,`help-click`,`rename`,`share`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=ute(),{chatHelper:o,componentManager:s,sessionBusinessManager:l,shareBusinessManager:u,shortcutManager:d,forwarders:f,forwardToManager:p,chatBotRef:m,draggableContainerRef:h,panelVisible:g,nimbusMinimized:_,normalizedUrl:v,agentName:y,currentSession:b,isCompressed:x,isWelcomeState:S,messageToolsTippyOptions:C,agentResources:w,agentPrompts:T,agentSkills:E,handleError:D,reportSdkError:O,ensureSessionReady:k,updateAgentInfo:A}=nQt({props:r,emit:i}),j=pi(()=>m.value?.selectedLlmCode),{show:M,hide:N,handleShow:P,handleClose:F,handleNimbusClick:I,handleDragging:L,handleResizing:R,handleDragStop:ee,handleResizeStop:te,handleToggleCompression:ne,handleCompressionChange:re,handleExecutionPanelChange:ie,sendMessage:ae,handleReceiveStart:oe,handleReceiveText:se,handleReceiveEnd:ce,handleStop:le,stopGeneration:ue,setCiteText:de,focusInput:fe,selectShortcut:pe,sendShortcut:me,getChatHelper:he,updatePosition:_e,updateSize:ve,updatePositionAndSize:ye,handleShortcutClick:be}=oQt({componentManager:s,chatBotRef:m,forwarders:f,forwardToManager:p,beforeNimbusClick:r.beforeNimbusClick,ensureSessionReady:k}),{sessionName:Ce,hasPermission:we,hasSessionContents:Te,autoGenerateLoading:Ee,handleNewChat:De,handleNewChatCreated:Oe,handleHistoryClick:ke,handleHistorySessionSwitch:Ae,handleHistorySessionDelete:je,handleHistorySessionRename:Me,handleAutoGenerateName:Ne,handleHelpClick:Pe,handleRename:Fe,handleSessionRenamed:Ie,handleSessionSwitched:Le,addNewSession:Re,switchToSession:ze,updateSessionName:Be}=sQt({chatHelper:o,sessionBusinessManager:l,chatBotRef:m,forwarders:f,reportSdkError:O,currentSession:b}),{isShareLoading:Ve,handleShare:He,handleCancelShare:Ue,handleConfirmShare:We}=cQt({shareBusinessManager:u,chatBotRef:m,emit:(e,t,n)=>i(e,t,n),forwarders:f,reportSdkError:O}),{aiSelectionVisible:Ge,filteredPopupShortcuts:Ke,handleSelectionChange:qe,handleAiSelectionShortcut:Je}=rQt({shortcutManager:d,chatBotRef:m,forwardToManager:p,show:M,props:r}),Ye=e=>{Te.value=!0,f.sendMessage(e)};return t({show:M,handleShow:P,handleClose:F,hide:N,sendMessage:ae,selectShortcut:pe,sendShortcut:me,getChatHelper:he,stopGeneration:ue,addNewSession:Re,switchToSession:ze,updateSessionName:Be,updatePosition:_e,updateSize:ve,updatePositionAndSize:ye,setCiteText:de,focusInput:fe,updateAgentInfo:A}),(e,t)=>(B(),Kr(Wn,{to:r.teleportTo},[H(`div`,{class:xe([`ai-blueking-v2`,r.extCls,z(a).class])},[ei(` 可拖拽容器 `),Xr(z(DQt),{ref_key:`draggableContainerRef`,ref:h,"compressed-padding":r.miniPadding,"default-height":r.defaultHeight,"default-width":r.defaultWidth,"default-x":r.defaultLeft,"default-y":r.defaultTop,"drag-handle":`.drag-handle`,draggable:r.draggable,"max-width":r.maxWidth,"max-width-percent":80,visible:z(g),onCompressionChange:z(re),onDragStop:z(ee),onDragging:z(L),onResizeStop:z(te),onResizing:z(R)},{default:Mn(()=>[H(`div`,{class:xe([`ai-blueking-panel`,{"has-messages":!z(S)}])},[ei(` 独立的 Header 组件 `),r.hideHeader?ei(`v-if`,!0):(B(),Kr(bZt,{key:0,"agent-name":z(y),"chat-helper":z(o),draggable:r.draggable,"dropdown-menu-config":r.dropdownMenuConfig,"enable-chat-session":r.enableChatSession,"has-permission":z(we),"has-session-contents":z(Te),"auto-generate-loading":z(Ee),"is-compression-height":z(x),"render-mode":r.renderMode,"session-business-manager":z(l),"selected-llm-code":j.value,"session-name":z(Ce),"show-compression-icon":r.showCompressionIcon,"show-history-icon":r.showHistoryIcon,"show-more-icon":r.showMoreIcon,"show-new-chat-icon":r.showNewChatIcon,title:r.title,onAutoGenerateName:z(Ne),onClose:z(F),onHelpClick:z(Pe),onHistoryClick:z(ke),onHistorySessionDelete:z(je),onHistorySessionRename:z(Me),onHistorySessionSwitch:z(Ae),onNewChat:z(De),onNewChatCreated:z(Oe),onRename:z(Fe),onShare:z(He),onToggleCompression:z(ne)},pr({_:2},[e.$slots.headerLeft?{name:`headerLeft`,fn:Mn(()=>[mr(e.$slots,`headerLeft`,{},void 0,!0)]),key:`0`}:void 0]),1032,`agent-name.chat-helper.draggable.dropdown-menu-config.enable-chat-session.has-permission.has-session-contents.auto-generate-loading.is-compression-height.render-mode.session-business-manager.selected-llm-code.session-name.show-compression-icon.show-history-icon.show-more-icon.show-new-chat-icon.title.onAutoGenerateName.onClose.onHelpClick.onHistoryClick.onHistorySessionDelete.onHistorySessionRename.onHistorySessionSwitch.onNewChat.onNewChatCreated.onRename.onShare.onToggleCompression`.split(`.`))),ei(` ChatBot 核心组件(仅聊天区域) `),Xr(JZt,{ref_key:`chatBotRef`,ref:m,"always-create-new-session":r.alwaysCreateNewSession,"auto-load":r.loadRecentSessionOnMount,"chat-helper":z(o),"enable-model-select":r.enableModelSelect,"error-toast":!1,"execution-tab-visible":r.executionTabVisible,"hello-text":r.helloText,"message-tools":r.messageTools,"message-tools-tippy-options":z(C),models:r.models,placeholder:r.placeholder,prompts:z(T),"render-mode":r.renderMode,"request-options":r.requestOptions,"use-agent-name":r.useAgentName,"get-side-render-component":r.getSideRenderComponent,"get-side-tab-render-component":r.getSideTabRenderComponent,"on-custom-tab-change":r.onCustomTabChange,"resize-props":r.resizeProps,size:r.size,resources:z(w),"session-code":r.initialSessionCode,"share-loading":z(Ve),shortcuts:r.shortcuts,skills:z(E),style:ge({height:r.hideHeader?`100%`:`calc(100% - 48px)`}),"update-tools":r.updateTools,url:z(v),onAgentAction:t[0]||=(e,t)=>i(`agent-action`,e,t),onCancelShare:z(Ue),onConfirmShare:t[1]||=(e,t)=>z(We)(e,t),onError:t[2]||=e=>z(D)(e),onExecutionPanelChange:z(ie),onReceiveEnd:z(ce),onReceiveStart:z(oe),onReceiveText:z(se),onRename:z(Ie),onRequestShare:z(He),onSendMessage:t[3]||=e=>Ye(e),onSessionSwitched:t[4]||=e=>z(Le)(e),onShortcutClick:z(be),onStop:z(le)},pr({_:2},[e.$slots.welcome?{name:`welcome`,fn:Mn(t=>[mr(e.$slots,`welcome`,Se(Zr(t)),void 0,!0)]),key:`0`}:void 0,e.$slots.codeHeader?{name:`codeHeader`,fn:Mn(t=>[mr(e.$slots,`codeHeader`,Se(Zr(t)),void 0,!0)]),key:`1`}:void 0,e.$slots.message?{name:`message`,fn:Mn(({message:t,messageToolsStatus:n,onInterruptResume:r})=>[mr(e.$slots,`message`,{message:t,messageToolsStatus:n,onInterruptResume:r},void 0,!0)]),key:`2`}:void 0]),1032,`always-create-new-session.auto-load.chat-helper.enable-model-select.execution-tab-visible.hello-text.message-tools.message-tools-tippy-options.models.placeholder.prompts.render-mode.request-options.use-agent-name.get-side-render-component.get-side-tab-render-component.on-custom-tab-change.resize-props.size.resources.session-code.share-loading.shortcuts.skills.style.update-tools.url.onCancelShare.onExecutionPanelChange.onReceiveEnd.onReceiveStart.onReceiveText.onRename.onRequestShare.onShortcutClick.onStop`.split(`.`))],2)]),_:3},8,[`compressed-padding`,`default-height`,`default-width`,`default-x`,`default-y`,`draggable`,`max-width`,`visible`,`onCompressionChange`,`onDragStop`,`onDragging`,`onResizeStop`,`onResizing`]),ei(` Nimbus 悬浮球 `),r.hideNimbus?ei(`v-if`,!0):(B(),Kr(AQt,{key:0,"is-minimize":z(_),"onUpdate:isMinimize":t[5]||=e=>on(_)?_.value=e:null,"is-panel-show":z(g),"onUpdate:isPanelShow":t[6]||=e=>on(g)?g.value=e:null,"default-minimize":r.defaultMinimize,size:r.nimbusSize,onClick:z(I)},null,8,[`is-minimize`,`is-panel-show`,`default-minimize`,`size`,`onClick`])),ei(` 划词选择弹窗(使用 chat-x 的 AiSelection 组件) `),r.enablePopup?(B(),Kr(z(VDe),{key:1,visible:z(Ge),"onUpdate:visible":t[7]||=e=>on(Ge)?Ge.value=e:null,"exclude-selectors":[`.draggable-container-wrapper`],"max-shortcut-count":r.shortcutLimit,shortcuts:z(Ke),onSelectShortcut:z(Je),onSelectionChange:z(qe)},null,8,[`visible`,`max-shortcut-count`,`shortcuts`,`onSelectShortcut`,`onSelectionChange`])):ei(`v-if`,!0)],2)],8,[`to`]))}}),[[`__scopeId`,`data-v-2d3264be`]]),MQt=[`close`,`show`,`stop`,`shortcut-click`,`send-message`,`receive-start`,`receive-end`,`receive-text`,`session-initialized`,`drag-stop`,`resize-stop`,`dragging`,`resizing`,`transfer-messages`,`share-messages`,`confirm-share`,`agent-action`,`sdk-error`,`new-chat`,`new-chat-created`,`history-click`,`auto-generate-name`,`help-click`,`rename`,`share`],NQt=[`show`,`handleShow`,`handleClose`,`hide`,`sendMessage`,`stopGeneration`,`addNewSession`,`switchToSession`,`updateSessionName`,`updatePosition`,`updateSize`,`updatePositionAndSize`,`setCiteText`,`focusInput`,`getChatHelper`,`selectShortcut`,`sendShortcut`],PQt=YZt(jQt,{name:`AIBluekingV2`,props:{extCls:{type:String,default:``},shortcuts:{type:Array,default:()=>[]},enablePopup:{type:Boolean,default:!0},url:{type:String,default:``},prompts:{type:Array,default:()=>[]},teleportTo:{type:String,default:`body`},title:{type:String,default:``},helloText:{type:String,default:()=>tf(`你好,我是小鲸`)},useAgentName:{type:Boolean,default:!1},requestOptions:{type:Object,default:()=>({})},defaultMinimize:{type:Boolean,default:!1},hideHeader:{type:Boolean,default:!1},hideNimbus:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},defaultWidth:{type:Number,default:400},defaultHeight:{type:Number,default:void 0},defaultLeft:{type:Number,default:void 0},defaultTop:{type:Number,default:0},disabledInput:{type:Boolean,default:!1},showCompressionIcon:{type:Boolean,default:!0},showMoreIcon:{type:Boolean,default:!0},showHistoryIcon:{type:Boolean,default:!0},showNewChatIcon:{type:Boolean,default:!0},defaultChatInputPosition:{type:String,default:void 0},maxWidth:{type:[Number,String],default:1e3},initialSessionCode:{type:String,default:``},autoSwitchToInitialSession:{type:Boolean,default:!1},alwaysCreateNewSession:{type:Boolean,default:!1},loadRecentSessionOnMount:{type:Boolean,default:!0},shortcutLimit:{type:Number,default:3},shortcutFilter:{type:Function,default:void 0},placeholder:{type:String,default:void 0},enableChatSession:{type:Boolean,default:!0},nimbusSize:{type:String,default:`normal`},miniPadding:{type:Number,default:0},dropdownMenuConfig:{type:Object,default:()=>({showRename:!0,showAutoGenerate:!0,showShare:!0})},resources:{type:Array,default:void 0},messageTools:{type:Array,default:void 0},updateTools:{type:Array,default:void 0},hideDefaultTrigger:{type:Boolean,default:!1},beforeNimbusClick:{type:Function,default:void 0},getSideRenderComponent:{type:Function,default:void 0},getSideTabRenderComponent:{type:Function,default:void 0},onCustomTabChange:{type:Function,default:void 0},executionTabVisible:{type:Boolean,default:void 0},resizeProps:{type:Object,default:void 0},size:{type:String,default:void 0}},emitNames:[...MQt],exposeKeys:[...NQt],slots:[`codeHeader`,`headerLeft`,`message`,`welcome`],deepWatchProps:[`requestOptions`,`shortcuts`,`beforeNimbusClick`],methods:{show(){return console.warn(`AIBluekingV2: show method not ready`),Promise.resolve()},handleShow(){return console.warn(`AIBluekingV2: handleShow method not ready`),Promise.resolve()},handleClose(){console.warn(`AIBluekingV2: handleClose method not ready`)},hide(){console.warn(`AIBluekingV2: hide method not ready`)},sendMessage(){return console.warn(`AIBluekingV2: sendMessage method not ready`),Promise.resolve()},stopGeneration(){console.warn(`AIBluekingV2: stopGeneration method not ready`)},addNewSession(){return console.warn(`AIBluekingV2: addNewSession method not ready`),Promise.resolve()},switchToSession(){return console.warn(`AIBluekingV2: switchToSession method not ready`),Promise.resolve()},updateSessionName(){return console.warn(`AIBluekingV2: updateSessionName method not ready`),Promise.resolve()},updatePosition(){console.warn(`AIBluekingV2: updatePosition method not ready`)},updateSize(){console.warn(`AIBluekingV2: updateSize method not ready`)},updatePositionAndSize(){console.warn(`AIBluekingV2: updatePositionAndSize method not ready`)},setCiteText(){console.warn(`AIBluekingV2: setCiteText method not ready`)},focusInput(){console.warn(`AIBluekingV2: focusInput method not ready`)},getChatHelper(){return console.warn(`AIBluekingV2: getChatHelper method not ready`),null},selectShortcut(){console.warn(`AIBluekingV2: selectShortcut method not ready`)},sendShortcut(){return console.warn(`AIBluekingV2: sendShortcut method not ready`),Promise.resolve()}}}),FQt=[`send-message`,`error`,`stop`,`receive-start`,`receive-end`,`receive-text`,`shortcut-click`,`session-switched`,`agent-info-loaded`,`request-share`,`confirm-share`,`cancel-share`,`execution-panel-change`,`feedback`,`agent-action`,`rename`],IQt=[`sendMessage`,`stopGeneration`,`focusInput`,`setCiteText`,`switchSession`,`selectShortcut`,`sendShortcut`,`enterShareMode`,`exitShareMode`,`getChatHelper`,`currentSession`,`isGenerating`,`messages`,`isReady`,`whenReady`];return e.ChatBotV2=YZt(JZt,{name:`ChatBotV2`,props:{chatHelper:{type:Object,default:void 0},url:{type:String,default:``},height:{type:[Number,String],default:void 0},maxWidth:{type:[Number,String],default:void 0},extCls:{type:String,default:``},helloText:{type:String,default:void 0},useAgentName:{type:Boolean,default:!1},placeholder:{type:String,default:void 0},shortcuts:{type:Array,default:()=>[]},prompts:{type:Array,default:()=>[]},resources:{type:Array,default:()=>[]},requestOptions:{type:Object,default:()=>({})},messageToolsTippyOptions:{type:Object,default:void 0},messageTools:{type:Array,default:void 0},updateTools:{type:Array,default:void 0},enableSelection:{type:Boolean,default:!1},shareLoading:{type:Boolean,default:!1},autoLoad:{type:Boolean,default:!0},alwaysCreateNewSession:{type:Boolean,default:!1},sessionCode:{type:String,default:void 0},resizeProps:{type:Object,default:void 0},size:{type:String,default:void 0},getSideRenderComponent:{type:Function,default:void 0},getSideTabRenderComponent:{type:Function,default:void 0},onCustomTabChange:{type:Function,default:void 0},executionTabVisible:{type:Boolean,default:void 0}},emitNames:[...FQt],exposeKeys:[...IQt],slots:[`codeHeader`,`message`,`welcome`],deepWatchProps:[`requestOptions`,`shortcuts`,`beforeNimbusClick`]}),e.default=PQt,e.h=U,e})({});
|