koishi-plugin-chat-patch 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/index.scss +36 -0
- package/client/index.ts +1 -0
- package/client/vue/chat-logic.ts +148 -3715
- package/client/vue/composables/useChatActions.ts +61 -0
- package/client/vue/composables/useChatData.ts +184 -0
- package/client/vue/composables/useImageCache.ts +140 -0
- package/client/vue/index.vue +399 -327
- package/client/vue/types.ts +71 -0
- package/dist/index.js +5 -27
- package/dist/style.css +1 -1
- package/lib/index.js +68 -36
- package/package.json +14 -5
- package/readme.md +1 -1
- package/src/api-handlers.ts +17 -10
- package/src/config.ts +2 -4
- package/src/index.ts +1 -1
- package/src/message-handler.ts +5 -4
- package/src/utils.ts +48 -4
- package/client/vue/style.css +0 -1997
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// 定义通用的聊天相关类型
|
|
2
|
+
|
|
3
|
+
export interface BotInfo {
|
|
4
|
+
selfId: string
|
|
5
|
+
platform: string
|
|
6
|
+
username: string
|
|
7
|
+
avatar?: string
|
|
8
|
+
status: 'online' | 'offline'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ChannelInfo {
|
|
12
|
+
id: string
|
|
13
|
+
name: string
|
|
14
|
+
type: number | string
|
|
15
|
+
channelId?: string
|
|
16
|
+
guildName?: string
|
|
17
|
+
isDirect?: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface MessageElement {
|
|
21
|
+
type: string
|
|
22
|
+
attrs: Record<string, any>
|
|
23
|
+
children: MessageElement[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface QuoteInfo {
|
|
27
|
+
messageId: string
|
|
28
|
+
id: string
|
|
29
|
+
content: string
|
|
30
|
+
elements?: MessageElement[]
|
|
31
|
+
user: {
|
|
32
|
+
id: string
|
|
33
|
+
name: string
|
|
34
|
+
userId: string
|
|
35
|
+
avatar?: string
|
|
36
|
+
username: string
|
|
37
|
+
}
|
|
38
|
+
timestamp: number
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface MessageInfo {
|
|
42
|
+
id: string
|
|
43
|
+
content: string
|
|
44
|
+
userId: string
|
|
45
|
+
username: string
|
|
46
|
+
avatar?: string
|
|
47
|
+
timestamp: number
|
|
48
|
+
channelId: string
|
|
49
|
+
selfId: string
|
|
50
|
+
elements?: MessageElement[]
|
|
51
|
+
isBot?: boolean
|
|
52
|
+
quote?: QuoteInfo
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ChatData {
|
|
56
|
+
bots: Record<string, BotInfo>
|
|
57
|
+
channels: Record<string, Record<string, ChannelInfo>>
|
|
58
|
+
messages: Record<string, MessageInfo[]>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface PluginConfig {
|
|
62
|
+
maxMessagesPerChannel: number
|
|
63
|
+
keepMessagesOnClear: number
|
|
64
|
+
loggerinfo: boolean
|
|
65
|
+
blockedPlatforms: Array<{
|
|
66
|
+
platformName: string
|
|
67
|
+
exactMatch: boolean
|
|
68
|
+
}>
|
|
69
|
+
chatContainerHeight: number
|
|
70
|
+
clearIndexedDBOnStart: boolean
|
|
71
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,5 @@
|
|
|
1
|
-
import{defineComponent as De,ref as g,onMounted as wt,h as m,computed as re,watch as Ft,nextTick as le,onUnmounted as Pn,createElementBlock as C,openBlock as w,unref as r,normalizeStyle as It,normalizeClass as ve,createCommentVNode as $,createElementVNode as f,Fragment as ee,renderList as Re,createBlock as Ye,toDisplayString as L,withDirectives as Ht,createTextVNode as xt,vShow as jn,withModifiers as Xt,withKeys as An,isRef as On,vModelText as zn,resolveComponent as Nn}from"vue";import{receive as Ct,send as F,icons as Fn}from"@koishijs/client";function Hn(){function ce(e){try{return new URL(e).protocol==="file:"}catch{return false}}const ge=De({props:{src:{type:String,required:true},alt:{type:String,default:"头像"},channelKey:{type:String,required:true}},setup(e){const t=g("loading"),n=g(e.src),a=g(""),o=async()=>{try{t.value="loading";const c=await vt(e.channelKey,e.src);if(c){n.value=c,t.value="loaded";return}const l=new Image;l.crossOrigin="anonymous",l.referrerPolicy="no-referrer",l.draggable=false;const u=new Promise((p,I)=>{l.onload=()=>p(),l.onerror=()=>I(new Error("Direct load failed")),l.src=e.src}),v=new Promise((p,I)=>{setTimeout(()=>I(new Error("Timeout")),3e3)});try{await Promise.race([u,v]),n.value=e.src,t.value="loaded",$e(e.channelKey,e.src).catch(p=>{console.warn("异步缓存头像失败:",p)})}catch{await s()}}catch(c){console.error("头像加载失败:",c),t.value="error",a.value="头像加载失败"}},s=async()=>{try{t.value="caching";const c=await $e(e.channelKey,e.src);if(c)n.value=c,t.value="loaded";else throw new Error("缓存系统加载失败")}catch(c){console.error("缓存系统加载头像失败:",c),t.value="error",a.value=(c==null?void 0:c.message)||"缓存加载失败"}};return wt(()=>{o()}),()=>{switch(t.value){case"loading":case"caching":return m("div",{class:"avatar-placeholder"},e.alt.charAt(0).toUpperCase());case"loaded":return m("img",{src:n.value,alt:e.alt,draggable:false,style:{width:"100%",height:"100%","object-fit":"cover"}});case"error":return m("div",{class:"avatar-placeholder"},e.alt.charAt(0).toUpperCase());default:return m("div",{class:"avatar-placeholder"},e.alt.charAt(0).toUpperCase())}}}}),Y=De({props:{src:{type:String,required:true},alt:{type:String,default:"图片"},filename:{type:String,default:""},channelKey:{type:String,required:true}},setup(e){const t=g("loading"),n=g(e.src),a=g(""),o=g(null),s=async()=>{try{t.value="loading";const l=await vt(e.channelKey,e.src);if(l){n.value=l,t.value="loaded";return}if(ce(e.src)){console.log("ImageComponent: 检测到本地文件,使用代理请求:",e.src),await c();return}const u=new Image;u.crossOrigin="anonymous",u.referrerPolicy="no-referrer",u.draggable=false;const v=new Promise((I,R)=>{u.onload=()=>I(),u.onerror=()=>R(new Error("Direct load failed")),u.src=e.src}),p=new Promise((I,R)=>{setTimeout(()=>R(new Error("Timeout")),3e3)});try{await Promise.race([v,p]),n.value=e.src,t.value="loaded",$e(e.channelKey,e.src).catch(I=>{console.warn("异步缓存图片失败:",I)})}catch{await c()}}catch(l){console.error("图片加载失败:",l),t.value="error",a.value="图片加载失败"}},c=async()=>{try{t.value="caching";const l=await $e(e.channelKey,e.src);if(l)n.value=l,t.value="loaded";else throw new Error("缓存系统加载失败")}catch(l){console.error("缓存系统加载图片失败:",l),t.value="error",a.value=(l==null?void 0:l.message)||"缓存加载失败"}};return wt(()=>{s()}),()=>{switch(t.value){case"loading":return m("div",{class:"message-image-loading"},"加载中...");case"caching":return m("div",{class:"message-image-loading"},"[图片加载缓存中...]");case"loaded":return m("img",{src:n.value,alt:e.alt,class:"message-image",loading:"lazy",ref:o,draggable:false,style:{"max-width":"min(400px, 66.67vw)","max-height":"200px",width:"auto",height:"auto","object-fit":"contain"},onLoad:()=>{o.value&&e.src.toLowerCase().includes(".gif")&&(o.value.style.imageRendering="auto")}});case"error":return m("div",{class:"message-image-error"},["图片加载失败",m("br"),m("small",e.filename||e.alt||"未知图片"),m("br"),m("small",{style:"color: #ff9800;"},a.value)]);default:return m("div",{class:"message-image-error"},"未知状态")}}}}),xe=De({props:{data:{type:String,required:true},channelKey:{type:String,required:true}},setup(e){const n=(()=>{try{const o=JSON.parse(e.data);if(o.meta&&o.meta.detail_1){const s=o.meta.detail_1;return{type:"share_card",title:s.title||o.prompt||"分享内容",desc:s.desc||"",preview:s.preview?s.preview.replace(/\\\//g,"/"):"",icon:s.icon?s.icon.replace(/\\\//g,"/"):"",url:s.qqdocurl?s.qqdocurl.replace(/\\\//g,"/"):s.url?s.url.replace(/\\\//g,"/"):"",appName:s.title||"应用"}}return{type:"raw",data:o}}catch(o){return console.error("解析JSON数据失败:",o),{type:"error",error:"无法解析的JSON数据"}}})(),a=()=>{n.type==="share_card"&&n.url&&window.open(n.url,"_blank","noopener,noreferrer")};return()=>n.type==="share_card"&&n.preview?m("img",{src:n.preview,alt:n.title||"[分享小程序]",class:"message-image",loading:"lazy",draggable:false,onClick:a,style:{"max-width":"400px","max-height":"200px",width:"auto",height:"auto","object-fit":"contain",cursor:n.url?"pointer":"default"},title:n.url?`点击打开: ${n.title||"链接"}`:n.title,onError:o=>{const c=o.target.parentElement;c&&(c.style.display="none")}}):n.type==="error"?m("div",{class:"message-json-error"},[m("span",{class:"json-error-text"},n.error),m("details",{class:"json-raw-data"},[m("summary","查看原始数据"),m("pre",{class:"json-raw-content"},e.data)])]):m("div",{class:"message-json-raw"},[m("div",{class:"json-label"},"[JSON数据]"),m("details",{class:"json-raw-data"},[m("summary","查看详情"),m("pre",{class:"json-raw-content"},JSON.stringify(n.data,null,2))])])}}),te=De({props:{element:{type:Object,required:true},channelKey:{type:String,required:true}},setup(e){const t=g(false),n=()=>{t.value=!t.value},a=()=>{if(!e.element.children||e.element.children.length===0)return{previews:[],messageCount:0};const s=e.element.children.filter(u=>u.type==="message"),c=s.length;return{previews:s.slice(0,3).map(u=>{var I,R;const v=((I=u.attrs)==null?void 0:I.nickname)||"用户";let p="";if(u.children&&u.children.length>0){const Q=u.children[0];Q.type==="text"?(p=(((R=Q.attrs)==null?void 0:R.content)||"").substring(0,20),p.length>15&&(p+="...")):Q.type==="img"?p="[图片]":Q.type==="video"?p="[视频]":p=`[${Q.type}]`}return`${v}:${p}`}),messageCount:c}},o=(s,c)=>{var v,p,I;const l=((v=s.attrs)==null?void 0:v.nickname)||"用户",u=((p=s.attrs)==null?void 0:p.userId)||"unknown";return m("div",{key:c,class:"forwarded-message-item"},[m("div",{class:"forwarded-message-header"},[m("span",{class:"forwarded-message-nickname"},l),m("span",{class:"forwarded-message-userid"},`(${u})`)]),m("div",{class:"forwarded-message-content"},((I=s.children)==null?void 0:I.map((R,Q)=>m(Me,{key:Q,element:R,channelKey:e.channelKey})))||[])])};return()=>{var l;const{previews:s,messageCount:c}=a();return m("div",{class:"forward-message-container"},[m("div",{class:"forward-message-preview",onClick:n},[m("div",{class:"forward-message-title"},"聊天记录"),...s.map((u,v)=>m("div",{key:v,class:"forward-message-preview-item"},u)),m("div",{class:"forward-message-footer"},[m("span",{class:"forward-message-count"},`查看${c}条转发消息`),m("span",{class:"forward-message-toggle"},t.value?"▲":"▼")])]),t.value&&m("div",{class:"forward-message-expanded"},((l=e.element.children)==null?void 0:l.filter(u=>u.type==="message").map((u,v)=>o(u,v)))||[])])}}}),Me=De({props:{element:{type:Object,required:true},channelKey:{type:String,required:true}},setup(e){const t=n=>{var a,o,s,c,l,u;switch(n.type){case"text":return m("span",{class:"message-text-content"},n.attrs.content||"");case"forward":return m("span",{class:"message-text-content"},`[转发消息 ${n.attrs.id}]`||"[转发消息]");case"img":case"image":const v=n.attrs.src||n.attrs.url||n.attrs.file;return m("div",{class:"message-image-container"},[m(Y,{src:v,alt:n.attrs.summary||"图片",filename:n.attrs.filename||n.attrs.summary||"",channelKey:e.channelKey})]);case"mface":const p=n.attrs.src||n.attrs.url||n.attrs.file;return m("div",{class:"message-image-container"},[m(Y,{src:p,alt:n.attrs.summary||"表情",filename:n.attrs.emojiId||n.attrs.summary||"",channelKey:e.channelKey})]);case"face":if((o=(a=n.children[0])==null?void 0:a.attrs)!=null&&o.src){const I=((c=(s=n.children[0])==null?void 0:s.attrs)==null?void 0:c.src)||((u=(l=n.children[0])==null?void 0:l.attrs)==null?void 0:u.url);return m("div",{class:"message-image-container"},[m(Y,{src:I,alt:n.attrs.name||n.attrs.id||"[表情]",filename:n.attrs.name||n.attrs.id||"[表情]",channelKey:e.channelKey})])}else return m("span",{class:"message-text-content"},`[${n.attrs.name||n.attrs.id}]`||"[表情]");case"at":return m("span",{class:"message-at",title:n.attrs.name},`@${(n.attrs.name||n.attrs.id).replace("@","")}`);case"json":return m("div",{class:"message-image-container"},[m(xe,{data:n.attrs.data||"",channelKey:e.channelKey})]);case"p":if(n.children&&n.children.length>0){const I=n.children.map((R,Q)=>m(Me,{key:Q,element:R,channelKey:e.channelKey}));return m("div",{class:"message-paragraph"},I)}else return m("div",{class:"message-paragraph"},"");case"figure":return m(te,{element:n,channelKey:e.channelKey});default:return m("span",{class:"message-unknown",title:`未知消息类型: ${n.type}`},n.attrs.content||`[${n.type}]`)}};return()=>t(e.element)}}),d=g({bots:{},channels:{},messages:{}}),z=g({}),P=g({}),ie=g({maxMessagesPerChannel:1e3,keepMessagesOnClear:50,loggerinfo:false,blockedPlatforms:[],chatContainerHeight:80,clearIndexedDBOnStart:true}),k=g({}),V=new Map,Pe=100*1024*1024,Ce=50;let be=0,x=null;const Ve="ChatImageCache",je=2,_="images",B=50*1024*1024,Je=100,ye=500,Ae=12*1024*1024,q=.8,tt=60*1e3;let j=0,J=0,Ge=0;const y=g(""),b=g(""),ue=g(""),G=g([]),pe=g(false),Oe=g(),A=g(false),Z=g("bots"),X=g(null),de=g(null),_e=g(false),E=g({show:false,text:""}),T=g(),ne=g(),Le=g(false),fe=g(false),ke=g(false),Se=g(false),he=g(""),N=g({x:0,y:0}),O=g({x:0,y:0}),Te=g({x:0,y:0}),qe=g({x:0,y:0}),W=80,Ue=g(0),H=g(null),ae=g(false),S=g(null),U=g({show:false,x:0,y:0,type:"bot",targetId:"",isSecondClick:false,message:void 0}),se=g(new Set),oe=g(new Set),nt=re(()=>Object.values(d.value.bots).sort((t,n)=>{const a=se.value.has(t.selfId),o=se.value.has(n.selfId);return a&&!o?-1:!a&&o?1:0})),at=re(()=>!y.value||!d.value.channels[y.value]?[]:Object.values(d.value.channels[y.value]).sort((t,n)=>{const a=oe.value.has(`${y.value}:${t.id}`),o=oe.value.has(`${y.value}:${n.id}`);return a&&!o?-1:!a&&o?1:0})),we=re(()=>{if(!y.value||!b.value)return[];const e=`${y.value}:${b.value}`,t=d.value.messages[e]||[];return t.filter(n=>n.quote),t}),st=re(()=>{var t;if(!y.value||!b.value)return"";const e=d.value.channels[y.value];return((t=e==null?void 0:e[b.value])==null?void 0:t.name)||""}),ot=re(()=>!y.value||!b.value?"":`${y.value}:${b.value}`),Ke=re(()=>y.value&&b.value&&(ue.value.trim()||G.value.length>0)&&!ke.value),rt=re(()=>y.value&&b.value&&!ke.value),bt=re(()=>{if(!A.value)return"";switch(Z.value){case"channels":return"show-channels";case"messages":return"show-messages";default:return""}}),h=re(()=>A.value?"输入消息...(屏幕左滑返回)":"输入消息..."),i=re(()=>({}));function M(e){return e.size||0}function me(e){be+=e,ie.value.loggerinfo&&console.log(`内存使用量变化: ${e>0?"+":""}${(e/1024/1024).toFixed(2)}MB, 总计: ${(be/1024/1024).toFixed(2)}MB`)}function kt(e=10){const t=Object.entries(k.value);if(t.length<=e)return;const n=t.slice(0,t.length-e);let a=0;n.forEach(([o,s])=>{URL.revokeObjectURL(s),delete k.value[o],a+=500*1024,ie.value.loggerinfo&&console.log("清理旧blob URL:",o)}),me(-a)}function Ze(){Object.keys(k.value).length>Ce&&kt(Math.floor(Ce*.7)),be>Pe&&kt(Math.floor(Ce*.5))}function Qt(e){y.value=e,b.value="",gt(),A.value&&(Z.value="channels")}function Yt(e,t){const n=/^<quote\s+id="([^"]+)"\s*\/>(.*)/,a=e.match(n);if(a){const o=a[1],s=a[2];return{quotedMessage:t.find(l=>l.id===o)||null,restContent:s}}return{quotedMessage:null,restContent:e}}function lt(e,t){return Yt(e,t)}function ze(e,t){return!e||!e.content?null:lt(e.content,t).quotedMessage}function Vt(e,t){if(e.quote&&e.quote.user)return{avatar:e.quote.user.avatar||"",username:e.quote.user.username||""};const n=ze(e,t);return n?{avatar:n.avatar||"",username:n.username||""}:{avatar:"",username:""}}function Jt(e,t){if(e.quote&&e.quote.timestamp)return e.quote.timestamp;const n=ze(e,t);return n?n.timestamp:Date.now()}function Gt(e,t){if(e.quote&&e.quote.content)return e.quote.content;const n=ze(e,t);return n?n.content:""}function Zt(e,t){if(e.quote&&e.quote.elements)return e.quote.elements;const n=ze(e,t);return n?n.elements||[]:[]}function Et(e,t){return!e||!e.content?"":lt(e.content,t).restContent||e.content}function en(e,t){if(e.preventDefault(),e.stopPropagation(),U.value.show&&U.value.type==="bot"&&U.value.targetId===t){K();return}ct(e,"bot",t)}function tn(e,t){if(e.preventDefault(),e.stopPropagation(),U.value.show&&U.value.type==="channel"&&U.value.targetId===t){K();return}ct(e,"channel",t)}function nn(e,t){var a;if(e.preventDefault(),e.stopPropagation(),U.value.show&&U.value.type==="message"&&((a=U.value.message)==null?void 0:a.id)===t.id){K();return}an(e,t)}function ct(e,t,n){let s=e.clientX,c=e.clientY;s+180>window.innerWidth&&(s=window.innerWidth-180-10),c+80>window.innerHeight&&(c=window.innerHeight-80-10),U.value={show:true,x:s,y:c,type:t,targetId:n,isSecondClick:false},document.addEventListener("click",K,{once:true}),document.addEventListener("keydown",Ee)}function an(e,t){let o=e.clientX,s=e.clientY;o+180>window.innerWidth&&(o=window.innerWidth-180-10),s+120>window.innerHeight&&(s=window.innerHeight-120-10),U.value={show:true,x:o,y:s,type:"message",targetId:t.id,isSecondClick:false,message:t},document.addEventListener("click",K,{once:true}),document.addEventListener("keydown",Ee)}function K(){U.value.show=false,document.removeEventListener("click",K),document.removeEventListener("keydown",Ee)}function Ee(e){e.key==="Escape"&&U.value.show&&K()}async function sn(e){se.value.has(e)?se.value.delete(e):se.value.add(e),await F("set-pinned-bots",{pinnedBots:Array.from(se.value)}),K()}async function on(e){const t=`${y.value}:${e}`;oe.value.has(t)?oe.value.delete(t):oe.value.add(t),await F("set-pinned-channels",{pinnedChannels:Array.from(oe.value)}),K()}async function rn(e){try{const t=await F("delete-bot-data",{selfId:e});if(t.success){const n=Object.keys(d.value.messages).filter(a=>a.startsWith(`${e}:`));for(const a of n)delete d.value.messages[a],delete z.value[a],await Qe(a);delete d.value.bots[e],delete d.value.channels[e],y.value===e&&(y.value="",b.value=""),D(t.message||"已删除该机器人的所有数据","success")}else throw new Error(t.error||"删除失败")}catch(t){console.error("删除机器人数据失败:",t),D("删除失败: "+((t==null?void 0:t.message)||String(t)),"error")}K()}async function ln(e){try{const t=await F("delete-channel-data",{selfId:y.value,channelId:e});if(t.success){const n=`${y.value}:${e}`;delete d.value.messages[n],delete z.value[n],d.value.channels[y.value]&&delete d.value.channels[y.value][e],await Qe(n),b.value===e&&(b.value=""),D(t.message||"已删除该频道的所有数据","success")}else throw new Error(t.error||"删除失败")}catch(t){console.error("删除频道数据失败:",t),D("删除失败: "+((t==null?void 0:t.message)||String(t)),"error")}K()}async function St(e){b.value=e,fe.value=false,gt(),A.value&&(Z.value="messages");const t=`${y.value}:${e}`;delete P.value[t],y.value&&await yt(y.value,e,50,0),le(()=>{Ie(),!A.value&&ne.value&&ne.value.focus()})}async function $t(){if(!Ke.value)return;const e=ue.value.trim();if(!e&&G.value.length===0)return;const t=b.value;ke.value=true;const n=[...G.value];try{const a=await F("send-message",{selfId:y.value,channelId:b.value,content:e,images:n.map(o=>({tempId:o.tempId,filename:o.filename}))});if(a.success){if(ue.value="",n.forEach(o=>{URL.revokeObjectURL(o.preview)}),G.value=[],pe.value=false,t&&(b.value="",await le(),St(t)),a.tempImageIds&&a.tempImageIds.length>0)try{await F("cleanup-temp-images",{tempImageIds:a.tempImageIds}),console.log("临时图片清理完成:",a.tempImageIds)}catch(o){console.warn("清理临时图片失败:",o)}}else console.error("消息发送失败:",a.error),D("发送失败: "+a.error,"error")}catch(a){console.error("发送消息时出错:",a),D("发送失败: "+((a==null?void 0:a.message)||String(a)),"error")}finally{ke.value=false}}function cn(){pe.value=!pe.value}function un(){Oe.value&&Oe.value.click(),pe.value=false}async function dn(e){const t=e.target,n=t.files;if(!(!n||n.length===0)){for(const a of Array.from(n))await it(a);t.value=""}}async function fn(e){var n;const t=(n=e.clipboardData)==null?void 0:n.items;if(t){for(const a of Array.from(t))if(a.type.startsWith("image/")){e.preventDefault();const o=a.getAsFile();if(o){const s=a.type==="image/gif"?".gif":a.type==="image/png"?".png":(a.type==="image/jpeg",".jpg"),c=`pasted-image-${Date.now()}${s}`,l=new File([o],c,{type:a.type,lastModified:Date.now()});await it(l)}}}}async function it(e){try{if(e.size>10*1024*1024){D("图片文件过大,请选择小于10MB的图片","error");return}if(!e.type.startsWith("image/")){D("请选择图片文件","error");return}const t=await Bt(e),n=URL.createObjectURL(e),a=await F("upload-image",{file:t,filename:e.name,mimeType:e.type,isGif:e.type==="image/gif"});a.success?G.value.push({tempId:a.tempId,filename:e.name,preview:n,size:e.size}):(URL.revokeObjectURL(n),D("图片上传失败: "+a.error,"error"))}catch(t){console.error("上传图片失败:",t),D("图片上传失败: "+((t==null?void 0:t.message)||String(t)),"error")}}async function hn(e){try{const t=G.value.findIndex(n=>n.tempId===e);if(t!==-1){const n=G.value[t];URL.revokeObjectURL(n.preview),G.value.splice(t,1)}await F("delete-temp-image",{tempId:e})}catch(t){console.error("删除图片失败:",t)}}function Bt(e){return new Promise((t,n)=>{const a=new FileReader;a.onload=()=>t(a.result),a.onerror=n,a.readAsDataURL(e)})}function ut(e){const t=e.target;t.closest(".input-actions")||(pe.value=false),t.closest(".context-menu")||K()}function mn(e){return new Date(e).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})}async function vn(e){var t,n;if(e){K();try{let a="";const o=e.elements||[];if(o.length>0)for(const s of o)switch(s.type){case"img":case"image":const c=s.attrs.src||s.attrs.url||s.attrs.file;c&&(a+=`<img src="${c}"/>`);break;case"mface":const l=s.attrs.src||s.attrs.url||s.attrs.file;l&&(a+=`<img src="${l}"/>`);break;case"face":if(s.children&&((n=(t=s.children[0])==null?void 0:t.attrs)!=null&&n.src)){const u=s.children[0].attrs.src;a+=`<img src="${u}"/>`}else a+=`[${s.attrs.name||s.attrs.id}]`;break;case"at":a+=`<at id="${s.attrs.id}" name="${s.attrs.name}"/>`;break;case"text":a+=s.attrs.content||"";break;default:a+=e.content;break}else a=e.content;ue.value=a,await $t()}catch(a){console.error("+1操作失败:",a),D("操作失败: "+((a==null?void 0:a.message)||String(a)),"error")}}}async function gn(e){var t,n;if(e){K();try{let a="";const o=e.elements||[];if(o.length>0)for(const s of o)switch(s.type){case"img":case"image":const c=s.attrs.src||s.attrs.url||s.attrs.file;c&&(a+=`<img src="${c}"/>`);break;case"mface":const l=s.attrs.src||s.attrs.url||s.attrs.file;l&&(a+=`<img src="${l}"/>`);break;case"face":if(s.children&&((n=(t=s.children[0])==null?void 0:t.attrs)!=null&&n.src)){const u=s.children[0].attrs.src;a+=`<img src="${u}"/>`}else a+=`[${s.attrs.name||s.attrs.id}]`;break;case"at":a+=`<at id="${s.attrs.id}" name="${s.attrs.name}"/>`;break;case"text":a+=s.attrs.content||"";break;default:a+=e.content;break}else a=e.content;await navigator.clipboard.writeText(a),D("已复制到剪贴板","success")}catch(a){console.error("复制失败:",a),D("复制失败: "+((a==null?void 0:a.message)||String(a)),"error")}}}function yn(e){if(e){K();try{const t=`<quote id="${e.id.replace("bot-msg-","")}"/>`;ue.value=t+ue.value,le(()=>{ne.value&&ne.value.focus()})}catch(t){console.error("回复操作失败:",t),D("操作失败: "+((t==null?void 0:t.message)||String(t)),"error")}}}function pn(e){if(typeof e=="number")switch(e){case 0:return"文本";case 1:return"私聊";default:return"未知"}return String(e)}function Ie(){T.value&&(T.value.scrollTop=T.value.scrollHeight,Le.value=false,fe.value=false)}function Ne(){if(T.value){const{scrollTop:e,scrollHeight:t,clientHeight:n}=T.value,o=t-(e+n)<=50,s=!o;Le.value=s,o?fe.value=false:fe.value=true,e<=10&&y.value&&b.value&&Dt()}}async function Dt(){if(!y.value||!b.value)return;const e=`${y.value}:${b.value}`,t=P.value[e];if(!(Se.value||t&&!t.hasMore)){P.value[e]||(P.value[e]={offset:0,hasMore:true,loading:false}),Se.value=true,P.value[e].loading=true;try{const n=(t==null?void 0:t.offset)||0;await yt(y.value,b.value,50,n)||(P.value[e].loading=false)}catch(n){console.error("加载更多消息失败:",n),P.value[e]&&(P.value[e].loading=false)}finally{Se.value=false}}}function Fe(){if(!T.value)return true;const{scrollTop:e,scrollHeight:t,clientHeight:n}=T.value;return t-(e+n)<=200}function Mt(e){var a;if(!y.value)return 0;const t=`${y.value}:${e}`,n=z.value[t];return n!==void 0?n:((a=d.value.messages[t])==null?void 0:a.length)||0}function wn(e,t){e.preventDefault(),e.stopPropagation();const n="touches"in e?e.touches[0].clientX:e.clientX,a="touches"in e?e.touches[0].clientY:e.clientY;Ue.value=Date.now(),N.value={x:n,y:a},O.value={x:n,y:a},ae.value=false;const s=e.target.getBoundingClientRect();Te.value={x:s.left,y:s.top},qe.value={x:n-s.left,y:a-s.top},H.value=window.setTimeout(()=>{if(Ue.value>0){ae.value=true,he.value=t;const c=e.target,l=c.cloneNode(true);l.classList.add("dragging-clone"),l.style.position="fixed",l.style.zIndex="1000",l.style.pointerEvents="none";const u=c.getBoundingClientRect();l.style.left=`${u.left}px`,l.style.top=`${u.top}px`,l.style.width=`${u.width}px`,l.style.height=`${u.height}px`,document.body.appendChild(l),S.value=l,document.body.style.userSelect="none",document.body.style.cursor="grabbing",document.body.classList.add("dragging-bubble-global"),Lt(N.value.x,N.value.y)}},60),document.addEventListener("mousemove",He),document.addEventListener("mouseup",Xe),document.addEventListener("touchmove",He),document.addEventListener("touchend",Xe)}function He(e){if(!ae.value||!S.value)return;e.preventDefault();const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;O.value={x:t,y:n};const a=O.value.x-N.value.x,o=O.value.y-N.value.y,s=Math.sqrt(a*a+o*o),c=Math.max(.3,1-s/(W*2)),l=Math.max(.8,1-s/(W*3)),u=s>W,v=O.value.x-qe.value.x,p=O.value.y-qe.value.y;S.value.style.left=`${v}px`,S.value.style.top=`${p}px`,S.value.style.transform=`scale(${l})`,S.value.style.opacity=`${c}`,S.value.style.backgroundColor=u?"#f44336":"#2196f3",S.value.style.boxShadow=u?"0 4px 12px rgba(244, 67, 54, 0.4)":"0 4px 12px rgba(33, 150, 243, 0.4)",u?S.value.classList.add("will-delete"):S.value.classList.remove("will-delete")}function Xe(e){if(H.value&&(clearTimeout(H.value),H.value=null),H.value&&(clearTimeout(H.value),H.value=null),!ae.value||!he.value){We();return}const t=he.value;if(Math.sqrt(Math.pow(O.value.x-N.value.x,2)+Math.pow(O.value.y-N.value.y,2))>W)_t(t),We();else if(S.value){S.value.style.transition="all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55)";const a=document.querySelector(`[data-channel-id="${t}"] .channel-message-count`);if(a){const o=a.getBoundingClientRect();S.value.style.left=`${o.left}px`,S.value.style.top=`${o.top}px`,S.value.style.transform="scale(1)",S.value.style.opacity="1",S.value.style.backgroundColor="#2196f3",S.value.style.boxShadow="0 4px 12px rgba(33, 150, 243, 0.4)"}setTimeout(()=>{We()},300)}else We()}function We(){H.value&&(clearTimeout(H.value),H.value=null),he.value="",N.value={x:0,y:0},O.value={x:0,y:0},Te.value={x:0,y:0},Ue.value=0,ae.value=false,document.removeEventListener("mousemove",He),document.removeEventListener("mouseup",Xe),document.removeEventListener("touchmove",He),document.removeEventListener("touchend",Xe),document.body.style.userSelect="",document.body.style.cursor="",document.body.classList.remove("dragging-bubble-global"),S.value&&S.value.parentNode&&(S.value.parentNode.removeChild(S.value),S.value=null),Tt()}function In(e){return he.value===e&&ae.value?{visibility:"hidden",pointerEvents:"none",transition:"none"}:{}}function xn(e){if(he.value!==e)return 0;const t=O.value.x-N.value.x,n=O.value.y-N.value.y;return Math.sqrt(t*t+n*n)}async function _t(e){if(y.value)try{const t=`${y.value}:${e}`,n=Mt(e),a=ie.value.keepMessagesOnClear;if(a>0&&n<=a){D("当前消息还很少诶~ 无需清理","success");return}const o=await F("clear-channel-history",{selfId:y.value,channelId:e});if(o.success)if(o.clearedCount&&o.clearedCount>0){if(d.value.messages[t]){const c=[...d.value.messages[t]].sort((l,u)=>l.timestamp-u.timestamp);d.value.messages[t]=c.slice(-o.keptCount)}z.value[t]=o.keptCount,await Qe(t),D(`历史记录已清理,清理了 ${o.clearedCount} 条消息,保留最新 ${o.keptCount} 条`,"success")}else a===0?(d.value.messages[t]&&(d.value.messages[t]=[]),z.value[t]=0,await Qe(t),D("历史记录已清理,所有消息已删除","success")):D("当前消息还很少诶~ 无需清理","success");else console.error("清理历史记录失败:",o.error),D("清理失败: "+o.error,"error")}catch(t){console.error("清理历史记录时出错:",t),D("清理失败: "+((t==null?void 0:t.message)||String(t)),"error")}}function D(e,t="success"){const n=document.createElement("div");n.className=`notification ${t}`,n.textContent=e;let a="#4caf50";switch(t){case"info":a="#2196f3";break;case"warn":a="#ff9800";break;case"error":a="#f44336";break;case"success":a="#4caf50";break}n.style.cssText=`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
padding: 12px 20px;
|
|
6
|
-
border-radius: 6px;
|
|
7
|
-
color: white;
|
|
8
|
-
font-weight: 500;
|
|
9
|
-
z-index: 10000;
|
|
10
|
-
animation: slideIn 0.3s ease-out;
|
|
11
|
-
background: ${a};
|
|
12
|
-
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
|
13
|
-
`;const o=document.createElement("style");o.textContent=`
|
|
14
|
-
@keyframes slideIn {
|
|
15
|
-
from { transform: translateX(100%); opacity: 0; }
|
|
16
|
-
to { transform: translateX(0); opacity: 1; }
|
|
17
|
-
}
|
|
18
|
-
@keyframes slideOut {
|
|
19
|
-
from { transform: translateX(0); opacity: 1; }
|
|
20
|
-
to { transform: translateX(100%); opacity: 0; }
|
|
21
|
-
}
|
|
22
|
-
`,document.head.appendChild(o),document.body.appendChild(n),setTimeout(()=>{n.style.animation="slideOut 0.3s ease-in",setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),o.parentNode&&o.parentNode.removeChild(o)},300)},3e3)}function Lt(e,t){const n=document.createElement("div");n.className="drag-threshold-circle",n.style.cssText=`
|
|
23
|
-
left: ${e-W}px;
|
|
24
|
-
top: ${t-W}px;
|
|
25
|
-
width: ${W*2}px;
|
|
26
|
-
height: ${W*2}px;
|
|
27
|
-
`,document.body.appendChild(n),window.dragThresholdCircle=n}function Tt(){const e=window.dragThresholdCircle;e&&e.parentNode&&(e.parentNode.removeChild(e),window.dragThresholdCircle=null)}async function dt(){try{if(!x)return false;const e=Date.now();if(e-Ge<tt)return true;Ge=e;const t=await qt();j=t.totalSize,J=t.totalImages,console.log("数据库健康检查:",{大小:`${(j/1024/1024).toFixed(2)}MB / ${(B/1024/1024).toFixed(2)}MB`,图片数量:`${J} / ${ye}`,使用率:`${(j/B*100).toFixed(1)}%`});const n=j/B,a=J/ye;return(n>q||a>q)&&(console.warn("数据库使用率过高,开始自动清理"),await et()),(n>.95||a>.95)&&(console.error("数据库接近极限,执行紧急清理"),await Cn()),true}catch(e){return console.error("数据库健康检查失败:",e),false}}async function qt(){return x?new Promise(e=>{const a=x.transaction([_],"readonly").objectStore(_).getAll();a.onsuccess=()=>{const o=a.result||[];let s=0;const c={};o.forEach(l=>{s+=l.size||0,c[l.channelKey]=(c[l.channelKey]||0)+1}),e({totalSize:s,totalImages:o.length,channelStats:c})},a.onerror=()=>{console.error("获取数据库统计失败:",a.error),e({totalSize:0,totalImages:0,channelStats:{}})}}):{totalSize:0,totalImages:0,channelStats:{}}}async function et(){try{console.log("开始自动清理...");const e=await Ut();if(e.length===0)return;const t={};e.forEach(o=>{t[o.channelKey]||(t[o.channelKey]=[]),t[o.channelKey].push(o)});let n=0,a=0;for(const[o,s]of Object.entries(t))if(s.length>Je){s.sort((l,u)=>l.timestamp-u.timestamp);const c=s.slice(0,s.length-Je);for(const l of c)await mt(l.url),n++,a+=l.size||0,k.value[l.url]&&(URL.revokeObjectURL(k.value[l.url]),delete k.value[l.url])}console.log(`自动清理完成: 清理了 ${n} 张图片,释放了 ${(a/1024/1024).toFixed(2)}MB`),J-=n,j-=a}catch(e){console.error("自动清理失败:",e)}}async function Cn(){try{console.log("开始紧急清理...");const e=await Ut();if(e.length===0)return;e.sort((s,c)=>c.timestamp-s.timestamp);const t=Math.floor(ye*.3),n=e.slice(t);let a=0,o=0;for(const s of n)await mt(s.url),a++,o+=s.size||0,k.value[s.url]&&(URL.revokeObjectURL(k.value[s.url]),delete k.value[s.url]);console.log(`紧急清理完成: 清理了 ${a} 张图片,释放了 ${(o/1024/1024).toFixed(2)}MB`),J=t,j-=o}catch(e){console.error("紧急清理失败:",e)}}async function Ut(){return x?new Promise(e=>{const a=x.transaction([_],"readonly").objectStore(_).getAll();a.onsuccess=()=>{e(a.result||[])},a.onerror=()=>{console.error("获取所有图片失败:",a.error),e([])}}):[]}async function ft(){return new Promise(e=>{try{x&&(x.close(),x=null);const t=indexedDB.deleteDatabase(Ve);t.onsuccess=()=>{console.log("IndexedDB数据库已完全清理"),j=0,J=0,e(true)},t.onerror=()=>{console.error("清理IndexedDB数据库失败:",t.error),e(false)},t.onblocked=()=>{console.warn("IndexedDB数据库删除被阻塞,可能有其他连接正在使用"),setTimeout(()=>{e(false)},5e3)}}catch(t){console.error("清理数据库时出错:",t),e(false)}})}async function bn(){try{return await Kt()?(setTimeout(async()=>{const t=await qt();console.log("数据库初始状态:",{大小:`${(t.totalSize/1024/1024).toFixed(2)}MB`,图片数量:t.totalImages,频道分布:t.channelStats}),(t.totalSize>B*.9||t.totalImages>ye*.9)&&(console.warn("数据库初始状态接近限制,执行清理"),await et())},1e3),true):(console.warn("数据库打开失败,尝试清理后重新初始化"),await ft(),await Kt())}catch(e){return console.error("IndexedDB初始化出错:",e),false}}async function Kt(){return new Promise(e=>{try{const t=indexedDB.open(Ve,je);t.onerror=()=>{console.error("IndexedDB打开失败:",t.error),e(false)},t.onsuccess=()=>{x=t.result,x.onerror=n=>{console.error("IndexedDB运行时错误:",n)},x.onversionchange=()=>{console.warn("IndexedDB版本变更,关闭连接"),x==null||x.close(),x=null},e(true)},t.onupgradeneeded=n=>{const a=n.target.result;if(!a.objectStoreNames.contains(_)){const o=a.createObjectStore(_,{keyPath:"url"});o.createIndex("channelKey","channelKey",{unique:false}),o.createIndex("timestamp","timestamp",{unique:false}),o.createIndex("size","size",{unique:false}),console.log("IndexedDB对象存储创建完成")}},t.onblocked=()=>{console.warn("IndexedDB打开被阻塞"),e(false)}}catch(t){console.error("打开数据库时出错:",t),e(false)}})}async function Rt(e){return x?new Promise((t,n)=>{const s=x.transaction([_],"readonly").objectStore(_).get(e);s.onsuccess=()=>{t(s.result||null)},s.onerror=()=>{console.error("从IndexedDB获取图片失败:",s.error),t(null)}}):null}async function ht(e){if(!x)return false;try{return e.size>Ae?(console.warn(`图片过大,跳过缓存: ${(e.size/1024/1024).toFixed(2)}MB > ${(Ae/1024/1024).toFixed(2)}MB`),false):(await dt(),j+e.size>B&&(console.warn("添加图片会超过数据库大小限制,执行清理"),await et(),j+e.size>B)?(console.warn("清理后仍会超过限制,跳过此图片"),false):J>=ye&&(console.warn("图片数量已达上限,执行清理"),await et(),J>=ye)?(console.warn("清理后仍达上限,跳过此图片"),false):new Promise(t=>{const o=x.transaction([_],"readwrite").objectStore(_).put(e);o.onsuccess=()=>{j+=e.size,J+=1,t(true)},o.onerror=()=>{console.error("保存图片到IndexedDB失败:",o.error),t(false)}}))}catch(t){return console.error("保存图片时出错:",t),false}}async function mt(e){return x?new Promise(t=>{const o=x.transaction([_],"readwrite").objectStore(_).delete(e);o.onsuccess=()=>{t(true)},o.onerror=()=>{console.error("从IndexedDB删除图片失败:",o.error),t(false)}}):false}async function kn(e){return x?new Promise(t=>{const s=x.transaction([_],"readonly").objectStore(_).index("channelKey").getAll(e);s.onsuccess=()=>{t(s.result||[])},s.onerror=()=>{console.error("获取频道图片失败:",s.error),t([])}}):[]}async function vt(e,t){if(V.has(t))return V.get(t)||null;const n=k.value[t];if(n)return n;const a=(async()=>{try{const o=k.value[t];if(o)return o;const s=await Rt(t);if(!s)return null;Ze();const c=URL.createObjectURL(s.blob);return k.value[t]=c,me(M(s.blob)),s.timestamp=Date.now(),await ht(s),c}catch(o){return console.error("获取缓存图片失败:",o),null}finally{V.delete(t)}})();return V.set(t,a),a}async function $e(e,t){if(V.has(t))return V.get(t)||null;const n=k.value[t];if(n)return n;const a=(async()=>{try{const o=k.value[t];if(o)return o;const s=await Rt(t);if(s){Ze();const Be=URL.createObjectURL(s.blob);return k.value[t]=Be,me(M(s.blob)),s.timestamp=Date.now(),await ht(s),Be}const c=await F("fetch-image",{url:t});if(!c.success)return null;const l=c.base64,u=c.contentType||"image/jpeg",v=atob(l),p=new Array(v.length);for(let Be=0;Be<v.length;Be++)p[Be]=v.charCodeAt(Be);const I=new Uint8Array(p),R=new Blob([I],{type:u});if(R.size>Ae)return null;const Q=k.value[t];if(Q)return Q;const Rn={url:t,blob:R,timestamp:Date.now(),size:R.size,channelKey:e};if(!await ht(Rn))return null;Ze();const Nt=URL.createObjectURL(R);return k.value[t]=Nt,me(M(R)),Nt}catch(o){return console.error("缓存图片失败:",o),null}finally{V.delete(t)}})();return V.set(t,a),a}async function Qe(e){try{const t=await kn(e);let n=0;for(const a of t)await mt(a.url),k.value[a.url]&&(URL.revokeObjectURL(k.value[a.url]),delete k.value[a.url],n+=a.size||0);n>0&&me(-n)}catch(t){console.error("清理频道图片缓存失败:",t)}}function Sn(){const e=Object.keys(k.value).length;return{blobCount:e,estimatedMemoryUsage:be,maxMemoryLimit:Pe,maxBlobLimit:Ce,memoryUsagePercent:(be/Pe*100).toFixed(1),blobUsagePercent:(e/Ce*100).toFixed(1)}}async function $n(){return x?new Promise(e=>{const a=x.transaction([_],"readonly").objectStore(_).getAll();a.onsuccess=()=>{const o=a.result||[],s=new Set;let c=0;o.forEach(l=>{s.add(l.channelKey),c+=l.size}),e({totalImages:o.length,totalSize:c,channels:s.size})},a.onerror=()=>{console.error("获取缓存统计失败:",a.error),e({totalImages:0,totalSize:0,channels:0})}}):{totalImages:0,totalSize:0,channels:0}}function gt(){y.value&&b.value&&(localStorage.setItem("chat-selected-bot",y.value),localStorage.setItem("chat-selected-channel",b.value))}function Pt(){const e=localStorage.getItem("chat-selected-bot"),t=localStorage.getItem("chat-selected-channel");return e&&t&&d.value.bots[e]&&d.value.channels[e]&&d.value.channels[e][t]?(y.value=e,b.value=t,true):false}function jt(e){var t,n,a,o;if(!d.value.bots[e.selfId])d.value.bots[e.selfId]={selfId:e.selfId,platform:e.platform,username:((t=e.bot)==null?void 0:t.name)||`Bot-${e.selfId}`,avatar:(n=e.bot)==null?void 0:n.avatar,status:"online"};else{const s=d.value.bots[e.selfId];s.status="online",(a=e.bot)!=null&&a.name&&s.username!==e.bot.name&&(s.username=e.bot.name),(o=e.bot)!=null&&o.avatar&&s.avatar!==e.bot.avatar&&(s.avatar=e.bot.avatar)}if(d.value.channels[e.selfId]||(d.value.channels[e.selfId]={}),e.channelId&&!d.value.channels[e.selfId][e.channelId]){const s=e.isDirect?`私聊(${e.username||"未知用户"})`:`${e.guildName||e.channelId} (${e.channelId})`;d.value.channels[e.selfId][e.channelId]={id:e.channelId,name:s,type:e.channelType||0,channelId:e.channelId,guildName:e.guildName||"群聊",isDirect:e.isDirect}}if(e.messageId&&e.content&&e.channelId){const s=`${e.selfId}:${e.channelId}`;if(d.value.messages[s]||(d.value.messages[s]=[]),!d.value.messages[s].find(l=>l.id===e.messageId)){const l={id:e.messageId,content:e.content,userId:e.userId,username:e.username,avatar:e.avatar,timestamp:e.timestamp,channelId:e.channelId,selfId:e.selfId,elements:e.elements,isBot:false,quote:e.quote},u=d.value.messages[s];let v=u.length;for(let I=u.length-1;I>=0;I--){if(u[I].timestamp<=e.timestamp){v=I+1;break}I===0&&(v=0)}u.splice(v,0,l),u.length>100&&(d.value.messages[s]=u.slice(-100)),z.value[s]=u.length;const p=Fe();le(()=>{setTimeout(()=>{p&&Ie()},10)})}}if(e.elements&&e.elements.length>0){const s=`${e.selfId}:${e.channelId}`;e.elements.forEach(c=>{if((c.type==="img"||c.type==="image"||c.type==="mface")&&c.attrs){const l=c.attrs.src||c.attrs.url||c.attrs.file;l&&$e(s,l).catch(u=>{console.warn("预缓存图片失败:",l,u)})}})}d.value={...d.value}}function At(e){const t=`${e.selfId}:${e.channelId}`;d.value.messages[t]||(d.value.messages[t]=[]);const n=d.value.messages[t],a=n.findIndex(o=>o.id.startsWith("bot-msg-")&&Math.abs(o.timestamp-e.timestamp)<5e3);if(a!==-1){const o=n[a];o.id=e.messageId,o.content=e.content,o.userId=e.selfId,o.username=e.botUsername,o.avatar=e.botAvatar,o.channelId=e.channelId,o.selfId=e.selfId,o.elements=e.elements,o.isBot=true,o.quote=e.quote}else if(!n.find(s=>s.id===e.messageId)){const s={id:e.messageId,content:e.content,userId:e.selfId,username:e.botUsername,avatar:e.botAvatar,timestamp:e.timestamp,channelId:e.channelId,selfId:e.selfId,elements:e.elements,isBot:true,quote:e.quote};let c=n.length;for(let u=n.length-1;u>=0;u--){if(n[u].timestamp<=e.timestamp){c=u+1;break}u===0&&(c=0)}n.splice(c,0,s),n.length>100&&(d.value.messages[t]=n.slice(-100)),z.value[t]=n.length;const l=Fe();le(()=>{setTimeout(()=>{l&&Ie()},10)})}d.value={...d.value}}function Bn(e){var t,n,a,o;if(!d.value.bots[e.selfId])d.value.bots[e.selfId]={selfId:e.selfId,platform:e.platform,username:((t=e.bot)==null?void 0:t.name)||`Bot-${e.selfId}`,avatar:(n=e.bot)==null?void 0:n.avatar,status:"online"};else{const s=d.value.bots[e.selfId];s.status="online",(a=e.bot)!=null&&a.name&&s.username!==e.bot.name&&(s.username=e.bot.name),(o=e.bot)!=null&&o.avatar&&s.avatar!==e.bot.avatar&&(s.avatar=e.bot.avatar)}if(d.value.channels[e.selfId]||(d.value.channels[e.selfId]={}),e.channelId&&!d.value.channels[e.selfId][e.channelId]){const s=e.isDirect?`私聊(${e.username||"未知用户"})`:`${e.guildName||e.channelId} (${e.channelId})`;d.value.channels[e.selfId][e.channelId]={id:e.channelId,name:s,type:e.channelType||0,channelId:e.channelId,guildName:e.guildName||"群聊",isDirect:e.isDirect}}if(e.messageId&&e.content&&e.channelId){const s=`${e.selfId}:${e.channelId}`;if(d.value.messages[s]||(d.value.messages[s]=[]),!d.value.messages[s].find(l=>l.id===e.messageId)){const l={id:e.messageId,content:e.content,userId:e.userId,username:e.username,avatar:e.avatar,timestamp:e.timestamp,channelId:e.channelId,selfId:e.selfId,elements:e.elements,isBot:true,quote:e.quote},u=d.value.messages[s];let v=u.length;for(let I=u.length-1;I>=0;I--){if(u[I].timestamp<=e.timestamp){v=I+1;break}I===0&&(v=0)}u.splice(v,0,l),u.length>100&&(d.value.messages[s]=u.slice(-100)),z.value[s]=u.length;const p=Fe();le(()=>{setTimeout(()=>{p&&Ie()},10)})}}if(e.elements&&e.elements.length>0){const s=`${e.selfId}:${e.channelId}`;e.elements.forEach(c=>{if((c.type==="img"||c.type==="image"||c.type==="mface")&&c.attrs){const l=c.attrs.src||c.attrs.url||c.attrs.file;l&&$e(s,l).catch(u=>{console.warn("预缓存图片失败:",l,u)})}})}d.value={...d.value}}async function Dn(){try{const e=await F("get-chat-data");if(e.success&&e.data){const t={};se.value=new Set(e.data.pinnedBots||[]),oe.value=new Set(e.data.pinnedChannels||[]);for(const[n,a]of Object.entries(e.data.messages||{})){const o=a.map(s=>({id:s.id,content:s.content,userId:s.userId,username:s.username,avatar:s.avatar,timestamp:s.timestamp,channelId:s.channelId,selfId:s.selfId,elements:s.elements,isBot:s.type==="bot",quote:s.quote}));o.sort((s,c)=>s.timestamp-c.timestamp),t[n]=o}return d.value={bots:e.data.bots||{},channels:e.data.channels||{},messages:t},await Mn(),true}else return console.warn("获取聊天数据失败:",e.error),false}catch(e){return console.error("获取聊天数据时出错:",e),false}}async function Mn(){try{const e=await F("get-all-channel-message-counts");if(e.success&&e.counts){const t={};for(const[n,a]of Object.entries(e.counts))t[n]=a;z.value=t}else console.warn("获取频道消息数量失败:",e.error)}catch(e){console.error("获取频道消息数量时出错:",e)}}async function _n(){try{const e=await F("get-plugin-config");e.success&&e.config?ie.value=e.config:console.warn("获取插件配置失败:",e.error)}catch(e){console.error("获取插件配置时出错:",e)}}async function yt(e,t,n,a){try{const o={selfId:e,channelId:t};n!==void 0&&(o.limit=n,o.offset=a||0);const s=await F("get-history-messages",o);if(s.success&&s.messages){const c=`${e}:${t}`,l=s.messages.map(v=>({id:v.id,content:v.content,userId:v.userId,username:v.username,avatar:v.avatar,timestamp:v.timestamp,channelId:v.channelId,selfId:v.selfId,elements:v.elements,isBot:v.type==="bot",quote:v.quote})),u=a||0;if(n!==void 0)if(l.sort((v,p)=>v.timestamp-p.timestamp),a===0)d.value.messages[c]=l,P.value[c]={offset:l.length,hasMore:l.length>=n&&s.total>l.length,loading:false};else{const v=d.value.messages[c]||[];d.value.messages[c]=[...l,...v];const p=a||0;P.value[c]={offset:p+l.length,hasMore:l.length>=n&&s.total>p+l.length,loading:false}}else l.sort((v,p)=>v.timestamp-p.timestamp),d.value.messages[c]=l,P.value[c]={offset:l.length,hasMore:false,loading:false};return z.value[c]=s.total||l.length,d.value={...d.value},true}else return console.warn("获取历史消息失败:",s.error),false}catch(o){return console.error("获取历史消息时出错:",o),false}}function Ln(e){if(!A.value||e.touches.length!==1)return;const t=e.touches[0];X.value={x:t.clientX,y:t.clientY,time:Date.now()},de.value={x:t.clientX,y:t.clientY},_e.value=false}function Tn(e){if(!A.value||!X.value||e.touches.length!==1)return;const t=e.touches[0];de.value={x:t.clientX,y:t.clientY};const n=t.clientX-X.value.x,a=t.clientY-X.value.y;if(Math.abs(n)>Math.abs(a)&&Math.abs(n)>30){const o=n>0,s=Z.value==="messages"||Z.value==="channels";if(o&&s){_e.value=true;const c=Math.min(n,200),l=150;c>l?E.value={show:true,text:"松开返回"}:E.value={show:true,text:`滑动返回 ${Math.round(c/l*100)}%`},e.preventDefault()}else E.value={show:false,text:""}}else E.value={show:false,text:""}}function qn(e){if(!A.value||!X.value)return;const n=Date.now()-X.value.time;if(de.value){const a=de.value.x-X.value.x,o=de.value.y-X.value.y,s=a>150,c=Math.abs(a)>Math.abs(o),l=n<300&&a>80;(s&&c||l)&&Un()}X.value=null,de.value=null,_e.value=false,E.value={show:false,text:""}}function Un(){switch(Z.value){case"messages":Z.value="channels";break;case"channels":Z.value="bots",y.value="",b.value="";break}}function pt(){A.value=window.innerWidth<=768}function Ot(){return!fe.value||Fe()}const zt=()=>{A.value&&T.value&&le(()=>{Ot()&&Ie()})},Kn=()=>{A.value&&setTimeout(()=>{T.value&&Ot()&&Ie()},300)};return Ft(we,(e,t)=>{t.length===0&&e.length>0&&le(()=>{Ie()})}),wt(async()=>{pt(),window.addEventListener("resize",pt),window.visualViewport&&window.visualViewport.addEventListener("resize",zt),document.addEventListener("click",ut),await _n(),ie.value.clearIndexedDBOnStart&&(console.log("启动时清空 IndexedDB 缓存..."),await ft()?console.log("IndexedDB 缓存已清空"):console.warn("清空 IndexedDB 缓存失败")),await bn()?(console.log("IndexedDB初始化成功"),setTimeout(async()=>{await dt()},2e3),setInterval(async()=>{await dt()},5*60*1e3)):console.warn("IndexedDB初始化失败,图片缓存功能将不可用"),await Dn(),le(()=>{Pt()});const t=Ct("chat-message-event",jt),n=Ct("bot-message-sent-event",At),a=Ct("chat-bot-message-event",Bn);Ft(b,o=>{o&&le(()=>{T.value&&(T.value.removeEventListener("scroll",Ne),T.value.addEventListener("scroll",Ne),Ne()),!A.value&&ne.value&&ne.value.focus()})},{immediate:true}),setInterval(()=>{Ze()},2*60*1e3),Pn(()=>{window.removeEventListener("resize",pt),window.visualViewport&&window.visualViewport.removeEventListener("resize",zt),document.removeEventListener("click",ut),t&&typeof t=="function"&&t(),n&&typeof n=="function"&&n(),a&&typeof a=="function"&&a(),T.value&&T.value.removeEventListener("scroll",Ne),Object.values(k.value).forEach(o=>{URL.revokeObjectURL(o)}),k.value={},x&&(x.close(),x=null)})}),{AvatarComponent:ge,ImageComponent:Y,JsonCardComponent:xe,ForwardMessageComponent:te,MessageElement:Me,chatData:d,channelMessageCounts:z,channelPagination:P,pluginConfig:ie,selectedBot:y,selectedChannel:b,inputMessage:ue,imageBlobUrls:k,pinnedBots:se,pinnedChannels:oe,uploadedImages:G,showActionMenu:pe,isMobile:A,mobileView:Z,touchStart:X,touchCurrent:de,isSwipeActive:_e,swipeIndicator:E,messageHistory:T,messageInput:ne,showScrollButton:Le,isUserScrolling:fe,isSending:ke,isLoadingMore:Se,draggingChannel:he,dragStartPos:N,dragCurrentPos:O,dragElementInitialPos:Te,dragOffset:qe,dragThreshold:W,isDragReady:ae,draggedBubbleElement:S,contextMenu:U,fileInput:Oe,bots:nt,currentChannels:at,currentMessages:we,currentChannelName:st,currentChannelKey:ot,canSendMessage:Ke,canInputMessage:rt,mobileViewClass:bt,inputPlaceholder:h,chatContainerStyle:i,selectBot:Qt,selectChannel:St,handleBotRightClick:en,handleChannelRightClick:tn,handleMessageRightClick:nn,showContextMenu:ct,hideContextMenu:K,handleKeyDown:Ee,toggleBotPin:sn,toggleChannelPin:on,deleteBotMessages:rn,deleteChannelMessages:ln,sendMessage:$t,toggleActionMenu:cn,triggerImageUpload:un,handleFileSelect:dn,handlePaste:fn,uploadImage:it,removeImage:hn,fileToBase64:Bt,handleClickOutside:ut,formatTime:mn,getChannelTypeText:pn,scrollToBottom:Ie,checkScrollPosition:Ne,isNearBottom:Fe,getChannelMessageCount:Mt,startDrag:wn,handleDragMove:He,handleDragEnd:Xe,resetDragState:We,getDragStyle:In,getDragDistance:xn,clearChannelHistory:_t,showNotification:D,createThresholdCircle:Lt,removeThresholdCircle:Tt,handleTouchStart:Ln,handleTouchMove:Tn,handleTouchEnd:qn,handleInputFocus:Kn,loadMoreMessages:Dt,handlePlusOne:vn,handleCopyMessage:gn,handleReplyMessage:yn,parseInlineQuote:lt,getInlineQuoteMessage:ze,getQuoteUser:Vt,getQuoteTimestamp:Jt,getQuoteContent:Gt,getQuoteElements:Zt,getMessageContentWithoutQuote:Et,getCachedImageUrl:vt,cacheImage:$e,clearChannelImageCache:Qe,clearAllIndexedDBData:ft,getMemoryStats:Sn,getCacheStats:$n,isFileUrl:ce,loadHistoryMessages:yt,handleMessageEvent:jt,handleBotMessageSentEvent:At,saveSelectionState:gt,restoreSelectionState:Pt}}const Xn={class:"bot-list"},Wn={class:"bot-items"},Qn=["onClick","onContextmenu"],Yn={class:"bot-avatar"},Vn={key:1,class:"avatar-placeholder"},Jn={class:"bot-info"},Gn={class:"bot-name"},Zn={class:"bot-platform"},En={class:"channel-list"},ea={key:0,class:"empty-state"},ta={key:1,class:"channel-items"},na=["data-channel-id","onClick","onContextmenu"],aa={class:"channel-info"},sa={class:"channel-name"},oa={class:"channel-type"},ra=["onMousedown","onTouchstart","title"],la={class:"message-area"},ca={class:"panel-header"},ia={key:0,class:"empty-state"},ua={key:1,class:"message-content"},da={key:0,class:"loading-more-indicator"},fa=["onContextmenu"],ha={class:"message-avatar"},ma={key:1,class:"avatar-placeholder"},va={class:"message-content-wrapper"},ga={class:"message-header"},ya={class:"message-username"},pa={class:"message-time"},wa={key:0,class:"message-quote"},Ia={class:"quote-header"},xa={class:"quote-avatar"},Ca={key:1,class:"avatar-placeholder"},ba={class:"quote-username"},ka={class:"quote-time"},Sa={class:"quote-content"},$a={class:"message-text"},Ba={class:"message-input"},Da={key:0,class:"image-preview-container"},Ma=["src","alt"],_a=["onClick"],La={class:"input-row"},Ta={class:"input-actions"},qa=["placeholder","disabled"],Ua=["disabled"],Ka=De({__name:"index",setup(ce){const ge=Hn(),{AvatarComponent:Y,MessageElement:xe,selectedBot:te,selectedChannel:Me,inputMessage:d,pinnedBots:z,pinnedChannels:P,uploadedImages:ie,showActionMenu:k,swipeIndicator:V,messageHistory:Pe,messageInput:Ce,showScrollButton:be,isSending:x,isLoadingMore:Ve,draggingChannel:je,dragThreshold:_,contextMenu:B,fileInput:Je,bots:ye,currentChannels:Ae,currentMessages:q,currentChannelName:tt,currentChannelKey:j,canSendMessage:J,canInputMessage:Ge,mobileViewClass:y,inputPlaceholder:b,chatContainerStyle:ue,selectBot:G,selectChannel:pe,handleBotRightClick:Oe,handleChannelRightClick:A,toggleBotPin:Z,toggleChannelPin:X,deleteBotMessages:de,deleteChannelMessages:_e,sendMessage:E,toggleActionMenu:T,triggerImageUpload:ne,handleFileSelect:Le,handlePaste:fe,removeImage:ke,formatTime:Se,getChannelTypeText:he,scrollToBottom:N,getChannelMessageCount:O,startDrag:Te,getDragStyle:qe,getDragDistance:W,handleTouchStart:Ue,handleTouchMove:H,handleTouchEnd:ae,handleInputFocus:S,handleMessageRightClick:U,handlePlusOne:se,handleCopyMessage:oe,handleReplyMessage:nt,getInlineQuoteMessage:at,getQuoteUser:we,getQuoteTimestamp:st,getQuoteContent:ot,getQuoteElements:Ke,getMessageContentWithoutQuote:rt}=ge;return(bt,h)=>(w(),C("div",{class:ve(["chat-container",r(y)]),style:It(r(ue)),onTouchstart:h[18]||(h[18]=(...i)=>r(Ue)&&r(Ue)(...i)),onTouchmove:h[19]||(h[19]=(...i)=>r(H)&&r(H)(...i)),onTouchend:h[20]||(h[20]=(...i)=>r(ae)&&r(ae)(...i))},[$(" 左侧机器人列表 "),f("div",Xn,[h[21]||(h[21]=f("div",{class:"panel-header"},[f("h3",null,"机器人")],-1)),f("div",Wn,[(w(true),C(ee,null,Re(r(ye),i=>(w(),C("div",{key:i.selfId,class:ve(["bot-item",{active:r(te)===i.selfId,pinned:r(z).has(i.selfId)}]),onClick:M=>r(G)(i.selfId),onContextmenu:M=>r(Oe)(M,i.selfId)},[f("div",Yn,[i.avatar?(w(),Ye(r(Y),{key:0,src:i.avatar,alt:i.username,"channel-key":"bot-list"},null,8,["src","alt"])):(w(),C("div",Vn,L(i.username.charAt(0).toUpperCase()),1))]),f("div",Jn,[f("div",Gn,L(i.username),1),f("div",Zn,L(i.platform),1)]),f("div",{class:ve(["bot-status",i.status])},null,2)],42,Qn))),128))])]),$(" 中间频道列表 "),f("div",En,[h[22]||(h[22]=f("div",{class:"panel-header"},[f("h3",null,"频道")],-1)),r(te)?(w(),C("div",ta,[(w(true),C(ee,null,Re(r(Ae),i=>(w(),C("div",{key:i.id,class:ve(["channel-item",{active:r(Me)===i.id,pinned:r(P).has(`${r(te)}:${i.id}`)}]),"data-channel-id":i.id,onClick:M=>r(pe)(i.id),onContextmenu:M=>r(A)(M,i.id)},[f("div",aa,[f("div",sa,L(i.name),1),f("div",oa,L(r(he)(i.type)),1)]),r(O)(i.id)>0?(w(),C("div",{key:0,class:ve(["channel-message-count draggable-bubble",{dragging:r(je)===i.id,"will-delete":r(je)===i.id&&r(W)(i.id)>r(_)}]),onMousedown:M=>r(Te)(M,i.id),onTouchstart:M=>r(Te)(M,i.id),style:It(r(qe)(i.id)),title:r(je)===i.id?r(W)(i.id)>r(_)?"松开清理历史记录":"拖拽更远以清理历史记录":"拖拽清理历史记录"},L(r(O)(i.id)),47,ra)):$("v-if",true)],42,na))),128))])):(w(),C("div",ea," 请选择一个机器人 "))]),$(" 右侧消息区域 "),f("div",la,[f("div",ca,[f("h3",null,L(r(tt)||"选择频道"),1)]),!r(te)||!r(Me)?(w(),C("div",ia," 请选择机器人和频道 ")):(w(),C("div",ua,[$(" 消息历史 "),f("div",{class:"message-history",ref_key:"messageHistory",ref:Pe},[$(" 加载更多指示器 "),r(Ve)?(w(),C("div",da,[...h[23]||(h[23]=[f("div",{class:"loading-spinner"},null,-1),f("span",null,"加载更多消息中...",-1)])])):$("v-if",true),(w(true),C(ee,null,Re(r(q),i=>(w(),C("div",{key:i.id,class:ve(["message-item",{"bot-message":i.isBot}]),onContextmenu:M=>i.isBot?null:r(U)(M,i)},[f("div",ha,[i.avatar?(w(),Ye(r(Y),{key:0,src:i.avatar,alt:i.username,"channel-key":r(j)},null,8,["src","alt","channel-key"])):(w(),C("div",ma,L(i.username.charAt(0).toUpperCase()),1))]),f("div",va,[f("div",ga,[f("span",ya,L(i.username),1),f("span",pa,L(r(Se)(i.timestamp)),1)]),$(" 引用消息显示 "),i.quote||r(at)(i,r(q))?(w(),C("div",wa,[f("div",Ia,[f("div",xa,[r(we)(i,r(q)).avatar?(w(),Ye(r(Y),{key:0,src:r(we)(i,r(q)).avatar,alt:r(we)(i,r(q)).username,"channel-key":r(j)},null,8,["src","alt","channel-key"])):(w(),C("div",Ca,L(r(we)(i,r(q)).username.charAt(0).toUpperCase()),1))]),f("span",ba,L(r(we)(i,r(q)).username),1),f("span",ka,L(r(Se)(r(st)(i,r(q)))),1)]),f("div",Sa,[r(Ke)(i,r(q))&&r(Ke)(i,r(q)).length>0?(w(true),C(ee,{key:0},Re(r(Ke)(i,r(q)),(M,me)=>(w(),Ye(r(xe),{key:`quote-${me}`,element:M,"channel-key":r(j)},null,8,["element","channel-key"]))),128)):(w(),C(ee,{key:1},[xt(L(r(ot)(i,r(q))),1)],64))])])):$("v-if",true),f("div",$a,[i.elements&&i.elements.length>0?(w(true),C(ee,{key:0},Re(i.elements,(M,me)=>(w(),Ye(r(xe),{key:me,element:M,"channel-key":r(j)},null,8,["element","channel-key"]))),128)):(w(),C(ee,{key:1},[xt(L(r(rt)(i,r(q))),1)],64))])])],42,fa))),128))],512),$(" 悬浮的滚动到底部按钮 "),Ht(f("div",{class:"floating-scroll-button",onClick:h[0]||(h[0]=(...i)=>r(N)&&r(N)(...i))},[...h[24]||(h[24]=[f("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor"},[f("path",{d:"M7 10l5 5 5-5z"})],-1)])],512),[[jn,r(be)]]),$(" 输入框 "),f("div",Ba,[$(" 图片预览区域 "),r(ie).length>0?(w(),C("div",Da,[(w(true),C(ee,null,Re(r(ie),i=>(w(),C("div",{key:i.tempId,class:"image-preview-item"},[f("img",{src:i.preview,alt:i.filename,class:"preview-image"},null,8,Ma),f("button",{class:"remove-image-btn",onClick:M=>r(ke)(i.tempId),title:"删除图片"},[...h[25]||(h[25]=[f("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor"},[f("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})],-1)])],8,_a)]))),128))])):$("v-if",true),f("div",La,[$(" 加号按钮 "),f("div",Ta,[f("button",{class:ve(["add-button",{active:r(k)}]),onClick:h[1]||(h[1]=(...i)=>r(T)&&r(T)(...i)),title:"更多操作"},[...h[26]||(h[26]=[f("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},[f("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),f("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)])],2),$(" 操作菜单 "),r(k)?(w(),C("div",{key:0,class:"action-menu",onClick:h[3]||(h[3]=Xt(()=>{},["stop"]))},[f("button",{class:"action-menu-item",onClick:h[2]||(h[2]=(...i)=>r(ne)&&r(ne)(...i))},[...h[27]||(h[27]=[f("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[f("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),f("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),f("polyline",{points:"21,15 16,10 5,21"})],-1),xt(" 上传图片 ",-1)])])])):$("v-if",true)]),Ht(f("input",{"onUpdate:modelValue":h[4]||(h[4]=i=>On(d)?d.value=i:null),type:"text",placeholder:r(b),onKeyup:h[5]||(h[5]=An((...i)=>r(E)&&r(E)(...i),["enter"])),disabled:!r(Ge),ref_key:"messageInput",ref:Ce,onPaste:h[6]||(h[6]=(...i)=>r(fe)&&r(fe)(...i)),onFocus:h[7]||(h[7]=(...i)=>r(S)&&r(S)(...i))},null,40,qa),[[zn,r(d)]]),f("button",{onClick:h[8]||(h[8]=(...i)=>r(E)&&r(E)(...i)),disabled:!r(J),class:ve({"is-sending":r(x)})},L(r(x)?"发送中...":"发送"),11,Ua)]),$(" 隐藏的文件输入 "),f("input",{type:"file",ref_key:"fileInput",ref:Je,onChange:h[9]||(h[9]=(...i)=>r(Le)&&r(Le)(...i)),accept:"image/*",multiple:"",style:{display:"none"}},null,544)])]))]),$(" 右键菜单 "),r(B).show?(w(),C("div",{key:0,class:"context-menu",style:It({left:r(B).x+"px",top:r(B).y+"px"}),onClick:h[17]||(h[17]=Xt(()=>{},["stop"]))},[$(" 机器人右键菜单 "),r(B).type==="bot"?(w(),C(ee,{key:0},[f("div",{class:"context-menu-item",onClick:h[10]||(h[10]=i=>r(Z)(r(B).targetId))},L(r(z).has(r(B).targetId)?"取消置顶":"置顶"),1),f("div",{class:"context-menu-item danger",onClick:h[11]||(h[11]=i=>r(de)(r(B).targetId))}," 彻底删除此机器人所有数据 ")],64)):$("v-if",true),$(" 频道右键菜单 "),r(B).type==="channel"?(w(),C(ee,{key:1},[f("div",{class:"context-menu-item",onClick:h[12]||(h[12]=i=>r(X)(r(B).targetId))},L(r(P).has(`${r(te)}:${r(B).targetId}`)?"取消置顶":"置顶"),1),f("div",{class:"context-menu-item danger",onClick:h[13]||(h[13]=i=>r(_e)(r(B).targetId))}," 彻底删除此频道所有数据 ")],64)):$("v-if",true),$(" 消息右键菜单 "),r(B).type==="message"&&r(B).message?(w(),C(ee,{key:2},[f("div",{class:"context-menu-item",onClick:h[14]||(h[14]=i=>r(se)(r(B).message))}," +1 "),f("div",{class:"context-menu-item",onClick:h[15]||(h[15]=i=>r(oe)(r(B).message))}," 复制 "),f("div",{class:"context-menu-item",onClick:h[16]||(h[16]=i=>r(nt)(r(B).message))}," 回复 ")],64)):$("v-if",true)],4)):$("v-if",true),$(" 滑动指示器 "),f("div",{class:ve(["swipe-indicator",{show:r(V).show}])},L(r(V).text),3)],38))}}),Wt=(ce,ge)=>{const Y=ce.__vccOpts||ce;for(const[xe,te]of ge)Y[xe]=te;return Y},Ra=Wt(Ka,[["__scopeId","data-v-d6c77cba"]]),Pa={},ja={class:"k-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none"};function Aa(ce,ge){return w(),C("svg",ja,[...ge[0]||(ge[0]=[f("path",{d:"M8 10.5H16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),f("path",{d:"M8 14H13.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),f("path",{d:"M17 3.33782C15.5291 2.48697 13.8214 2 12 2C6.47715 2 2 6.47715 2 12C2 13.5997 2.37562 15.1116 3.04346 16.4525C3.22094 16.8088 3.28001 17.2161 3.17712 17.6006L2.58151 19.8267C2.32295 20.793 3.20701 21.677 4.17335 21.4185L6.39939 20.8229C6.78393 20.72 7.19121 20.7791 7.54753 20.9565C8.88837 21.6244 10.4003 22 12 22C17.5228 22 22 17.5228 22 12C22 10.1786 21.513 8.47087 20.6622 7",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])])}const Oa=Wt(Pa,[["render",Aa]]);Fn.register("activity:chat",Oa);const Ha=ce=>{ce.page({name:"聊天室",path:"/chat-patch",desc:"",authority:4,icon:"activity:chat",component:De({setup(){return()=>m(Nn("k-layout"),{},{default:()=>m(Ra)})}})})};export{Ha as default};
|
|
1
|
+
import{defineComponent as K,createElementBlock as S,openBlock as v,createElementVNode as y,getCurrentInstance as Re,inject as Ce,ref as A,computed as w,unref as i,isRef as Cn,warn as ua,provide as kn,mergeProps as Kt,renderSlot as de,onMounted as De,watch as ye,toRef as Gt,onUnmounted as En,shallowRef as Dt,nextTick as oe,useAttrs as ca,useSlots as xo,normalizeStyle as dt,normalizeClass as M,createCommentVNode as P,Fragment as ie,createBlock as O,withCtx as L,resolveDynamicComponent as _e,withModifiers as Ae,toDisplayString as Y,onBeforeUnmount as Bt,createVNode as B,Transition as Sn,withDirectives as Je,createTextVNode as ce,vShow as Qe,Text as da,reactive as Yt,h as Q,watchEffect as fa,onScopeDispose as pa,shallowReactive as _o,isVNode as Qt,render as qt,markRaw as hn,toRefs as va,resolveComponent as ue,withKeys as Et,renderList as Ne}from"vue";import{send as Le,receive as sn,icons as ma}from"@koishijs/client";import{isClient as $e,computedEager as ha,useEventListener as Ht,useResizeObserver as Co,useTimeoutFn as ga}from"@vueuse/core";/*! Element Plus Icons Vue v2.3.2 */var ba=K({name:"CircleCheck",__name:"circle-check",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"}),y("path",{fill:"currentColor",d:"M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752z"})]))}}),ya=ba,wa=K({name:"CircleCloseFilled",__name:"circle-close-filled",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"})]))}}),In=wa,xa=K({name:"CircleClose",__name:"circle-close",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"}),y("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"})]))}}),ko=xa,_a=K({name:"Close",__name:"close",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),Ca=_a,ka=K({name:"Collection",__name:"collection",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M192 736h640V128H256a64 64 0 0 0-64 64zm64-672h608a32 32 0 0 1 32 32v672a32 32 0 0 1-32 32H160l-32 57.536V192A128 128 0 0 1 256 64"}),y("path",{fill:"currentColor",d:"M240 800a48 48 0 1 0 0 96h592v-96zm0-64h656v160a64 64 0 0 1-64 64H240a112 112 0 0 1 0-224m144-608v250.88l96-76.8 96 76.8V128zm-64-64h320v381.44a32 32 0 0 1-51.968 24.96L480 384l-108.032 86.4A32 32 0 0 1 320 445.44z"})]))}}),Ea=ka,Sa=K({name:"Delete",__name:"delete",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),Ia=Sa,Ta=K({name:"Hide",__name:"hide",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M876.8 156.8c0-9.6-3.2-16-9.6-22.4s-12.8-9.6-22.4-9.6-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176S0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4s3.2 16 9.6 22.4 12.8 9.6 22.4 9.6 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4m-646.4 528Q115.2 579.2 76.8 512q43.2-72 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4m140.8-96Q352 555.2 352 512c0-44.8 16-83.2 48-112s67.2-48 112-48c28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6q-43.2 72-153.6 172.8c-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176S1024 528 1024 512s-48.001-73.6-134.401-176"}),y("path",{fill:"currentColor",d:"M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112s-67.2 48-112 48"})]))}}),Ma=Ta,La=K({name:"InfoFilled",__name:"info-filled",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.99 12.99 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"})]))}}),gn=La,Aa=K({name:"Loading",__name:"loading",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"})]))}}),St=Aa,Ba=K({name:"Picture",__name:"picture",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M160 160v704h704V160zm-32-64h768a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H128a32 32 0 0 1-32-32V128a32 32 0 0 1 32-32"}),y("path",{fill:"currentColor",d:"M384 288q64 0 64 64t-64 64-64-64 64-64M185.408 876.992l-50.816-38.912L350.72 556.032a96 96 0 0 1 134.592-17.856l1.856 1.472 122.88 99.136a32 32 0 0 0 44.992-4.864l216-269.888 49.92 39.936-215.808 269.824-.256.32a96 96 0 0 1-135.04 14.464l-122.88-99.072-.64-.512a32 32 0 0 0-44.8 5.952z"})]))}}),$a=Ba,Pa=K({name:"StarFilled",__name:"star-filled",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M313.6 924.48a70.4 70.4 0 0 1-74.152-5.365 70.4 70.4 0 0 1-27.992-68.875l37.888-220.928L88.96 472.96a70.4 70.4 0 0 1 3.788-104.225A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 100.246-28.595 70.4 70.4 0 0 1 25.962 28.595l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"})]))}}),Un=Pa,Oa=K({name:"Star",__name:"star",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"})]))}}),Na=Oa,za=K({name:"SuccessFilled",__name:"success-filled",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"})]))}}),Eo=za,Ra=K({name:"View",__name:"view",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"})]))}}),Fa=Ra,Da=K({name:"WarningFilled",__name:"warning-filled",setup(e){return(t,n)=>(v(),S("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[y("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.43 58.43 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.43 58.43 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"})]))}}),So=Da;const Io=Symbol(),Vt="el",Ha="is-",lt=(e,t,n,o,a)=>{let r=`${e}-${t}`;return n&&(r+=`-${n}`),o&&(r+=`__${o}`),a&&(r+=`--${a}`),r},To=Symbol("namespaceContextKey"),Mo=e=>{const t=e||(Re()?Ce(To,A(Vt)):A(Vt));return w(()=>i(t)||Vt)},Fe=(e,t)=>{const n=Mo(t);return{namespace:n,b:(u="")=>lt(n.value,e,u,"",""),e:u=>u?lt(n.value,e,"",u,""):"",m:u=>u?lt(n.value,e,"","",u):"",be:(u,b)=>u&&b?lt(n.value,e,u,b,""):"",em:(u,b)=>u&&b?lt(n.value,e,"",u,b):"",bm:(u,b)=>u&&b?lt(n.value,e,u,"",b):"",bem:(u,b,h)=>u&&b&&h?lt(n.value,e,u,b,h):"",is:(u,...b)=>{const h=b.length>=1?b[0]:true;return u&&h?`${Ha}${u}`:""},cssVar:u=>{const b={};for(const h in u)u[h]&&(b[`--${n.value}-${h}`]=u[h]);return b},cssVarName:u=>`--${n.value}-${u}`,cssVarBlock:u=>{const b={};for(const h in u)u[h]&&(b[`--${n.value}-${e}-${h}`]=u[h]);return b},cssVarBlockName:u=>`--${n.value}-${e}-${u}`}};/**
|
|
2
|
+
* @vue/shared v3.6.0-alpha.6
|
|
3
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/const ct=()=>{},Va=Object.prototype.hasOwnProperty,It=(e,t)=>Va.call(e,t),Ua=Array.isArray,Ke=e=>typeof e=="function",Se=e=>typeof e=="string",bt=e=>e!==null&&typeof e=="object",ja=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},Ka=/-(\w)/g,Ga=(e,t)=>t?t.toUpperCase():"",Ya=ja(e=>e.replace(Ka,Ga));var qa=typeof global=="object"&&global&&global.Object===Object&&global,Wa=typeof self=="object"&&self&&self.Object===Object&&self,Tn=qa||Wa||Function("return this")(),et=Tn.Symbol,Lo=Object.prototype,Xa=Lo.hasOwnProperty,Za=Lo.toString,kt=et?et.toStringTag:void 0;function Ja(e){var t=Xa.call(e,kt),n=e[kt];try{e[kt]=void 0;var o=true}catch{}var a=Za.call(e);return o&&(t?e[kt]=n:delete e[kt]),a}var Qa=Object.prototype,er=Qa.toString;function tr(e){return er.call(e)}var nr="[object Null]",or="[object Undefined]",jn=et?et.toStringTag:void 0;function Mn(e){return e==null?e===void 0?or:nr:jn&&jn in Object(e)?Ja(e):tr(e)}function Ln(e){return e!=null&&typeof e=="object"}var ar="[object Symbol]";function An(e){return typeof e=="symbol"||Ln(e)&&Mn(e)==ar}function rr(e,t){for(var n=-1,o=e==null?0:e.length,a=Array(o);++n<o;)a[n]=t(e[n],n,e);return a}var $t=Array.isArray,Kn=et?et.prototype:void 0,Gn=Kn?Kn.toString:void 0;function Ao(e){if(typeof e=="string")return e;if($t(e))return rr(e,Ao)+"";if(An(e))return Gn?Gn.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Wt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function sr(e){return e}var lr="[object AsyncFunction]",ir="[object Function]",ur="[object GeneratorFunction]",cr="[object Proxy]";function dr(e){if(!Wt(e))return false;var t=Mn(e);return t==ir||t==ur||t==lr||t==cr}var ln=Tn["__core-js_shared__"],Yn=function(){var e=/[^.]+$/.exec(ln&&ln.keys&&ln.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function fr(e){return!!Yn&&Yn in e}var pr=Function.prototype,vr=pr.toString;function mr(e){if(e!=null){try{return vr.call(e)}catch{}try{return e+""}catch{}}return""}var hr=/[\\^$.*+?()[\]{}|]/g,gr=/^\[object .+?Constructor\]$/,br=Function.prototype,yr=Object.prototype,wr=br.toString,xr=yr.hasOwnProperty,_r=RegExp("^"+wr.call(xr).replace(hr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Cr(e){if(!Wt(e)||fr(e))return false;var t=dr(e)?_r:gr;return t.test(mr(e))}function kr(e,t){return e==null?void 0:e[t]}function Bn(e,t){var n=kr(e,t);return Cr(n)?n:void 0}function Er(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Sr=800,Ir=16,Tr=Date.now;function Mr(e){var t=0,n=0;return function(){var o=Tr(),a=Ir-(o-n);if(n=o,a>0){if(++t>=Sr)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Lr(e){return function(){return e}}var Xt=function(){try{var e=Bn(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Ar=Xt?function(e,t){return Xt(e,"toString",{configurable:true,enumerable:false,value:Lr(t),writable:true})}:sr,Br=Mr(Ar),$r=9007199254740991,Pr=/^(?:0|[1-9]\d*)$/;function Bo(e,t){var n=typeof e;return t=t??$r,!!t&&(n=="number"||n!="symbol"&&Pr.test(e))&&e>-1&&e%1==0&&e<t}function Or(e,t,n){t=="__proto__"&&Xt?Xt(e,t,{configurable:true,enumerable:true,value:n,writable:true}):e[t]=n}function $o(e,t){return e===t||e!==e&&t!==t}var Nr=Object.prototype,zr=Nr.hasOwnProperty;function Rr(e,t,n){var o=e[t];(!(zr.call(e,t)&&$o(o,n))||n===void 0&&!(t in e))&&Or(e,t,n)}var qn=Math.max;function Fr(e,t,n){return t=qn(t===void 0?e.length-1:t,0),function(){for(var o=arguments,a=-1,r=qn(o.length-t,0),s=Array(r);++a<r;)s[a]=o[t+a];a=-1;for(var l=Array(t+1);++a<t;)l[a]=o[a];return l[t]=n(s),Er(e,this,l)}}var Dr=9007199254740991;function Hr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Dr}var Vr="[object Arguments]";function Wn(e){return Ln(e)&&Mn(e)==Vr}var Po=Object.prototype,Ur=Po.hasOwnProperty,jr=Po.propertyIsEnumerable,Oo=Wn(function(){return arguments}())?Wn:function(e){return Ln(e)&&Ur.call(e,"callee")&&!jr.call(e,"callee")},Kr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Gr=/^\w*$/;function Yr(e,t){if($t(e))return false;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||An(e)?true:Gr.test(e)||!Kr.test(e)||t!=null&&e in Object(t)}var Tt=Bn(Object,"create");function qr(){this.__data__=Tt?Tt(null):{},this.size=0}function Wr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Xr="__lodash_hash_undefined__",Zr=Object.prototype,Jr=Zr.hasOwnProperty;function Qr(e){var t=this.__data__;if(Tt){var n=t[e];return n===Xr?void 0:n}return Jr.call(t,e)?t[e]:void 0}var es=Object.prototype,ts=es.hasOwnProperty;function ns(e){var t=this.__data__;return Tt?t[e]!==void 0:ts.call(t,e)}var os="__lodash_hash_undefined__";function as(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Tt&&t===void 0?os:t,this}function ft(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}ft.prototype.clear=qr;ft.prototype.delete=Wr;ft.prototype.get=Qr;ft.prototype.has=ns;ft.prototype.set=as;function rs(){this.__data__=[],this.size=0}function en(e,t){for(var n=e.length;n--;)if($o(e[n][0],t))return n;return-1}var ss=Array.prototype,ls=ss.splice;function is(e){var t=this.__data__,n=en(t,e);if(n<0)return false;var o=t.length-1;return n==o?t.pop():ls.call(t,n,1),--this.size,true}function us(e){var t=this.__data__,n=en(t,e);return n<0?void 0:t[n][1]}function cs(e){return en(this.__data__,e)>-1}function ds(e,t){var n=this.__data__,o=en(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}function wt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}wt.prototype.clear=rs;wt.prototype.delete=is;wt.prototype.get=us;wt.prototype.has=cs;wt.prototype.set=ds;var fs=Bn(Tn,"Map");function ps(){this.size=0,this.__data__={hash:new ft,map:new(fs||wt),string:new ft}}function vs(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function tn(e,t){var n=e.__data__;return vs(t)?n[typeof t=="string"?"string":"hash"]:n.map}function ms(e){var t=tn(this,e).delete(e);return this.size-=t?1:0,t}function hs(e){return tn(this,e).get(e)}function gs(e){return tn(this,e).has(e)}function bs(e,t){var n=tn(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}function vt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}vt.prototype.clear=ps;vt.prototype.delete=ms;vt.prototype.get=hs;vt.prototype.has=gs;vt.prototype.set=bs;var ys="Expected a function";function $n(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(ys);var n=function(){var o=arguments,a=t?t.apply(this,o):o[0],r=n.cache;if(r.has(a))return r.get(a);var s=e.apply(this,o);return n.cache=r.set(a,s)||r,s};return n.cache=new($n.Cache||vt),n}$n.Cache=vt;var ws=500;function xs(e){var t=$n(e,function(o){return n.size===ws&&n.clear(),o}),n=t.cache;return t}var _s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Cs=/\\(\\)?/g,ks=xs(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(_s,function(n,o,a,r){t.push(a?r.replace(Cs,"$1"):o||n)}),t});function Es(e){return e==null?"":Ao(e)}function nn(e,t){return $t(e)?e:Yr(e,t)?[e]:ks(Es(e))}function Pn(e){if(typeof e=="string"||An(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function No(e,t){t=nn(t,e);for(var n=0,o=t.length;e!=null&&n<o;)e=e[Pn(t[n++])];return n&&n==o?e:void 0}function Ss(e,t,n){var o=e==null?void 0:No(e,t);return o===void 0?n:o}function Is(e,t){for(var n=-1,o=t.length,a=e.length;++n<o;)e[a+n]=t[n];return e}var Xn=et?et.isConcatSpreadable:void 0;function Ts(e){return $t(e)||Oo(e)||!!(Xn&&e&&e[Xn])}function Ms(e,t,n,o,a){var r=-1,s=e.length;for(n||(n=Ts),a||(a=[]);++r<s;){var l=e[r];n(l)?Is(a,l):a[a.length]=l}return a}function Ls(e){var t=e==null?0:e.length;return t?Ms(e):[]}function As(e){return Br(Fr(e,void 0,Ls),e+"")}function Bs(e,t){return e!=null&&t in Object(e)}function $s(e,t,n){t=nn(t,e);for(var o=-1,a=t.length,r=false;++o<a;){var s=Pn(t[o]);if(!(r=e!=null&&n(e,s)))break;e=e[s]}return r||++o!=a?r:(a=e==null?0:e.length,!!a&&Hr(a)&&Bo(s,a)&&($t(e)||Oo(e)))}function Ps(e,t){return e!=null&&$s(e,t,Bs)}function zo(e){for(var t=-1,n=e==null?0:e.length,o={};++t<n;){var a=e[t];o[a[0]]=a[1]}return o}function Ro(e){return e==null}function Os(e,t,n,o){if(!Wt(e))return e;t=nn(t,e);for(var a=-1,r=t.length,s=r-1,l=e;l!=null&&++a<r;){var p=Pn(t[a]),f=n;if(p==="__proto__"||p==="constructor"||p==="prototype")return e;if(a!=s){var C=l[p];f=void 0,f===void 0&&(f=Wt(C)?C:Bo(t[a+1])?[]:{})}Rr(l,p,f),l=l[p]}return e}function Ns(e,t,n){for(var o=-1,a=t.length,r={};++o<a;){var s=t[o],l=No(e,s);n(l,s)&&Os(r,nn(s,e),l)}return r}function zs(e,t){return Ns(e,t,function(n,o){return Ps(e,o)})}var Rs=As(function(e,t){return e==null?{}:zs(e,t)});const Fs=e=>e===void 0,un=e=>typeof e=="boolean",Ge=e=>typeof e=="number",bn=e=>typeof Element>"u"?false:e instanceof Element,Ds=e=>Se(e)?!Number.isNaN(Number(e)):false;class Hs extends Error{constructor(t){super(t),this.name="ElementPlusError"}}function Vs(e,t){throw new Hs(`[${e}] ${t}`)}const Zn={current:0},Jn=A(0),Fo=2e3,Qn=Symbol("elZIndexContextKey"),Do=Symbol("zIndexContextKey"),Us=e=>{const t=Re()?Ce(Qn,Zn):Zn,n=e||(Re()?Ce(Do,void 0):void 0),o=w(()=>{const s=i(n);return Ge(s)?s:Fo}),a=w(()=>o.value+Jn.value),r=()=>(t.current++,Jn.value=t.current,a.value);return!$e&&Ce(Qn),{initialZIndex:o,currentZIndex:a,nextZIndex:r}};var js={name:"en",el:{breadcrumb:{label:"Breadcrumb"},colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color.",alphaLabel:"pick alpha value",alphaDescription:"alpha {alpha}, current color is {color}",hueLabel:"pick hue value",hueDescription:"hue {hue}, current color is {color}",svLabel:"pick saturation and brightness value",svDescription:"saturation {saturation}, brightness {brightness}, current color is {color}",predefineDescription:"select {value} as the color"},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},mention:{loading:"Loading"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",page:"Page",prev:"Go to previous page",next:"Go to next page",currentPage:"page {pager}",prevPages:"Previous {pager} pages",nextPages:"Next {pager} pages",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum",selectAllLabel:"Select all rows",selectRowLabel:"Select this row",expandRowLabel:"Expand this row",collapseRowLabel:"Collapse this row",sortLabel:"Sort by {column}",filterLabel:"Filter by {column}"},tag:{close:"Close this tag"},tour:{next:"Next",previous:"Previous",finish:"Finish",close:"Close this dialog"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"},carousel:{leftArrow:"Carousel arrow left",rightArrow:"Carousel arrow right",indicator:"Carousel switch to index {index}"}}};const Ks=e=>(t,n)=>Gs(t,n,i(e)),Gs=(e,t,n)=>Ss(n,e,e).replace(/\{(\w+)\}/g,(o,a)=>{var r;return`${(r=t==null?void 0:t[a])!=null?r:`{${a}}`}`}),Ys=e=>{const t=w(()=>i(e).name),n=Cn(e)?e:A(e);return{lang:t,locale:n,t:Ks(e)}},Ho=Symbol("localeContextKey"),qs=e=>{const t=e||Ce(Ho,A());return Ys(w(()=>t.value||js))},Vo="__epPropKey",q=e=>e,Ws=e=>bt(e)&&!!e[Vo],Uo=(e,t)=>{if(!bt(e)||Ws(e))return e;const{values:n,required:o,default:a,type:r,validator:s}=e,p={type:r,required:!!o,validator:n||s?f=>{let C=false,x=[];if(n&&(x=Array.from(n),It(e,"default")&&x.push(a),C||(C=x.includes(f))),s&&(C||(C=s(f))),!C&&x.length>0){const T=[...new Set(x)].map(d=>JSON.stringify(d)).join(", ");ua(`Invalid prop: validation failed${t?` for prop "${t}"`:""}. Expected one of [${T}], got value ${JSON.stringify(f)}.`)}return C}:void 0,[Vo]:true};return It(e,"default")&&(p.default=a),p},Ye=e=>zo(Object.entries(e).map(([t,n])=>[t,Uo(n,t)])),jo=["","default","small","large"],On=Uo({type:String,values:jo,required:false}),Ko=Symbol("size"),Xs=()=>{const e=Ce(Ko,{});return w(()=>i(e.size)||"")},Zs=Symbol("emptyValuesContextKey"),Js=Ye({emptyValues:Array,valueOnClear:{type:q([String,Number,Boolean,Function]),default:void 0,validator:e=>(e=Ke(e)?e():e,Ua(e)?e.every(t=>!t):!e)}}),eo=e=>Object.keys(e),Zt=A();function Nn(e,t=void 0){const n=Re()?Ce(Io,Zt):Zt;return e?w(()=>{var o,a;return(a=(o=n.value)==null?void 0:o[e])!=null?a:t}):n}function Go(e,t){const n=Nn(),o=Fe(e,w(()=>{var l;return((l=n.value)==null?void 0:l.namespace)||Vt})),a=qs(w(()=>{var l;return(l=n.value)==null?void 0:l.locale})),r=Us(w(()=>{var l;return((l=n.value)==null?void 0:l.zIndex)||Fo})),s=w(()=>{var l;return i(t)||((l=n.value)==null?void 0:l.size)||""});return Yo(w(()=>i(n)||{})),{ns:o,locale:a,zIndex:r,size:s}}const Yo=(e,t,n=false)=>{var o;const a=!!Re(),r=a?Nn():void 0,s=(o=void 0)!=null?o:a?kn:void 0;if(!s)return;const l=w(()=>{const p=i(e);return r!=null&&r.value?Qs(r.value,p):p});return s(Io,l),s(Ho,w(()=>l.value.locale)),s(To,w(()=>l.value.namespace)),s(Do,w(()=>l.value.zIndex)),s(Ko,{size:w(()=>l.value.size||"")}),s(Zs,w(()=>({emptyValues:l.value.emptyValues,valueOnClear:l.value.valueOnClear}))),(n||!Zt.value)&&(Zt.value=l.value),l},Qs=(e,t)=>{const n=[...new Set([...eo(e),...eo(t)])],o={};for(const a of n)o[a]=t[a]!==void 0?t[a]:e[a];return o};var tt=(e,t)=>{const n=e.__vccOpts||e;for(const[o,a]of t)n[o]=a;return n};const on=(e,t)=>{if(e.install=n=>{for(const o of[e,...Object.values(t??{})])n.component(o.name,o)},t)for(const[n,o]of Object.entries(t))e[n]=o;return e},el=(e,t)=>(e.install=n=>{e._context=n._context,n.config.globalProperties[t]=e},e),tl=e=>(e.install=ct,e),Ut="update:modelValue",to="change",cn="input",qo=(e="")=>e.split(" ").filter(t=>!!t.trim()),nl=(e,t)=>{if(!e||!t)return false;if(t.includes(" "))throw new Error("className should not contain space.");return e.classList.contains(t)},ol=(e,t)=>{!e||!t.trim()||e.classList.add(...qo(t))},al=(e,t)=>{!e||!t.trim()||e.classList.remove(...qo(t))},rl=(e,t)=>{var n;if(!$e||!e||!t)return"";let o=Ya(t);o==="float"&&(o="cssFloat");try{const a=e.style[o];if(a)return a;const r=(n=document.defaultView)==null?void 0:n.getComputedStyle(e,"");return r?r[o]:""}catch{return e.style[o]}};function Mt(e,t="px"){if(!e&&e!==0)return"";if(Ge(e)||Ds(e))return`${e}${t}`;if(Se(e))return e}let Pt;const sl=e=>{var t;if(!$e)return 0;if(Pt!==void 0)return Pt;const n=document.createElement("div");n.className=`${e}-scrollbar__wrap`,n.style.visibility="hidden",n.style.width="100px",n.style.position="absolute",n.style.top="-9999px",document.body.appendChild(n);const o=n.offsetWidth;n.style.overflow="scroll";const a=document.createElement("div");a.style.width="100%",n.appendChild(a);const r=a.offsetWidth;return(t=n.parentNode)==null||t.removeChild(n),Pt=o-r,Pt},ll=Ye({size:{type:q([Number,String])},color:{type:String}}),il=K({name:"ElIcon",inheritAttrs:false,__name:"icon",props:ll,setup(e){const t=e,n=Fe("icon"),o=w(()=>{const{size:a,color:r}=t,s=Mt(a);return!s&&!r?{}:{fontSize:s,"--color":r}});return(a,r)=>(v(),S("i",Kt({class:i(n).b(),style:o.value},a.$attrs),[de(a.$slots,"default")],16))}});var ul=tt(il,[["__file","/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);const ze=on(ul),gt=q([String,Object,Function]),Wo={Close:Ca,SuccessFilled:Eo,InfoFilled:gn,WarningFilled:So,CircleCloseFilled:In},Jt={primary:gn,success:Eo,warning:So,error:In,info:gn},cl={validating:St,success:ya,error:ko},dl=()=>$e&&/firefox/i.test(window.navigator.userAgent),fl=()=>$e&&/android/i.test(window.navigator.userAgent);let xe;const pl={height:"0",visibility:"hidden",overflow:dl()?"":"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},vl=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],no=e=>{const t=Number.parseFloat(e);return Number.isNaN(t)?e:t};function ml(e){const t=window.getComputedStyle(e),n=t.getPropertyValue("box-sizing"),o=Number.parseFloat(t.getPropertyValue("padding-bottom"))+Number.parseFloat(t.getPropertyValue("padding-top")),a=Number.parseFloat(t.getPropertyValue("border-bottom-width"))+Number.parseFloat(t.getPropertyValue("border-top-width"));return{contextStyle:vl.map(s=>[s,t.getPropertyValue(s)]),paddingSize:o,borderSize:a,boxSizing:n}}function oo(e,t=1,n){var o,a;xe||(xe=document.createElement("textarea"),((o=e.parentNode)!=null?o:document.body).appendChild(xe));const{paddingSize:r,borderSize:s,boxSizing:l,contextStyle:p}=ml(e);p.forEach(([T,d])=>xe==null?void 0:xe.style.setProperty(T,d)),Object.entries(pl).forEach(([T,d])=>xe==null?void 0:xe.style.setProperty(T,d,"important")),xe.value=e.value||e.placeholder||"";let f=xe.scrollHeight;const C={};l==="border-box"?f=f+s:l==="content-box"&&(f=f-r),xe.value="";const x=xe.scrollHeight-r;if(Ge(t)){let T=x*t;l==="border-box"&&(T=T+r+s),f=Math.max(T,f),C.minHeight=`${T}px`}if(Ge(n)){let T=x*n;l==="border-box"&&(T=T+r+s),f=Math.min(T,f)}return C.height=`${f}px`,(a=xe.parentNode)==null||a.removeChild(xe),xe=void 0,C}const Xo=e=>e,hl=Ye({ariaLabel:String,ariaOrientation:{type:String,values:["horizontal","vertical","undefined"]},ariaControls:String}),gl=e=>Rs(hl,e),bl=Ye({id:{type:String,default:void 0},size:On,disabled:{type:Boolean,default:void 0},modelValue:{type:q([String,Number,Object]),default:""},modelModifiers:{type:q(Object),default:()=>({})},maxlength:{type:[String,Number]},minlength:{type:[String,Number]},type:{type:q(String),default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:q([Boolean,Object]),default:false},autocomplete:{type:q(String),default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:String},form:{type:String},readonly:Boolean,clearable:Boolean,clearIcon:{type:gt,default:ko},showPassword:Boolean,showWordLimit:Boolean,wordLimitPosition:{type:String,values:["inside","outside"],default:"inside"},suffixIcon:{type:gt},prefixIcon:{type:gt},containerRole:{type:String,default:void 0},tabindex:{type:[String,Number],default:0},validateEvent:{type:Boolean,default:true},inputStyle:{type:q([Object,Array,String]),default:()=>Xo({})},autofocus:Boolean,rows:{type:Number,default:2},...gl(["ariaLabel"]),inputmode:{type:q(String),default:void 0},name:String}),yl={[Ut]:e=>Se(e),input:e=>Se(e),change:(e,t)=>Se(e)&&(t instanceof Event||t===void 0),focus:e=>e instanceof FocusEvent,blur:e=>e instanceof FocusEvent,clear:()=>true,mouseleave:e=>e instanceof MouseEvent,mouseenter:e=>e instanceof MouseEvent,keydown:e=>e instanceof Event,compositionstart:e=>e instanceof CompositionEvent,compositionupdate:e=>e instanceof CompositionEvent,compositionend:e=>e instanceof CompositionEvent},wl=["class","style"],xl=/^on[A-Z]/,_l=(e={})=>{const{excludeListeners:t=false,excludeKeys:n}=e,o=w(()=>((n==null?void 0:n.value)||[]).concat(wl)),a=Re();return a?w(()=>{var r;return zo(Object.entries((r=a.proxy)==null?void 0:r.$attrs).filter(([s])=>!o.value.includes(s)&&!(t&&xl.test(s))))}):w(()=>({}))},ao={prefix:Math.floor(Math.random()*1e4),current:0},Cl=Symbol("elIdInjection"),kl=()=>Re()?Ce(Cl,ao):ao,yn=e=>{const t=kl(),n=Mo();return ha(()=>i(e)||`${n.value}-id-${t.prefix}-${t.current++}`)},zn=Symbol("formContextKey"),Zo=Symbol("formItemContextKey"),Jo=()=>{const e=Ce(zn,void 0),t=Ce(Zo,void 0);return{form:e,formItem:t}},El=(e,{formItemContext:t,disableIdGeneration:n,disableIdManagement:o})=>{n||(n=A(false)),o||(o=A(false));const a=Re(),r=()=>{let f=a==null?void 0:a.parent;for(;f;){if(f.type.name==="ElFormItem")return false;if(f.type.name==="ElLabelWrap")return true;f=f.parent}return false},s=A();let l;const p=w(()=>{var f;return!!(!(e.label||e.ariaLabel)&&t&&t.inputIds&&((f=t.inputIds)==null?void 0:f.length)<=1)});return De(()=>{l=ye([Gt(e,"id"),n],([f,C])=>{const x=f??(C?void 0:yn().value);x!==s.value&&(t!=null&&t.removeInputId&&!r()&&(s.value&&t.removeInputId(s.value),!(o!=null&&o.value)&&!C&&x&&t.addInputId(x)),s.value=x)},{immediate:true})}),En(()=>{l&&l(),t!=null&&t.removeInputId&&s.value&&t.removeInputId(s.value)}),{isLabeledByFormItem:p,inputId:s}},Qo=e=>{const t=Re();return w(()=>{var n,o;return(o=(n=t==null?void 0:t.proxy)==null?void 0:n.$props)==null?void 0:o[e]})},ea=(e,t={})=>{const n=A(void 0),o=t.prop?n:Qo("size"),a=t.global?n:Xs(),r=t.form?{size:void 0}:Ce(zn,void 0),s=t.formItem?{size:void 0}:Ce(Zo,void 0);return w(()=>o.value||i(e)||(s==null?void 0:s.size)||(r==null?void 0:r.size)||a.value||"")},Rn=e=>{const t=Qo("disabled"),n=Ce(zn,void 0);return w(()=>{var o,a,r;return(r=(a=(o=t.value)!=null?o:i(e))!=null?a:n==null?void 0:n.disabled)!=null?r:false})},Sl='a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])',ro=e=>typeof Element>"u"?false:e instanceof Element,Il=e=>getComputedStyle(e).position==="fixed"?false:e.offsetParent!==null,so=e=>Array.from(e.querySelectorAll(Sl)).filter(t=>Fn(t)&&Il(t)),Fn=e=>{if(e.tabIndex>0||e.tabIndex===0&&e.getAttribute("tabIndex")!==null)return true;if(e.tabIndex<0||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true")return false;switch(e.nodeName){case"A":return!!e.href&&e.rel!=="ignore";case"INPUT":return!(e.type==="hidden"||e.type==="file");case"BUTTON":case"SELECT":case"TEXTAREA":return true;default:return false}},Tl=(e,t)=>{if(!e||!e.focus)return;let n=false;ro(e)&&!Fn(e)&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","-1"),n=true),e.focus(t),ro(e)&&n&&e.removeAttribute("tabindex")};function Ml(e,{disabled:t,beforeFocus:n,afterFocus:o,beforeBlur:a,afterBlur:r}={}){const s=Re(),{emit:l}=s,p=Dt(),f=A(false),C=d=>{const c=Ke(n)?n(d):false;i(t)||f.value||c||(f.value=true,l("focus",d),o==null||o())},x=d=>{var c;const u=Ke(a)?a(d):false;i(t)||d.relatedTarget&&((c=p.value)!=null&&c.contains(d.relatedTarget))||u||(f.value=false,l("blur",d),r==null||r())},T=d=>{var c,u;i(t)||Fn(d.target)||(c=p.value)!=null&&c.contains(document.activeElement)&&p.value!==document.activeElement||(u=e.value)==null||u.focus()};return ye([p,()=>i(t)],([d,c])=>{d&&(c?d.removeAttribute("tabindex"):d.setAttribute("tabindex","-1"))}),Ht(p,"focus",C,true),Ht(p,"blur",x,true),Ht(p,"click",T,true),{isFocused:f,wrapperRef:p,handleFocus:C,handleBlur:x}}const Ll=e=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(e);function Al({afterComposition:e,emit:t}){const n=A(false),o=l=>{t==null||t("compositionstart",l),n.value=true},a=l=>{var p;t==null||t("compositionupdate",l);const f=(p=l.target)==null?void 0:p.value,C=f[f.length-1]||"";n.value=!Ll(C)},r=l=>{t==null||t("compositionend",l),n.value&&(n.value=false,oe(()=>e(l)))};return{isComposing:n,handleComposition:l=>{l.type==="compositionend"?r(l):a(l)},handleCompositionStart:o,handleCompositionUpdate:a,handleCompositionEnd:r}}function Bl(e){let t;function n(){if(e.value==null)return;const{selectionStart:a,selectionEnd:r,value:s}=e.value;if(a==null||r==null)return;const l=s.slice(0,Math.max(0,a)),p=s.slice(Math.max(0,r));t={selectionStart:a,selectionEnd:r,value:s,beforeTxt:l,afterTxt:p}}function o(){if(e.value==null||t==null)return;const{value:a}=e.value,{beforeTxt:r,afterTxt:s,selectionStart:l}=t;if(r==null||s==null||l==null)return;let p=a.length;if(a.endsWith(s))p=a.length-s.length;else if(a.startsWith(r))p=r.length;else{const f=r[l-1],C=a.indexOf(f,l-1);C!==-1&&(p=C+1)}e.value.setSelectionRange(p,p)}return[n,o]}const $l=["id","name","minlength","maxlength","type","disabled","readonly","autocomplete","tabindex","aria-label","placeholder","form","autofocus","role","inputmode"],Pl=["id","name","minlength","maxlength","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form","autofocus","rows","role"],Ol="ElInput",Nl=K({name:Ol,inheritAttrs:false,__name:"input",props:bl,emits:yl,setup(e,{expose:t,emit:n}){const o=e,a=n,r=ca(),s=_l(),l=xo(),p=w(()=>[o.type==="textarea"?b.b():u.b(),u.m(d.value),u.is("disabled",c.value),u.is("exceed",_t.value),{[u.b("group")]:l.prepend||l.append,[u.m("prefix")]:l.prefix||o.prefixIcon,[u.m("suffix")]:l.suffix||o.suffixIcon||o.clearable||o.showPassword,[u.bm("suffix","password-clear")]:X.value&&Oe.value,[u.b("hidden")]:o.type==="hidden"},r.class]),f=w(()=>[u.e("wrapper"),u.is("focus",Z.value)]),{form:C,formItem:x}=Jo(),{inputId:T}=El(o,{formItemContext:x}),d=ea(),c=Rn(),u=Fe("input"),b=Fe("textarea"),h=Dt(),m=Dt(),I=A(false),z=A(false),D=A(),G=Dt(o.inputStyle),H=w(()=>h.value||m.value),{wrapperRef:V,isFocused:Z,handleFocus:re,handleBlur:he}=Ml(H,{disabled:c,afterBlur(){var g;o.validateEvent&&((g=x==null?void 0:x.validate)==null||g.call(x,"blur").catch($=>void 0))}}),J=w(()=>{var g;return(g=C==null?void 0:C.statusIcon)!=null?g:false}),N=w(()=>(x==null?void 0:x.validateState)||""),ge=w(()=>N.value&&cl[N.value]),Pe=w(()=>z.value?Fa:Ma),nt=w(()=>[r.style]),U=w(()=>[o.inputStyle,G.value,{resize:o.resize}]),W=w(()=>Ro(o.modelValue)?"":String(o.modelValue)),X=w(()=>o.clearable&&!c.value&&!o.readonly&&!!W.value&&(Z.value||I.value)),Oe=w(()=>o.showPassword&&!c.value&&!!W.value),we=w(()=>o.showWordLimit&&!!o.maxlength&&(o.type==="text"||o.type==="textarea")&&!c.value&&!o.readonly&&!o.showPassword),ee=w(()=>W.value.length),_t=w(()=>!!we.value&&ee.value>Number(o.maxlength)),ot=w(()=>!!l.suffix||!!o.suffixIcon||X.value||o.showPassword||we.value||!!N.value&&J.value),He=w(()=>!!Object.keys(o.modelModifiers).length),[_,E]=Bl(h);Co(m,g=>{if(j(),!we.value||o.resize!=="both"&&o.resize!=="horizontal")return;const $=g[0],{width:R}=$.contentRect;D.value={right:`calc(100% - ${R+22-10}px)`}});const se=()=>{const{type:g,autosize:$}=o;if(!(!$e||g!=="textarea"||!m.value))if($){const R=bt($)?$.minRows:void 0,mt=bt($)?$.maxRows:void 0,Ct=oo(m.value,R,mt);G.value={overflowY:"hidden",...Ct},oe(()=>{m.value.offsetHeight,G.value=Ct})}else G.value={minHeight:oo(m.value).minHeight}},j=(g=>{let $=false;return()=>{var R;if($||!o.autosize)return;((R=m.value)==null?void 0:R.offsetParent)===null||(setTimeout(g),$=true)}})(se),te=()=>{const g=H.value,$=o.formatter?o.formatter(W.value):W.value;!g||g.value===$||o.type==="file"||(g.value=$)},be=g=>{const{trim:$,number:R}=o.modelModifiers;return $&&(g=g.trim()),R&&(g=`${no(g)}`),o.formatter&&o.parser&&(g=o.parser(g)),g},ne=async g=>{if(at.value)return;const{lazy:$}=o.modelModifiers;let{value:R}=g.target;if($){a(cn,R);return}if(R=be(R),String(R)===W.value){o.formatter&&te();return}_(),a(Ut,R),a(cn,R),await oe(),(o.formatter&&o.parser||!He.value)&&te(),E()},Ve=async g=>{let{value:$}=g.target;$=be($),o.modelModifiers.lazy&&a(Ut,$),a(to,$,g),await oe(),te()},{isComposing:at,handleCompositionStart:ae,handleCompositionUpdate:le,handleCompositionEnd:Ue}=Al({emit:a,afterComposition:ne}),rt=()=>{z.value=!z.value},k=()=>{var g;return(g=H.value)==null?void 0:g.focus()},pe=()=>{var g;return(g=H.value)==null?void 0:g.blur()},Ie=g=>{I.value=false,a("mouseleave",g)},st=g=>{I.value=true,a("mouseenter",g)},Ee=g=>{a("keydown",g)},Te=()=>{var g;(g=H.value)==null||g.select()},Vn=()=>{a(Ut,""),a(to,""),a("clear"),a(cn,"")};return ye(()=>o.modelValue,()=>{var g;oe(()=>se()),o.validateEvent&&((g=x==null?void 0:x.validate)==null||g.call(x,"change").catch($=>void 0))}),ye(W,g=>{if(!H.value)return;const{trim:$,number:R}=o.modelModifiers,mt=H.value.value,Ct=(R||o.type==="number")&&!/^0\d/.test(mt)?`${no(mt)}`:mt;Ct!==g&&(document.activeElement===H.value&&H.value.type!=="range"&&$&&Ct.trim()===g||te())}),ye(()=>o.type,async()=>{await oe(),te(),se()}),De(()=>{!o.formatter&&o.parser,te(),oe(se)}),t({input:h,textarea:m,ref:H,textareaStyle:U,autosize:Gt(o,"autosize"),isComposing:at,focus:k,blur:pe,select:Te,clear:Vn,resizeTextarea:se}),(g,$)=>(v(),S("div",{class:M([p.value,{[i(u).bm("group","append")]:g.$slots.append,[i(u).bm("group","prepend")]:g.$slots.prepend}]),style:dt(nt.value),onMouseenter:st,onMouseleave:Ie},[P(" input "),g.type!=="textarea"?(v(),S(ie,{key:0},[P(" prepend slot "),g.$slots.prepend?(v(),S("div",{key:0,class:M(i(u).be("group","prepend"))},[de(g.$slots,"prepend")],2)):P("v-if",true),y("div",{ref_key:"wrapperRef",ref:V,class:M(f.value)},[P(" prefix slot "),g.$slots.prefix||g.prefixIcon?(v(),S("span",{key:0,class:M(i(u).e("prefix"))},[y("span",{class:M(i(u).e("prefix-inner"))},[de(g.$slots,"prefix"),g.prefixIcon?(v(),O(i(ze),{key:0,class:M(i(u).e("icon"))},{default:L(()=>[(v(),O(_e(g.prefixIcon)))]),_:1},8,["class"])):P("v-if",true)],2)],2)):P("v-if",true),y("input",Kt({id:i(T),ref_key:"input",ref:h,class:i(u).e("inner")},i(s),{name:g.name,minlength:g.minlength,maxlength:g.maxlength,type:g.showPassword?z.value?"text":"password":g.type,disabled:i(c),readonly:g.readonly,autocomplete:g.autocomplete,tabindex:g.tabindex,"aria-label":g.ariaLabel,placeholder:g.placeholder,style:g.inputStyle,form:g.form,autofocus:g.autofocus,role:g.containerRole,inputmode:g.inputmode,onCompositionstart:$[0]||($[0]=(...R)=>i(ae)&&i(ae)(...R)),onCompositionupdate:$[1]||($[1]=(...R)=>i(le)&&i(le)(...R)),onCompositionend:$[2]||($[2]=(...R)=>i(Ue)&&i(Ue)(...R)),onInput:ne,onChange:Ve,onKeydown:Ee}),null,16,$l),P(" suffix slot "),ot.value?(v(),S("span",{key:1,class:M(i(u).e("suffix"))},[y("span",{class:M(i(u).e("suffix-inner"))},[!X.value||!Oe.value||!we.value?(v(),S(ie,{key:0},[de(g.$slots,"suffix"),g.suffixIcon?(v(),O(i(ze),{key:0,class:M(i(u).e("icon"))},{default:L(()=>[(v(),O(_e(g.suffixIcon)))]),_:1},8,["class"])):P("v-if",true)],64)):P("v-if",true),X.value?(v(),O(i(ze),{key:1,class:M([i(u).e("icon"),i(u).e("clear")]),onMousedown:Ae(i(ct),["prevent"]),onClick:Vn},{default:L(()=>[(v(),O(_e(g.clearIcon)))]),_:1},8,["class","onMousedown"])):P("v-if",true),Oe.value?(v(),O(i(ze),{key:2,class:M([i(u).e("icon"),i(u).e("password")]),onClick:rt,onMousedown:Ae(i(ct),["prevent"]),onMouseup:Ae(i(ct),["prevent"])},{default:L(()=>[(v(),O(_e(Pe.value)))]),_:1},8,["class","onMousedown","onMouseup"])):P("v-if",true),we.value?(v(),S("span",{key:3,class:M([i(u).e("count"),i(u).is("outside",g.wordLimitPosition==="outside")])},[y("span",{class:M(i(u).e("count-inner"))},Y(ee.value)+" / "+Y(g.maxlength),3)],2)):P("v-if",true),N.value&&ge.value&&J.value?(v(),O(i(ze),{key:4,class:M([i(u).e("icon"),i(u).e("validateIcon"),i(u).is("loading",N.value==="validating")])},{default:L(()=>[(v(),O(_e(ge.value)))]),_:1},8,["class"])):P("v-if",true)],2)],2)):P("v-if",true)],2),P(" append slot "),g.$slots.append?(v(),S("div",{key:1,class:M(i(u).be("group","append"))},[de(g.$slots,"append")],2)):P("v-if",true)],64)):(v(),S(ie,{key:1},[P(" textarea "),y("textarea",Kt({id:i(T),ref_key:"textarea",ref:m,class:[i(b).e("inner"),i(u).is("focus",i(Z))]},i(s),{name:g.name,minlength:g.minlength,maxlength:g.maxlength,tabindex:g.tabindex,disabled:i(c),readonly:g.readonly,autocomplete:g.autocomplete,style:U.value,"aria-label":g.ariaLabel,placeholder:g.placeholder,form:g.form,autofocus:g.autofocus,rows:g.rows,role:g.containerRole,onCompositionstart:$[3]||($[3]=(...R)=>i(ae)&&i(ae)(...R)),onCompositionupdate:$[4]||($[4]=(...R)=>i(le)&&i(le)(...R)),onCompositionend:$[5]||($[5]=(...R)=>i(Ue)&&i(Ue)(...R)),onInput:ne,onFocus:$[6]||($[6]=(...R)=>i(re)&&i(re)(...R)),onBlur:$[7]||($[7]=(...R)=>i(he)&&i(he)(...R)),onChange:Ve,onKeydown:Ee}),null,16,Pl),we.value?(v(),S("span",{key:0,style:dt(D.value),class:M([i(u).e("count"),i(u).is("outside",g.wordLimitPosition==="outside")])},Y(ee.value)+" / "+Y(g.maxlength),7)):P("v-if",true)],64))],38))}});var zl=tt(Nl,[["__file","/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);const Rl=on(zl),dn="focus-trap.focus-after-trapped",fn="focus-trap.focus-after-released",Fl="focus-trap.focusout-prevented",lo={cancelable:true,bubbles:false},Dl={cancelable:true,bubbles:false},io="focusAfterTrapped",uo="focusAfterReleased",Hl=Symbol("elFocusTrap"),Dn=A(),an=A(0),Hn=A(0);let Ot=0;const ta=e=>{const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const a=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||a?NodeFilter.FILTER_SKIP:o.tabIndex>=0||o===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t},co=(e,t)=>{for(const n of e)if(!Vl(n,t))return n},Vl=(e,t)=>{if(getComputedStyle(e).visibility==="hidden")return true;for(;e;){if(t&&e===t)return false;if(getComputedStyle(e).display==="none")return true;e=e.parentElement}return false},Ul=e=>{const t=ta(e),n=co(t,e),o=co(t.reverse(),e);return[n,o]},jl=e=>e instanceof HTMLInputElement&&"select"in e,We=(e,t)=>{if(e){const n=document.activeElement;Tl(e,{preventScroll:true}),Hn.value=window.performance.now(),e!==n&&jl(e)&&t&&e.select()}};function fo(e,t){const n=[...e],o=e.indexOf(t);return o!==-1&&n.splice(o,1),n}const Kl=()=>{let e=[];return{push:o=>{const a=e[0];a&&o!==a&&a.pause(),e=fo(e,o),e.unshift(o)},remove:o=>{var a,r;e=fo(e,o),(r=(a=e[0])==null?void 0:a.resume)==null||r.call(a)}}},Gl=(e,t=false)=>{const n=document.activeElement;for(const o of e)if(We(o,t),document.activeElement!==n)return},po=Kl(),Yl=()=>an.value>Hn.value,Nt=()=>{Dn.value="pointer",an.value=window.performance.now()},vo=()=>{Dn.value="keyboard",an.value=window.performance.now()},ql=()=>(De(()=>{Ot===0&&(document.addEventListener("mousedown",Nt),document.addEventListener("touchstart",Nt),document.addEventListener("keydown",vo)),Ot++}),Bt(()=>{Ot--,Ot<=0&&(document.removeEventListener("mousedown",Nt),document.removeEventListener("touchstart",Nt),document.removeEventListener("keydown",vo))}),{focusReason:Dn,lastUserFocusTimestamp:an,lastAutomatedFocusTimestamp:Hn}),zt=e=>new CustomEvent(Fl,{...Dl,detail:e}),yt={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},rn=e=>{if(e.code&&e.code!=="Unidentified")return e.code;const t=Wl(e);if(t){if(Object.values(yt).includes(t))return t;switch(t){case" ":return yt.space;default:return""}}return""},Wl=e=>{let t=e.key&&e.key!=="Unidentified"?e.key:"";if(!t&&e.type==="keyup"&&fl()){const n=e.target;t=n.value.charAt(n.selectionStart-1)}return t};let ht=[];const mo=e=>{rn(e)===yt.esc&&ht.forEach(n=>n(e))},Xl=e=>{De(()=>{ht.length===0&&document.addEventListener("keydown",mo),$e&&ht.push(e)}),Bt(()=>{ht=ht.filter(t=>t!==e),ht.length===0&&$e&&document.removeEventListener("keydown",mo)})},Zl=K({name:"ElFocusTrap",inheritAttrs:false,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[io,uo,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:t}){const n=A();let o,a;const{focusReason:r}=ql();Xl(c=>{e.trapped&&!s.paused&&t("release-requested",c)});const s={paused:false,pause(){this.paused=true},resume(){this.paused=false}},l=c=>{if(!e.loop&&!e.trapped||s.paused)return;const{altKey:u,ctrlKey:b,metaKey:h,currentTarget:m,shiftKey:I}=c,{loop:z}=e,G=rn(c)===yt.tab&&!u&&!b&&!h,H=document.activeElement;if(G&&H){const V=m,[Z,re]=Ul(V);if(Z&&re){if(!I&&H===re){const J=zt({focusReason:r.value});t("focusout-prevented",J),J.defaultPrevented||(c.preventDefault(),z&&We(Z,true))}else if(I&&[Z,V].includes(H)){const J=zt({focusReason:r.value});t("focusout-prevented",J),J.defaultPrevented||(c.preventDefault(),z&&We(re,true))}}else if(H===V){const J=zt({focusReason:r.value});t("focusout-prevented",J),J.defaultPrevented||c.preventDefault()}}};kn(Hl,{focusTrapRef:n,onKeydown:l}),ye(()=>e.focusTrapEl,c=>{c&&(n.value=c)},{immediate:true}),ye([n],([c],[u])=>{c&&(c.addEventListener("keydown",l),c.addEventListener("focusin",C),c.addEventListener("focusout",x)),u&&(u.removeEventListener("keydown",l),u.removeEventListener("focusin",C),u.removeEventListener("focusout",x))});const p=c=>{t(io,c)},f=c=>t(uo,c),C=c=>{const u=i(n);if(!u)return;const b=c.target,h=c.relatedTarget,m=b&&u.contains(b);e.trapped||h&&u.contains(h)||(o=h),m&&t("focusin",c),!s.paused&&e.trapped&&(m?a=b:We(a,true))},x=c=>{const u=i(n);if(!(s.paused||!u))if(e.trapped){const b=c.relatedTarget;!Ro(b)&&!u.contains(b)&&setTimeout(()=>{if(!s.paused&&e.trapped){const h=zt({focusReason:r.value});t("focusout-prevented",h),h.defaultPrevented||We(a,true)}},0)}else{const b=c.target;b&&u.contains(b)||t("focusout",c)}};async function T(){await oe();const c=i(n);if(c){po.push(s);const u=c.contains(document.activeElement)?o:document.activeElement;if(o=u,!c.contains(u)){const h=new Event(dn,lo);c.addEventListener(dn,p),c.dispatchEvent(h),h.defaultPrevented||oe(()=>{let m=e.focusStartEl;Se(m)||(We(m),document.activeElement!==m&&(m="first")),m==="first"&&Gl(ta(c),true),(document.activeElement===u||m==="container")&&We(c)})}}}function d(){const c=i(n);if(c){c.removeEventListener(dn,p);const u=new CustomEvent(fn,{...lo,detail:{focusReason:r.value}});c.addEventListener(fn,f),c.dispatchEvent(u),!u.defaultPrevented&&(r.value=="keyboard"||!Yl()||c.contains(document.activeElement))&&We(o??document.body),c.removeEventListener(fn,f),po.remove(s),o=null,a=null}}return De(()=>{e.trapped&&T(),ye(()=>e.trapped,c=>{c?T():d()})}),Bt(()=>{e.trapped&&d(),n.value&&(n.value.removeEventListener("keydown",l),n.value.removeEventListener("focusin",C),n.value.removeEventListener("focusout",x),n.value=void 0),o=null,a=null}),{onKeydown:l}}});function Jl(e,t,n,o,a,r){return de(e.$slots,"default",{handleKeydown:e.onKeydown})}var Ql=tt(Zl,[["render",Jl],["__file","/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);const ei=Ye({value:{type:[String,Number],default:""},max:{type:Number,default:99},isDot:Boolean,hidden:Boolean,type:{type:String,values:["primary","success","warning","info","danger"],default:"danger"},showZero:{type:Boolean,default:true},color:String,badgeStyle:{type:q([String,Object,Array])},offset:{type:q(Array),default:[0,0]},badgeClass:{type:String}}),ti=K({name:"ElBadge",__name:"badge",props:ei,setup(e,{expose:t}){const n=e,o=Fe("badge"),a=w(()=>n.isDot?"":Ge(n.value)&&Ge(n.max)?n.max<n.value?`${n.max}+`:`${n.value}`:`${n.value}`),r=w(()=>{var s;return[{backgroundColor:n.color,marginRight:Mt(-n.offset[0]),marginTop:Mt(n.offset[1])},(s=n.badgeStyle)!=null?s:{}]});return t({content:a}),(s,l)=>(v(),S("div",{class:M(i(o).b())},[de(s.$slots,"default"),B(Sn,{name:`${i(o).namespace.value}-zoom-in-center`,persisted:""},{default:L(()=>[Je(y("sup",{class:M([i(o).e("content"),i(o).em("content",s.type),i(o).is("fixed",!!s.$slots.default),i(o).is("dot",s.isDot),i(o).is("hide-zero",!s.showZero&&s.value===0),s.badgeClass]),style:dt(r.value)},[de(s.$slots,"content",{value:a.value},()=>[ce(Y(a.value),1)])],6),[[Qe,!s.hidden&&(a.value||s.isDot||s.$slots.content)]])]),_:3},8,["name"])],2))}});var ni=tt(ti,[["__file","/home/runner/work/element-plus/element-plus/packages/components/badge/src/badge.vue"]]);const oi=on(ni),na=Symbol("buttonGroupContextKey"),ai=({from:e,replacement:t,scope:n,version:o,ref:a,type:r="API"},s)=>{ye(()=>i(s),l=>{},{immediate:true})},ri=(e,t)=>{ai({from:"type.text",replacement:"link",version:"3.0.0",scope:"props",ref:"https://element-plus.org/en-US/component/button.html#button-attributes"},w(()=>e.type==="text"));const n=Ce(na,void 0),o=Nn("button"),{form:a}=Jo(),r=ea(w(()=>n==null?void 0:n.size)),s=Rn(),l=A(),p=xo(),f=w(()=>{var h;return e.type||(n==null?void 0:n.type)||((h=o.value)==null?void 0:h.type)||""}),C=w(()=>{var h,m,I;return(I=(m=e.autoInsertSpace)!=null?m:(h=o.value)==null?void 0:h.autoInsertSpace)!=null?I:false}),x=w(()=>{var h,m,I;return(I=(m=e.plain)!=null?m:(h=o.value)==null?void 0:h.plain)!=null?I:false}),T=w(()=>{var h,m,I;return(I=(m=e.round)!=null?m:(h=o.value)==null?void 0:h.round)!=null?I:false}),d=w(()=>{var h,m,I;return(I=(m=e.text)!=null?m:(h=o.value)==null?void 0:h.text)!=null?I:false}),c=w(()=>e.tag==="button"?{ariaDisabled:s.value||e.loading,disabled:s.value||e.loading,autofocus:e.autofocus,type:e.nativeType}:{}),u=w(()=>{var h;const m=(h=p.default)==null?void 0:h.call(p);if(C.value&&(m==null?void 0:m.length)===1){const I=m[0];if((I==null?void 0:I.type)===da){const z=I.children;return new RegExp("^\\p{Unified_Ideograph}{2}$","u").test(z.trim())}}return false});return{_disabled:s,_size:r,_type:f,_ref:l,_props:c,_plain:x,_round:T,_text:d,shouldAddSpace:u,handleClick:h=>{if(s.value||e.loading){h.stopPropagation();return}e.nativeType==="reset"&&(a==null||a.resetFields()),t("click",h)}}},si=["default","primary","success","warning","info","danger","text",""],li=["button","submit","reset"],wn=Ye({size:On,disabled:{type:Boolean,default:void 0},type:{type:String,values:si,default:""},icon:{type:gt},nativeType:{type:String,values:li,default:"button"},loading:Boolean,loadingIcon:{type:gt,default:()=>St},plain:{type:Boolean,default:void 0},text:{type:Boolean,default:void 0},link:Boolean,bg:Boolean,autofocus:Boolean,round:{type:Boolean,default:void 0},circle:Boolean,color:String,dark:Boolean,autoInsertSpace:{type:Boolean,default:void 0},tag:{type:q([String,Object]),default:"button"}}),ii={click:e=>e instanceof MouseEvent};function fe(e,t){ui(e)&&(e="100%");var n=ci(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(t===360?e=(e<0?e%t+t:e%t)/parseFloat(String(t)):e=e%t/parseFloat(String(t)),e)}function Rt(e){return Math.min(1,Math.max(0,e))}function ui(e){return typeof e=="string"&&e.indexOf(".")!==-1&&parseFloat(e)===1}function ci(e){return typeof e=="string"&&e.indexOf("%")!==-1}function oa(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Ft(e){return e<=1?"".concat(Number(e)*100,"%"):e}function it(e){return e.length===1?"0"+e:String(e)}function di(e,t,n){return{r:fe(e,255)*255,g:fe(t,255)*255,b:fe(n,255)*255}}function ho(e,t,n){e=fe(e,255),t=fe(t,255),n=fe(n,255);var o=Math.max(e,t,n),a=Math.min(e,t,n),r=0,s=0,l=(o+a)/2;if(o===a)s=0,r=0;else{var p=o-a;switch(s=l>.5?p/(2-o-a):p/(o+a),o){case e:r=(t-n)/p+(t<n?6:0);break;case t:r=(n-e)/p+2;break;case n:r=(e-t)/p+4;break}r/=6}return{h:r,s,l}}function pn(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*(6*n):n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function fi(e,t,n){var o,a,r;if(e=fe(e,360),t=fe(t,100),n=fe(n,100),t===0)a=n,r=n,o=n;else{var s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;o=pn(l,s,e+1/3),a=pn(l,s,e),r=pn(l,s,e-1/3)}return{r:o*255,g:a*255,b:r*255}}function go(e,t,n){e=fe(e,255),t=fe(t,255),n=fe(n,255);var o=Math.max(e,t,n),a=Math.min(e,t,n),r=0,s=o,l=o-a,p=o===0?0:l/o;if(o===a)r=0;else{switch(o){case e:r=(t-n)/l+(t<n?6:0);break;case t:r=(n-e)/l+2;break;case n:r=(e-t)/l+4;break}r/=6}return{h:r,s:p,v:s}}function pi(e,t,n){e=fe(e,360)*6,t=fe(t,100),n=fe(n,100);var o=Math.floor(e),a=e-o,r=n*(1-t),s=n*(1-a*t),l=n*(1-(1-a)*t),p=o%6,f=[n,s,r,r,l,n][p],C=[l,n,n,s,r,r][p],x=[r,r,l,n,n,s][p];return{r:f*255,g:C*255,b:x*255}}function bo(e,t,n,o){var a=[it(Math.round(e).toString(16)),it(Math.round(t).toString(16)),it(Math.round(n).toString(16))];return o&&a[0].startsWith(a[0].charAt(1))&&a[1].startsWith(a[1].charAt(1))&&a[2].startsWith(a[2].charAt(1))?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function vi(e,t,n,o,a){var r=[it(Math.round(e).toString(16)),it(Math.round(t).toString(16)),it(Math.round(n).toString(16)),it(mi(o))];return a&&r[0].startsWith(r[0].charAt(1))&&r[1].startsWith(r[1].charAt(1))&&r[2].startsWith(r[2].charAt(1))&&r[3].startsWith(r[3].charAt(1))?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0)+r[3].charAt(0):r.join("")}function mi(e){return Math.round(parseFloat(e)*255).toString(16)}function yo(e){return ke(e)/255}function ke(e){return parseInt(e,16)}function hi(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var xn={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function gi(e){var t={r:0,g:0,b:0},n=1,o=null,a=null,r=null,s=false,l=false;return typeof e=="string"&&(e=wi(e)),typeof e=="object"&&(je(e.r)&&je(e.g)&&je(e.b)?(t=di(e.r,e.g,e.b),s=true,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):je(e.h)&&je(e.s)&&je(e.v)?(o=Ft(e.s),a=Ft(e.v),t=pi(e.h,o,a),s=true,l="hsv"):je(e.h)&&je(e.s)&&je(e.l)&&(o=Ft(e.s),r=Ft(e.l),t=fi(e.h,o,r),s=true,l="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(n=e.a)),n=oa(n),{ok:s,format:e.format||l,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var bi="[-\\+]?\\d+%?",yi="[-\\+]?\\d*\\.\\d+%?",Ze="(?:".concat(yi,")|(?:").concat(bi,")"),vn="[\\s|\\(]+(".concat(Ze,")[,|\\s]+(").concat(Ze,")[,|\\s]+(").concat(Ze,")\\s*\\)?"),mn="[\\s|\\(]+(".concat(Ze,")[,|\\s]+(").concat(Ze,")[,|\\s]+(").concat(Ze,")[,|\\s]+(").concat(Ze,")\\s*\\)?"),Me={CSS_UNIT:new RegExp(Ze),rgb:new RegExp("rgb"+vn),rgba:new RegExp("rgba"+mn),hsl:new RegExp("hsl"+vn),hsla:new RegExp("hsla"+mn),hsv:new RegExp("hsv"+vn),hsva:new RegExp("hsva"+mn),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function wi(e){if(e=e.trim().toLowerCase(),e.length===0)return false;var t=false;if(xn[e])e=xn[e],t=true;else if(e==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n=Me.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=Me.rgba.exec(e),n?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Me.hsl.exec(e),n?{h:n[1],s:n[2],l:n[3]}:(n=Me.hsla.exec(e),n?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Me.hsv.exec(e),n?{h:n[1],s:n[2],v:n[3]}:(n=Me.hsva.exec(e),n?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Me.hex8.exec(e),n?{r:ke(n[1]),g:ke(n[2]),b:ke(n[3]),a:yo(n[4]),format:t?"name":"hex8"}:(n=Me.hex6.exec(e),n?{r:ke(n[1]),g:ke(n[2]),b:ke(n[3]),format:t?"name":"hex"}:(n=Me.hex4.exec(e),n?{r:ke(n[1]+n[1]),g:ke(n[2]+n[2]),b:ke(n[3]+n[3]),a:yo(n[4]+n[4]),format:t?"name":"hex8"}:(n=Me.hex3.exec(e),n?{r:ke(n[1]+n[1]),g:ke(n[2]+n[2]),b:ke(n[3]+n[3]),format:t?"name":"hex"}:false)))))))))}function je(e){return!!Me.CSS_UNIT.exec(String(e))}var xi=function(){function e(t,n){t===void 0&&(t=""),n===void 0&&(n={});var o;if(t instanceof e)return t;typeof t=="number"&&(t=hi(t)),this.originalInput=t;var a=gi(t);this.originalInput=t,this.r=a.r,this.g=a.g,this.b=a.b,this.a=a.a,this.roundA=Math.round(100*this.a)/100,this.format=(o=n.format)!==null&&o!==void 0?o:a.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=a.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},e.prototype.getLuminance=function(){var t=this.toRgb(),n,o,a,r=t.r/255,s=t.g/255,l=t.b/255;return r<=.03928?n=r/12.92:n=Math.pow((r+.055)/1.055,2.4),s<=.03928?o=s/12.92:o=Math.pow((s+.055)/1.055,2.4),l<=.03928?a=l/12.92:a=Math.pow((l+.055)/1.055,2.4),.2126*n+.7152*o+.0722*a},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(t){return this.a=oa(t),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){var t=this.toHsl().s;return t===0},e.prototype.toHsv=function(){var t=go(this.r,this.g,this.b);return{h:t.h*360,s:t.s,v:t.v,a:this.a}},e.prototype.toHsvString=function(){var t=go(this.r,this.g,this.b),n=Math.round(t.h*360),o=Math.round(t.s*100),a=Math.round(t.v*100);return this.a===1?"hsv(".concat(n,", ").concat(o,"%, ").concat(a,"%)"):"hsva(".concat(n,", ").concat(o,"%, ").concat(a,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var t=ho(this.r,this.g,this.b);return{h:t.h*360,s:t.s,l:t.l,a:this.a}},e.prototype.toHslString=function(){var t=ho(this.r,this.g,this.b),n=Math.round(t.h*360),o=Math.round(t.s*100),a=Math.round(t.l*100);return this.a===1?"hsl(".concat(n,", ").concat(o,"%, ").concat(a,"%)"):"hsla(".concat(n,", ").concat(o,"%, ").concat(a,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(t){return t===void 0&&(t=false),bo(this.r,this.g,this.b,t)},e.prototype.toHexString=function(t){return t===void 0&&(t=false),"#"+this.toHex(t)},e.prototype.toHex8=function(t){return t===void 0&&(t=false),vi(this.r,this.g,this.b,this.a,t)},e.prototype.toHex8String=function(t){return t===void 0&&(t=false),"#"+this.toHex8(t)},e.prototype.toHexShortString=function(t){return t===void 0&&(t=false),this.a===1?this.toHexString(t):this.toHex8String(t)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var t=Math.round(this.r),n=Math.round(this.g),o=Math.round(this.b);return this.a===1?"rgb(".concat(t,", ").concat(n,", ").concat(o,")"):"rgba(".concat(t,", ").concat(n,", ").concat(o,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var t=function(n){return"".concat(Math.round(fe(n,255)*100),"%")};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var t=function(n){return Math.round(fe(n,255)*100)};return this.a===1?"rgb(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%)"):"rgba(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(this.a===0)return"transparent";if(this.a<1)return false;for(var t="#"+bo(this.r,this.g,this.b,false),n=0,o=Object.entries(xn);n<o.length;n++){var a=o[n],r=a[0],s=a[1];if(t===s)return r}return false},e.prototype.toString=function(t){var n=!!t;t=t??this.format;var o=false,a=this.a<1&&this.a>=0,r=!n&&a&&(t.startsWith("hex")||t==="name");return r?t==="name"&&this.a===0?this.toName():this.toRgbString():(t==="rgb"&&(o=this.toRgbString()),t==="prgb"&&(o=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(o=this.toHexString()),t==="hex3"&&(o=this.toHexString(true)),t==="hex4"&&(o=this.toHex8String(true)),t==="hex8"&&(o=this.toHex8String()),t==="name"&&(o=this.toName()),t==="hsl"&&(o=this.toHslString()),t==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=Rt(n.l),new e(n)},e.prototype.brighten=function(t){t===void 0&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),new e(n)},e.prototype.darken=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=Rt(n.l),new e(n)},e.prototype.tint=function(t){return t===void 0&&(t=10),this.mix("white",t)},e.prototype.shade=function(t){return t===void 0&&(t=10),this.mix("black",t)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=Rt(n.s),new e(n)},e.prototype.saturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=Rt(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),o=(n.h+t)%360;return n.h=o<0?360+o:o,new e(n)},e.prototype.mix=function(t,n){n===void 0&&(n=50);var o=this.toRgb(),a=new e(t).toRgb(),r=n/100,s={r:(a.r-o.r)*r+o.r,g:(a.g-o.g)*r+o.g,b:(a.b-o.b)*r+o.b,a:(a.a-o.a)*r+o.a};return new e(s)},e.prototype.analogous=function(t,n){t===void 0&&(t=6),n===void 0&&(n=30);var o=this.toHsl(),a=360/n,r=[this];for(o.h=(o.h-(a*t>>1)+720)%360;--t;)o.h=(o.h+a)%360,r.push(new e(o));return r},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var n=this.toHsv(),o=n.h,a=n.s,r=n.v,s=[],l=1/t;t--;)s.push(new e({h:o,s:a,v:r})),r=(r+l)%1;return s},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),o=new e(t).toRgb(),a=n.a+o.a*(1-n.a);return new e({r:(n.r*n.a+o.r*o.a*(1-n.a))/a,g:(n.g*n.a+o.g*o.a*(1-n.a))/a,b:(n.b*n.a+o.b*o.a*(1-n.a))/a,a})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),o=n.h,a=[this],r=360/t,s=1;s<t;s++)a.push(new e({h:(o+s*r)%360,s:n.s,l:n.l}));return a},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();function qe(e,t=20){return e.mix("#141414",t).toString()}function _i(e){const t=Rn(),n=Fe("button");return w(()=>{let o={},a=e.color;if(a){const r=a.match(/var\((.*?)\)/);r&&(a=window.getComputedStyle(window.document.documentElement).getPropertyValue(r[1]));const s=new xi(a),l=e.dark?s.tint(20).toString():qe(s,20);if(e.plain)o=n.cssVarBlock({"bg-color":e.dark?qe(s,90):s.tint(90).toString(),"text-color":a,"border-color":e.dark?qe(s,50):s.tint(50).toString(),"hover-text-color":`var(${n.cssVarName("color-white")})`,"hover-bg-color":a,"hover-border-color":a,"active-bg-color":l,"active-text-color":`var(${n.cssVarName("color-white")})`,"active-border-color":l}),t.value&&(o[n.cssVarBlockName("disabled-bg-color")]=e.dark?qe(s,90):s.tint(90).toString(),o[n.cssVarBlockName("disabled-text-color")]=e.dark?qe(s,50):s.tint(50).toString(),o[n.cssVarBlockName("disabled-border-color")]=e.dark?qe(s,80):s.tint(80).toString());else{const p=e.dark?qe(s,30):s.tint(30).toString(),f=s.isDark()?`var(${n.cssVarName("color-white")})`:`var(${n.cssVarName("color-black")})`;if(o=n.cssVarBlock({"bg-color":a,"text-color":f,"border-color":a,"hover-bg-color":p,"hover-text-color":f,"hover-border-color":p,"active-bg-color":l,"active-border-color":l}),t.value){const C=e.dark?qe(s,50):s.tint(50).toString();o[n.cssVarBlockName("disabled-bg-color")]=C,o[n.cssVarBlockName("disabled-text-color")]=e.dark?"rgba(255, 255, 255, 0.5)":`var(${n.cssVarName("color-white")})`,o[n.cssVarBlockName("disabled-border-color")]=C}}}return o})}const Ci=K({name:"ElButton",__name:"button",props:wn,emits:ii,setup(e,{expose:t,emit:n}){const o=e,a=n,r=_i(o),s=Fe("button"),{_ref:l,_size:p,_type:f,_disabled:C,_props:x,_plain:T,_round:d,_text:c,shouldAddSpace:u,handleClick:b}=ri(o,a),h=w(()=>[s.b(),s.m(f.value),s.m(p.value),s.is("disabled",C.value),s.is("loading",o.loading),s.is("plain",T.value),s.is("round",d.value),s.is("circle",o.circle),s.is("text",c.value),s.is("link",o.link),s.is("has-bg",o.bg)]);return t({ref:l,size:p,type:f,disabled:C,shouldAddSpace:u}),(m,I)=>(v(),O(_e(m.tag),Kt({ref_key:"_ref",ref:l},i(x),{class:h.value,style:i(r),onClick:i(b)}),{default:L(()=>[m.loading?(v(),S(ie,{key:0},[m.$slots.loading?de(m.$slots,"loading",{key:0}):(v(),O(i(ze),{key:1,class:M(i(s).is("loading"))},{default:L(()=>[(v(),O(_e(m.loadingIcon)))]),_:1},8,["class"]))],64)):m.icon||m.$slots.icon?(v(),O(i(ze),{key:1},{default:L(()=>[m.icon?(v(),O(_e(m.icon),{key:0})):de(m.$slots,"icon",{key:1})]),_:3})):P("v-if",true),m.$slots.default?(v(),S("span",{key:2,class:M({[i(s).em("text","expand")]:i(u)})},[de(m.$slots,"default")],2)):P("v-if",true)]),_:3},16,["class","style","onClick"]))}});var ki=tt(Ci,[["__file","/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);const Ei={size:wn.size,type:wn.type,direction:{type:q(String),values:["horizontal","vertical"],default:"horizontal"}},Si=K({name:"ElButtonGroup",__name:"button-group",props:Ei,setup(e){const t=e;kn(na,Yt({size:Gt(t,"size"),type:Gt(t,"type")}));const n=Fe("button");return(o,a)=>(v(),S("div",{class:M([i(n).b("group"),i(n).bm("group",t.direction)])},[de(o.$slots,"default")],2))}});var aa=tt(Si,[["__file","/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);const Ii=on(ki,{ButtonGroup:aa});tl(aa);var jt=(e=>(e[e.TEXT=1]="TEXT",e[e.CLASS=2]="CLASS",e[e.STYLE=4]="STYLE",e[e.PROPS=8]="PROPS",e[e.FULL_PROPS=16]="FULL_PROPS",e[e.HYDRATE_EVENTS=32]="HYDRATE_EVENTS",e[e.STABLE_FRAGMENT=64]="STABLE_FRAGMENT",e[e.KEYED_FRAGMENT=128]="KEYED_FRAGMENT",e[e.UNKEYED_FRAGMENT=256]="UNKEYED_FRAGMENT",e[e.NEED_PATCH=512]="NEED_PATCH",e[e.DYNAMIC_SLOTS=1024]="DYNAMIC_SLOTS",e[e.HOISTED=-1]="HOISTED",e[e.BAIL=-2]="BAIL",e))(jt||{});const Ti=Ye({a11y:{type:Boolean,default:true},locale:{type:q(Object)},size:On,button:{type:q(Object)},card:{type:q(Object)},dialog:{type:q(Object)},link:{type:q(Object)},experimentalFeatures:{type:q(Object)},keyboardNavigation:{type:Boolean,default:true},message:{type:q(Object)},zIndex:Number,namespace:{type:String,default:"el"},...Js}),me={placement:"top"};K({name:"ElConfigProvider",props:Ti,setup(e,{slots:t}){const n=Yo(e);return ye(()=>e.message,o=>{var a,r;Object.assign(me,(r=(a=n==null?void 0:n.value)==null?void 0:a.message)!=null?r:{},o??{})},{immediate:true,deep:true}),()=>de(t,"default",{config:n==null?void 0:n.value})}});const ra=e=>{if(!e)return{onClick:ct,onMousedown:ct,onMouseup:ct};let t=false,n=false;return{onClick:s=>{t&&n&&e(s),t=n=false},onMousedown:s=>{t=s.target===s.currentTarget},onMouseup:s=>{n=s.target===s.currentTarget}}},Mi=Ye({mask:{type:Boolean,default:true},customMaskEvent:Boolean,overlayClass:{type:q([String,Array,Object])},zIndex:{type:q([String,Number])}}),Li={click:e=>e instanceof MouseEvent},Ai="overlay";var Bi=K({name:"ElOverlay",props:Mi,emits:Li,setup(e,{slots:t,emit:n}){const o=Fe(Ai),a=p=>{n("click",p)},{onClick:r,onMousedown:s,onMouseup:l}=ra(e.customMaskEvent?void 0:a);return()=>e.mask?B("div",{class:[o.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:r,onMousedown:s,onMouseup:l},[de(t,"default")],jt.STYLE|jt.CLASS|jt.PROPS,["onClick","onMouseup","onMousedown"]):Q("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[de(t,"default")])}});const $i=Bi,Pi=(e,t,n,o)=>{const a={offsetX:0,offsetY:0},r=A(false),s=(T,d)=>{if(e.value){const{offsetX:c,offsetY:u}=a,b=e.value.getBoundingClientRect(),h=b.left,m=b.top,I=b.width,z=b.height,D=document.documentElement.clientWidth,G=document.documentElement.clientHeight,H=-h+c,V=-m+u,Z=D-h-I+c,re=G-m-(z<G?z:0)+u;o!=null&&o.value||(T=Math.min(Math.max(T,H),Z),d=Math.min(Math.max(d,V),re)),a.offsetX=T,a.offsetY=d,e.value.style.transform=`translate(${Mt(T)}, ${Mt(d)})`}},l=T=>{const d=T.clientX,c=T.clientY,{offsetX:u,offsetY:b}=a,h=I=>{r.value||(r.value=true);const z=u+I.clientX-d,D=b+I.clientY-c;s(z,D)},m=()=>{r.value=false,document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",m)};document.addEventListener("mousemove",h),document.addEventListener("mouseup",m)},p=()=>{t.value&&e.value&&(t.value.addEventListener("mousedown",l),window.addEventListener("resize",x))},f=()=>{t.value&&e.value&&(t.value.removeEventListener("mousedown",l),window.removeEventListener("resize",x))},C=()=>{a.offsetX=0,a.offsetY=0,e.value&&(e.value.style.transform="")},x=()=>{const{offsetX:T,offsetY:d}=a;s(T,d)};return De(()=>{fa(()=>{n.value?p():f()})}),Bt(()=>{f()}),{isDragging:r,resetPosition:C,updatePosition:x}},Oi=(e,t={})=>{Cn(e)||Vs("[useLockscreen]","You need to pass a ref param to this function");const n=t.ns||Fe("popup"),o=w(()=>n.bm("parent","hidden"));let a=0,r=false,s="0";const l=()=>{setTimeout(()=>{typeof document>"u"||r&&document&&(document.body.style.width=s,al(document.body,o.value))},200)};ye(e,p=>{if(!p){l();return}r=!nl(document.body,o.value),r&&(s=document.body.style.width,ol(document.body,o.value)),a=sl(n.namespace.value);const f=document.documentElement.clientHeight<document.body.scrollHeight,C=rl(document.body,"overflowY");a>0&&(f||C==="scroll")&&r&&(document.body.style.width=`calc(100% - ${a}px)`)}),pa(()=>l())},Ni=e=>["",...jo].includes(e),sa=["primary","success","info","warning","error"],la=["top","top-left","top-right","bottom","bottom-left","bottom-right"],Lt="top",ve=Xo({customClass:"",dangerouslyUseHTMLString:false,duration:3e3,icon:void 0,id:"",message:"",onClose:void 0,showClose:false,type:"info",plain:false,offset:16,placement:void 0,zIndex:0,grouping:false,repeatNum:1,appendTo:$e?document.body:void 0}),zi=Ye({customClass:{type:String,default:ve.customClass},dangerouslyUseHTMLString:{type:Boolean,default:ve.dangerouslyUseHTMLString},duration:{type:Number,default:ve.duration},icon:{type:gt,default:ve.icon},id:{type:String,default:ve.id},message:{type:q([String,Object,Function]),default:ve.message},onClose:{type:q(Function),default:ve.onClose},showClose:{type:Boolean,default:ve.showClose},type:{type:String,values:sa,default:ve.type},plain:{type:Boolean,default:ve.plain},offset:{type:Number,default:ve.offset},placement:{type:String,values:la,default:ve.placement},zIndex:{type:Number,default:ve.zIndex},grouping:{type:Boolean,default:ve.grouping},repeatNum:{type:Number,default:ve.repeatNum}}),Ri={destroy:()=>true},Be=_o({}),Fi=e=>(Be[e]||(Be[e]=_o([])),Be[e]),Di=(e,t)=>{const n=Be[t]||[],o=n.findIndex(s=>s.id===e),a=n[o];let r;return o>0&&(r=n[o-1]),{current:a,prev:r}},Hi=(e,t)=>{const{prev:n}=Di(e,t);return n?n.vm.exposed.bottom.value:0},Vi=(e,t,n)=>(Be[n]||[]).findIndex(r=>r.id===e)>0?16:t,Ui=["id"],ji=["innerHTML"],Ki=K({name:"ElMessage",__name:"message",props:zi,emits:Ri,setup(e,{expose:t,emit:n}){const{Close:o}=Wo,a=e,r=n,s=A(false),{ns:l,zIndex:p}=Go("message"),{currentZIndex:f,nextZIndex:C}=p,x=A(),T=A(false),d=A(0);let c;const u=w(()=>a.type?a.type==="error"?"danger":a.type:"info"),b=w(()=>{const N=a.type;return{[l.bm("icon",N)]:N&&Jt[N]}}),h=w(()=>a.icon||Jt[a.type]||""),m=w(()=>a.placement||Lt),I=w(()=>Hi(a.id,m.value)),z=w(()=>Vi(a.id,a.offset,m.value)+I.value),D=w(()=>d.value+z.value),G=w(()=>m.value.includes("left")?l.is("left"):m.value.includes("right")?l.is("right"):l.is("center")),H=w(()=>m.value.startsWith("top")?"top":"bottom"),V=w(()=>({[H.value]:`${z.value}px`,zIndex:f.value}));function Z(){a.duration!==0&&({stop:c}=ga(()=>{he()},a.duration))}function re(){c==null||c()}function he(){T.value=false,oe(()=>{var N;s.value||((N=a.onClose)==null||N.call(a),r("destroy"))})}function J(N){rn(N)===yt.esc&&he()}return De(()=>{Z(),C(),T.value=true}),ye(()=>a.repeatNum,()=>{re(),Z()}),Ht(document,"keydown",J),Co(x,()=>{d.value=x.value.getBoundingClientRect().height}),t({visible:T,bottom:D,close:he}),(N,ge)=>(v(),O(Sn,{name:i(l).b("fade"),onBeforeEnter:ge[0]||(ge[0]=Pe=>s.value=true),onBeforeLeave:N.onClose,onAfterLeave:ge[1]||(ge[1]=Pe=>N.$emit("destroy")),persisted:""},{default:L(()=>[Je(y("div",{id:N.id,ref_key:"messageRef",ref:x,class:M([i(l).b(),{[i(l).m(N.type)]:N.type},i(l).is("closable",N.showClose),i(l).is("plain",N.plain),i(l).is("bottom",H.value==="bottom"),G.value,N.customClass]),style:dt(V.value),role:"alert",onMouseenter:re,onMouseleave:Z},[N.repeatNum>1?(v(),O(i(oi),{key:0,value:N.repeatNum,type:u.value,class:M(i(l).e("badge"))},null,8,["value","type","class"])):P("v-if",true),h.value?(v(),O(i(ze),{key:1,class:M([i(l).e("icon"),b.value])},{default:L(()=>[(v(),O(_e(h.value)))]),_:1},8,["class"])):P("v-if",true),de(N.$slots,"default",{},()=>[N.dangerouslyUseHTMLString?(v(),S(ie,{key:1},[P(" Caution here, message could've been compromised, never use user's input as message "),y("p",{class:M(i(l).e("content")),innerHTML:N.message},null,10,ji)],2112)):(v(),S("p",{key:0,class:M(i(l).e("content"))},Y(N.message),3))]),N.showClose?(v(),O(i(ze),{key:2,class:M(i(l).e("closeBtn")),onClick:Ae(he,["stop"])},{default:L(()=>[B(i(o))]),_:1},8,["class"])):P("v-if",true)],46,Ui),[[Qe,T.value]])]),_:3},8,["name","onBeforeLeave"]))}});var Gi=tt(Ki,[["__file","/home/runner/work/element-plus/element-plus/packages/components/message/src/message.vue"]]);let Yi=1;const qi=e=>{if(!e.appendTo)e.appendTo=document.body;else if(Se(e.appendTo)){let n=document.querySelector(e.appendTo);bn(n)||(n=document.body),e.appendTo=n}},Wi=e=>{!e.placement&&Se(me.placement)&&me.placement&&(e.placement=me.placement),e.placement||(e.placement=Lt),la.includes(e.placement)||(e.placement=Lt)},ia=e=>{const t=!e||Se(e)||Qt(e)||Ke(e)?{message:e}:e,n={...ve,...t};return qi(n),Wi(n),un(me.grouping)&&!n.grouping&&(n.grouping=me.grouping),Ge(me.duration)&&n.duration===3e3&&(n.duration=me.duration),Ge(me.offset)&&n.offset===16&&(n.offset=me.offset),un(me.showClose)&&!n.showClose&&(n.showClose=me.showClose),un(me.plain)&&!n.plain&&(n.plain=me.plain),n},Xi=e=>{const t=e.props.placement||Lt,n=Be[t],o=n.indexOf(e);if(o===-1)return;n.splice(o,1);const{handler:a}=e;a.close()},Zi=({appendTo:e,...t},n)=>{const o=`message_${Yi++}`,a=t.onClose,r=document.createElement("div"),s={...t,id:o,onClose:()=>{a==null||a(),Xi(C)},onDestroy:()=>{qt(null,r)}},l=B(Gi,s,Ke(s.message)||Qt(s.message)?{default:Ke(s.message)?s.message:()=>s.message}:null);l.appContext=n||pt._context,qt(l,r),e.appendChild(r.firstElementChild);const p=l.component,C={id:o,vnode:l,vm:p,handler:{close:()=>{p.exposed.close()}},props:l.component.props};return C},pt=(e={},t)=>{if(!$e)return{close:()=>{}};const n=ia(e),o=Fi(n.placement||Lt);if(n.grouping&&o.length){const r=o.find(({vnode:s})=>{var l;return((l=s.props)==null?void 0:l.message)===n.message});if(r)return r.props.repeatNum+=1,r.props.type=n.type,r.handler}if(Ge(me.max)&&o.length>=me.max)return{close:()=>{}};const a=Zi(n,t);return o.push(a),a.handler};sa.forEach(e=>{pt[e]=(t={},n)=>{const o=ia(t);return pt({...o,type:e},n)}});function Ji(e){for(const t in Be)if(It(Be,t)){const n=[...Be[t]];for(const o of n)(!e||e===o.props.type)&&o.handler.close()}}function Qi(e){if(!Be[e])return;[...Be[e]].forEach(n=>n.handler.close())}pt.closeAll=Ji;pt.closeAllByPlacement=Qi;pt._context=null;const eu=el(pt,"$message"),_n="_trap-focus-children",ut=[],wo=e=>{if(ut.length===0)return;const t=rn(e),n=ut[ut.length-1][_n];if(n.length>0&&t===yt.tab){if(n.length===1){e.preventDefault(),document.activeElement!==n[0]&&n[0].focus();return}const o=e.shiftKey,a=e.target===n[0],r=e.target===n[n.length-1];a&&o&&(e.preventDefault(),n[n.length-1].focus()),r&&!o&&(e.preventDefault(),n[0].focus())}},tu={beforeMount(e){e[_n]=so(e),ut.push(e),ut.length<=1&&document.addEventListener("keydown",wo)},updated(e){oe(()=>{e[_n]=so(e)})},unmounted(){ut.shift(),ut.length===0&&document.removeEventListener("keydown",wo)}},nu=K({name:"ElMessageBox",directives:{TrapFocus:tu},components:{ElButton:Ii,ElFocusTrap:Ql,ElInput:Rl,ElOverlay:$i,ElIcon:ze,...Wo},inheritAttrs:false,props:{buttonSize:{type:String,validator:Ni},modal:{type:Boolean,default:true},lockScroll:{type:Boolean,default:true},showClose:{type:Boolean,default:true},closeOnClickModal:{type:Boolean,default:true},closeOnPressEscape:{type:Boolean,default:true},closeOnHashChange:{type:Boolean,default:true},center:Boolean,draggable:Boolean,overflow:Boolean,roundButton:Boolean,container:{type:String,default:"body"},boxType:{type:String,default:""}},emits:["vanish","action"],setup(e,{emit:t}){const{locale:n,zIndex:o,ns:a,size:r}=Go("message-box",w(()=>e.buttonSize)),{t:s}=n,{nextZIndex:l}=o,p=A(false),f=Yt({autofocus:true,beforeClose:null,callback:null,cancelButtonText:"",cancelButtonClass:"",confirmButtonText:"",confirmButtonClass:"",customClass:"",customStyle:{},dangerouslyUseHTMLString:false,distinguishCancelAndClose:false,icon:"",closeIcon:"",inputPattern:null,inputPlaceholder:"",inputType:"text",inputValue:"",inputValidator:void 0,inputErrorMessage:"",message:"",modalFade:true,modalClass:"",showCancelButton:false,showConfirmButton:true,type:"",title:void 0,showInput:false,action:"",confirmButtonLoading:false,cancelButtonLoading:false,confirmButtonLoadingIcon:hn(St),cancelButtonLoadingIcon:hn(St),confirmButtonDisabled:false,editorErrorMessage:"",validateError:false,zIndex:l()}),C=w(()=>{const U=f.type;return{[a.bm("icon",U)]:U&&Jt[U]}}),x=yn(),T=yn(),d=w(()=>{const U=f.type;return f.icon||U&&Jt[U]||""}),c=w(()=>!!f.message),u=A(),b=A(),h=A(),m=A(),I=A(),z=w(()=>f.confirmButtonClass);ye(()=>f.inputValue,async U=>{await oe(),e.boxType==="prompt"&&U&&N()},{immediate:true}),ye(()=>p.value,U=>{var W,X;U&&(e.boxType!=="prompt"&&(f.autofocus?h.value=(X=(W=I.value)==null?void 0:W.$el)!=null?X:u.value:h.value=u.value),f.zIndex=l()),e.boxType==="prompt"&&(U?oe().then(()=>{var Oe;m.value&&m.value.$el&&(f.autofocus?h.value=(Oe=ge())!=null?Oe:u.value:h.value=u.value)}):(f.editorErrorMessage="",f.validateError=false))});const D=w(()=>e.draggable),G=w(()=>e.overflow),{isDragging:H}=Pi(u,b,D,G);De(async()=>{await oe(),e.closeOnHashChange&&window.addEventListener("hashchange",V)}),Bt(()=>{e.closeOnHashChange&&window.removeEventListener("hashchange",V)});function V(){p.value&&(p.value=false,oe(()=>{f.action&&t("action",f.action)}))}const Z=()=>{e.closeOnClickModal&&J(f.distinguishCancelAndClose?"close":"cancel")},re=ra(Z),he=U=>{if(f.inputType!=="textarea")return U.preventDefault(),J("confirm")},J=U=>{var W;e.boxType==="prompt"&&U==="confirm"&&!N()||(f.action=U,f.beforeClose?(W=f.beforeClose)==null||W.call(f,U,f,V):V())},N=()=>{if(e.boxType==="prompt"){const U=f.inputPattern;if(U&&!U.test(f.inputValue||""))return f.editorErrorMessage=f.inputErrorMessage||s("el.messagebox.error"),f.validateError=true,false;const W=f.inputValidator;if(Ke(W)){const X=W(f.inputValue);if(X===false)return f.editorErrorMessage=f.inputErrorMessage||s("el.messagebox.error"),f.validateError=true,false;if(Se(X))return f.editorErrorMessage=X,f.validateError=true,false}}return f.editorErrorMessage="",f.validateError=false,true},ge=()=>{var U,W;const X=(U=m.value)==null?void 0:U.$refs;return(W=X==null?void 0:X.input)!=null?W:X==null?void 0:X.textarea},Pe=()=>{J("close")},nt=()=>{e.closeOnPressEscape&&Pe()};return e.lockScroll&&Oi(p,{ns:a}),{...va(f),ns:a,overlayEvent:re,visible:p,hasMessage:c,typeClass:C,contentId:x,inputId:T,btnSize:r,iconComponent:d,confirmButtonClasses:z,rootRef:u,focusStartRef:h,headerRef:b,inputRef:m,isDragging:H,confirmRef:I,doClose:V,handleClose:Pe,onCloseRequested:nt,handleWrapperClick:Z,handleInputEnter:he,handleAction:J,t:s}}}),ou=["aria-label","aria-describedby"],au=["aria-label"],ru=["id"];function su(e,t,n,o,a,r){const s=ue("el-icon"),l=ue("el-input"),p=ue("el-button"),f=ue("el-focus-trap"),C=ue("el-overlay");return v(),O(Sn,{name:"fade-in-linear",onAfterLeave:t[11]||(t[11]=x=>e.$emit("vanish")),persisted:""},{default:L(()=>[Je(B(C,{"z-index":e.zIndex,"overlay-class":[e.ns.is("message-box"),e.modalClass],mask:e.modal},{default:L(()=>[y("div",{role:"dialog","aria-label":e.title,"aria-modal":"true","aria-describedby":e.showInput?void 0:e.contentId,class:M(`${e.ns.namespace.value}-overlay-message-box`),onClick:t[8]||(t[8]=(...x)=>e.overlayEvent.onClick&&e.overlayEvent.onClick(...x)),onMousedown:t[9]||(t[9]=(...x)=>e.overlayEvent.onMousedown&&e.overlayEvent.onMousedown(...x)),onMouseup:t[10]||(t[10]=(...x)=>e.overlayEvent.onMouseup&&e.overlayEvent.onMouseup(...x))},[B(f,{loop:"",trapped:e.visible,"focus-trap-el":e.rootRef,"focus-start-el":e.focusStartRef,onReleaseRequested:e.onCloseRequested},{default:L(()=>[y("div",{ref:"rootRef",class:M([e.ns.b(),e.customClass,e.ns.is("draggable",e.draggable),e.ns.is("dragging",e.isDragging),{[e.ns.m("center")]:e.center}]),style:dt(e.customStyle),tabindex:"-1",onClick:t[7]||(t[7]=Ae(()=>{},["stop"]))},[e.title!==null&&e.title!==void 0?(v(),S("div",{key:0,ref:"headerRef",class:M([e.ns.e("header"),{"show-close":e.showClose}])},[y("div",{class:M(e.ns.e("title"))},[e.iconComponent&&e.center?(v(),O(s,{key:0,class:M([e.ns.e("status"),e.typeClass])},{default:L(()=>[(v(),O(_e(e.iconComponent)))]),_:1},8,["class"])):P("v-if",true),y("span",null,Y(e.title),1)],2),e.showClose?(v(),S("button",{key:0,type:"button",class:M(e.ns.e("headerbtn")),"aria-label":e.t("el.messagebox.close"),onClick:t[0]||(t[0]=x=>e.handleAction(e.distinguishCancelAndClose?"close":"cancel")),onKeydown:t[1]||(t[1]=Et(Ae(x=>e.handleAction(e.distinguishCancelAndClose?"close":"cancel"),["prevent"]),["enter"]))},[B(s,{class:M(e.ns.e("close"))},{default:L(()=>[(v(),O(_e(e.closeIcon||"close")))]),_:1},8,["class"])],42,au)):P("v-if",true)],2)):P("v-if",true),y("div",{id:e.contentId,class:M(e.ns.e("content"))},[y("div",{class:M(e.ns.e("container"))},[e.iconComponent&&!e.center&&e.hasMessage?(v(),O(s,{key:0,class:M([e.ns.e("status"),e.typeClass])},{default:L(()=>[(v(),O(_e(e.iconComponent)))]),_:1},8,["class"])):P("v-if",true),e.hasMessage?(v(),S("div",{key:1,class:M(e.ns.e("message"))},[de(e.$slots,"default",{},()=>[e.dangerouslyUseHTMLString?(v(),O(_e(e.showInput?"label":"p"),{key:1,for:e.showInput?e.inputId:void 0,innerHTML:e.message},null,8,["for","innerHTML"])):(v(),O(_e(e.showInput?"label":"p"),{key:0,for:e.showInput?e.inputId:void 0,textContent:Y(e.message)},null,8,["for","textContent"]))])],2)):P("v-if",true)],2),Je(y("div",{class:M(e.ns.e("input"))},[B(l,{id:e.inputId,ref:"inputRef",modelValue:e.inputValue,"onUpdate:modelValue":t[2]||(t[2]=x=>e.inputValue=x),type:e.inputType,placeholder:e.inputPlaceholder,"aria-invalid":e.validateError,class:M({invalid:e.validateError}),onKeydown:Et(e.handleInputEnter,["enter"])},null,8,["id","modelValue","type","placeholder","aria-invalid","class","onKeydown"]),y("div",{class:M(e.ns.e("errormsg")),style:dt({visibility:e.editorErrorMessage?"visible":"hidden"})},Y(e.editorErrorMessage),7)],2),[[Qe,e.showInput]])],10,ru),y("div",{class:M(e.ns.e("btns"))},[e.showCancelButton?(v(),O(p,{key:0,loading:e.cancelButtonLoading,"loading-icon":e.cancelButtonLoadingIcon,class:M([e.cancelButtonClass]),round:e.roundButton,size:e.btnSize,onClick:t[3]||(t[3]=x=>e.handleAction("cancel")),onKeydown:t[4]||(t[4]=Et(Ae(x=>e.handleAction("cancel"),["prevent"]),["enter"]))},{default:L(()=>[ce(Y(e.cancelButtonText||e.t("el.messagebox.cancel")),1)]),_:1},8,["loading","loading-icon","class","round","size"])):P("v-if",true),Je(B(p,{ref:"confirmRef",type:"primary",loading:e.confirmButtonLoading,"loading-icon":e.confirmButtonLoadingIcon,class:M([e.confirmButtonClasses]),round:e.roundButton,disabled:e.confirmButtonDisabled,size:e.btnSize,onClick:t[5]||(t[5]=x=>e.handleAction("confirm")),onKeydown:t[6]||(t[6]=Et(Ae(x=>e.handleAction("confirm"),["prevent"]),["enter"]))},{default:L(()=>[ce(Y(e.confirmButtonText||e.t("el.messagebox.confirm")),1)]),_:1},8,["loading","loading-icon","class","round","disabled","size"]),[[Qe,e.showConfirmButton]])],2)],6)]),_:3},8,["trapped","focus-trap-el","focus-start-el","onReleaseRequested"])],42,ou)]),_:3},8,["z-index","overlay-class","mask"]),[[Qe,e.visible]])]),_:3})}var lu=tt(nu,[["render",su],["__file","/home/runner/work/element-plus/element-plus/packages/components/message-box/src/index.vue"]]);const At=new Map,iu=e=>{let t=document.body;return e.appendTo&&(Se(e.appendTo)&&(t=document.querySelector(e.appendTo)),bn(e.appendTo)&&(t=e.appendTo),bn(t)||(t=document.body)),t},uu=(e,t,n=null)=>{const o=B(lu,e,Ke(e.message)||Qt(e.message)?{default:Ke(e.message)?e.message:()=>e.message}:null);return o.appContext=n,qt(o,t),iu(e).appendChild(t.firstElementChild),o.component},cu=()=>document.createElement("div"),du=(e,t)=>{const n=cu();e.onVanish=()=>{qt(null,n),At.delete(a)},e.onAction=r=>{const s=At.get(a);let l;e.showInput?l={value:a.inputValue,action:r}:l=r,e.callback?e.callback(l,o.proxy):r==="cancel"||r==="close"?e.distinguishCancelAndClose&&r!=="cancel"?s.reject("close"):s.reject("cancel"):s.resolve(l)};const o=uu(e,n,t),a=o.proxy;for(const r in e)It(e,r)&&!It(a.$props,r)&&(r==="closeIcon"&&bt(e[r])?a[r]=hn(e[r]):a[r]=e[r]);return a.visible=true,a};function xt(e,t=null){if(!$e)return Promise.reject();let n;return Se(e)||Qt(e)?e={message:e}:n=e.callback,new Promise((o,a)=>{const r=du(e,t??xt._context);At.set(r,{options:e,callback:n,resolve:o,reject:a})})}const fu=["alert","confirm","prompt"],pu={alert:{closeOnPressEscape:false,closeOnClickModal:false},confirm:{showCancelButton:true},prompt:{showCancelButton:true,showInput:true}};fu.forEach(e=>{xt[e]=vu(e)});function vu(e){return(t,n,o,a)=>{let r="";return bt(n)?(o=n,r=""):Fs(n)?r="":r=n,xt(Object.assign({title:r,message:t,type:"",...pu[e]},o,{boxType:e}),a)}}xt.close=()=>{At.forEach((e,t)=>{t.doClose()}),At.clear()};xt._context=null;const Xe=xt;Xe.install=e=>{Xe._context=e._context,e.config.globalProperties.$msgbox=Xe,e.config.globalProperties.$messageBox=Xe,e.config.globalProperties.$alert=Xe.alert,e.config.globalProperties.$confirm=Xe.confirm,e.config.globalProperties.$prompt=Xe.prompt};const mu=Xe;function hu(){const e=A({bots:{},channels:{},messages:{}}),t=A({maxMessagesPerChannel:1e3,keepMessagesOnClear:50,loggerinfo:false,blockedPlatforms:[],chatContainerHeight:80,clearIndexedDBOnStart:true}),n=A(new Set),o=A(new Set),a=A({}),r=w(()=>Object.values(e.value.bots).sort((d,c)=>{const u=n.value.has(d.selfId),b=n.value.has(c.selfId);return u===b?0:u?-1:1})),s=d=>!d||!e.value.channels[d]?[]:Object.values(e.value.channels[d]).sort((c,u)=>{const b=o.value.has(`${d}:${c.id}`),h=o.value.has(`${d}:${u.id}`);return b===h?0:b?-1:1}),l=(d,c)=>{const u=`${d}:${c}`;return e.value.messages[u]||[]},p=(d,c)=>{const u=`${d}:${c}`;return a.value[u]||{offset:0,hasMore:true}};async function f(){const d=await Le("get-chat-data");d.success&&d.data&&(e.value={bots:d.data.bots||{},channels:d.data.channels||{},messages:d.data.messages||{}},n.value=new Set(d.data.pinnedBots||[]),o.value=new Set(d.data.pinnedChannels||[]))}async function C(){const d=await Le("get-plugin-config");d.success&&d.config&&(t.value=d.config)}function x(d){var I,z;const c=d.selfId,u=d.channelId,b=`${c}:${u}`;e.value.bots[c]||(e.value.bots[c]={selfId:c,platform:d.platform||"unknown",username:((I=d.bot)==null?void 0:I.name)||`Bot-${c}`,avatar:(z=d.bot)==null?void 0:z.avatar,status:"online"}),e.value.channels[c]||(e.value.channels[c]={}),e.value.channels[c][u]||(e.value.channels[c][u]={id:u,name:d.guildName||d.username||u,type:d.channelType||0}),e.value.messages[b]||(e.value.messages[b]=[]);const h=e.value.messages[b];if(!h.some(D=>!!(D.id===d.messageId||D.id===d.id||(d.type==="bot-message"||d.type==="bot-message-sent"||d.type==="bot")&&D.isBot&&Math.abs(D.timestamp-d.timestamp)<2e3&&D.content===d.content))){const D={id:d.messageId||d.id,content:d.content,userId:d.userId,username:d.username,avatar:d.avatar,timestamp:d.timestamp,channelId:u,selfId:c,elements:d.elements,isBot:d.isBot||d.type==="bot-message"||d.type==="bot",quote:d.quote};h.push(D),h.sort((G,H)=>G.timestamp-H.timestamp)}e.value={...e.value}}async function T(d,c,u=50){const b=`${d}:${c}`,h=p(d,c);if(!h.hasMore)return;const m=await Le("get-history-messages",{selfId:d,channelId:c,limit:u,offset:h.offset});if(m.success&&m.messages){e.value.messages[b]||(e.value.messages[b]=[]);const I=e.value.messages[b],z=m.messages.filter(D=>!I.find(G=>G.id===D.id));return e.value.messages[b]=[...z,...I].sort((D,G)=>D.timestamp-G.timestamp),a.value[b]={offset:h.offset+m.messages.length,hasMore:m.messages.length>=u&&m.total>h.offset+m.messages.length},e.value={...e.value},m.messages.length}return 0}return{chatData:e,pluginConfig:t,pinnedBots:n,pinnedChannels:o,bots:r,getChannels:s,getMessages:l,getPagination:p,loadInitialData:f,loadConfig:C,addMessage:x,loadHistory:T}}function gu(){const e=A(false);async function t(l,p,f,C){if(!e.value){e.value=true;try{return await Le("send-message",{selfId:l,channelId:p,content:f,images:C.map(T=>({tempId:T.tempId,filename:T.filename}))})}finally{e.value=false}}}async function n(l){return await Le("delete-bot-data",{selfId:l})}async function o(l,p){return await Le("delete-channel-data",{selfId:l,channelId:p})}async function a(l,p){return await Le("clear-channel-history",{selfId:l,channelId:p})}async function r(l,p,f){p?f.delete(l):f.add(l),await Le("set-pinned-bots",{pinnedBots:Array.from(f)})}async function s(l,p,f,C){const x=`${l}:${p}`;f?C.delete(x):C.add(x),await Le("set-pinned-channels",{pinnedChannels:Array.from(C)})}return{isSending:e,sendMessage:t,deleteBotData:n,deleteChannelData:o,clearHistory:a,togglePinBot:r,togglePinChannel:s}}function bu(){const e=A({}),t=new Map;let n=null;const o="ChatImageCache",a=2,r="images",s=12*1024*1024;async function l(){return new Promise(d=>{const c=indexedDB.open(o,a);c.onupgradeneeded=u=>{const b=u.target.result;if(!b.objectStoreNames.contains(r)){const h=b.createObjectStore(r,{keyPath:"url"});h.createIndex("channelKey","channelKey",{unique:false}),h.createIndex("timestamp","timestamp",{unique:false})}},c.onsuccess=()=>{n=c.result,d(true)},c.onerror=()=>d(false)})}async function p(d,c){if(e.value[c])return e.value[c];if(t.has(c))return t.get(c);const u=(async()=>{try{n||await l();const b=await f(c);if(b){const h=URL.createObjectURL(b.blob);return e.value[c]=h,h}return null}finally{t.delete(c)}})();return t.set(c,u),u}async function f(d){return n?new Promise(c=>{const h=n.transaction([r],"readonly").objectStore(r).get(d);h.onsuccess=()=>c(h.result||null),h.onerror=()=>c(null)}):null}async function C(d,c){const u=await p(d,c);if(u)return u;try{const b=await Le("fetch-image",{url:c});if(!b.success)return null;const m=await(await fetch(b.dataUrl)).blob();if(m.size>s)return null;const I={url:c,blob:m,timestamp:Date.now(),size:m.size,channelKey:d};await x(I);const z=URL.createObjectURL(m);return e.value[c]=z,z}catch{return null}}async function x(d){if(!n)return;n.transaction([r],"readwrite").objectStore(r).put(d)}async function T(d){Object.keys(e.value).forEach(c=>{URL.revokeObjectURL(e.value[c]),delete e.value[c]})}return En(()=>{Object.values(e.value).forEach(URL.revokeObjectURL),n&&n.close()}),{getCachedImageUrl:p,cacheImage:C,clearChannelCache:T}}function yu(){const{bots:e,pinnedBots:t,pinnedChannels:n,getChannels:o,getMessages:a,loadInitialData:r,loadConfig:s,addMessage:l,loadHistory:p,getPagination:f}=hu(),{isSending:C,sendMessage:x,deleteBotData:T,deleteChannelData:d,togglePinBot:c,togglePinChannel:u}=gu(),{getCachedImageUrl:b,cacheImage:h}=bu(),m=A(""),I=A(""),z=A(""),D=A([]),G=A(null),H=A(false),V=A("bots"),Z=A(false),re=Yt({messages:[]}),he=Yt({url:""}),J=w(()=>o(m.value)),N=w(()=>a(m.value,I.value)),ge=w(()=>{const _=J.value.find(E=>E.id===I.value);return _?_.name:""}),Pe=_=>{m.value=_,I.value="",H.value&&(V.value="channels")},nt=async _=>{I.value=_,H.value&&(V.value="messages"),N.value.length===0&&await p(m.value,_),await oe(),we()},U=()=>{V.value==="image"||V.value==="forward"?V.value="messages":V.value==="messages"?V.value="channels":V.value==="channels"&&(V.value="bots")},W=_=>{re.messages=_.filter(E=>E.type==="message"),V.value="forward"},X=_=>{he.url=_,V.value="image"},Oe=_=>{const E=document.createElement("a");E.href=_,E.download=`chat-image-${Date.now()}.png`,E.click()},we=()=>{if(G.value){const _=G.value.wrapRef;_&&(_.scrollTop=_.scrollHeight)}},ee=async({scrollTop:_})=>{var E;if(_<=10&&!Z.value&&m.value&&I.value&&f(m.value,I.value).hasMore){Z.value=true;const F=(E=G.value)==null?void 0:E.wrapRef,j=(F==null?void 0:F.scrollHeight)||0;await p(m.value,I.value),await oe(),F&&(F.scrollTop=F.scrollHeight-j),Z.value=false}},_t=async()=>{if(!m.value||!I.value||!z.value.trim()&&!D.value.length)return;const _=await x(m.value,I.value,z.value,D.value);_!=null&&_.success?(z.value="",D.value=[],we()):eu.error((_==null?void 0:_.error)||"发送失败")},ot=()=>{H.value=window.innerWidth<=768};let He=[];return De(async()=>{ot(),window.addEventListener("resize",ot),await s(),await r();const _=sn("chat-message-event",F=>{var j;if(l(F),F.selfId===m.value&&F.channelId===I.value){const te=(j=G.value)==null?void 0:j.wrapRef;te&&te.scrollHeight-te.scrollTop-te.clientHeight<100&&oe(we)}});typeof _=="function"&&He.push(_);const E=sn("bot-message-sent-event",F=>{l(F),F.selfId===m.value&&F.channelId===I.value&&oe(we)});typeof E=="function"&&He.push(E);const se=sn("chat-bot-message-event",F=>{l(F),F.selfId===m.value&&F.channelId===I.value&&oe(we)});typeof se=="function"&&He.push(se)}),En(()=>{window.removeEventListener("resize",ot),He.forEach(_=>_==null?void 0:_())}),{bots:e,selectedBot:m,selectedChannel:I,currentChannels:J,currentMessages:N,currentChannelName:ge,inputText:z,uploadedImages:D,isSending:C,pinnedBots:t,pinnedChannels:n,scrollRef:G,isMobile:H,mobileView:V,forwardData:re,imageViewer:he,isLoadingHistory:Z,selectBot:Pe,selectChannel:nt,handleSend:_t,togglePinBot:c,togglePinChannel:u,deleteBotData:T,deleteChannelData:d,getCachedImageUrl:b,cacheImage:h,getMessages:a,goBack:U,showForward:W,openImageViewer:X,downloadImage:Oe,handleScroll:ee}}const wu={class:"chat-patch-wrapper absolute inset-0 flex overflow-hidden bg-[var(--k-page-bg)] text-[var(--k-text-color)] font-sans"},xu=["onClick","onContextmenu"],_u={class:"ml-3 flex-1 overflow-hidden"},Cu={class:"flex items-center gap-1 text-sm font-bold truncate"},ku={class:"text-xs text-[var(--k-text-color-secondary)] truncate opacity-80"},Eu={class:"flex h-14 items-center px-4 font-bold border-b border-[var(--k-border-color)] text-lg text-[var(--k-text-color)]"},Su=["onClick","onContextmenu"],Iu={class:"flex-1 overflow-hidden"},Tu={class:"flex items-center gap-1 text-sm font-medium truncate"},Mu={class:"flex h-14 items-center px-4 font-bold border-b border-[var(--k-border-color)] bg-[var(--k-card-bg)] shadow-sm z-10 text-[var(--k-text-color)]"},Lu={class:"truncate"},Au={class:"flex-1 overflow-hidden relative bg-opacity-50 bg-gray-100 dark:bg-black/20"},Bu={class:"p-6 flex flex-col min-h-full"},$u={key:0,class:"flex justify-center py-4"},Pu={class:"flex items-center gap-2 mb-1.5 text-xs text-[var(--k-text-color-secondary)]"},Ou={class:"font-bold"},Nu={class:"opacity-60"},zu={key:0,class:"mb-2.5 p-2.5 text-sm bg-black/5 dark:bg-white/5 rounded-lg border-l-4 border-gray-400/50 text-left"},Ru={class:"font-bold opacity-70 mb-1 text-xs"},Fu={class:"opacity-90"},Du={class:"text-left min-w-[20px]"},Hu={class:"p-4 border-t border-[var(--k-border-color)] bg-[var(--k-card-bg)] shadow-[0_-2px_10px_rgba(0,0,0,0.05)]"},Vu={key:0,class:"flex gap-3 mb-3 overflow-x-auto pb-2 scrollbar-hide"},Uu={class:"flex gap-3 items-end"},ju={class:"flex h-14 items-center px-4 font-bold border-b border-[var(--k-border-color)] bg-[var(--k-card-bg)] shadow-sm"},Ku={class:"p-4 space-y-6"},Gu={class:"flex-1 overflow-hidden"},Yu={class:"text-xs text-[var(--k-text-color-secondary)] mb-1 font-bold"},qu={class:"p-3 bg-[var(--k-card-bg)] rounded-2xl rounded-tl-none shadow-sm text-sm break-all border border-[var(--k-border-color)]"},Wu={class:"flex h-14 items-center px-4 font-bold border-b border-white/10 bg-black text-white shadow-sm"},Xu={class:"flex-1 flex items-center justify-center p-4"},Zu=["src"],Ju={class:"p-6 space-y-6 bg-gray-50 dark:bg-black/10"},Qu={class:"flex-1 overflow-hidden"},ec={class:"text-xs text-[var(--k-text-color-secondary)] mb-1 font-bold"},tc={class:"p-3 bg-[var(--k-card-bg)] rounded-2xl rounded-tl-none shadow-sm text-sm break-all border border-[var(--k-border-color)]"},nc={class:"flex flex-col items-center gap-4"},oc=["src"],ac=K({__name:"index",setup(e){const{bots:t,selectedBot:n,selectedChannel:o,currentChannels:a,currentMessages:r,currentChannelName:s,inputText:l,uploadedImages:p,isSending:f,pinnedBots:C,pinnedChannels:x,scrollRef:T,isMobile:d,mobileView:c,goBack:u,forwardData:b,imageViewer:h,isLoadingHistory:m,selectBot:I,selectChannel:z,handleSend:D,togglePinBot:G,togglePinChannel:H,deleteBotData:V,deleteChannelData:Z,getCachedImageUrl:re,cacheImage:he,showForward:J,openImageViewer:N,downloadImage:ge,handleScroll:Pe}=yu(),nt=_=>new Date(_).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),U=w({get:()=>!d.value&&c.value==="forward",set:_=>{_||u()}}),W=w({get:()=>!d.value&&c.value==="image",set:_=>{_||u()}}),X=K({props:["element","botId","channelId"],setup(_){const E=A(""),se=["img","image","mface","audio","video"].includes(_.element.type),F=async()=>{const j=_.element.attrs.src||_.element.attrs.url||_.element.attrs.file;if(j){const te=await re(`${_.botId}:${_.channelId}`,j);if(te)E.value=te;else{const be=await he(`${_.botId}:${_.channelId}`,j);E.value=be||j}}};return se&&F(),ye(()=>_.element.attrs.src||_.element.attrs.url||_.element.attrs.file,F),()=>{var at;const{element:j,botId:te,channelId:be}=_,ne=j.type,Ve=j.attrs;if(ne==="text")return Q("span",Ve.content);if(ne==="img"||ne==="image"||ne==="mface"){const ae=ne==="mface";return Q("div",{class:"block my-1.5"},[Q("img",{src:E.value,class:["rounded-lg shadow-sm border border-black/5 block cursor-pointer hover:opacity-90 transition-opacity",ae?"max-w-[100px] max-h-[100px]":"max-w-full max-h-[400px]"],style:`min-width: ${ae?"30px":"50px"}; min-height: ${ae?"30px":"50px"}; object-fit: contain; background: rgba(0,0,0,0.05)`,onClick:le=>{le.stopPropagation(),N(E.value)},onError:le=>{le.target.src="",le.target.alt="图片加载失败"}})])}return ne==="audio"?Q("audio",{src:E.value,controls:true,class:"max-w-full my-1.5 block"}):ne==="video"?Q("video",{src:E.value,controls:true,class:"max-w-full my-1.5 rounded-lg shadow-sm block"}):ne==="at"?Q("span",{class:"text-blue-500 font-bold hover:underline cursor-default mx-0.5"},`@${Ve.name||Ve.id}`):ne==="p"?Q("div",{class:"my-1 block min-h-[1em]"},(j.children||[]).map((ae,le)=>Q(X,{key:le,element:ae,botId:te,channelId:be}))):ne==="i18n"?Q("span",{class:"opacity-80 italic"},`[${Ve.path||"i18n"}]`):ne==="figure"||ne==="forward"?Q("div",{class:"my-2 p-3 bg-black/5 dark:bg-white/5 rounded-xl border border-black/10 dark:border-white/10 max-w-[300px] cursor-pointer hover:bg-black/10 dark:hover:bg-white/10 transition-colors",onClick:ae=>{ae.stopPropagation(),J(j.children||[])}},[Q("div",{class:"flex items-center gap-2 mb-2 font-bold text-sm opacity-80"},[Q("el-icon",null,{default:()=>Q(Ea)}),Q("span","合并转发记录")]),Q("div",{class:"space-y-1.5"},(j.children||[]).filter(ae=>ae.type==="message").slice(0,4).map(ae=>{var le,Ue,rt,k;return Q("div",{class:"text-xs truncate opacity-70"},[Q("span",{class:"font-bold mr-1"},`${((le=ae.attrs)==null?void 0:le.nickname)||"用户"}:`),Q("span",((k=(rt=(Ue=ae.children)==null?void 0:Ue[0])==null?void 0:rt.attrs)==null?void 0:k.content)||"[富媒体内容]")])})),((at=j.children)==null?void 0:at.length)>4?Q("div",{class:"mt-2 pt-2 border-t border-black/5 dark:border-white/5 text-[10px] opacity-50"},`查看更多 ${j.children.length} 条内容...`):null]):ne==="quote"?null:Q("span",{class:"text-gray-400 italic text-xs"},`[${ne}]`)}}}),Oe=async _=>{const E=new FileReader;E.onload=async se=>{var te;const F=(te=se.target)==null?void 0:te.result,j=await Le("upload-image",{file:F,filename:_.name,mimeType:_.raw.type});j.success&&p.value.push({tempId:j.tempId,preview:URL.createObjectURL(_.raw),filename:_.name})},E.readAsDataURL(_.raw)},we=_=>{p.value=p.value.filter(E=>E.tempId!==_)},ee=A({show:false,x:0,y:0,type:"",id:"",isPinned:false}),_t=(_,E)=>{ee.value={show:true,x:_.clientX,y:_.clientY,type:"bot",id:E.selfId,isPinned:C.value.has(E.selfId)}},ot=(_,E)=>{ee.value={show:true,x:_.clientX,y:_.clientY,type:"channel",id:E.id,isPinned:x.value.has(`${n.value}:${E.id}`)}},He=async _=>{ee.value.show=false,_==="pin"?ee.value.type==="bot"?await G(ee.value.id,ee.value.isPinned,C.value):await H(n.value,ee.value.id,ee.value.isPinned,x.value):_==="delete"&&(await mu.confirm("确定删除所有数据吗?此操作不可恢复。","警告",{type:"warning",confirmButtonClass:"el-button--danger"}),ee.value.type==="bot"?await V(ee.value.id):await Z(n.value,ee.value.id),location.reload())};return De(()=>{window.addEventListener("click",()=>ee.value.show=false)}),(_,E)=>{const se=ue("el-avatar"),F=ue("el-icon"),j=ue("el-scrollbar"),te=ue("el-aside"),be=ue("el-button"),ne=ue("el-image"),Ve=ue("el-upload"),at=ue("el-input"),ae=ue("el-empty"),le=ue("el-main"),Ue=ue("el-container"),rt=ue("el-dialog");return v(),S("div",wu,[B(Ue,{class:"h-full w-full"},{default:L(()=>[Je(B(te,{width:i(d)?"100%":"280px",class:"flex flex-col border-r border-[var(--k-border-color)] bg-[var(--k-page-bg)] brightness-95 dark:brightness-90"},{default:L(()=>[E[7]||(E[7]=y("div",{class:"flex h-14 items-center px-4 font-bold border-b border-[var(--k-border-color)] text-lg text-[var(--k-text-color)]"}," 机器人",-1)),B(j,{class:"flex-1"},{default:L(()=>[(v(true),S(ie,null,Ne(i(t),k=>(v(),S("div",{key:k.selfId,class:M(["flex items-center p-4 cursor-pointer transition-all hover:bg-[var(--k-button-hover-bg)] border-l-4 border-transparent",{"!border-[var(--k-color-primary)] bg-[var(--k-button-active-bg)] text-[var(--k-color-primary)]":i(n)===k.selfId}]),onClick:pe=>i(I)(k.selfId),onContextmenu:Ae(pe=>_t(pe,k),["prevent"])},[B(se,{size:44,src:k.avatar,class:"flex-shrink-0 shadow-sm"},{default:L(()=>[ce(Y(k.username[0]),1)]),_:2},1032,["src"]),y("div",_u,[y("div",Cu,[ce(Y(k.username)+" ",1),i(C).has(k.selfId)?(v(),O(F,{key:0,class:"text-orange-400"},{default:L(()=>[B(i(Un))]),_:1})):P("",true)]),y("div",ku,Y(k.platform),1)]),y("div",{class:M(["w-2.5 h-2.5 rounded-full ml-2 shadow-inner",k.status==="online"?"bg-green-500":"bg-gray-400"])},null,2)],42,xu))),128))]),_:1})]),_:1},8,["width"]),[[Qe,!i(d)||i(c)==="bots"]]),Je(B(te,{width:i(d)?"100%":"260px",class:"flex flex-col border-r border-[var(--k-border-color)] bg-[var(--k-page-bg)] brightness-100 dark:brightness-95"},{default:L(()=>[y("div",Eu,[i(d)?(v(),O(be,{key:0,icon:"ArrowLeft",circle:"",size:"small",class:"mr-3",onClick:i(u)},null,8,["onClick"])):P("",true),E[8]||(E[8]=ce(" 频道 ",-1))]),B(j,{class:"flex-1"},{default:L(()=>[(v(true),S(ie,null,Ne(i(a),k=>(v(),S("div",{key:k.id,class:M(["flex items-center p-4 cursor-pointer transition-all hover:bg-[var(--k-button-hover-bg)] border-l-4 border-transparent",{"!border-[var(--k-color-primary)] bg-[var(--k-button-active-bg)] text-[var(--k-color-primary)]":i(o)===k.id}]),onClick:pe=>i(z)(k.id),onContextmenu:Ae(pe=>ot(pe,k),["prevent"])},[y("div",Iu,[y("div",Tu,[ce(Y(k.name)+" ",1),i(x).has(`${i(n)}:${k.id}`)?(v(),O(F,{key:0,class:"text-orange-400"},{default:L(()=>[B(i(Un))]),_:1})):P("",true)])])],42,Su))),128))]),_:1})]),_:1},8,["width"]),[[Qe,!i(d)&&i(n)||i(d)&&i(c)==="channels"]]),Je(B(le,{class:"flex flex-col p-0 bg-[var(--k-page-bg)] relative brightness-105 dark:brightness-100"},{default:L(()=>[i(n)&&i(o)?(v(),S(ie,{key:0},[y("div",Mu,[i(d)?(v(),O(be,{key:0,icon:"ArrowLeft",circle:"",size:"small",class:"mr-3",onClick:i(u)},null,8,["onClick"])):P("",true),y("span",Lu,Y(i(s)),1)]),y("div",Au,[B(j,{ref_key:"scrollRef",ref:T,onScroll:i(Pe)},{default:L(()=>[y("div",Bu,[i(m)?(v(),S("div",$u,[B(F,{class:"is-loading text-[var(--k-color-primary)]"},{default:L(()=>[B(i(St))]),_:1})])):P("",true),(v(true),S(ie,null,Ne(i(r),k=>(v(),S("div",{key:k.id,class:M(["flex mb-6 gap-3 group",k.isBot||k.userId===i(n)?"flex-row-reverse":"flex-row"])},[B(se,{size:40,src:k.avatar,class:"flex-shrink-0 shadow-sm"},{default:L(()=>[ce(Y(k.username[0]),1)]),_:2},1032,["src"]),y("div",{class:M(["max-w-[85%] md:max-w-[75%] flex flex-col",k.isBot||k.userId===i(n)?"items-end":"items-start"])},[y("div",Pu,[y("span",Ou,Y(k.username),1),y("span",Nu,Y(nt(k.timestamp)),1)]),y("div",{class:M(["p-3.5 rounded-2xl shadow-sm text-[15px] leading-relaxed break-all relative",k.isBot||k.userId===i(n)?"bg-[#95ec69] text-black rounded-tr-none":"bg-[var(--k-card-bg)] text-[var(--k-text-color)] rounded-tl-none border border-[var(--k-border-color)]"])},[k.quote?(v(),S("div",zu,[y("div",Ru,Y(k.quote.user.username)+":",1),y("div",Fu,[k.quote.elements&&k.quote.elements.length?(v(true),S(ie,{key:0},Ne(k.quote.elements,(pe,Ie)=>(v(),O(i(X),{key:Ie,element:pe,"bot-id":i(n),"channel-id":i(o)},null,8,["element","bot-id","channel-id"]))),128)):(v(),S(ie,{key:1},[ce(Y(k.quote.content),1)],64))])])):P("",true),y("div",Du,[k.elements&&k.elements.length?(v(true),S(ie,{key:0},Ne(k.elements,(pe,Ie)=>(v(),O(i(X),{key:Ie,element:pe,"bot-id":i(n),"channel-id":i(o)},null,8,["element","bot-id","channel-id"]))),128)):(v(),S(ie,{key:1},[ce(Y(k.content),1)],64))])],2)],2)],2))),128))])]),_:1},8,["onScroll"])]),y("div",Hu,[i(p).length?(v(),S("div",Vu,[(v(true),S(ie,null,Ne(i(p),k=>(v(),S("div",{key:k.tempId,class:"relative w-20 h-20 flex-shrink-0 group"},[B(ne,{src:k.preview,fit:"cover",class:"w-full h-full rounded-lg border-2 border-[var(--k-border-color)] shadow-sm"},null,8,["src"]),B(F,{class:"absolute -top-2 -right-2 cursor-pointer text-red-500 bg-white rounded-full shadow-md opacity-0 group-hover:opacity-100 transition-opacity",onClick:pe=>we(k.tempId)},{default:L(()=>[B(i(In))]),_:1},8,["onClick"])]))),128))])):P("",true),y("div",Uu,[B(Ve,{action:"#","auto-upload":false,"show-file-list":false,"on-change":Oe,multiple:""},{default:L(()=>[B(be,{circle:"",class:"!w-10 !h-10 !text-xl shadow-sm hover:scale-105 transition-transform"},{default:L(()=>[B(F,null,{default:L(()=>[B(i($a))]),_:1})]),_:1})]),_:1}),B(at,{modelValue:i(l),"onUpdate:modelValue":E[0]||(E[0]=k=>Cn(l)?l.value=k:null),type:"textarea",autosize:{minRows:1,maxRows:4},placeholder:"输入消息...",class:"flex-1 !text-base",onKeydown:Et(Ae(i(D),["prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),B(be,{type:"primary",loading:i(f),onClick:i(D),class:"px-6 h-10 !text-base font-bold shadow-md"},{default:L(()=>[...E[9]||(E[9]=[ce("发送",-1)])]),_:1},8,["loading","onClick"])])])],64)):(v(),O(ae,{key:1,description:"请选择频道开始对话",class:"h-full flex items-center justify-center opacity-60"}))]),_:1},512),[[Qe,!i(d)&&i(n)&&i(o)||i(d)&&i(c)==="messages"]]),i(d)&&i(c)==="forward"?(v(),O(le,{key:0,class:"flex flex-col p-0 bg-[var(--k-page-bg)] absolute inset-0 z-50"},{default:L(()=>[y("div",ju,[B(be,{icon:"ArrowLeft",circle:"",size:"small",class:"mr-3",onClick:i(u)},null,8,["onClick"]),E[10]||(E[10]=y("span",null,"聊天记录",-1))]),B(j,{class:"flex-1 bg-gray-50 dark:bg-black/10"},{default:L(()=>[y("div",Ku,[(v(true),S(ie,null,Ne(i(b).messages,(k,pe)=>{var Ie,st;return v(),S("div",{key:pe,class:"flex gap-3"},[B(se,{size:36,src:(Ie=k.attrs)==null?void 0:Ie.avatar,class:"flex-shrink-0 shadow-sm"},{default:L(()=>{var Ee,Te;return[ce(Y((Te=(Ee=k.attrs)==null?void 0:Ee.nickname)==null?void 0:Te[0]),1)]}),_:2},1032,["src"]),y("div",Gu,[y("div",Yu,Y((st=k.attrs)==null?void 0:st.nickname),1),y("div",qu,[(v(true),S(ie,null,Ne(k.children,(Ee,Te)=>(v(),O(i(X),{key:Te,element:Ee,"bot-id":i(n),"channel-id":i(o)},null,8,["element","bot-id","channel-id"]))),128))])])])}),128))])]),_:1})]),_:1})):P("",true),i(d)&&i(c)==="image"?(v(),O(le,{key:1,class:"flex flex-col p-0 bg-black absolute inset-0 z-[60]"},{default:L(()=>[y("div",Wu,[B(be,{icon:"ArrowLeft",circle:"",size:"small",class:"mr-3 !bg-white/10 !border-none !text-white",onClick:i(u)},null,8,["onClick"]),E[12]||(E[12]=y("span",null,"查看图片",-1)),E[13]||(E[13]=y("div",{class:"flex-1"},null,-1)),B(be,{type:"primary",icon:"Download",size:"small",onClick:E[1]||(E[1]=k=>i(ge)(i(h).url))},{default:L(()=>[...E[11]||(E[11]=[ce("下载",-1)])]),_:1})]),y("div",Xu,[y("img",{src:i(h).url,class:"max-w-full max-h-full object-contain shadow-2xl"},null,8,Zu)])]),_:1})):P("",true)]),_:1}),i(d)?P("",true):(v(),O(rt,{key:0,modelValue:U.value,"onUpdate:modelValue":E[2]||(E[2]=k=>U.value=k),title:"聊天记录",width:"550px",class:"forward-dialog",teleported:""},{default:L(()=>[B(j,{"max-height":"70vh"},{default:L(()=>[y("div",Ju,[(v(true),S(ie,null,Ne(i(b).messages,(k,pe)=>{var Ie,st;return v(),S("div",{key:pe,class:"flex gap-3"},[B(se,{size:36,src:(Ie=k.attrs)==null?void 0:Ie.avatar,class:"flex-shrink-0 shadow-sm"},{default:L(()=>{var Ee,Te;return[ce(Y((Te=(Ee=k.attrs)==null?void 0:Ee.nickname)==null?void 0:Te[0]),1)]}),_:2},1032,["src"]),y("div",Qu,[y("div",ec,Y((st=k.attrs)==null?void 0:st.nickname),1),y("div",tc,[(v(true),S(ie,null,Ne(k.children,(Ee,Te)=>(v(),O(i(X),{key:Te,element:Ee,"bot-id":i(n),"channel-id":i(o)},null,8,["element","bot-id","channel-id"]))),128))])])])}),128))])]),_:1})]),_:1},8,["modelValue"])),i(d)?P("",true):(v(),O(rt,{key:1,modelValue:W.value,"onUpdate:modelValue":E[4]||(E[4]=k=>W.value=k),title:"查看图片",width:"fit-content",class:"image-viewer-dialog",teleported:"",center:""},{default:L(()=>[y("div",nc,[y("img",{src:i(h).url,class:"max-w-full max-h-[70vh] rounded shadow-lg"},null,8,oc),B(be,{type:"primary",icon:"Download",onClick:E[3]||(E[3]=k=>i(ge)(i(h).url))},{default:L(()=>[...E[14]||(E[14]=[ce("下载图片",-1)])]),_:1})])]),_:1},8,["modelValue"])),ee.value.show?(v(),S("div",{key:2,class:"fixed bg-[var(--k-card-bg)] border border-[var(--k-border-color)] shadow-xl z-[2000] py-1.5 rounded-lg min-w-[140px] backdrop-blur-sm bg-opacity-90",style:dt({left:ee.value.x+"px",top:ee.value.y+"px"})},[y("div",{class:"px-4 py-2.5 cursor-pointer text-sm hover:bg-[var(--k-button-hover-bg)] transition-colors flex items-center gap-2",onClick:E[5]||(E[5]=k=>He("pin"))},[B(F,null,{default:L(()=>[B(i(Na))]),_:1}),ce(" "+Y(ee.value.isPinned?"取消置顶":"置顶"),1)]),y("div",{class:"px-4 py-2.5 cursor-pointer text-sm text-red-500 hover:bg-[var(--k-button-hover-bg)] transition-colors flex items-center gap-2",onClick:E[6]||(E[6]=k=>He("delete"))},[B(F,null,{default:L(()=>[B(i(Ia))]),_:1}),E[15]||(E[15]=ce(" 删除数据 ",-1))])],4)):P("",true)])}}}),rc=(e,t)=>{const n=e.__vccOpts||e;for(const[o,a]of t)n[o]=a;return n},sc={},lc={class:"k-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none"};function ic(e,t){return v(),S("svg",lc,[...t[0]||(t[0]=[y("path",{d:"M8 10.5H16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),y("path",{d:"M8 14H13.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),y("path",{d:"M17 3.33782C15.5291 2.48697 13.8214 2 12 2C6.47715 2 2 6.47715 2 12C2 13.5997 2.37562 15.1116 3.04346 16.4525C3.22094 16.8088 3.28001 17.2161 3.17712 17.6006L2.58151 19.8267C2.32295 20.793 3.20701 21.677 4.17335 21.4185L6.39939 20.8229C6.78393 20.72 7.19121 20.7791 7.54753 20.9565C8.88837 21.6244 10.4003 22 12 22C17.5228 22 22 17.5228 22 12C22 10.1786 21.513 8.47087 20.6622 7",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])])}const uc=rc(sc,[["render",ic]]);ma.register("activity:chat",uc);const pc=e=>{e.page({name:"聊天室",path:"/chat-patch",desc:"",authority:4,icon:"activity:chat",component:K({setup(){return()=>Q(ue("k-layout"),{},{default:()=>Q(ac)})}})})};export{pc as default};
|