102 lines
788 KiB
JavaScript
102 lines
788 KiB
JavaScript
import{c as fy,s as yn,T as my,u as qt,r as ud}from"./@vue/runtime-dom-DVgibYoU.js";import{i as nt,I as gy,a as vy,b as Fh,c as yy,d as Er,T as Tt,_ as _y,u as ve,e as jc,f as jh,g as by,h as nr,j as Gh,k as wy,l as ut,m as Sy,n as ky,o as Ey,p as Cy,q as ki,r as My,s as $y,t as Gc,v as Ty,w as Wl,x as Iy,y as Ay,z as xy,A as qh,B as Oy,C as Ry,D as Py,E as Dy,F as Ny,G as Ly,H as Uy,J as By,K as Fy,L as jy,M as Gy,N as qy,O as Hy,P as Vy,Q as zy}from"./@tencentcloud/uikit-base-component-vue3-CG74Nqga.js";import{f as z,ak as _,G as U,a as V,aN as j,I as O,J as I,H as Y,O as ge,T as qc,A as B,aq as ee,aF as Hh,at as se,i as he,F as ie,ap as we,ar as Wy,w as ce,k as Ky,g as Zn,n as Fe,a5 as Hc,C as Yy,ab as Me,y as Jy,b as qe,d as st,ae as Da,aJ as Wt,am as Vc,aK as Vh,a9 as zh,aC as Xy,Z as Ro,ad as Qy}from"./@vue/runtime-core-D7eUgySO.js";import{Q as H,o as S,p as De,B as Zy,z as Wh,P as kn}from"./@vue/shared-C75lBtbe.js";import{o as A,y as f,M as e_,K as rn,L as _t,u as Na,r as ur,B as Kh,H as t_,C as Yh,F as Jh,a as sl,q as Xh,J as n_,c as Fo,m as zc}from"./@vue/reactivity-maRK_BBd.js";import{X as oe,Q as Re,o as He,n as yt,i as ze,t as Cr,r as Ct,s as Ei,D as Ce,a as us}from"./@tencentcloud/chat-uikit-engine-DgKjflbG.js";import{A as Ci,R as Kl,E as qn}from"./@tencentcloud/tui-core-aciHwo_F.js";import{t as o_}from"./vue-BWLcg9DT.js";import{H as r_}from"./@tencentcloud/tuiroom-engine-js-BDAeGN9D.js";const un=(t,e,n=!0,o=!1)=>{nt.addResourceBundle(t,"translation",e.translation,n,o)},Wc=typeof wx<"u"&&typeof wx.getSystemInfoSync=="function"&&!!wx.getSystemInfoSync().fontSizeSetting,Qh=typeof uni<"u"&&typeof window>"u",a_=Wc||Qh,dr=(typeof uni<"u"||typeof window<"u")&&!a_,Yn=dr&&window&&window.navigator&&window.navigator.userAgent||"",s_=/Android/i.test(Yn),i_=/(?:Windows Phone)/.test(Yn),l_=/(?:SymbianOS)/.test(Yn),Zh=/OpenHarmony/i.test(Yn),c_=Zh&&/\(PC[;,]/i.test(Yn),u_=Zh&&!c_,d_=dr&&("ontouchstart"in window||navigator.maxTouchPoints>0)&&(function(){if(dr){if(/Tablet|Pad/i.test(Yn))return!0;if(window.orientation===180||window.orientation===0)return window.innerWidth>=768&&window.innerHeight>=1024;if(window.orientation===90||window.orientation===-90)return window.innerWidth>=1024&&window.innerHeight>=768}return!1})(),p_=/iPhone/i.test(Yn)||/iPod/i.test(Yn),h_=Wc,ef=s_||i_||l_||p_||d_||u_,f_=dr&&!ef,m_=Qh&&!Wc;function La(){let t="";return f_?t="pc":ef?t="h5":h_?t="wechat":m_&&(t="app"),t}let g_=class As{constructor(){if(As.instance)return As.instance;As.instance=this,this.eventCallback=null,this.listener=null,this.button=0,this.init()}init(){dr&&(this.eventCallback=e=>{this.listener&&this.listener(e)},document.addEventListener("mousedown",this.eventCallback))}listen(e){if(dr){const{domRefs:n,ignoreDomRefs:o,handler:r,button:a=0}=e;this.button=a,this.listener=s=>{const i=Array.isArray(o)?o:[o];for(const c of i)if(c&&c.contains(s.target))return;const l=Array.isArray(n)?n:[n];for(const c of l)if(c&&c.contains(s.target)&&this.button===s.button)return;r(s),this.remove()}}}remove(){this.listener=null,this.button=-1}};console.log("UniversalAPI.VERSION:2.4.1");new g_;const v_={"The room does not exist, please confirm the room number or create a room!":"房间不存在,请确认房间号或创建房间!","Log out":"退出登录","Edit profile":"编辑资料","User Name":"用户名","Please input user name":"请输入名称","Username length should be greater than 0":"昵称长度应该大于0",Save:"保存",Camera:"摄像头",Mic:"麦克风","Off Camera":"摄像头已关闭","Mic settings":"麦克风设置",Output:"输出",Speaker:"扬声器",Test:"测试",Stop:"停止测试",Preview:"视频画面",Mirror:"视频镜像",Resolution:"分辨率","More Camera Settings":"更多摄像头设置","Join the room ?":"是否进入房间?","You are invited to room ":"您被邀请进入 ",Room:"房间",Join:"加入","Switch Theme":"换肤",Layout:"布局","New Room":"新建房间","Room Type":"房间类型","Your Name":"您的名字","Turn on the microphone":"开启麦克风","Turn on the speaker":"开启扬声器","Turn on the video":"开启视频","Free Speech Room":"自由发言房间","On-stage Speaking Room":"上台发言房间","Join Room":"进入房间","Enter room ID":"输入房间号","video conferencing":" 的视频会议","Quick Conference":"的快速会议","Room ID":"房间号","Low Definition":"流畅","Standard Definition":"标清","High Definition":"高清","Super Definition":"超清","End sharing":"结束共享","Stop sharing?":"是否停止屏幕共享?","Stop sharing":"停止共享","You are sharing the screen...":"你正在共享屏幕...",Sure:"确定",Sharing:"屏幕共享中","Share screen":"共享屏幕","Grant permission to screen recording":"打开屏幕录制权限","Open the system preferences settings":"打开系统便好设置",'Due to macOS 10.15 system requirements, please check the current application in "System Preferences - Security & Privacy - Screen Recording".':'由于macos 10.15 系统要求,请在"系统偏好设置-安全性与隐私-屏幕录制"中勾选当前应用程序。',"Others will no longer see your screen after you stop sharing. Are you sure you want to stop?":"是否结束当前的共享屏幕,停止后所有人将无法继续观看屏幕内容","Others will no longer see your screen after you stop sharing.":"停止后所有人将无法继续观看屏幕内容","You currently do not have sharing permission, please raise your hand to apply for sharing permission first":"您当前没有共享权限,请先举手申请上台获取共享权限","You currently do not have whiteboard permission, please raise your hand to apply for whiteboard permission first":"您当前没有白板权限,请先举手申请上台获取白板权限",Host:"房主",Me:"我",me:"我",Admin:"管理员",RoomOwner:"主持人",More:"更多","AI Assistant":"AI 助手","AI real-time conference content":"AI 实时会议内容","Turn on AI real-time subtitles":"开启AI实时字幕","Turn off AI real-time subtitles":"关闭AI实时字幕","Enable AI real-time meeting recording":"开启AI实时会议记录","Raise hand":"举手",Agree:"同意",Chat:"聊天",Cancel:"取消",Exit:"退出全屏","Full screen":"全屏",Members:"成员","Search Member":"搜索成员","Make host":"转交房主","Set as administrator":"设为管理员","Remove administrator":"撤销管理员","The administrator status of sb has been withdrawn":({named:t})=>`已将 ${t("name")} 的管理员身份撤回`,"sb has been set as administrator":({named:t})=>`已将 ${t("name")} 设为管理员`,"You have been invited by the administrator to step down, please raise your hand if you need to speak":"您已被管理员邀请下台,需要发言请先举手",Invite:"邀请",Settings:"设置",VirtualBackground:"虚拟背景",Close:"关闭",BlurredBackground:"背景模糊",EndPC:"结束房间",EndH5:"结束",Tips:"提示",'You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed. If you choose "Leave Room", the current room will not be disbanded, and your hosting privileges will be transferred to other members.':"您当前是房间主持人,请选择相应操作。若选择“结束房间”,将解散当前房间并将全体成员移出。若选择“离开房间”,当前房间不会解散,您的主持人权限将移交给其他成员。",'You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed.':"您当前是房间主持人,请选择相应操作。若选择“结束房间”,将解散当前房间并将全体成员移出。","If you do not want to end the meeting, please designate a new host before leaving the meeting.":"如果您不想结束会议,请在离开会议前指定新的主持人。","Are you sure you want to leave this room?":"确定离开房间吗?","New host":"选择主持人","Transfer and leave":"移交并离开","Leave room?":"是否要离开房间","Select a new host":"请选择新的房间主持人","Appoint a new host":"指定一位新的主持人","The host closed the room.":"主持人结束会议,已解散房间",Note:"通知",Confirm:"确认",Leave:"离开房间",Dismiss:"结束房间","The administrator has been changed to ":"管理员已变更为","Muted by the moderator":"已被主持人禁言","Type a message":"说点什么...",Send:"发送","Failed to send the message":"发送消息失败","Applying for the stage":"正在申请上台","Apply for the stage":"申请上台","Cancel Apply":"取消申请","Are you sure you want to step down":"确定要下台吗",Check:"查看",Neglect:"忽略","Disable all audios":"全体静音","Enable all audios":"解除全体静音","Disable all videos":"全体静画","Enable all videos":"解除全体静画","All mute":"全体静音","All current and new members will be muted":"所有及新加入的成员将被静音","All and new members will be banned from the camera":"所有及新加入的成员将被禁止视频","All stop video":"全体禁画","Lift all mute":"取消全体静音","Lift stop all video":"取消全体禁画","No relevant user found.":"未找到相关用户","Member List":"成员列表",Unmute:"解除静音","Cancel Unmute":"取消解除禁言",Mute:"静音",members:"人","Failed to get chat message":"获取聊天消息失败","Agree to the stage":"同意上台","Take the stage now":"立即上台","Stay off the stage":"暂不上台","Cancel stage":"取消邀请上台","Invite stage":"邀请上台","Refuse stage":"拒绝上台","Members applying on stage":"成员上台申请","Enable video":"请求开启视频","Cancel Enable video":"取消解除禁画","Disable video":"关闭视频","Enable chat":"解除禁言","Disable chat":"禁言","Kick out":"踢出房间","is sharing their screen":"的屏幕分享","Apply to stage":"上台申请","Apply to stage application":"请求上台申请","Member Onstage Application":"成员上台申请",Reject:"拒绝","Reject All":"全部拒绝","Agree All":"全部同意","Please raise your hand to apply":"如果您想发言请先举手申请上麦","You can turn on the microphone and camera once you are on stage":"上台后可以打开麦克风和摄像头","Sb invites you to speak on stage":({named:t})=>`${t("role")}邀请您上台发言`,"After agreeing to go on stage, you can turn on the camera and microphone. Do you agree to go on stage?":"同意上台后可打开摄像头和麦克风,是否同意上台?","Hand down":"手放下","Step down(Master)":"邀请下台","Step down":"下台","sb has rejected your application for the stage":({named:t})=>`${t("role")}拒绝了你的上台申请`,"You have been invited by the host to step down, please raise your hand if you need to speak":"您已被主持人邀请下台,需要发言请先举手","Select a screen/window":"选择屏幕/窗口",Screen:"屏幕",Window:"窗口",Share:"开始分享","Safety Reminder":"安全提醒","Continue sharing":"继续共享","Select a screen or window first":"请选择要分享的屏幕或者窗口",Grid:"一屏九等分","Gallery on right":"右侧成员列表","Gallery at top":"顶部成员列表","Network ":"网络",Latency:"延迟",Stability:"稳定",Fluctuation:"波动",Lag:"卡顿",Disconnected:"已断开","Packet loss":"丢包率","Share the room ID or invite link":"您可以通过复制房间号或者邀请链接的方式邀请更多人加入房间","Invite by room number":"通过房间号邀请","Invite via room link":"通过房间链接邀请","Room Link":"房间链接","You can share the room number or link to invite more people to join the room.":"您可以分享房间号或链接邀请更多人加入房间。","You can share the room number to invite more people to join the room":"您可以分享房间号邀请更多人加入房间","If you have any questions, please feel free to join our QQ group or send an email":"如果有任何问题欢迎加入我们的QQ群或者发送邮件。","If you have any questions, please email us.":"如果有任何问题欢迎加入我们的交流群或者发送邮件。","Join our product discussion group":"加入产品交流群","Our email address":"我们的邮件地址","Join now":"立即加入","Room QR code":"房间二维码",Participants:"参会成员","Search for conference attendees":"搜索参会成员","Invite via client scheme":"通过客户端 scheme 邀请","Contact us":"联系我们","Member management":"成员管理","Grid view":"宫格视图","Join our QQ group chat or email us.":"如果有任何问题欢迎加入我们的QQ群或者发送邮件","group chat":"QQ 群",Email:"邮箱地址","Audio settings":"声音设置","Camera settings":"摄像头设置",Copy:"复制","Copied successfully":"复制成功","Copied failure":"复制失败","This model does not support copying at this time":"此机型暂不支持复制","accepted the invitation to the stage":"接受了上台邀请","declined the invitation to the stage":"拒绝了上台邀请","All audios disabled":"已开启全体静音","All audios enabled":"已解除全体静音","Your microphone has been turned off":"已关闭您的麦克风","Sb invites you to turn on the microphone":({named:t})=>`${t("role")}邀请你打开麦克风`,"All videos disabled":"已开启全体禁画","All videos enabled":"已解除全体禁画","Your camera has been turned off":"已关闭您的摄像头","Sb invites you to turn on the camera":({named:t})=>`${t("role")}邀请你打开摄像头`,"The host has turned off your screen sharing":"主持人已关闭您的屏幕分享","Turn on the camera":"打开摄像头","Keep it closed":"保持关闭","You have been banned from text chat":"您被禁止文字聊天","You are allowed to text chat":"您被允许文字聊天","kicked out of the room by the host":"被主持人踢出房间","kicked out of the room":"被踢出房间","kicked out of the room by serve":"被服务端踢出房间","Reject sb on stage failed, please retry":({named:t})=>`拒绝 ${t("name")} 上台失败, 请重试`,"Agree sb on stage failed, please retry":({named:t})=>`同意 ${t("name")} 上台失败, 请重试`,"Has been fully muted and cannot open the microphone":"已被全员静音,无法打开麦克风","Has been muted by the host and cannot open the microphone":"已被主持人静音,无法打开麦克风","To apply to speak in the room, please raise your hand first to apply for the microphone":"申请发言房间,请先举手申请上麦","Has been full static painting, can not open the video":"已被全员静画,无法打开视频","It has been stilled by the host and cannot open the video":"已被主持人静画,无法打开视频","Failed to enter the room.":"进入房间失败!","Has been full static painting, can not share your screen":"已被全员静画,无法打开屏幕分享","Microphone not detected on current device":"当前设备未检测到麦克风","Camera not detected on current device":"当前设备未检测到摄像头","Camera And Microphone not detected on current device":"当前设备未检测到摄像头和麦克风","Another user is sharing the screen.":"其他成员正在屏幕共享","Screen sharing is currently active, cannot start the whiteboard.":"当前正在屏幕共享,无法开启白板","This action causes the room to be exited, does it continue?":"该操作会导致退出房间,是否继续?","This action causes the room to be disbanded, does it continue?":"该操作会导致解散房间,是否继续?","Sharing screens may lead to the leakage of private information such as SMS verification codes and passwords, resulting in financial losses. Please be vigilant against various forms of fraud.":"共享屏幕时可能会泄露短信验证码、密码等隐私信息,造成财产损失,请警惕各种诈骗行为","Please enter the room number":"请输入房间号","The current browser does not support capturing audio and video":"当前浏览器不支持采集音频和视频","The current browser does not support getting microphone and camera list":"当前浏览器不支持获取麦克风和摄像头列表","The current browser does not support screen sharing":"当前浏览器不支持屏幕分享","The current browser does not support capturing audio":"当前浏览器不支持采集音频","The current browser does not support capturing video":"当前浏览器不支持采集视频","The current browser does not support audio and video communication capabilities":"当前浏览器不支持音视频通信能力","whether to kick sb off the room":({named:t})=>`是否将 ${t("name")} 移出房间`,"An invitation to open the microphone has been sent to sb.":({named:t})=>`已向 ${t("name")} 发出开启麦克风邀请`,"An invitation to open the camera has been sent to sb.":({named:t})=>`已向 ${t("name")} 发出开启摄像头邀请`,"Make host failed, please try again.":"转交房主失败,请重试","Sb has been set as an administrator":({named:t})=>`已将 ${t("name")} 设为管理员`,"Succeed on stage":"上台成功","After unlocking, users can freely turn on the microphone":"解除后用户可以自由开启麦克风","Members will not be able to open the microphone":"成员将无法开启麦克风","After unlocking, users can freely turn on the camera":"解除后用户可以自由开启视频","Members will not be able to open the camera":"成员将无法开启视频画面","You have become a administrator":"您已成为管理员","You are now a room owner":"您已成为房主","Your administrator status has been revoked":"您的管理员身份被收回","After transfer the room owner, you will become a general user":"转交房主后将成为普通成员","Transfer the roomOwner to sb":({named:t})=>`将房主转移给${t("name")}`,"Confirm transfer":"确认转交","The room owner has been transferred to sb":({named:t})=>`已将房主转交给${t("name")}`,"Application to go on stage was rejected":"上台申请被拒绝","You are now an administrator":"您已成为管理员","The RoomOwner has withdrawn your administrator privileges":"房主已收回您的管理员权限","This member has already received the same request, please try again later":"该成员已收到相同请求,请稍后再试","The request to go on stage has timed out":"上台请求已超时","The invitation to sb to go on stage has timed out":({named:t})=>`对${t("name")}的上台邀请已超时`,"Currently no member has applied to go on stage":"暂无成员申请上台",Operate:"操作","Stage management":"上台管理","On stage":"已上台","Not on stage":"未上台","To go on stage again, you need to reapply and wait for the roomOwner/administrator to approve":"再次上台需重新发起申请,并等待房主/管理员通过","To go on stage again, a new application needs to be initiated":"再次上台需重新发起申请","The request to go on stage has been sent out, please wait for the roomOwner/administrator to approve it":"上台申请已发出,请等待房主/管理员通过","Cancellation request has been sent, please wait for the roomOwner/administrator to approve it":"取消上台申请已发出,请等待房主/管理员通过","Canceled application to go on stage":"已取消上台申请","and so on":"等","people applying to stage":"人正在申请上台","and so on number people applying to stage":({named:t})=>`等 ${t("number")} 人正在申请上台`,"The stage is full, please contact the host":"台上人数已满,请联系主持人","The stage is full":"台上人数已满","change name":"修改名称","quick conference":"快速会议",Meeting:"会议","Meeting in progress":"会议 进行中",Initiating:"正在发起","X people have joined":({named:t})=>`${t("number")} 人已入会`,"Waiting for members to join the meeting":"等待成员入会","X people are in the meeting":({named:t})=>`${t("number")} 人在会议中`,"Already joined":"已入会","Enter the meeting":"进入会议","Ending meeting":"正在结束会议","The meeting has ended":"会议已结束","Currently in a meeting, please exit the current meeting before proceeding.":"正在会议中,请先退出当前会议后再进行操作","Failed to initiate meeting":"发起会议失败","Failed to enter the meeting":"进入会议失败","Failed to disable chat":"禁言失败","All members can share screen":"全体成员可共享屏幕","Screen sharing for host/admin only":"仅房主/管理员可共享屏幕","Failed to initiate screen sharing, currently only host/admin can share screen.":"发起共享失败,当前仅房主/管理员可以共享","Is it turned on that only the host/admin can share the screen?":"是否开启仅房主/管理员可共享屏幕?","Other member is sharing the screen is now, the member's sharing will be terminated after you turning on":"当前有成员正在共享屏幕, 开启后该成员的共享将会被终止","Your screen sharing has been stopped":"共享屏幕停止","Your screen sharing has been stopped, Now only the host/admin can share the screen":"已停止您的共享,当前仅房主/管理员可以共享屏幕","The system prohibits the current browser from accessing the screen content, please enable the screen sharing privilege.":"系统禁止当前浏览器获取屏幕内容, 请开启屏幕分享权限。","User canceled screen sharing":"用户取消屏幕分享","An unknown error occurred while screen sharing, please try again.":"屏幕分享发生了未知错误,请重试","I got it":"我知道了",Attention:"注意",'Audio playback failed. Click the "Confirm" to resume playback':"音频播放失败。单击 “确认 ”恢复播放。","x people selected":({named:t})=>`已选择${t("number")}人`,Modify:"修改","view details":"查看详情","modify room":"修改房间","cancel room":"取消房间","No room available for booking":"暂无预订房间",Ongoing:"进行中",finished:"已结束","History room":"历史房间","sb temporary room":({named:t})=>`${t("name")}的临时房间`,year:"年",month:"月",day:"日",Schedule:"预订房间","Modify Room":"修改房间","Room Name":"房间名称","please enter the room name":"请输入房间名称","Room type":"房间类型","Starting time":"开始时间","Room duration":"房间时长","Time zone":"时区",Attendees:"参与成员","Please enter the member name":"请输入成员名称",people:"人",Contacts:"联系人","No relevant members found":"暂无相关成员","Selected Contact":"已选联系人","Scheduled meetings":"预订的会议",minute:"分钟",hour:"小时",minutes:"分钟",hours:"小时","The start time cannot be earlier than the current time":"开始时间不能早于当前时间","Room Time":"房间时间",Creator:"发起人","Room Details":"房间详情","Enter Now":"立即进入","Invited members":"邀请成员","The room is closed":"房间已结束","Entry Time":"进房时间","Duration of participation":"参会时长","No cancellation":"暂不取消","Cancellation of scheduled rooms":"取消已预订的房间","Other members will not be able to join after cancellation":"取消后其他成员将无法加入","Inviting members to join":"邀请成员加入","Invitation by room ID":"通过房间号邀请","Invitation via room link":"通过房间链接邀请","Copy the conference number and link":"复制会议号与链接","Schedule successful, invite members to join":"预订成功,邀请成员加入","Name changed successfully":"名称修改成功","schedule year":"年","schedule month":"月","schedule day":"日","The room name cannot exceed 100 characters":"房间名称不能超过100个字节","The room name cannot be empty":"房间名不能为空","The meeting is in progress and any meeting information cannot be modified":"进行中的会议,不能修改任何会议信息","Schedule room loading":"预定房间加载中...","The user name cannot exceed 32 characters":"用户名称不能超过32个字节","sb invites you to join the conference":({named:t})=>`${t("name")} 邀请您加入会议`,microphone:"麦克风",camera:"摄像头","Unable to use the device":({named:t})=>`无法使用${t("deviceType")}`,"media device failed to open, please check the media device and try again":({named:t})=>`打开${t("deviceType")}失败, 请检查${t("deviceType")}设备并重试`,"Please check the current browser camera permission":"请检查当前浏览器的摄像头权限","The current device is not authorized, please allow access to the device permissions":({named:t})=>`${t("deviceType")}设备未授权, 请允许访问${t("deviceType")}权限`,"The current device is occupied by other apps, try to close other apps or change the device":({named:t})=>`当前${t("deviceType")}被其他应用程序占用,请尝试关闭其他应用程序或更换${t("deviceType")}`,"Turn on device privileges":({named:t})=>`打开${t("deviceType")}权限`,'You can go to "System Preferences - Security & Privacy - Device" to enable device permissions':({named:t})=>`你可前往"系统设置 - 隐私与安全性 - ${t("deviceType")}"开启设备权限。`,"Go to Settings":"前往设置",addMember:"添加成员",shareRoom:"分享房间","Invitation sent, waiting for members to join.":"邀请信息已发出,等待成员加入","Not joining for now":"暂不入会","Not Entered":"未进入",Entered:"已进房",Call:"呼叫","Calling...":"呼叫中...","Call all":"呼叫所有人","Busy line":"忙线中","Entering the room now...":"正在进入房间...","The room is encrypted":"房间已加密","Please enter the password":"请输入入会密码","Your room password format is incorrect, please check it":"房间密码格式不正确,请检查",Security:"安全设置","Room Password":"进房密码","Enter 6-digit password":"请输入6位进房密码","Wrong password":"密码错误",Encryption:"房间加密","Open whiteboard":"开启白板","Close whiteboard":"关闭白板","Start annotating":"开始批注","End annotating":"结束批注","You are sharing the whiteboard, please stop sharing first":"您正在共享白板,请先停止共享","Line Size":"线条粗细","Line Color":"线条颜色","Arrow Size":"箭头大小","Arrow Color":"箭头颜色","Text Size":"文字大小","Text Color":"文字颜色","Shape Type":"图形类型","Shape Style":"形状样式","Shape Color":"图形颜色","Shape Size":"图形大小",Beauty:"美颜","Beauty Effects":"美颜特效",Smoother:"磨皮",Whitening:"美白",Ruddy:"红润",Compare:"对比",Reset:"重置",Degree:"程度","Sure you want to reset the beauty effect?":"确定要重置美颜效果吗?","All beauty parameters will revert to default after reset":"重置后所有美颜参数将恢复至默认","Theme Colours":"主题色","Custom Themes":"自定义主题"},y_={"The room does not exist, please confirm the room number or create a room!":"The room does not exist, please confirm the room number or create a room!","Log out":"Log out","Edit profile":"Edit profile","User Name":"User Name","Please input user name":"Please input user name","Username length should be greater than 0":"Username length should be greater than 0",Save:"Save",Camera:"Camera",Mic:"Mic","Off Camera":"Off Camera","Mic settings":"Mic settings",Output:"Output",Speaker:"Speaker",Test:"Test",Stop:"Stop",Preview:"Preview",Mirror:"Mirror",Resolution:"Resolution","More Camera Settings":"More Camera Settings","Join the room ?":"Join the room ?","You are invited to room ":"You are invited to room ",Room:"Room",Join:"Join",Sure:"Sure","Switch Theme":"Theme",Layout:"Layout","New Room":"New Room","Room Type":"Room Type","Your Name":"Your Name","Grid view":"Grid view","Speaker view":"Speaker view","Turn on the microphone":"Turn on the microphone","Turn on the speaker":"Turn on the speaker","Turn on the video":"Turn on the video","Free Speech Room":"Free Speech Room","On-stage Speaking Room":"On-stage Speaking Room","Join Room":"Join Room","Enter room ID":"Enter room ID","video conferencing":" 's video conferencing","Quick Conference":" 's Quick Conference","Room ID":"Room ID","Low Definition":"Low Definition","Standard Definition":"Standard Definition","High Definition":"High Definition","Super Definition":"Super Definition","End sharing":"End sharing","Stop sharing?":"Stop sharing?","Stop sharing":"Stop sharing","You are sharing the screen...":"You are sharing the screen...",Sharing:"Sharing","Safety Reminder":"Safety Reminder","Share screen":"Share screen","Grant permission to screen recording":"Grant permission to screen recording","Open the system preferences settings":"Open the system preferences settings",'Due to macOS 10.15 system requirements, please check the current application in "System Preferences - Security & Privacy - Screen Recording".':'Due to macOS 10.15 system requirements, please check the current application in "System Preferences - Security & Privacy - Screen Recording".',"Others will no longer see your screen after you stop sharing. Are you sure you want to stop?":"Others will no longer see your screen after you stop sharing. Are you sure you want to stop?","Others will no longer see your screen after you stop sharing.":"Others will no longer see your screen after you stop sharing.","You currently do not have sharing permission, please raise your hand to apply for sharing permission first":"You currently do not have sharing permission, please raise your hand to apply for sharing permission first","You currently do not have whiteboard permission, please raise your hand to apply for whiteboard permission first":"You currently do not have whiteboard permission, please raise your hand to apply for whiteboard permission first",Host:"Host",Admin:"Admin",RoomOwner:"RoomOwner",Me:"Me",me:"me",More:"More","AI Assistant":"AI Assistant","AI real-time conference content":"AI real-time conference content","Turn on AI real-time subtitles":"Turn on AI real-time subtitles","Turn off AI real-time subtitles":"Turn off AI real-time subtitles","Enable AI real-time meeting recording":"Enable AI real-time meeting recording","Raise hand":"Raise hand",Agree:"Agree",Chat:"Chat",Cancel:"Cancel",Exit:"Exit full screen","Full screen":"Full screen",Members:"Members","Search Member":"Search Member","Make host":"Make host","Set as administrator":"Set as administrator","Remove administrator":"Remove administrator","The administrator status of sb has been withdrawn":({named:t})=>`The administrator status of ${t("name")} has been withdrawn`,"sb has been set as administrator":({named:t})=>`${t("name")} has been set as administrator`,"You have been invited by the administrator to step down, please raise your hand if you need to speak":"You have been invited by the administrator to step down, please raise your hand if you need to speak",Invite:"Invite",Settings:"Settings",VirtualBackground:"VirtualBackground",Close:"Close",BlurredBackground:"Blur",EndPC:"End",EndH5:"End",'You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed. If you choose "Leave Room", the current room will not be disbanded, and your hosting privileges will be transferred to other members.':'You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed. If you choose "Leave Room", the current room will not be disbanded, and your hosting privileges will be transferred to other members.','You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed.':'You are currently the host of the room, please choose the corresponding operation. If you choose "End Room", the current room will be disbanded and all members will be removed.',"If you do not want to end the meeting, please designate a new host before leaving the meeting.":"If you do not want to end the meeting, please designate a new host before leaving the meeting.","Are you sure you want to leave this room?":"Are you sure you want to leave this room?","New host":"New host","Transfer and leave":"Transfer and leave","Leave room?":"Leave room?","Select a new host":"Select a new host","Appoint a new host":"Appoint a new host","The host closed the room.":"The host closed the room.",Note:"Note",Confirm:"Confirm",Leave:"Leave",Dismiss:"Dismiss","The administrator has been changed to ":"The administrator has been changed to ","Muted by the moderator":"Muted by the moderator","Type a message":"Type a message",Send:"Send","Failed to send the message":"Failed to send the message","Applying for the stage":"Applying for the stage","Apply for the stage":"Apply for the stage","Cancel Apply":"Cancel Apply","Are you sure you want to step down":"Are you sure you want to step down",Check:"Check",Neglect:"Neglect","Disable all audios":"Disable all audios","Enable all audios":"Enable all audios","Disable all videos":"Disable all videos","Enable all videos":"Enable all videos","Member List":"Member List","All mute":"All mute","All stop video":"All stop video","Lift all mute":"Lift all mute","Lift stop all video":"Lift stop all video",Unmute:"Unmute","Cancel Unmute":"Cancel Unmute",Mute:"Mute",members:"members","Failed to get chat message":"Failed to get chat message","Agree to the stage":"Agree to the stage","Take the stage now":"Take the stage now","Stay off the stage":"Stay off the stage","Cancel stage":"Cancel stage","Invite stage":"Invite stage","Refuse stage":"Refuse stage","Members applying on stage":"Members applying on stage","Step down":"Step down","Step down(Master)":"Step down","Enable video":"Enable video","Disable video":"Disable video","Enable chat":"Enable chat","Disable chat":"Disable chat","Kick out":"Kick out","is sharing their screen":"is sharing their screen","Apply to stage":"Apply to stage","Apply to stage application":"Apply to stage application","Member Onstage Application":"Member Onstage Application",Reject:"Reject","Reject All":"Reject All","Agree All":"Agree All","Please raise your hand to apply":"Please raise your hand to apply","You can turn on the microphone and camera once you are on stage":"You can turn on the microphone and camera once you are on stage","Sb invites you to speak on stage":({named:t})=>`${t("role")} invites you to speak on stage`,"After agreeing to go on stage, you can turn on the camera and microphone. Do you agree to go on stage?":"After agreeing to go on stage, you can turn on the camera and microphone. Do you agree to go on stage?","Hand down":"Hand down","sb has rejected your application for the stage":({named:t})=>`${t("role")} has rejected your application for the stage`,"You have been invited by the host to step down, please raise your hand if you need to speak":"You have been invited by the host to step down, please raise your hand if you need to speak","If you have any questions, please email us.":"If you have any questions, please email us.","Join our product discussion group":"Join our product discussion group","Our email address":"Our email address","Join now":"Join now","Select a screen/window":"Select a screen/window",Screen:"Screen",Window:"Window",Share:"Share","Continue sharing":"Continue sharing","Select a screen or window first":"Select a screen or window first",Grid:"Grid",Tips:"Tips","Gallery on right":"Gallery on right","Gallery at top":"Gallery at top","Network ":"Network ",Latency:"Latency",Stability:"Stability",Fluctuation:"Fluctuation",Lag:"Lag",Disconnected:"Disconnected","Packet loss":"Packet loss","Share the room ID or invite link":"Share the room ID or invite link","Invite by room number":"Invite by room number","Invite via room link":"Invite via room link","Room Link":"Room Link","You can share the room number or link to invite more people to join the room.":"You can share the room number or link to invite more people to join the room.","You can share the room number to invite more people to join the room":"You can share the room number to invite more people to join the room","If you have any questions, please feel free to join our QQ group or send an email":"If you have any questions, please feel free to join our QQ group or send an email","Room QR code":"Room QR code",Participants:"Participants","Search for conference attendees":"Search for conference attendees","Invite via client scheme":"Invite via client scheme","All current and new members will be muted":"All current and new members will be muted","All and new members will be banned from the camera":"All and new members will be banned from the camera","No relevant user found.":"No relevant user found.","Contact us":"Contact us","Member management":"Member management","Join our QQ group chat or email us.":"Join our QQ group chat or email us.","group chat":"group chat",Email:"Email","Audio settings":"Audio settings","Camera settings":"Camera settings",Copy:"Copy","Copied successfully":"Copied successfully","Copied failure":"Copied failure","This model does not support copying at this time":"This model does not support copying at this time","accepted the invitation to the stage":"accepted the invitation to the stage","declined the invitation to the stage":"declined the invitation to the stage","All audios disabled":"All audios disabled","All audios enabled":"All audios enabled","Your microphone has been turned off":"Your microphone has been turned off","Sb invites you to turn on the microphone":({named:t})=>`${t("role")} invites you to turn on the microphone`,"All videos disabled":"All videos disabled","All videos enabled":"All videos enabled","Your camera has been turned off":"Your camera has been turned off","Sb invites you to turn on the camera":({named:t})=>`${t("role")} invites you to turn on the camera`,"The host has turned off your screen sharing":"The host has turned off your screen sharing","Turn on the camera":"Turn on the camera","Keep it closed":"Keep it closed","You have been banned from text chat":"You have been banned from text chat","You are allowed to text chat":"You are allowed to text chat","kicked out of the room by the host":"kicked out of the room by the host","kicked out of the room":"kicked out of the room","kicked out of the room by serve":"kicked out of the room by serve","Reject sb on stage failed, please retry":({named:t})=>`Reject ${t("name")} on Stage failed, please retry`,"Agree sb on stage failed, please retry":({named:t})=>`Agree ${t("name")} on Stage failed, please retry`,"Has been fully muted and cannot open the microphone":"Has been fully muted and cannot open the microphone","Has been muted by the host and cannot open the microphone":"Has been muted by the host and cannot open the microphone","To apply to speak in the room, please raise your hand first to apply for the microphone":"To apply to speak in the room, please raise your hand first to apply for the microphone","Has been full static painting, can not open the video":"Has been full static painting, can not open the video","It has been stilled by the host and cannot open the video":"It has been stilled by the host and cannot open the video","Failed to enter the room.":"Failed to enter the room.","Has been full static painting, can not share your screen":"Has been full static painting, can not share your screen.","Microphone not detected on current device":"Microphone not detected on current device","Camera not detected on current device":"Camera not detected on current device","Camera And Microphone not detected on current device":"Camera And Microphone not detected on current device","Another user is sharing the screen.":"Another user is sharing the screen.","Screen sharing is currently active, cannot start the whiteboard.":"Screen sharing is currently active, cannot start the whiteboard.","This action causes the room to be disbanded, does it continue?":"This action causes the room to be disbanded, does it continue?","This action causes the room to be exited, does it continue?":"This action causes the room to be exited, does it continue?","Sharing screens may lead to the leakage of private information such as SMS verification codes and passwords, resulting in financial losses. Please be vigilant against various forms of fraud.":"Sharing screens may lead to the leakage of private information such as SMS verification codes and passwords, resulting in financial losses. Please be vigilant against various forms of fraud.","Please enter the room number":"Please enter the room number","whether to kick sb off the room":({named:t})=>`whether to kick ${t("name")} off the room`,"The current browser does not support capturing audio and video":"The current browser does not support capturing audio and video","The current browser does not support getting microphone and camera list":"The current browser does not support getting audio/video device list","The current browser does not support screen sharing":"The current browser does not support screen sharing","The current browser does not support capturing audio":"The current browser does not support capture audio","The current browser does not support capturing video":"The current browser does not support capture video","The current browser does not support audio and video communication capabilities":"The current browser does not support audio and video communication capabilities","An invitation to open the microphone has been sent to sb.":({named:t})=>`An invitation to open the microphone has been sent to ${t("name")}`,"An invitation to open the camera has been sent to sb.":({named:t})=>`An invitation to open the camera has been sent to ${t("name")}`,"Make host failed, please try again.":"Make host failed, please try again.","Sb has been set as an administrator":({named:t})=>`${t("name")} has been set as an administrator.`,"Succeed on stage":"Succeed on stage","After unlocking, users can freely turn on the microphone":"After unlocking, users can freely turn on the microphone","Members will not be able to open the microphone":"Members will not be able to open the microphone","After unlocking, users can freely turn on the camera":"After unlocking, users can freely turn on the camera","Members will not be able to open the camera":"Members will not be able to open the camera","You have become a administrator":"You have become a administrator","You are now a room owner":"You are now a room owner","Your administrator status has been revoked":"Your administrator status has been revoked","After transfer the room owner, you will become a general user":"After transfer the room owner, you will become a general user","Transfer the roomOwner to sb":({named:t})=>`Transfer the roomOwner to ${t("name")}`,"Confirm transfer":"Confirm transfer","The room owner has been transferred to sb":({named:t})=>`The room owner has been transferred to ${t("name")}`,"Application to go on stage was rejected":"Application to go on stage was rejected","You are now an administrator":"You are now an administrator","The RoomOwner has withdrawn your administrator privileges":"The RoomOwner has withdrawn your administrator privileges","This member has already received the same request, please try again later":"This member has already received the same request, please try again later","The request to go on stage has timed out":"The request to go on stage has timed out","The invitation to sb to go on stage has timed out":({named:t})=>`The invitation to ${t("name")} to go on stage has timed out`,"Currently no member has applied to go on stage":"Currently no member has applied to go on stage",Operate:"Operate","Stage management":"Stage management","On stage":"On stage","Not on stage":"Not on stage","To go on stage again, you need to reapply and wait for the roomOwner/administrator to approve":"To go on stage again, you need to reapply and wait for the roomOwner/administrator to approve","To go on stage again, a new application needs to be initiated":"To go on stage again, a new application needs to be initiated","The request to go on stage has been sent out, please wait for the roomOwner/administrator to approve it":"The request to go on stage has been sent out, please wait for the roomOwner/administrator to approve it","Cancellation request has been sent, please wait for the roomOwner/administrator to approve it":"Cancellation request has been sent, please wait for the roomOwner/administrator to approve it","Canceled application to go on stage":"Canceled application to go on stage","and so on":"and so on","people applying to stage":"people applying to stage","and so on number people applying to stage":({named:t})=>`and so on ${t("number")} people applying to stage`,"The stage is full, please contact the host":"The stage is full, please contact the host","The stage is full":"The stage is full","change name":"change name","quick conference":"quick conference",Meeting:"Meeting","Meeting in progress":"Meeting in progress",Initiating:"Initiating","X people have joined":({named:t})=>`${t("number")} people have joined`,"Waiting for members to join the meeting":"Waiting for members to join the meeting","X people are in the meeting":({named:t})=>`${t("number")} people are in the meeting`,"Already joined":"Already joined","Enter the meeting":"Enter the meeting","Ending meeting":"Ending meeting","The meeting has ended":"The meeting has ended","Currently in a meeting, please exit the current meeting before proceeding.":"Currently in a meeting, please exit the current meeting before proceeding.","Failed to initiate meeting":"Failed to initiate meeting","Failed to enter the meeting":"Failed to enter the meeting","Failed to disable chat":"Failed to disable chat","All members can share screen":"All members can share screen","Screen sharing for host/admin only":"Screen sharing for host/admin only","Failed to initiate screen sharing, currently only host/admin can share screen.":"Failed to initiate screen sharing, currently only host/admin can share screen.","Is it turned on that only the host/admin can share the screen?":"Is it turned on that only the host/admin can share the screen?","Other member is sharing the screen is now, the member's sharing will be terminated after you turning on":"Other member is sharing the screen now, the member's sharing will be terminated after you turning on","Your screen sharing has been stopped":"Your screen sharing has been stopped","Your screen sharing has been stopped, Now only the host/admin can share the screen":"Your screen sharing has been stopped, Now only the host/admin can share the screen","The system prohibits the current browser from accessing the screen content, please enable the screen sharing privilege.":"The system prohibits the current browser from accessing the screen content, please enable the screen sharing privilege.","User canceled screen sharing":"User canceled screen sharing","An unknown error occurred while screen sharing, please try again.":"An unknown error occurred while screen sharing, please try again.","I got it":"I got it",Attention:"Attention",'Audio playback failed. Click the "Confirm" to resume playback':'Audio playback failed. Click the "Confirm" to resume playback.',"x people selected":({named:t})=>`${t("number")} people selected`,"view details":"view details","modify room":"modify room","cancel room":"cancel room",Modify:"Modify","No room available for booking":"No room available for booking",Ongoing:"Ongoing",finished:"finished","History room":"History room","sb temporary room":({named:t})=>`${t("name")}'s temporary room`,year:"year",month:"month",day:"day",Schedule:"Schedule","Modify Room":"Modify Room","Room Name":"Room Name","please enter the room name":"please enter the room name","Room type":"Room type","Starting time":"Starting time","Room duration":"Room duration","Time zone":"Time zone",Attendees:"Attendees","Please enter the member name":"Please enter the member name",people:"people","Scheduled meetings":"scheduled meetings",minute:"minute",hour:"hour",minutes:"minutes",hours:"hours","The start time cannot be earlier than the current time":"The start time cannot be earlier than the current time","Room Time":"Room Time",Creator:"Creator","Room Details":"Room Details","Enter Now":"Enter Now","Invited members":"Invited members","The room is closed":"The room is closed","Entry Time":"Entry Time","Duration of participation":"Duration of participation","No cancellation":"No cancellation","Other members will not be able to join after cancellation":"Other members will not be able to join after cancellation","Inviting members to join":"Inviting members to join","Invitation by room ID":"Invitation by room ID","Invitation via room link":"Invitation via room link","Copy the conference number and link":"Copy the conference number and link","Schedule successful, invite members to join":"Schedule successful, invite members to join","Name changed successfully":"Name changed successfully","schedule year":"/","schedule month":"/","schedule day":" ","The room name cannot exceed 100 characters":"The room name cannot exceed 100 characters","The room name cannot be empty":"The room name cannot be empty","The meeting is in progress and any meeting information cannot be modified":"The meeting is in progress and any meeting information cannot be modified","Schedule room loading":"Schedule room loading...","The user name cannot exceed 32 characters":"The user name cannot exceed 32 characters","sb invites you to join the conference":({named:t})=>`${t("name")} invites you to join the conference`,microphone:"microphone",camera:"camera","Unable to use the device":({named:t})=>`Unable to use the ${t("deviceType")}`,"media device failed to open, please check the media device and try again":({named:t})=>`${t("deviceType")} failed to open, please check the ${t("deviceType")} and try again`,"Please check the current browser camera permission":"Please check the current browser camera permission","The current device is not authorized, please allow access to the device permissions":({named:t})=>`The ${t("deviceType")} is not authorized, please allow access to the ${t("deviceType")} permissions`,"The current device is occupied by other apps, try to close other apps or change the device":({named:t})=>`The ${t("deviceType")} is occupied by other apps, try to close other apps or change the device`,"Turn on device privileges":({named:t})=>`Turn on ${t("deviceType")} privileges`,'You can go to "System Preferences - Security & Privacy - Device" to enable device permissions':({named:t})=>`You can go to "System Preferences - Security & Privacy - ${t("deviceType")}" to enable device permissions.`,"Go to Settings":"Go to Settings",addMember:"addMember",shareRoom:"shareRoom","Invitation sent, waiting for members to join.":"Invitation sent, waiting for members to join.","Not joining for now":"Not joining for now","Not Entered":"Not Entered",Entered:"Entered",Call:"Call","Calling...":"Calling...","Call all":"Call all","Busy line":"Busy line","Entering the room now...":"Entering the room now...","The room is encrypted":"The room is encrypted","Please enter the password":"Please enter the password","Your room password format is incorrect, please check it":"Your room password format is incorrect, please check it",Security:"Security","Room Password":"Room Password","Enter 6-digit password":"Enter 6-digit password","Wrong password":"Wrong password",Encryption:"Encryption","Open whiteboard":"Open whiteboard","Close whiteboard":"Close whiteboard","Start annotating":"Start annotating","End annotating":"End annotating","You are sharing the whiteboard, please stop sharing first":"You are sharing the whiteboard, please stop sharing first","Line Size":"Line Size","Line Color":"Line Color","Arrow Size":"Arrow Size","Arrow Color":"Arrow Color","Text Size":"Text Size","Text Color":"Text Color","Shape Type":"Shape Type","Shape Style":"Shape Style","Shape Color":"Shape Color","Shape Size":"Shape Size",Beauty:"Beauty","Beauty Effects":"Beauty Effects",Smoother:"Smoother",Whitening:"Whitening",Ruddy:"ruddy",Compare:"Compare",Reset:"Reset",Degree:"Degree","Sure you want to reset the beauty effect?":"Sure you want to reset the beauty effect?","All beauty parameters will revert to default after reset":"All beauty parameters will revert to default after reset","Theme Colours":"Theme Colours","Custom Themes":"Custom Themes"};var __=Object.defineProperty,b_=(t,e,n)=>e in t?__(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,dd=(t,e,n)=>b_(t,typeof e!="symbol"?e+"":e,n);const il=A("");let w_=class{constructor(e){dd(this,"messages"),dd(this,"global"),this.messages=e.messages,il.value=e.locale,this.global={},this.global.locale=il,this.global.t=this.t.bind(this)}getNamed(e){return n=>e[n]||n}t(e,n){const o=this.messages[il.value];if(!o[e])return e;if(typeof o[e]=="function"){const r=this.getNamed(n||{});return o[e]({named:r})}return o[e]}install(){}};const pd=new w_({locale:"zh-CN",messages:{"zh-CN":v_,"en-US":y_}});function S_(){return{t:pd.global.t.bind(pd)}}const tf=A(null),xs=A(null),Os=A(null);function nf(){const t=navigator.userAgent,e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t);return{userAgent:t,platformCode:e?2:1}}function of(){let t=sessionStorage.getItem("uikit_session_id");return t||(t=`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,sessionStorage.setItem("uikit_session_id",t)),t}function rf(t){var e,n;try{(((n=(e=r_)==null?void 0:e.Module)==null?void 0:n.logger)||console).info("[UIKitModal]",t)}catch{console.info("[UIKitModal]",t)}}function k_(t){const e=Date.now(),{userAgent:n,platformCode:o}=nf();tf.value=t,xs.value=t.id,Os.value=e,rf({eventType:1,modalId:t.id,timestamp:e,sessionId:of(),platformCode:o,userAgent:n})}function E_(t="confirm"){if(xs.value===null||!Os.value)return;const e=Date.now(),n=e-Os.value,{userAgent:o,platformCode:r}=nf(),a={confirm:1,cancel:2,timeout:3,mask:2};rf({eventType:2,modalId:xs.value,timestamp:e,stayDuration:n,closeReasonCode:a[t],sessionId:of(),platformCode:r,userAgent:o}),tf.value=null,xs.value=null,Os.value=null}function C_(){return{openModal:k_,closeModal:E_}}const M_={class:"uikit-modal-default uikit-modal-container"},$_={class:"uikit-modal-header"},T_={class:"uikit-modal-title"},I_=["innerHTML"],A_={class:"uikit-modal-footer"},x_=z({__name:"index",props:{visible:{type:Boolean,default:!1},id:{},title:{default:""},content:{default:""},type:{default:"info"},onConfirm:{},onCancel:{}},emits:["confirm","cancel"],setup(t,{emit:e}){const n=La()==="pc",{t:o}=S_(),r=t,a=e,s=/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i,i=/(https?:\/\/[^\s]+)/g,l=B(()=>{const{content:h}=r;if(!h||typeof h!="string")return h;if(s.test(h.trim())){const m=h.trim(),g=m.startsWith("http")?m:`https://${m}`;return`<a href="${c(g)}" target="_blank" rel="noopener noreferrer" class="uikit-modal-link">${c(m)}</a>`}return h.includes("<a ")||h.includes("<a>")?u(h):i.test(h)?c(h).replace(i,m=>`<a href="${m}" target="_blank" rel="noopener noreferrer" class="uikit-modal-link">${m}</a>`):c(h)});function c(h){const m=document.createElement("div");return m.textContent=h,m.innerHTML}function u(h){const m=new DOMParser().parseFromString(h,"text/html");return m.querySelectorAll("a").forEach(g=>{if(g.getAttribute("href")){g.setAttribute("target","_blank"),g.setAttribute("rel","noopener noreferrer"),g.classList.add("uikit-modal-link");const v=g.textContent||"";g.innerHTML=`<span style="padding: 0 0.2em; display: inline-block; color: var(--text-color-link)">${v}</span>`}}),m.body.innerHTML}function d(){var h;(h=r.onConfirm)==null||h.call(r),a("confirm")}function p(){var h;(h=r.onCancel)==null||h.call(r),a("cancel")}return(h,m)=>(_(),U(qc,{to:"body"},[V(my,{name:"fade"},{default:j(()=>[t.visible?(_(),O("div",{key:0,class:"uikit-modal-mask",onClick:yn(d,["self"])},[I("div",M_,[I("div",$_,[t.type==="success"?(_(),U(f(gy),{key:0,class:"uikit-modal-type-icon"})):Y("",!0),t.type==="info"?(_(),U(f(vy),{key:1,class:"uikit-modal-type-icon"})):Y("",!0),t.type==="error"?(_(),U(f(Fh),{key:2,class:"uikit-modal-type-icon"})):Y("",!0),t.type==="warning"?(_(),U(f(yy),{key:3,class:"uikit-modal-type-icon"})):Y("",!0),I("span",T_,H(t.title),1),n?(_(),U(f(Er),{key:4,class:"uikit-modal-close-icon",onClick:p})):Y("",!0)]),I("div",{class:"uikit-modal-body",innerHTML:l.value},null,8,I_),I("div",A_,[V(f(Tt),{type:"default",style:{"min-width":"88px"},onClick:p},{default:j(()=>[ge(H(f(o)("Cancel")),1)]),_:1}),V(f(Tt),{type:"primary",style:{"min-width":"88px"},onClick:d},{default:j(()=>[ge(H(f(o)("Confirm")),1)]),_:1})])])])):Y("",!0)]),_:1})]))}});let aa=null;const{openModal:O_,closeModal:R_}=C_(),P_=()=>{const t=window.location.hostname,e=window.location.href;return!!(t==="localhost"||t==="127.0.0.1"||t.startsWith("192.168.")||e.startsWith("https://web.sdk.qcloud.com/trtc/livekit"))},hd=()=>{aa&&(aa.unmount(),aa=null)},D_=t=>new Promise(e=>{if(hd(),O_({id:t.id,title:t.title,content:t.content,type:t.type,onConfirm:t.onConfirm,onCancel:t.onCancel}),!P_()){e({action:"confirm"});return}const n=r=>{R_(r),hd(),e({action:r})},o={...t,visible:!0,onConfirm:()=>{var r;(r=t.onConfirm)==null||r.call(t),n("confirm")},onCancel:()=>{var r;(r=t.onCancel)==null||r.call(t),n("cancel")}};aa=fy(x_,o),aa.mount(document.createElement("div"))}),N_={openModal:t=>D_(t)};var sa=(t=>(t[t.LOGIN_INVALID_SDK_APP_ID=3e4]="LOGIN_INVALID_SDK_APP_ID",t[t.LOGIN_INVALID_USER_ID=30001]="LOGIN_INVALID_USER_ID",t[t.LOGIN_INVALID_SECRET_KEY=30004]="LOGIN_INVALID_SECRET_KEY",t[t.LOGIN_INVALID_USER_SIG=30005]="LOGIN_INVALID_USER_SIG",t[t.LOGIN_USER_SIG_EXPIRED=30006]="LOGIN_USER_SIG_EXPIRED",t[t.LOGIN_USER_SIG_INVALID=30042]="LOGIN_USER_SIG_INVALID",t[t.LOGIN_USER_ID_NOT_MATCH_USER_SIG=30007]="LOGIN_USER_ID_NOT_MATCH_USER_SIG",t[t.LOGIN_SDK_APP_ID_NOT_MATCH_USER_SIG=30008]="LOGIN_SDK_APP_ID_NOT_MATCH_USER_SIG",t[t.LOGIN_SDK_APP_ID_NOT_FOUND=30041]="LOGIN_SDK_APP_ID_NOT_FOUND",t[t.PACKAGE_NOT_PURCHASED=30002]="PACKAGE_NOT_PURCHASED",t[t.PACKAGE_GROUP_READ_RECEIPT_NOT_ENABLED=30014]="PACKAGE_GROUP_READ_RECEIPT_NOT_ENABLED",t[t.PACKAGE_ONLINE_USER_LIST_NOT_ENABLED=30015]="PACKAGE_ONLINE_USER_LIST_NOT_ENABLED",t[t.PACKAGE_CLOUD_SEARCH_NOT_ENABLED=30016]="PACKAGE_CLOUD_SEARCH_NOT_ENABLED",t[t.PACKAGE_TEXT_TRANSLATION_NOT_ENABLED=30018]="PACKAGE_TEXT_TRANSLATION_NOT_ENABLED",t[t.PACKAGE_SPEECH_TO_TEXT_NOT_ENABLED=30019]="PACKAGE_SPEECH_TO_TEXT_NOT_ENABLED",t[t.CALL_KIT_NOT_INTEGRATED=30010]="CALL_KIT_NOT_INTEGRATED",t[t.SEARCH_CLOUD_RATE_LIMIT=30017]="SEARCH_CLOUD_RATE_LIMIT",t[t.MESSAGE_VOICE_SIZE_EXCEEDED=30020]="MESSAGE_VOICE_SIZE_EXCEEDED",t[t.MESSAGE_IMAGE_INVALID_FORMAT=30021]="MESSAGE_IMAGE_INVALID_FORMAT",t[t.MESSAGE_IMAGE_SIZE_EXCEEDED=30022]="MESSAGE_IMAGE_SIZE_EXCEEDED",t[t.MESSAGE_IMAGE_SENSITIVE_CONTENT=30023]="MESSAGE_IMAGE_SENSITIVE_CONTENT",t[t.MESSAGE_VIDEO_INVALID_FORMAT=30024]="MESSAGE_VIDEO_INVALID_FORMAT",t[t.MESSAGE_VIDEO_SIZE_EXCEEDED=30025]="MESSAGE_VIDEO_SIZE_EXCEEDED",t[t.MESSAGE_FILE_NOT_EXIST=30026]="MESSAGE_FILE_NOT_EXIST",t[t.MESSAGE_FILE_SIZE_EXCEEDED=30027]="MESSAGE_FILE_SIZE_EXCEEDED",t[t.MESSAGE_FILE_SENDING_BANNED=30028]="MESSAGE_FILE_SENDING_BANNED",t[t.MESSAGE_TEXT_SENSITIVE_CONTENT=30029]="MESSAGE_TEXT_SENSITIVE_CONTENT",t[t.MESSAGE_LENGTH_EXCEEDED=30030]="MESSAGE_LENGTH_EXCEEDED",t[t.MESSAGE_LOCAL_AUDIT_BLOCKED=30031]="MESSAGE_LOCAL_AUDIT_BLOCKED",t[t.MESSAGE_RECALL_TIME_EXCEEDED=30039]="MESSAGE_RECALL_TIME_EXCEEDED",t[t.REACTION_EMOJI_LIMIT_REACHED=30033]="REACTION_EMOJI_LIMIT_REACHED",t[t.PROFILE_REMARK_LENGTH_EXCEEDED=30034]="PROFILE_REMARK_LENGTH_EXCEEDED",t[t.GROUP_ANNOUNCEMENT_LENGTH_EXCEEDED=30035]="GROUP_ANNOUNCEMENT_LENGTH_EXCEEDED",t[t.GROUP_NAME_INVALID=30036]="GROUP_NAME_INVALID",t[t.GROUP_ID_ALREADY_USED=30040]="GROUP_ID_ALREADY_USED",t))(sa||{});const L_={3e4:{i18nKey:"login_invalid_sdk_app_id"},30001:{i18nKey:"login_invalid_user_id"},30004:{i18nKey:"login_invalid_secret_key"},30005:{i18nKey:"login_invalid_user_sig"},30006:{i18nKey:"login_user_sig_expired"},30042:{i18nKey:"login_user_sig_invalid"},30007:{i18nKey:"login_user_id_not_match_user_sig"},30008:{i18nKey:"login_sdk_app_id_not_match_user_sig"},30041:{i18nKey:"login_sdk_app_id_not_found"},30002:{i18nKey:"package_not_purchased"},30014:{i18nKey:"package_group_read_receipt_not_enabled"},30015:{i18nKey:"package_online_user_list_not_enabled"},30016:{i18nKey:"package_cloud_search_not_enabled"},30018:{i18nKey:"package_text_translation_not_enabled"},30019:{i18nKey:"package_speech_to_text_not_enabled"},30010:{i18nKey:"call_kit_not_integrated"},30017:{i18nKey:"search_cloud_rate_limit"},30020:{i18nKey:"message_voice_size_exceeded"},30021:{i18nKey:"message_image_invalid_format"},30022:{i18nKey:"message_image_size_exceeded"},30023:{i18nKey:"message_image_sensitive_content"},30024:{i18nKey:"message_video_invalid_format"},30025:{i18nKey:"message_video_size_exceeded"},30026:{i18nKey:"message_file_not_exist"},30027:{i18nKey:"message_file_size_exceeded"},30028:{i18nKey:"message_file_sending_banned"},30029:{i18nKey:"message_text_sensitive_content"},30030:{i18nKey:"message_length_exceeded"},30031:{i18nKey:"message_local_audit_blocked"},30039:{i18nKey:"message_recall_time_exceeded"},30033:{i18nKey:"reaction_emoji_limit_reached"},30034:{i18nKey:"profile_remark_length_exceeded"},30035:{i18nKey:"group_announcement_length_exceeded"},30036:{i18nKey:"group_name_invalid"},30040:{i18nKey:"group_id_already_used"}},U_={2e3:3e4,2002:30001,2003:30005,70001:30006,70003:30042,70013:30007,70014:30008,70020:30041,60018:30017,2301:30020,2252:30021,2253:30022,2352:30024,2351:30025,2401:30026,2402:30027,3123:30031,20016:30039,10031:30039,10021:30040};function ia(t){const e=L_[t];e&&N_.openModal({id:t,title:nt.t("ChatErrorModal.title"),content:nt.t(`ChatErrorModal.${e.i18nKey}`),type:"error"})}function Mi(t){const e=t.code;if(e==null)return!1;const n=U_[e];return n!==void 0?(ia(n),!0):!1}const Kc=A(void 0);function B_(t){Kc.value=t}function F_(){return Kc.value}function af(){return{chatScene:Kc,setChatScene:B_,getChatScene:F_}}const Gs=A(null),{getChatScene:j_}=af();async function G_(t){const{userId:e,userSig:n,sdkAppId:o,...r}=t,a={SDKAppID:o,userID:e,userSig:n,useUploadPlugin:!0,scene:j_(),...r};try{await Ci.login(a)}catch(s){throw Mi(s)||(e?n?o||ia(sa.LOGIN_INVALID_SDK_APP_ID):ia(sa.LOGIN_INVALID_USER_SIG):ia(sa.LOGIN_INVALID_USER_ID)),s}}async function q_(t){const e=Gs.value||{},{chat:n}=Ci.getContext();if(n){const o=[];t.customInfo&&Object.keys(t.customInfo).forEach(r=>{var a;let s=r;r.includes("Tag_Profile_Custom")||(s=`Tag_Profile_Custom_${r}`),o.push({key:s,value:(a=t.customInfo)==null?void 0:a[r]})});try{const r=await n.updateMyProfile({nick:t.userName,avatar:t.avatarUrl,profileCustomField:o});return Gs.value={...e,...t},r}catch(r){throw console.error("[loginState setSelfInfo] error",r),r}}else throw Error("[loginState setSelfInfo] not login")}async function H_(){Gs.value=null,Ci.logout()}function sf(){return{loginUserInfo:Gs,login:G_,logout:H_,setSelfInfo:q_}}var Yl=(t=>(t.CHAT_WEB="42",t.CHAT_H5="43",t))(Yl||{});const Rs=La()==="pc",Oe=La()==="h5";La();La();var V_=Object.defineProperty,z_=(t,e,n)=>e in t?V_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zo=(t,e,n)=>z_(t,typeof e!="symbol"?e+"":e,n);const{setChatScene:W_}=af(),lf=class Gr{constructor(){zo(this,"isReady",!1),zo(this,"isEngineLoggingIn",!1),zo(this,"isLogin",A(!1)),zo(this,"resolveList",[]),zo(this,"rejectList",[]),this.init()}static getInstance(){return Gr.instance||(Gr.instance=new Gr),Gr.instance}init(){W_(Rs?Yl.CHAT_WEB:Yl.CHAT_H5),this.isReady||(this.isReady=!0,Kl.registerEvent(qn.TUILogin.EVENT.LOGIN_STATE_CHANGED,qn.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS,this))}onNotifyEvent(e,n){if(e===qn.TUILogin.EVENT.LOGIN_STATE_CHANGED)switch(n){case qn.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS:this.login();break;case qn.TUILogin.EVENT_SUB_KEY.USER_LOGOUT_SUCCESS:this.logout();break}}async login(){const{chat:e,SDKAppID:n,userID:o,userSig:r}=Ci.getContext();if(this.isEngineLoggingIn)return new Promise((a,s)=>{this.resolveList.push(a),this.rejectList.push(s)});try{this.isEngineLoggingIn=!0;const a=await oe.login({chat:e,SDKAppID:n,userID:o,userSig:r});this.isLogin.value=!0,this.resolveList.forEach(l=>{l()}),this.rejectList=[],this.resolveList=[];const{loginUserInfo:s}=sf(),i=(await e.getUserProfile({userIDList:[o]})).data[0];return i.value||(s.value={userId:i.userID,userName:i.nick,avatarUrl:i.avatar,customInfo:i.profileCustomField}),a}catch(a){throw this.rejectList.forEach(s=>{s(a)}),this.rejectList=[],this.resolveList=[],a}finally{this.isEngineLoggingIn=!1}}logout(){this.isLogin.value=!1,this.isEngineLoggingIn=!1}};zo(lf,"instance");let K_=lf;function Y_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cf={exports:{}};/*!
|
||
Copyright (c) 2018 Jed Watson.
|
||
Licensed under the MIT License (MIT), see
|
||
http://jedwatson.github.io/classnames
|
||
*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var a="",s=0;s<arguments.length;s++){var i=arguments[s];i&&(a=r(a,o(i)))}return a}function o(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return n.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var s="";for(var i in a)e.call(a,i)&&a[i]&&(s=r(s,i));return s}function r(a,s){return s?a?a+" "+s:a+s:a}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(cf);var J_=cf.exports;const ke=Y_(J_),Z=(t,e)=>{const n=t.__vccOpts||t;for(const[o,r]of e)n[o]=r;return n},X_={class:"avatar-badge"},Q_=z({name:"AvatarBadge",__name:"AvatarBadge",props:{size:{default:"md"},onlineStatus:{default:"online"}},setup(t){return(e,n)=>(_(),O("div",X_,[ee(e.$slots,"default",{},void 0,!0),I("div",{class:S(["avatar-badge__indicator","avatar-badge__indicator--bottom-right",`avatar-badge__indicator--${t.size}`])},[t.onlineStatus?(_(),O("div",{key:0,class:S(["avatar-badge__online-status",`avatar-badge__online-status--${t.onlineStatus}`,`avatar-badge__online-status--${t.size}`])},null,2)):Y("",!0)],2)]))}}),Z_=Z(Q_,[["__scopeId","data-v-a69536c2"]]),eb="https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_16.png",tb="https://web.sdk.qcloud.com/im/demo/TUIkit/react-static/images/group_avatar_work.png",nb="https://web.sdk.qcloud.com/im/demo/TUIkit/react-static/images/group_avatar_public.png",ob="https://web.sdk.qcloud.com/im/demo/TUIkit/react-static/images/group_avatar_meeting.png",rb="https://web.sdk.qcloud.com/im/demo/TUIkit/react-static/images/group_avatar_AVChatRoom.png",ab="https://web.sdk.qcloud.com/im/demo/TUIkit/web/img/constomer.png",sb=z({name:"Avatar",__name:"Avatar",props:{isShowOnlineStatus:{type:Boolean,default:!1},isOnline:{type:Boolean,default:!1},unreadCount:{default:0},maxUnreadCount:{default:99},isDotUnreadCount:{type:Boolean,default:!1},src:{},size:{default:"md"},shape:{default:"circular"},alt:{},className:{},style:{},onClick:{}},setup(t){const e=t,n=Hh(),o=qt(),r=A(!1),a=A(!!e.src),s=B(()=>n.default),i=v=>{a.value=v},l=()=>{a.value=!1},c=()=>{r.value=!0,a.value=!1},u=()=>{e.onClick&&e.onClick()},d=()=>e.alt?e.alt.trim().charAt(0):"",p=B(()=>{let v=40;if(typeof e.size=="number"){const b=e.shape==="circular"?"50%":e.shape==="square"?"0%":`${e.size/6}px`;return{width:`${e.size}px`,height:`${e.size}px`,fontSize:`${Math.floor(e.size/2)}px`,borderRadius:b}}if(typeof e.size=="string")switch(e.size){case"xxl":v=96;break;case"xl":v=64;break;case"lg":v=48;break;case"md":v=40;break;case"sm":v=32;break;case"xs":v=24;break;default:v=40;break}return{fontSize:`${Math.floor(v/2)}px`}}),h=B(()=>ke(o.avatar,o[`avatar--shape-${e.shape}`],typeof e.size!="number"&&o[`size-${e.size}`],e.className)),m=B(()=>he("div",{class:h.value,style:[p.value,e.style,{cursor:e.onClick?"pointer":"default"}],onClick:u,role:e.onClick?"button":void 0,tabindex:e.onClick?0:void 0,"aria-label":e.alt||"avatar"},[s.value?he("div",{class:o.avatar__fallback},s.value):e.src&&!r.value?he("img",{class:o.avatar__image,src:e.src,alt:e.alt||"avatar",onLoad:l,onError:c}):e.alt?he("div",{class:o.avatar__fallback},d()):he("img",{class:o.avatar__image,src:eb,alt:"default avatar",onLoad:()=>i(!1),onError:()=>i(!1)}),a.value&&he("div",{class:o.avatar__skeleton})])),g=B(()=>{let v=m.value;return e.unreadCount!==void 0&&(v=he(_y,{hidden:e.unreadCount===0,value:typeof e.unreadCount=="number"?e.unreadCount:"",max:e.maxUnreadCount,isDot:e.isDotUnreadCount,type:"danger"},[v])),e.isShowOnlineStatus&&(v=he(Z_,{show:!0,onlineStatus:e.isOnline?"online":"offline",size:typeof e.size=="number"?"md":e.size},[v])),v});return(v,b)=>!t.isShowOnlineStatus&&!t.unreadCount?(_(),U(se(m.value),{key:0})):(_(),U(se(g.value),{key:1}))}}),ib="_avatar_bq44a_1",lb="_avatar__image_bq44a_61",cb="_avatar__fallback_bq44a_67",ub="_avatar__skeleton_bq44a_78",db="_shimmer_bq44a_1",pb={avatar:ib,"avatar--shape-circular":"_avatar--shape-circular_bq44a_10","avatar--shape-square":"_avatar--shape-square_bq44a_13","size-xs":"_size-xs_bq44a_16","size-sm":"_size-sm_bq44a_20","size-md":"_size-md_bq44a_24","size-lg":"_size-lg_bq44a_28","size-xl":"_size-xl_bq44a_32","size-xxl":"_size-xxl_bq44a_36","avatar--shape-rounded":"_avatar--shape-rounded_bq44a_40",avatar__image:lb,avatar__fallback:cb,avatar__skeleton:ub,shimmer:db},hb={$style:pb},ft=Z(sb,[["__cssModules",hb]]),fb=["onClick"],mb=z({__name:"ListMode",props:{dataSource:{},selectedKeys:{},lockedKeys:{},onItemClick:{type:Function},onReachEnd:{type:Function},renderItem:{}},setup(t){const e=t,{t:n}=ve(),o=i=>e.selectedKeys.has(i),r=i=>e.lockedKeys.has(i),a=i=>{r(i)||e.onItemClick(i)},s=i=>{if(!e.onReachEnd)return;const l=i.currentTarget,{scrollTop:c,scrollHeight:u,clientHeight:d}=l;u-c-d<50&&e.onReachEnd()};return(i,l)=>t.dataSource.length===0?(_(),O("div",{key:0,class:S(i.$style.list__empty)},H(f(n)("UserPicker.no_data_available")),3)):(_(),O("div",{key:1,class:S(i.$style.list__container),onScroll:s},[(_(!0),O(ie,null,we(t.dataSource,c=>(_(),O("div",{key:c.key},[I("div",{class:S([i.$style.list__item,{[i.$style["list__item--selected"]]:o(c.key),[i.$style["list__item--locked"]]:r(c.key)}]),onClick:u=>a(c.key)},[I("div",{class:S(i.$style["list__checkbox-wrapper"])},[I("div",{class:S([i.$style.list__checkbox,{[i.$style["list__checkbox--checked"]]:o(c.key)}])},[o(c.key)?(_(),U(f(jc),{key:0})):Y("",!0)],2)],2),t.renderItem?(_(),U(se(t.renderItem),{key:0,item:c},null,8,["item"])):(_(),O("div",{key:1,class:S(i.$style.list__content)},[V(f(ft),{src:c.avatarUrl||"",class:S(i.$style.list__avatar),alt:c.label},null,8,["src","class","alt"]),I("span",{class:S(i.$style.list__label)},H(c.label),3)],2))],10,fb)]))),128))],34))}}),gb="_list__container_101wg_1",vb="_list__item_101wg_21",yb="_list__checkbox_101wg_42",_b="_list__content_101wg_59",bb="_list__avatar_101wg_65",wb="_list__label_101wg_68",Sb="_list__empty_101wg_84",kb={list__container:gb,list__item:vb,"list__item--selected":"_list__item--selected_101wg_32","list__item--locked":"_list__item--locked_101wg_38","list__checkbox-wrapper":"_list__checkbox-wrapper_101wg_42",list__checkbox:yb,"list__checkbox--checked":"_list__checkbox--checked_101wg_55",list__content:_b,list__avatar:bb,list__label:wb,"list__load-more":"_list__load-more_101wg_76",list__empty:Sb,"list__end-marker":"_list__end-marker_101wg_93"},Eb={$style:kb},Cb=Z(mb,[["__cssModules",Eb]]),Mb=["placeholder","value"],$b=z({__name:"SearchBar",props:{placeholder:{},onSearch:{type:Function}},setup(t){const e=t,n=A(""),o=a=>{console.log("handleChange",a);const s=a.target.value;n.value=s,e.onSearch(s)},r=()=>{n.value="",e.onSearch("")};return(a,s)=>(_(),O("div",{class:S(a.$style.search__bar)},[I("div",{class:S(a.$style["search__input-wrapper"])},[V(f(jh),{name:"search",class:S(a.$style.search__icon)},null,8,["class"]),I("input",{type:"text",class:S(a.$style.search__input),placeholder:t.placeholder,value:n.value,onInput:o},null,42,Mb),n.value?(_(),U(f(Er),{key:0,name:"close",class:S(a.$style["search__clear-icon"]),size:"12px",onClick:r},null,8,["class"])):Y("",!0)],2)],2))}}),Tb="_search__bar_ufjq9_1",Ib="_search__icon_ufjq9_14",Ab="_search__input_ufjq9_4",xb={search__bar:Tb,"search__input-wrapper":"_search__input-wrapper_ufjq9_4",search__icon:Ib,search__input:Ab,"search__clear-icon":"_search__clear-icon_ufjq9_31"},Ob={$style:xb},Rb=Z($b,[["__cssModules",Ob]]),Pb=["onClick"],Db=z({__name:"SelectedPanel",props:{displayMode:{},selectedItems:{},lockedKeys:{},onRemove:{},maxCount:{default:Number.POSITIVE_INFINITY}},setup(t){const{t:e}=ve(),n=t,o=B(()=>n.displayMode==="list"?n.selectedItems:n.displayMode==="tree"?n.selectedItems.filter(a=>a.isLeafNode):[]),r=Number.POSITIVE_INFINITY;return(a,s)=>o.value.length>0?(_(),O("div",{key:0,class:S(a.$style.selected__panel)},[I("div",{class:S(a.$style.selected__header)},[I("span",{class:S(a.$style.selected__title)},H(f(e)("UserPicker.selected")),3),I("span",{class:S(a.$style.selected__count)},[ge(H(o.value.length)+" ",1),t.maxCount<f(r)?(_(),O(ie,{key:0},[ge(" / "+H(t.maxCount),1)],64)):Y("",!0),ge(" "+H(f(e)("UserPicker.people_unit")),1)],2)],2),I("div",{class:S(a.$style.selected__list)},[(_(!0),O(ie,null,we(o.value,i=>(_(),O("div",{key:i.key,class:S(a.$style.selected__item)},[I("div",{class:S(a.$style["selected__item-content"])},[V(f(ft),{src:i.avatarUrl,class:S(a.$style["selected__item-avatar"]),size:"sm",alt:i.label},null,8,["src","class","alt"]),I("div",{class:S(a.$style["selected__item-label"])},H(i.label),3)],2),t.lockedKeys.has(i.key)?Y("",!0):(_(),O("button",{key:0,type:"button",class:S(a.$style["selected__remove-button"]),"aria-label":"remove",onClick:l=>t.onRemove(i.key)},[V(f(Er),{name:"close",size:"12px"})],10,Pb))],2))),128))],2)],2)):Y("",!0)}}),Nb="_selected__panel_1phj6_12",Lb="_selected__header_1phj6_17",Ub="_selected__title_1phj6_23",Bb="_selected__count_1phj6_28",Fb="_selected__list_1phj6_32",jb="_selected__item_1phj6_55",Gb={selected__panel:Nb,selected__header:Lb,selected__title:Ub,selected__count:Bb,selected__list:Fb,selected__item:jb,"selected__item-content":"_selected__item-content_1phj6_64","selected__item-avatar":"_selected__item-avatar_1phj6_70","selected__item-label":"_selected__item-label_1phj6_83","selected__remove-button":"_selected__remove-button_1phj6_91"},qb={$style:Gb},Hb=Z(Db,[["__cssModules",qb]]),Vb=["data-level"],zb={key:0,viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor"},Wb=["data-level"],Kb=z({__name:"TreeNode",props:{node:{},level:{},selectedKeys:{},halfSelectedKeys:{},lockedKeys:{},expandedKeys:{},loadingKeys:{},renderItem:{}},emits:["item-click","expand"],setup(t,{emit:e}){const n=t,o=e,r=B(()=>n.selectedKeys.has(n.node.key)),a=B(()=>n.halfSelectedKeys.has(n.node.key)),s=B(()=>n.lockedKeys.has(n.node.key)),i=B(()=>n.expandedKeys.has(n.node.key)),l=B(()=>n.loadingKeys.has(n.node.key)),c=B(()=>n.node.children&&n.node.children.length>0),u=B(()=>i.value&&n.node.lazyLoad&&l.value),d=()=>{s.value||o("item-click",n.node.key)},p=h=>{h.stopPropagation(),o("expand",n.node)};return(h,m)=>{const g=Wy("TreeNode",!0);return _(),O("div",{class:S(h.$style["tree__node-wrapper"])},[I("div",{class:S([h.$style.tree__node,{[h.$style["tree__node--selected"]]:r.value,[h.$style["tree__node--half-selected"]]:a.value,[h.$style["tree__node--locked"]]:s.value}])},[I("div",{class:S(h.$style["tree__node-content"]),"data-level":t.level,style:De({paddingLeft:`${t.level*20+(t.level>0&&t.node.isLeafNode?32:0)}px`})},[t.node.isLeafNode?Y("",!0):(_(),U(f(by),{key:0,name:"arrow-down",class:S([h.$style["tree__expand-icon"],{[h.$style["tree__expand-icon--expanded"]]:i.value}]),size:20,onClick:p},null,8,["class"])),I("div",{class:S(h.$style["tree__checkbox-wrapper"]),onClick:d},[I("div",{class:S([h.$style.tree__checkbox,{[h.$style["tree__checkbox--checked"]]:r.value,[h.$style["tree__checkbox--half-checked"]]:a.value}])},[a.value?(_(),O("svg",zb,[...m[2]||(m[2]=[I("path",{d:"M19 13H5v-2h14v2z"},null,-1)])])):r.value?(_(),U(f(jc),{key:1,name:"check"})):Y("",!0)],2)],2),t.renderItem?(_(),U(se(t.renderItem),{key:1,node:t.node},null,8,["node"])):(_(),O("div",{key:2,class:S(h.$style["tree__node-label"])},[m[3]||(m[3]=I("span",null,"头像",-1)),I("span",{class:S(h.$style.tree__label)},H(t.node.label),3)],2))],14,Vb)],2),c.value&&i.value||u.value?(_(),O("div",{key:0,class:S(h.$style["tree__child-nodes"])},[u.value&&!c.value?(_(),O("div",{key:0,class:S(h.$style["tree__loading-container"]),"data-level":t.level+1,style:De({paddingLeft:`${(t.level+1)*20+40}px`})},[I("span",{class:S(h.$style["tree__loading-indicator"])},[V(f(nr))],2)],14,Wb)):(_(!0),O(ie,{key:1},we(t.node.children,v=>(_(),U(g,{key:v.key,node:v,level:t.level+1,"selected-keys":t.selectedKeys,"half-selected-keys":t.halfSelectedKeys,"locked-keys":t.lockedKeys,"expanded-keys":t.expandedKeys,"loading-keys":t.loadingKeys,"render-item":t.renderItem,onItemClick:m[0]||(m[0]=b=>h.$emit("item-click",b)),onExpand:m[1]||(m[1]=b=>h.$emit("expand",b))},null,8,["node","level","selected-keys","half-selected-keys","locked-keys","expanded-keys","loading-keys","render-item"]))),128))],2)):Y("",!0)],2)}}}),Yb="_tree__node_19f24_1",Jb="_tree__checkbox_19f24_47",Xb="_tree__label_19f24_75",Qb="_tree__avatar_19f24_83",Zb={"tree__node-wrapper":"_tree__node-wrapper_19f24_1",tree__node:Yb,"tree__node--selected":"_tree__node--selected_19f24_12","tree__node--half-selected":"_tree__node--half-selected_19f24_18","tree__node--locked":"_tree__node--locked_19f24_21","tree__node-content":"_tree__node-content_19f24_25","tree__expand-icon":"_tree__expand-icon_19f24_30","tree__expand-icon--expanded":"_tree__expand-icon--expanded_19f24_41","tree__checkbox-wrapper":"_tree__checkbox-wrapper_19f24_47",tree__checkbox:Jb,"tree__checkbox--checked":"_tree__checkbox--checked_19f24_61","tree__checkbox--half-checked":"_tree__checkbox--half-checked_19f24_65","tree__node-label":"_tree__node-label_19f24_69",tree__label:Xb,tree__avatar:Qb,"tree__child-nodes":"_tree__child-nodes_19f24_95","tree__loading-container":"_tree__loading-container_19f24_98","tree__loading-indicator":"_tree__loading-indicator_19f24_102","tree-spin":"_tree-spin_19f24_1"},ew={$style:Zb},tw=Z(Kb,[["__cssModules",ew]]),nw=z({__name:"TreeMode",props:{dataSource:{},selectedKeys:{},halfSelectedKeys:{},lockedKeys:{},expandedKeys:{},loadingKeys:{},onItemClick:{type:Function},onExpand:{type:Function},renderItem:{}},setup(t){return(e,n)=>t.dataSource.length===0?(_(),O("div",{key:0,class:S(e.$style.tree__empty)},"No data available",2)):(_(),O("div",{key:1,class:S(e.$style.tree__container)},[(_(!0),O(ie,null,we(t.dataSource,o=>(_(),U(tw,{key:o.key,node:o,level:0,"selected-keys":t.selectedKeys,"half-selected-keys":t.halfSelectedKeys,"locked-keys":t.lockedKeys,"expanded-keys":t.expandedKeys,"loading-keys":t.loadingKeys,"render-item":t.renderItem,onItemClick:t.onItemClick,onExpand:t.onExpand},null,8,["node","selected-keys","half-selected-keys","locked-keys","expanded-keys","loading-keys","render-item","onItemClick","onExpand"]))),128))],2))}}),ow="_tree__container_1fo8v_1",rw="_tree__empty_1fo8v_21",aw={tree__container:ow,tree__empty:rw},sw={$style:aw},iw=Z(nw,[["__cssModules",sw]]);function lw(t){return t.length===0?!1:"isLeafNode"in t[0]}function cw(t,e){if(!e.trim())return t;const n=e.toLowerCase(),o=a=>a.key.toLowerCase().includes(n)||a.label.toLowerCase().includes(n),r=a=>{const s=[];return a.forEach(i=>{const l=o(i);let c=[];i.children&&i.children.length&&(c=r(i.children)),(l||c.length>0)&&s.push({...i,children:c.length>0?c:i.children})}),s};return r(t)}function uw(t,e){if(!e.trim())return t;const n=e.toLowerCase();return t.filter(o=>o.key.toLowerCase().includes(n)||o.label.toLowerCase().includes(n))}function dw({dataSource:t,isTreeMode:e=!1,onSearch:n,debounceTime:o=300}){const r=A(""),a=A(!1),s=B(()=>{const d=r.value.trim();return d?e&&lw(t.value)?cw(t.value,d):n?n(t.value,d):uw(t.value,d):t.value}),i=d=>{a.value=!0,r.value=d,a.value=!1},l=()=>{r.value=""},c=d=>{r.value=d},u=B(()=>r.value.trim()?Array.isArray(s.value)&&s.value.length===0:!1);return{searchValue:r,setSearchValue:c,filteredData:s,isSearching:a,handleSearch:i,clearSearch:l,isSearchEmpty:u}}function ds(t){return t.length===0?!1:"isLeafNode"in t[0]}function pw(t){const e=new Map,n=o=>{o.forEach(r=>{e.set(r.key,r),r.children&&r.children.length&&n(r.children)})};return n(t),e}function hw(t){const e=new Map,n=(o,r)=>{o.forEach(a=>{var s;r&&(e.has(r)||e.set(r,[]),(s=e.get(r))==null||s.push(a.key)),a.children&&a.children.length&&n(a.children,a.key)})};return n(t),e}function fw(t){const e=new Map,n=(o,r)=>{o.forEach(a=>{r&&e.set(a.key,r),a.children&&a.children.length&&n(a.children,a.key)})};return n(t),e}function fd(t,e){return t.size!==e.size?!1:Array.from(t).every(n=>e.has(n))}function mw({defaultSelectedKeys:t=[],lockedKeys:e=[],maxCount:n=1/0,minCount:o=0,isTreeMode:r=!1,dataSource:a,onSelectedChange:s,onMaxCountExceed:i}){const l=A(new Set(t)),c=A(new Set),u=A(new Set(e)),d=B(()=>r&&ds(a.value)?hw(a.value):new Map),p=B(()=>r&&ds(a.value)?fw(a.value):new Map),h=B(()=>r&&ds(a.value)?pw(a.value):new Map),m=B(()=>l.value.size),g=B(()=>m.value<n),v=B(()=>m.value>=n),b=M=>{const x=[],L=q=>{const $=d.value.get(q);$&&$.forEach(D=>{x.push(D),L(D)})};return L(M.key),x},w=M=>{const x=h.value.get(M);return x!=null&&x.isLeafNode&&!l.value.has(M)&&!u.value.has(M)?[x]:b({key:M}).filter(L=>!l.value.has(L)&&!u.value.has(L)).map(L=>h.value.get(L)).filter(L=>L==null?void 0:L.isLeafNode)},E=M=>{const x=h.value.get(M);return x!=null&&x.isLeafNode&&l.value.has(M)?[x]:b({key:M}).filter(L=>l.value.has(L)&&!u.value.has(L)).map(L=>h.value.get(L)).filter(L=>L==null?void 0:L.isLeafNode)},y=M=>{const x=[M];let L=M;for(;p.value.has(L);){const q=p.value.get(L);x.push(q),L=q}return x},P=()=>{if(!r)return;const M=new Set,x=new Set,L=new Set(Array.from(l.value));d.value.forEach((D,G)=>{L.add(G)}),d.value.forEach(D=>{D.forEach(G=>L.add(G))}),l.value.forEach(D=>{const G=d.value.get(D);(!G||G.length===0)&&l.value.has(D)&&M.add(D)});let q=!0;const $=D=>{if(u.value.has(D))return;const G=d.value.get(D);if(!G||G.length===0)return;const k=G.filter(pe=>!u.value.has(pe));if(k.length===0)return;const N=k.filter(pe=>M.has(pe)).length,F=k.filter(pe=>x.has(pe)).length,K=M.has(D),J=x.has(D);N===k.length?(!K||J)&&(M.add(D),x.delete(D),q=!0):N>0||F>0?(K||!J)&&(M.delete(D),x.add(D),q=!0):(K||J)&&(M.delete(D),x.delete(D),q=!0)};for(;q;)q=!1,L.forEach($);fd(M,l.value)||(l.value=M),fd(x,c.value)||(c.value=x)},C=M=>{if(u.value.has(M))return;const x=new Set(l.value);if(r){const L=x.has(M),q=c.value.has(M);if(L){const $=E(M),D=T().filter(G=>G.isLeafNode).length;$.length>0&&D-$.length>=o&&$.forEach(G=>{x.delete(G.key)})}else if(q){const $=w(M).length;if($===0){const D=E(M),G=T().filter(k=>k.isLeafNode).length;D.length>0&&G-D.length>=o&&D.forEach(k=>{x.delete(k.key)})}else $>0&&T().filter(D=>D.isLeafNode).length+$<=n&&w(M).forEach(D=>{x.add(D.key)})}else{const $=w(M);$.length>0&&T().filter(D=>D.isLeafNode).length+$.length<=n&&$.forEach(D=>{x.add(D.key)})}}else x.has(M)?x.delete(M):x.size<n?x.add(M):i==null||i(T());l.value=x},T=()=>{const M=[];if(r&&ds(a.value)){const x=a.value,L=(q,$)=>{var D;const G=$.find(k=>k.key===q);if(G)return G;for(let k=0;k<$.length;k+=1){const N=$[k];if((D=N.children)!=null&&D.length){const F=L(q,N.children);if(F)return F}}return null};l.value.forEach(q=>{const $=L(q,x);$&&M.push({key:$.key,label:$.label,avatarUrl:$.avatarUrl,isLeafNode:$.isLeafNode,extraData:$.extraData,path:[...y($.key)].reverse()})})}else{const x=a.value;l.value.forEach(L=>{const q=x.find($=>$.key===L);q&&M.push({key:q.key,label:q.label,avatarUrl:q.avatarUrl,extraData:q.extraData})})}return M};return ce([l,c],()=>{r&&P(),s&&s(T())},{deep:!0}),{selectedKeys:l,halfSelectedKeys:c,lockedKeys:u,isSelected:M=>l.value.has(M),isHalfSelected:M=>c.value.has(M),isLocked:M=>u.value.has(M),toggle:C,getSelectedItems:T,getNodeChildKeys:b,getSelectableLeafNodes:w,getCancelableLeafNodes:E,getNodeParentChildrenMap:()=>d.value,canSelectMore:g,reachMaxCount:v,allSelectedCount:m}}function gw({onExpand:t}={}){const e=A(new Set),n=A(new Set),o=s=>e.value.has(s),r=s=>n.value.has(s),a=(s,i)=>{const l=new Set(n.value);i?l.add(s):l.delete(s),n.value=l};return{expandedKeys:e,loadingKeys:n,checkNodeIsExpanded:o,checkNodeIsLoading:r,toggleExpand:s=>{if(s.isLeafNode)return;const i=new Set(e.value);i.has(s.key)?i.delete(s.key):(i.add(s.key),s.lazyLoad&&t&&(a(s.key,!0),t(s))),e.value=i},setNodeLoading:a}}const vw=["data-display-mode"],yw=["data-display-mode"],_w=z({__name:"UserPicker",props:{displayMode:{},dataSource:{default:()=>[]},defaultSelectedItems:{default:()=>[]},lockedItems:{default:()=>[]},maxCount:{default:Number.POSITIVE_INFINITY},minCount:{default:0},onMaxCountExceed:{},enableSearch:{type:Boolean,default:!0},searchPlaceholder:{},onSearch:{},renderItem:{},onSelectedChange:{},onReachEnd:{},onExpand:{}},setup(t,{expose:e}){const n=t,{t:o}=ve(),r=B(()=>n.displayMode==="tree"),a=A(n.dataSource),s=B(()=>n.defaultSelectedItems.map(p=>p.key)),i=B(()=>n.lockedItems.map(p=>p.key)),l=mw({defaultSelectedKeys:s.value,lockedKeys:i.value,maxCount:n.maxCount,minCount:n.minCount,isTreeMode:r.value,dataSource:a,onSelectedChange:n.onSelectedChange||(()=>{}),onMaxCountExceed:n.onMaxCountExceed||(()=>{})}),c=dw({dataSource:a,isTreeMode:r.value,onSearch:n.onSearch}),u=gw({onExpand:p=>{n.onExpand&&n.onExpand(p)}});ce(()=>n.dataSource,p=>{r.value||(a.value=p)},{deep:!0});const d=(p,h)=>{if(!r.value)return;const m=JSON.parse(JSON.stringify(a.value)),g=v=>{for(let b=0;b<v.length;b+=1){if(v[b].key===p){const E={...v[b],...h,key:v[b].key};h.children&&v[b].lazyLoad&&(E.lazyLoad=!1);const y=[...v];return y[b]=E,v.splice(0,v.length,...y),!0}const{children:w}=v[b];if(w&&Array.isArray(w)&&w.length>0&&g(w))return!0}return!1};Array.isArray(m)&&g(m),a.value=m,h.children&&u.setNodeLoading(p,!1)};return e({getSelectedItems:()=>l.getSelectedItems(),updateListData:p=>{r.value||(a.value=p)},updateTreeData:(p,h)=>{d(p,h)}}),(p,h)=>(_(),O("div",{class:S(p.$style["user-picker"]),"data-display-mode":t.displayMode},[t.enableSearch?(_(),U(f(Rb),{key:0,placeholder:t.searchPlaceholder||f(o)("UserPicker.search"),"on-search":f(c).handleSearch},null,8,["placeholder","on-search"])):Y("",!0),I("div",{class:S(p.$style["user-picker__panel"]),"data-display-mode":t.displayMode},[f(c).isSearchEmpty.value?(_(),O("div",{key:0,class:S(p.$style["empty-search"])},H(f(o)("UserPicker.no_result")),3)):r.value?(_(),U(f(iw),{key:2,"data-source":f(c).filteredData.value,"selected-keys":f(l).selectedKeys.value,"half-selected-keys":f(l).halfSelectedKeys.value,"locked-keys":f(l).lockedKeys.value,"expanded-keys":f(u).expandedKeys.value,"loading-keys":f(u).loadingKeys.value,"on-item-click":f(l).toggle,"on-expand":f(u).toggleExpand,"render-item":t.renderItem},null,8,["data-source","selected-keys","half-selected-keys","locked-keys","expanded-keys","loading-keys","on-item-click","on-expand","render-item"])):(_(),U(f(Cb),{key:1,"data-source":f(c).filteredData.value,"selected-keys":f(l).selectedKeys.value,"locked-keys":f(l).lockedKeys.value,"on-item-click":f(l).toggle,"on-reach-end":t.onReachEnd||(()=>{}),"render-item":t.renderItem},null,8,["data-source","selected-keys","locked-keys","on-item-click","on-reach-end","render-item"]))],10,yw),V(f(Hb),{"display-mode":t.displayMode,"selected-items":f(l).getSelectedItems(),"locked-keys":f(l).lockedKeys.value,"on-remove":f(l).toggle,"max-count":t.maxCount},null,8,["display-mode","selected-items","locked-keys","on-remove","max-count"])],10,vw))}}),bw={"user-picker":"_user-picker_1cf9q_1","user-picker__panel":"_user-picker__panel_1cf9q_8","user-picker__empty-search":"_user-picker__empty-search_1cf9q_17","user-picker__selection-status":"_user-picker__selection-status_1cf9q_25"},ww={$style:bw},Sw=Z(_w,[["__cssModules",ww]]),kw={search:"Search",no_result:"No result",no_data_available:"No data available",selected:"Selected",people_unit:"people"},Ew={search:"搜索",no_result:"没有结果",no_data_available:"无数据",selected:"已选择",people_unit:"人"},uf={"en-US":kw,"zh-CN":Ew};un("en-US",{translation:{UserPicker:uf["en-US"]}});un("zh-CN",{translation:{UserPicker:uf["zh-CN"]}});const $i=Sw;var Ge=(t=>(t[t.C2C=oe.TYPES.CONV_C2C]="C2C",t[t.GROUP=oe.TYPES.CONV_GROUP]="GROUP",t[t.SYSTEM=oe.TYPES.CONV_SYSTEM]="SYSTEM",t))(Ge||{}),ue=(t=>(t[t.TEXT=oe.TYPES.MSG_TEXT]="TEXT",t[t.IMAGE=oe.TYPES.MSG_IMAGE]="IMAGE",t[t.AUDIO=oe.TYPES.MSG_AUDIO]="AUDIO",t[t.VIDEO=oe.TYPES.MSG_VIDEO]="VIDEO",t[t.FILE=oe.TYPES.MSG_FILE]="FILE",t[t.FACE=oe.TYPES.MSG_FACE]="FACE",t[t.LOCATION=oe.TYPES.MSG_LOCATION]="LOCATION",t[t.GRP_TIP=oe.TYPES.MSG_GRP_TIP]="GRP_TIP",t[t.CUSTOM=oe.TYPES.MSG_CUSTOM]="CUSTOM",t[t.MERGER=oe.TYPES.MSG_MERGER]="MERGER",t))(ue||{}),Q=(t=>(t.MESSAGE="message",t.CHAT_MESSAGE="chat_message",t.USER="user",t.GROUP="group",t))(Q||{}),Cw=(t=>(t[t.LOWEST=oe.TYPES.MSG_PRIORITY_LOWEST]="LOWEST",t[t.LOW=oe.TYPES.MSG_PRIORITY_LOW]="LOW",t[t.NORMAL=oe.TYPES.MSG_PRIORITY_NORMAL]="NORMAL",t[t.HIGH=oe.TYPES.MSG_PRIORITY_HIGH]="HIGH",t))(Cw||{}),de=(t=>(t.MINI="mini",t.STANDARD="standard",t.EMBEDDED="embedded",t.EXACT="exact",t))(de||{});const df={[Q.MESSAGE]:"Search.type.messages",[Q.CHAT_MESSAGE]:"Search.type.messages",[Q.USER]:"Search.type.users",[Q.GROUP]:"Search.type.groups"};var Pe=(t=>(t.USER_SELECT="Next",t.CREATE_DETAIL="Create",t.GROUP_TYPE="GroupType",t))(Pe||{}),Nt=(t=>(t.LOADING="LOADING",t.NO_CONVERSATIONS="NO_CONVERSATIONS",t.WRONG="WRONG",t))(Nt||{}),qs=(t=>(t.C2C="createC2C",t.GROUP="createGroup",t))(qs||{}),uo=(t=>(t.NAME="name",t.GROUP_ID="groupID",t.TYPE="type",t))(uo||{}),dt=(t=>(t.WORK="Private",t.PUBLIC="Public",t.MEETING="ChatRoom",t.AVCHATROOM="AVChatRoom",t.COMMUNITY="Community",t))(dt||{});const ae=z({name:"View",__name:"View",props:{gap:{default:void 0},dir:{default:"column"},justify:{default:void 0},align:{default:void 0}},setup(t){const e=t,n=B(()=>ke("view__v",{"view__v--dir-row":e.dir==="row",[`view__v--justify-${e.justify}`]:e.justify,[`view__v--align-${e.align}`]:e.align}));return(o,r)=>(_(),O("div",{class:S(n.value),style:De({gap:t.gap?`${t.gap}px`:void 0})},[ee(o.$slots,"default")],6))}});function dn(t,e){const n=typeof t=="string"&&!e?`${t}Context`:e,o=Symbol(n);return[r=>{const a=Hc(o,r);if(a||a===null)return a;throw new Error(`Injection \`${o.toString()}\` not found. Component must be used within ${Array.isArray(t)?`one of the following components: ${t.join(", ")}`:`\`${t}\``}`)},r=>(Vc(o,r),r)]}function Qe(){let t=document.activeElement;if(t==null)return null;for(;t!=null&&t.shadowRoot!=null&&t.shadowRoot.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function pf(t,e,n){const o=n.originalEvent.target,r=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),o.dispatchEvent(r)}function Mw(t){return t==null}function Yc(t){return t?t.flatMap(e=>e.type===ie?Yc(e.children):[e]):[]}const[hf]=dn("ConfigProvider");function $w(t,e){var n;const o=Na();return Wt(()=>{o.value=t()},{...e,flush:(n=void 0)!==null&&n!==void 0?n:"sync"}),t_(o)}function ff(t,e){return Yh()?(Jh(t,e),!0):!1}function Tw(t){let e=!1,n;const o=Kh(!0);return(...r)=>(e||(n=o.run(()=>t(...r)),e=!0),n)}const Tn=typeof window<"u"&&typeof document<"u",Iw=t=>typeof t<"u",Aw=Object.prototype.toString,xw=t=>Aw.call(t)==="[object Object]",md=Ow();function Ow(){var t,e,n;return Tn&&!!(!((t=window)===null||t===void 0||(t=t.navigator)===null||t===void 0)&&t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window)===null||e===void 0||(e=e.navigator)===null||e===void 0?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test((n=window)===null||n===void 0?void 0:n.navigator.userAgent))}function ll(t){return Array.isArray(t)?t:[t]}function Rw(t){return Zn()}function mf(t){if(!Tn)return t;let e=0,n,o;const r=()=>{e-=1,o&&e<=0&&(o.stop(),n=void 0,o=void 0)};return(...a)=>(e+=1,o||(o=Kh(!0),n=o.run(()=>t(...a))),ff(r),n)}function Pw(t){return sl(t)?ur(new Proxy({},{get(e,n,o){return f(Reflect.get(t.value,n,o))},set(e,n,o){return sl(t.value[n])&&!sl(o)?t.value[n].value=o:t.value[n]=o,!0},deleteProperty(e,n){return Reflect.deleteProperty(t.value,n)},has(e,n){return Reflect.has(t.value,n)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}})):ur(t)}function Dw(t){return Pw(B(t))}function Nw(t,...e){const n=e.flat(),o=n[0];return Dw(()=>Object.fromEntries(typeof o=="function"?Object.entries(rn(t)).filter(([r,a])=>!o(_t(a),r)):Object.entries(rn(t)).filter(r=>!n.includes(r[0]))))}function Lw(t,e=1e4){return Xh((n,o)=>{let r=_t(t),a;const s=()=>setTimeout(()=>{r=_t(t),o()},_t(e));return ff(()=>{clearTimeout(a)}),{get(){return n(),r},set(i){r=i,o(),clearTimeout(a),a=s()}}})}function Uw(t,e){Rw()&&Da(t,e)}function Bw(t,e,n){return ce(t,e,{...n,immediate:!0})}const Jc=Tn?window:void 0;function Mr(t){var e;const n=_t(t);return(e=n==null?void 0:n.$el)!==null&&e!==void 0?e:n}function Hs(...t){const e=(o,r,a,s)=>(o.addEventListener(r,a,s),()=>o.removeEventListener(r,a,s)),n=B(()=>{const o=ll(_t(t[0])).filter(r=>r!=null);return o.every(r=>typeof r!="string")?o:void 0});return Bw(()=>{var o,r;return[(o=(r=n.value)===null||r===void 0?void 0:r.map(a=>Mr(a)))!==null&&o!==void 0?o:[Jc].filter(a=>a!=null),ll(_t(n.value?t[1]:t[0])),ll(f(n.value?t[2]:t[1])),_t(n.value?t[3]:t[2])]},([o,r,a,s],i,l)=>{if(!(o!=null&&o.length)||!(r!=null&&r.length)||!(a!=null&&a.length))return;const c=xw(s)?{...s}:s,u=o.flatMap(d=>r.flatMap(p=>a.map(h=>e(d,p,h,c))));l(()=>{u.forEach(d=>d())})},{flush:"post"})}function Fw(){const t=Na(!1),e=Zn();return e&&qe(()=>{t.value=!0},e),t}function jw(t){return typeof t=="function"?t:typeof t=="string"?e=>e.key===t:Array.isArray(t)?e=>t.includes(e.key):()=>!0}function Gw(...t){let e,n,o={};t.length===3?(e=t[0],n=t[1],o=t[2]):t.length===2?typeof t[1]=="object"?(e=!0,n=t[0],o=t[1]):(e=t[0],n=t[1]):(e=!0,n=t[0]);const{target:r=Jc,eventName:a="keydown",passive:s=!1,dedupe:i=!1}=o,l=jw(e);return Hs(r,a,c=>{c.repeat&&_t(i)||l(c)&&n(c)},s)}function qw(t){return JSON.parse(JSON.stringify(t))}function Ti(t,e,n,o={}){var r,a;const{clone:s=!1,passive:i=!1,eventName:l,deep:c=!1,defaultValue:u,shouldEmit:d}=o,p=Zn(),h=n||(p==null?void 0:p.emit)||(p==null||(r=p.$emit)===null||r===void 0?void 0:r.bind(p))||(p==null||(a=p.proxy)===null||a===void 0||(a=a.$emit)===null||a===void 0?void 0:a.bind(p==null?void 0:p.proxy));let m=l;e||(e="modelValue"),m=m||`update:${e.toString()}`;const g=w=>s?typeof s=="function"?s(w):qw(w):w,v=()=>Iw(t[e])?g(t[e]):u,b=w=>{d?d(w)&&h(m,w):h(m,w)};if(i){const w=A(v());let E=!1;return ce(()=>t[e],y=>{E||(E=!0,w.value=g(y),Fe(()=>E=!1))}),ce(w,y=>{!E&&(y!==t[e]||c)&&b(y)},{deep:c}),w}else return B({get(){return v()},set(w){b(w)}})}function cl(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in t?!1:Symbol.toStringTag in t?Object.prototype.toString.call(t)==="[object Module]":!0}function Jl(t,e,n=".",o){if(!cl(e))return Jl(t,{},n);const r=Object.assign({},e);for(const a in t){if(a==="__proto__"||a==="constructor")continue;const s=t[a];s!=null&&(Array.isArray(s)&&Array.isArray(r[a])?r[a]=[...s,...r[a]]:cl(s)&&cl(r[a])?r[a]=Jl(s,r[a],(n?`${n}.`:"")+a.toString()):r[a]=s)}return r}function Hw(t){return(...e)=>e.reduce((n,o)=>Jl(n,o,""),{})}const Vw=Hw(),zw=mf(()=>{const t=A(new Map),e=A(),n=B(()=>{for(const s of t.value.values())if(s)return!0;return!1}),o=hf({scrollBody:A(!0)});let r=null;const a=()=>{document.body.style.paddingRight="",document.body.style.marginRight="",document.body.style.pointerEvents="",document.documentElement.style.removeProperty("--scrollbar-width"),document.body.style.overflow=e.value??"",md&&(r==null||r()),e.value=void 0};return ce(n,(s,i)=>{var l;if(!Tn)return;if(!s){i&&a();return}e.value===void 0&&(e.value=document.body.style.overflow);const c=window.innerWidth-document.documentElement.clientWidth,u={padding:c,margin:0},d=(l=o.scrollBody)!=null&&l.value?typeof o.scrollBody.value=="object"?Vw({padding:o.scrollBody.value.padding===!0?c:o.scrollBody.value.padding,margin:o.scrollBody.value.margin===!0?c:o.scrollBody.value.margin},u):u:{padding:0,margin:0};c>0&&(document.body.style.paddingRight=typeof d.padding=="number"?`${d.padding}px`:String(d.padding),document.body.style.marginRight=typeof d.margin=="number"?`${d.margin}px`:String(d.margin),document.documentElement.style.setProperty("--scrollbar-width",`${c}px`),document.body.style.overflow="hidden"),md&&(r=Hs(document,"touchmove",p=>Ww(p),{passive:!1})),Fe(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})},{immediate:!0,flush:"sync"}),t});function Xc(t){const e=Math.random().toString(36).substring(2,7),n=zw();n.value.set(e,t??!1);const o=B({get:()=>n.value.get(e)??!1,set:r=>n.value.set(e,r)});return Uw(()=>{n.value.delete(e)}),o}function gf(t){const e=window.getComputedStyle(t);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&t.clientWidth<t.scrollWidth||e.overflowY==="auto"&&t.clientHeight<t.scrollHeight)return!0;{const n=t.parentNode;return!(n instanceof Element)||n.tagName==="BODY"?!1:gf(n)}}function Ww(t){const e=t||window.event,n=e.target;return n instanceof Element&&gf(n)?!1:e.touches.length>1?!0:(e.preventDefault&&e.cancelable&&e.preventDefault(),!1)}function Ua(t){const e=Zn(),n=e==null?void 0:e.type.emits,o={};return n!=null&&n.length||console.warn(`No emitted event found. Please check component: ${e==null?void 0:e.type.__name}`),n==null||n.forEach(r=>{o[Zy(Wh(r))]=(...a)=>t(r,...a)}),o}function Ne(){const t=Zn(),e=A(),n=B(()=>o());Ky(()=>{n.value!==o()&&e_(e)});function o(){return e.value&&"$el"in e.value&&["#text","#comment"].includes(e.value.$el.nodeName)?e.value.$el.nextElementSibling:Mr(e)}const r=Object.assign({},t.exposed),a={};for(const i in t.props)Object.defineProperty(a,i,{enumerable:!0,configurable:!0,get:()=>t.props[i]});if(Object.keys(r).length>0)for(const i in r)Object.defineProperty(a,i,{enumerable:!0,configurable:!0,get:()=>r[i]});Object.defineProperty(a,"$el",{enumerable:!0,configurable:!0,get:()=>t.vnode.el}),t.exposed=a;function s(i){if(e.value=i,!!i&&(Object.defineProperty(a,"$el",{enumerable:!0,configurable:!0,get:()=>i instanceof Element?i:i.$el}),!(i instanceof Element)&&!Object.prototype.hasOwnProperty.call(i,"$el"))){const l=i.$.exposed,c=Object.assign({},a);for(const u in l)Object.defineProperty(c,u,{enumerable:!0,configurable:!0,get:()=>l[u]});t.exposed=c}}return{forwardRef:s,currentRef:e,currentElement:n}}var Kw=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},jo=new WeakMap,ps=new WeakMap,hs={},ul=0,vf=function(t){return t&&(t.host||vf(t.parentNode))},Yw=function(t,e){return e.map(function(n){if(t.contains(n))return n;var o=vf(n);return o&&t.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Jw=function(t,e,n,o){var r=Yw(e,Array.isArray(t)?t:[t]);hs[n]||(hs[n]=new WeakMap);var a=hs[n],s=[],i=new Set,l=new Set(r),c=function(d){!d||i.has(d)||(i.add(d),c(d.parentNode))};r.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(p){if(i.has(p))u(p);else try{var h=p.getAttribute(o),m=h!==null&&h!=="false",g=(jo.get(p)||0)+1,v=(a.get(p)||0)+1;jo.set(p,g),a.set(p,v),s.push(p),g===1&&m&&ps.set(p,!0),v===1&&p.setAttribute(n,"true"),m||p.setAttribute(o,"true")}catch(b){console.error("aria-hidden: cannot operate on ",p,b)}})};return u(e),i.clear(),ul++,function(){s.forEach(function(d){var p=jo.get(d)-1,h=a.get(d)-1;jo.set(d,p),a.set(d,h),p||(ps.has(d)||d.removeAttribute(o),ps.delete(d)),h||d.removeAttribute(n)}),ul--,ul||(jo=new WeakMap,jo=new WeakMap,ps=new WeakMap,hs={})}},Xw=function(t,e,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(t)?t:[t]),r=Kw(t);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Jw(o,r,n,"aria-hidden")):function(){return null}};function Qc(t){let e;ce(()=>Mr(t),n=>{n?e=Xw(n):e&&e()}),st(()=>{e&&e()})}function Qw(t,e){const n=A(t);function o(r){return e[n.value][r]??n.value}return{state:n,dispatch:r=>{n.value=o(r)}}}function Zw(t,e){var n;const o=A({}),r=A("none"),a=A(t),s=t.value?"mounted":"unmounted";let i;const l=((n=e.value)==null?void 0:n.ownerDocument.defaultView)??Jc,{state:c,dispatch:u}=Qw(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),d=v=>{var b;if(Tn){const w=new CustomEvent(v,{bubbles:!1,cancelable:!1});(b=e.value)==null||b.dispatchEvent(w)}};ce(t,async(v,b)=>{var w;const E=b!==v;if(await Fe(),E){const y=r.value,P=fs(e.value);v?(u("MOUNT"),d("enter"),P==="none"&&d("after-enter")):P==="none"||P==="undefined"||((w=o.value)==null?void 0:w.display)==="none"?(u("UNMOUNT"),d("leave"),d("after-leave")):b&&y!==P?(u("ANIMATION_OUT"),d("leave")):(u("UNMOUNT"),d("after-leave"))}},{immediate:!0});const p=v=>{const b=fs(e.value),w=b.includes(CSS.escape(v.animationName)),E=c.value==="mounted"?"enter":"leave";if(v.target===e.value&&w&&(d(`after-${E}`),u("ANIMATION_END"),!a.value)){const y=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",i=l==null?void 0:l.setTimeout(()=>{var P;((P=e.value)==null?void 0:P.style.animationFillMode)==="forwards"&&(e.value.style.animationFillMode=y)})}v.target===e.value&&b==="none"&&u("ANIMATION_END")},h=v=>{v.target===e.value&&(r.value=fs(e.value))},m=ce(e,(v,b)=>{v?(o.value=getComputedStyle(v),v.addEventListener("animationstart",h),v.addEventListener("animationcancel",p),v.addEventListener("animationend",p)):(u("ANIMATION_END"),i!==void 0&&(l==null||l.clearTimeout(i)),b==null||b.removeEventListener("animationstart",h),b==null||b.removeEventListener("animationcancel",p),b==null||b.removeEventListener("animationend",p))},{immediate:!0}),g=ce(c,()=>{const v=fs(e.value);r.value=c.value==="mounted"?v:"none"});return st(()=>{m(),g()}),{isPresent:B(()=>["mounted","unmountSuspended"].includes(c.value))}}function fs(t){return t&&getComputedStyle(t).animationName||"none"}var Ii=z({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(t,{slots:e,expose:n}){var o;const{present:r,forceMount:a}=rn(t),s=A(),{isPresent:i}=Zw(r,s);n({present:i});let l=e.default({present:i.value});l=Yc(l||[]);const c=Zn();if(l&&(l==null?void 0:l.length)>1){const u=(o=c==null?void 0:c.parent)!=null&&o.type.name?`<${c.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${u}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(d=>` - ${d}`).join(`
|
||
`)].join(`
|
||
`))}return()=>a.value||r.value||i.value?he(e.default({present:i.value})[0],{ref:u=>{const d=Mr(u);return typeof(d==null?void 0:d.hasAttribute)>"u"||(d!=null&&d.hasAttribute("data-reka-popper-content-wrapper")?s.value=d.firstElementChild:s.value=d),d}}):null}});const Xl=z({name:"PrimitiveSlot",inheritAttrs:!1,setup(t,{attrs:e,slots:n}){return()=>{var o;if(!n.default)return null;const r=Yc(n.default()),a=r.findIndex(c=>c.type!==Yy);if(a===-1)return r;const s=r[a];(o=s.props)==null||delete o.ref;const i=s.props?Me(e,s.props):e,l=Jy({...s,props:{}},i);return r.length===1?l:(r[a]=l,r)}}}),e0=["area","img","input"],an=z({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(t,{attrs:e,slots:n}){const o=t.asChild?"template":t.as;return typeof o=="string"&&e0.includes(o)?()=>he(o,e):o!=="template"?()=>he(t.as,e,{default:n.default}):()=>he(Xl,e,{default:n.default})}}),t0="dismissableLayer.pointerDownOutside",n0="dismissableLayer.focusOutside";function yf(t,e){const n=e.closest("[data-dismissable-layer]"),o=t.dataset.dismissableLayer===""?t:t.querySelector("[data-dismissable-layer]"),r=Array.from(t.ownerDocument.querySelectorAll("[data-dismissable-layer]"));return!!(n&&(o===n||r.indexOf(o)<r.indexOf(n)))}function o0(t,e,n=!0){var o;const r=((o=e==null?void 0:e.value)==null?void 0:o.ownerDocument)??(globalThis==null?void 0:globalThis.document),a=A(!1),s=A(()=>{});return Wt(i=>{if(!Tn||!_t(n))return;const l=async u=>{const d=u.target;if(!(!(e!=null&&e.value)||!d)){if(yf(e.value,d)){a.value=!1;return}if(u.target&&!a.value){let p=function(){pf(t0,t,h)};const h={originalEvent:u};u.pointerType==="touch"?(r.removeEventListener("click",s.value),s.value=p,r.addEventListener("click",s.value,{once:!0})):p()}else r.removeEventListener("click",s.value);a.value=!1}},c=window.setTimeout(()=>{r.addEventListener("pointerdown",l)},0);i(()=>{window.clearTimeout(c),r.removeEventListener("pointerdown",l),r.removeEventListener("click",s.value)})}),{onPointerDownCapture:()=>{_t(n)&&(a.value=!0)}}}function r0(t,e,n=!0){var o;const r=((o=e==null?void 0:e.value)==null?void 0:o.ownerDocument)??(globalThis==null?void 0:globalThis.document),a=A(!1);return Wt(s=>{if(!Tn||!_t(n))return;const i=async l=>{if(!(e!=null&&e.value))return;await Fe(),await Fe();const c=l.target;!e.value||!c||yf(e.value,c)||l.target&&!a.value&&pf(n0,t,{originalEvent:l})};r.addEventListener("focusin",i),s(()=>r.removeEventListener("focusin",i))}),{onFocusCapture:()=>{_t(n)&&(a.value=!0)},onBlurCapture:()=>{_t(n)&&(a.value=!1)}}}const Dt=ur({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,originalBodyPointerEvents:void 0,branches:new Set});var a0=z({__name:"DismissableLayer",props:{disableOutsidePointerEvents:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","dismiss"],setup(t,{emit:e}){const n=t,o=e,{forwardRef:r,currentElement:a}=Ne(),s=B(()=>{var h;return((h=a.value)==null?void 0:h.ownerDocument)??globalThis.document}),i=B(()=>Dt.layersRoot),l=B(()=>a.value?Array.from(i.value).indexOf(a.value):-1),c=B(()=>Dt.layersWithOutsidePointerEventsDisabled.size>0),u=B(()=>{const h=Array.from(i.value),[m]=[...Dt.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(m);return l.value>=g}),d=o0(async h=>{const m=[...Dt.branches].some(g=>g==null?void 0:g.contains(h.target));!u.value||m||(o("pointerDownOutside",h),o("interactOutside",h),await Fe(),h.defaultPrevented||o("dismiss"))},a),p=r0(h=>{[...Dt.branches].some(m=>m==null?void 0:m.contains(h.target))||(o("focusOutside",h),o("interactOutside",h),h.defaultPrevented||o("dismiss"))},a);return Gw("Escape",h=>{l.value===i.value.size-1&&(o("escapeKeyDown",h),h.defaultPrevented||o("dismiss"))}),Wt(h=>{a.value&&(n.disableOutsidePointerEvents&&(Dt.layersWithOutsidePointerEventsDisabled.size===0&&(Dt.originalBodyPointerEvents=s.value.body.style.pointerEvents,s.value.body.style.pointerEvents="none"),Dt.layersWithOutsidePointerEventsDisabled.add(a.value)),i.value.add(a.value),h(()=>{n.disableOutsidePointerEvents&&Dt.layersWithOutsidePointerEventsDisabled.size===1&&!Mw(Dt.originalBodyPointerEvents)&&(s.value.body.style.pointerEvents=Dt.originalBodyPointerEvents)}))}),Wt(h=>{h(()=>{a.value&&(i.value.delete(a.value),Dt.layersWithOutsidePointerEventsDisabled.delete(a.value))})}),(h,m)=>(_(),U(f(an),{ref:f(r),"as-child":h.asChild,as:h.as,"data-dismissable-layer":"",style:De({pointerEvents:c.value?u.value?"auto":"none":void 0}),onFocusCapture:f(p).onFocusCapture,onBlurCapture:f(p).onBlurCapture,onPointerdownCapture:f(d).onPointerDownCapture},{default:j(()=>[ee(h.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),Zc=a0;const s0=Tw(()=>A([]));function i0(){const t=s0();return{add(e){const n=t.value[0];e!==n&&(n==null||n.pause()),t.value=gd(t.value,e),t.value.unshift(e)},remove(e){var n;t.value=gd(t.value,e),(n=t.value[0])==null||n.resume()}}}function gd(t,e){const n=[...t],o=n.indexOf(e);return o!==-1&&n.splice(o,1),n}const dl="focusScope.autoFocusOnMount",pl="focusScope.autoFocusOnUnmount",vd={bubbles:!1,cancelable:!0};function l0(t,{select:e=!1}={}){const n=Qe();for(const o of t)if(Ln(o,{select:e}),Qe()!==n)return!0}function c0(t){const e=_f(t),n=yd(e,t),o=yd(e.reverse(),t);return[n,o]}function _f(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function yd(t,e){for(const n of t)if(!u0(n,{upTo:e}))return n}function u0(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function d0(t){return t instanceof HTMLInputElement&&"select"in t}function Ln(t,{select:e=!1}={}){if(t&&t.focus){const n=Qe();t.focus({preventScroll:!0}),t!==n&&d0(t)&&e&&t.select()}}var p0=z({__name:"FocusScope",props:{loop:{type:Boolean,required:!1,default:!1},trapped:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["mountAutoFocus","unmountAutoFocus"],setup(t,{emit:e}){const n=t,o=e,{currentRef:r,currentElement:a}=Ne(),s=A(null),i=i0(),l=ur({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});Wt(u=>{if(!Tn)return;const d=a.value;if(!n.trapped)return;function p(v){if(l.paused||!d)return;const b=v.target;d.contains(b)?s.value=b:Ln(s.value,{select:!0})}function h(v){if(l.paused||!d)return;const b=v.relatedTarget;b!==null&&(d.contains(b)||Ln(s.value,{select:!0}))}function m(v){d.contains(s.value)||Ln(d)}document.addEventListener("focusin",p),document.addEventListener("focusout",h);const g=new MutationObserver(m);d&&g.observe(d,{childList:!0,subtree:!0}),u(()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",h),g.disconnect()})}),Wt(async u=>{const d=a.value;if(await Fe(),!d)return;i.add(l);const p=Qe();if(!d.contains(p)){const h=new CustomEvent(dl,vd);d.addEventListener(dl,m=>o("mountAutoFocus",m)),d.dispatchEvent(h),h.defaultPrevented||(l0(_f(d),{select:!0}),Qe()===p&&Ln(d))}u(()=>{d.removeEventListener(dl,g=>o("mountAutoFocus",g));const h=new CustomEvent(pl,vd),m=g=>{o("unmountAutoFocus",g)};d.addEventListener(pl,m),d.dispatchEvent(h),setTimeout(()=>{h.defaultPrevented||Ln(p??document.body,{select:!0}),d.removeEventListener(pl,m),i.remove(l)},0)})});function c(u){if(!n.loop&&!n.trapped||l.paused)return;const d=u.key==="Tab"&&!u.altKey&&!u.ctrlKey&&!u.metaKey,p=Qe();if(d&&p){const h=u.currentTarget,[m,g]=c0(h);m&&g?!u.shiftKey&&p===g?(u.preventDefault(),n.loop&&Ln(m,{select:!0})):u.shiftKey&&p===m&&(u.preventDefault(),n.loop&&Ln(g,{select:!0})):p===h&&u.preventDefault()}}return(u,d)=>(_(),U(f(an),{ref_key:"currentRef",ref:r,tabindex:"-1","as-child":u.asChild,as:u.as,onKeydown:c},{default:j(()=>[ee(u.$slots,"default")]),_:3},8,["as-child","as"]))}}),eu=p0,h0=z({__name:"Teleport",props:{to:{type:null,required:!1,default:"body"},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(t){const e=Fw();return(n,o)=>f(e)||n.forceMount?(_(),U(qc,{key:0,to:n.to,disabled:n.disabled,defer:n.defer},[ee(n.$slots,"default")],8,["to","disabled","defer"])):Y("v-if",!0)}}),tu=h0;let hl=0;function bf(){Wt(t=>{if(!Tn)return;const e=document.querySelectorAll("[data-reka-focus-guard]");document.body.insertAdjacentElement("afterbegin",e[0]??_d()),document.body.insertAdjacentElement("beforeend",e[1]??_d()),hl++,t(()=>{hl===1&&document.querySelectorAll("[data-reka-focus-guard]").forEach(n=>n.remove()),hl--})})}function _d(){const t=document.createElement("span");return t.setAttribute("data-reka-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}function wf(t){const e=Zn(),n=Object.keys((e==null?void 0:e.type.props)??{}).reduce((r,a)=>{const s=(e==null?void 0:e.type.props[a]).default;return s!==void 0&&(r[a]=s),r},{}),o=n_(t);return B(()=>{const r={},a=(e==null?void 0:e.vnode.props)??{};return Object.keys(a).forEach(s=>{r[Wh(s)]=a[s]}),Object.keys({...n,...r}).reduce((s,i)=>(o.value[i]!==void 0&&(s[i]=o.value[i]),s),{})})}function Po(t,e){const n=wf(t),o=e?Ua(e):{};return B(()=>({...n.value,...o}))}function f0(t){const e=A(),n=B(()=>{var r;return((r=e.value)==null?void 0:r.width)??0}),o=B(()=>{var r;return((r=e.value)==null?void 0:r.height)??0});return qe(()=>{const r=Mr(t);if(r){e.value={width:r.offsetWidth,height:r.offsetHeight};const a=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let l,c;if("borderBoxSize"in i){const u=i.borderBoxSize,d=Array.isArray(u)?u[0]:u;l=d.inlineSize,c=d.blockSize}else l=r.offsetWidth,c=r.offsetHeight;e.value={width:l,height:c}});return a.observe(r,{box:"border-box"}),()=>a.unobserve(r)}else e.value=void 0}),{width:n,height:o}}const[Sf,m0]=dn("PopperRoot");var g0=z({inheritAttrs:!1,__name:"PopperRoot",setup(t){const e=A();return m0({anchor:e,onAnchorChange:n=>e.value=n}),(n,o)=>ee(n.$slots,"default")}}),kf=g0,v0=z({__name:"PopperAnchor",props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=t,{forwardRef:n,currentElement:o}=Ne(),r=Sf();return Vh(()=>{r.onAnchorChange(e.reference??o.value)}),(a,s)=>(_(),U(f(an),{ref:f(n),as:a.as,"as-child":a.asChild},{default:j(()=>[ee(a.$slots,"default")]),_:3},8,["as","as-child"]))}}),nu=v0;function y0(t){return t!==null}function _0(t){return{name:"transformOrigin",options:t,fn(e){var n,o,r;const{placement:a,rects:s,middlewareData:i}=e,l=((n=i.arrow)==null?void 0:n.centerOffset)!==0,c=l?0:t.arrowWidth,u=l?0:t.arrowHeight,[d,p]=Ql(a),h={start:"0%",center:"50%",end:"100%"}[p],m=(((o=i.arrow)==null?void 0:o.x)??0)+c/2,g=(((r=i.arrow)==null?void 0:r.y)??0)+u/2;let v="",b="";return d==="bottom"?(v=l?h:`${m}px`,b=`${-u}px`):d==="top"?(v=l?h:`${m}px`,b=`${s.floating.height+u}px`):d==="right"?(v=`${-u}px`,b=l?h:`${g}px`):d==="left"&&(v=`${s.floating.width+u}px`,b=l?h:`${g}px`),{data:{x:v,y:b}}}}}function Ql(t){const[e,n="center"]=t.split("-");return[e,n]}const b0=["top","right","bottom","left"],Jn=Math.min,$t=Math.max,Vs=Math.round,ms=Math.floor,nn=t=>({x:t,y:t}),w0={left:"right",right:"left",bottom:"top",top:"bottom"};function Zl(t,e,n){return $t(t,Jn(e,n))}function En(t,e){return typeof t=="function"?t(e):t}function Cn(t){return t.split("-")[0]}function $r(t){return t.split("-")[1]}function ou(t){return t==="x"?"y":"x"}function ru(t){return t==="y"?"height":"width"}function tn(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function au(t){return ou(tn(t))}function S0(t,e,n){n===void 0&&(n=!1);const o=$r(t),r=au(t),a=ru(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(s=zs(s)),[s,zs(s)]}function k0(t){const e=zs(t);return[ec(t),e,ec(e)]}function ec(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const bd=["left","right"],wd=["right","left"],E0=["top","bottom"],C0=["bottom","top"];function M0(t,e,n){switch(t){case"top":case"bottom":return n?e?wd:bd:e?bd:wd;case"left":case"right":return e?E0:C0;default:return[]}}function $0(t,e,n,o){const r=$r(t);let a=M0(Cn(t),n==="start",o);return r&&(a=a.map(s=>s+"-"+r),e&&(a=a.concat(a.map(ec)))),a}function zs(t){const e=Cn(t);return w0[e]+t.slice(e.length)}function T0(t){return{top:0,right:0,bottom:0,left:0,...t}}function Ef(t){return typeof t!="number"?T0(t):{top:t,right:t,bottom:t,left:t}}function Ws(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}function Sd(t,e,n){let{reference:o,floating:r}=t;const a=tn(e),s=au(e),i=ru(s),l=Cn(e),c=a==="y",u=o.x+o.width/2-r.width/2,d=o.y+o.height/2-r.height/2,p=o[i]/2-r[i]/2;let h;switch(l){case"top":h={x:u,y:o.y-r.height};break;case"bottom":h={x:u,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:d};break;case"left":h={x:o.x-r.width,y:d};break;default:h={x:o.x,y:o.y}}switch($r(e)){case"start":h[s]-=p*(n&&c?-1:1);break;case"end":h[s]+=p*(n&&c?-1:1);break}return h}async function I0(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:a,rects:s,elements:i,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=En(e,t),m=Ef(h),g=i[p?d==="floating"?"reference":"floating":d],v=Ws(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(g)))==null||n?g:g.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(i.floating)),boundary:c,rootBoundary:u,strategy:l})),b=d==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(i.floating)),E=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},y=Ws(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:b,offsetParent:w,strategy:l}):b);return{top:(v.top-y.top+m.top)/E.y,bottom:(y.bottom-v.bottom+m.bottom)/E.y,left:(v.left-y.left+m.left)/E.x,right:(y.right-v.right+m.right)/E.x}}const A0=50,x0=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:a=[],platform:s}=n,i=s.detectOverflow?s:{...s,detectOverflow:I0},l=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:u,y:d}=Sd(c,o,l),p=o,h=0;const m={};for(let g=0;g<a.length;g++){const v=a[g];if(!v)continue;const{name:b,fn:w}=v,{x:E,y,data:P,reset:C}=await w({x:u,y:d,initialPlacement:o,placement:p,strategy:r,middlewareData:m,rects:c,platform:i,elements:{reference:t,floating:e}});u=E??u,d=y??d,m[b]={...m[b],...P},C&&h<A0&&(h++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:r}):C.rects),{x:u,y:d}=Sd(c,p,l)),g=-1)}return{x:u,y:d,placement:p,strategy:r,middlewareData:m}},O0=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:r,rects:a,platform:s,elements:i,middlewareData:l}=e,{element:c,padding:u=0}=En(t,e)||{};if(c==null)return{};const d=Ef(u),p={x:n,y:o},h=au(r),m=ru(h),g=await s.getDimensions(c),v=h==="y",b=v?"top":"left",w=v?"bottom":"right",E=v?"clientHeight":"clientWidth",y=a.reference[m]+a.reference[h]-p[h]-a.floating[m],P=p[h]-a.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let T=C?C[E]:0;(!T||!await(s.isElement==null?void 0:s.isElement(C)))&&(T=i.floating[E]||a.floating[m]);const M=y/2-P/2,x=T/2-g[m]/2-1,L=Jn(d[b],x),q=Jn(d[w],x),$=L,D=T-g[m]-q,G=T/2-g[m]/2+M,k=Zl($,G,D),N=!l.arrow&&$r(r)!=null&&G!==k&&a.reference[m]/2-(G<$?L:q)-g[m]/2<0,F=N?G<$?G-$:G-D:0;return{[h]:p[h]+F,data:{[h]:k,centerOffset:G-k-F,...N&&{alignmentOffset:F}},reset:N}}}),R0=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:a,rects:s,initialPlacement:i,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...v}=En(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const b=Cn(r),w=tn(i),E=Cn(i)===i,y=await(l.isRTL==null?void 0:l.isRTL(c.floating)),P=p||(E||!g?[zs(i)]:k0(i)),C=m!=="none";!p&&C&&P.push(...$0(i,g,m,y));const T=[i,...P],M=await l.detectOverflow(e,v),x=[];let L=((o=a.flip)==null?void 0:o.overflows)||[];if(u&&x.push(M[b]),d){const G=S0(r,s,y);x.push(M[G[0]],M[G[1]])}if(L=[...L,{placement:r,overflows:x}],!x.every(G=>G<=0)){var q,$;const G=(((q=a.flip)==null?void 0:q.index)||0)+1,k=T[G];if(k&&(!(d==="alignment"&&w!==tn(k))||L.every(F=>tn(F.placement)===w?F.overflows[0]>0:!0)))return{data:{index:G,overflows:L},reset:{placement:k}};let N=($=L.filter(F=>F.overflows[0]<=0).sort((F,K)=>F.overflows[1]-K.overflows[1])[0])==null?void 0:$.placement;if(!N)switch(h){case"bestFit":{var D;const F=(D=L.filter(K=>{if(C){const J=tn(K.placement);return J===w||J==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(J=>J>0).reduce((J,pe)=>J+pe,0)]).sort((K,J)=>K[1]-J[1])[0])==null?void 0:D[0];F&&(N=F);break}case"initialPlacement":N=i;break}if(r!==N)return{reset:{placement:N}}}return{}}}};function kd(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ed(t){return b0.some(e=>t[e]>=0)}const P0=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:r="referenceHidden",...a}=En(t,e);switch(r){case"referenceHidden":{const s=await o.detectOverflow(e,{...a,elementContext:"reference"}),i=kd(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Ed(i)}}}case"escaped":{const s=await o.detectOverflow(e,{...a,altBoundary:!0}),i=kd(s,n.floating);return{data:{escapedOffsets:i,escaped:Ed(i)}}}default:return{}}}}},Cf=new Set(["left","top"]);async function D0(t,e){const{placement:n,platform:o,elements:r}=t,a=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=Cn(n),i=$r(n),l=tn(n)==="y",c=Cf.has(s)?-1:1,u=a&&l?-1:1,d=En(e,t);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return i&&typeof m=="number"&&(h=i==="end"?m*-1:m),l?{x:h*u,y:p*c}:{x:p*c,y:h*u}}const N0=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:a,placement:s,middlewareData:i}=e,l=await D0(e,t);return s===((n=i.offset)==null?void 0:n.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:a+l.y,data:{...l,placement:s}}}}},L0=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r,platform:a}=e,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:b=>{let{x:w,y:E}=b;return{x:w,y:E}}},...c}=En(t,e),u={x:n,y:o},d=await a.detectOverflow(e,c),p=tn(Cn(r)),h=ou(p);let m=u[h],g=u[p];if(s){const b=h==="y"?"top":"left",w=h==="y"?"bottom":"right",E=m+d[b],y=m-d[w];m=Zl(E,m,y)}if(i){const b=p==="y"?"top":"left",w=p==="y"?"bottom":"right",E=g+d[b],y=g-d[w];g=Zl(E,g,y)}const v=l.fn({...e,[h]:m,[p]:g});return{...v,data:{x:v.x-n,y:v.y-o,enabled:{[h]:s,[p]:i}}}}}},U0=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:r,rects:a,middlewareData:s}=e,{offset:i=0,mainAxis:l=!0,crossAxis:c=!0}=En(t,e),u={x:n,y:o},d=tn(r),p=ou(d);let h=u[p],m=u[d];const g=En(i,e),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const E=p==="y"?"height":"width",y=a.reference[p]-a.floating[E]+v.mainAxis,P=a.reference[p]+a.reference[E]-v.mainAxis;h<y?h=y:h>P&&(h=P)}if(c){var b,w;const E=p==="y"?"width":"height",y=Cf.has(Cn(r)),P=a.reference[d]-a.floating[E]+(y&&((b=s.offset)==null?void 0:b[d])||0)+(y?0:v.crossAxis),C=a.reference[d]+a.reference[E]+(y?0:((w=s.offset)==null?void 0:w[d])||0)-(y?v.crossAxis:0);m<P?m=P:m>C&&(m=C)}return{[p]:h,[d]:m}}}},B0=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:a,platform:s,elements:i}=e,{apply:l=()=>{},...c}=En(t,e),u=await s.detectOverflow(e,c),d=Cn(r),p=$r(r),h=tn(r)==="y",{width:m,height:g}=a.floating;let v,b;d==="top"||d==="bottom"?(v=d,b=p===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(b=d,v=p==="end"?"top":"bottom");const w=g-u.top-u.bottom,E=m-u.left-u.right,y=Jn(g-u[v],w),P=Jn(m-u[b],E),C=!e.middlewareData.shift;let T=y,M=P;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(M=E),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(T=w),C&&!p){const L=$t(u.left,0),q=$t(u.right,0),$=$t(u.top,0),D=$t(u.bottom,0);h?M=m-2*(L!==0||q!==0?L+q:$t(u.left,u.right)):T=g-2*($!==0||D!==0?$+D:$t(u.top,u.bottom))}await l({...e,availableWidth:M,availableHeight:T});const x=await s.getDimensions(i.floating);return m!==x.width||g!==x.height?{reset:{rects:!0}}:{}}}};function Ai(){return typeof window<"u"}function Do(t){return su(t)?(t.nodeName||"").toLowerCase():"#document"}function It(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function pn(t){var e;return(e=(su(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function su(t){return Ai()?t instanceof Node||t instanceof It(t).Node:!1}function Kt(t){return Ai()?t instanceof Element||t instanceof It(t).Element:!1}function In(t){return Ai()?t instanceof HTMLElement||t instanceof It(t).HTMLElement:!1}function Cd(t){return!Ai()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof It(t).ShadowRoot}function Ba(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=Yt(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&r!=="inline"&&r!=="contents"}function F0(t){return/^(table|td|th)$/.test(Do(t))}function xi(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const j0=/transform|translate|scale|rotate|perspective|filter/,G0=/paint|layout|strict|content/,io=t=>!!t&&t!=="none";let fl;function iu(t){const e=Kt(t)?Yt(t):t;return io(e.transform)||io(e.translate)||io(e.scale)||io(e.rotate)||io(e.perspective)||!lu()&&(io(e.backdropFilter)||io(e.filter))||j0.test(e.willChange||"")||G0.test(e.contain||"")}function q0(t){let e=Xn(t);for(;In(e)&&!pr(e);){if(iu(e))return e;if(xi(e))return null;e=Xn(e)}return null}function lu(){return fl==null&&(fl=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),fl}function pr(t){return/^(html|body|#document)$/.test(Do(t))}function Yt(t){return It(t).getComputedStyle(t)}function Oi(t){return Kt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Xn(t){if(Do(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Cd(t)&&t.host||pn(t);return Cd(e)?e.host:e}function Mf(t){const e=Xn(t);return pr(e)?t.ownerDocument?t.ownerDocument.body:t.body:In(e)&&Ba(e)?e:Mf(e)}function va(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=Mf(t),a=r===((o=t.ownerDocument)==null?void 0:o.body),s=It(r);if(a){const i=tc(s);return e.concat(s,s.visualViewport||[],Ba(r)?r:[],i&&n?va(i):[])}else return e.concat(r,va(r,[],n))}function tc(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function $f(t){const e=Yt(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=In(t),a=r?t.offsetWidth:n,s=r?t.offsetHeight:o,i=Vs(n)!==a||Vs(o)!==s;return i&&(n=a,o=s),{width:n,height:o,$:i}}function cu(t){return Kt(t)?t:t.contextElement}function ar(t){const e=cu(t);if(!In(e))return nn(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:a}=$f(e);let s=(a?Vs(n.width):n.width)/o,i=(a?Vs(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!i||!Number.isFinite(i))&&(i=1),{x:s,y:i}}const H0=nn(0);function Tf(t){const e=It(t);return!lu()||!e.visualViewport?H0:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function V0(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==It(t)?!1:e}function $o(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),a=cu(t);let s=nn(1);e&&(o?Kt(o)&&(s=ar(o)):s=ar(t));const i=V0(a,n,o)?Tf(a):nn(0);let l=(r.left+i.x)/s.x,c=(r.top+i.y)/s.y,u=r.width/s.x,d=r.height/s.y;if(a){const p=It(a),h=o&&Kt(o)?It(o):o;let m=p,g=tc(m);for(;g&&o&&h!==m;){const v=ar(g),b=g.getBoundingClientRect(),w=Yt(g),E=b.left+(g.clientLeft+parseFloat(w.paddingLeft))*v.x,y=b.top+(g.clientTop+parseFloat(w.paddingTop))*v.y;l*=v.x,c*=v.y,u*=v.x,d*=v.y,l+=E,c+=y,m=It(g),g=tc(m)}}return Ws({width:u,height:d,x:l,y:c})}function Ri(t,e){const n=Oi(t).scrollLeft;return e?e.left+n:$o(pn(t)).left+n}function If(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-Ri(t,n),r=n.top+e.scrollTop;return{x:o,y:r}}function z0(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const a=r==="fixed",s=pn(o),i=e?xi(e.floating):!1;if(o===s||i&&a)return n;let l={scrollLeft:0,scrollTop:0},c=nn(1);const u=nn(0),d=In(o);if((d||!d&&!a)&&((Do(o)!=="body"||Ba(s))&&(l=Oi(o)),d)){const h=$o(o);c=ar(o),u.x=h.x+o.clientLeft,u.y=h.y+o.clientTop}const p=s&&!d&&!a?If(s,l):nn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}}function W0(t){return Array.from(t.getClientRects())}function K0(t){const e=pn(t),n=Oi(t),o=t.ownerDocument.body,r=$t(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),a=$t(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+Ri(t);const i=-n.scrollTop;return Yt(o).direction==="rtl"&&(s+=$t(e.clientWidth,o.clientWidth)-r),{width:r,height:a,x:s,y:i}}const Md=25;function Y0(t,e){const n=It(t),o=pn(t),r=n.visualViewport;let a=o.clientWidth,s=o.clientHeight,i=0,l=0;if(r){a=r.width,s=r.height;const u=lu();(!u||u&&e==="fixed")&&(i=r.offsetLeft,l=r.offsetTop)}const c=Ri(o);if(c<=0){const u=o.ownerDocument,d=u.body,p=getComputedStyle(d),h=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(o.clientWidth-d.clientWidth-h);m<=Md&&(a-=m)}else c<=Md&&(a+=c);return{width:a,height:s,x:i,y:l}}function J0(t,e){const n=$o(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,a=In(t)?ar(t):nn(1),s=t.clientWidth*a.x,i=t.clientHeight*a.y,l=r*a.x,c=o*a.y;return{width:s,height:i,x:l,y:c}}function $d(t,e,n){let o;if(e==="viewport")o=Y0(t,n);else if(e==="document")o=K0(pn(t));else if(Kt(e))o=J0(e,n);else{const r=Tf(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Ws(o)}function Af(t,e){const n=Xn(t);return n===e||!Kt(n)||pr(n)?!1:Yt(n).position==="fixed"||Af(n,e)}function X0(t,e){const n=e.get(t);if(n)return n;let o=va(t,[],!1).filter(i=>Kt(i)&&Do(i)!=="body"),r=null;const a=Yt(t).position==="fixed";let s=a?Xn(t):t;for(;Kt(s)&&!pr(s);){const i=Yt(s),l=iu(s);!l&&i.position==="fixed"&&(r=null),(a?!l&&!r:!l&&i.position==="static"&&r&&(r.position==="absolute"||r.position==="fixed")||Ba(s)&&!l&&Af(t,s))?o=o.filter(c=>c!==s):r=i,s=Xn(s)}return e.set(t,o),o}function Q0(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const a=[...n==="clippingAncestors"?xi(e)?[]:X0(e,this._c):[].concat(n),o],s=$d(e,a[0],r);let i=s.top,l=s.right,c=s.bottom,u=s.left;for(let d=1;d<a.length;d++){const p=$d(e,a[d],r);i=$t(p.top,i),l=Jn(p.right,l),c=Jn(p.bottom,c),u=$t(p.left,u)}return{width:l-u,height:c-i,x:u,y:i}}function Z0(t){const{width:e,height:n}=$f(t);return{width:e,height:n}}function eS(t,e,n){const o=In(e),r=pn(e),a=n==="fixed",s=$o(t,!0,a,e);let i={scrollLeft:0,scrollTop:0};const l=nn(0);function c(){l.x=Ri(r)}if(o||!o&&!a)if((Do(e)!=="body"||Ba(r))&&(i=Oi(e)),o){const h=$o(e,!0,a,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else r&&c();a&&!o&&r&&c();const u=r&&!o&&!a?If(r,i):nn(0),d=s.left+i.scrollLeft-l.x-u.x,p=s.top+i.scrollTop-l.y-u.y;return{x:d,y:p,width:s.width,height:s.height}}function ml(t){return Yt(t).position==="static"}function Td(t,e){if(!In(t)||Yt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return pn(t)===n&&(n=n.ownerDocument.body),n}function xf(t,e){const n=It(t);if(xi(t))return n;if(!In(t)){let r=Xn(t);for(;r&&!pr(r);){if(Kt(r)&&!ml(r))return r;r=Xn(r)}return n}let o=Td(t,e);for(;o&&F0(o)&&ml(o);)o=Td(o,e);return o&&pr(o)&&ml(o)&&!iu(o)?n:o||q0(t)||n}const tS=async function(t){const e=this.getOffsetParent||xf,n=this.getDimensions,o=await n(t.floating);return{reference:eS(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function nS(t){return Yt(t).direction==="rtl"}const oS={convertOffsetParentRelativeRectToViewportRelativeRect:z0,getDocumentElement:pn,getClippingRect:Q0,getOffsetParent:xf,getElementRects:tS,getClientRects:W0,getDimensions:Z0,getScale:ar,isElement:Kt,isRTL:nS};function Of(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function rS(t,e){let n=null,o;const r=pn(t);function a(){var i;clearTimeout(o),(i=n)==null||i.disconnect(),n=null}function s(i,l){i===void 0&&(i=!1),l===void 0&&(l=1),a();const c=t.getBoundingClientRect(),{left:u,top:d,width:p,height:h}=c;if(i||e(),!p||!h)return;const m=ms(d),g=ms(r.clientWidth-(u+p)),v=ms(r.clientHeight-(d+h)),b=ms(u),w={rootMargin:-m+"px "+-g+"px "+-v+"px "+-b+"px",threshold:$t(0,Jn(1,l))||1};let E=!0;function y(P){const C=P[0].intersectionRatio;if(C!==l){if(!E)return s();C?s(!1,C):o=setTimeout(()=>{s(!1,1e-7)},1e3)}C===1&&!Of(c,t.getBoundingClientRect())&&s(),E=!1}try{n=new IntersectionObserver(y,{...w,root:r.ownerDocument})}catch{n=new IntersectionObserver(y,w)}n.observe(t)}return s(!0),a}function aS(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,c=cu(t),u=r||a?[...c?va(c):[],...e?va(e):[]]:[];u.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),a&&b.addEventListener("resize",n)});const d=c&&i?rS(c,n):null;let p=-1,h=null;s&&(h=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var E;(E=h)==null||E.observe(e)})),n()}),c&&!l&&h.observe(c),e&&h.observe(e));let m,g=l?$o(t):null;l&&v();function v(){const b=$o(t);g&&!Of(g,b)&&n(),g=b,m=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(w=>{r&&w.removeEventListener("scroll",n),a&&w.removeEventListener("resize",n)}),d==null||d(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(m)}}const sS=N0,iS=L0,Id=R0,lS=B0,cS=P0,uS=O0,dS=U0,pS=(t,e,n)=>{const o=new Map,r={platform:oS,...n},a={...r.platform,_c:o};return x0(t,e,{...r,platform:a})};function hS(t){return t!=null&&typeof t=="object"&&"$el"in t}function nc(t){if(hS(t)){const e=t.$el;return su(e)&&Do(e)==="#comment"?null:e}return t}function Wo(t){return typeof t=="function"?t():f(t)}function fS(t){return{name:"arrow",options:t,fn(e){const n=nc(Wo(t.element));return n==null?{}:uS({element:n,padding:t.padding}).fn(e)}}}function Rf(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Ad(t,e){const n=Rf(t);return Math.round(e*n)/n}function mS(t,e,n){n===void 0&&(n={});const o=n.whileElementsMounted,r=B(()=>{var T;return(T=Wo(n.open))!=null?T:!0}),a=B(()=>Wo(n.middleware)),s=B(()=>{var T;return(T=Wo(n.placement))!=null?T:"bottom"}),i=B(()=>{var T;return(T=Wo(n.strategy))!=null?T:"absolute"}),l=B(()=>{var T;return(T=Wo(n.transform))!=null?T:!0}),c=B(()=>nc(t.value)),u=B(()=>nc(e.value)),d=A(0),p=A(0),h=A(i.value),m=A(s.value),g=Na({}),v=A(!1),b=B(()=>{const T={position:h.value,left:"0",top:"0"};if(!u.value)return T;const M=Ad(u.value,d.value),x=Ad(u.value,p.value);return l.value?{...T,transform:"translate("+M+"px, "+x+"px)",...Rf(u.value)>=1.5&&{willChange:"transform"}}:{position:h.value,left:M+"px",top:x+"px"}});let w;function E(){if(c.value==null||u.value==null)return;const T=r.value;pS(c.value,u.value,{middleware:a.value,placement:s.value,strategy:i.value}).then(M=>{d.value=M.x,p.value=M.y,h.value=M.strategy,m.value=M.placement,g.value=M.middlewareData,v.value=T!==!1})}function y(){typeof w=="function"&&(w(),w=void 0)}function P(){if(y(),o===void 0){E();return}if(c.value!=null&&u.value!=null){w=o(c.value,u.value,E);return}}function C(){r.value||(v.value=!1)}return ce([a,s,i,r],E,{flush:"sync"}),ce([c,u],P,{flush:"sync"}),ce(r,C,{flush:"sync"}),Yh()&&Jh(y),{x:Fo(d),y:Fo(p),strategy:Fo(h),placement:Fo(m),middlewareData:Fo(g),isPositioned:Fo(v),floatingStyles:b,update:E}}const Pf={side:"bottom",sideOffset:0,sideFlip:!0,align:"center",alignOffset:0,alignFlip:!0,arrowPadding:0,hideShiftedArrow:!0,avoidCollisions:!0,collisionBoundary:()=>[],collisionPadding:0,sticky:"partial",hideWhenDetached:!1,positionStrategy:"fixed",updatePositionStrategy:"optimized",prioritizePosition:!1},[KG,gS]=dn("PopperContent");var vS=z({inheritAttrs:!1,__name:"PopperContent",props:zh({side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},{...Pf}),emits:["placed"],setup(t,{emit:e}){const n=t,o=e,r=Sf(),{forwardRef:a,currentElement:s}=Ne(),i=A(),l=A(),{width:c,height:u}=f0(l),d=B(()=>n.side+(n.align!=="center"?`-${n.align}`:"")),p=B(()=>typeof n.collisionPadding=="number"?n.collisionPadding:{top:0,right:0,bottom:0,left:0,...n.collisionPadding}),h=B(()=>Array.isArray(n.collisionBoundary)?n.collisionBoundary:[n.collisionBoundary]),m=B(()=>({padding:p.value,boundary:h.value.filter(y0),altBoundary:h.value.length>0})),g=B(()=>({mainAxis:n.sideFlip,crossAxis:n.alignFlip})),v=$w(()=>[sS({mainAxis:n.sideOffset+u.value,alignmentAxis:n.alignOffset}),n.prioritizePosition&&n.avoidCollisions&&Id({...m.value,...g.value}),n.avoidCollisions&&iS({mainAxis:!0,crossAxis:!!n.prioritizePosition,limiter:n.sticky==="partial"?dS():void 0,...m.value}),!n.prioritizePosition&&n.avoidCollisions&&Id({...m.value,...g.value}),lS({...m.value,apply:({elements:$,rects:D,availableWidth:G,availableHeight:k})=>{const{width:N,height:F}=D.reference,K=$.floating.style;K.setProperty("--reka-popper-available-width",`${G}px`),K.setProperty("--reka-popper-available-height",`${k}px`),K.setProperty("--reka-popper-anchor-width",`${N}px`),K.setProperty("--reka-popper-anchor-height",`${F}px`)}}),l.value&&fS({element:l.value,padding:n.arrowPadding}),_0({arrowWidth:c.value,arrowHeight:u.value}),n.hideWhenDetached&&cS({strategy:"referenceHidden",...m.value})]),b=B(()=>n.reference??r.anchor.value),{floatingStyles:w,placement:E,isPositioned:y,middlewareData:P}=mS(b,i,{strategy:n.positionStrategy,placement:d,whileElementsMounted:(...$)=>aS(...$,{layoutShift:!n.disableUpdateOnLayoutShift,animationFrame:n.updatePositionStrategy==="always"}),middleware:v}),C=B(()=>Ql(E.value)[0]),T=B(()=>Ql(E.value)[1]);Vh(()=>{y.value&&o("placed")});const M=B(()=>{var $;const D=(($=P.value.arrow)==null?void 0:$.centerOffset)!==0;return n.hideShiftedArrow&&D}),x=A("");Wt(()=>{s.value&&(x.value=window.getComputedStyle(s.value).zIndex)});const L=B(()=>{var $;return(($=P.value.arrow)==null?void 0:$.x)??0}),q=B(()=>{var $;return(($=P.value.arrow)==null?void 0:$.y)??0});return gS({placedSide:C,onArrowChange:$=>l.value=$,arrowX:L,arrowY:q,shouldHideArrow:M}),($,D)=>{var G,k,N;return _(),O("div",{ref_key:"floatingRef",ref:i,"data-reka-popper-content-wrapper":"",style:De({...f(w),transform:f(y)?f(w).transform:"translate(0, -200%)",minWidth:"max-content",zIndex:x.value,"--reka-popper-transform-origin":[(G=f(P).transformOrigin)==null?void 0:G.x,(k=f(P).transformOrigin)==null?void 0:k.y].join(" "),...((N=f(P).hide)==null?void 0:N.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}})},[V(f(an),Me({ref:f(a)},$.$attrs,{"as-child":n.asChild,as:$.as,"data-side":C.value,"data-align":T.value,style:{animation:f(y)?void 0:"none"}}),{default:j(()=>[ee($.$slots,"default")]),_:3},16,["as-child","as","data-side","data-align","style"])],4)}}}),Df=vS;function Ks(t,e="reka"){var n;let o;return o=(n=Xy)==null?void 0:n.call(o_),e?`${e}-${o}`:o}const[Tr,yS]=dn("PopoverRoot");var _S=z({__name:"PopoverRoot",props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},modal:{type:Boolean,required:!1,default:!1}},emits:["update:open"],setup(t,{emit:e}){const n=t,o=e,{modal:r}=rn(n),a=Ti(n,"open",o,{defaultValue:n.defaultOpen,passive:n.open===void 0}),s=A(),i=A(!1);return yS({contentId:"",triggerId:"",modal:r,open:a,onOpenChange:l=>{a.value=l},onOpenToggle:()=>{a.value=!a.value},triggerElement:s,hasCustomAnchor:i}),(l,c)=>(_(),U(f(kf),null,{default:j(()=>[ee(l.$slots,"default",{open:f(a),close:()=>a.value=!1})]),_:3}))}}),uu=_S,bS=z({__name:"PopoverContentImpl",props:{trapFocus:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=wf(Nw(n,"trapFocus","disableOutsidePointerEvents")),{forwardRef:a}=Ne(),s=Tr();return bf(),(i,l)=>(_(),U(f(eu),{"as-child":"",loop:"",trapped:i.trapFocus,onMountAutoFocus:l[5]||(l[5]=c=>o("openAutoFocus",c)),onUnmountAutoFocus:l[6]||(l[6]=c=>o("closeAutoFocus",c))},{default:j(()=>[V(f(Zc),{"as-child":"","disable-outside-pointer-events":i.disableOutsidePointerEvents,onPointerDownOutside:l[0]||(l[0]=c=>o("pointerDownOutside",c)),onInteractOutside:l[1]||(l[1]=c=>o("interactOutside",c)),onEscapeKeyDown:l[2]||(l[2]=c=>o("escapeKeyDown",c)),onFocusOutside:l[3]||(l[3]=c=>o("focusOutside",c)),onDismiss:l[4]||(l[4]=c=>f(s).onOpenChange(!1))},{default:j(()=>[V(f(Df),Me(f(r),{id:f(s).contentId,ref:f(a),"data-state":f(s).open.value?"open":"closed","aria-labelledby":f(s).triggerId,style:{"--reka-popover-content-transform-origin":"var(--reka-popper-transform-origin)","--reka-popover-content-available-width":"var(--reka-popper-available-width)","--reka-popover-content-available-height":"var(--reka-popper-available-height)","--reka-popover-trigger-width":"var(--reka-popper-anchor-width)","--reka-popover-trigger-height":"var(--reka-popper-anchor-height)"},role:"dialog"}),{default:j(()=>[ee(i.$slots,"default")]),_:3},16,["id","data-state","aria-labelledby"])]),_:3},8,["disable-outside-pointer-events"])]),_:3},8,["trapped"]))}}),Nf=bS,wS=z({__name:"PopoverContentModal",props:{side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=Tr(),a=A(!1);Xc(!0);const s=Po(n,o),{forwardRef:i,currentElement:l}=Ne();return Qc(l),(c,u)=>(_(),U(Nf,Me(f(s),{ref:f(i),"trap-focus":f(r).open.value,"disable-outside-pointer-events":"",onCloseAutoFocus:u[0]||(u[0]=yn(d=>{var p;o("closeAutoFocus",d),a.value||(p=f(r).triggerElement.value)==null||p.focus()},["prevent"])),onPointerDownOutside:u[1]||(u[1]=d=>{o("pointerDownOutside",d);const p=d.detail.originalEvent,h=p.button===0&&p.ctrlKey===!0,m=p.button===2||h;a.value=m}),onFocusOutside:u[2]||(u[2]=yn(()=>{},["prevent"]))}),{default:j(()=>[ee(c.$slots,"default")]),_:3},16,["trap-focus"]))}}),SS=wS,kS=z({__name:"PopoverContentNonModal",props:{side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=Tr(),a=A(!1),s=A(!1),i=Po(n,o);return(l,c)=>(_(),U(Nf,Me(f(i),{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:c[0]||(c[0]=u=>{var d;o("closeAutoFocus",u),u.defaultPrevented||(a.value||(d=f(r).triggerElement.value)==null||d.focus(),u.preventDefault()),a.value=!1,s.value=!1}),onInteractOutside:c[1]||(c[1]=async u=>{var d;o("interactOutside",u),u.defaultPrevented||(a.value=!0,u.detail.originalEvent.type==="pointerdown"&&(s.value=!0));const p=u.target;(d=f(r).triggerElement.value)!=null&&d.contains(p)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&s.value&&u.preventDefault()})}),{default:j(()=>[ee(l.$slots,"default")]),_:3},16))}}),ES=kS,CS=z({__name:"PopoverContent",props:{forceMount:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=Tr(),a=Po(n,o),{forwardRef:s}=Ne();return r.contentId||(r.contentId=Ks(void 0,"reka-popover-content")),(i,l)=>(_(),U(f(Ii),{present:i.forceMount||f(r).open.value},{default:j(()=>[f(r).modal.value?(_(),U(SS,Me({key:0},f(a),{ref:f(s)}),{default:j(()=>[ee(i.$slots,"default")]),_:3},16)):(_(),U(ES,Me({key:1},f(a),{ref:f(s)}),{default:j(()=>[ee(i.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),du=CS,MS=z({__name:"PopoverPortal",props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(t){const e=t;return(n,o)=>(_(),U(f(tu),kn(Ro(e)),{default:j(()=>[ee(n.$slots,"default")]),_:3},16))}}),pu=MS,$S=z({__name:"PopoverTrigger",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(t){const e=t,n=Tr(),{forwardRef:o,currentElement:r}=Ne();return n.triggerId||(n.triggerId=Ks(void 0,"reka-popover-trigger")),qe(()=>{n.triggerElement.value=r.value}),(a,s)=>(_(),U(se(f(n).hasCustomAnchor.value?f(an):f(nu)),{"as-child":""},{default:j(()=>[V(f(an),{id:f(n).triggerId,ref:f(o),type:a.as==="button"?"button":void 0,"aria-haspopup":"dialog","aria-expanded":f(n).open.value,"aria-controls":f(n).contentId,"data-state":f(n).open.value?"open":"closed",as:a.as,"as-child":e.asChild,onClick:f(n).onOpenToggle},{default:j(()=>[ee(a.$slots,"default")]),_:3},8,["id","type","aria-expanded","aria-controls","data-state","as","as-child","onClick"])]),_:3}))}}),Lf=$S,xe=(t=>(t.TEXT="text",t.IMAGE="image",t.VIDEO="video",t.FILE="file",t.MENTION="mention",t.EMOJI="emoji",t))(xe||{});function Uf(t){switch(t.type){case xe.TEXT:return{type:"text",text:t.content};case xe.IMAGE:{const e=t.content,n=URL.createObjectURL(e);return{type:xe.IMAGE,attrs:{src:n,alt:e==null?void 0:e.name,fileData:e,title:e==null?void 0:e.name}}}case xe.EMOJI:{const e=t.content;return{type:xe.EMOJI,attrs:{src:e.url,alt:e.key,title:e.text}}}default:return{type:"text",text:String(t.content)}}}function TS(t){if(t.length===0)return[];let e=-1,n=-1;for(let o=0;o<t.length;o++){const r=t[o];(r.type!==xe.TEXT||r.content.trim().length>0)&&(e===-1&&(e=o),n=o)}return e===-1?[]:t.slice(e,n+1).map((o,r,a)=>{if(o.type===xe.TEXT){let s=o.content;return r===0&&(s=s.trimStart()),r===a.length-1&&(s=s.trimEnd()),{...o,content:s}}return o}).filter(o=>o.type===xe.TEXT?o.content.length>0:!0)}function Bf(t){return t!=null&&t.content?t.content.flatMap((e,n)=>{var o,r,a,s,i,l,c;switch(e.type){case"text":return e.text?[{type:xe.TEXT,content:e.text}]:[];case"image":return[{type:xe.IMAGE,content:(o=e.attrs)==null?void 0:o.fileData}];case"emoji":return[{type:xe.EMOJI,content:{url:(r=e.attrs)==null?void 0:r.src,key:(a=e.attrs)==null?void 0:a.alt,text:(s=e.attrs)==null?void 0:s.title}}];case"hardBreak":return[{type:xe.TEXT,content:`
|
||
`}];case"mention":return[{type:xe.MENTION,content:{id:(i=e.attrs)==null?void 0:i.id,label:(l=e.attrs)==null?void 0:l.label,mentionSuggestionChar:(c=e.attrs)==null?void 0:c.mentionSuggestionChar}}];default:{const u=Bf(e);return e.type==="paragraph"&&n>0?[{type:xe.TEXT,content:`
|
||
`},...u]:u}}}):[]}const gl="https://web.sdk.qcloud.com/im/assets/emoji-plugin/",qr={"[TUIEmoji_Expect]":"emoji_0@2x.png","[TUIEmoji_Blink]":"emoji_1@2x.png","[TUIEmoji_Guffaw]":"emoji_2@2x.png","[TUIEmoji_KindSmile]":"emoji_3@2x.png","[TUIEmoji_Haha]":"emoji_4@2x.png","[TUIEmoji_Cheerful]":"emoji_5@2x.png","[TUIEmoji_Smile]":"emoji_6@2x.png","[TUIEmoji_Sorrow]":"emoji_7@2x.png","[TUIEmoji_Speechless]":"emoji_8@2x.png","[TUIEmoji_Amazed]":"emoji_9@2x.png","[TUIEmoji_Complacent]":"emoji_10@2x.png","[TUIEmoji_Lustful]":"emoji_11@2x.png","[TUIEmoji_Stareyes]":"emoji_12@2x.png","[TUIEmoji_Giggle]":"emoji_13@2x.png","[TUIEmoji_Daemon]":"emoji_14@2x.png","[TUIEmoji_Rage]":"emoji_15@2x.png","[TUIEmoji_Yawn]":"emoji_16@2x.png","[TUIEmoji_TearsLaugh]":"emoji_17@2x.png","[TUIEmoji_Silly]":"emoji_18@2x.png","[TUIEmoji_Wail]":"emoji_19@2x.png","[TUIEmoji_Kiss]":"emoji_20@2x.png","[TUIEmoji_Trapped]":"emoji_21@2x.png","[TUIEmoji_Fear]":"emoji_22@2x.png","[TUIEmoji_BareTeeth]":"emoji_23@2x.png","[TUIEmoji_FlareUp]":"emoji_24@2x.png","[TUIEmoji_Tact]":"emoji_25@2x.png","[TUIEmoji_Shit]":"emoji_26@2x.png","[TUIEmoji_ShutUp]":"emoji_27@2x.png","[TUIEmoji_Sigh]":"emoji_28@2x.png","[TUIEmoji_Hehe]":"emoji_29@2x.png","[TUIEmoji_Silent]":"emoji_30@2x.png","[TUIEmoji_Skull]":"emoji_31@2x.png","[TUIEmoji_Mask]":"emoji_32@2x.png","[TUIEmoji_Beer]":"emoji_33@2x.png","[TUIEmoji_Cake]":"emoji_34@2x.png","[TUIEmoji_RedPacket]":"emoji_35@2x.png","[TUIEmoji_Bombs]":"emoji_36@2x.png","[TUIEmoji_Ai]":"emoji_37@2x.png","[TUIEmoji_Celebrate]":"emoji_38@2x.png","[TUIEmoji_Bless]":"emoji_39@2x.png","[TUIEmoji_Flower]":"emoji_40@2x.png","[TUIEmoji_Watermelon]":"emoji_41@2x.png","[TUIEmoji_Cow]":"emoji_42@2x.png","[TUIEmoji_Fool]":"emoji_43@2x.png","[TUIEmoji_Surprised]":"emoji_44@2x.png","[TUIEmoji_Askance]":"emoji_45@2x.png","[TUIEmoji_Monster]":"emoji_46@2x.png","[TUIEmoji_Pig]":"emoji_47@2x.png","[TUIEmoji_Coffee]":"emoji_48@2x.png","[TUIEmoji_Ok]":"emoji_49@2x.png","[TUIEmoji_Heart]":"emoji_50@2x.png","[TUIEmoji_Sun]":"emoji_51@2x.png","[TUIEmoji_Moon]":"emoji_52@2x.png","[TUIEmoji_Star]":"emoji_53@2x.png","[TUIEmoji_Rich]":"emoji_54@2x.png","[TUIEmoji_Fortune]":"emoji_55@2x.png","[TUIEmoji_857]":"emoji_56@2x.png","[TUIEmoji_666]":"emoji_57@2x.png","[TUIEmoji_Prohibit]":"emoji_58@2x.png","[TUIEmoji_Convinced]":"emoji_59@2x.png","[TUIEmoji_Knife]":"emoji_60@2x.png","[TUIEmoji_Like]":"emoji_61@2x.png"};function Ir(t){if(!t)return"";const e=/(\[.+?\])/g;let n=t;return e.test(t)&&(n=t.replace(e,o=>qr[o]?nt.t(`Emoji.${o}`):o)),n}const vl={};function oc(t){var e;if(!t)return"";const n=/(\[.+?\])/g;let o=t;if(n.test(t)){const r=nt.language;if(!vl[r]){const a=nt.getDataByLanguage(r);(e=a==null?void 0:a.translation)!=null&&e.Emoji&&(vl[r]=Object.fromEntries(Object.entries(a.translation.Emoji).map(([s,i])=>[i,s])))}o=t.replace(n,a=>{var s;return((s=vl[r])==null?void 0:s[a])??a})}return o}function IS(t){var e;const n=Re.getData(He.USER,"userProfile");return t.type===Ge.C2C?(n==null?void 0:n.nick)||(n==null?void 0:n.userID)||"":((e=t.getShowName)==null?void 0:e.call(t))||""}function AS(t,e,n){if(t===ue.TEXT)return Ir((e==null?void 0:e.text)||"");if(t===ue.CUSTOM&&e.description)return e.description;const o={[ue.TEXT]:"OfflinePush.text",[ue.IMAGE]:"OfflinePush.image",[ue.VIDEO]:"OfflinePush.video",[ue.FILE]:"OfflinePush.file",[ue.AUDIO]:"OfflinePush.audio",[ue.FACE]:"OfflinePush.face",[ue.LOCATION]:"OfflinePush.location",[ue.MERGER]:"OfflinePush.merger",[ue.CUSTOM]:"OfflinePush.custom"}[t]||"OfflinePush.custom";return n(o)}function xS(t){var e;const n=Re.getData(He.USER,"userProfile"),o={sender:t.type===Ge.GROUP?(e=t.groupProfile)==null?void 0:e.groupID:n==null?void 0:n.userID,nickName:(n==null?void 0:n.nick)||"",chatType:t.type===Ge.GROUP?2:1,version:1,action:1};return JSON.stringify({entity:o})}function OS(t,e,n,o,r,a){return{title:IS(t),description:AS(e,n,o),extension:xS(t),androidInfo:r,apnsInfo:a}}const gs=A(null);function hu(){function t(r){gs.value=r}function e(r){const a=gs.value;if(!(a!=null&&a.chatOfflinePushInfo))return;const s=a.chatOfflinePushInfo,i=l=>nt.t(l);return OS(r.conversation,r.messageType,r.payload||{},i,s.androidInfo,s.apnsInfo)}function n(){const r=gs.value;return r==null?void 0:r.callOfflinePushInfo}function o(){return gs.value!==null}return{setOfflinePushInfo:t,createChatOfflinePushInfo:e,createCallOfflinePushInfo:n,isEnabled:o}}let xd;const Ys=A(void 0),Js=A(void 0),fu=A(void 0),Ff=A(void 0),jf=A(void 0),mu=A(void 0),Gf=A(new Set),Xs=A(new Set);function RS(){Ys.value=void 0,Js.value=void 0,fu.value=void 0,Ff.value=void 0,mu.value=void 0,Xs.value=new Set}function PS(t){jf.value=t}function DS(t){mu.value=t}function NS({messageID:t,duration:e}){Xs.value.add(t),setTimeout(()=>{Xs.value.delete(t)},e)}async function LS(){return yt.getMessageList()}function Fa(){return{activeConversationID:Ys,messageList:Js,hasMoreOlderMessage:fu,hasMoreNewerMessage:Ff,enableReadReceipt:jf,isDisableScroll:mu,recalledMessageIDSet:Gf,highlightMessageIDSet:Xs,loadMoreOlderMessage:LS,setEnableReadReceipt:PS,setIsDisableScroll:DS,highlightMessage:NS}}const US=()=>{function t(o){if(!Ys.value)return;function r(s){return{...s,status:s.status,progress:s.progress,isRevoked:s.isRevoked,isDeleted:s.isDeleted,isPeerRead:s.isPeerRead,readReceiptInfo:s.readReceiptInfo?{...s.readReceiptInfo,readCount:s.readReceiptInfo.readCount,unreadCount:s.readReceiptInfo.unreadCount,isPeerRead:s.readReceiptInfo.isPeerRead}:s.readReceiptInfo,getMessageContent:()=>s.getMessageContent(),deleteMessage:()=>s.deleteMessage(),revokeMessage:()=>s.revokeMessage(),resendMessage:()=>s.resendMessage(),getSignalingInfo:()=>s.getSignalingInfo(),modifyMessage:i=>s.modifyMessage(i),quoteMessage:()=>s.quoteMessage(),replyMessage:()=>s.replyMessage()}}const a=o.map(r);Js.value=a,Js.value.forEach(s=>{s.isRevoked&&Gf.value.add(s.ID)})}function e(o){fu.value=!o}function n(o){(!o||o!==xd)&&(RS(),Ys.value=o),xd=o||void 0}Re.watch(He.CONV,{currentConversationID:n}),Re.watch(He.CHAT,{messageList:t,isCompleted:e})};US();const gu=A(void 0),vu=A(void 0),qf=A(0),BS=A(oe.TYPES.NET_STATE_CONNECTED),FS=t=>{gu.value=t},jS=t=>{qf.value=t},GS=t=>{vu.value=t},Pi=t=>{var e;return(e=gu.value)==null?void 0:e.find(n=>n.conversationID===t)},Hf=(t,e)=>{const n=Pi(t),{markList:o=[],unreadCount:r=0}=n||{},a=o.includes(oe.TYPES.CONV_MARK_TYPE_UNREAD),s=r>0;return!n||e&&(s||a)||!e&&!s&&!a?Promise.resolve():s&&!e?n==null?void 0:n.setMessageRead():Cr.markConversation({conversationIDList:[t],markType:oe.TYPES.CONV_MARK_TYPE_UNREAD,enableMark:e})},qS=async t=>{const e=vu.value;t!==(e==null?void 0:e.conversationID)&&(t&&Hf(t,!1),await Cr.switchConversation(t))},HS=(t,e)=>{const n=Pi(t);return!n||(n==null?void 0:n.isPinned)===e?Promise.resolve():n==null?void 0:n.pinConversation()},VS=t=>{const e=Pi(t);return e?e==null?void 0:e.deleteConversation():Promise.resolve()},zS=(t,e)=>{const n=Pi(t);return!n||(n==null?void 0:n.isMuted)===e?Promise.resolve():n==null?void 0:n.muteConversation()},WS=t=>Cr.setConversationDraft(t),KS=async t=>(await Cr.getConversationProfile(`C2C${t}`)).data.conversation,YS=async t=>{const{groupID:e,...n}=t,o=n;t.type!==oe.TYPES.GRP_COMMUNITY&&(o.groupID=e||"");const r=await ze.createGroup(o),{type:a}=r.data.group;return a===oe.TYPES.GRP_AVCHATROOM&&await ze.joinGroup({groupID:r.data.group.groupID,applyMessage:""}),(await Cr.getConversationProfile(`GROUP${r.data.group.groupID}`)).data.conversation};function JS(){Re.watch(He.CONV,{conversationList:t=>{FS(t)},currentConversation:t=>{GS(t??void 0)},totalUnreadCount:t=>{jS(t)}})}JS();function Rt(){return{conversationList:gu,activeConversation:vu,totalUnRead:qf,netStatus:BS,setActiveConversation:qS,markConversationUnread:Hf,pinConversation:HS,deleteConversation:VS,muteConversation:zS,setConversationDraft:WS,createC2CConversation:KS,createGroupConversation:YS}}const pt=A(null),Qs=A(""),Vf=A(!1),{setOfflinePushInfo:XS,createChatOfflinePushInfo:QS,isEnabled:ZS}=hu();function mo(t){const{messageType:e,payload:n,options:o}=t;if(o!=null&&o.offlinePushInfo||!ZS())return o;const{activeConversation:r}=Rt();if(!r.value)return o;const a=QS({conversation:r.value,messageType:e,payload:n||{}});return a?{...o,offlinePushInfo:a}:o}const ek=t=>{if(typeof t!="string"&&!Array.isArray(t)){console.warn("Invalid input type for updateRawValue");return}typeof t=="string"?Qs.value=t.trim():Qs.value=(t==null?void 0:t.length)>0?t:""},tk=t=>{pt.value&&pt.value.destroy(),pt.value=t},nk=t=>{if(pt.value){if(typeof t=="string")pt.value.commands.setContent(t,!0);else{const e=t.map(Uf);pt.value.commands.setContent(e,!0)}pt.value.commands.focus()}},ok=(t,e=!0)=>{if(pt.value){if(typeof t=="string")pt.value.commands.insertContent(t);else{const n=t.map(Uf);pt.value.commands.insertContent(n)}e&&pt.value.commands.focus()}},rk=()=>{var t;(t=pt.value)==null||t.commands.focus()},ak=()=>{var t;(t=pt.value)==null||t.commands.blur()},sk=async t=>{const{enableReadReceipt:e}=Fa(),n={needReadReceipt:e.value||!1};let o=t;o===void 0&&pt.value&&(o=Bf(pt.value.getJSON()));const r=ik(o??Qs.value);if(r)try{typeof r=="string"?await yt.sendTextMessage({payload:{text:oc(r)},...n},mo({messageType:ue.TEXT,payload:{text:oc(r)}})):await lk(r,n)}catch(a){throw Mi(a),a}};function ik(t){if(typeof t=="string")return t.trim()||null;const e=TS(t);return e.length>0?e:null}async function lk(t,e){const n=[],o=[],r=async()=>{if(n.length===0)return;const l=Ir(n.join("")),c=oc(l);n.length=0,o.length>0?(await yt.sendTextAtMessage({payload:{text:c,atUserList:o},...e},mo({messageType:ue.TEXT,payload:{text:l}})),o.length=0):await yt.sendTextMessage({payload:{text:c},...e},mo({messageType:ue.TEXT,payload:{text:l}}))},a=async l=>{switch(l.type){case xe.TEXT:n.push(l.content);break;case xe.EMOJI:n.push(l.content.key);break;case xe.MENTION:o.push(l.content.id),n.push(l.content.mentionSuggestionChar+l.content.label);break;case xe.IMAGE:await r(),await yt.sendImageMessage({payload:{file:l.content},...e},mo({messageType:ue.IMAGE,payload:{file:l.content.name}}));break;case xe.VIDEO:await r(),await yt.sendVideoMessage({payload:{file:l.content},...e},mo({messageType:ue.VIDEO,payload:{file:l.content.name}}));break;case xe.FILE:await r(),await yt.sendFileMessage({payload:{file:l.content},...e},mo({messageType:ue.FILE,payload:{file:l.content.name}}));break;default:console.warn(`[MessageInput] Unknown message type: ${l==null?void 0:l.type}, skipping`);break}};let s=0;const i=t.length;for(;s<i;)await a(t[s]),s+=1;await r()}const ck=(t,e)=>yt.sendCustomMessage(t,mo({messageType:ue.CUSTOM,payload:t.payload,options:e}));function eo(){return{inputRawValue:Qs,isPeerTyping:Vf,updateRawValue:ek,setEditorInstance:tk,setContent:nk,insertContent:ok,focusEditor:rk,blurEditor:ak,sendMessage:sk,sendCustomMessage:ck,setOfflinePushInfo:XS}}function uk(){Re.watch(He.CHAT,{typingStatus:t=>{Vf.value=t}})}uk();const dk=["accept"],pk=z({__name:"FilePicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const e={ACCEPT_TYPE:"*/*"},n=t,o=qt(),{sendMessage:r}=eo(),a=A(null);function s(){var l;n.disabled||(l=a.value)==null||l.click()}function i(l){var c;const u=l.target,d=(c=u.files)==null?void 0:c[0];d&&(r([{type:xe.FILE,content:d}]),u.value="")}return(l,c)=>(_(),U(f(ae),null,{default:j(()=>[I("div",{onClick:s},[ee(l.$slots,"default",{},()=>[I("div",{class:S(f(ke)(f(o)["file-picker__button"],{[f(o).disabled]:n.disabled}))},[V(f(Gh),{size:n.iconSize,class:S(f(ke)(f(o)["file-picker__icon"]))},null,8,["size","class"])],2)])]),I("input",{ref_key:"fileInputRef",ref:a,type:"file",accept:e.ACCEPT_TYPE,hidden:"",onChange:i},null,40,dk)]),_:3}))}}),hk="_disabled_o5cim_16",fk={"file-picker__button":"_file-picker__button_o5cim_1",disabled:hk,"file-picker__icon":"_file-picker__icon_o5cim_22"},mk={$style:fk},yu=Z(pk,[["__cssModules",mk]]),gk=["accept"],vk=z({__name:"ImagePicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const{t:e}=ve(),n=["image/jpg","image/jpeg","image/gif","image/bmp","image/png","image/webp"];function o(u){return n.includes(u.type)}const r=t,a=qt(),{sendMessage:s}=eo(),i=A(null);function l(){var u;r.disabled||(u=i.value)==null||u.click()}function c(u){var d;const p=u.target,h=(d=p.files)==null?void 0:d[0];if(h){if(!o(h)){ut.error({message:e("MessageInput.invalid_image_type")});return}s([{type:xe.IMAGE,content:h}]),p.value=""}}return(u,d)=>(_(),U(f(ae),null,{default:j(()=>[I("div",{onClick:l},[ee(u.$slots,"default",{},()=>[I("div",{class:S(f(ke)(f(a)["image-picker__button"],{[f(a).disabled]:r.disabled}))},[V(f(wy),{size:r.iconSize,class:S(f(ke)(f(a)["image-picker__icon"]))},null,8,["size","class"])],2)])]),I("input",{ref_key:"fileInputRef",ref:i,type:"file",accept:n.join(","),hidden:"",onChange:c},null,40,gk)]),_:3}))}}),yk="_disabled_xwls5_16",_k={"image-picker__button":"_image-picker__button_xwls5_1",disabled:yk,"image-picker__icon":"_image-picker__icon_xwls5_22"},bk={$style:_k},_u=Z(vk,[["__cssModules",bk]]),wk=["accept"],Sk=z({__name:"VideoPicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const e={ACCEPT_TYPE:".mp4,.mov,.qt"},n=t,o=qt(),{sendMessage:r}=eo(),a=A(null);function s(){var l;n.disabled||(l=a.value)==null||l.click()}function i(l){var c;const u=l.target,d=(c=u.files)==null?void 0:c[0];d&&(r([{type:xe.VIDEO,content:d}]),u.value="")}return(l,c)=>(_(),U(f(ae),null,{default:j(()=>[I("div",{onClick:s},[ee(l.$slots,"default",{},()=>[I("div",{class:S(f(ke)(f(o)["video-picker__button"],{[f(o).disabled]:n.disabled}))},[V(f(Sy),{size:n.iconSize,class:S(f(ke)(f(o)["video-picker__icon"]))},null,8,["size","class"])],2)])]),I("input",{ref_key:"fileInputRef",ref:a,type:"file",accept:e.ACCEPT_TYPE,hidden:"",onChange:i},null,40,wk)]),_:3}))}}),kk="_disabled_1skpb_16",Ek={"video-picker__button":"_video-picker__button_1skpb_1",disabled:kk,"video-picker__icon":"_video-picker__icon_1skpb_22"},Ck={$style:Ek},zf=Z(Sk,[["__cssModules",Ck]]),vs={"attachment-picker":"_attachment-picker_1bduq_1","attachment-picker__icon":"_attachment-picker__icon_1bduq_5","attachment-picker__popup":"_attachment-picker__popup_1bduq_9","attachment-picker--expanded":"_attachment-picker--expanded_1bduq_19","attachment-picker__item":"_attachment-picker__item_1bduq_24","attachment-picker__item-icon":"_attachment-picker__item-icon_1bduq_48"},Od=z({__name:"AttachmentPicker",props:{attachmentPickerMode:{default:"collapsed"}},setup(t){const e={COLLAPSED:18,EXPANDED:24},n=t,{t:o}=ve(),r=B(()=>n.attachmentPickerMode==="collapsed"),a=B(()=>[{type:"file",Component:yu},{type:"image",Component:_u},{type:"video",Component:zf}].map(({type:s,Component:i})=>({Component:i,props:{label:r.value?o(`MessageInput.${s}`):"",iconSize:r.value?e.COLLAPSED:e.EXPANDED}})));return(s,i)=>(_(),O("div",{class:S([f(vs)["attachment-picker"]])},[r.value?(_(),U(f(uu),{key:0},{default:j(()=>[V(f(Lf),{as:"div"},{default:j(()=>[ee(s.$slots,"default",{},()=>[V(f(ky),{class:S(f(vs)["attachment-picker__icon"]),size:"20"},null,8,["class"])])]),_:3}),V(f(pu),null,{default:j(()=>[V(f(du),{side:"top",align:"start","side-offset":5},{default:j(()=>[I("div",{class:S(f(vs)["attachment-picker__popup"])},[(_(!0),O(ie,null,we(a.value,(l,c)=>(_(),U(se(l.Component),Me({key:c},{ref_for:!0},l.props),null,16))),128))],2)]),_:1})]),_:1})]),_:3})):(_(),O("div",{key:1,class:S(f(vs)["attachment-picker--expanded"])},[(_(!0),O(ie,null,we(a.value,(l,c)=>(_(),U(se(l.Component),Me({key:c},{ref_for:!0},l.props),null,16))),128))],2))],2))}}),Mk=["onClick"],$k=["src","alt"],Tk=z({name:"EmojiPicker",inheritAttrs:!1,__name:"EmojiPicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=A(!1),o=qt(),{t:r}=ve(),{insertContent:a}=eo();qe(()=>{Object.values(qr).forEach(l=>{const c=new Image;c.src=gl+l})});const s=l=>{e.disabled||(n.value=l)};function i(l){l&&a([{type:xe.EMOJI,content:{url:gl+qr[l],key:l,text:Ir(l)}}])}return(l,c)=>(_(),U(f(ae),null,{default:j(()=>[V(f(uu),{open:n.value,"onUpdate:open":s},{default:j(()=>[V(f(Lf),{as:"div",disabled:e.disabled},{default:j(()=>[I("div",Me({"data-test":"test",class:f(ke)(f(o)["emoji-picker__button"],{[f(o).disabled]:e.disabled})},l.$attrs),[ee(l.$slots,"default",{},()=>[V(f(Ey),{class:S(f(o)["emoji-picker__icon"]),size:e.iconSize},null,8,["class","size"])])],16)]),_:3},8,["disabled"]),V(f(pu),null,{default:j(()=>[V(f(du),{side:"top",align:"start","side-offset":5},{default:j(()=>[I("div",null,[I("div",{class:S(f(o)["emoji-picker__list"])},[(_(!0),O(ie,null,we(Object.keys(f(qr)),u=>(_(),O("div",{key:u,class:S(f(o)["emoji-picker__list-item"]),onClick:d=>i(u)},[I("img",{class:S(f(o)["emoji-picker__list-item"]),src:f(gl)+f(qr)[u],alt:f(r)(`Emoji.${u}`)},null,10,$k)],10,Mk))),128))],2)])]),_:1})]),_:1})]),_:3},8,["open"])]),_:3}))}}),Ik="_disabled_kxj4t_16",Ak={"emoji-picker__button":"_emoji-picker__button_kxj4t_1",disabled:Ik,"emoji-picker__icon":"_emoji-picker__icon_kxj4t_22","emoji-picker__list":"_emoji-picker__list_kxj4t_25","emoji-picker__list-item":"_emoji-picker__list-item_kxj4t_36"},xk={$style:Ak},Wf=Z(Tk,[["__cssModules",xk]]);function Ke(t){this.content=t}Ke.prototype={constructor:Ke,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,r=o.find(t),a=o.content.slice();return r==-1?a.push(n||t,e):(a[r+1]=e,n&&(a[r]=n)),new Ke(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ke(n)},addToStart:function(t,e){return new Ke([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ke(n)},addBefore:function(t,e,n){var o=this.remove(e),r=o.content.slice(),a=o.find(t);return r.splice(a==-1?r.length:a,0,e,n),new Ke(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ke.from(t),t.size?new Ke(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ke.from(t),t.size?new Ke(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ke.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ke.from=function(t){if(t instanceof Ke)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ke(e)};function Kf(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(o),a=e.child(o);if(r==a){n+=r.nodeSize;continue}if(!r.sameMarkup(a))return n;if(r.isText&&r.text!=a.text){for(let s=0;r.text[s]==a.text[s];s++)n++;return n}if(r.content.size||a.content.size){let s=Kf(r.content,a.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function Yf(t,e,n,o){for(let r=t.childCount,a=e.childCount;;){if(r==0||a==0)return r==a?null:{a:n,b:o};let s=t.child(--r),i=e.child(--a),l=s.nodeSize;if(s==i){n-=l,o-=l;continue}if(!s.sameMarkup(i))return{a:n,b:o};if(s.isText&&s.text!=i.text){let c=0,u=Math.min(s.text.length,i.text.length);for(;c<u&&s.text[s.text.length-c-1]==i.text[i.text.length-c-1];)c++,n--,o--;return{a:n,b:o}}if(s.content.size||i.content.size){let c=Yf(s.content,i.content,n-1,o-1);if(c)return c}n-=l,o-=l}}let X=class ct{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,r=0,a){for(let s=0,i=0;i<n;s++){let l=this.content[s],c=i+l.nodeSize;if(c>e&&o(l,r+i,a||null,s)!==!1&&l.content.size){let u=i+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),o,r+u)}i=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,r){let a="",s=!0;return this.nodesBetween(e,n,(i,l)=>{let c=i.isText?i.text.slice(Math.max(e,l)-l,n-l):i.isLeaf?r?typeof r=="function"?r(i):r:i.type.spec.leafText?i.type.spec.leafText(i):"":"";i.isBlock&&(i.isLeaf&&c||i.isTextblock)&&o&&(s?s=!1:a+=o),a+=c},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,r=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(o)&&(r[r.length-1]=n.withText(n.text+o.text),a=1);a<e.content.length;a++)r.push(e.content[a]);return new ct(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],r=0;if(n>e)for(let a=0,s=0;s<n;a++){let i=this.content[a],l=s+i.nodeSize;l>e&&((s<e||l>n)&&(i.isText?i=i.cut(Math.max(0,e-s),Math.min(i.text.length,n-s)):i=i.cut(Math.max(0,e-s-1),Math.min(i.content.size,n-s-1))),o.push(i),r+=i.nodeSize),s=l}return new ct(o,r)}cutByIndex(e,n){return e==n?ct.empty:e==0&&n==this.content.length?this:new ct(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let r=this.content.slice(),a=this.size+n.nodeSize-o.nodeSize;return r[e]=n,new ct(r,a)}addToStart(e){return new ct([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ct(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,o=0;n<this.content.length;n++){let r=this.content[n];e(r,o,n),o+=r.nodeSize}}findDiffStart(e,n=0){return Kf(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return Yf(this,e,n,o)}findIndex(e){if(e==0)return ys(0,e);if(e==this.size)return ys(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,o=0;;n++){let r=this.child(n),a=o+r.nodeSize;if(a>=e)return a==e?ys(n+1,a):ys(n,o);o=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return ct.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ct(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ct.empty;let n,o=0;for(let r=0;r<e.length;r++){let a=e[r];o+=a.nodeSize,r&&a.isText&&e[r-1].sameMarkup(a)?(n||(n=e.slice(0,r)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new ct(n||e,o)}static from(e){if(!e)return ct.empty;if(e instanceof ct)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ct([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};X.empty=new X([],0);const yl={index:0,offset:0};function ys(t,e){return yl.index=t,yl.offset=e,yl}function Zs(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let o=0;o<t.length;o++)if(!Zs(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!Zs(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let Ie=class rc{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let r=0;r<e.length;r++){let a=e[r];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,r));else{if(a.type.excludes(this.type))return e;!o&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),o=!0),n&&n.push(a)}}return n||(n=e.slice()),o||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Zs(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=o.create(n.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return rc.none;if(e instanceof rc)return[e];let n=e.slice();return n.sort((o,r)=>o.type.rank-r.type.rank),n}};Ie.none=[];let ei=class extends Error{},te=class Ko{constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=Xf(this.content,e+this.openStart,n);return o&&new Ko(o,this.openStart,this.openEnd)}removeBetween(e,n){return new Ko(Jf(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Ko.empty;let o=n.openStart||0,r=n.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ko(X.fromJSON(e,n.content),o,r)}static maxOpen(e,n=!0){let o=0,r=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)o++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)r++;return new Ko(e,o,r)}};te.empty=new te(X.empty,0,0);function Jf(t,e,n){let{index:o,offset:r}=t.findIndex(e),a=t.maybeChild(o),{index:s,offset:i}=t.findIndex(n);if(r==e||a.isText){if(i!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,a.copy(Jf(a.content,e-r-1,n-r-1)))}function Xf(t,e,n,o){let{index:r,offset:a}=t.findIndex(e),s=t.maybeChild(r);if(a==e||s.isText)return o&&!o.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let i=Xf(s.content,e-a-1,n,s);return i&&t.replaceChild(r,s.copy(i))}function Ok(t,e,n){if(n.openStart>t.depth)throw new ei("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ei("Inconsistent open depths");return Qf(t,e,n,0)}function Qf(t,e,n,o){let r=t.index(o),a=t.node(o);if(r==e.index(o)&&o<t.depth-n.openStart){let s=Qf(t,e,n,o+1);return a.copy(a.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let s=t.parent,i=s.content;return wo(s,i.cut(0,t.parentOffset).append(n.content).append(i.cut(e.parentOffset)))}else{let{start:s,end:i}=Rk(n,t);return wo(a,em(t,s,i,e,o))}else return wo(a,ti(t,e,o))}function Zf(t,e){if(!e.type.compatibleContent(t.type))throw new ei("Cannot join "+e.type.name+" onto "+t.type.name)}function ac(t,e,n){let o=t.node(n);return Zf(o,e.node(n)),o}function bo(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function la(t,e,n,o){let r=(e||t).node(n),a=0,s=e?e.index(n):r.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(bo(t.nodeAfter,o),a++));for(let i=a;i<s;i++)bo(r.child(i),o);e&&e.depth==n&&e.textOffset&&bo(e.nodeBefore,o)}function wo(t,e){return t.type.checkContent(e),t.copy(e)}function em(t,e,n,o,r){let a=t.depth>r&&ac(t,e,r+1),s=o.depth>r&&ac(n,o,r+1),i=[];return la(null,t,r,i),a&&s&&e.index(r)==n.index(r)?(Zf(a,s),bo(wo(a,em(t,e,n,o,r+1)),i)):(a&&bo(wo(a,ti(t,e,r+1)),i),la(e,n,r,i),s&&bo(wo(s,ti(n,o,r+1)),i)),la(o,null,r,i),new X(i)}function ti(t,e,n){let o=[];if(la(null,t,n,o),t.depth>n){let r=ac(t,e,n+1);bo(wo(r,ti(t,e,n+1)),o)}return la(e,null,n,o),new X(o)}function Rk(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let r=n-1;r>=0;r--)o=e.node(r).copy(X.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}let Rd=class sc{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(n);return o?e.child(n).cut(o):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let o=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)r+=o.child(a).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ie.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),r=e.maybeChild(n);if(!o){let i=o;o=r,r=i}let a=o.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!r||!a[s].isInSet(r.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,r=e.parent.maybeChild(e.index());for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!r||!o[a].isInSet(r.marks))&&(o=o[a--].removeFromSet(o));return o}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new ni(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let o=[],r=0,a=n;for(let s=e;;){let{index:i,offset:l}=s.content.findIndex(a),c=a-l;if(o.push(s,i,r+l),!c||(s=s.child(i),s.isText))break;a=c-1,r+=l+1}return new sc(n,o,a)}static resolveCached(e,n){let o=Pd.get(e);if(o)for(let a=0;a<o.elts.length;a++){let s=o.elts[a];if(s.pos==n)return s}else Pd.set(e,o=new Pk);let r=o.elts[o.i]=sc.resolve(e,n);return o.i=(o.i+1)%Dk,r}};class Pk{constructor(){this.elts=[],this.i=0}}const Dk=12,Pd=new WeakMap;let ni=class{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}};const Nk=Object.create(null);let _n=class ic{constructor(e,n,o,r=Ie.none){this.type=e,this.attrs=n,this.marks=r,this.content=o||X.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,o,r=0){this.content.nodesBetween(e,n,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,o,r){return this.content.textBetween(e,n,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,o){return this.type==e&&Zs(this.attrs,n||e.defaultAttrs||Nk)&&Ie.sameSet(this.marks,o||Ie.none)}copy(e=null){return e==this.content?this:new ic(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ic(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,o=!1){if(e==n)return te.empty;let r=this.resolve(e),a=this.resolve(n),s=o?0:r.sharedDepth(n),i=r.start(s),l=r.node(s).content.cut(r.pos-i,a.pos-i);return new te(l,r.depth-s,a.depth-s)}replace(e,n,o){return Ok(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let r=this.content.child(n-1);return{node:r,index:n-1,offset:o-r.nodeSize}}resolve(e){return Rd.resolveCached(this,e)}resolveNoCache(e){return Rd.resolve(this,e)}rangeHasMark(e,n,o){let r=!1;return n>e&&this.nodesBetween(e,n,a=>(o.isInSet(a.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),tm(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,o=X.empty,r=0,a=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,a),i=s&&s.matchFragment(this.content,n);if(!i||!i.validEnd)return!1;for(let l=r;l<a;l++)if(!this.type.allowsMarks(o.child(l).marks))return!1;return!0}canReplaceWith(e,n,o,r){if(r&&!this.type.allowsMarks(r))return!1;let a=this.contentMatchAt(e).matchType(o),s=a&&a.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ie.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!Ie.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,o)}let r=X.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,r,o);return a.type.checkAttrs(a.attrs),a}};_n.prototype.text=void 0;let Lk=class lc extends _n{constructor(e,n,o,r){if(super(e,n,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):tm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new lc(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new lc(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function tm(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}let ya=class nm{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new Uk(e,n);if(o.next==null)return nm.empty;let r=om(o);o.next&&o.err("Unexpected trailing text");let a=Vk(Hk(r));return zk(a,o),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,o=e.childCount){let r=this;for(let a=n;r&&a<o;a++)r=r.matchType(e.child(a).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let r=[this];function a(s,i){let l=s.matchFragment(e,o);if(l&&(!n||l.validEnd))return X.from(i.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(d)==-1){r.push(d);let p=a(d,i.concat(u));if(p)return p}}return null}return a(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),a=r.match;if(a.matchType(e)){let s=[];for(let i=r;i.type;i=i.via)s.push(i.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:i,next:l}=a.next[s];!i.isLeaf&&!i.hasRequiredAttrs()&&!(i.name in n)&&(!r.type||l.validEnd)&&(o.push({match:i.contentMatch,type:i,via:r}),n[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&n(o.next[r].next)}return n(this),e.map((o,r)=>{let a=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)a+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return a}).join(`
|
||
`)}};ya.empty=new ya(!0);class Uk{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function om(t){let e=[];do e.push(Bk(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Bk(t){let e=[];do e.push(Fk(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Fk(t){let e=qk(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=jk(t,e);else break;return e}function Dd(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function jk(t,e){let n=Dd(t),o=n;return t.eat(",")&&(t.next!="}"?o=Dd(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function Gk(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let r=[];for(let a in n){let s=n[a];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function qk(t){if(t.eat("(")){let e=om(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Gk(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Hk(t){let e=[[]];return r(a(t,0),n()),e;function n(){return e.push([])-1}function o(s,i,l){let c={term:l,to:i};return e[s].push(c),c}function r(s,i){s.forEach(l=>l.to=i)}function a(s,i){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(a(c,i)),[]);if(s.type=="seq")for(let l=0;;l++){let c=a(s.exprs[l],i);if(l==s.exprs.length-1)return c;r(c,i=n())}else if(s.type=="star"){let l=n();return o(i,l),r(a(s.expr,l),l),[o(l)]}else if(s.type=="plus"){let l=n();return r(a(s.expr,i),l),r(a(s.expr,l),l),[o(l)]}else{if(s.type=="opt")return[o(i)].concat(a(s.expr,i));if(s.type=="range"){let l=i;for(let c=0;c<s.min;c++){let u=n();r(a(s.expr,l),u),l=u}if(s.max==-1)r(a(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();o(l,u),r(a(s.expr,l),u),l=u}return[o(l)]}else{if(s.type=="name")return[o(i,void 0,s.value)];throw new Error("Unknown expr type")}}}}function rm(t,e){return e-t}function Nd(t,e){let n=[];return o(e),n.sort(rm);function o(r){let a=t[r];if(a.length==1&&!a[0].term)return o(a[0].to);n.push(r);for(let s=0;s<a.length;s++){let{term:i,to:l}=a[s];!i&&n.indexOf(l)==-1&&o(l)}}}function Vk(t){let e=Object.create(null);return n(Nd(t,0));function n(o){let r=[];o.forEach(s=>{t[s].forEach(({term:i,to:l})=>{if(!i)return;let c;for(let u=0;u<r.length;u++)r[u][0]==i&&(c=r[u][1]);Nd(t,l).forEach(u=>{c||r.push([i,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let a=e[o.join(",")]=new ya(o.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let i=r[s][1].sort(rm);a.next.push({type:r[s][0],next:e[i.join(",")]||n(i)})}return a}}function zk(t,e){for(let n=0,o=[t];n<o.length;n++){let r=o[n],a=!r.validEnd,s=[];for(let i=0;i<r.next.length;i++){let{type:l,next:c}=r.next[i];s.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),o.indexOf(c)==-1&&o.push(c)}a&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function am(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function sm(t,e){let n=Object.create(null);for(let o in t){let r=e&&e[o];if(r===void 0){let a=t[o];if(a.hasDefault)r=a.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=r}return n}function im(t,e,n,o){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let a=t[r];a.validate&&a.validate(e[r])}}function lm(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new Kk(t,o,e[o]);return n}let Ld=class cm{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=lm(e,o.attrs),this.defaultAttrs=am(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ya.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:sm(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new _n(this,this.computeAttrs(e),X.from(n),Ie.setFrom(o))}createChecked(e=null,n,o){return n=X.from(n),this.checkContent(n),new _n(this,this.computeAttrs(e),n,Ie.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=X.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),a=r&&r.fillBefore(X.empty,!0);return a?new _n(this,e,n.append(a),Ie.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){im(this.attrs,e,"node")}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:Ie.none:e}static compile(e,n){let o=Object.create(null);e.forEach((a,s)=>o[a]=new cm(a,n,s));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let a in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function Wk(t,e,n){let o=n.split("|");return r=>{let a=r===null?"null":typeof r;if(o.indexOf(a)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${a}`)}}class Kk{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?Wk(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}let um=class dm{constructor(e,n,o,r){this.name=e,this.rank=n,this.schema=o,this.spec=r,this.attrs=lm(e,r.attrs),this.excluded=null;let a=am(this.attrs);this.instance=a?new Ie(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Ie(this,sm(this.attrs,e))}static compile(e,n){let o=Object.create(null),r=0;return e.forEach((a,s)=>o[a]=new dm(a,r++,n,s)),o}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){im(this.attrs,e,"mark")}excludes(e){return this.excluded.indexOf(e)>-1}};class pm{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=Ke.from(e.nodes),n.marks=Ke.from(e.marks||{}),this.nodes=Ld.compile(this.spec.nodes,this),this.marks=um.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let a=this.nodes[r],s=a.spec.content||"",i=a.spec.marks;if(a.contentMatch=o[s]||(o[s]=ya.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=i=="_"?null:i?Ud(this,i.split(" ")):i==""||!a.inlineContent?[]:null}for(let r in this.marks){let a=this.marks[r],s=a.spec.excludes;a.excluded=s==null?[a]:s==""?[]:Ud(this,s.split(" "))}this.nodeFromJSON=r=>_n.fromJSON(this,r),this.markFromJSON=r=>Ie.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ld){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,o,r)}text(e,n){let o=this.nodes.text;return new Lk(o,o.defaultAttrs,e,Ie.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Ud(t,e){let n=[];for(let o=0;o<e.length;o++){let r=e[o],a=t.marks[r],s=a;if(a)n.push(a);else for(let i in t.marks){let l=t.marks[i];(r=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function Yk(t){return t.tag!=null}function Jk(t){return t.style!=null}let ca=class cc{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(r=>{if(Yk(r))this.tags.push(r);else if(Jk(r)){let a=/[^=]*/.exec(r.style)[0];o.indexOf(a)<0&&o.push(a),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let a=e.nodes[r.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let o=new Fd(this,n,!1);return o.addAll(e,Ie.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new Fd(this,n,!0);return o.addAll(e,Ie.none,n.from,n.to),te.maxOpen(o.finish())}matchTag(e,n,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let a=this.tags[r];if(Zk(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let s=a.getAttrs(e);if(s===!1)continue;a.attrs=s||void 0}return a}}}matchStyle(e,n,o,r){for(let a=r?this.styles.indexOf(r)+1:0;a<this.styles.length;a++){let s=this.styles[a],i=s.style;if(!(i.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||i.length>e.length&&(i.charCodeAt(e.length)!=61||i.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function o(r){let a=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let i=n[s];if((i.priority==null?50:i.priority)<a)break}n.splice(s,0,r)}for(let r in e.marks){let a=e.marks[r].spec.parseDOM;a&&a.forEach(s=>{o(s=jd(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let a=e.nodes[r].spec.parseDOM;a&&a.forEach(s=>{o(s=jd(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new cc(e,cc.schemaRules(e)))}};const hm={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Xk={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},fm={ol:!0,ul:!0},_a=1,uc=2,ua=4;function Bd(t,e,n){return e!=null?(e?_a:0)|(e==="full"?uc:0):t&&t.whitespace=="pre"?_a|uc:n&~ua}let _s=class{constructor(e,n,o,r,a,s){this.type=e,this.attrs=n,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=Ie.none,this.match=a||(s&ua?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(X.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&_a)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let a=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-r[0].length))}}let n=X.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(X.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!hm.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Fd=class{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=n.topNode,a,s=Bd(null,n.preserveWhitespace,0)|(o?ua:0);r?a=new _s(r.type,r.attrs,Ie.none,!0,n.topMatch||r.type.contentMatch,s):o?a=new _s(null,null,Ie.none,!0,null,s):a=new _s(e.schema.topNodeType,null,Ie.none,!0,null,s),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let o=e.nodeValue,r=this.top,a=r.options&uc?"full":this.localPreserveWS||(r.options&_a)>0,{schema:s}=this.parser;if(a==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(a)if(a==="full")o=o.replace(/\r\n?/g,`
|
||
`);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let i=o.split(/\r?\n|\r/);for(let l=0;l<i.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),i[l]&&this.insertNode(s.text(i[l]),n,!/\S/.test(i[l]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],l=e.previousSibling;(!i||l&&l.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),n,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,n,o){let r=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),i;fm.hasOwnProperty(s)&&this.parser.normalizeLists&&Qk(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,o));e:if(l?l.ignore:Xk.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(hm.hasOwnProperty(s))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),c=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(a),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?i:void 0)}this.localPreserveWS=r}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
||
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let a=this.parser.matchedStyles[r],s=o.getPropertyValue(a);if(s)for(let i=void 0;;){let l=this.parser.matchStyle(a,s,this,i);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)i=l;else break}}return n}addElementByRule(e,n,o,r){let a,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let l=this.enter(s,n.attrs||null,o,n.preserveWhitespace);l&&(a=!0,o=l)}else{let l=this.parser.schema.marks[n.mark];o=o.concat(l.create(n.attrs))}let i=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,o,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,o),this.findAround(e,l,!1)}a&&this.sync(i)&&this.open--}addAll(e,n,o,r){let a=o||0;for(let s=o?e.childNodes[o]:e.firstChild,i=r==null?null:e.childNodes[r];s!=i;s=s.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(s,n);this.findAtPoint(e,a)}findPlace(e,n,o){let r,a;for(let s=this.open,i=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!r||r.length>c.length+i)&&(r=c,a=l,!c.length))break;if(l.solid){if(o)break;i+=2}}if(!r)return null;this.sync(a);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n,o){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(n=this.enterInner(a,null,n))}let r=this.findPlace(e,n,o);if(r){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let s=Ie.none;for(let i of r.concat(e.marks))(a.type?a.type.allowsMarkType(i.type):Gd(i.type,e.type))&&(s=i.addToSet(s));return a.content.push(e.mark(s)),!0}return!1}enter(e,n,o,r){let a=this.findPlace(e.create(n),o,!1);return a&&(a=this.enterInner(e,n,o,!0,r)),a}enterInner(e,n,o,r=!1,a){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let i=Bd(e,a,s.options);s.options&ua&&s.content.length==0&&(i|=ua);let l=Ie.none;return o=o.filter(c=>(s.type?s.type.allowsMarkType(c.type):Gd(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new _s(e,n,l,r,null,i)),this.open++,o}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=_a)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let o=this.nodes[n].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==n&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,o){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),a=-(o?o.depth+1:0)+(r?0:1),s=(i,l)=>{for(;i>=0;i--){let c=n[i];if(c==""){if(i==n.length-1||i==0)continue;for(;l>=a;l--)if(s(i-1,l))return!0;return!1}else{let u=l>0||l==0&&r?this.nodes[l].type:o&&l>=a?o.node(l-a).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let n in this.parser.schema.nodes){let o=this.parser.schema.nodes[n];if(o.isTextblock&&o.defaultAttrs)return o}}};function Qk(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&fm.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function Zk(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function jd(t){let e={};for(let n in t)e[n]=t[n];return e}function Gd(t,e){let n=e.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(t))continue;let a=[],s=i=>{a.push(i);for(let l=0;l<i.edgeCount;l++){let{type:c,next:u}=i.edge(l);if(c==e||a.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}let ja=class mm{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=_l(n).createDocumentFragment());let r=o,a=[];return e.forEach(s=>{if(a.length||s.marks.length){let i=0,l=0;for(;i<a.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(a[i][0])||c.type.spec.spanning===!1)break;i++,l++}for(;i<a.length;)r=a.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(a.push([c,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:r}=Ps(_l(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return o}serializeNode(e,n={}){let o=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let a=this.serializeMark(e.marks[r],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(o),o=a.dom)}return o}serializeMark(e,n,o={}){let r=this.marks[e.type.name];return r&&Ps(_l(o),r(e,n),null,e.attrs)}static renderSpec(e,n,o=null,r){return Ps(e,n,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new mm(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=qd(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return qd(e.marks)}};function qd(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function _l(t){return t.document||window.document}const Hd=new WeakMap;function eE(t){let e=Hd.get(t);return e===void 0&&Hd.set(t,e=tE(t)),e}function tE(t){let e=null;function n(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)n(o[r]);else for(let r in o)n(o[r])}return n(t),e}function Ps(t,e,n,o){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],a;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(a=eE(o))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let i,l=n?t.createElementNS(n,r):t.createElement(r),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let p=e[d];if(p===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:m}=Ps(t,p,n,o);if(l.appendChild(h),m){if(i)throw new RangeError("Multiple content holes");i=m}}}return{dom:l,contentDOM:i}}const gm=65535,vm=Math.pow(2,16);function nE(t,e){return t+e*vm}function Vd(t){return t&gm}function oE(t){return(t-(t&gm))/vm}const ym=1,_m=2,Ds=4,bm=8;let dc=class{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&bm)>0}get deletedBefore(){return(this.delInfo&(ym|Ds))>0}get deletedAfter(){return(this.delInfo&(_m|Ds))>0}get deletedAcross(){return(this.delInfo&Ds)>0}},To=class Yo{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Yo.empty)return Yo.empty}recover(e){let n=0,o=Vd(e);if(!this.inverted)for(let r=0;r<o;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+n+oE(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,o){let r=0,a=this.inverted?2:1,s=this.inverted?1:2;for(let i=0;i<this.ranges.length;i+=3){let l=this.ranges[i]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[i+a],u=this.ranges[i+s],d=l+c;if(e<=d){let p=c?e==l?-1:e==d?1:n:n,h=l+r+(p<0?0:u);if(o)return h;let m=e==(n<0?l:d)?null:nE(i/3,e-l),g=e==l?_m:e==d?ym:Ds;return(n<0?e!=l:e!=d)&&(g|=bm),new dc(h,g,m)}r+=u-c}return o?e+r:new dc(e+r,0,null)}touches(e,n){let o=0,r=Vd(n),a=this.inverted?2:1,s=this.inverted?1:2;for(let i=0;i<this.ranges.length;i+=3){let l=this.ranges[i]-(this.inverted?o:0);if(l>e)break;let c=this.ranges[i+a],u=l+c;if(e<=u&&i==r*3)return!0;o+=this.ranges[i+s]-c}return!1}forEach(e){let n=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,a=0;r<this.ranges.length;r+=3){let s=this.ranges[r],i=s-(this.inverted?a:0),l=s+(this.inverted?0:a),c=this.ranges[r+n],u=this.ranges[r+o];e(i,i+c,l,l+u),a+=u-c}}invert(){return new Yo(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Yo.empty:new Yo(e<0?[0,-e,0]:[0,0,e])}};To.empty=new To([]);let wm=class pc{constructor(e,n,o=0,r=e?e.length:0){this.mirror=n,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new pc(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,o=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?o+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,o=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?o-r-1:void 0)}}invert(){let e=new pc;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,o){let r=0;for(let a=this.from;a<this.to;a++){let s=this._maps[a],i=s.mapResult(e,n);if(i.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this._maps[l].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return o?e:new dc(e,r,null)}};const bl=Object.create(null);let it=class{getMap(){return To.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=bl[n.stepType];if(!o)throw new RangeError(`No step type ${n.stepType} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in bl)throw new RangeError("Duplicate use of step JSON ID "+e);return bl[e]=n,n.prototype.jsonID=e,n}},ht=class Hr{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Hr(e,null)}static fail(e){return new Hr(null,e)}static fromReplace(e,n,o,r){try{return Hr.ok(e.replace(n,o,r))}catch(a){if(a instanceof ei)return Hr.fail(a.message);throw a}}};function bu(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let a=t.child(r);a.content.size&&(a=a.copy(bu(a.content,e,a))),a.isInline&&(a=e(a,n,r)),o.push(a)}return X.fromArray(o)}let wu=class Vr extends it{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),a=new te(bu(n.content,(s,i)=>!s.isAtom||!i.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return ht.fromReplace(e,this.from,this.to,a)}invert(){return new Ga(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new Vr(n.pos,o.pos,this.mark)}merge(e){return e instanceof Vr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Vr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Vr(n.from,n.to,e.markFromJSON(n.mark))}};it.jsonID("addMark",wu);let Ga=class zr extends it{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=new te(bu(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return ht.fromReplace(e,this.from,this.to,o)}invert(){return new wu(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new zr(n.pos,o.pos,this.mark)}merge(e){return e instanceof zr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new zr(n.from,n.to,e.markFromJSON(n.mark))}};it.jsonID("removeMark",Ga);let Su=class Wr extends it{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ht.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ht.fromReplace(e,this.pos,this.pos+1,new te(X.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let o=this.mark.addToSet(n.marks);if(o.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(o))return new Wr(this.pos,n.marks[r]);return new Wr(this.pos,this.mark)}}return new oi(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Wr(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Wr(n.pos,e.markFromJSON(n.mark))}};it.jsonID("addNodeMark",Su);let oi=class hc extends it{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ht.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ht.fromReplace(e,this.pos,this.pos+1,new te(X.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Su(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new hc(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new hc(n.pos,e.markFromJSON(n.mark))}};it.jsonID("removeNodeMark",oi);let Jt=class po extends it{constructor(e,n,o,r=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=r}apply(e){return this.structure&&fc(e,this.from,this.to)?ht.fail("Structure replace would overwrite content"):ht.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new To([this.from,this.to-this.from,this.slice.size])}invert(e){return new po(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deletedAcross&&o.deletedAcross?null:new po(n.pos,Math.max(n.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof po)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?te.empty:new te(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new po(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?te.empty:new te(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new po(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new po(n.from,n.to,te.fromJSON(e,n.slice),!!n.structure)}};it.jsonID("replace",Jt);let kt=class Ns extends it{constructor(e,n,o,r,a,s,i=!1){super(),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=r,this.slice=a,this.insert=s,this.structure=i}apply(e){if(this.structure&&(fc(e,this.from,this.gapFrom)||fc(e,this.gapTo,this.to)))return ht.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ht.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?ht.fromReplace(e,this.from,this.to,o):ht.fail("Content does not fit in gap")}getMap(){return new To([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ns(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return n.deletedAcross&&o.deletedAcross||r<n.pos||a>o.pos?null:new Ns(n.pos,o.pos,r,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ns(n.from,n.to,n.gapFrom,n.gapTo,te.fromJSON(e,n.slice),n.insert,!!n.structure)}};it.jsonID("replaceAround",kt);function fc(t,e,n){let o=t.resolve(e),r=n-e,a=o.depth;for(;r>0&&a>0&&o.indexAfter(a)==o.node(a).childCount;)a--,r--;if(r>0){let s=o.node(a).maybeChild(o.indexAfter(a));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function rE(t,e,n,o){let r=[],a=[],s,i;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!o.isInSet(d)&&u.type.allowsMarkType(o.type)){let p=Math.max(c,e),h=Math.min(c+l.nodeSize,n),m=o.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(d[g])?s.to=h:r.push(s=new Ga(p,h,d[g])));i&&i.to==p?i.to=h:a.push(i=new wu(p,h,o))}}),r.forEach(l=>t.step(l)),a.forEach(l=>t.step(l))}function aE(t,e,n,o){let r=[],a=0;t.doc.nodesBetween(e,n,(s,i)=>{if(!s.isInline)return;a++;let l=null;if(o instanceof um){let c=s.marks,u;for(;u=o.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else o?o.isInSet(s.marks)&&(l=[o]):l=s.marks;if(l&&l.length){let c=Math.min(i+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==a-1&&d.eq(r[h].style)&&(p=m)}p?(p.to=c,p.step=a):r.push({style:d,from:Math.max(i,e),to:c,step:a})}}}),r.forEach(s=>t.step(new Ga(s.from,s.to,s.style)))}function ku(t,e,n,o=n.contentMatch,r=!0){let a=t.doc.nodeAt(e),s=[],i=e+1;for(let l=0;l<a.childCount;l++){let c=a.child(l),u=i+c.nodeSize,d=o.matchType(c.type);if(!d)s.push(new Jt(i,u,te.empty));else{o=d;for(let p=0;p<c.marks.length;p++)n.allowsMarkType(c.marks[p].type)||t.step(new Ga(i,u,c.marks[p]));if(r&&c.isText&&n.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(c.text);)m||(m=new te(X.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new Jt(i+p.index,i+p.index+p[0].length,m))}}i=u}if(!o.validEnd){let l=o.fillBefore(X.empty,!0);t.replace(i,i,new te(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function sE(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ar(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth,o=0,r=0;;--n){let a=t.$from.node(n),s=t.$from.index(n)+o,i=t.$to.indexAfter(n)-r;if(n<t.depth&&a.canReplace(s,i,e))return n;if(n==0||a.type.spec.isolating||!sE(a,s,i))break;s&&(o=1),i<a.childCount&&(r=1)}return null}function iE(t,e,n){let{$from:o,$to:r,depth:a}=e,s=o.before(a+1),i=r.after(a+1),l=s,c=i,u=X.empty,d=0;for(let m=a,g=!1;m>n;m--)g||o.index(m)>0?(g=!0,u=X.from(o.node(m).copy(u)),d++):l--;let p=X.empty,h=0;for(let m=a,g=!1;m>n;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=X.from(r.node(m).copy(p)),h++):c++;t.step(new kt(l,c,s,i,new te(u.append(p),d,h),u.size-d,!0))}function Eu(t,e,n=null,o=t){let r=lE(t,e),a=r&&cE(o,e);return a?r.map(zd).concat({type:e,attrs:n}).concat(a.map(zd)):null}function zd(t){return{type:t,attrs:null}}function lE(t,e){let{parent:n,startIndex:o,endIndex:r}=t,a=n.contentMatchAt(o).findWrapping(e);if(!a)return null;let s=a.length?a[0]:e;return n.canReplaceWith(o,r,s)?a:null}function cE(t,e){let{parent:n,startIndex:o,endIndex:r}=t,a=n.child(o),s=e.contentMatch.findWrapping(a.type);if(!s)return null;let i=(s.length?s[s.length-1]:e).contentMatch;for(let l=o;i&&l<r;l++)i=i.matchType(n.child(l).type);return!i||!i.validEnd?null:s}function uE(t,e,n){let o=X.empty;for(let s=n.length-1;s>=0;s--){if(o.size){let i=n[s].type.contentMatch.matchFragment(o);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=X.from(n[s].type.create(n[s].attrs,o))}let r=e.start,a=e.end;t.step(new kt(r,a,r,a,new te(o,0,0),n.length,!0))}function dE(t,e,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(s,i)=>{let l=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,l)&&pE(t.doc,t.mapping.slice(a).map(i),o)){let c=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&km(t,s,i,a),ku(t,t.mapping.slice(a).map(i,1),o,void 0,c===null);let u=t.mapping.slice(a),d=u.map(i,1),p=u.map(i+s.nodeSize,1);return t.step(new kt(d,p,d+1,p-1,new te(X.from(o.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Sm(t,s,i,a),!1}})}function Sm(t,e,n,o){e.forEach((r,a)=>{if(r.isText){let s,i=/\r?\n|\r/g;for(;s=i.exec(r.text);){let l=t.mapping.slice(o).map(n+1+a+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function km(t,e,n,o){e.forEach((r,a)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(o).map(n+1+a);t.replaceWith(s,s+1,e.type.schema.text(`
|
||
`))}})}function pE(t,e,n){let o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}function hE(t,e,n,o,r){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");n||(n=a.type);let s=n.create(o,null,r||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,s);if(!n.validContent(a.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new kt(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new te(X.from(s),0,0),1,!0))}function sr(t,e,n=1,o){let r=t.resolve(e),a=r.depth-n,s=o&&o[o.length-1]||r.parent;if(a<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let c=r.depth-1,u=n-2;c>a;c--,u--){let d=r.node(c),p=r.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(p,d.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[u]||d;if(!d.canReplace(p+1,d.childCount)||!g.type.validContent(h))return!1}let i=r.indexAfter(a),l=o&&o[0];return r.node(a).canReplaceWith(i,i,l?l.type:r.node(a+1).type)}function fE(t,e,n=1,o){let r=t.doc.resolve(e),a=X.empty,s=X.empty;for(let i=r.depth,l=r.depth-n,c=n-1;i>l;i--,c--){a=X.from(r.node(i).copy(a));let u=o&&o[c];s=X.from(u?u.type.create(u.attrs,s):r.node(i).copy(s))}t.step(new Jt(e,e,new te(a.append(s),n,n),!0))}function to(t,e){let n=t.resolve(e),o=n.index();return Em(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function mE(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:o}=t.type.schema;for(let r=0;r<e.childCount;r++){let a=e.child(r),s=a.type==o?t.type.schema.nodes.text:a.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(a.marks))return!1}return n.validEnd}function Em(t,e){return!!(t&&e&&!t.isLeaf&&mE(t,e))}function Di(t,e,n=-1){let o=t.resolve(e);for(let r=o.depth;;r--){let a,s,i=o.index(r);if(r==o.depth?(a=o.nodeBefore,s=o.nodeAfter):n>0?(a=o.node(r+1),i++,s=o.node(r).maybeChild(i)):(a=o.node(r).maybeChild(i-1),s=o.node(r+1)),a&&!a.isTextblock&&Em(a,s)&&o.node(r).canReplace(i,i+1))return e;if(r==0)break;e=n<0?o.before(r):o.after(r)}}function gE(t,e,n){let o=null,{linebreakReplacement:r}=t.doc.type.schema,a=t.doc.resolve(e-n),s=a.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(r);u&&!d?o=!1:!u&&d&&(o=!0)}let i=t.steps.length;if(o===!1){let u=t.doc.resolve(e+n);km(t,u.node(),u.before(),i)}s.inlineContent&&ku(t,e+n-1,s,a.node().contentMatchAt(a.index()),o==null);let l=t.mapping.slice(i),c=l.map(e-n);if(t.step(new Jt(c,l.map(e+n,-1),te.empty,!0)),o===!0){let u=t.doc.resolve(c);Sm(t,u.node(),u.before(),t.steps.length)}return t}function vE(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let a=o.index(r);if(o.node(r).canReplaceWith(a,a,n))return o.before(r+1);if(a>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let a=o.indexAfter(r);if(o.node(r).canReplaceWith(a,a,n))return o.after(r+1);if(a<o.node(r).childCount)return null}return null}function Cm(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let a=0;a<n.openStart;a++)r=r.firstChild.content;for(let a=1;a<=(n.openStart==0&&n.size?2:1);a++)for(let s=o.depth;s>=0;s--){let i=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,l=o.index(s)+(i>0?1:0),c=o.node(s),u=!1;if(a==1)u=c.canReplace(l,l,r);else{let d=c.contentMatchAt(l).findWrapping(r.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return i==0?o.pos:i<0?o.before(s+1):o.after(s+1)}return null}function Ni(t,e,n=e,o=te.empty){if(e==n&&!o.size)return null;let r=t.resolve(e),a=t.resolve(n);return Mm(r,a,o)?new Jt(e,n,o):new yE(r,a,o).fit()}function Mm(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class yE{constructor(e,n,o){this.$from=e,this.$to=n,this.unplaced=o,this.frontier=[],this.placed=X.empty;for(let r=0;r<=e.depth;r++){let a=e.node(r);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=X.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let a=this.placed,s=o.depth,i=r.depth;for(;s&&i&&a.childCount==1;)a=a.firstChild.content,s--,i--;let l=new te(a,s,i);return e>-1?new kt(o.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||o.pos!=this.$to.pos?new Jt(o.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let a=n.firstChild;if(n.childCount>1&&(r=0),a.type.spec.isolating&&r<=o){e=o;break}n=a.content}for(let n=1;n<=2;n++)for(let o=n==1?e:this.unplaced.openStart;o>=0;o--){let r,a=null;o?(a=wl(this.unplaced.content,o-1).firstChild,r=a.content):r=this.unplaced.content;let s=r.firstChild;for(let i=this.depth;i>=0;i--){let{type:l,match:c}=this.frontier[i],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(X.from(s),!1)):a&&l.compatibleContent(a.type)))return{sliceDepth:o,frontierDepth:i,parent:a,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:i,parent:a,wrap:u};if(a&&c.matchType(a.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=wl(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new te(e,n+1,Math.max(o,r.size+n>=e.size-o?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=wl(e,n);if(r.childCount<=1&&n>0){let a=e.size-n<=n+r.size;this.unplaced=new te(Kr(e,n-1,1),n-1,a?n-1:o)}else this.unplaced=new te(Kr(e,n,1),n,o)}placeNodes({sliceDepth:e,frontierDepth:n,parent:o,inject:r,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let g=0;g<a.length;g++)this.openFrontierNode(a[g]);let s=this.unplaced,i=o?o.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:p}=this.frontier[n];if(r){for(let g=0;g<r.childCount;g++)u.push(r.child(g));d=d.matchFragment(r)}let h=i.size+e-(s.content.size-s.openEnd);for(;c<i.childCount;){let g=i.child(c),v=d.matchType(g.type);if(!v)break;c++,(c>1||l==0||g.content.size)&&(d=v,u.push($m(g.mark(p.allowedMarks(g.marks)),c==1?l:0,c==i.childCount?h:-1)))}let m=c==i.childCount;m||(h=-1),this.placed=Yr(this.placed,n,X.from(u)),this.frontier[n].match=d,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,v=i;g<h;g++){let b=v.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),v=b.content}this.unplaced=m?e==0?te.empty:new te(Kr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new te(Kr(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Sl(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:o,type:r}=this.frontier[n],a=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Sl(e,n,r,o,a);if(s){for(let i=n-1;i>=0;i--){let{match:l,type:c}=this.frontier[i],u=Sl(e,i,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:a?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Yr(this.placed,n.depth,n.fit)),e=n.move;for(let o=n.depth+1;o<=e.depth;o++){let r=e.node(o),a=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,a)}return e}openFrontierNode(e,n=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Yr(this.placed,this.depth,X.from(e.create(n,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(X.empty,!0);e.childCount&&(this.placed=Yr(this.placed,this.frontier.length,e))}}function Kr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Kr(t.firstChild.content,e-1,n)))}function Yr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Yr(t.lastChild.content,e-1,n)))}function wl(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function $m(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,$m(o.firstChild,e-1,o.childCount==1?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(X.empty,!0)))),t.copy(o)}function Sl(t,e,n,o,r){let a=t.node(e),s=r?t.indexAfter(e):t.index(e);if(s==a.childCount&&!n.compatibleContent(a.type))return null;let i=o.fillBefore(a.content,!0,s);return i&&!_E(n,a.content,s)?i:null}function _E(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function bE(t){return t.spec.defining||t.spec.definingForContent}function wE(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),a=t.doc.resolve(n);if(Mm(r,a,o))return t.step(new Jt(e,n,o));let s=Im(r,a);s[s.length-1]==0&&s.pop();let i=-(r.depth+1);s.unshift(i);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?i=p:r.before(p)==h&&s.splice(1,0,-p)}let l=s.indexOf(i),c=[],u=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(c.push(m),h==o.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=c[p],m=bE(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(i)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+u+1)%(o.openStart+1),m=c[h];if(m)for(let g=0;g<s.length;g++){let v=s[(g+l)%s.length],b=!0;v<0&&(b=!1,v=-v);let w=r.node(v-1),E=r.index(v-1);if(w.canReplaceWith(E,E,m.type,m.marks))return t.replace(r.before(v),b?a.after(v):n,new te(Tm(o.content,0,o.openStart,h),h,o.openEnd))}}let d=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,o),!(t.steps.length>d));p--){let h=s[p];h<0||(e=r.before(h),n=a.after(h))}}function Tm(t,e,n,o,r){if(e<n){let a=t.firstChild;t=t.replaceChild(0,a.copy(Tm(a.content,e+1,n,o,a)))}if(e>o){let a=r.contentMatchAt(0),s=a.fillBefore(t).append(t);t=s.append(a.matchFragment(s).fillBefore(X.empty,!0))}return t}function SE(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=vE(t.doc,e,o.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new te(X.from(o),0,0))}function kE(t,e,n){let o=t.doc.resolve(e),r=t.doc.resolve(n),a=Im(o,r);for(let s=0;s<a.length;s++){let i=a[s],l=s==a.length-1;if(l&&i==0||o.node(i).type.contentMatch.validEnd)return t.delete(o.start(i),r.end(i));if(i>0&&(l||o.node(i-1).canReplace(o.index(i-1),r.indexAfter(i-1))))return t.delete(o.before(i),r.after(i))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&n>o.end(s)&&r.end(s)-n!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return t.delete(o.before(s),n);t.delete(e,n)}function Im(t,e){let n=[],o=Math.min(t.depth,e.depth);for(let r=o;r>=0;r--){let a=t.start(r);if(a<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(a==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==a-1)&&n.push(r)}return n}let Am=class Ls extends it{constructor(e,n,o){super(),this.pos=e,this.attr=n,this.value=o}apply(e){let n=e.nodeAt(this.pos);if(!n)return ht.fail("No node at attribute step's position");let o=Object.create(null);for(let a in n.attrs)o[a]=n.attrs[a];o[this.attr]=this.value;let r=n.type.create(o,null,n.marks);return ht.fromReplace(e,this.pos,this.pos+1,new te(X.from(r),0,n.isLeaf?0:1))}getMap(){return To.empty}invert(e){return new Ls(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ls(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ls(n.pos,n.attr,n.value)}};it.jsonID("attr",Am);let xm=class mc extends it{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let o=e.type.create(n,e.content,e.marks);return ht.ok(o)}getMap(){return To.empty}invert(e){return new mc(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new mc(n.attr,n.value)}};it.jsonID("docAttr",xm);let hr=class extends Error{};hr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};hr.prototype=Object.create(Error.prototype);hr.prototype.constructor=hr;hr.prototype.name="TransformError";class EE{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new wm}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new hr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let o=0;o<this.mapping.maps.length;o++){let r=this.mapping.maps[o];o&&(e=r.map(e,1),n=r.map(n,-1)),r.forEach((a,s,i,l)=>{e=Math.min(e,i),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,o=te.empty){let r=Ni(this.doc,e,n,o);return r&&this.step(r),this}replaceWith(e,n,o){return this.replace(e,n,new te(X.from(o),0,0))}delete(e,n){return this.replace(e,n,te.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,o){return wE(this,e,n,o),this}replaceRangeWith(e,n,o){return SE(this,e,n,o),this}deleteRange(e,n){return kE(this,e,n),this}lift(e,n){return iE(this,e,n),this}join(e,n=1){return gE(this,e,n),this}wrap(e,n){return uE(this,e,n),this}setBlockType(e,n=e,o,r=null){return dE(this,e,n,o,r),this}setNodeMarkup(e,n,o=null,r){return hE(this,e,n,o,r),this}setNodeAttribute(e,n,o){return this.step(new Am(e,n,o)),this}setDocAttribute(e,n){return this.step(new xm(e,n)),this}addNodeMark(e,n){return this.step(new Su(e,n)),this}removeNodeMark(e,n){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(n instanceof Ie)n.isInSet(o.marks)&&this.step(new oi(e,n));else{let r=o.marks,a,s=[];for(;a=n.isInSet(r);)s.push(new oi(e,a)),r=a.removeFromSet(r);for(let i=s.length-1;i>=0;i--)this.step(s[i])}return this}split(e,n=1,o){return fE(this,e,n,o),this}addMark(e,n,o){return rE(this,e,n,o),this}removeMark(e,n,o){return aE(this,e,n,o),this}clearIncompatible(e,n,o){return ku(this,e,n,o),this}}const kl=Object.create(null);let ye=class{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new CE(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=te.empty){let o=n.content.lastChild,r=null;for(let i=0;i<n.openEnd;i++)r=o,o=o.lastChild;let a=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:l,$to:c}=s[i],u=e.mapping.slice(a);e.replaceRange(u.map(l.pos),u.map(c.pos),i?te.empty:n),i==0&&Yd(e,a,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let o=e.steps.length,r=this.ranges;for(let a=0;a<r.length;a++){let{$from:s,$to:i}=r[a],l=e.mapping.slice(o),c=l.map(s.pos),u=l.map(i.pos);a?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Yd(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let r=e.parent.inlineContent?new Se(e):Jo(e.node(0),e.parent,e.pos,e.index(),n,o);if(r)return r;for(let a=e.depth-1;a>=0;a--){let s=n<0?Jo(e.node(0),e.node(a),e.before(a+1),e.index(a),n,o):Jo(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,n,o);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Vn(e.node(0))}static atStart(e){return Jo(e,e,0,0,1)||new Vn(e)}static atEnd(e){return Jo(e,e,e.content.size,e.childCount,-1)||new Vn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=kl[n.type];if(!o)throw new RangeError(`No selection type ${n.type} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in kl)throw new RangeError("Duplicate use of selection JSON ID "+e);return kl[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Se.between(this.$anchor,this.$head).getBookmark()}};ye.prototype.visible=!0;class CE{constructor(e,n){this.$from=e,this.$to=n}}let Wd=!1;function Kd(t){!Wd&&!t.parent.inlineContent&&(Wd=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let Se=class Jr extends ye{constructor(e,n=e){Kd(e),Kd(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let o=e.resolve(n.map(this.head));if(!o.parent.inlineContent)return ye.near(o);let r=e.resolve(n.map(this.anchor));return new Jr(r.parent.inlineContent?r:o,o)}replace(e,n=te.empty){if(super.replace(e,n),n==te.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Jr&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Om(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Jr(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){let r=e.resolve(n);return new this(r,o==n?r:e.resolve(o))}static between(e,n,o){let r=e.pos-n.pos;if((!o||r)&&(o=r>=0?1:-1),!n.parent.inlineContent){let a=ye.findFrom(n,o,!0)||ye.findFrom(n,-o,!0);if(a)n=a.$head;else return ye.near(n,o)}return e.parent.inlineContent||(r==0?e=n:(e=(ye.findFrom(e,-o,!0)||ye.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new Jr(e,n)}};ye.jsonID("text",Se);let Om=class Rm{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Rm(e.map(this.anchor),e.map(this.head))}resolve(e){return Se.between(e.resolve(this.anchor),e.resolve(this.head))}},fe=class Xr extends ye{constructor(e){let n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);super(e,o),this.node=n}map(e,n){let{deleted:o,pos:r}=n.mapResult(this.anchor),a=e.resolve(r);return o?ye.near(a):new Xr(a)}content(){return new te(X.from(this.node),0,0)}eq(e){return e instanceof Xr&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Cu(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Xr(e.resolve(n.anchor))}static create(e,n){return new Xr(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};fe.prototype.visible=!1;ye.jsonID("node",fe);class Cu{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new Om(o,o):new Cu(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&fe.isSelectable(o)?new fe(n):ye.near(n)}}let Vn=class Us extends ye{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=te.empty){if(n==te.empty){e.delete(0,e.doc.content.size);let o=ye.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Us(e)}map(e){return new Us(e)}eq(e){return e instanceof Us}getBookmark(){return ME}};ye.jsonID("all",Vn);const ME={map(){return this},resolve(t){return new Vn(t)}};function Jo(t,e,n,o,r,a=!1){if(e.inlineContent)return Se.create(t,n);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let i=e.child(s);if(i.isAtom){if(!a&&fe.isSelectable(i))return fe.create(t,n-(r<0?i.nodeSize:0))}else{let l=Jo(t,i,n+r,r<0?i.childCount:0,r,a);if(l)return l}n+=i.nodeSize*r}return null}function Yd(t,e,n){let o=t.steps.length-1;if(o<e)return;let r=t.steps[o];if(!(r instanceof Jt||r instanceof kt))return;let a=t.mapping.maps[o],s;a.forEach((i,l,c,u)=>{s==null&&(s=u)}),t.setSelection(ye.near(t.doc.resolve(s),n))}const Jd=1,bs=2,Xd=4;class $E extends EE{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Jd)&~bs,this.storedMarks=null,this}get selectionSet(){return(this.updated&Jd)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=bs,this}ensureMarks(e){return Ie.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&bs)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~bs,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let o=this.selection;return n&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||Ie.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,o){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=n),!e)return this.deleteRange(n,o);let a=this.storedMarks;if(!a){let s=this.doc.resolve(n);a=o==n?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(n,o,r.text(e,a)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ye.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Xd,this}get scrolledIntoView(){return(this.updated&Xd)>0}}function Qd(t,e){return!e||!t?t:t.bind(e)}let Qr=class{constructor(e,n,o){this.name=e,this.init=Qd(n.init,o),this.apply=Qd(n.apply,o)}};const TE=[new Qr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Qr("selection",{init(t,e){return t.selection||ye.atStart(e.doc)},apply(t){return t.selection}}),new Qr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new Qr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];let El=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=TE.slice(),n&&n.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Qr(o.key,o.spec.state,o))})}},IE=class Zr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=n){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],o=this.applyInner(e),r=null;for(;;){let a=!1;for(let s=0;s<this.config.plugins.length;s++){let i=this.config.plugins[s];if(i.spec.appendTransaction){let l=r?r[s].n:0,c=r?r[s].state:this,u=l<n.length&&i.spec.appendTransaction.call(i,l?n.slice(l):n,c,o);if(u&&o.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let d=0;d<this.config.plugins.length;d++)r.push(d<s?{state:o,n:n.length}:{state:this,n:0})}n.push(u),o=o.applyInner(u),a=!0}r&&(r[s]={state:o,n:n.length})}}if(!a)return{state:o,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Zr(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let a=o[r];n[a.name]=a.apply(e,this[a.name],this,n)}return n}get tr(){return new $E(this)}static create(e){let n=new El(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new Zr(n);for(let r=0;r<n.fields.length;r++)o[n.fields[r].name]=n.fields[r].init(e,o);return o}reconfigure(e){let n=new El(this.schema,e.plugins),o=n.fields,r=new Zr(n);for(let a=0;a<o.length;a++){let s=o[a].name;r[s]=this.hasOwnProperty(s)?this[s]:o[a].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],a=r.spec.state;a&&a.toJSON&&(n[o]=a.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,o){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new El(e.schema,e.plugins),a=new Zr(r);return r.fields.forEach(s=>{if(s.name=="doc")a.doc=_n.fromJSON(e.schema,n.doc);else if(s.name=="selection")a.selection=ye.fromJSON(a.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(a.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let i in o){let l=o[i],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[s.name]=c.fromJSON.call(l,e,n[i],a);return}}a[s.name]=s.init(e,a)}}),a}};function Pm(t,e,n){for(let o in t){let r=t[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Pm(r,e,{})),n[o]=r}return n}let je=class{constructor(e){this.spec=e,this.props={},e.props&&Pm(e.props,this,this.props),this.key=e.key?e.key.key:Dm("plugin")}getState(e){return e[this.key]}};const Cl=Object.create(null);function Dm(t){return t in Cl?t+"$"+ ++Cl[t]:(Cl[t]=0,t+"$")}let Ze=class{constructor(e="key"){this.key=Dm(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};const Ye=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},fr=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let gc=null;const mn=function(t,e,n){let o=gc||(gc=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},AE=function(){gc=null},Io=function(t,e,n,o){return n&&(Zd(t,e,n,o,-1)||Zd(t,e,n,o,1))},xE=/^(img|br|input|textarea|hr)$/i;function Zd(t,e,n,o,r){for(var a;;){if(t==n&&e==o)return!0;if(e==(r<0?0:Ut(t))){let s=t.parentNode;if(!s||s.nodeType!=1||qa(t)||xE.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ye(t)+(r<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((a=s.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=r;else return!1;else t=s,e=r<0?Ut(t):0}else return!1}}function Ut(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function OE(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ut(t)}else if(t.parentNode&&!qa(t))e=Ye(t),t=t.parentNode;else return null}}function RE(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!qa(t))e=Ye(t)+1,t=t.parentNode;else return null}}function PE(t,e,n){for(let o=e==0,r=e==Ut(t);o||r;){if(t==n)return!0;let a=Ye(t);if(t=t.parentNode,!t)return!1;o=o&&a==0,r=r&&a==Ut(t)}}function qa(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Li=function(t){return t.focusNode&&Io(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function go(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function DE(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function NE(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(Ut(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(Ut(o.startContainer),o.startOffset)}}}const sn=typeof navigator<"u"?navigator:null,ep=typeof document<"u"?document:null,No=sn&&sn.userAgent||"",vc=/Edge\/(\d+)/.exec(No),Nm=/MSIE \d/.exec(No),yc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(No),bt=!!(Nm||yc||vc),zn=Nm?document.documentMode:yc?+yc[1]:vc?+vc[1]:0,zt=!bt&&/gecko\/(\d+)/i.test(No),_c=!bt&&/Chrome\/(\d+)/.exec(No),Xe=!!_c,Lm=_c?+_c[1]:0,ot=!bt&&!!sn&&/Apple Computer/.test(sn.vendor),mr=ot&&(/Mobile\/\w+/.test(No)||!!sn&&sn.maxTouchPoints>2),Lt=mr||(sn?/Mac/.test(sn.platform):!1),Um=sn?/Win/.test(sn.platform):!1,gn=/Android \d/.test(No),Ha=!!ep&&"webkitFontSmoothing"in ep.documentElement.style,LE=Ha?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function UE(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function fn(t,e){return typeof t=="number"?t:t[e]}function BE(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function tp(t,e,n){let o=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=fr(s);continue}let i=s,l=i==a.body,c=l?UE(a):BE(i),u=0,d=0;if(e.top<c.top+fn(o,"top")?d=-(c.top-e.top+fn(r,"top")):e.bottom>c.bottom-fn(o,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+fn(r,"top")-c.top:e.bottom-c.bottom+fn(r,"bottom")),e.left<c.left+fn(o,"left")?u=-(c.left-e.left+fn(r,"left")):e.right>c.right-fn(o,"right")&&(u=e.right-c.right+fn(r,"right")),u||d)if(l)a.defaultView.scrollBy(u,d);else{let h=i.scrollLeft,m=i.scrollTop;d&&(i.scrollTop+=d),u&&(i.scrollLeft+=u);let g=i.scrollLeft-h,v=i.scrollTop-m;e={left:e.left-g,top:e.top-v,right:e.right-g,bottom:e.bottom-v}}let p=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:fr(s)}}function FE(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,r;for(let a=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let i=t.root.elementFromPoint(a,s);if(!i||i==t.dom||!t.dom.contains(i))continue;let l=i.getBoundingClientRect();if(l.top>=n-20){o=i,r=l.top;break}}return{refDOM:o,refTop:r,stack:Bm(t.dom)}}function Bm(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=fr(o));return e}function jE({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;Fm(n,o==0?0:o-e)}function Fm(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:r,left:a}=t[n];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=a&&(o.scrollLeft=a)}}let Go=null;function GE(t){if(t.setActive)return t.setActive();if(Go)return t.focus(Go);let e=Bm(t);t.focus(Go==null?{get preventScroll(){return Go={preventScroll:!0},!0}}:void 0),Go||(Go=!1,Fm(e,0))}function jm(t,e){let n,o=2e8,r,a=0,s=e.top,i=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=mn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=s&&m.bottom>=i){s=Math.max(m.bottom,s),i=Math.min(m.top,i);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<o){n=u,o=g,r=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(a=d+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(a=d+1)}}return!n&&l&&(n=l,r=c,o=0),n&&n.nodeType==3?qE(n,r):!n||o&&n.nodeType==1?{node:t,offset:a}:jm(n,r)}function qE(t,e){let n=t.nodeValue.length,o=document.createRange(),r;for(let a=0;a<n;a++){o.setEnd(t,a+1),o.setStart(t,a);let s=Un(o,1);if(s.top!=s.bottom&&Mu(e,s)){r={node:t,offset:a+(e.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),r||{node:t,offset:0}}function Mu(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function HE(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function VE(t,e,n){let{node:o,offset:r}=jm(e,n),a=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,r,a)}function zE(t,e,n,o){let r=-1;for(let a=e,s=!1;a!=t.dom;){let i=t.docView.nearestDesc(a,!0),l;if(!i)return null;if(i.dom.nodeType==1&&(i.node.isBlock&&i.parent||!i.contentDOM)&&((l=i.dom.getBoundingClientRect()).width||l.height)&&(i.node.isBlock&&i.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(i.dom.nodeName)&&(!s&&l.left>o.left||l.top>o.top?r=i.posBefore:(!s&&l.right<o.left||l.bottom<o.top)&&(r=i.posAfter),s=!0),!i.contentDOM&&r<0&&!i.node.isText))return(i.node.isBlock?o.top<(l.top+l.bottom)/2:o.left<(l.left+l.right)/2)?i.posBefore:i.posAfter;a=i.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function Gm(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),a=r;;){let s=t.childNodes[a];if(s.nodeType==1){let i=s.getClientRects();for(let l=0;l<i.length;l++){let c=i[l];if(Mu(e,c))return Gm(s,e,c)}}if((a=(a+1)%o)==r)break}return t}function WE(t,e){let n=t.dom.ownerDocument,o,r=0,a=NE(n,e.left,e.top);a&&({node:o,offset:r}=a);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),i;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!Mu(e,c)||(s=Gm(t.dom,e,c),!s))return null}if(ot)for(let c=s;o&&c;c=fr(c))c.draggable&&(o=void 0);if(s=HE(s,e),o){if(zt&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&r++}let c;Ha&&r&&o.nodeType==1&&(c=o.childNodes[r-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&r--,o==t.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?i=t.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(i=zE(t,o,r,e))}i==null&&(i=VE(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:i,inside:l?l.posAtStart-l.border:-1}}function np(t){return t.top<t.bottom||t.left<t.right}function Un(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(np(o))return o}return Array.prototype.find.call(n,np)||t.getBoundingClientRect()}const KE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function qm(t,e,n){let{node:o,offset:r,atom:a}=t.docView.domFromPos(e,n<0?-1:1),s=Ha||zt;if(o.nodeType==3)if(s&&(KE.test(o.nodeValue)||(n<0?!r:r==o.nodeValue.length))){let i=Un(mn(o,r,r),n);if(zt&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let l=Un(mn(o,r-1,r-1),-1);if(l.top==i.top){let c=Un(mn(o,r,r+1),-1);if(c.top!=i.top)return Ur(c,c.left<l.left)}}return i}else{let i=r,l=r,c=n<0?1:-1;return n<0&&!r?(l++,c=-1):n>=0&&r==o.nodeValue.length?(i--,c=1):n<0?i--:l++,Ur(Un(mn(o,i,l),c),c<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&r&&(n<0||r==Ut(o))){let i=o.childNodes[r-1];if(i.nodeType==1)return Ml(i.getBoundingClientRect(),!1)}if(a==null&&r<Ut(o)){let i=o.childNodes[r];if(i.nodeType==1)return Ml(i.getBoundingClientRect(),!0)}return Ml(o.getBoundingClientRect(),n>=0)}if(a==null&&r&&(n<0||r==Ut(o))){let i=o.childNodes[r-1],l=i.nodeType==3?mn(i,Ut(i)-(s?0:1)):i.nodeType==1&&(i.nodeName!="BR"||!i.nextSibling)?i:null;if(l)return Ur(Un(l,1),!1)}if(a==null&&r<Ut(o)){let i=o.childNodes[r];for(;i.pmViewDesc&&i.pmViewDesc.ignoreForCoords;)i=i.nextSibling;let l=i?i.nodeType==3?mn(i,0,s?0:1):i.nodeType==1?i:null:null;if(l)return Ur(Un(l,-1),!0)}return Ur(Un(o.nodeType==3?mn(o):o,-n),n>=0)}function Ur(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Ml(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Hm(t,e,n){let o=t.state,r=t.root.activeElement;o!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),r!=t.dom&&r&&r.focus()}}function YE(t,e,n){let o=e.selection,r=n=="up"?o.$from:o.$to;return Hm(t,e,()=>{let{node:a}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let i=t.docView.nearestDesc(a,!0);if(!i)break;if(i.node.isBlock){a=i.contentDOM||i.dom;break}a=i.dom.parentNode}let s=qm(t,r.pos,1);for(let i=a.firstChild;i;i=i.nextSibling){let l;if(i.nodeType==1)l=i.getClientRects();else if(i.nodeType==3)l=mn(i,0,i.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const JE=/[\u0590-\u08ac]/;function XE(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,a=!r,s=r==o.parent.content.size,i=t.domSelection();return i?!JE.test(o.parent.textContent)||!i.modify?n=="left"||n=="backward"?a:s:Hm(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),p=i.caretBidiLevel;i.modify("move",n,"character");let h=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),v=m&&!h.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==g;try{i.collapse(u,d),l&&(l!=u||c!=d)&&i.extend&&i.extend(l,c)}catch{}return p!=null&&(i.caretBidiLevel=p),v}):o.pos==o.start()||o.pos==o.end()}let op=null,rp=null,ap=!1;function QE(t,e,n){return op==e&&rp==n?ap:(op=e,rp=n,ap=n=="up"||n=="down"?YE(t,e,n):XE(t,e,n))}const Bt=0,sp=1,yo=2,ln=3;let Va=class{constructor(e,n,o,r){this.parent=e,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=Bt,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,o=this.posAtStart;;n++){let r=this.children[n];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let a,s;if(e==this.contentDOM)a=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.previousSibling}for(;a&&!((s=a.pmViewDesc)&&s.parent==this);)a=a.previousSibling;return a?this.posBeforeChild(s)+s.size:this.posAtStart}else{let a,s;if(e==this.contentDOM)a=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.nextSibling}for(;a&&!((s=a.pmViewDesc)&&s.parent==this);)a=a.nextSibling;return a?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>Ye(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=e;;a=a.parentNode){if(a==this.dom){r=!1;break}if(a.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){r=!0;break}if(a.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,r=e;r;r=r.parentNode){let a=this.getDesc(r),s;if(a&&(!n||a.node))if(o&&(s=a.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return a}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let r=e;r;r=r.parentNode){let a=this.getDesc(r);if(a)return a.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let r=this.children[n],a=o+r.size;if(o==e&&a!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let i=r.children[s];if(i.size){r=i;break}}return r}if(e<a)return r.descAt(e-o-r.border);o=a}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let a=0;o<this.children.length;o++){let s=this.children[o],i=a+s.size;if(i>e||s instanceof Ym){r=e-a;break}a=i}if(r)return this.children[o].domFromPos(r-this.children[o].border,n);for(let a;o&&!(a=this.children[o-1]).size&&a instanceof Vm&&a.side>=0;o--);if(n<=0){let a,s=!0;for(;a=o?this.children[o-1]:null,!(!a||a.dom.parentNode==this.contentDOM);o--,s=!1);return a&&n&&s&&!a.border&&!a.domAtom?a.domFromPos(a.size,n):{node:this.contentDOM,offset:a?Ye(a.dom)+1:0}}else{let a,s=!0;for(;a=o<this.children.length?this.children[o]:null,!(!a||a.dom.parentNode==this.contentDOM);o++,s=!1);return a&&s&&!a.border&&!a.domAtom?a.domFromPos(0,n):{node:this.contentDOM,offset:a?Ye(a.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,a=-1;for(let s=o,i=0;;i++){let l=this.children[i],c=s+l.size;if(r==-1&&e<=c){let u=s+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=s;for(let d=i;d>0;d--){let p=this.children[d-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Ye(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(c>n||i==this.children.length-1)){n=c;for(let u=i+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){a=Ye(d.dom);break}n+=d.size}a==-1&&(a=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:a}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,r=!1){let a=Math.min(e,n),s=Math.max(e,n);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],v=m+g.size;if(a>m&&s<v)return g.setSelection(e-m-g.border,n-m-g.border,o,r);m=v}let i=this.domFromPos(e,e?-1:1),l=n==e?i:this.domFromPos(n,n?-1:1),c=o.root.getSelection(),u=o.domSelectionRange(),d=!1;if((zt||ot)&&e==n){let{node:h,offset:m}=i;if(h.nodeType==3){if(d=!!(m&&h.nodeValue[m-1]==`
|
||
`),d&&m==h.nodeValue.length)for(let g=h,v;g;g=g.parentNode){if(v=g.nextSibling){v.nodeName=="BR"&&(i=l={node:v.parentNode,offset:Ye(v)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[m-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(zt&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||d&&ot)&&Io(i.node,i.offset,u.anchorNode,u.anchorOffset)&&Io(l.node,l.offset,u.focusNode,u.focusOffset))return;let p=!1;if((c.extend||e==n)&&!(d&&zt)){c.collapse(i.node,i.offset);try{e!=n&&c.extend(l.node,l.offset),p=!0}catch{}}if(!p){if(e>n){let m=i;i=l,l=m}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(i.node,i.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let o=0,r=0;r<this.children.length;r++){let a=this.children[r],s=o+a.size;if(o==s?e<=s&&n>=o:e<s&&n>o){let i=o+a.border,l=s-a.border;if(e>=i&&n<=l){this.dirty=e==o||n==s?yo:sp,e==i&&n==l&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=ln:a.markDirty(e-i,n-i);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?yo:ln}o=s}this.dirty=yo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?yo:sp;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}};class Vm extends Va{constructor(e,n,o,r){let a,s=n.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!a)return r;if(a.parent)return a.parent.posBeforeChild(a)})),!n.type.spec.raw){if(s.nodeType!=1){let i=document.createElement("span");i.appendChild(s),s=i}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,a=this}matchesWidget(e){return this.dirty==Bt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ZE extends Va{constructor(e,n,o,r){super(e,[],n,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}let ri=class bc extends Va{constructor(e,n,o,r,a){super(e,[],o,r),this.mark=n,this.spec=a}static create(e,n,o,r){let a=r.nodeViews[n.type.name],s=a&&a(n,r,o);return(!s||!s.dom)&&(s=ja.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new bc(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&ln||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ln&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Bt){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=Bt}}slice(e,n,o){let r=bc.create(this.parent,this.mark,!0,o),a=this.children,s=this.size;n<s&&(a=Sc(a,n,s,o)),e>0&&(a=Sc(a,0,e,o));for(let i=0;i<a.length;i++)a[i].parent=r;return r.children=a,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},ir=class zm extends Va{constructor(e,n,o,r,a,s,i,l,c){super(e,[],a,s),this.node=n,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=i}static create(e,n,o,r,a,s){let i=a.nodeViews[n.type.name],l,c=i&&i(n,a,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},o,r),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=ja.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let p=u;return u=Qm(u,o,n),c?l=new e1(e,n,o,r,u,d||null,p,c,a,s+1):n.isText?new Wm(e,n,o,r,u,p,a):new zm(e,n,o,r,u,d||null,p,a,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>X.empty)}return e}matchesNode(e,n,o){return this.dirty==Bt&&e.eq(this.node)&&ai(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,r=n,a=e.composing?this.localCompositionInfo(e,n):null,s=a&&a.pos>-1?a:null,i=a&&a.pos<0,l=new n1(this,s&&s.node,e);a1(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,o,e,u):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Ie.none:this.node.child(u).marks,o,e,u),l.placeWidget(c,e,r)},(c,u,d,p)=>{l.syncToMarks(c.marks,o,e,p);let h;l.findNodeMatch(c,u,d,p)||i&&e.state.selection.from>r&&e.state.selection.to<r+c.nodeSize&&(h=l.findIndexWithChild(a.node))>-1&&l.updateNodeAt(c,u,d,h,e)||l.updateNextNode(c,u,d,e,p,r)||l.addNode(c,u,d,e,r),r+=c.nodeSize}),l.syncToMarks([],o,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==yo)&&(s&&this.protectLocalComposition(e,s),Jm(this.contentDOM,this.children,e),mr&&s1(this.dom))}localCompositionInfo(e,n){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof Se)||o<n||r>n+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let s=a.nodeValue,i=i1(this.node.content,s,o-n,r-n);return i<0?null:{node:a,pos:i,text:s}}else return{node:a,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:r}){if(this.getDesc(n))return;let a=n;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let s=new ZE(this,a,n,r);e.input.compositionNodes.push(s),this.children=Sc(this.children,o,o+r.length,e,s)}update(e,n,o,r){return this.dirty==ln||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,r),!0)}updateInner(e,n,o,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Bt}updateOuterDeco(e){if(ai(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=Xm(this.dom,this.nodeDOM,wc(this.outerDeco,this.node,n),wc(e,this.node,n)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function ip(t,e,n,o,r){Qm(o,e,t);let a=new ir(void 0,t,e,n,o,o,o,r,0);return a.contentDOM&&a.updateChildren(r,0),a}let Wm=class Km extends ir{constructor(e,n,o,r,a,s,i){super(e,n,o,r,a,null,s,i,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,o,r){return this.dirty==ln||this.dirty!=Bt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Bt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Bt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let r=this.node.cut(e,n),a=document.createTextNode(r.text);return new Km(this.parent,r,this.outerDeco,this.innerDeco,a,a,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ln)}get domAtom(){return!1}isText(e){return this.node.text==e}};class Ym extends Va{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Bt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class e1 extends ir{constructor(e,n,o,r,a,s,i,l,c,u){super(e,n,o,r,a,s,i,c,u),this.spec=l}update(e,n,o,r){if(this.dirty==ln)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let a=this.spec.update(e,n,o);return a&&this.updateInner(e,n,o,r),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,r){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Jm(t,e,n){let o=t.firstChild,r=!1;for(let a=0;a<e.length;a++){let s=e[a],i=s.dom;if(i.parentNode==t){for(;i!=o;)o=lp(o),r=!0;o=o.nextSibling}else r=!0,t.insertBefore(i,o);if(s instanceof ri){let l=o?o.previousSibling:t.lastChild;Jm(s.contentDOM,s.children,n),o=l?l.nextSibling:t.firstChild}}for(;o;)o=lp(o),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const da=function(t){t&&(this.nodeName=t)};da.prototype=Object.create(null);const _o=[new da];function wc(t,e,n){if(t.length==0)return _o;let o=n?_o[0]:new da,r=[o];for(let a=0;a<t.length;a++){let s=t[a].type.attrs;if(s){s.nodeName&&r.push(o=new da(s.nodeName));for(let i in s){let l=s[i];l!=null&&(n&&r.length==1&&r.push(o=new da(e.isInline?"span":"div")),i=="class"?o.class=(o.class?o.class+" ":"")+l:i=="style"?o.style=(o.style?o.style+";":"")+l:i!="nodeName"&&(o[i]=l))}}}return r}function Xm(t,e,n,o){if(n==_o&&o==_o)return e;let r=e;for(let a=0;a<o.length;a++){let s=o[a],i=n[a];if(a){let l;i&&i.nodeName==s.nodeName&&r!=t&&(l=r.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(r),i=_o[0]),r=l}t1(r,i||_o[0],s)}return r}function t1(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let a=0;a<o.length;a++)r.indexOf(o[a])==-1&&t.classList.remove(o[a]);for(let a=0;a<r.length;a++)o.indexOf(r[a])==-1&&t.classList.add(r[a]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function Qm(t,e,n){return Xm(t,t,_o,wc(e,n,t.nodeType!=1))}function ai(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function lp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class n1{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=o1(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o,r){let a=0,s=this.stack.length>>1,i=Math.min(s,e.length);for(;a<i&&(a==s-1?this.top:this.stack[a+1<<1]).matchesMark(e[a])&&e[a].type.spec.spanning!==!1;)a++;for(;a<s;)this.destroyRest(),this.top.dirty=Bt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;r<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=ri.create(this.top,e[s],n,o);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,o,r){let a=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,o))a=this.top.children.indexOf(s,this.index);else for(let i=this.index,l=Math.min(this.top.children.length,i+5);i<l;i++){let c=this.top.children[i];if(c.matchesNode(e,n,o)&&!this.preMatch.matched.has(c)){a=i;break}}return a<0?!1:(this.destroyBetween(this.index,a),this.index++,!0)}updateNodeAt(e,n,o,r,a){let s=this.top.children[r];return s.dirty==ln&&s.dom==s.contentDOM&&(s.dirty=yo),s.update(e,n,o,a)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=n}}updateNextNode(e,n,o,r,a,s){for(let i=this.index;i<this.top.children.length;i++){let l=this.top.children[i];if(l instanceof ir){let c=this.preMatch.matched.get(l);if(c!=null&&c!=a)return!1;let u=l.dom,d,p=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=ln&&ai(n,l.outerDeco));if(!p&&l.update(e,n,o,r))return this.destroyBetween(this.index,i),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(d=this.recreateWrapper(l,e,n,o,r,s)))return this.destroyBetween(this.index,i),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=yo,d.updateChildren(r,s+1),d.dirty=Bt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,r,a,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!ai(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let i=ir.create(this.top,n,o,r,a,s);if(i.contentDOM){i.children=e.children,e.children=[];for(let l of i.children)l.parent=i}return e.destroy(),i}addNode(e,n,o,r,a){let s=ir.create(this.top,e,n,o,r,a);s.contentDOM&&s.updateChildren(r,a+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let a=new Vm(this.top,e,n,o);this.top.children.splice(this.index++,0,a),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ri;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Wm)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ot||Xe)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new Ym(this.top,[],o,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function o1(t,e){let n=e,o=n.children.length,r=t.childCount,a=new Map,s=[];e:for(;r>0;){let i;for(;;)if(o){let c=n.children[o-1];if(c instanceof ri)n=c,o=c.children.length;else{i=c,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let l=i.node;if(l){if(l!=t.child(r-1))break;--r,a.set(i,r),s.push(i)}}return{index:r,matched:a,matches:s.reverse()}}function r1(t,e){return t.type.side-e.type.side}function a1(t,e,n,o){let r=e.locals(t),a=0;if(r.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);o(u,r,e.forChild(a,u),c),a+=u.nodeSize}return}let s=0,i=[],l=null;for(let c=0;;){let u,d;for(;s<r.length&&r[s].to==a;){let v=r[s++];v.widget&&(u?(d||(d=[u])).push(v):u=v)}if(u)if(d){d.sort(r1);for(let v=0;v<d.length;v++)n(d[v],c,!!l)}else n(u,c,!!l);let p,h;if(l)h=-1,p=l,l=null;else if(c<t.childCount)h=c,p=t.child(c++);else break;for(let v=0;v<i.length;v++)i[v].to<=a&&i.splice(v--,1);for(;s<r.length&&r[s].from<=a&&r[s].to>a;)i.push(r[s++]);let m=a+p.nodeSize;if(p.isText){let v=m;s<r.length&&r[s].from<v&&(v=r[s].from);for(let b=0;b<i.length;b++)i[b].to<v&&(v=i[b].to);v<m&&(l=p.cut(v-a),p=p.cut(0,v-a),m=v,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let g=p.isInline&&!p.isLeaf?i.filter(v=>!v.inline):i.slice();o(p,g,e.forChild(a,p),h),a=m}}function s1(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function i1(t,e,n,o){for(let r=0,a=0;r<t.childCount&&a<=o;){let s=t.child(r++),i=a;if(a+=s.nodeSize,!s.isText)continue;let l=s.text;for(;r<t.childCount;){let c=t.child(r++);if(a+=c.nodeSize,!c.isText)break;l+=c.text}if(a>=n){if(a>=o&&l.slice(o-e.length-i,o-i)==e)return o-e.length;let c=i<o?l.lastIndexOf(e,o-i-1):-1;if(c>=0&&c+e.length+i>=n)return i+c;if(n==o&&l.length>=o+e.length-i&&l.slice(o-i,o-i+e.length)==e)return o}}return-1}function Sc(t,e,n,o,r){let a=[];for(let s=0,i=0;s<t.length;s++){let l=t[s],c=i,u=i+=l.size;c>=n||u<=e?a.push(l):(c<e&&a.push(l.slice(0,e-c,o)),r&&(a.push(r),r=void 0),u>n&&a.push(l.slice(n-c,l.size,o)))}return a}function $u(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),a=r&&r.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let i=o.resolve(s),l,c;if(Li(n)){for(l=s;r&&!r.node;)r=r.parent;let d=r.node;if(r&&d.isAtom&&fe.isSelectable(d)&&r.parent&&!(d.isInline&&PE(n.focusNode,n.focusOffset,r.dom))){let p=r.posBefore;c=new fe(s==p?i:o.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,p=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,s]=p==t.state.selection.anchor?[p,d]:[d,p],i=o.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=o.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<i.pos&&!a?1:-1;c=Tu(t,u,i,d)}return c}function Zm(t){return t.editable?t.hasFocus():tg(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function bn(t,e=!1){let n=t.state.selection;if(eg(t,n),!!Zm(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Xe){let o=t.domSelectionRange(),r=t.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&Io(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)c1(t);else{let{anchor:o,head:r}=n,a,s;cp&&!(n instanceof Se)&&(n.$from.parent.inlineContent||(a=up(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=up(t,n.to))),t.docView.setSelection(o,r,t,e),cp&&(a&&dp(a),s&&dp(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&l1(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const cp=ot||Xe&&Lm<63;function up(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),r=o<n.childNodes.length?n.childNodes[o]:null,a=o?n.childNodes[o-1]:null;if(ot&&r&&r.contentEditable=="false")return $l(r);if((!r||r.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(r)return $l(r);if(a)return $l(a)}}function $l(t){return t.contentEditable="true",ot&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function dp(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function l1(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Zm(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function c1(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,o=n.nodeName=="IMG";o?e.collapse(n.parentNode,Ye(n)+1):e.collapse(n,0),!o&&!t.state.selection.visible&&bt&&zn<=11&&(n.disabled=!0,n.disabled=!1)}function eg(t,e){if(e instanceof fe){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(pp(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else pp(t)}function pp(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Tu(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Se.between(e,n,o)}function hp(t){return t.editable&&!t.hasFocus()?!1:tg(t)}function tg(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function u1(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Io(e.node,e.offset,n.anchorNode,n.anchorOffset)}function kc(t,e){let{$anchor:n,$head:o}=t.selection,r=e>0?n.max(o):n.min(o),a=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return a&&ye.findFrom(a,e)}function jn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function fp(t,e,n){let o=t.state.selection;if(o instanceof Se)if(n.indexOf("s")>-1){let{$head:r}=o,a=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let s=t.state.doc.resolve(r.pos+a.nodeSize*(e<0?-1:1));return jn(t,new Se(o.$anchor,s))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=kc(t.state,e);return r&&r instanceof fe?jn(t,r):!1}else if(!(Lt&&n.indexOf("m")>-1)){let r=o.$head,a=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!a||a.isText)return!1;let i=e<0?r.pos-a.nodeSize:r.pos;return a.isAtom||(s=t.docView.descAt(i))&&!s.contentDOM?fe.isSelectable(a)?jn(t,new fe(e<0?t.state.doc.resolve(r.pos-a.nodeSize):r)):Ha?jn(t,new Se(t.state.doc.resolve(e<0?i:i+a.nodeSize))):!1:!1}}else return!1;else{if(o instanceof fe&&o.node.isInline)return jn(t,new Se(e>0?o.$to:o.$from));{let r=kc(t.state,e);return r?jn(t,r):!1}}}function si(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function pa(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function qo(t,e){return e<0?d1(t):p1(t)}function d1(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r,a,s=!1;for(zt&&n.nodeType==1&&o<si(n)&&pa(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(n.nodeType!=1)break;{let i=n.childNodes[o-1];if(pa(i,-1))r=n,a=--o;else if(i.nodeType==3)n=i,o=n.nodeValue.length;else break}}else{if(ng(n))break;{let i=n.previousSibling;for(;i&&pa(i,-1);)r=n.parentNode,a=Ye(i),i=i.previousSibling;if(i)n=i,o=si(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}s?Ec(t,n,o):r&&Ec(t,r,a)}function p1(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r=si(n),a,s;for(;;)if(o<r){if(n.nodeType!=1)break;let i=n.childNodes[o];if(pa(i,1))a=n,s=++o;else break}else{if(ng(n))break;{let i=n.nextSibling;for(;i&&pa(i,1);)a=i.parentNode,s=Ye(i)+1,i=i.nextSibling;if(i)n=i,o=0,r=si(n);else{if(n=n.parentNode,n==t.dom)break;o=r=0}}}a&&Ec(t,a,s)}function ng(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function h1(t,e){for(;t&&e==t.childNodes.length&&!qa(t);)e=Ye(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function f1(t,e){for(;t&&!e&&!qa(t);)e=Ye(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Ec(t,e,n){if(e.nodeType!=3){let a,s;(s=h1(e,n))?(e=s,n=0):(a=f1(e,n))&&(e=a,n=a.nodeValue.length)}let o=t.domSelection();if(!o)return;if(Li(o)){let a=document.createRange();a.setEnd(e,n),a.setStart(e,n),o.removeAllRanges(),o.addRange(a)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&bn(t)},50)}function mp(t,e){let n=t.state.doc.resolve(e);if(!(Xe||Um)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let r=t.coordsAtPos(e-1),a=(r.top+r.bottom)/2;if(a>o.top&&a<o.bottom&&Math.abs(r.left-o.left)>1)return r.left<o.left?"ltr":"rtl"}if(e<n.end()){let r=t.coordsAtPos(e+1),a=(r.top+r.bottom)/2;if(a>o.top&&a<o.bottom&&Math.abs(r.left-o.left)>1)return r.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function gp(t,e,n){let o=t.state.selection;if(o instanceof Se&&!o.empty||n.indexOf("s")>-1||Lt&&n.indexOf("m")>-1)return!1;let{$from:r,$to:a}=o;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=kc(t.state,e);if(s&&s instanceof fe)return jn(t,s)}if(!r.parent.inlineContent){let s=e<0?r:a,i=o instanceof Vn?ye.near(s,e):ye.findFrom(s,e);return i?jn(t,i):!1}return!1}function vp(t,e){if(!(t.state.selection instanceof Se))return!0;let{$head:n,$anchor:o,empty:r}=t.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let s=t.state.tr;return e<0?s.delete(n.pos-a.nodeSize,n.pos):s.delete(n.pos,n.pos+a.nodeSize),t.dispatch(s),!0}return!1}function yp(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function m1(t){if(!ot||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;yp(t,o,"true"),setTimeout(()=>yp(t,o,"false"),20)}return!1}function g1(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function v1(t,e){let n=e.keyCode,o=g1(e);if(n==8||Lt&&n==72&&o=="c")return vp(t,-1)||qo(t,-1);if(n==46&&!e.shiftKey||Lt&&n==68&&o=="c")return vp(t,1)||qo(t,1);if(n==13||n==27)return!0;if(n==37||Lt&&n==66&&o=="c"){let r=n==37?mp(t,t.state.selection.from)=="ltr"?-1:1:-1;return fp(t,r,o)||qo(t,r)}else if(n==39||Lt&&n==70&&o=="c"){let r=n==39?mp(t,t.state.selection.from)=="ltr"?1:-1:1;return fp(t,r,o)||qo(t,r)}else{if(n==38||Lt&&n==80&&o=="c")return gp(t,-1,o)||qo(t,-1);if(n==40||Lt&&n==78&&o=="c")return m1(t)||gp(t,1,o)||qo(t,1);if(o==(Lt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Iu(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:o,openStart:r,openEnd:a}=e;for(;r>1&&a>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,a--;let h=o.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=t.someProp("clipboardSerializer")||ja.fromSchema(t.state.schema),i=lg(),l=i.createElement("div");l.appendChild(s.serializeFragment(o,{document:i}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=ig[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=i.createElement(u[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${r} ${a}${d?` -${d}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
||
|
||
`);return{dom:l,text:p,slice:e}}function og(t,e,n,o,r){let a=r.parent.type.spec.code,s,i;if(!n&&!e)return null;let l=!!e&&(o||a||!n);if(l){if(t.someProp("transformPastedText",p=>{e=p(e,a||o,t)}),a)return i=new te(X.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
||
`))),0,0),t.someProp("transformPasted",p=>{i=p(i,t,!0)}),i;let d=t.someProp("clipboardTextParser",p=>p(e,r,o,t));if(d)i=d;else{let p=r.marks(),{schema:h}=t.state,m=ja.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let v=s.appendChild(document.createElement("p"));g&&v.appendChild(m.serializeNode(h.text(g,p)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=w1(n),Ha&&S1(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(i||(i=(t.someProp("clipboardParser")||t.someProp("domParser")||ca.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:r,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!y1.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)i=k1(_p(i,+u[1],+u[2]),u[4]);else if(i=te.maxOpen(_1(i.content,r),!0),i.openStart||i.openEnd){let d=0,p=0;for(let h=i.content.firstChild;d<i.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=i.content.lastChild;p<i.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);i=_p(i,d,p)}return t.someProp("transformPasted",d=>{i=d(i,t,l)}),i}const y1=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function _1(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),r,a=[];if(t.forEach(s=>{if(!a)return;let i=o.findWrapping(s.type),l;if(!i)return a=null;if(l=a.length&&r.length&&ag(i,r,s,a[a.length-1],0))a[a.length-1]=l;else{a.length&&(a[a.length-1]=sg(a[a.length-1],r.length));let c=rg(s,i);a.push(c),o=o.matchType(c.type),r=i}}),a)return X.from(a)}return t}function rg(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,X.from(t));return t}function ag(t,e,n,o,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let a=ag(t,e,n,o.lastChild,r+1);if(a)return o.copy(o.content.replaceChild(o.childCount-1,a));if(o.contentMatchAt(o.childCount).matchType(r==t.length-1?n.type:t[r+1]))return o.copy(o.content.append(X.from(rg(n,t,r+1))))}}function sg(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,sg(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(X.empty,!0);return t.copy(n.append(o))}function Cc(t,e,n,o,r,a){let s=e<0?t.firstChild:t.lastChild,i=s.content;return t.childCount>1&&(a=0),r<o-1&&(i=Cc(i,e,n,o,r+1,a)),r>=n&&(i=e<0?s.contentMatchAt(0).fillBefore(i,a<=r).append(i):i.append(s.contentMatchAt(s.childCount).fillBefore(X.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(i))}function _p(t,e,n){return e<t.openStart&&(t=new te(Cc(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new te(Cc(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const ig={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let bp=null;function lg(){return bp||(bp=document.implementation.createHTMLDocument("title"))}let Tl=null;function b1(t){let e=window.trustedTypes;return e?(Tl||(Tl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Tl.createHTML(t)):t}function w1(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=lg().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),r;if((r=o&&ig[o[1].toLowerCase()])&&(t=r.map(a=>"<"+a+">").join("")+t+r.map(a=>"</"+a+">").reverse().join("")),n.innerHTML=b1(t),r)for(let a=0;a<r.length;a++)n=n.querySelector(r[a])||n;return n}function S1(t){let e=t.querySelectorAll(Xe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function k1(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:r,openStart:a,openEnd:s}=t;for(let i=o.length-2;i>=0;i-=2){let l=n.nodes[o[i]];if(!l||l.hasRequiredAttrs())break;r=X.from(l.create(o[i+1],r)),a++,s++}return new te(r,a,s)}const mt={},gt={},E1={touchstart:!0,touchmove:!0};class C1{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function M1(t){for(let e in mt){let n=mt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{T1(t,o)&&!Au(t,o)&&(t.editable||!(o.type in gt))&&n(t,o)},E1[e]?{passive:!0}:void 0)}ot&&t.dom.addEventListener("input",()=>null),Mc(t)}function Hn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function $1(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Mc(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>Au(t,o))})}function Au(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function T1(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function I1(t,e){!Au(t,e)&&mt[e.type]&&(t.editable||!(e.type in gt))&&mt[e.type](t,e)}gt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!ug(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(gn&&Xe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),mr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",r=>r(t,go(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||v1(t,n)?n.preventDefault():Hn(t,"key")};gt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};gt.keypress=(t,e)=>{let n=e;if(ug(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Lt&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof Se)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(n.charCode),a=()=>t.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",s=>s(t,o.$from.pos,o.$to.pos,r,a))&&t.dispatch(a()),n.preventDefault()}};function Ui(t){return{left:t.clientX,top:t.clientY}}function A1(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function xu(t,e,n,o,r){if(o==-1)return!1;let a=t.state.doc.resolve(o);for(let s=a.depth+1;s>0;s--)if(t.someProp(e,i=>s>a.depth?i(t,n,a.nodeAfter,a.before(s),r,!0):i(t,n,a.node(s),a.before(s),r,!1)))return!0;return!1}function lr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function x1(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&fe.isSelectable(o)?(lr(t,new fe(n)),!0):!1}function O1(t,e){if(e==-1)return!1;let n=t.state.selection,o,r;n instanceof fe&&(o=n.node);let a=t.state.doc.resolve(e);for(let s=a.depth+1;s>0;s--){let i=s>a.depth?a.nodeAfter:a.node(s);if(fe.isSelectable(i)){o&&n.$from.depth>0&&s>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?r=a.before(n.$from.depth):r=a.before(s);break}}return r!=null?(lr(t,fe.create(t.state.doc,r)),!0):!1}function R1(t,e,n,o,r){return xu(t,"handleClickOn",e,n,o)||t.someProp("handleClick",a=>a(t,e,o))||(r?O1(t,n):x1(t,n))}function P1(t,e,n,o){return xu(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",r=>r(t,e,o))}function D1(t,e,n,o){return xu(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",r=>r(t,e,o))||N1(t,n,o)}function N1(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(lr(t,Se.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let a=r.depth+1;a>0;a--){let s=a>r.depth?r.nodeAfter:r.node(a),i=r.before(a);if(s.inlineContent)lr(t,Se.create(o,i+1,i+1+s.content.size));else if(fe.isSelectable(s))lr(t,fe.create(o,i));else continue;return!0}}function Ou(t){return ii(t)}const cg=Lt?"metaKey":"ctrlKey";mt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=Ou(t),r=Date.now(),a="singleClick";r-t.input.lastClick.time<500&&A1(n,t.input.lastClick)&&!n[cg]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:a,button:n.button};let s=t.posAtCoords(Ui(n));s&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new L1(t,s,n,!!o)):(a=="doubleClick"?P1:D1)(t,s.pos,s.inside,n)?n.preventDefault():Hn(t,"pointer"))};class L1{constructor(e,n,o,r){this.view=e,this.pos=n,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[cg],this.allowDefault=o.shiftKey;let a,s;if(n.inside>-1)a=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);a=u.parent,s=u.depth?u.before():0}const i=r?null:o.target,l=i?e.docView.nearestDesc(i,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(o.button==0&&a.type.spec.draggable&&a.type.spec.selectable!==!1||c instanceof fe&&c.from<=s&&c.to>s)&&(this.mightDrag={node:a,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&zt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Hn(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>bn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ui(e))),this.updateAllowDefault(e),this.allowDefault||!n?Hn(this.view,"pointer"):R1(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ot&&this.mightDrag&&!this.mightDrag.node.isAtom||Xe&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(lr(this.view,ye.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Hn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Hn(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}mt.touchstart=t=>{t.input.lastTouch=Date.now(),Ou(t),Hn(t,"pointer")};mt.touchmove=t=>{t.input.lastTouch=Date.now(),Hn(t,"pointer")};mt.contextmenu=t=>Ou(t);function ug(t,e){return t.composing?!0:ot&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const U1=gn?5e3:-1;gt.compositionstart=gt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Se&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||Xe&&Um&&B1(t)))t.markCursor=t.state.storedMarks||n.marks(),ii(t,!0),t.markCursor=null;else if(ii(t,!e.selection.empty),zt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let r=o.focusNode,a=o.focusOffset;r&&r.nodeType==1&&a!=0;){let s=a<0?r.lastChild:r.childNodes[a-1];if(!s)break;if(s.nodeType==3){let i=t.domSelection();i&&i.collapse(s,s.nodeValue.length);break}else r=s,a=-1}}t.input.composing=!0}dg(t,U1)};function B1(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let o=e.childNodes[n];return o.nodeType==1&&o.contentEditable=="false"}gt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,dg(t,20))};function dg(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ii(t),e))}function pg(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=j1());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function F1(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=OE(e.focusNode,e.focusOffset),o=RE(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let r=o.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(n==a||o==a)return a;if(!r||!r.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return o}}return n||o}function j1(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ii(t,e=!1){if(!(gn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),pg(t),e||t.docView&&t.docView.dirty){let n=$u(t),o=t.state.selection;return n&&!n.eq(o)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function G1(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ba=bt&&zn<15||mr&&LE<604;mt.copy=gt.cut=(t,e)=>{let n=e,o=t.state.selection,r=n.type=="cut";if(o.empty)return;let a=ba?null:n.clipboardData,s=o.content(),{dom:i,text:l}=Iu(t,s);a?(n.preventDefault(),a.clearData(),a.setData("text/html",i.innerHTML),a.setData("text/plain",l)):G1(t,i),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function q1(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function H1(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?wa(t,o.value,null,r,e):wa(t,o.textContent,o.innerHTML,r,e)},50)}function wa(t,e,n,o,r){let a=og(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,r,a||te.empty)))return!0;if(!a)return!1;let s=q1(a),i=s?t.state.tr.replaceSelectionWith(s,o):t.state.tr.replaceSelection(a);return t.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function hg(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}gt.paste=(t,e)=>{let n=e;if(t.composing&&!gn)return;let o=ba?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&wa(t,hg(o),o.getData("text/html"),r,n)?n.preventDefault():H1(t,n)};class fg{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const V1=Lt?"altKey":"ctrlKey";function mg(t,e){return t.someProp("dragCopies",o=>!o(e))??!e[V1]}mt.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r=t.state.selection,a=r.empty?null:t.posAtCoords(Ui(n)),s;if(!(a&&a.pos>=r.from&&a.pos<=(r instanceof fe?r.to-1:r.to))){if(o&&o.mightDrag)s=fe.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=fe.create(t.state.doc,d.posBefore))}}let i=(s||t.state.selection).content(),{dom:l,text:c,slice:u}=Iu(t,i);(!n.dataTransfer.files.length||!Xe||Lm>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ba?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ba||n.dataTransfer.setData("text/plain",c),t.dragging=new fg(u,mg(t,n),s)};mt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};gt.dragover=gt.dragenter=(t,e)=>e.preventDefault();gt.drop=(t,e)=>{try{z1(t,e,t.dragging)}finally{t.dragging=null}};function z1(t,e,n){if(!e.dataTransfer)return;let o=t.posAtCoords(Ui(e));if(!o)return;let r=t.state.doc.resolve(o.pos),a=n&&n.slice;a?t.someProp("transformPasted",h=>{a=h(a,t,!1)}):a=og(t,hg(e.dataTransfer),ba?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(n&&mg(t,e));if(t.someProp("handleDrop",h=>h(t,e,a||te.empty,s))){e.preventDefault();return}if(!a)return;e.preventDefault();let i=a?Cm(t.state.doc,r.pos,a):r.pos;i==null&&(i=r.pos);let l=t.state.tr;if(s){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let c=l.mapping.map(i),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=l.doc;if(u?l.replaceRangeWith(c,c,a.content.firstChild):l.replaceRange(c,c,a),l.doc.eq(d))return;let p=l.doc.resolve(c);if(u&&fe.isSelectable(a.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(a.content.firstChild))l.setSelection(new fe(p));else{let h=l.mapping.map(i);l.mapping.maps[l.mapping.maps.length-1].forEach((m,g,v,b)=>h=b),l.setSelection(Tu(t,p,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}mt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&bn(t)},20))};mt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};mt.beforeinput=(t,e)=>{if(Xe&&gn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",r=>r(t,go(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in gt)mt[t]=gt[t];function Sa(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}let wp=class gg{constructor(e,n){this.toDOM=e,this.spec=n||So,this.side=this.spec.side||0}map(e,n,o,r){let{pos:a,deleted:s}=e.mapResult(n.from+r,this.side<0?-1:1);return s?null:new An(a-o,a-o,this)}valid(){return!0}eq(e){return this==e||e instanceof gg&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Sa(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},ha=class $c{constructor(e,n){this.attrs=e,this.spec=n||So}map(e,n,o,r){let a=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-o;return a>=s?null:new An(a,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof $c&&Sa(this.attrs,e.attrs)&&Sa(this.spec,e.spec)}static is(e){return e.type instanceof $c}destroy(){}},W1=class vg{constructor(e,n){this.attrs=e,this.spec=n||So}map(e,n,o,r){let a=e.mapResult(n.from+r,1);if(a.deleted)return null;let s=e.mapResult(n.to+r,-1);return s.deleted||s.pos<=a.pos?null:new An(a.pos-o,s.pos-o,this)}valid(e,n){let{index:o,offset:r}=e.content.findIndex(n.from),a;return r==n.from&&!(a=e.child(o)).isText&&r+a.nodeSize==n.to}eq(e){return this==e||e instanceof vg&&Sa(this.attrs,e.attrs)&&Sa(this.spec,e.spec)}destroy(){}},An=class ea{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new ea(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new ea(e,e,new wp(n,o))}static inline(e,n,o,r){return new ea(e,n,new ha(o,r))}static node(e,n,o,r){return new ea(e,n,new W1(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof ha}get widget(){return this.type instanceof wp}};const Xo=[],So={};let At=class Bn{constructor(e,n){this.local=e.length?e:Xo,this.children=n.length?n:Xo}static create(e,n){return n.length?li(n,e,0,So):tt}find(e,n,o){let r=[];return this.findInner(e??0,n??1e9,r,0,o),r}findInner(e,n,o,r,a){for(let s=0;s<this.local.length;s++){let i=this.local[s];i.from<=n&&i.to>=e&&(!a||a(i.spec))&&o.push(i.copy(i.from+r,i.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let i=this.children[s]+1;this.children[s+2].findInner(e-i,n-i,o,r+i,a)}}map(e,n,o){return this==tt||e.maps.length==0?this:this.mapInner(e,n,0,0,o||So)}mapInner(e,n,o,r,a){let s;for(let i=0;i<this.local.length;i++){let l=this.local[i].map(e,o,r);l&&l.type.valid(n,l)?(s||(s=[])).push(l):a.onRemove&&a.onRemove(this.local[i].spec)}return this.children.length?K1(this.children,s||[],e,n,o,r,a):s?new Bn(s.sort(ko),Xo):tt}add(e,n){return n.length?this==tt?Bn.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let r,a=0;e.forEach((i,l)=>{let c=l+o,u;if(u=bg(n,i,c)){for(r||(r=this.children.slice());a<r.length&&r[a]<l;)a+=3;r[a]==l?r[a+2]=r[a+2].addInner(i,u,c+1):r.splice(a,0,l,l+i.nodeSize,li(u,i,c+1,So)),a+=3}});let s=_g(a?wg(n):n,-o);for(let i=0;i<s.length;i++)s[i].type.valid(e,s[i])||s.splice(i--,1);return new Bn(s.length?this.local.concat(s).sort(ko):this.local,r||this.children)}remove(e){return e.length==0||this==tt?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,r=this.local;for(let a=0;a<o.length;a+=3){let s,i=o[a]+n,l=o[a+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>i&&d.to<l&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;o==this.children&&(o=this.children.slice());let c=o[a+2].removeInner(s,i+1);c!=tt?o[a+2]=c:(o.splice(a,3),a-=3)}if(r.length){for(let a=0,s;a<e.length;a++)if(s=e[a])for(let i=0;i<r.length;i++)r[i].eq(s,n)&&(r==this.local&&(r=this.local.slice()),r.splice(i--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new Bn(r,o):tt}forChild(e,n){if(this==tt)return this;if(n.isLeaf)return Bn.empty;let o,r;for(let i=0;i<this.children.length;i+=3)if(this.children[i]>=e){this.children[i]==e&&(o=this.children[i+2]);break}let a=e+1,s=a+n.content.size;for(let i=0;i<this.local.length;i++){let l=this.local[i];if(l.from<s&&l.to>a&&l.type instanceof ha){let c=Math.max(a,l.from)-a,u=Math.min(s,l.to)-a;c<u&&(r||(r=[])).push(l.copy(c,u))}}if(r){let i=new Bn(r.sort(ko),Xo);return o?new yg([i,o]):i}return o||tt}eq(e){if(this==e)return!0;if(!(e instanceof Bn)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Ru(this.localsInner(e))}localsInner(e){if(this==tt)return Xo;if(e.inlineContent||!this.local.some(ha.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof ha||n.push(this.local[o]);return n}forEachSet(e){e(this)}};At.empty=new At([],[]);At.removeOverlap=Ru;const tt=At.empty;let yg=class Qo{constructor(e){this.members=e}map(e,n){const o=this.members.map(r=>r.map(e,n,So));return Qo.from(o)}forChild(e,n){if(n.isLeaf)return At.empty;let o=[];for(let r=0;r<this.members.length;r++){let a=this.members[r].forChild(e,n);a!=tt&&(a instanceof Qo?o=o.concat(a.members):o.push(a))}return Qo.from(o)}eq(e){if(!(e instanceof Qo)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,o=!0;for(let r=0;r<this.members.length;r++){let a=this.members[r].localsInner(e);if(a.length)if(!n)n=a;else{o&&(n=n.slice(),o=!1);for(let s=0;s<a.length;s++)n.push(a[s])}}return n?Ru(o?n:n.sort(ko)):Xo}static from(e){switch(e.length){case 0:return tt;case 1:return e[0];default:return new Qo(e.every(n=>n instanceof At)?e:e.reduce((n,o)=>n.concat(o instanceof At?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function K1(t,e,n,o,r,a,s){let i=t.slice();for(let c=0,u=a;c<n.maps.length;c++){let d=0;n.maps[c].forEach((p,h,m,g)=>{let v=g-m-(h-p);for(let b=0;b<i.length;b+=3){let w=i[b+1];if(w<0||p>w+u-d)continue;let E=i[b]+u-d;h>=E?i[b+1]=p<=E?-2:-1:p>=u&&v&&(i[b]+=v,i[b+1]+=v)}d+=v}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<i.length;c+=3)if(i[c+1]<0){if(i[c+1]==-2){l=!0,i[c+1]=-1;continue}let u=n.map(t[c]+a),d=u-r;if(d<0||d>=o.content.size){l=!0;continue}let p=n.map(t[c+1]+a,-1),h=p-r,{index:m,offset:g}=o.content.findIndex(d),v=o.maybeChild(m);if(v&&g==d&&g+v.nodeSize==h){let b=i[c+2].mapInner(n,v,u+1,t[c]+a+1,s);b!=tt?(i[c]=d,i[c+1]=h,i[c+2]=b):(i[c+1]=-2,l=!0)}else l=!0}if(l){let c=Y1(i,t,e,n,r,a,s),u=li(c,o,0,s);e=u.local;for(let d=0;d<i.length;d+=3)i[d+1]<0&&(i.splice(d,3),d-=3);for(let d=0,p=0;d<u.children.length;d+=3){let h=u.children[d];for(;p<i.length&&i[p]<h;)p+=3;i.splice(p,0,u.children[d],u.children[d+1],u.children[d+2])}}return new At(e.sort(ko),i)}function _g(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let r=t[o];n.push(new An(r.from+e,r.to+e,r.type))}return n}function Y1(t,e,n,o,r,a,s){function i(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(o,r,c);d?n.push(d):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)i(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&i(t[l+2],e[l]+a+1);return n}function bg(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,r=null;for(let a=0,s;a<t.length;a++)(s=t[a])&&s.from>n&&s.to<o&&((r||(r=[])).push(s),t[a]=null);return r}function wg(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function li(t,e,n,o){let r=[],a=!1;e.forEach((i,l)=>{let c=bg(t,i,l+n);if(c){a=!0;let u=li(c,i,n+l+1,o);u!=tt&&r.push(l,l+i.nodeSize,u)}});let s=_g(a?wg(t):t,-n).sort(ko);for(let i=0;i<s.length;i++)s[i].type.valid(e,s[i])||(o.onRemove&&o.onRemove(s[i].spec),s.splice(i--,1));return s.length||r.length?new At(s,r):tt}function ko(t,e){return t.from-e.from||t.to-e.to}function Ru(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let r=n+1;r<e.length;r++){let a=e[r];if(a.from==o.from){a.to!=o.to&&(e==t&&(e=t.slice()),e[r]=a.copy(a.from,o.to),Sp(e,r+1,a.copy(o.to,a.to)));continue}else{a.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,a.from),Sp(e,r,o.copy(a.from,o.to)));break}}}return e}function Sp(t,e,n){for(;e<t.length&&ko(n,t[e])>0;)e++;t.splice(e,0,n)}function Il(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=tt&&e.push(o)}),t.cursorWrapper&&e.push(At.create(t.state.doc,[t.cursorWrapper.deco])),yg.from(e)}const J1={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},X1=bt&&zn<=11;class Q1{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Z1{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Q1,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);bt&&zn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():ot&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),X1&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,J1)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(hp(this.view)){if(this.suppressingSelectionUpdates)return bn(this.view);if(bt&&zn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Io(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,o;for(let a=e.focusNode;a;a=fr(a))n.add(a);for(let a=e.anchorNode;a;a=fr(a))if(n.has(a)){o=a;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&hp(e)&&!this.ignoreSelectionChange(o),a=-1,s=-1,i=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(a=a<0?d.from:Math.min(d.from,a),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(i=!0))}if(l.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&u.parentNode.removeChild(u)}}else if(zt&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,p]=u;d.parentNode&&d.parentNode.parentNode==p.parentNode?p.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!d||nC(e,d)!=h)&&p.remove()}}}let c=null;a<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Li(o)&&(c=$u(e))&&c.eq(ye.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,bn(e),this.currentSelection.set(o),e.scrollToSelection()):(a>-1||r)&&(a>-1&&(e.docView.markDirty(a,s),eC(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,oC(e,l)),this.handleDOMChange(a,s,i,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||bn(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,a=e.nextSibling;if(bt&&zn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:p}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(r=d),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(a=p)}let s=r&&r.parentNode==e.target?Ye(r)+1:0,i=o.localPosFromDOM(e.target,s,-1),l=a&&a.parentNode==e.target?Ye(a):e.target.childNodes.length,c=o.localPosFromDOM(e.target,l,1);return{from:i,to:c}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let kp=new WeakMap,Ep=!1;function eC(t){if(!kp.has(t)&&(kp.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=zt,Ep)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Ep=!0}}function Cp(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,a=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Io(s.node,s.offset,r,a)&&([n,o,r,a]=[r,a,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:a}}function tC(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return Cp(t,r)}let n;function o(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?Cp(t,n):null}function nC(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function oC(t,e){var n;let{focusNode:o,focusOffset:r}=t.domSelectionRange();for(let a of e)if(((n=a.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=a.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let i=s;for(;;){let l=i.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;i=l}i.insertBefore(a,i.firstChild),o==a&&t.domSelection().collapse(a,r)}else a.parentNode.removeChild(a)}}function rC(t,e,n){let{node:o,fromOffset:r,toOffset:a,from:s,to:i}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Li(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Xe&&t.input.lastKeyCode===8)for(let v=a;v>r;v--){let b=o.childNodes[v-1],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){a=v;break}if(!w||w.size)break}let d=t.state.doc,p=t.someProp("domParser")||ca.fromSchema(t.state.schema),h=d.resolve(s),m=null,g=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:a,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:aC,context:h});if(c&&c[0].pos!=null){let v=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=v),m={anchor:v+s,head:b+s}}return{doc:g,sel:m,from:s,to:i}}function aC(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(ot&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||ot&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const sC=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function iC(t,e,n,o,r){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let T=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=$u(t,T);if(M&&!t.state.selection.eq(M)){if(Xe&&gn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",L=>L(t,go(13,"Enter"))))return;let x=t.state.tr.setSelection(M);T=="pointer"?x.setMeta("pointer",!0):T=="key"&&x.scrollIntoView(),a&&x.setMeta("composition",a),t.dispatch(x)}return}let s=t.state.doc.resolve(e),i=s.sharedDepth(n);e=s.before(i+1),n=t.state.doc.resolve(n).after(i+1);let l=t.state.selection,c=rC(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),p,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let m=uC(d.content,c.doc.content,c.from,p,h);if(m&&t.input.domChangeCount++,(mr&&t.input.lastIOSEnter>Date.now()-225||gn)&&r.some(T=>T.nodeType==1&&!sC.test(T.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",T=>T(t,go(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(o&&l instanceof Se&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let T=Mp(t,t.state.doc,c.sel);if(T&&!T.eq(t.state.selection)){let M=t.state.tr.setSelection(T);a&&M.setMeta("composition",a),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof Se&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),bt&&zn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)==" "&&(m.start--,m.endA--,m.endB--);let g=c.doc.resolveNoCache(m.start-c.from),v=c.doc.resolveNoCache(m.endB-c.from),b=u.resolve(m.start),w=g.sameParent(v)&&g.parent.inlineContent&&b.end()>=m.endA;if((mr&&t.input.lastIOSEnter>Date.now()-225&&(!w||r.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!w&&g.pos<c.doc.content.size&&(!g.sameParent(v)||!g.parent.inlineContent)&&g.pos<v.pos&&!/\S/.test(c.doc.textBetween(g.pos,v.pos,"","")))&&t.someProp("handleKeyDown",T=>T(t,go(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&cC(u,m.start,m.endA,g,v)&&t.someProp("handleKeyDown",T=>T(t,go(8,"Backspace")))){gn&&Xe&&t.domObserver.suppressSelectionUpdates();return}Xe&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),gn&&!w&&g.start()!=v.start()&&v.parentOffset==0&&g.depth==v.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,v=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(T){return T(t,go(13,"Enter"))})},20));let E=m.start,y=m.endA,P=T=>{let M=T||t.state.tr.replace(E,y,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let x=Mp(t,M.doc,c.sel);x&&!(Xe&&t.composing&&x.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(x.head==E||x.head==M.mapping.map(y)-1)||bt&&x.empty&&x.head==E)&&M.setSelection(x)}return a&&M.setMeta("composition",a),M.scrollIntoView()},C;if(w)if(g.pos==v.pos){bt&&zn<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>bn(t),20));let T=P(t.state.tr.delete(E,y)),M=u.resolve(m.start).marksAcross(u.resolve(m.endA));M&&T.ensureMarks(M),t.dispatch(T)}else if(m.endA==m.endB&&(C=lC(g.parent.content.cut(g.parentOffset,v.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let T=P(t.state.tr);C.type=="add"?T.addMark(E,y,C.mark):T.removeMark(E,y,C.mark),t.dispatch(T)}else if(g.parent.child(g.index()).isText&&g.index()==v.index()-(v.textOffset?0:1)){let T=g.parent.textBetween(g.parentOffset,v.parentOffset),M=()=>P(t.state.tr.insertText(T,E,y));t.someProp("handleTextInput",x=>x(t,E,y,T,M))||t.dispatch(M())}else t.dispatch(P());else t.dispatch(P())}function Mp(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Tu(t,e.resolve(n.anchor),e.resolve(n.head))}function lC(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,r=n,a=o,s,i,l;for(let u=0;u<o.length;u++)r=o[u].removeFromSet(r);for(let u=0;u<n.length;u++)a=n[u].removeFromSet(a);if(r.length==1&&a.length==0)i=r[0],s="add",l=u=>u.mark(i.addToSet(u.marks));else if(r.length==0&&a.length==1)i=a[0],s="remove",l=u=>u.mark(i.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(X.from(c).eq(t))return{mark:i,type:s}}function cC(t,e,n,o,r){if(n-e<=r.pos-o.pos||Al(o,!0,!1)<r.pos)return!1;let a=t.resolve(e);if(!o.parent.isTextblock){let i=a.nodeAfter;return i!=null&&n==e+i.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let s=t.resolve(Al(a,!0,!0));return!s.parent.isTextblock||s.pos>n||Al(s,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function Al(t,e,n){let o=t.depth,r=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,r++,e=!1;if(n){let a=t.node(o).maybeChild(t.indexAfter(o));for(;a&&!a.isLeaf;)a=a.firstChild,r++}return r}function uC(t,e,n,o,r){let a=t.findDiffStart(e,n);if(a==null)return null;let{a:s,b:i}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let l=Math.max(0,a-Math.min(s,i));o-=s+l-a}if(s<a&&t.size<e.size){let l=o<=a&&o>=s?a-o:0;a-=l,a&&a<e.size&&$p(e.textBetween(a-1,a+1))&&(a+=l?1:-1),i=a+(i-s),s=a}else if(i<a){let l=o<=a&&o>=i?a-o:0;a-=l,a&&a<t.size&&$p(t.textBetween(a-1,a+1))&&(a+=l?1:-1),s=a+(s-i),i=a}return{start:a,endA:s,endB:i}}function $p(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Sg{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new C1,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Op),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ap(this),Ip(this),this.nodeViews=xp(this),this.docView=ip(this.state.doc,Tp(this),Il(this),this.dom,this),this.domObserver=new Z1(this,(o,r,a,s)=>iC(this,o,r,a,s)),this.domObserver.start(),M1(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Mc(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Op),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let r=this.state,a=!1,s=!1;e.storedMarks&&this.composing&&(pg(this),s=!0),this.state=e;let i=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(i||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=xp(this);pC(h,this.nodeViews)&&(this.nodeViews=h,a=!0)}(i||n.handleDOMEvents!=this._props.handleDOMEvents)&&Mc(this),this.editable=Ap(this),Ip(this);let l=Il(this),c=Tp(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",d=a||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(r.selection))&&(s=!0);let p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&FE(this);if(s){this.domObserver.stop();let h=d&&(bt||Xe)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&dC(r.selection,e.selection);if(d){let m=Xe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=F1(this)),(a||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=ip(e.doc,c,l,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&u1(this))?bn(this,h):(eg(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&jE(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof fe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&tp(this,n.getBoundingClientRect(),e)}else tp(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let a=o.from+(this.state.doc.content.size-n.doc.content.size);(a>0&&this.state.doc.nodeAt(a))==o.node&&(r=a)}this.dragging=new fg(e.slice,e.move,r<0?void 0:fe.create(this.state.doc,r))}someProp(e,n){let o=this._props&&this._props[e],r;if(o!=null&&(r=n?n(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let i=this.directPlugins[s].props[e];if(i!=null&&(r=n?n(i):i))return r}let a=this.state.plugins;if(a)for(let s=0;s<a.length;s++){let i=a[s].props[e];if(i!=null&&(r=n?n(i):i))return r}}hasFocus(){if(bt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&GE(this.dom),bn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return WE(this,e)}coordsAtPos(e,n=1){return qm(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,o=-1){let r=this.docView.posFromDOM(e,n,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return QE(this,n||this.state,e)}pasteHTML(e,n){return wa(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return wa(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Iu(this,e)}destroy(){this.docView&&($1(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Il(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,AE())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return I1(this,e)}domSelectionRange(){let e=this.domSelection();return e?ot&&this.root.nodeType===11&&DE(this.dom.ownerDocument)==this.dom&&tC(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Sg.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Tp(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[An.node(0,t.state.doc.content.size,e)]}function Ip(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:An.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Ap(t){return!t.someProp("editable",e=>e(t.state)===!1)}function dC(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function xp(t){let e=Object.create(null);function n(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function pC(t,e){let n=0,o=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)o++;return n!=o}function Op(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Qn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ci={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},hC=typeof navigator<"u"&&/Mac/.test(navigator.platform),fC=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Je=0;Je<10;Je++)Qn[48+Je]=Qn[96+Je]=String(Je);for(var Je=1;Je<=24;Je++)Qn[Je+111]="F"+Je;for(var Je=65;Je<=90;Je++)Qn[Je]=String.fromCharCode(Je+32),ci[Je]=String.fromCharCode(Je);for(var xl in Qn)ci.hasOwnProperty(xl)||(ci[xl]=Qn[xl]);function mC(t){var e=hC&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||fC&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ci:Qn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const gC=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),vC=typeof navigator<"u"&&/Win/.test(navigator.platform);function yC(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let o,r,a,s;for(let i=0;i<e.length-1;i++){let l=e[i];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))o=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))gC?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+l)}return o&&(n="Alt-"+n),r&&(n="Ctrl-"+n),s&&(n="Meta-"+n),a&&(n="Shift-"+n),n}function _C(t){let e=Object.create(null);for(let n in t)e[yC(n)]=t[n];return e}function Ol(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function bC(t){return new je({props:{handleKeyDown:kg(t)}})}function kg(t){let e=_C(t);return function(n,o){let r=mC(o),a,s=e[Ol(r,o)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let i=e[Ol(r,o,!1)];if(i&&i(n.state,n.dispatch,n))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(vC&&o.ctrlKey&&o.altKey)&&(a=Qn[o.keyCode])&&a!=r){let i=e[Ol(a,o)];if(i&&i(n.state,n.dispatch,n))return!0}}return!1}}const wC=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Eg(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const SC=(t,e,n)=>{let o=Eg(t,n);if(!o)return!1;let r=Pu(o);if(!r){let s=o.blockRange(),i=s&&Ar(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)}let a=r.nodeBefore;if(Tg(t,r,e,-1))return!0;if(o.parent.content.size==0&&(gr(a,"end")||fe.isSelectable(a)))for(let s=o.depth;;s--){let i=Ni(t.doc,o.before(s),o.after(s),te.empty);if(i&&i.slice.size<i.to-i.from){if(e){let l=t.tr.step(i);l.setSelection(gr(a,"end")?ye.findFrom(l.doc.resolve(l.mapping.map(r.pos,-1)),-1):fe.create(l.doc,r.pos-a.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return a.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos-a.nodeSize,r.pos).scrollIntoView()),!0):!1},kC=(t,e,n)=>{let o=Eg(t,n);if(!o)return!1;let r=Pu(o);return r?Cg(t,r,e):!1},EC=(t,e,n)=>{let o=Mg(t);if(!o)return!1;let r=Du(o);return r?Cg(t,r,e):!1};function Cg(t,e,n){let o=e.nodeBefore,r=o,a=e.pos-1;for(;!r.isTextblock;a--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let s=e.nodeAfter,i=s,l=e.pos+1;for(;!i.isTextblock;l++){if(i.type.spec.isolating)return!1;let u=i.firstChild;if(!u)return!1;i=u}let c=Ni(t.doc,a,l,te.empty);if(!c||c.from!=a||c instanceof Jt&&c.slice.size>=l-a)return!1;if(n){let u=t.tr.step(c);u.setSelection(Se.create(u.doc,a)),n(u.scrollIntoView())}return!0}function gr(t,e,n=!1){for(let o=t;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&o.childCount!=1)return!1}return!1}const CC=(t,e,n)=>{let{$head:o,empty:r}=t.selection,a=o;if(!r)return!1;if(o.parent.isTextblock){if(o.parentOffset>0)return!1;a=Pu(o)}let s=a&&a.nodeBefore;return!s||!fe.isSelectable(s)?!1:(e&&e(t.tr.setSelection(fe.create(t.doc,a.pos-s.nodeSize)).scrollIntoView()),!0)};function Pu(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Mg(t,e){let{$cursor:n}=t.selection;return!n||n.parentOffset<n.parent.content.size?null:n}const MC=(t,e,n)=>{let o=Mg(t);if(!o)return!1;let r=Du(o);if(!r)return!1;let a=r.nodeAfter;if(Tg(t,r,e,1))return!0;if(o.parent.content.size==0&&(gr(a,"start")||fe.isSelectable(a))){let s=Ni(t.doc,o.before(),o.after(),te.empty);if(s&&s.slice.size<s.to-s.from){if(e){let i=t.tr.step(s);i.setSelection(gr(a,"start")?ye.findFrom(i.doc.resolve(i.mapping.map(r.pos)),1):fe.create(i.doc,i.mapping.map(r.pos))),e(i.scrollIntoView())}return!0}}return a.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos,r.pos+a.nodeSize).scrollIntoView()),!0):!1},$C=(t,e,n)=>{let{$head:o,empty:r}=t.selection,a=o;if(!r)return!1;if(o.parent.isTextblock){if(o.parentOffset<o.parent.content.size)return!1;a=Du(o)}let s=a&&a.nodeAfter;return!s||!fe.isSelectable(s)?!1:(e&&e(t.tr.setSelection(fe.create(t.doc,a.pos)).scrollIntoView()),!0)};function Du(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const TC=(t,e)=>{let n=t.selection,o=n instanceof fe,r;if(o){if(n.node.isTextblock||!to(t.doc,n.from))return!1;r=n.from}else if(r=Di(t.doc,n.from,-1),r==null)return!1;if(e){let a=t.tr.join(r);o&&a.setSelection(fe.create(a.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},IC=(t,e)=>{let n=t.selection,o;if(n instanceof fe){if(n.node.isTextblock||!to(t.doc,n.to))return!1;o=n.to}else if(o=Di(t.doc,n.to,1),o==null)return!1;return e&&e(t.tr.join(o).scrollIntoView()),!0},AC=(t,e)=>{let{$from:n,$to:o}=t.selection,r=n.blockRange(o),a=r&&Ar(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)},xC=(t,e)=>{let{$head:n,$anchor:o}=t.selection;return!n.parent.type.spec.code||!n.sameParent(o)?!1:(e&&e(t.tr.insertText(`
|
||
`).scrollIntoView()),!0)};function $g(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const OC=(t,e)=>{let{$head:n,$anchor:o}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),a=n.indexAfter(-1),s=$g(r.contentMatchAt(a));if(!s||!r.canReplaceWith(a,a,s))return!1;if(e){let i=n.after(),l=t.tr.replaceWith(i,i,s.createAndFill());l.setSelection(ye.near(l.doc.resolve(i),1)),e(l.scrollIntoView())}return!0},RC=(t,e)=>{let n=t.selection,{$from:o,$to:r}=n;if(n instanceof Vn||o.parent.inlineContent||r.parent.inlineContent)return!1;let a=$g(r.parent.contentMatchAt(r.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,i=t.tr.insert(s,a.createAndFill());i.setSelection(Se.create(i.doc,s+1)),e(i.scrollIntoView())}return!0},PC=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let a=n.before();if(sr(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let o=n.blockRange(),r=o&&Ar(o);return r==null?!1:(e&&e(t.tr.lift(o,r).scrollIntoView()),!0)},DC=(t,e)=>{let{$from:n,to:o}=t.selection,r,a=n.sharedDepth(o);return a==0?!1:(r=n.before(a),e&&e(t.tr.setSelection(fe.create(t.doc,r))),!0)};function NC(t,e,n){let o=e.nodeBefore,r=e.nodeAfter,a=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(a-1,a)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(r.isTextblock||to(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Tg(t,e,n,o){let r=e.nodeBefore,a=e.nodeAfter,s,i,l=r.type.spec.isolating||a.type.spec.isolating;if(!l&&NC(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(i=r.contentMatchAt(r.childCount)).findWrapping(a.type))&&i.matchType(s[0]||a.type).validEnd){if(n){let h=e.pos+a.nodeSize,m=X.empty;for(let b=s.length-1;b>=0;b--)m=X.from(s[b].create(null,m));m=X.from(r.copy(m));let g=t.tr.step(new kt(e.pos-1,h,e.pos,h,new te(m,1,0),s.length,!0)),v=g.doc.resolve(h+2*s.length);v.nodeAfter&&v.nodeAfter.type==r.type&&to(g.doc,v.pos)&&g.join(v.pos),n(g.scrollIntoView())}return!0}let u=a.type.spec.isolating||o>0&&l?null:ye.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),p=d&&Ar(d);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(d,p).scrollIntoView()),!0;if(c&&gr(a,"start",!0)&&gr(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=a,v=1;for(;!g.isTextblock;g=g.firstChild)v++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let b=X.empty;for(let E=m.length-1;E>=0;E--)b=X.from(m[E].copy(b));let w=t.tr.step(new kt(e.pos-m.length,e.pos+a.nodeSize,e.pos+v,e.pos+a.nodeSize-v,new te(b,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function Ig(t){return function(e,n){let o=e.selection,r=t<0?o.$from:o.$to,a=r.depth;for(;r.node(a).isInline;){if(!a)return!1;a--}return r.node(a).isTextblock?(n&&n(e.tr.setSelection(Se.create(e.doc,t<0?r.start(a):r.end(a)))),!0):!1}}const LC=Ig(-1),UC=Ig(1);function BC(t,e=null){return function(n,o){let{$from:r,$to:a}=n.selection,s=r.blockRange(a),i=s&&Eu(s,t,e);return i?(o&&o(n.tr.wrap(s,i).scrollIntoView()),!0):!1}}function Rp(t,e=null){return function(n,o){let r=!1;for(let a=0;a<n.selection.ranges.length&&!r;a++){let{$from:{pos:s},$to:{pos:i}}=n.selection.ranges[a];n.doc.nodesBetween(s,i,(l,c)=>{if(r)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)r=!0;else{let u=n.doc.resolve(c),d=u.index();r=u.parent.canReplaceWith(d,d+1,t)}})}if(!r)return!1;if(o){let a=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:i},$to:{pos:l}}=n.selection.ranges[s];a.setBlockType(i,l,t,e)}o(a.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function FC(t,e=null){return function(n,o){let{$from:r,$to:a}=n.selection,s=r.blockRange(a);if(!s)return!1;let i=o?n.tr:null;return jC(i,s,t,e)?(o&&o(i.scrollIntoView()),!0):!1}}function jC(t,e,n,o=null){let r=!1,a=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);a=new ni(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new ni(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let i=Eu(a,n,o,e);return i?(t&&GC(t,e,i,r,n),!0):!1}function GC(t,e,n,o,r){let a=X.empty;for(let u=n.length-1;u>=0;u--)a=X.from(n[u].type.create(n[u].attrs,a));t.step(new kt(e.start-(o?2:0),e.end,e.start,e.end,new te(a,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==r&&(s=u+1);let i=n.length-s,l=e.start+n.length-(o?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,p=!0;u<d;u++,p=!1)!p&&sr(t.doc,l,i)&&(t.split(l,i),l+=2*i),l+=c.child(u).nodeSize;return t}function qC(t){return function(e,n){let{$from:o,$to:r}=e.selection,a=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==t);return a?n?o.node(a.depth-1).type==t?HC(e,n,t,a):VC(e,n,a):!0:!1}}function HC(t,e,n,o){let r=t.tr,a=o.end,s=o.$to.end(o.depth);a<s&&(r.step(new kt(a-1,s,a,s,new te(X.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new ni(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const i=Ar(o);if(i==null)return!1;r.lift(o,i);let l=r.doc.resolve(r.mapping.map(a,-1)-1);return to(r.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&r.join(l.pos),e(r.scrollIntoView()),!0}function VC(t,e,n){let o=t.tr,r=n.parent;for(let h=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let a=o.doc.resolve(n.start),s=a.nodeAfter;if(o.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let i=n.startIndex==0,l=n.endIndex==r.childCount,c=a.node(-1),u=a.index(-1);if(!c.canReplace(u+(i?0:1),u+1,s.content.append(l?X.empty:X.from(r))))return!1;let d=a.pos,p=d+s.nodeSize;return o.step(new kt(d-(i?1:0),p+(l?1:0),d+1,p-1,new te((i?X.empty:X.from(r.copy(X.empty))).append(l?X.empty:X.from(r.copy(X.empty))),i?0:1,l?0:1),i?0:1)),e(o.scrollIntoView()),!0}function zC(t){return function(e,n){let{$from:o,$to:r}=e.selection,a=o.blockRange(r,c=>c.childCount>0&&c.firstChild.type==t);if(!a)return!1;let s=a.startIndex;if(s==0)return!1;let i=a.parent,l=i.child(s-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==i.type,u=X.from(c?t.create():null),d=new te(X.from(t.create(null,X.from(i.type.create(null,u)))),c?3:1,0),p=a.start,h=a.end;n(e.tr.step(new kt(p-(c?3:1),h,p,h,d,1,!0)).scrollIntoView())}return!0}}function Bi(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:a}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return a},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,a=n.storedMarks,n}}}let Fi=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:o}=this,{view:r}=n,{tr:a}=o,s=this.buildProps(a);return Object.fromEntries(Object.entries(e).map(([i,l])=>[i,(...c)=>{const u=l(...c)(s);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(a),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:o,editor:r,state:a}=this,{view:s}=r,i=[],l=!!e,c=e||a.tr,u=()=>(!l&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),i.every(p=>p===!0)),d={...Object.fromEntries(Object.entries(o).map(([p,h])=>[p,(...m)=>{const g=this.buildProps(c,n),v=h(...m)(g);return i.push(v),d}])),run:u};return d}createCan(e){const{rawCommands:n,state:o}=this,r=!1,a=e||o.tr,s=this.buildProps(a,r);return{...Object.fromEntries(Object.entries(n).map(([i,l])=>[i,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(a,r)}}buildProps(e,n=!0){const{rawCommands:o,editor:r,state:a}=this,{view:s}=r,i={tr:e,editor:r,view:s,state:Bi({state:a,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(o).map(([l,c])=>[l,(...u)=>c(...u)(i)]))}};return i}};class WC{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const o=this.callbacks[e];return o&&o.forEach(r=>r.apply(this,n)),this}off(e,n){const o=this.callbacks[e];return o&&(n?this.callbacks[e]=o.filter(r=>r!==n):delete this.callbacks[e]),this}once(e,n){const o=(...r)=>{this.off(e,o),n.apply(this,r)};return this.on(e,o)}removeAllListeners(){this.callbacks={}}}function ne(t,e,n){return t.config[e]===void 0&&t.parent?ne(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ne(t.parent,e,n):null}):t.config[e]}function ji(t){const e=t.filter(r=>r.type==="extension"),n=t.filter(r=>r.type==="node"),o=t.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:o}}function Ag(t){const e=[],{nodeExtensions:n,markExtensions:o}=ji(t),r=[...n,...o],a={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const i={name:s.name,options:s.options,storage:s.storage,extensions:r},l=ne(s,"addGlobalAttributes",i);l&&l().forEach(c=>{c.types.forEach(u=>{Object.entries(c.attributes).forEach(([d,p])=>{e.push({type:u,name:d,attribute:{...a,...p}})})})})}),r.forEach(s=>{const i={name:s.name,options:s.options,storage:s.storage},l=ne(s,"addAttributes",i);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const p={...a,...d};typeof(p==null?void 0:p.default)=="function"&&(p.default=p.default()),p!=null&&p.isRequired&&(p==null?void 0:p.default)===void 0&&delete p.default,e.push({type:s.name,name:u,attribute:p})})}),e}function We(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Be(...t){return t.filter(e=>!!e).reduce((e,n)=>{const o={...e};return Object.entries(n).forEach(([r,a])=>{if(!o[r]){o[r]=a;return}if(r==="class"){const s=a?String(a).split(" "):[],i=o[r]?o[r].split(" "):[],l=s.filter(c=>!i.includes(c));o[r]=[...i,...l].join(" ")}else if(r==="style"){const s=a?a.split(";").map(c=>c.trim()).filter(Boolean):[],i=o[r]?o[r].split(";").map(c=>c.trim()).filter(Boolean):[],l=new Map;i.forEach(c=>{const[u,d]=c.split(":").map(p=>p.trim());l.set(u,d)}),s.forEach(c=>{const[u,d]=c.split(":").map(p=>p.trim());l.set(u,d)}),o[r]=Array.from(l.entries()).map(([c,u])=>`${c}: ${u}`).join("; ")}else o[r]=a}),o},{})}function Tc(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,o)=>Be(n,o),{})}function xg(t){return typeof t=="function"}function be(t,e=void 0,...n){return xg(t)?e?t.bind(e)(...n):t(...n):t}function KC(t={}){return Object.keys(t).length===0&&t.constructor===Object}function YC(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Pp(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(o===!1)return!1;const r=e.reduce((a,s)=>{const i=s.attribute.parseHTML?s.attribute.parseHTML(n):YC(n.getAttribute(s.name));return i==null?a:{...a,[s.name]:i}},{});return{...o,...r}}}}function Dp(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&KC(n)?!1:n!=null))}function JC(t,e){var n;const o=Ag(t),{nodeExtensions:r,markExtensions:a}=ji(t),s=(n=r.find(c=>ne(c,"topNode")))===null||n===void 0?void 0:n.name,i=Object.fromEntries(r.map(c=>{const u=o.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},p=t.reduce((b,w)=>{const E=ne(w,"extendNodeSchema",d);return{...b,...E?E(c):{}}},{}),h=Dp({...p,content:be(ne(c,"content",d)),marks:be(ne(c,"marks",d)),group:be(ne(c,"group",d)),inline:be(ne(c,"inline",d)),atom:be(ne(c,"atom",d)),selectable:be(ne(c,"selectable",d)),draggable:be(ne(c,"draggable",d)),code:be(ne(c,"code",d)),whitespace:be(ne(c,"whitespace",d)),linebreakReplacement:be(ne(c,"linebreakReplacement",d)),defining:be(ne(c,"defining",d)),isolating:be(ne(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var w;return[b.name,{default:(w=b==null?void 0:b.attribute)===null||w===void 0?void 0:w.default}]}))}),m=be(ne(c,"parseHTML",d));m&&(h.parseDOM=m.map(b=>Pp(b,u)));const g=ne(c,"renderHTML",d);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:Tc(b,u)}));const v=ne(c,"renderText",d);return v&&(h.toText=v),[c.name,h]})),l=Object.fromEntries(a.map(c=>{const u=o.filter(v=>v.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},p=t.reduce((v,b)=>{const w=ne(b,"extendMarkSchema",d);return{...v,...w?w(c):{}}},{}),h=Dp({...p,inclusive:be(ne(c,"inclusive",d)),excludes:be(ne(c,"excludes",d)),group:be(ne(c,"group",d)),spanning:be(ne(c,"spanning",d)),code:be(ne(c,"code",d)),attrs:Object.fromEntries(u.map(v=>{var b;return[v.name,{default:(b=v==null?void 0:v.attribute)===null||b===void 0?void 0:b.default}]}))}),m=be(ne(c,"parseHTML",d));m&&(h.parseDOM=m.map(v=>Pp(v,u)));const g=ne(c,"renderHTML",d);return g&&(h.toDOM=v=>g({mark:v,HTMLAttributes:Tc(v,u)})),[c.name,h]}));return new pm({topNode:s,nodes:i,marks:l})}function Rl(t,e){return e.nodes[t]||e.marks[t]||null}function Np(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Nu(t,e){const n=ja.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}const XC=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(r,a,s,i)=>{var l,c;const u=((c=(l=r.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:r,pos:a,parent:s,index:i}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-a))}),n};function Lu(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Gi{constructor(e){this.find=e.find,this.handler=e.handler}}const QC=(t,e)=>{if(Lu(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function ws(t){var e;const{editor:n,from:o,to:r,text:a,rules:s,plugin:i}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(o);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const d=XC(c)+a;return s.forEach(p=>{if(u)return;const h=QC(d,p.find);if(!h)return;const m=l.state.tr,g=Bi({state:l.state,transaction:m}),v={from:o-(h[0].length-a.length),to:r},{commands:b,chain:w,can:E}=new Fi({editor:n,state:g});p.handler({state:g,range:v,match:h,commands:b,chain:w,can:E})===null||!m.steps.length||(m.setMeta(i,{transform:m,from:o,to:r,text:a}),l.dispatch(m),u=!0)}),u}function ZC(t){const{editor:e,rules:n}=t,o=new je({state:{init(){return null},apply(r,a,s){const i=r.getMeta(o);if(i)return i;const l=r.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=Nu(X.from(c),s.schema);const{from:u}=l,d=u+c.length;ws({editor:e,from:u,to:d,text:c,rules:n,plugin:o})}),r.selectionSet||r.docChanged?null:a}},props:{handleTextInput(r,a,s,i){return ws({editor:e,from:a,to:s,text:i,rules:n,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:a}=r.state.selection;a&&ws({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(r,a){if(a.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?ws({editor:e,from:s.pos,to:s.pos,text:`
|
||
`,rules:n,plugin:o}):!1}},isInputRules:!0});return o}function eM(t){return Object.prototype.toString.call(t).slice(8,-1)}function Ss(t){return eM(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function qi(t,e){const n={...t};return Ss(t)&&Ss(e)&&Object.keys(e).forEach(o=>{Ss(e[o])&&Ss(t[o])?n[o]=qi(t[o],e[o]):n[o]=e[o]}),n}let za=class Ic{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=be(ne(this,"addOptions",{name:this.name}))),this.storage=be(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ic(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>qi(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ic(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=be(ne(n,"addOptions",{name:n.name})),n.storage=be(ne(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const a=r.marks();if(!a.find(i=>(i==null?void 0:i.type.name)===n.name))return!1;const s=a.find(i=>(i==null?void 0:i.type.name)===n.name);return s&&o.removeStoredMark(s),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}};function tM(t){return typeof t=="number"}class nM{constructor(e){this.find=e.find,this.handler=e.handler}}const oM=(t,e,n)=>{if(Lu(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(r=>{const a=[r.text];return a.index=r.index,a.input=t,a.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(r.replaceWith)),a}):[]};function rM(t){const{editor:e,state:n,from:o,to:r,rule:a,pasteEvent:s,dropEvent:i}=t,{commands:l,chain:c,can:u}=new Fi({editor:e,state:n}),d=[];return n.doc.nodesBetween(o,r,(p,h)=>{if(!p.isTextblock||p.type.spec.code)return;const m=Math.max(o,h),g=Math.min(r,h+p.content.size),v=p.textBetween(m-h,g-h,void 0,"");oM(v,a.find,s).forEach(b=>{if(b.index===void 0)return;const w=m+b.index+1,E=w+b[0].length,y={from:n.tr.mapping.map(w),to:n.tr.mapping.map(E)},P=a.handler({state:n,range:y,match:b,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:i});d.push(P)})}),d.every(p=>p!==null)}let ks=null;const aM=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function sM(t){const{editor:e,rules:n}=t;let o=null,r=!1,a=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,i;try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}const l=({state:c,from:u,to:d,rule:p,pasteEvt:h})=>{const m=c.tr,g=Bi({state:c,transaction:m});if(!(!rM({editor:e,state:g,from:Math.max(u-1,0),to:d.b-1,rule:p,pasteEvent:h,dropEvent:i})||!m.steps.length)){try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(c=>new je({view(u){const d=h=>{var m;o=!((m=u.dom.parentElement)===null||m===void 0)&&m.contains(h.target)?u.dom.parentElement:null,o&&(ks=e)},p=()=>{ks&&(ks=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(u,d)=>{if(a=o===u.dom.parentElement,i=d,!a){const p=ks;p!=null&&p.isEditable&&setTimeout(()=>{const h=p.state.selection;h&&p.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(u,d)=>{var p;const h=(p=d.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return s=d,r=!!(h!=null&&h.includes("data-pm-slice")),!1}}},appendTransaction:(u,d,p)=>{const h=u[0],m=h.getMeta("uiEvent")==="paste"&&!r,g=h.getMeta("uiEvent")==="drop"&&!a,v=h.getMeta("applyPasteRules"),b=!!v;if(!m&&!g&&!b)return;if(b){let{text:y}=v;typeof y=="string"?y=y:y=Nu(X.from(y),p.schema);const{from:P}=v,C=P+y.length,T=aM(y);return l({rule:c,state:p,from:P,to:{b:C},pasteEvt:T})}const w=d.doc.content.findDiffStart(p.doc.content),E=d.doc.content.findDiffEnd(p.doc.content);if(!(!tM(w)||!E||w===E.b))return l({rule:c,state:p,from:w,to:E,pasteEvt:s})}}))}function iM(t){const e=t.filter((n,o)=>t.indexOf(n)!==o);return Array.from(new Set(e))}let lM=class ta{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=ta.resolve(e),this.schema=JC(this.extensions,n),this.setupExtensions()}static resolve(e){const n=ta.sort(ta.flatten(e)),o=iM(n.map(r=>r.name));return o.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${o.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const o={name:n.name,options:n.options,storage:n.storage},r=ne(n,"addExtensions",o);return r?[n,...this.flatten(r())]:n}).flat(10)}static sort(e){return e.sort((n,o)=>{const r=ne(n,"priority")||100,a=ne(o,"priority")||100;return r>a?-1:r<a?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const o={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Rl(n.name,this.schema)},r=ne(n,"addCommands",o);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this,n=ta.sort([...this.extensions].reverse()),o=[],r=[],a=n.map(s=>{const i={name:s.name,options:s.options,storage:s.storage,editor:e,type:Rl(s.name,this.schema)},l=[],c=ne(s,"addKeyboardShortcuts",i);let u={};if(s.type==="mark"&&ne(s,"exitable",i)&&(u.ArrowRight=()=>za.handleExit({editor:e,mark:s})),c){const g=Object.fromEntries(Object.entries(c()).map(([v,b])=>[v,()=>b({editor:e})]));u={...u,...g}}const d=bC(u);l.push(d);const p=ne(s,"addInputRules",i);Np(s,e.options.enableInputRules)&&p&&o.push(...p());const h=ne(s,"addPasteRules",i);Np(s,e.options.enablePasteRules)&&h&&r.push(...h());const m=ne(s,"addProseMirrorPlugins",i);if(m){const g=m();l.push(...g)}return l}).flat();return[ZC({editor:e,rules:o}),...sM({editor:e,rules:r}),...a]}get attributes(){return Ag(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=ji(this.extensions);return Object.fromEntries(n.filter(o=>!!ne(o,"addNodeView")).map(o=>{const r=this.attributes.filter(l=>l.type===o.name),a={name:o.name,options:o.options,storage:o.storage,editor:e,type:We(o.name,this.schema)},s=ne(o,"addNodeView",a);if(!s)return[];const i=(l,c,u,d,p)=>{const h=Tc(l,r);return s()({node:l,view:c,getPos:u,decorations:d,innerDecorations:p,editor:e,extension:o,HTMLAttributes:h})};return[o.name,i]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const o={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Rl(e.name,this.schema)};e.type==="mark"&&(!((n=be(ne(e,"keepOnSplit",o)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const r=ne(e,"onBeforeCreate",o),a=ne(e,"onCreate",o),s=ne(e,"onUpdate",o),i=ne(e,"onSelectionUpdate",o),l=ne(e,"onTransaction",o),c=ne(e,"onFocus",o),u=ne(e,"onBlur",o),d=ne(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),a&&this.editor.on("create",a),s&&this.editor.on("update",s),i&&this.editor.on("selectionUpdate",i),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}},et=class Ac{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=be(ne(this,"addOptions",{name:this.name}))),this.storage=be(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ac(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>qi(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ac({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=be(ne(n,"addOptions",{name:n.name})),n.storage=be(ne(n,"addStorage",{name:n.name,options:n.options})),n}};function Og(t,e,n){const{from:o,to:r}=e,{blockSeparator:a=`
|
||
|
||
`,textSerializers:s={}}=n||{};let i="";return t.nodesBetween(o,r,(l,c,u,d)=>{var p;l.isBlock&&c>o&&(i+=a);const h=s==null?void 0:s[l.type.name];if(h)return u&&(i+=h({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(i+=(p=l==null?void 0:l.text)===null||p===void 0?void 0:p.slice(Math.max(o,c)-c,r-c))}),i}function Uu(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const cM=et.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new je({key:new Ze("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:a}=r,s=Math.min(...a.map(c=>c.$from.pos)),i=Math.max(...a.map(c=>c.$to.pos)),l=Uu(n);return Og(o,{from:s,to:i},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),uM=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),dM=(t=!1)=>({commands:e})=>e.setContent("",t),pM=()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:r}=o;return n&&r.forEach(({$from:a,$to:s})=>{t.doc.nodesBetween(a.pos,s.pos,(i,l)=>{if(i.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),p=c.resolve(u.map(l+i.nodeSize)),h=d.blockRange(p);if(!h)return;const m=Ar(h);if(i.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},hM=t=>e=>t(e),fM=()=>({state:t,dispatch:e})=>RC(t,e),mM=(t,e)=>({editor:n,tr:o})=>{const{state:r}=n,a=r.doc.slice(t.from,t.to);o.deleteRange(t.from,t.to);const s=o.mapping.map(e);return o.insert(s,a.content),o.setSelection(new Se(o.doc.resolve(Math.max(s-1,0)))),!0},gM=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let a=r.depth;a>0;a-=1)if(r.node(a).type===o.type){if(e){const s=r.before(a),i=r.after(a);t.delete(s,i).scrollIntoView()}return!0}return!1},vM=t=>({tr:e,state:n,dispatch:o})=>{const r=We(t,n.schema),a=e.selection.$anchor;for(let s=a.depth;s>0;s-=1)if(a.node(s).type===r){if(o){const i=a.before(s),l=a.after(s);e.delete(i,l).scrollIntoView()}return!0}return!1},yM=t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},_M=()=>({state:t,dispatch:e})=>wC(t,e),bM=()=>({commands:t})=>t.keyboardShortcut("Enter"),wM=()=>({state:t,dispatch:e})=>OC(t,e);function ui(t,e,n={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>n.strict?e[r]===t[r]:Lu(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function Rg(t,e,n={}){return t.find(o=>o.type===e&&ui(Object.fromEntries(Object.keys(n).map(r=>[r,o.attrs[r]])),n))}function Lp(t,e,n={}){return!!Rg(t,e,n)}function Bu(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e)||(n=n||((o=r.node.marks[0])===null||o===void 0?void 0:o.attrs),!Rg([...r.node.marks],e,n)))return;let a=r.index,s=t.start()+r.offset,i=a+1,l=s+r.node.nodeSize;for(;a>0&&Lp([...t.parent.child(a-1).marks],e,n);)a-=1,s-=t.parent.child(a).nodeSize;for(;i<t.parent.childCount&&Lp([...t.parent.child(i).marks],e,n);)l+=t.parent.child(i).nodeSize,i+=1;return{from:s,to:l}}function no(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const SM=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const a=no(t,o.schema),{doc:s,selection:i}=n,{$from:l,from:c,to:u}=i;if(r){const d=Bu(l,a,e);if(d&&d.from<=c&&d.to>=u){const p=Se.create(s,d.from,d.to);n.setSelection(p)}}return!0},kM=t=>e=>{const n=typeof t=="function"?t(e):t;for(let o=0;o<n.length;o+=1)if(n[o](e))return!0;return!1};function Fu(t){return t instanceof Se}function vn(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Pg(t,e=null){if(!e)return null;const n=ye.atStart(t),o=ye.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return o;const r=n.from,a=o.to;return e==="all"?Se.create(t,vn(0,r,a),vn(t.content.size,r,a)):Se.create(t,vn(e,r,a),vn(e,r,a))}function Up(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function di(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function EM(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const CM=(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:a})=>{e={scrollIntoView:!0,...e};const s=()=>{(di()||Up())&&o.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),EM()&&!di()&&!Up()&&o.dom.focus({preventScroll:!0}))})};if(o.hasFocus()&&t===null||t===!1)return!0;if(a&&t===null&&!Fu(n.state.selection))return s(),!0;const i=Pg(r.doc,t)||n.state.selection,l=n.state.selection.eq(i);return a&&(l||r.setSelection(i),l&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},MM=(t,e)=>n=>t.every((o,r)=>e(o,{...n,index:r})),$M=(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Dg=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):o.nodeType===1&&Dg(o)}return t};function Es(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Dg(n)}function ka(t,e,n){if(t instanceof _n||t instanceof X)return t;n={slice:!0,parseOptions:{},...n};const o=typeof t=="object"&&t!==null,r=typeof t=="string";if(o)try{if(Array.isArray(t)&&t.length>0)return X.fromArray(t.map(s=>e.nodeFromJSON(s)));const a=e.nodeFromJSON(t);return n.errorOnInvalidContent&&a.check(),a}catch(a){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",a),ka("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,i="";const l=new pm({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,i=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?ca.fromSchema(l).parseSlice(Es(t),n.parseOptions):ca.fromSchema(l).parse(Es(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const a=ca.fromSchema(e);return n.slice?a.parseSlice(Es(t),n.parseOptions).content:a.parse(Es(t),n.parseOptions)}return ka("",e,n)}function TM(t,e,n){const o=t.steps.length-1;if(o<e)return;const r=t.steps[o];if(!(r instanceof Jt||r instanceof kt))return;const a=t.mapping.maps[o];let s=0;a.forEach((i,l,c,u)=>{s===0&&(s=u)}),t.setSelection(ye.near(t.doc.resolve(s),n))}const IM=t=>!("type"in t),AM=(t,e,n)=>({tr:o,dispatch:r,editor:a})=>{var s;if(r){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i;const l=g=>{a.emit("contentError",{editor:a,error:g,disableCollaboration:()=>{a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{ka(e,a.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{i=ka(e,a.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:a.options.enableContentCheck})}catch(g){return l(g),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,h=!0;if((IM(i)?i:[i]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===d&&h){const{parent:g}=o.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,d+=1)}let m;if(p){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof X){let g="";e.forEach(v=>{v.text&&(g+=v.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;o.insertText(m,u,d)}else m=i,o.replaceWith(u,d,m);n.updateSelection&&TM(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:m})}return!0},xM=()=>({state:t,dispatch:e})=>TC(t,e),OM=()=>({state:t,dispatch:e})=>IC(t,e),RM=()=>({state:t,dispatch:e})=>SC(t,e),PM=()=>({state:t,dispatch:e})=>MC(t,e),DM=()=>({state:t,dispatch:e,tr:n})=>{try{const o=Di(t.doc,t.selection.$from.pos,-1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},NM=()=>({state:t,dispatch:e,tr:n})=>{try{const o=Di(t.doc,t.selection.$from.pos,1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},LM=()=>({state:t,dispatch:e})=>kC(t,e),UM=()=>({state:t,dispatch:e})=>EC(t,e);function Ng(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function BM(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let o,r,a,s;for(let i=0;i<e.length-1;i+=1){const l=e[i];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))o=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))di()||Ng()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return o&&(n=`Alt-${n}`),r&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}const FM=t=>({editor:e,view:n,tr:o,dispatch:r})=>{const a=BM(t).split(/-(?!$)/),s=a.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),i=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,i))});return l==null||l.steps.forEach(c=>{const u=c.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function Ea(t,e,n={}){const{from:o,to:r,empty:a}=t.selection,s=e?We(e,t.schema):null,i=[];t.doc.nodesBetween(o,r,(u,d)=>{if(u.isText)return;const p=Math.max(o,d),h=Math.min(r,d+u.nodeSize);i.push({node:u,from:p,to:h})});const l=r-o,c=i.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>ui(u.node.attrs,n,{strict:!1}));return a?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=l}const jM=(t,e={})=>({state:n,dispatch:o})=>{const r=We(t,n.schema);return Ea(n,r,e)?AC(n,o):!1},GM=()=>({state:t,dispatch:e})=>PC(t,e),qM=t=>({state:e,dispatch:n})=>{const o=We(t,e.schema);return qC(o)(e,n)},HM=()=>({state:t,dispatch:e})=>xC(t,e);function Hi(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Bp(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((o,r)=>(n.includes(r)||(o[r]=t[r]),o),{})}const VM=(t,e)=>({tr:n,state:o,dispatch:r})=>{let a=null,s=null;const i=Hi(typeof t=="string"?t:t.name,o.schema);return i?(i==="node"&&(a=We(t,o.schema)),i==="mark"&&(s=no(t,o.schema)),r&&n.selection.ranges.forEach(l=>{o.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{a&&a===c.type&&n.setNodeMarkup(u,void 0,Bp(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(Bp(d.attrs,e)))})})}),!0):!1},zM=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),WM=()=>({tr:t,dispatch:e})=>{if(e){const n=new Vn(t.doc);t.setSelection(n)}return!0},KM=()=>({state:t,dispatch:e})=>CC(t,e),YM=()=>({state:t,dispatch:e})=>$C(t,e),JM=()=>({state:t,dispatch:e})=>DC(t,e),XM=()=>({state:t,dispatch:e})=>UC(t,e),QM=()=>({state:t,dispatch:e})=>LC(t,e);function xc(t,e,n={},o={}){return ka(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}const ZM=(t,e=!1,n={},o={})=>({editor:r,tr:a,dispatch:s,commands:i})=>{var l,c;const{doc:u}=a;if(n.preserveWhitespace!=="full"){const d=xc(t,r.schema,n,{errorOnInvalidContent:(l=o.errorOnInvalidContent)!==null&&l!==void 0?l:r.options.enableContentCheck});return s&&a.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!e),!0}return s&&a.setMeta("preventUpdate",!e),i.insertContentAt({from:0,to:u.content.size},t,{parseOptions:n,errorOnInvalidContent:(c=o.errorOnInvalidContent)!==null&&c!==void 0?c:r.options.enableContentCheck})};function Lg(t,e){const n=no(e,t.schema),{from:o,to:r,empty:a}=t.selection,s=[];a?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,l=>{s.push(...l.marks)});const i=s.find(l=>l.type.name===n.name);return i?{...i.attrs}:{}}function e$(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function t$(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function ju(t){return e=>t$(e.$from,t)}function Ug(t,e){const n={from:0,to:t.content.size};return Og(t,n,e)}function n$(t,e){const n=We(e,t.schema),{from:o,to:r}=t.selection,a=[];t.doc.nodesBetween(o,r,i=>{a.push(i)});const s=a.reverse().find(i=>i.type.name===n.name);return s?{...s.attrs}:{}}function o$(t,e){const n=Hi(typeof e=="string"?e:e.name,t.schema);return n==="node"?n$(t,e):n==="mark"?Lg(t,e):{}}function Bg(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(r=>{const a=n.resolve(t),s=Bu(a,r.type);s&&o.push({mark:r,...s})}):n.nodesBetween(t,e,(r,a)=>{!r||(r==null?void 0:r.nodeSize)===void 0||o.push(...r.marks.map(s=>({from:a,to:a+r.nodeSize,mark:s})))}),o}function Bs(t,e,n){return Object.fromEntries(Object.entries(n).filter(([o])=>{const r=t.find(a=>a.type===e&&a.name===o);return r?r.attribute.keepOnSplit:!1}))}function Oc(t,e,n={}){const{empty:o,ranges:r}=t.selection,a=e?no(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>a?a.name===u.type.name:!0).find(u=>ui(u.attrs,n,{strict:!1}));let s=0;const i=[];if(r.forEach(({$from:u,$to:d})=>{const p=u.pos,h=d.pos;t.doc.nodesBetween(p,h,(m,g)=>{if(!m.isText&&!m.marks.length)return;const v=Math.max(p,g),b=Math.min(h,g+m.nodeSize),w=b-v;s+=w,i.push(...m.marks.map(E=>({mark:E,from:v,to:b})))})}),s===0)return!1;const l=i.filter(u=>a?a.name===u.mark.type.name:!0).filter(u=>ui(u.mark.attrs,n,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=i.filter(u=>a?u.mark.type!==a&&u.mark.type.excludes(a):!0).reduce((u,d)=>u+d.to-d.from,0);return(l>0?l+c:l)>=s}function r$(t,e,n={}){if(!e)return Ea(t,null,n)||Oc(t,null,n);const o=Hi(e,t.schema);return o==="node"?Ea(t,e,n):o==="mark"?Oc(t,e,n):!1}function Fp(t,e){const{nodeExtensions:n}=ji(e),o=n.find(s=>s.name===t);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},a=be(ne(o,"group",r));return typeof a!="string"?!1:a.split(" ").includes("list")}function Vi(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((o=t.text)!==null&&o!==void 0?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let r=!0;return t.content.forEach(a=>{r!==!1&&(Vi(a,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}function Fg(t){return t instanceof fe}function jg(t,e,n){const o=t.state.doc.content.size,r=vn(e,0,o),a=vn(n,0,o),s=t.coordsAtPos(r),i=t.coordsAtPos(a,-1),l=Math.min(s.top,i.top),c=Math.max(s.bottom,i.bottom),u=Math.min(s.left,i.left),d=Math.max(s.right,i.right),p=d-u,h=c-l,m={top:l,bottom:c,left:u,right:d,width:p,height:h,x:u,y:l};return{...m,toJSON:()=>m}}function a$(t,e,n){var o;const{selection:r}=e;let a=null;if(Fu(r)&&(a=r.$cursor),a){const i=(o=t.storedMarks)!==null&&o!==void 0?o:a.marks();return!!n.isInSet(i)||!i.some(l=>l.type.excludes(n))}const{ranges:s}=r;return s.some(({$from:i,$to:l})=>{let c=i.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(i.pos,l.pos,(u,d,p)=>{if(c)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=h&&m}return!c}),c})}const s$=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:a}=n,{empty:s,ranges:i}=a,l=no(t,o.schema);if(r)if(s){const c=Lg(o,l);n.addStoredMark(l.create({...c,...e}))}else i.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;o.doc.nodesBetween(u,d,(p,h)=>{const m=Math.max(h,u),g=Math.min(h+p.nodeSize,d);p.marks.find(v=>v.type===l)?p.marks.forEach(v=>{l===v.type&&n.addMark(m,g,l.create({...v.attrs,...e}))}):n.addMark(m,g,l.create(e))})});return a$(o,n,l)},i$=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),l$=(t,e={})=>({state:n,dispatch:o,chain:r})=>{const a=We(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),a.isTextblock?r().command(({commands:i})=>Rp(a,{...s,...e})(n)?!0:i.clearNodes()).command(({state:i})=>Rp(a,{...s,...e})(i,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},c$=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,r=vn(t,0,o.content.size),a=fe.create(o,r);e.setSelection(a)}return!0},u$=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,{from:r,to:a}=typeof t=="number"?{from:t,to:t}:t,s=Se.atStart(o).from,i=Se.atEnd(o).to,l=vn(r,s,i),c=vn(a,s,i),u=Se.create(o,l,c);e.setSelection(u)}return!0},d$=t=>({state:e,dispatch:n})=>{const o=We(t,e.schema);return zC(o)(e,n)};function jp(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(r=>e==null?void 0:e.includes(r.type.name));t.tr.ensureMarks(o)}}const p$=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:r})=>{const{selection:a,doc:s}=e,{$from:i,$to:l}=a,c=r.extensionManager.attributes,u=Bs(c,i.node().type.name,i.node().attrs);if(a instanceof fe&&a.node.isBlock)return!i.parentOffset||!sr(s,i.pos)?!1:(o&&(t&&jp(n,r.extensionManager.splittableMarks),e.split(i.pos).scrollIntoView()),!0);if(!i.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,p=i.depth===0?void 0:e$(i.node(-1).contentMatchAt(i.indexAfter(-1)));let h=d&&p?[{type:p,attrs:u}]:void 0,m=sr(e.doc,e.mapping.map(i.pos),1,h);if(!h&&!m&&sr(e.doc,e.mapping.map(i.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),o){if(m&&(a instanceof Se&&e.deleteSelection(),e.split(e.mapping.map(i.pos),1,h),p&&!d&&!i.parentOffset&&i.parent.type!==p)){const g=e.mapping.map(i.before()),v=e.doc.resolve(g);i.node(-1).canReplaceWith(v.index(),v.index()+1,p)&&e.setNodeMarkup(e.mapping.map(i.before()),p)}t&&jp(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},h$=(t,e={})=>({tr:n,state:o,dispatch:r,editor:a})=>{var s;const i=We(t,o.schema),{$from:l,$to:c}=o.selection,u=o.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==i)return!1;const p=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==i||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let b=X.empty;const w=l.index(-1)?1:l.index(-2)?2:3;for(let M=l.depth-w;M>=l.depth-3;M-=1)b=X.from(l.node(M).copy(b));const E=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,y={...Bs(p,l.node().type.name,l.node().attrs),...e},P=((s=i.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(y))||void 0;b=b.append(X.from(i.createAndFill(null,P)||void 0));const C=l.before(l.depth-(w-1));n.replace(C,l.after(-E),new te(b,4-w,0));let T=-1;n.doc.nodesBetween(C,n.doc.content.size,(M,x)=>{if(T>-1)return!1;M.isTextblock&&M.content.size===0&&(T=x+1)}),T>-1&&n.setSelection(Se.near(n.doc.resolve(T))),n.scrollIntoView()}return!0}const h=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,m={...Bs(p,d.type.name,d.attrs),...e},g={...Bs(p,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const v=h?[{type:i,attrs:m},{type:h,attrs:g}]:[{type:i,attrs:m}];if(!sr(n.doc,l.pos,2))return!1;if(r){const{selection:b,storedMarks:w}=o,{splittableMarks:E}=a.extensionManager,y=w||b.$to.parentOffset&&b.$from.marks();if(n.split(l.pos,2,v).scrollIntoView(),!y||!r)return!0;const P=y.filter(C=>E.includes(C.type.name));n.ensureMarks(P)}return!0},Pl=(t,e)=>{const n=ju(a=>a.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===(r==null?void 0:r.type)&&to(t.doc,n.pos)&&t.join(n.pos),!0},Dl=(t,e)=>{const n=ju(a=>a.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===(r==null?void 0:r.type)&&to(t.doc,o)&&t.join(o),!0},f$=(t,e,n,o={})=>({editor:r,tr:a,state:s,dispatch:i,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:p}=r.extensionManager,h=We(t,s.schema),m=We(e,s.schema),{selection:g,storedMarks:v}=s,{$from:b,$to:w}=g,E=b.blockRange(w),y=v||g.$to.parentOffset&&g.$from.marks();if(!E)return!1;const P=ju(C=>Fp(C.type.name,d))(g);if(E.depth>=1&&P&&E.depth-P.depth<=1){if(P.node.type===h)return c.liftListItem(m);if(Fp(P.node.type.name,d)&&h.validContent(P.node.content)&&i)return l().command(()=>(a.setNodeMarkup(P.pos,h),!0)).command(()=>Pl(a,h)).command(()=>Dl(a,h)).run()}return!n||!y||!i?l().command(()=>u().wrapInList(h,o)?!0:c.clearNodes()).wrapInList(h,o).command(()=>Pl(a,h)).command(()=>Dl(a,h)).run():l().command(()=>{const C=u().wrapInList(h,o),T=y.filter(M=>p.includes(M.type.name));return a.ensureMarks(T),C?!0:c.clearNodes()}).wrapInList(h,o).command(()=>Pl(a,h)).command(()=>Dl(a,h)).run()},m$=(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:a=!1}=n,s=no(t,o.schema);return Oc(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:a}):r.setMark(s,e)},g$=(t,e,n={})=>({state:o,commands:r})=>{const a=We(t,o.schema),s=We(e,o.schema),i=Ea(o,a,n);let l;return o.selection.$anchor.sameParent(o.selection.$head)&&(l=o.selection.$anchor.parent.attrs),i?r.setNode(s,l):r.setNode(a,{...l,...n})},v$=(t,e={})=>({state:n,commands:o})=>{const r=We(t,n.schema);return Ea(n,r,e)?o.lift(r):o.wrapIn(r,e)},y$=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let a;if(r.spec.isInputRules&&(a=r.getState(t))){if(e){const s=t.tr,i=a.transform;for(let l=i.steps.length-1;l>=0;l-=1)s.step(i.steps[l].invert(i.docs[l]));if(a.text){const l=s.doc.resolve(a.from).marks();s.replaceWith(a.from,a.to,t.schema.text(a.text,l))}else s.delete(a.from,a.to)}return!0}}return!1},_$=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},b$=(t,e={})=>({tr:n,state:o,dispatch:r})=>{var a;const{extendEmptyMarkRange:s=!1}=e,{selection:i}=n,l=no(t,o.schema),{$from:c,empty:u,ranges:d}=i;if(!r)return!0;if(u&&s){let{from:p,to:h}=i;const m=(a=c.marks().find(v=>v.type===l))===null||a===void 0?void 0:a.attrs,g=Bu(c,l,m);g&&(p=g.from,h=g.to),n.removeMark(p,h,l)}else d.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,l)});return n.removeStoredMark(l),!0},w$=(t,e={})=>({tr:n,state:o,dispatch:r})=>{let a=null,s=null;const i=Hi(typeof t=="string"?t:t.name,o.schema);return i?(i==="node"&&(a=We(t,o.schema)),i==="mark"&&(s=no(t,o.schema)),r&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;let d,p,h,m;n.selection.empty?o.doc.nodesBetween(c,u,(g,v)=>{a&&a===g.type&&(h=Math.max(v,c),m=Math.min(v+g.nodeSize,u),d=v,p=g)}):o.doc.nodesBetween(c,u,(g,v)=>{v<c&&a&&a===g.type&&(h=Math.max(v,c),m=Math.min(v+g.nodeSize,u),d=v,p=g),v>=c&&v<=u&&(a&&a===g.type&&n.setNodeMarkup(v,void 0,{...g.attrs,...e}),s&&g.marks.length&&g.marks.forEach(b=>{if(s===b.type){const w=Math.max(v,c),E=Math.min(v+g.nodeSize,u);n.addMark(w,E,s.create({...b.attrs,...e}))}}))}),p&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...p.attrs,...e}),s&&p.marks.length&&p.marks.forEach(g=>{s===g.type&&n.addMark(h,m,s.create({...g.attrs,...e}))}))}),!0):!1},S$=(t,e={})=>({state:n,dispatch:o})=>{const r=We(t,n.schema);return BC(r,e)(n,o)},k$=(t,e={})=>({state:n,dispatch:o})=>{const r=We(t,n.schema);return FC(r,e)(n,o)};var E$=Object.freeze({__proto__:null,blur:uM,clearContent:dM,clearNodes:pM,command:hM,createParagraphNear:fM,cut:mM,deleteCurrentNode:gM,deleteNode:vM,deleteRange:yM,deleteSelection:_M,enter:bM,exitCode:wM,extendMarkRange:SM,first:kM,focus:CM,forEach:MM,insertContent:$M,insertContentAt:AM,joinBackward:RM,joinDown:OM,joinForward:PM,joinItemBackward:DM,joinItemForward:NM,joinTextblockBackward:LM,joinTextblockForward:UM,joinUp:xM,keyboardShortcut:FM,lift:jM,liftEmptyBlock:GM,liftListItem:qM,newlineInCode:HM,resetAttributes:VM,scrollIntoView:zM,selectAll:WM,selectNodeBackward:KM,selectNodeForward:YM,selectParentNode:JM,selectTextblockEnd:XM,selectTextblockStart:QM,setContent:ZM,setMark:s$,setMeta:i$,setNode:l$,setNodeSelection:c$,setTextSelection:u$,sinkListItem:d$,splitBlock:p$,splitListItem:h$,toggleList:f$,toggleMark:m$,toggleNode:g$,toggleWrap:v$,undoInputRule:y$,unsetAllMarks:_$,unsetMark:b$,updateAttributes:w$,wrapIn:S$,wrapInList:k$});const C$=et.create({name:"commands",addCommands(){return{...E$}}}),M$=et.create({name:"drop",addProseMirrorPlugins(){return[new je({key:new Ze("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),$$=et.create({name:"editable",addProseMirrorPlugins(){return[new je({key:new Ze("editable"),props:{editable:()=>this.editor.options.editable}})]}}),T$=new Ze("focusEvents"),I$=et.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new je({key:T$,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),A$=et.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:s})=>{const{selection:i,doc:l}=s,{empty:c,$anchor:u}=i,{pos:d,parent:p}=u,h=u.parent.isTextblock&&d>0?s.doc.resolve(d-1):u,m=h.parent.type.spec.isolating,g=u.pos-u.parentOffset,v=m&&h.parent.childCount===1?g===u.pos:ye.atStart(l).from===d;return!c||!p.type.isTextblock||p.textContent.length||!v||v&&u.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...n},r={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return di()||Ng()?r:o},addProseMirrorPlugins(){return[new je({key:new Ze("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(h=>h.getMeta("composition")))return;const o=t.some(h=>h.docChanged)&&!e.doc.eq(n.doc),r=t.some(h=>h.getMeta("preventClearDocument"));if(!o||r)return;const{empty:a,from:s,to:i}=e.selection,l=ye.atStart(e.doc).from,c=ye.atEnd(e.doc).to;if(a||!(s===l&&i===c)||!Vi(n.doc))return;const u=n.tr,d=Bi({state:n,transaction:u}),{commands:p}=new Fi({editor:this.editor,state:d});if(p.clearNodes(),!!u.steps.length)return u}})]}}),x$=et.create({name:"paste",addProseMirrorPlugins(){return[new je({key:new Ze("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),O$=et.create({name:"tabindex",addProseMirrorPlugins(){return[new je({key:new Ze("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});let R$=class Zo{get name(){return this.node.type.name}constructor(e,n,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=n,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,o=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:n,to:o},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Zo(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Zo(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Zo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,o)=>{const r=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,s=this.pos+o+(a?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const i=this.resolvedPos.doc.resolve(s);if(!r&&i.depth<=this.depth)return;const l=new Zo(i,this.editor,r,r?n:null);r&&(l.actualDepth=this.depth+1),e.push(new Zo(i,this.editor,r,r?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let o=null,r=this.parent;for(;r&&!o;)r.node.type.name===e&&(Object.keys(n).length>0||(o=r)),r=r.parent;return o}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const a=Object.keys(n);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&a.every(i=>n[i]===s.node.attrs[i])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,n,o))))}),r}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}};const P$=`.ProseMirror {
|
||
position: relative;
|
||
}
|
||
|
||
.ProseMirror {
|
||
word-wrap: break-word;
|
||
white-space: pre-wrap;
|
||
white-space: break-spaces;
|
||
-webkit-font-variant-ligatures: none;
|
||
font-variant-ligatures: none;
|
||
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
||
}
|
||
|
||
.ProseMirror [contenteditable="false"] {
|
||
white-space: normal;
|
||
}
|
||
|
||
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
||
white-space: pre-wrap;
|
||
}
|
||
|
||
.ProseMirror pre {
|
||
white-space: pre-wrap;
|
||
}
|
||
|
||
img.ProseMirror-separator {
|
||
display: inline !important;
|
||
border: none !important;
|
||
margin: 0 !important;
|
||
width: 0 !important;
|
||
height: 0 !important;
|
||
}
|
||
|
||
.ProseMirror-gapcursor {
|
||
display: none;
|
||
pointer-events: none;
|
||
position: absolute;
|
||
margin: 0;
|
||
}
|
||
|
||
.ProseMirror-gapcursor:after {
|
||
content: "";
|
||
display: block;
|
||
position: absolute;
|
||
top: -2px;
|
||
width: 20px;
|
||
border-top: 1px solid black;
|
||
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
||
}
|
||
|
||
@keyframes ProseMirror-cursor-blink {
|
||
to {
|
||
visibility: hidden;
|
||
}
|
||
}
|
||
|
||
.ProseMirror-hideselection *::selection {
|
||
background: transparent;
|
||
}
|
||
|
||
.ProseMirror-hideselection *::-moz-selection {
|
||
background: transparent;
|
||
}
|
||
|
||
.ProseMirror-hideselection * {
|
||
caret-color: transparent;
|
||
}
|
||
|
||
.ProseMirror-focused .ProseMirror-gapcursor {
|
||
display: block;
|
||
}
|
||
|
||
.tippy-box[data-animation=fade][data-state=hidden] {
|
||
opacity: 0
|
||
}`;function D$(t,e,n){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(r),r}let N$=class extends WC{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:n,moved:o})=>this.options.onDrop(e,n,o)),this.on("paste",({event:e,slice:n})=>this.options.onPaste(e,n)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=D$(P$,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n=xg(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(r=>{const a=typeof r=="string"?`${r}$`:r.key;n=n.filter(s=>!s.key.startsWith(a))}),e.length===n.length)return;const o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[$$,cM.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),C$,I$,A$,O$,M$,x$].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new lM(n,this)}createCommandManager(){this.commandManager=new Fi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let e;try{e=xc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(a){if(!(a instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(a.message))throw a;this.emit("contentError",{editor:this,error:a,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),e=xc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=Pg(e,this.options.autofocus);this.view=new Sg(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:IE.create({doc:e,selection:n||void 0})});const o=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(o),this.createNodeViews(),this.prependClass();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(a=>{var s;return(s=this.capturedTransaction)===null||s===void 0?void 0:s.step(a)});return}const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=t.getMeta("focus"),r=t.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:t}),r&&this.emit("blur",{editor:this,event:r.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return o$(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,o=typeof t=="string"?e:t;return r$(this.state,n,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Nu(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
|
||
|
||
`,textSerializers:n={}}=t||{};return Ug(this.state.doc,{blockSeparator:e,textSerializers:{...Uu(this.schema),...n}})}get isEmpty(){return Vi(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new R$(e,this)}get $doc(){return this.$pos(0)}};function vr(t){return new Gi({find:t.find,handler:({state:e,range:n,match:o})=>{const r=be(t.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:a}=e,s=o[o.length-1],i=o[0];if(s){const l=i.search(/\S/),c=n.from+i.indexOf(s),u=c+s.length;if(Bg(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(h=>h===t.type&&h!==p.mark.type)).filter(p=>p.to>c).length)return null;u<n.to&&a.delete(u,n.to),c>n.from&&a.delete(n.from+l,c);const d=n.from+l+s.length;a.addMark(n.from+l,d,t.type.create(r||{})),a.removeStoredMark(t.type)}}})}function Gg(t){return new Gi({find:t.find,handler:({state:e,range:n,match:o})=>{const r=be(t.getAttributes,void 0,o)||{},{tr:a}=e,s=n.from;let i=n.to;const l=t.type.create(r);if(o[1]){const c=o[0].lastIndexOf(o[1]);let u=s+c;u>i?u=i:i=u+o[1].length;const d=o[0][o[0].length-1];a.insertText(d,s+o[0].length-1),a.replaceWith(u,i,l)}else if(o[0]){const c=t.type.isInline?s:s-1;a.insert(c,t.type.create(r)).delete(a.mapping.map(s),a.mapping.map(i))}a.scrollIntoView()}})}function Rc(t){return new Gi({find:t.find,handler:({state:e,range:n,match:o})=>{const r=e.doc.resolve(n.from),a=be(t.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,a)}})}function Ca(t){return new Gi({find:t.find,handler:({state:e,range:n,match:o,chain:r})=>{const a=be(t.getAttributes,void 0,o)||{},s=e.tr.delete(n.from,n.to),i=s.doc.resolve(n.from).blockRange(),l=i&&Eu(i,t.type,a);if(!l)return null;if(s.wrap(i,l),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:p}=t.editor.extensionManager,h=d||u.$to.parentOffset&&u.$from.marks();if(h){const m=h.filter(g=>p.includes(g.type.name));s.ensureMarks(m)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(u,a).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&to(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,c))&&s.join(n.from-1)}})}class rt{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=be(ne(this,"addOptions",{name:this.name}))),this.storage=be(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new rt(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>qi(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new rt(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=be(ne(n,"addOptions",{name:n.name})),n.storage=be(ne(n,"addStorage",{name:n.name,options:n.options})),n}}function yr(t){return new nM({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:r})=>{const a=be(t.getAttributes,void 0,o,r);if(a===!1||a===null)return null;const{tr:s}=e,i=o[o.length-1],l=o[0];let c=n.to;if(i){const u=l.search(/\S/),d=n.from+l.indexOf(i),p=d+i.length;if(Bg(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>d).length)return null;p<n.to&&s.delete(p,n.to),d>n.from&&s.delete(n.from+u,d),c=n.from+u+i.length,s.addMark(n.from+u,c,t.type.create(a||{})),s.removeStoredMark(t.type)}}})}function L$(t,e){const{selection:n}=t,{$from:o}=n;if(n instanceof fe){const a=o.index();return o.parent.canReplaceWith(a,a+1,e)}let r=o.depth;for(;r>=0;){const a=o.index(r);if(o.node(r).contentMatchAt(a).matchType(e))return!0;r-=1}return!1}function U$(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var wt="top",jt="bottom",Gt="right",St="left",Gu="auto",Wa=[wt,jt,Gt,St],_r="start",Ma="end",B$="clippingParents",qg="viewport",Br="popper",F$="reference",Gp=Wa.reduce(function(t,e){return t.concat([e+"-"+_r,e+"-"+Ma])},[]),Hg=[].concat(Wa,[Gu]).reduce(function(t,e){return t.concat([e,e+"-"+_r,e+"-"+Ma])},[]),j$="beforeRead",G$="read",q$="afterRead",H$="beforeMain",V$="main",z$="afterMain",W$="beforeWrite",K$="write",Y$="afterWrite",J$=[j$,G$,q$,H$,V$,z$,W$,K$,Y$];function cn(t){return t?(t.nodeName||"").toLowerCase():null}function xt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Ao(t){var e=xt(t).Element;return t instanceof e||t instanceof Element}function Ft(t){var e=xt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function qu(t){if(typeof ShadowRoot>"u")return!1;var e=xt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function X$(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var o=e.styles[n]||{},r=e.attributes[n]||{},a=e.elements[n];!Ft(a)||!cn(a)||(Object.assign(a.style,o),Object.keys(r).forEach(function(s){var i=r[s];i===!1?a.removeAttribute(s):a.setAttribute(s,i===!0?"":i)}))})}function Q$(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(o){var r=e.elements[o],a=e.attributes[o]||{},s=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:n[o]),i=s.reduce(function(l,c){return l[c]="",l},{});!Ft(r)||!cn(r)||(Object.assign(r.style,i),Object.keys(a).forEach(function(l){r.removeAttribute(l)}))})}}const Vg={name:"applyStyles",enabled:!0,phase:"write",fn:X$,effect:Q$,requires:["computeStyles"]};function on(t){return t.split("-")[0]}var Eo=Math.max,pi=Math.min,br=Math.round;function Pc(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function zg(){return!/^((?!chrome|android).)*safari/i.test(Pc())}function wr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var o=t.getBoundingClientRect(),r=1,a=1;e&&Ft(t)&&(r=t.offsetWidth>0&&br(o.width)/t.offsetWidth||1,a=t.offsetHeight>0&&br(o.height)/t.offsetHeight||1);var s=Ao(t)?xt(t):window,i=s.visualViewport,l=!zg()&&n,c=(o.left+(l&&i?i.offsetLeft:0))/r,u=(o.top+(l&&i?i.offsetTop:0))/a,d=o.width/r,p=o.height/a;return{width:d,height:p,top:u,right:c+d,bottom:u+p,left:c,x:c,y:u}}function Hu(t){var e=wr(t),n=t.offsetWidth,o=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:o}}function Wg(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&qu(n)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function Mn(t){return xt(t).getComputedStyle(t)}function Z$(t){return["table","td","th"].indexOf(cn(t))>=0}function oo(t){return((Ao(t)?t.ownerDocument:t.document)||window.document).documentElement}function zi(t){return cn(t)==="html"?t:t.assignedSlot||t.parentNode||(qu(t)?t.host:null)||oo(t)}function qp(t){return!Ft(t)||Mn(t).position==="fixed"?null:t.offsetParent}function eT(t){var e=/firefox/i.test(Pc()),n=/Trident/i.test(Pc());if(n&&Ft(t)){var o=Mn(t);if(o.position==="fixed")return null}var r=zi(t);for(qu(r)&&(r=r.host);Ft(r)&&["html","body"].indexOf(cn(r))<0;){var a=Mn(r);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||e&&a.willChange==="filter"||e&&a.filter&&a.filter!=="none")return r;r=r.parentNode}return null}function Ka(t){for(var e=xt(t),n=qp(t);n&&Z$(n)&&Mn(n).position==="static";)n=qp(n);return n&&(cn(n)==="html"||cn(n)==="body"&&Mn(n).position==="static")?e:n||eT(t)||e}function Vu(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function fa(t,e,n){return Eo(t,pi(e,n))}function tT(t,e,n){var o=fa(t,e,n);return o>n?n:o}function Kg(){return{top:0,right:0,bottom:0,left:0}}function Yg(t){return Object.assign({},Kg(),t)}function Jg(t,e){return e.reduce(function(n,o){return n[o]=t,n},{})}var nT=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,Yg(typeof t!="number"?t:Jg(t,Wa))};function oT(t){var e,n=t.state,o=t.name,r=t.options,a=n.elements.arrow,s=n.modifiersData.popperOffsets,i=on(n.placement),l=Vu(i),c=[St,Gt].indexOf(i)>=0,u=c?"height":"width";if(!(!a||!s)){var d=nT(r.padding,n),p=Hu(a),h=l==="y"?wt:St,m=l==="y"?jt:Gt,g=n.rects.reference[u]+n.rects.reference[l]-s[l]-n.rects.popper[u],v=s[l]-n.rects.reference[l],b=Ka(a),w=b?l==="y"?b.clientHeight||0:b.clientWidth||0:0,E=g/2-v/2,y=d[h],P=w-p[u]-d[m],C=w/2-p[u]/2+E,T=fa(y,C,P),M=l;n.modifiersData[o]=(e={},e[M]=T,e.centerOffset=T-C,e)}}function rT(t){var e=t.state,n=t.options,o=n.element,r=o===void 0?"[data-popper-arrow]":o;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||Wg(e.elements.popper,r)&&(e.elements.arrow=r))}const aT={name:"arrow",enabled:!0,phase:"main",fn:oT,effect:rT,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Sr(t){return t.split("-")[1]}var sT={top:"auto",right:"auto",bottom:"auto",left:"auto"};function iT(t,e){var n=t.x,o=t.y,r=e.devicePixelRatio||1;return{x:br(n*r)/r||0,y:br(o*r)/r||0}}function Hp(t){var e,n=t.popper,o=t.popperRect,r=t.placement,a=t.variation,s=t.offsets,i=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,d=t.isFixed,p=s.x,h=p===void 0?0:p,m=s.y,g=m===void 0?0:m,v=typeof u=="function"?u({x:h,y:g}):{x:h,y:g};h=v.x,g=v.y;var b=s.hasOwnProperty("x"),w=s.hasOwnProperty("y"),E=St,y=wt,P=window;if(c){var C=Ka(n),T="clientHeight",M="clientWidth";if(C===xt(n)&&(C=oo(n),Mn(C).position!=="static"&&i==="absolute"&&(T="scrollHeight",M="scrollWidth")),C=C,r===wt||(r===St||r===Gt)&&a===Ma){y=jt;var x=d&&C===P&&P.visualViewport?P.visualViewport.height:C[T];g-=x-o.height,g*=l?1:-1}if(r===St||(r===wt||r===jt)&&a===Ma){E=Gt;var L=d&&C===P&&P.visualViewport?P.visualViewport.width:C[M];h-=L-o.width,h*=l?1:-1}}var q=Object.assign({position:i},c&&sT),$=u===!0?iT({x:h,y:g},xt(n)):{x:h,y:g};if(h=$.x,g=$.y,l){var D;return Object.assign({},q,(D={},D[y]=w?"0":"",D[E]=b?"0":"",D.transform=(P.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",D))}return Object.assign({},q,(e={},e[y]=w?g+"px":"",e[E]=b?h+"px":"",e.transform="",e))}function lT(t){var e=t.state,n=t.options,o=n.gpuAcceleration,r=o===void 0?!0:o,a=n.adaptive,s=a===void 0?!0:a,i=n.roundOffsets,l=i===void 0?!0:i,c={placement:on(e.placement),variation:Sr(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Hp(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Hp(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const cT={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:lT,data:{}};var Cs={passive:!0};function uT(t){var e=t.state,n=t.instance,o=t.options,r=o.scroll,a=r===void 0?!0:r,s=o.resize,i=s===void 0?!0:s,l=xt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return a&&c.forEach(function(u){u.addEventListener("scroll",n.update,Cs)}),i&&l.addEventListener("resize",n.update,Cs),function(){a&&c.forEach(function(u){u.removeEventListener("scroll",n.update,Cs)}),i&&l.removeEventListener("resize",n.update,Cs)}}const dT={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:uT,data:{}};var pT={left:"right",right:"left",bottom:"top",top:"bottom"};function Fs(t){return t.replace(/left|right|bottom|top/g,function(e){return pT[e]})}var hT={start:"end",end:"start"};function Vp(t){return t.replace(/start|end/g,function(e){return hT[e]})}function zu(t){var e=xt(t),n=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:n,scrollTop:o}}function Wu(t){return wr(oo(t)).left+zu(t).scrollLeft}function fT(t,e){var n=xt(t),o=oo(t),r=n.visualViewport,a=o.clientWidth,s=o.clientHeight,i=0,l=0;if(r){a=r.width,s=r.height;var c=zg();(c||!c&&e==="fixed")&&(i=r.offsetLeft,l=r.offsetTop)}return{width:a,height:s,x:i+Wu(t),y:l}}function mT(t){var e,n=oo(t),o=zu(t),r=(e=t.ownerDocument)==null?void 0:e.body,a=Eo(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=Eo(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),i=-o.scrollLeft+Wu(t),l=-o.scrollTop;return Mn(r||n).direction==="rtl"&&(i+=Eo(n.clientWidth,r?r.clientWidth:0)-a),{width:a,height:s,x:i,y:l}}function Ku(t){var e=Mn(t),n=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function Xg(t){return["html","body","#document"].indexOf(cn(t))>=0?t.ownerDocument.body:Ft(t)&&Ku(t)?t:Xg(zi(t))}function ma(t,e){var n;e===void 0&&(e=[]);var o=Xg(t),r=o===((n=t.ownerDocument)==null?void 0:n.body),a=xt(o),s=r?[a].concat(a.visualViewport||[],Ku(o)?o:[]):o,i=e.concat(s);return r?i:i.concat(ma(zi(s)))}function Dc(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function gT(t,e){var n=wr(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function zp(t,e,n){return e===qg?Dc(fT(t,n)):Ao(e)?gT(e,n):Dc(mT(oo(t)))}function vT(t){var e=ma(zi(t)),n=["absolute","fixed"].indexOf(Mn(t).position)>=0,o=n&&Ft(t)?Ka(t):t;return Ao(o)?e.filter(function(r){return Ao(r)&&Wg(r,o)&&cn(r)!=="body"}):[]}function yT(t,e,n,o){var r=e==="clippingParents"?vT(t):[].concat(e),a=[].concat(r,[n]),s=a[0],i=a.reduce(function(l,c){var u=zp(t,c,o);return l.top=Eo(u.top,l.top),l.right=pi(u.right,l.right),l.bottom=pi(u.bottom,l.bottom),l.left=Eo(u.left,l.left),l},zp(t,s,o));return i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}function Qg(t){var e=t.reference,n=t.element,o=t.placement,r=o?on(o):null,a=o?Sr(o):null,s=e.x+e.width/2-n.width/2,i=e.y+e.height/2-n.height/2,l;switch(r){case wt:l={x:s,y:e.y-n.height};break;case jt:l={x:s,y:e.y+e.height};break;case Gt:l={x:e.x+e.width,y:i};break;case St:l={x:e.x-n.width,y:i};break;default:l={x:e.x,y:e.y}}var c=r?Vu(r):null;if(c!=null){var u=c==="y"?"height":"width";switch(a){case _r:l[c]=l[c]-(e[u]/2-n[u]/2);break;case Ma:l[c]=l[c]+(e[u]/2-n[u]/2);break}}return l}function $a(t,e){e===void 0&&(e={});var n=e,o=n.placement,r=o===void 0?t.placement:o,a=n.strategy,s=a===void 0?t.strategy:a,i=n.boundary,l=i===void 0?B$:i,c=n.rootBoundary,u=c===void 0?qg:c,d=n.elementContext,p=d===void 0?Br:d,h=n.altBoundary,m=h===void 0?!1:h,g=n.padding,v=g===void 0?0:g,b=Yg(typeof v!="number"?v:Jg(v,Wa)),w=p===Br?F$:Br,E=t.rects.popper,y=t.elements[m?w:p],P=yT(Ao(y)?y:y.contextElement||oo(t.elements.popper),l,u,s),C=wr(t.elements.reference),T=Qg({reference:C,element:E,placement:r}),M=Dc(Object.assign({},E,T)),x=p===Br?M:C,L={top:P.top-x.top+b.top,bottom:x.bottom-P.bottom+b.bottom,left:P.left-x.left+b.left,right:x.right-P.right+b.right},q=t.modifiersData.offset;if(p===Br&&q){var $=q[r];Object.keys(L).forEach(function(D){var G=[Gt,jt].indexOf(D)>=0?1:-1,k=[wt,jt].indexOf(D)>=0?"y":"x";L[D]+=$[k]*G})}return L}function _T(t,e){e===void 0&&(e={});var n=e,o=n.placement,r=n.boundary,a=n.rootBoundary,s=n.padding,i=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?Hg:l,u=Sr(o),d=u?i?Gp:Gp.filter(function(m){return Sr(m)===u}):Wa,p=d.filter(function(m){return c.indexOf(m)>=0});p.length===0&&(p=d);var h=p.reduce(function(m,g){return m[g]=$a(t,{placement:g,boundary:r,rootBoundary:a,padding:s})[on(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function bT(t){if(on(t)===Gu)return[];var e=Fs(t);return[Vp(t),e,Vp(e)]}function wT(t){var e=t.state,n=t.options,o=t.name;if(!e.modifiersData[o]._skip){for(var r=n.mainAxis,a=r===void 0?!0:r,s=n.altAxis,i=s===void 0?!0:s,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,p=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,g=n.allowedAutoPlacements,v=e.options.placement,b=on(v),w=b===v,E=l||(w||!m?[Fs(v)]:bT(v)),y=[v].concat(E).reduce(function(Mt,vt){return Mt.concat(on(vt)===Gu?_T(e,{placement:vt,boundary:u,rootBoundary:d,padding:c,flipVariations:m,allowedAutoPlacements:g}):vt)},[]),P=e.rects.reference,C=e.rects.popper,T=new Map,M=!0,x=y[0],L=0;L<y.length;L++){var q=y[L],$=on(q),D=Sr(q)===_r,G=[wt,jt].indexOf($)>=0,k=G?"width":"height",N=$a(e,{placement:q,boundary:u,rootBoundary:d,altBoundary:p,padding:c}),F=G?D?Gt:St:D?jt:wt;P[k]>C[k]&&(F=Fs(F));var K=Fs(F),J=[];if(a&&J.push(N[$]<=0),i&&J.push(N[F]<=0,N[K]<=0),J.every(function(Mt){return Mt})){x=q,M=!1;break}T.set(q,J)}if(M)for(var pe=m?3:1,le=function(Mt){var vt=y.find(function(xn){var ro=T.get(xn);if(ro)return ro.slice(0,Mt).every(function(On){return On})});if(vt)return x=vt,"break"},_e=pe;_e>0;_e--){var Ae=le(_e);if(Ae==="break")break}e.placement!==x&&(e.modifiersData[o]._skip=!0,e.placement=x,e.reset=!0)}}const ST={name:"flip",enabled:!0,phase:"main",fn:wT,requiresIfExists:["offset"],data:{_skip:!1}};function Wp(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function Kp(t){return[wt,Gt,jt,St].some(function(e){return t[e]>=0})}function kT(t){var e=t.state,n=t.name,o=e.rects.reference,r=e.rects.popper,a=e.modifiersData.preventOverflow,s=$a(e,{elementContext:"reference"}),i=$a(e,{altBoundary:!0}),l=Wp(s,o),c=Wp(i,r,a),u=Kp(l),d=Kp(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const ET={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:kT};function CT(t,e,n){var o=on(t),r=[St,wt].indexOf(o)>=0?-1:1,a=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=a[0],i=a[1];return s=s||0,i=(i||0)*r,[St,Gt].indexOf(o)>=0?{x:i,y:s}:{x:s,y:i}}function MT(t){var e=t.state,n=t.options,o=t.name,r=n.offset,a=r===void 0?[0,0]:r,s=Hg.reduce(function(u,d){return u[d]=CT(d,e.rects,a),u},{}),i=s[e.placement],l=i.x,c=i.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[o]=s}const $T={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:MT};function TT(t){var e=t.state,n=t.name;e.modifiersData[n]=Qg({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const IT={name:"popperOffsets",enabled:!0,phase:"read",fn:TT,data:{}};function AT(t){return t==="x"?"y":"x"}function xT(t){var e=t.state,n=t.options,o=t.name,r=n.mainAxis,a=r===void 0?!0:r,s=n.altAxis,i=s===void 0?!1:s,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,p=n.tether,h=p===void 0?!0:p,m=n.tetherOffset,g=m===void 0?0:m,v=$a(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),b=on(e.placement),w=Sr(e.placement),E=!w,y=Vu(b),P=AT(y),C=e.modifiersData.popperOffsets,T=e.rects.reference,M=e.rects.popper,x=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,L=typeof x=="number"?{mainAxis:x,altAxis:x}:Object.assign({mainAxis:0,altAxis:0},x),q=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,$={x:0,y:0};if(C){if(a){var D,G=y==="y"?wt:St,k=y==="y"?jt:Gt,N=y==="y"?"height":"width",F=C[y],K=F+v[G],J=F-v[k],pe=h?-M[N]/2:0,le=w===_r?T[N]:M[N],_e=w===_r?-M[N]:-T[N],Ae=e.elements.arrow,Mt=h&&Ae?Hu(Ae):{width:0,height:0},vt=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Kg(),xn=vt[G],ro=vt[k],On=fa(0,T[N],Mt[N]),Ja=E?T[N]/2-pe-On-xn-L.mainAxis:le-On-xn-L.mainAxis,Rn=E?-T[N]/2+pe+On+ro+L.mainAxis:_e+On+ro+L.mainAxis,Lo=e.elements.arrow&&Ka(e.elements.arrow),Xa=Lo?y==="y"?Lo.clientTop||0:Lo.clientLeft||0:0,Rr=(D=q==null?void 0:q[y])!=null?D:0,Qa=F+Ja-Rr-Xa,Za=F+Rn-Rr,Pr=fa(h?pi(K,Qa):K,F,h?Eo(J,Za):J);C[y]=Pr,$[y]=Pr-F}if(i){var Dr,es=y==="x"?wt:St,ts=y==="x"?jt:Gt,hn=C[P],Pn=P==="y"?"height":"width",Nr=hn+v[es],ao=hn-v[ts],Lr=[wt,St].indexOf(b)!==-1,ns=(Dr=q==null?void 0:q[P])!=null?Dr:0,rs=Lr?Nr:hn-T[Pn]-M[Pn]-ns+L.altAxis,as=Lr?hn+T[Pn]+M[Pn]-ns-L.altAxis:ao,ss=h&&Lr?tT(rs,hn,as):fa(h?rs:Nr,hn,h?as:ao);C[P]=ss,$[P]=ss-hn}e.modifiersData[o]=$}}const OT={name:"preventOverflow",enabled:!0,phase:"main",fn:xT,requiresIfExists:["offset"]};function RT(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function PT(t){return t===xt(t)||!Ft(t)?zu(t):RT(t)}function DT(t){var e=t.getBoundingClientRect(),n=br(e.width)/t.offsetWidth||1,o=br(e.height)/t.offsetHeight||1;return n!==1||o!==1}function NT(t,e,n){n===void 0&&(n=!1);var o=Ft(e),r=Ft(e)&&DT(e),a=oo(e),s=wr(t,r,n),i={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(o||!o&&!n)&&((cn(e)!=="body"||Ku(a))&&(i=PT(e)),Ft(e)?(l=wr(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):a&&(l.x=Wu(a))),{x:s.left+i.scrollLeft-l.x,y:s.top+i.scrollTop-l.y,width:s.width,height:s.height}}function LT(t){var e=new Map,n=new Set,o=[];t.forEach(function(a){e.set(a.name,a)});function r(a){n.add(a.name);var s=[].concat(a.requires||[],a.requiresIfExists||[]);s.forEach(function(i){if(!n.has(i)){var l=e.get(i);l&&r(l)}}),o.push(a)}return t.forEach(function(a){n.has(a.name)||r(a)}),o}function UT(t){var e=LT(t);return J$.reduce(function(n,o){return n.concat(e.filter(function(r){return r.phase===o}))},[])}function BT(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function FT(t){var e=t.reduce(function(n,o){var r=n[o.name];return n[o.name]=r?Object.assign({},r,o,{options:Object.assign({},r.options,o.options),data:Object.assign({},r.data,o.data)}):o,n},{});return Object.keys(e).map(function(n){return e[n]})}var Yp={placement:"bottom",modifiers:[],strategy:"absolute"};function Jp(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function jT(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,o=n===void 0?[]:n,r=e.defaultOptions,a=r===void 0?Yp:r;return function(s,i,l){l===void 0&&(l=a);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Yp,a),modifiersData:{},elements:{reference:s,popper:i},attributes:{},styles:{}},u=[],d=!1,p={state:c,setOptions:function(g){var v=typeof g=="function"?g(c.options):g;m(),c.options=Object.assign({},a,c.options,v),c.scrollParents={reference:Ao(s)?ma(s):s.contextElement?ma(s.contextElement):[],popper:ma(i)};var b=UT(FT([].concat(o,c.options.modifiers)));return c.orderedModifiers=b.filter(function(w){return w.enabled}),h(),p.update()},forceUpdate:function(){if(!d){var g=c.elements,v=g.reference,b=g.popper;if(Jp(v,b)){c.rects={reference:NT(v,Ka(b),c.options.strategy==="fixed"),popper:Hu(b)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(M){return c.modifiersData[M.name]=Object.assign({},M.data)});for(var w=0;w<c.orderedModifiers.length;w++){if(c.reset===!0){c.reset=!1,w=-1;continue}var E=c.orderedModifiers[w],y=E.fn,P=E.options,C=P===void 0?{}:P,T=E.name;typeof y=="function"&&(c=y({state:c,options:C,name:T,instance:p})||c)}}}},update:BT(function(){return new Promise(function(g){p.forceUpdate(),g(c)})}),destroy:function(){m(),d=!0}};if(!Jp(s,i))return p;p.setOptions(l).then(function(g){!d&&l.onFirstUpdate&&l.onFirstUpdate(g)});function h(){c.orderedModifiers.forEach(function(g){var v=g.name,b=g.options,w=b===void 0?{}:b,E=g.effect;if(typeof E=="function"){var y=E({state:c,name:v,instance:p,options:w}),P=function(){};u.push(y||P)}})}function m(){u.forEach(function(g){return g()}),u=[]}return p}}var GT=[dT,IT,cT,Vg,$T,ST,OT,aT,ET],qT=jT({defaultModifiers:GT}),HT="tippy-box",Zg="tippy-content",VT="tippy-backdrop",ev="tippy-arrow",tv="tippy-svg-arrow",ho={passive:!0,capture:!0},nv=function(){return document.body};function Nl(t,e,n){if(Array.isArray(t)){var o=t[e];return o??(Array.isArray(n)?n[e]:n)}return t}function Yu(t,e){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(e+"]")>-1}function ov(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Xp(t,e){if(e===0)return t;var n;return function(o){clearTimeout(n),n=setTimeout(function(){t(o)},e)}}function zT(t){return t.split(/\s+/).filter(Boolean)}function er(t){return[].concat(t)}function Qp(t,e){t.indexOf(e)===-1&&t.push(e)}function WT(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function KT(t){return t.split("-")[0]}function hi(t){return[].slice.call(t)}function Zp(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function ga(){return document.createElement("div")}function Wi(t){return["Element","Fragment"].some(function(e){return Yu(t,e)})}function YT(t){return Yu(t,"NodeList")}function JT(t){return Yu(t,"MouseEvent")}function XT(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function QT(t){return Wi(t)?[t]:YT(t)?hi(t):Array.isArray(t)?t:hi(document.querySelectorAll(t))}function Ll(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function eh(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function ZT(t){var e,n=er(t),o=n[0];return o!=null&&(e=o.ownerDocument)!=null&&e.body?o.ownerDocument:document}function eI(t,e){var n=e.clientX,o=e.clientY;return t.every(function(r){var a=r.popperRect,s=r.popperState,i=r.props,l=i.interactiveBorder,c=KT(s.placement),u=s.modifiersData.offset;if(!u)return!0;var d=c==="bottom"?u.top.y:0,p=c==="top"?u.bottom.y:0,h=c==="right"?u.left.x:0,m=c==="left"?u.right.x:0,g=a.top-o+d>l,v=o-a.bottom-p>l,b=a.left-n+h>l,w=n-a.right-m>l;return g||v||b||w})}function Ul(t,e,n){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){t[o](r,n)})}function th(t,e){for(var n=e;n;){var o;if(t.contains(n))return!0;n=n.getRootNode==null||(o=n.getRootNode())==null?void 0:o.host}return!1}var Qt={isTouch:!1},nh=0;function tI(){Qt.isTouch||(Qt.isTouch=!0,window.performance&&document.addEventListener("mousemove",rv))}function rv(){var t=performance.now();t-nh<20&&(Qt.isTouch=!1,document.removeEventListener("mousemove",rv)),nh=t}function nI(){var t=document.activeElement;if(XT(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function oI(){document.addEventListener("touchstart",tI,ho),window.addEventListener("blur",nI)}var rI=typeof window<"u"&&typeof document<"u",aI=rI?!!window.msCrypto:!1,sI={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},iI={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Vt=Object.assign({appendTo:nv,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},sI,iI),lI=Object.keys(Vt),cI=function(t){var e=Object.keys(t);e.forEach(function(n){Vt[n]=t[n]})};function av(t){var e=t.plugins||[],n=e.reduce(function(o,r){var a=r.name,s=r.defaultValue;if(a){var i;o[a]=t[a]!==void 0?t[a]:(i=Vt[a])!=null?i:s}return o},{});return Object.assign({},t,n)}function uI(t,e){var n=e?Object.keys(av(Object.assign({},Vt,{plugins:e}))):lI,o=n.reduce(function(r,a){var s=(t.getAttribute("data-tippy-"+a)||"").trim();if(!s)return r;if(a==="content")r[a]=s;else try{r[a]=JSON.parse(s)}catch{r[a]=s}return r},{});return o}function oh(t,e){var n=Object.assign({},e,{content:ov(e.content,[t])},e.ignoreAttributes?{}:uI(t,e.plugins));return n.aria=Object.assign({},Vt.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}var dI=function(){return"innerHTML"};function Nc(t,e){t[dI()]=e}function rh(t){var e=ga();return t===!0?e.className=ev:(e.className=tv,Wi(t)?e.appendChild(t):Nc(e,t)),e}function ah(t,e){Wi(e.content)?(Nc(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Nc(t,e.content):t.textContent=e.content)}function Lc(t){var e=t.firstElementChild,n=hi(e.children);return{box:e,content:n.find(function(o){return o.classList.contains(Zg)}),arrow:n.find(function(o){return o.classList.contains(ev)||o.classList.contains(tv)}),backdrop:n.find(function(o){return o.classList.contains(VT)})}}function sv(t){var e=ga(),n=ga();n.className=HT,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var o=ga();o.className=Zg,o.setAttribute("data-state","hidden"),ah(o,t.props),e.appendChild(n),n.appendChild(o),r(t.props,t.props);function r(a,s){var i=Lc(e),l=i.box,c=i.content,u=i.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),typeof s.animation=="string"?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(a.content!==s.content||a.allowHTML!==s.allowHTML)&&ah(c,t.props),s.arrow?u?a.arrow!==s.arrow&&(l.removeChild(u),l.appendChild(rh(s.arrow))):l.appendChild(rh(s.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:r}}sv.$$tippy=!0;var pI=1,Ms=[],Bl=[];function hI(t,e){var n=oh(t,Object.assign({},Vt,av(Zp(e)))),o,r,a,s=!1,i=!1,l=!1,c=!1,u,d,p,h=[],m=Xp(Qa,n.interactiveDebounce),g,v=pI++,b=null,w=WT(n.plugins),E={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},y={id:v,reference:t,popper:ga(),popperInstance:b,props:n,state:E,plugins:w,clearDelayTimeouts:rs,setProps:as,setContent:ss,show:ly,hide:cy,hideWithInteractivity:uy,enable:Lr,disable:ns,unmount:dy,destroy:py};if(!n.render)return y;var P=n.render(y),C=P.popper,T=P.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+y.id,y.popper=C,t._tippy=y,C._tippy=y;var M=w.map(function(W){return W.fn(y)}),x=t.hasAttribute("aria-expanded");return Lo(),pe(),F(),K("onCreate",[y]),n.showOnCreate&&Nr(),C.addEventListener("mouseenter",function(){y.props.interactive&&y.state.isVisible&&y.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){y.props.interactive&&y.props.trigger.indexOf("mouseenter")>=0&&G().addEventListener("mousemove",m)}),y;function L(){var W=y.props.touch;return Array.isArray(W)?W:[W,0]}function q(){return L()[0]==="hold"}function $(){var W;return!!((W=y.props.render)!=null&&W.$$tippy)}function D(){return g||t}function G(){var W=D().parentNode;return W?ZT(W):document}function k(){return Lc(C)}function N(W){return y.state.isMounted&&!y.state.isVisible||Qt.isTouch||u&&u.type==="focus"?0:Nl(y.props.delay,W?0:1,Vt.delay)}function F(W){W===void 0&&(W=!1),C.style.pointerEvents=y.props.interactive&&!W?"":"none",C.style.zIndex=""+y.props.zIndex}function K(W,re,me){if(me===void 0&&(me=!0),M.forEach(function(Ee){Ee[W]&&Ee[W].apply(Ee,re)}),me){var $e;($e=y.props)[W].apply($e,re)}}function J(){var W=y.props.aria;if(W.content){var re="aria-"+W.content,me=C.id,$e=er(y.props.triggerTarget||t);$e.forEach(function(Ee){var lt=Ee.getAttribute(re);if(y.state.isVisible)Ee.setAttribute(re,lt?lt+" "+me:me);else{var Pt=lt&<.replace(me,"").trim();Pt?Ee.setAttribute(re,Pt):Ee.removeAttribute(re)}})}}function pe(){if(!(x||!y.props.aria.expanded)){var W=er(y.props.triggerTarget||t);W.forEach(function(re){y.props.interactive?re.setAttribute("aria-expanded",y.state.isVisible&&re===D()?"true":"false"):re.removeAttribute("aria-expanded")})}}function le(){G().removeEventListener("mousemove",m),Ms=Ms.filter(function(W){return W!==m})}function _e(W){if(!(Qt.isTouch&&(l||W.type==="mousedown"))){var re=W.composedPath&&W.composedPath()[0]||W.target;if(!(y.props.interactive&&th(C,re))){if(er(y.props.triggerTarget||t).some(function(me){return th(me,re)})){if(Qt.isTouch||y.state.isVisible&&y.props.trigger.indexOf("click")>=0)return}else K("onClickOutside",[y,W]);y.props.hideOnClick===!0&&(y.clearDelayTimeouts(),y.hide(),i=!0,setTimeout(function(){i=!1}),y.state.isMounted||xn())}}}function Ae(){l=!0}function Mt(){l=!1}function vt(){var W=G();W.addEventListener("mousedown",_e,!0),W.addEventListener("touchend",_e,ho),W.addEventListener("touchstart",Mt,ho),W.addEventListener("touchmove",Ae,ho)}function xn(){var W=G();W.removeEventListener("mousedown",_e,!0),W.removeEventListener("touchend",_e,ho),W.removeEventListener("touchstart",Mt,ho),W.removeEventListener("touchmove",Ae,ho)}function ro(W,re){Ja(W,function(){!y.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&re()})}function On(W,re){Ja(W,re)}function Ja(W,re){var me=k().box;function $e(Ee){Ee.target===me&&(Ul(me,"remove",$e),re())}if(W===0)return re();Ul(me,"remove",d),Ul(me,"add",$e),d=$e}function Rn(W,re,me){me===void 0&&(me=!1);var $e=er(y.props.triggerTarget||t);$e.forEach(function(Ee){Ee.addEventListener(W,re,me),h.push({node:Ee,eventType:W,handler:re,options:me})})}function Lo(){q()&&(Rn("touchstart",Rr,{passive:!0}),Rn("touchend",Za,{passive:!0})),zT(y.props.trigger).forEach(function(W){if(W!=="manual")switch(Rn(W,Rr),W){case"mouseenter":Rn("mouseleave",Za);break;case"focus":Rn(aI?"focusout":"blur",Pr);break;case"focusin":Rn("focusout",Pr);break}})}function Xa(){h.forEach(function(W){var re=W.node,me=W.eventType,$e=W.handler,Ee=W.options;re.removeEventListener(me,$e,Ee)}),h=[]}function Rr(W){var re,me=!1;if(!(!y.state.isEnabled||Dr(W)||i)){var $e=((re=u)==null?void 0:re.type)==="focus";u=W,g=W.currentTarget,pe(),!y.state.isVisible&&JT(W)&&Ms.forEach(function(Ee){return Ee(W)}),W.type==="click"&&(y.props.trigger.indexOf("mouseenter")<0||s)&&y.props.hideOnClick!==!1&&y.state.isVisible?me=!0:Nr(W),W.type==="click"&&(s=!me),me&&!$e&&ao(W)}}function Qa(W){var re=W.target,me=D().contains(re)||C.contains(re);if(!(W.type==="mousemove"&&me)){var $e=Pn().concat(C).map(function(Ee){var lt,Pt=Ee._tippy,Uo=(lt=Pt.popperInstance)==null?void 0:lt.state;return Uo?{popperRect:Ee.getBoundingClientRect(),popperState:Uo,props:n}:null}).filter(Boolean);eI($e,W)&&(le(),ao(W))}}function Za(W){var re=Dr(W)||y.props.trigger.indexOf("click")>=0&&s;if(!re){if(y.props.interactive){y.hideWithInteractivity(W);return}ao(W)}}function Pr(W){y.props.trigger.indexOf("focusin")<0&&W.target!==D()||y.props.interactive&&W.relatedTarget&&C.contains(W.relatedTarget)||ao(W)}function Dr(W){return Qt.isTouch?q()!==W.type.indexOf("touch")>=0:!1}function es(){ts();var W=y.props,re=W.popperOptions,me=W.placement,$e=W.offset,Ee=W.getReferenceClientRect,lt=W.moveTransition,Pt=$()?Lc(C).arrow:null,Uo=Ee?{getBoundingClientRect:Ee,contextElement:Ee.contextElement||D()}:t,is={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(ls){var Bo=ls.state;if($()){var hy=k(),al=hy.box;["placement","reference-hidden","escaped"].forEach(function(cs){cs==="placement"?al.setAttribute("data-placement",Bo.placement):Bo.attributes.popper["data-popper-"+cs]?al.setAttribute("data-"+cs,""):al.removeAttribute("data-"+cs)}),Bo.attributes.popper={}}}},so=[{name:"offset",options:{offset:$e}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!lt}},is];$()&&Pt&&so.push({name:"arrow",options:{element:Pt,padding:3}}),so.push.apply(so,(re==null?void 0:re.modifiers)||[]),y.popperInstance=qT(Uo,C,Object.assign({},re,{placement:me,onFirstUpdate:p,modifiers:so}))}function ts(){y.popperInstance&&(y.popperInstance.destroy(),y.popperInstance=null)}function hn(){var W=y.props.appendTo,re,me=D();y.props.interactive&&W===nv||W==="parent"?re=me.parentNode:re=ov(W,[me]),re.contains(C)||re.appendChild(C),y.state.isMounted=!0,es()}function Pn(){return hi(C.querySelectorAll("[data-tippy-root]"))}function Nr(W){y.clearDelayTimeouts(),W&&K("onTrigger",[y,W]),vt();var re=N(!0),me=L(),$e=me[0],Ee=me[1];Qt.isTouch&&$e==="hold"&&Ee&&(re=Ee),re?o=setTimeout(function(){y.show()},re):y.show()}function ao(W){if(y.clearDelayTimeouts(),K("onUntrigger",[y,W]),!y.state.isVisible){xn();return}if(!(y.props.trigger.indexOf("mouseenter")>=0&&y.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(W.type)>=0&&s)){var re=N(!1);re?r=setTimeout(function(){y.state.isVisible&&y.hide()},re):a=requestAnimationFrame(function(){y.hide()})}}function Lr(){y.state.isEnabled=!0}function ns(){y.hide(),y.state.isEnabled=!1}function rs(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(a)}function as(W){if(!y.state.isDestroyed){K("onBeforeUpdate",[y,W]),Xa();var re=y.props,me=oh(t,Object.assign({},re,Zp(W),{ignoreAttributes:!0}));y.props=me,Lo(),re.interactiveDebounce!==me.interactiveDebounce&&(le(),m=Xp(Qa,me.interactiveDebounce)),re.triggerTarget&&!me.triggerTarget?er(re.triggerTarget).forEach(function($e){$e.removeAttribute("aria-expanded")}):me.triggerTarget&&t.removeAttribute("aria-expanded"),pe(),F(),T&&T(re,me),y.popperInstance&&(es(),Pn().forEach(function($e){requestAnimationFrame($e._tippy.popperInstance.forceUpdate)})),K("onAfterUpdate",[y,W])}}function ss(W){y.setProps({content:W})}function ly(){var W=y.state.isVisible,re=y.state.isDestroyed,me=!y.state.isEnabled,$e=Qt.isTouch&&!y.props.touch,Ee=Nl(y.props.duration,0,Vt.duration);if(!(W||re||me||$e)&&!D().hasAttribute("disabled")&&(K("onShow",[y],!1),y.props.onShow(y)!==!1)){if(y.state.isVisible=!0,$()&&(C.style.visibility="visible"),F(),vt(),y.state.isMounted||(C.style.transition="none"),$()){var lt=k(),Pt=lt.box,Uo=lt.content;Ll([Pt,Uo],0)}p=function(){var is;if(!(!y.state.isVisible||c)){if(c=!0,C.style.transition=y.props.moveTransition,$()&&y.props.animation){var so=k(),ls=so.box,Bo=so.content;Ll([ls,Bo],Ee),eh([ls,Bo],"visible")}J(),pe(),Qp(Bl,y),(is=y.popperInstance)==null||is.forceUpdate(),K("onMount",[y]),y.props.animation&&$()&&On(Ee,function(){y.state.isShown=!0,K("onShown",[y])})}},hn()}}function cy(){var W=!y.state.isVisible,re=y.state.isDestroyed,me=!y.state.isEnabled,$e=Nl(y.props.duration,1,Vt.duration);if(!(W||re||me)&&(K("onHide",[y],!1),y.props.onHide(y)!==!1)){if(y.state.isVisible=!1,y.state.isShown=!1,c=!1,s=!1,$()&&(C.style.visibility="hidden"),le(),xn(),F(!0),$()){var Ee=k(),lt=Ee.box,Pt=Ee.content;y.props.animation&&(Ll([lt,Pt],$e),eh([lt,Pt],"hidden"))}J(),pe(),y.props.animation?$()&&ro($e,y.unmount):y.unmount()}}function uy(W){G().addEventListener("mousemove",m),Qp(Ms,m),m(W)}function dy(){y.state.isVisible&&y.hide(),y.state.isMounted&&(ts(),Pn().forEach(function(W){W._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),Bl=Bl.filter(function(W){return W!==y}),y.state.isMounted=!1,K("onHidden",[y]))}function py(){!y.state.isDestroyed&&(y.clearDelayTimeouts(),y.unmount(),Xa(),delete t._tippy,y.state.isDestroyed=!0,K("onDestroy",[y]))}}function xr(t,e){e===void 0&&(e={});var n=Vt.plugins.concat(e.plugins||[]);oI();var o=Object.assign({},e,{plugins:n}),r=QT(t),a=r.reduce(function(s,i){var l=i&&hI(i,o);return l&&s.push(l),s},[]);return Wi(t)?a[0]:a}xr.defaultProps=Vt;xr.setDefaultProps=cI;xr.currentInput=Qt;Object.assign({},Vg,{effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow)}});xr.setDefaultProps({render:sv});class fI{constructor({editor:e,element:n,view:o,tippyOptions:r={},updateDelay:a=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:i,state:l,from:c,to:u})=>{const{doc:d,selection:p}=l,{empty:h}=p,m=!d.textBetween(c,u).length&&Fu(l.selection),g=this.element.contains(document.activeElement);return!(!(i.hasFocus()||g)||h||m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:i})=>{var l;if(this.preventHide){this.preventHide=!1;return}i!=null&&i.relatedTarget&&!((l=this.element.parentNode)===null||l===void 0)&&l.contains(i.relatedTarget)||(i==null?void 0:i.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=i=>{this.blurHandler({event:i})},this.handleDebouncedUpdate=(i,l)=>{const c=!(l!=null&&l.selection.eq(i.state.selection)),u=!(l!=null&&l.doc.eq(i.state.doc));!c&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(i,c,u,l)},this.updateDelay))},this.updateHandler=(i,l,c,u)=>{var d,p,h;const{state:m,composing:g}=i,{selection:v}=m;if(g||!l&&!c)return;this.createTooltip();const{ranges:b}=v,w=Math.min(...b.map(y=>y.$from.pos)),E=Math.max(...b.map(y=>y.$to.pos));if(!(!((d=this.shouldShow)===null||d===void 0)&&d.call(this,{editor:this.editor,element:this.element,view:i,state:m,oldState:u,from:w,to:E}))){this.hide();return}(p=this.tippy)===null||p===void 0||p.setProps({getReferenceClientRect:((h=this.tippyOptions)===null||h===void 0?void 0:h.getReferenceClientRect)||(()=>{if(Fg(m.selection)){let y=i.nodeDOM(w);if(y){const P=y.dataset.nodeViewWrapper?y:y.querySelector("[data-node-view-wrapper]");if(P&&(y=P.firstChild),y)return y.getBoundingClientRect()}}return jg(i,w,E)})}),this.show()},this.editor=e,this.element=n,this.view=o,this.updateDelay=a,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.element.tabIndex=0,!(this.tippy||!n)&&(this.tippy=xr(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:o}=e,r=o.selection.from!==o.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,n);return}const a=!(n!=null&&n.selection.eq(e.state.selection)),s=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,a,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const mI=t=>new je({key:typeof t.pluginKey=="string"?new Ze(t.pluginKey):t.pluginKey,view:e=>new fI({view:e,...t})});et.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[mI({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class gI{getTextContent(e){return Ug(e,{textSerializers:Uu(this.editor.schema)})}constructor({editor:e,element:n,view:o,tippyOptions:r={},shouldShow:a}){this.preventHide=!1,this.shouldShow=({view:s,state:i})=>{const{selection:l}=i,{$anchor:c,empty:u}=l,d=c.depth===1,p=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent&&c.parent.childCount===0&&!this.getTextContent(c.parent);return!(!s.hasFocus()||!u||!d||!p||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:s})=>{var i;if(this.preventHide){this.preventHide=!1;return}s!=null&&s.relatedTarget&&!((i=this.element.parentNode)===null||i===void 0)&&i.contains(s.relatedTarget)||(s==null?void 0:s.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=s=>{this.blurHandler({event:s})},this.editor=e,this.element=n,this.view=o,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.element.tabIndex=0,!(this.tippy||!n)&&(this.tippy=xr(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var o,r,a;const{state:s}=e,{doc:i,selection:l}=s,{from:c,to:u}=l;if(!(n&&n.doc.eq(i)&&n.selection.eq(l))){if(this.createTooltip(),!(!((o=this.shouldShow)===null||o===void 0)&&o.call(this,{editor:this.editor,view:e,state:s,oldState:n}))){this.hide();return}(r=this.tippy)===null||r===void 0||r.setProps({getReferenceClientRect:((a=this.tippyOptions)===null||a===void 0?void 0:a.getReferenceClientRect)||(()=>jg(e,c,u))}),this.show()}}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const vI=t=>new je({key:typeof t.pluginKey=="string"?new Ze(t.pluginKey):t.pluginKey,view:e=>new gI({view:e,...t})});et.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[vI({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});function sh(t){return Xh((e,n)=>({get(){return e(),t},set(o){t=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class yI extends N${constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=sh(this.view.state),this.reactiveExtensionStorage=sh(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),zc(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const o=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=o),o}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const _I=z({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=A(),n=Zn();return Wt(()=>{const o=t.editor;o&&o.options.element&&e.value&&Fe(()=>{if(!e.value||!o.options.element.firstChild)return;const r=f(e.value);e.value.append(...o.options.element.childNodes),o.contentComponent=n.ctx._,n&&(o.appContext={...n.appContext,provides:n.provides}),o.setOptions({element:r}),o.createNodeViews()})}),Da(()=>{const o=t.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return he("div",{ref:t=>{this.rootEl=t}})}}),bI=(t={})=>{const e=Na();return qe(()=>{e.value=new yI(t)}),Da(()=>{var n,o,r;const a=(n=e.value)===null||n===void 0?void 0:n.options.element,s=a==null?void 0:a.cloneNode(!0);(o=a==null?void 0:a.parentNode)===null||o===void 0||o.replaceChild(s,a),(r=e.value)===null||r===void 0||r.destroy()}),e};class wI{constructor(e,{props:n={},editor:o}){this.editor=o,this.component=zc(e),this.el=document.createElement("div"),this.props=ur(n),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,n,o,r;return!((n=(e=this.renderedComponent.vNode)===null||e===void 0?void 0:e.component)===null||n===void 0)&&n.exposed?this.renderedComponent.vNode.component.exposed:(r=(o=this.renderedComponent.vNode)===null||o===void 0?void 0:o.component)===null||r===void 0?void 0:r.proxy}renderComponent(){let e=he(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&ud(e,this.el),{vNode:e,destroy:()=>{this.el&&ud(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){Object.entries(e).forEach(([n,o])=>{this.props[n]=o}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}}const SI=et.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new je({key:new Ze("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=e,r=[];if(!n)return null;const a=this.editor.isEmpty;return t.descendants((s,i)=>{const l=o>=i&&o<=i+s.nodeSize,c=!s.isLeaf&&Vi(s);if((l||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];a&&u.push(this.options.emptyEditorClass);const d=An.node(i,i+s.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:i,hasAnchor:l}):this.options.placeholder});r.push(d)}return this.options.includeChildren}),At.create(t,r)}}})]}}),kI=/^\s*>\s$/,EI=rt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Be(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ca({find:kI,type:this.type})]}}),CI=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,MI=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,$I=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,TI=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,II=za.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Be(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[vr({find:CI,type:this.type}),vr({find:$I,type:this.type})]},addPasteRules(){return[yr({find:MI,type:this.type}),yr({find:TI,type:this.type})]}}),AI="listItem",ih="textStyle",lh=/^\s*([-+*])\s$/,xI=rt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Be(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(AI,this.editor.getAttributes(ih)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ca({find:lh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ca({find:lh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ih),editor:this.editor})),[t]}}),OI=/(^|[^`])`([^`]+)`(?!`)/,RI=/(^|[^`])`([^`]+)`(?!`)/g,PI=za.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Be(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[vr({find:OI,type:this.type})]},addPasteRules(){return[yr({find:RI,type:this.type})]}}),DI=/^```([a-z]+)?[\s\n]$/,NI=/^~~~([a-z]+)?[\s\n]$/,LI=rt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;return[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(r=>r.startsWith(n)).map(r=>r.replace(n,""))[0]||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Be(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:o,empty:r}=n;if(!r||o.parent.type!==this.type)return!1;const a=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith(`
|
||
|
||
`);return!a||!s?!1:t.chain().command(({tr:i})=>(i.delete(o.pos-2,o.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:o}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type||r.parentOffset!==r.parent.nodeSize-2)return!1;const s=r.after();return s===void 0?!1:o.nodeAt(s)?t.commands.command(({tr:i})=>(i.setSelection(ye.near(o.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[Rc({find:DI,type:this.type,getAttributes:t=>({language:t[1]})}),Rc({find:NI,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new je({key:new Ze("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),o=e.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,a=r==null?void 0:r.mode;if(!n||!a)return!1;const{tr:s,schema:i}=t.state,l=i.text(n.replace(/\r\n?/g,`
|
||
`));return s.replaceSelectionWith(this.type.create({language:a},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(Se.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),UI=rt.create({name:"doc",topNode:!0,content:"block+"});function BI(t={}){return new je({view(e){return new FI(e,t)}})}let FI=class{constructor(e,n){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=n.width)!==null&&o!==void 0?o:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let a=s=>{this[r](s)};return e.dom.addEventListener(r,a),{name:r,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,o,r=this.editorView.dom,a=r.getBoundingClientRect(),s=a.width/r.offsetWidth,i=a.height/r.offsetHeight;if(n){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=d?m.bottom:m.top;d&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*i;o={left:m.left,right:m.right,top:g-v,bottom:g+v}}}}if(!o){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;o={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,h=d.height/l.offsetHeight;c=d.left-l.scrollLeft*p,u=d.top-l.scrollTop*h}this.element.style.left=(o.left-c)/s+"px",this.element.style.top=(o.top-u)/i+"px",this.element.style.width=(o.right-o.left)/s+"px",this.element.style.height=(o.bottom-o.top)/i+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=o&&o.type.spec.disableDropCursor,a=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!a){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let i=Cm(this.editorView.state.doc,s,this.editorView.dragging.slice);i!=null&&(s=i)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};const jI=et.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[BI(this.options)]}});let Et=class Fn extends ye{constructor(e){super(e,e)}map(e,n){let o=e.resolve(n.map(this.head));return Fn.valid(o)?new Fn(o):ye.near(o)}content(){return te.empty}eq(e){return e instanceof Fn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Fn(e.resolve(n.pos))}getBookmark(){return new GI(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!qI(e)||!HI(e))return!1;let o=n.type.spec.allowGapCursor;if(o!=null)return o;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,o=!1){e:for(;;){if(!o&&Fn.valid(e))return e;let r=e.pos,a=null;for(let s=e.depth;;s--){let i=e.node(s);if(n>0?e.indexAfter(s)<i.childCount:e.index(s)>0){a=i.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=n;let l=e.doc.resolve(r);if(Fn.valid(l))return l}for(;;){let s=n>0?a.firstChild:a.lastChild;if(!s){if(a.isAtom&&!a.isText&&!fe.isSelectable(a)){e=e.doc.resolve(r+a.nodeSize*n),o=!1;continue e}break}a=s,r+=n;let i=e.doc.resolve(r);if(Fn.valid(i))return i}return null}}};Et.prototype.visible=!1;Et.findFrom=Et.findGapCursorFrom;ye.jsonID("gapcursor",Et);let GI=class iv{constructor(e){this.pos=e}map(e){return new iv(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Et.valid(n)?new Et(n):ye.near(n)}};function lv(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function qI(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),o=t.node(e);if(n==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||lv(r.type))return!0;if(r.inlineContent)return!1}}return!0}function HI(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),o=t.node(e);if(n==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||lv(r.type))return!0;if(r.inlineContent)return!1}}return!0}function VI(){return new je({props:{decorations:YI,createSelectionBetween(t,e,n){return e.pos==n.pos&&Et.valid(n)?new Et(n):null},handleClick:WI,handleKeyDown:zI,handleDOMEvents:{beforeinput:KI}}})}const zI=kg({ArrowLeft:$s("horiz",-1),ArrowRight:$s("horiz",1),ArrowUp:$s("vert",-1),ArrowDown:$s("vert",1)});function $s(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,a){let s=o.selection,i=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Se){if(!a.endOfTextblock(n)||i.depth==0)return!1;l=!1,i=o.doc.resolve(e>0?i.after():i.before())}let c=Et.findGapCursorFrom(i,e,l);return c?(r&&r(o.tr.setSelection(new Et(c))),!0):!1}}function WI(t,e,n){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!Et.valid(o))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&fe.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Et(o))),!0)}function KI(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Et))return!1;let{$from:n}=t.state.selection,o=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;let r=X.empty;for(let s=o.length-1;s>=0;s--)r=X.from(o[s].createAndFill(null,r));let a=t.state.tr.replace(n.pos,n.pos,new te(r,0,0));return a.setSelection(Se.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function YI(t){if(!(t.selection instanceof Et))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",At.create(t.doc,[An.widget(t.selection.head,e,{key:"gapcursor"})])}const JI=et.create({name:"gapCursor",addProseMirrorPlugins(){return[VI()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=be(ne(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),XI=rt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Be(this.options.HTMLAttributes,t)]},renderText(){return`
|
||
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:o})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:a}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:i}=o.extensionManager,l=a||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&s){const d=l.filter(p=>i.includes(p.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),QI=rt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Be(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Rc({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var fi=200,Ve=function(){};Ve.prototype.append=function(t){return t.length?(t=Ve.from(t),!this.length&&t||t.length<fi&&this.leafAppend(t)||this.length<fi&&t.leafPrepend(this)||this.appendInner(t)):this};Ve.prototype.prepend=function(t){return t.length?Ve.from(t).append(this):this};Ve.prototype.appendInner=function(t){return new ZI(this,t)};Ve.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?Ve.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};Ve.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Ve.prototype.forEach=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)};Ve.prototype.map=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length);var o=[];return this.forEach(function(r,a){return o.push(t(r,a))},e,n),o};Ve.from=function(t){return t instanceof Ve?t:t&&t.length?new cv(t):Ve.empty};var cv=(function(t){function e(o){t.call(this),this.values=o}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,r){return o==0&&r==this.length?this:new e(this.values.slice(o,r))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,r,a,s){for(var i=r;i<a;i++)if(o(this.values[i],s+i)===!1)return!1},e.prototype.forEachInvertedInner=function(o,r,a,s){for(var i=r-1;i>=a;i--)if(o(this.values[i],s+i)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=fi)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=fi)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Ve);Ve.empty=new cv([]);var ZI=(function(t){function e(n,o){t.call(this),this.left=n,this.right=o,this.length=n.length+o.length,this.depth=Math.max(n.depth,o.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,o,r,a){var s=this.left.length;if(o<s&&this.left.forEachInner(n,o,Math.min(r,s),a)===!1||r>s&&this.right.forEachInner(n,Math.max(o-s,0),Math.min(this.length,r)-s,a+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,o,r,a){var s=this.left.length;if(o>s&&this.right.forEachInvertedInner(n,o-s,Math.max(r,s)-s,a+s)===!1||r<s&&this.left.forEachInvertedInner(n,Math.min(o,s),r,a)===!1)return!1},e.prototype.sliceInner=function(n,o){if(n==0&&o==this.length)return this;var r=this.left.length;return o<=r?this.left.slice(n,o):n>=r?this.right.slice(n-r,o-r):this.left.slice(n,r).append(this.right.slice(0,o-r))},e.prototype.leafAppend=function(n){var o=this.right.leafAppend(n);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(n){var o=this.left.leafPrepend(n);if(o)return new e(o,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(Ve);const eA=500;let Ta=class tr{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let r,a;n&&(r=this.remapping(o,this.items.length),a=r.maps.length);let s=e.tr,i,l,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){r||(r=this.remapping(o,p+1),a=r.maps.length),a--,u.push(d);return}if(r){u.push(new Dn(d.map));let h=d.step.map(r.slice(a)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new Dn(m,void 0,void 0,c.length+u.length))),a--,m&&r.appendMap(m,a)}else s.maybeStep(d.step);if(d.selection)return i=r?d.selection.map(r.slice(a)):d.selection,l=new tr(this.items.slice(0,o).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:i}}addTransform(e,n,o,r){let a=[],s=this.eventCount,i=this.items,l=!r&&i.length?i.get(i.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),p=new Dn(e.mapping.maps[u],d,n),h;(h=l&&l.merge(p))&&(p=h,u?a.pop():i=i.slice(0,i.length-1)),a.push(p),n&&(s++,n=void 0),r||(l=p)}let c=s-o.depth;return c>nA&&(i=tA(i,c),s-=c),new tr(i.append(a),s)}remapping(e,n){let o=new wm;return this.items.forEach((r,a)=>{let s=r.mirrorOffset!=null&&a-r.mirrorOffset>=e?o.maps.length-r.mirrorOffset:void 0;o.appendMap(r.map,s)},e,n),o}addMaps(e){return this.eventCount==0?this:new tr(this.items.append(e.map(n=>new Dn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let o=[],r=Math.max(0,this.items.length-n),a=e.mapping,s=e.steps.length,i=this.eventCount;this.items.forEach(p=>{p.selection&&i--},r);let l=n;this.items.forEach(p=>{let h=a.getMirror(--l);if(h==null)return;s=Math.min(s,h);let m=a.maps[h];if(p.step){let g=e.steps[h].invert(e.docs[h]),v=p.selection&&p.selection.map(a.slice(l+1,h));v&&i++,o.push(new Dn(m,g,v))}else o.push(new Dn(m))},r);let c=[];for(let p=n;p<s;p++)c.push(new Dn(a.maps[p]));let u=this.items.slice(0,r).append(c).append(o),d=new tr(u,i);return d.emptyItemCount()>eA&&(d=d.compress(this.items.length-o.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),o=n.maps.length,r=[],a=0;return this.items.forEach((s,i)=>{if(i>=e)r.push(s),s.selection&&a++;else if(s.step){let l=s.step.map(n.slice(o)),c=l&&l.getMap();if(o--,c&&n.appendMap(c,o),l){let u=s.selection&&s.selection.map(n.slice(o));u&&a++;let d=new Dn(c.invert(),l,u),p,h=r.length-1;(p=r.length&&r[h].merge(d))?r[h]=p:r.push(d)}}else s.map&&o--},this.items.length,0),new tr(Ve.from(r.reverse()),a)}};Ta.empty=new Ta(Ve.empty,0);function tA(t,e){let n;return t.forEach((o,r)=>{if(o.selection&&e--==0)return n=r,!1}),t.slice(n)}let Dn=class uv{constructor(e,n,o,r){this.map=e,this.step=n,this.selection=o,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new uv(n.getMap().invert(),n,this.selection)}}},Gn=class{constructor(e,n,o,r,a){this.done=e,this.undone=n,this.prevRanges=o,this.prevTime=r,this.prevComposition=a}};const nA=20;function oA(t,e,n,o){let r=n.getMeta(Co),a;if(r)return r.historyState;n.getMeta(sA)&&(t=new Gn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Co))return s.getMeta(Co).redo?new Gn(t.done.addTransform(n,void 0,o,js(e)),t.undone,ch(n.mapping.maps),t.prevTime,t.prevComposition):new Gn(t.done,t.undone.addTransform(n,void 0,o,js(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let i=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=i&&(t.prevTime<(n.time||0)-o.newGroupDelay||!rA(n,t.prevRanges)),c=s?Fl(t.prevRanges,n.mapping):ch(n.mapping.maps);return new Gn(t.done.addTransform(n,l?e.selection.getBookmark():void 0,o,js(e)),Ta.empty,c,n.time,i??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Gn(t.done.rebased(n,a),t.undone.rebased(n,a),Fl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Gn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Fl(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function rA(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((o,r)=>{for(let a=0;a<e.length;a+=2)o<=e[a+1]&&r>=e[a]&&(n=!0)}),n}function ch(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((o,r,a,s)=>e.push(a,s));return e}function Fl(t,e){if(!t)return null;let n=[];for(let o=0;o<t.length;o+=2){let r=e.map(t[o],1),a=e.map(t[o+1],-1);r<=a&&n.push(r,a)}return n}function aA(t,e,n){let o=js(e),r=Co.get(e).spec.config,a=(n?t.undone:t.done).popEvent(e,o);if(!a)return null;let s=a.selection.resolve(a.transform.doc),i=(n?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),r,o),l=new Gn(n?i:a.remaining,n?a.remaining:i,null,0,-1);return a.transform.setSelection(s).setMeta(Co,{redo:n,historyState:l})}let jl=!1,uh=null;function js(t){let e=t.plugins;if(uh!=e){jl=!1,uh=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){jl=!0;break}}return jl}const Co=new Ze("history"),sA=new Ze("closeHistory");function iA(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new je({key:Co,state:{init(){return new Gn(Ta.empty,Ta.empty,null,0,-1)},apply(e,n,o){return oA(n,o,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let o=n.inputType,r=o=="historyUndo"?pv:o=="historyRedo"?hv:null;return!r||!e.editable?!1:(n.preventDefault(),r(e.state,e.dispatch))}}}})}function dv(t,e){return(n,o)=>{let r=Co.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(o){let a=aA(r,n,t);a&&o(a.scrollIntoView())}return!0}}const pv=dv(!1),hv=dv(!0),lA=et.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>pv(t,e),redo:()=>({state:t,dispatch:e})=>hv(t,e)}},addProseMirrorPlugins(){return[iA(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),cA=rt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Be(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!L$(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:o,$to:r}=n,a=t();return o.parentOffset===0?a.insertContentAt({from:Math.max(o.pos-1,0),to:r.pos},{type:this.name}):Fg(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({tr:s,dispatch:i})=>{var l;if(i){const{$to:c}=s.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(Se.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(fe.create(s.doc,c.pos)):s.setSelection(Se.create(s.doc,c.pos));else{const d=(l=c.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();d&&(s.insert(u,d),s.setSelection(Se.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Gg({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),uA=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,dA=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,pA=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,hA=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,fA=za.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Be(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[vr({find:uA,type:this.type}),vr({find:pA,type:this.type})]},addPasteRules(){return[yr({find:dA,type:this.type}),yr({find:hA,type:this.type})]}}),mA=rt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Be(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),gA="listItem",dh="textStyle",ph=/^(\d+)\.\s$/,vA=rt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Be(this.options.HTMLAttributes,n),0]:["ol",Be(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(gA,this.editor.getAttributes(dh)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ca({find:ph,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ca({find:ph,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(dh)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),yA=rt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Be(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),_A=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,bA=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,wA=za.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Be(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[vr({find:_A,type:this.type})]},addPasteRules(){return[yr({find:bA,type:this.type})]}}),SA=rt.create({name:"text",group:"inline"}),kA=et.create({name:"starterKit",addExtensions(){var t,e,n,o,r,a,s,i,l,c,u,d,p,h,m,g,v,b;const w=[];return this.options.bold!==!1&&w.push(II.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&w.push(EI.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&w.push(xI.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&w.push(PI.configure((o=this.options)===null||o===void 0?void 0:o.code)),this.options.codeBlock!==!1&&w.push(LI.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&w.push(UI.configure((a=this.options)===null||a===void 0?void 0:a.document)),this.options.dropcursor!==!1&&w.push(jI.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&w.push(JI.configure((i=this.options)===null||i===void 0?void 0:i.gapcursor)),this.options.hardBreak!==!1&&w.push(XI.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&w.push(QI.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&w.push(lA.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&w.push(cA.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&w.push(fA.configure((p=this.options)===null||p===void 0?void 0:p.italic)),this.options.listItem!==!1&&w.push(mA.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&w.push(vA.configure((m=this.options)===null||m===void 0?void 0:m.orderedList)),this.options.paragraph!==!1&&w.push(yA.configure((g=this.options)===null||g===void 0?void 0:g.paragraph)),this.options.strike!==!1&&w.push(wA.configure((v=this.options)===null||v===void 0?void 0:v.strike)),this.options.text!==!1&&w.push(SA.configure((b=this.options)===null||b===void 0?void 0:b.text)),w}}),hh=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter("en",{granularity:"grapheme"}):null;function EA(t){return hh?Array.from(hh.segment(t)).length:[...t].length}const CA=et.create({name:"characterCount",addOptions(){return{limit:null,textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;let n=0;return e.descendants(o=>{o.isText&&o.text?n+=EA(o.text):o.type.name==="emoji"&&(n+=1)}),n},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new je({key:new Ze("characterCount"),appendTransaction:(e,n,o)=>{if(t)return null;const{limit:r}=this.options;if(r==null||r===0)return t=!0,null;const a=this.storage.characters({node:o.doc});if(a>r){const s=a-r,i=0,l=s,c=o.tr.deleteRange(i,l);return t=!0,c}return t=!0,null},filterTransaction:(e,n)=>{const{limit:o}=this.options;if(!e.docChanged||o===0||o===null||o===void 0)return!0;const r=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc}),s=e.getMeta("paste");if(a<=o||r>o&&a>o&&a<=r)return!0;if(r>o&&a>o&&a>r||!s)return!1;const{pos:i}=e.selection.$head,l=a-o,c=i-l,u=i;return!(c<0||(e.deleteRange(c,u),this.storage.characters({node:e.doc})>o))}})]}});function MA(t){return et.create({name:"enterKey",addKeyboardShortcuts(){return{Enter:()=>(t==null||t(),!0),"Mod-Enter":({editor:e})=>(e.commands.setHardBreak(),!0)}}})}const $A=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,fv=rt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Be(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Gg({find:$A,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}});function TA(){return fv.extend({name:xe.EMOJI,inline:!0,group:"inline",draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"message-emoji"}}}})}function IA(){return fv.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"message-image"}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),fileData:{default:null,parseHTML:()=>null,renderHTML:()=>({})}}},addProseMirrorPlugins(){return[new je({key:new Ze("imagePaste"),props:{handlePaste:(t,e)=>{var n;const o=Array.from(((n=e.clipboardData)==null?void 0:n.items)||[]).filter(r=>r.type.indexOf("image")===0);return o.length===0?!1:(o.forEach(r=>{const a=r.getAsFile();if(a){const s=new FileReader;s.onload=i=>{var l;const c=(l=i.target)==null?void 0:l.result,u=t.state.schema.nodes.image.create({src:c,fileData:a}),d=t.state.tr.replaceSelectionWith(u);t.dispatch(d)},s.onerror=i=>{console.error("[MessageInput]::Failed to read image file:",i)},s.onabort=()=>{console.warn("[MessageInput]::Image file reading was aborted.")},s.readAsDataURL(a)}}),!0)}}})]}}).configure({inline:!0})}const mv="Expected a function";function Ju(t,e,n){let o=!0,r=!0;if(typeof t!="function")throw new TypeError(mv);return n&&vv(n)&&(o="leading"in n?!!n.leading:o,r="trailing"in n?!!n.trailing:r),gv(t,e,{leading:o,maxWait:e,trailing:r})}function gv(t,e,n){let o,r,a,s,i,l,c=0,u=!1,d=!1,p=!0;if(typeof t!="function")throw new TypeError(mv);e=e||0,n&&vv(n)&&(u=!!n.leading,d="maxWait"in n,a=d?Math.max(n.maxWait||0,e):a,p="trailing"in n?!!n.trailing:p);function h(C){const T=o,M=r;return o=r=void 0,c=C,s=t.apply(M,T),s}function m(C){return c=C,i=setTimeout(b,e),u?h(C):s}function g(C){const T=C-l,M=C-c,x=e-T;return d?Math.min(x,a-M):x}function v(C){const T=C-l,M=C-c;return l===void 0||T>=e||T<0||d&&M>=a}function b(){const C=Date.now();if(v(C))return w(C);i=setTimeout(b,g(C))}function w(C){return i=void 0,p&&o?h(C):(o=r=void 0,s)}function E(){i!==void 0&&clearTimeout(i),c=0,o=l=r=i=void 0}function y(){return i===void 0?s:w(Date.now())}function P(...C){const T=Date.now(),M=v(T);if(o=C,r=this,l=T,M){if(i===void 0)return m(l);if(d)return clearTimeout(i),i=setTimeout(b,e),h(l)}return i===void 0&&(i=setTimeout(b,e)),s}return P.cancel=E,P.flush=y,P}function vv(t){const e=typeof t;return t!=null&&(e=="object"||e=="function")}function or(t,e){let n=null;const o=(...r)=>new Promise((a,s)=>{n&&clearTimeout(n),n=setTimeout(async()=>{try{const i=await t(...r);a(i)}catch(i){s(i)}},e)});return o.cancel=()=>{n&&(clearTimeout(n),n=null)},o}var Le=(t=>(t.OWNER="Owner",t.ADMIN="Admin",t.COMMON="Member",t))(Le||{}),vo=(t=>(t.WORK="Private",t.PUBLIC="Public",t.MEETING="ChatRoom",t.AVCHATROOM="AVChatRoom",t.COMMUNITY="Community",t))(vo||{}),na=(t=>(t.FREE_ACCESS="FREE_ACCESS",t.NEED_PERMISSION="NEED_PERMISSION",t.DISABLE_APPLY="DISABLE_APPLY",t))(na||{}),R=(t=>(t.VIEW_GROUP_INFO="VIEW_GROUP_INFO",t.VIEW_MEMBER_LIST="VIEW_MEMBER_LIST",t.EDIT_GROUP_PROFILE_NAME="EDIT_GROUP_PROFILE_NAME",t.EDIT_GROUP_PROFILE_AVATAR="EDIT_GROUP_PROFILE_AVATAR",t.EDIT_GROUP_PROFILE_INTRODUCTION="EDIT_GROUP_PROFILE_INTRODUCTION",t.EDIT_GROUP_PROFILE_NOTIFICATION="EDIT_GROUP_PROFILE_NOTIFICATION",t.EDIT_GROUP_PROFILE_ELSE="EDIT_GROUP_PROFILE_ELSE",t.REMOVE_MEMBER="REMOVE_MEMBER",t.SET_MEMBER_ROLE="SET_MEMBER_ROLE",t.MUTE_MEMBER="MUTE_MEMBER",t.MUTE_ALL_MEMBERS="MUTE_ALL_MEMBERS",t.TRANSFER_OWNERSHIP="TRANSFER_OWNERSHIP",t.DISMISS_GROUP="DISMISS_GROUP",t.QUIT_GROUP="QUIT_GROUP",t))(R||{});const Uc={[vo.WORK]:{[Le.OWNER]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!0,[R.EDIT_GROUP_PROFILE_AVATAR]:!0,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[R.EDIT_GROUP_PROFILE_ELSE]:!0,[R.REMOVE_MEMBER]:!0,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!1,[R.MUTE_ALL_MEMBERS]:!1,[R.TRANSFER_OWNERSHIP]:!0,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0},[Le.ADMIN]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!0,[R.EDIT_GROUP_PROFILE_AVATAR]:!0,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[R.EDIT_GROUP_PROFILE_ELSE]:!1,[R.REMOVE_MEMBER]:!1,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!1,[R.MUTE_ALL_MEMBERS]:!1,[R.TRANSFER_OWNERSHIP]:!1,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0},[Le.COMMON]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!0,[R.EDIT_GROUP_PROFILE_AVATAR]:!0,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[R.EDIT_GROUP_PROFILE_ELSE]:!1,[R.REMOVE_MEMBER]:!1,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!1,[R.MUTE_ALL_MEMBERS]:!1,[R.TRANSFER_OWNERSHIP]:!1,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0}},[vo.PUBLIC]:{[Le.OWNER]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!0,[R.EDIT_GROUP_PROFILE_AVATAR]:!0,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[R.EDIT_GROUP_PROFILE_ELSE]:!0,[R.REMOVE_MEMBER]:!0,[R.SET_MEMBER_ROLE]:!0,[R.MUTE_MEMBER]:!0,[R.MUTE_ALL_MEMBERS]:!0,[R.TRANSFER_OWNERSHIP]:!0,[R.DISMISS_GROUP]:!0,[R.QUIT_GROUP]:!1},[Le.ADMIN]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!0,[R.EDIT_GROUP_PROFILE_AVATAR]:!0,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[R.EDIT_GROUP_PROFILE_ELSE]:!1,[R.REMOVE_MEMBER]:!0,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!0,[R.MUTE_ALL_MEMBERS]:!1,[R.TRANSFER_OWNERSHIP]:!1,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0},[Le.COMMON]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!1,[R.EDIT_GROUP_PROFILE_AVATAR]:!1,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!1,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!1,[R.EDIT_GROUP_PROFILE_ELSE]:!1,[R.REMOVE_MEMBER]:!1,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!1,[R.MUTE_ALL_MEMBERS]:!1,[R.TRANSFER_OWNERSHIP]:!1,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0}},[vo.MEETING]:{[Le.OWNER]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!0,[R.EDIT_GROUP_PROFILE_AVATAR]:!0,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[R.EDIT_GROUP_PROFILE_ELSE]:!0,[R.REMOVE_MEMBER]:!0,[R.SET_MEMBER_ROLE]:!0,[R.MUTE_MEMBER]:!0,[R.MUTE_ALL_MEMBERS]:!0,[R.TRANSFER_OWNERSHIP]:!0,[R.DISMISS_GROUP]:!0,[R.QUIT_GROUP]:!1},[Le.ADMIN]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!0,[R.EDIT_GROUP_PROFILE_AVATAR]:!0,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[R.EDIT_GROUP_PROFILE_ELSE]:!1,[R.REMOVE_MEMBER]:!0,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!0,[R.MUTE_ALL_MEMBERS]:!0,[R.TRANSFER_OWNERSHIP]:!1,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0},[Le.COMMON]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!1,[R.EDIT_GROUP_PROFILE_AVATAR]:!1,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!1,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!1,[R.EDIT_GROUP_PROFILE_ELSE]:!1,[R.REMOVE_MEMBER]:!1,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!1,[R.MUTE_ALL_MEMBERS]:!1,[R.TRANSFER_OWNERSHIP]:!1,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0}},[vo.COMMUNITY]:{[Le.OWNER]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!0,[R.EDIT_GROUP_PROFILE_AVATAR]:!0,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[R.EDIT_GROUP_PROFILE_ELSE]:!0,[R.REMOVE_MEMBER]:!0,[R.SET_MEMBER_ROLE]:!0,[R.MUTE_MEMBER]:!0,[R.MUTE_ALL_MEMBERS]:!0,[R.TRANSFER_OWNERSHIP]:!0,[R.DISMISS_GROUP]:!0,[R.QUIT_GROUP]:!1},[Le.ADMIN]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!0,[R.EDIT_GROUP_PROFILE_AVATAR]:!0,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[R.EDIT_GROUP_PROFILE_ELSE]:!1,[R.REMOVE_MEMBER]:!0,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!0,[R.MUTE_ALL_MEMBERS]:!0,[R.TRANSFER_OWNERSHIP]:!1,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0},[Le.COMMON]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!1,[R.EDIT_GROUP_PROFILE_AVATAR]:!1,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!1,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!1,[R.EDIT_GROUP_PROFILE_ELSE]:!1,[R.REMOVE_MEMBER]:!1,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!1,[R.MUTE_ALL_MEMBERS]:!1,[R.TRANSFER_OWNERSHIP]:!1,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0}},[vo.AVCHATROOM]:{[Le.OWNER]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!0,[R.EDIT_GROUP_PROFILE_AVATAR]:!0,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!0,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!0,[R.EDIT_GROUP_PROFILE_ELSE]:!0,[R.REMOVE_MEMBER]:!1,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!0,[R.MUTE_ALL_MEMBERS]:!0,[R.TRANSFER_OWNERSHIP]:!1,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0},[Le.ADMIN]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!1,[R.EDIT_GROUP_PROFILE_AVATAR]:!1,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!1,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!1,[R.EDIT_GROUP_PROFILE_ELSE]:!1,[R.REMOVE_MEMBER]:!1,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!1,[R.MUTE_ALL_MEMBERS]:!1,[R.TRANSFER_OWNERSHIP]:!1,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0},[Le.COMMON]:{[R.VIEW_GROUP_INFO]:!0,[R.VIEW_MEMBER_LIST]:!0,[R.EDIT_GROUP_PROFILE_NAME]:!1,[R.EDIT_GROUP_PROFILE_AVATAR]:!1,[R.EDIT_GROUP_PROFILE_INTRODUCTION]:!1,[R.EDIT_GROUP_PROFILE_NOTIFICATION]:!1,[R.EDIT_GROUP_PROFILE_ELSE]:!1,[R.REMOVE_MEMBER]:!1,[R.SET_MEMBER_ROLE]:!1,[R.MUTE_MEMBER]:!1,[R.MUTE_ALL_MEMBERS]:!1,[R.TRANSFER_OWNERSHIP]:!1,[R.DISMISS_GROUP]:!1,[R.QUIT_GROUP]:!0}}},wn=A(void 0),at=A(void 0),Mo=A(void 0),Ia=A(void 0),Aa=A(void 0),xa=A(void 0),Oa=A(void 0),Ra=A(void 0),Ki=A(void 0),Yi=A(void 0),kr=A([]),Xt=A([]),Xu=A(void 0),Qu=A(void 0),$n=A(void 0),Ji=A(void 0),Xi=A(void 0),Qi=A(void 0),mi=A(void 0),rr=A(void 0);async function Zi(t){var e;const n=(t==null?void 0:t.groupID)||at.value;if(!n)throw new Error("getGroupMemberList::groupID is required");const o=await ze.getGroupMemberList({groupID:n,count:(t==null?void 0:t.count)||100,offset:(t==null?void 0:t.offset)||0});if((e=o==null?void 0:o.data)!=null&&e.memberList){const r=o.data.memberList.map(u=>({userID:u.userID,nick:u.nick||u.userID,avatar:u.avatar||"",role:u.role,joinTime:u.joinTime,muteUntil:u.muteUntil||"",memberCustomField:u.memberCustomField||""})),a=Xt.value||[],s=(t==null?void 0:t.offset)||0;let i;s===0?i=r:(i=[...a],r.forEach((u,d)=>{const p=s+d;p<i.length?i[p]=u:i.push(u)}));const l=i.find(u=>u.role===Le.OWNER),c=i.filter(u=>u.role===Le.ADMIN);return l&&(Yi.value=l),kr.value=c,Xt.value=i,i}throw new Error("getGroupMemberList::getGroupMemberList failed")}async function AA(t){const e=t.groupID||at.value;if(!e)throw new Error("updateGroupProfile::groupID is required");const n={groupID:e};if(t.name!==void 0){if(typeof t.name!="string")throw new Error("updateGroupProfile::name must be a string");if(t.name.length===0)throw new Error("updateGroupProfile::name cannot be empty");if(t.name.length>30)throw new Error("updateGroupProfile::name must be less than or equal to 25 characters");if(t.name===Ia.value)throw new Error("updateGroupProfile::name cannot be the same as current value");n.name=t.name}if(t.introduction!==void 0){if(typeof t.introduction!="string")throw new Error("updateGroupProfile::introduction must be a string");if(t.introduction.length>130)throw new Error("updateGroupProfile::introduction must be less than 100 characters");if(t.introduction===xa.value)throw new Error("updateGroupProfile::introduction cannot be the same as current value");n.introduction=t.introduction}if(t.notification!==void 0){if(typeof t.notification!="string")throw new Error("updateGroupProfile::notification must be a string");if(t.notification.length>130)throw new Error("updateGroupProfile::notification must be less than 100 characters");if(t.notification===Oa.value)throw new Error("updateGroupProfile::notification cannot be the same as current value");n.notification=t.notification}if(t.avatar!==void 0){if(typeof t.avatar!="string")throw new Error("updateGroupProfile::avatar must be a string");if(t.avatar.length>500)throw new Error("updateGroupProfile::avatar must be less than 500 characters");if(t.avatar===Aa.value)throw new Error("updateGroupProfile::avatar cannot be the same as current value");n.avatar=t.avatar}try{await ze.updateGroupProfile(n)}catch(o){throw Mi(o),o}t.name!==void 0&&(Ia.value=t.name),t.introduction!==void 0&&(xa.value=t.introduction),t.notification!==void 0&&(Oa.value=t.notification),t.avatar!==void 0&&(Aa.value=t.avatar)}async function xA(t){const e=t.groupID||at.value;if(!e)throw new Error("addGroupMember::groupID is required");const n=await ze.addGroupMember({groupID:e,userIDList:t.userIDList});return Zi({count:100}),n}async function OA(t){var e,n;const o=t.groupID||at.value;if(!o)throw new Error("deleteGroupMember::groupID is required");await ze.deleteGroupMember({groupID:o,userIDList:t.userIDList});const r=(e=Xt.value)==null?void 0:e.filter(s=>!t.userIDList.includes(s.userID)),a=(n=kr.value)==null?void 0:n.filter(s=>!t.userIDList.includes(s.userID));Xt.value=r,kr.value=a}async function RA(t){const e=t.groupID||at.value;e&&await ze.changeGroupOwner({groupID:e,newOwnerID:t.newOwnerID})}async function PA(t){const e=t.groupID||at.value;e&&(await ze.setGroupMemberRole({groupID:e,userID:t.userID,role:t.role}),Zi({count:100}))}async function DA(t){const e=t.groupID||at.value;!e||!$n.value||(Xi.value=t.nameCard,await ze.setGroupMemberNameCard({groupID:e,userID:t.userID||$n.value,nameCard:t.nameCard}))}async function NA(t){if(!wn.value)throw new Error("setChatPinned::currentConversation is required");t!==wn.value.isPinned&&(Ki.value=t,await wn.value.pinConversation())}async function LA(t){if(!wn.value)throw new Error("setChatMuted::currentConversation is required");if(t!==wn.value.isMuted){Ra.value=t;try{await wn.value.muteConversation()}catch(e){throw Ra.value=!t,e}}}async function UA(t){const e=t.groupID||at.value;if(!e)throw new Error("setGroupMemberMuteTime::groupID is required");await ze.setGroupMemberMuteTime({groupID:e,userID:t.userID,muteTime:t.time}),Zi({count:100})}async function BA(t){if(!at.value)throw new Error("setMuteAllMember::groupID is required");await ze.updateGroupProfile({groupID:at.value,muteAllMembers:t}),Qi.value=t}async function FA(t){const e=t||at.value;if(!e)throw new Error("dismissGroup::groupID is required");await ze.dismissGroup(e)}async function jA(t){const e=t||at.value;if(!e)throw new Error("quitGroup::groupID is required");await ze.quitGroup(e)}function GA(t,e,n){const o=n||Mo.value,r=e||Ji.value||Le.COMMON;if(!o||!r)throw new Error("hasPermission::groupType or userRole is required");const a=Uc[o][r][t];if(typeof a!="boolean")throw new Error(`hasPermission::${t}-${o}-${r} is not defined`);return a}function qA(t){if(!$n.value||!Xt.value)return!1;const e=Xt.value.find(n=>n.userID===$n.value);return!e||e.userID===t.userID?!1:e.role===Le.OWNER?!0:e.role===Le.ADMIN?t.role===Le.COMMON:!1}function HA(){if(!Mo.value||!$n.value||!Xt.value)return[];const t=Xt.value.find(e=>e.userID===$n.value);return t?Uc[Mo.value][t.role]?Object.keys(Uc[Mo.value][t.role]):[]:[]}function VA(){wn.value=void 0,at.value=void 0,Mo.value=void 0,Ia.value=void 0,Aa.value=void 0,xa.value=void 0,Oa.value=void 0,Ra.value=void 0,Ki.value=void 0,Yi.value=void 0,kr.value=[],Xt.value=[],Xu.value=void 0,Qu.value=void 0,$n.value=void 0,Ji.value=void 0,Xi.value=void 0,Qi.value=void 0,mi.value=void 0,rr.value=void 0}function zA(){Re.watch(He.CONV,{currentConversation:t=>{var e;if(t&&t.type==="GROUP"){((e=wn.value)==null?void 0:e.conversationID)!==t.conversationID&&(Xt.value=void 0,kr.value=void 0,Yi.value=void 0),wn.value=t;const{groupProfile:{groupID:n,name:o,avatar:r,introduction:a,muteAllMembers:s,memberCount:i,maxMemberCount:l,notification:c,type:u,inviteOption:d,selfInfo:{role:p,userID:h,nameCard:m}},isMuted:g,isPinned:v,operationType:b}=t;switch(at.value=n,Mo.value=u,Ia.value=o,Aa.value=r,xa.value=a,Ra.value=g,Ki.value=v,Qi.value=s,Xu.value=i,$n.value=h,Ji.value=p,Xi.value=m,Qu.value=l,Oa.value=c,d){case oe.TYPES.JOIN_OPTIONS_FREE_ACCESS:rr.value=na.FREE_ACCESS;break;case oe.TYPES.JOIN_OPTIONS_NEED_PERMISSION:rr.value=na.NEED_PERMISSION;break;case oe.TYPES.JOIN_OPTIONS_DISABLE_INVITE:rr.value=na.DISABLE_APPLY;break;default:rr.value=na.DISABLE_APPLY}[4,5,8].includes(b)?mi.value=!1:b===0&&(mi.value=!0)}else VA()}}),Re.watch(He.GRP,{groupProfile:t=>{typeof t=="object"&&t&&"groupID"in t&&(at.value=t.groupID)}})}zA();function Ya(){return{groupID:at,groupType:Mo,groupName:Ia,avatar:Aa,introduction:xa,notification:Oa,isMuted:Ra,isPinned:Ki,groupOwner:Yi,adminMembers:kr,allMembers:Xt,memberCount:Xu,maxMemberCount:Qu,currentUserID:$n,currentUserRole:Ji,nameCard:Xi,isMuteAllMembers:Qi,isInGroup:mi,inviteOption:rr,hasPermission:GA,canOperateOnMember:qA,getAvailablePermissions:HA,getGroupMemberList:Zi,updateGroupProfile:AA,addGroupMember:xA,deleteGroupMember:OA,changeGroupOwner:RA,setGroupMemberRole:PA,setGroupMemberNameCard:DA,setChatPinned:NA,setChatMuted:LA,setGroupMemberMuteTime:UA,setMuteAllMember:BA,dismissGroup:FA,quitGroup:jA}}var WA=z({__name:"PopoverAnchor",props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=t;Ne();const n=Tr();return Qy(()=>{n.hasCustomAnchor.value=!0}),st(()=>{n.hasCustomAnchor.value=!1}),(o,r)=>(_(),U(f(nu),kn(Ro(e)),{default:j(()=>[ee(o.$slots,"default")]),_:3},16))}}),KA=WA;const YA=["onClick","onMouseenter"],JA={class:"mention-suggestion__name"},XA={key:0,class:"mention-suggestion__loading"},QA={key:1,class:"mention-suggestion__empty"},ZA=z({__name:"MentionSuggestion",props:{editor:{},range:{},query:{},text:{},items:{},command:{type:Function},decorationNode:{},clientRect:{type:[Function,null]}},setup(t,{expose:e}){const n=t,{t:o}=ve(),r=A(0),a=A(!0),s=A(null),i=A(null),l=A(!1),c=A(0),{allMembers:u,currentUserID:d,groupID:p,memberCount:h,getGroupMemberList:m}=Ya(),g=B(()=>{if(!u.value||!d.value||!h.value)return[];const D=u.value.filter(G=>G.userID!==d.value);return h.value&&h.value>2&&D.unshift({userID:oe.TYPES.MSG_AT_ALL,nick:o("MessageInput.at_all_members")||"all",avatar:"/at_all_members.png"}),D}),v=B(()=>{var D;return(((D=u.value)==null?void 0:D.length)||0)<(h.value||0)}),b=B(()=>{const D=n.query.toLowerCase().trim();return D?g.value.filter(G=>G.nick.toLowerCase().includes(D)):g.value}),w=B(()=>b.value[r.value]||null),E=B(()=>v.value||l.value||b.value.length===0),y=async()=>{var D;if(!(l.value||!v.value||!p.value)){l.value=!0;try{await m({count:100,offset:((D=u.value)==null?void 0:D.length)||0})}catch(G){console.error("[MentionSuggestion] Failed to load more members:",G)}finally{l.value=!1}}};ce([()=>n.query,b,v],([D,G,k])=>{D.toLowerCase().trim()&&G.length===0&&!k?a.value=!1:a.value=!0,G.length<10&&k&&!l.value&&y()},{immediate:!0});const P=B(()=>{var D;const G=(D=n.clientRect)==null?void 0:D.call(n);return G?{getBoundingClientRect:()=>({width:0,height:G.height,x:G.left,y:G.top,top:G.top,left:G.left,right:G.left,bottom:G.top+G.height})}:null});ce(b,(D,G)=>{!G||D.length<G.length||D.length===0?r.value=0:D.length>G.length&&r.value>=D.length&&(r.value=D.length-1)},{immediate:!0});let C=null;const T=()=>{C&&(C.disconnect(),C=null),!(!s.value||!i.value)&&(C=new IntersectionObserver(D=>{D.forEach(G=>{G.isIntersecting&&y()})},{root:s.value,rootMargin:"0px",threshold:.1}),C.observe(i.value))};ce([s,i,E],()=>{E.value&&s.value&&i.value&&setTimeout(T,0)},{flush:"post"}),qe(()=>{window.addEventListener("resize",Ju(M,30))}),Da(()=>{C&&(C.disconnect(),C=null),window.removeEventListener("resize",M)});const M=()=>{c.value+=1},x=D=>{const G=b.value[D];G&&n.command({id:G.userID,label:G.nick,mentionSuggestionChar:"@"})},L=()=>{if(!s.value)return;const D=s.value.children[r.value];D&&(D.scrollIntoView({block:"nearest"}),r.value===b.value.length-1&&v.value&&i.value&&i.value.scrollIntoView({block:"nearest"}))},q=D=>{const{event:G}=D;if(G.key==="ArrowDown"){G.preventDefault();const k=Math.min(r.value+1,b.value.length-1);return r.value=k,L(),k===b.value.length-1&&v.value&&!l.value&&y(),!0}return G.key==="ArrowUp"?(G.preventDefault(),r.value=Math.max(r.value-1,0),L(),!0):G.key==="Enter"&&(G.preventDefault(),w.value)?(x(r.value),!0):G.key==="Escape"},$=D=>{D.preventDefault()};return e({onKeyDown:q}),(D,G)=>(_(),U(f(uu),{open:a.value,"onUpdate:open":G[0]||(G[0]=k=>a.value=k),modal:!1},{default:j(()=>[P.value?(_(),U(f(KA),{key:0,reference:P.value},null,8,["reference"])):Y("",!0),V(f(pu),null,{default:j(()=>[V(f(du),{class:"mention-suggestion__content",side:"top",align:"start","side-offset":8,"collision-padding":8,"avoid-collisions":!1,onOpenAutoFocus:$},{default:j(()=>[I("div",{ref_key:"listboxRef",ref:s,class:"mention-suggestion__listbox"},[(_(!0),O(ie,null,we(b.value,(k,N)=>(_(),O("div",{key:k.userID,class:S(["mention-suggestion__item",{"mention-suggestion__item--selected":N===r.value}]),onClick:F=>x(N),onMouseenter:F=>r.value=N},[k.avatar!=="/at_all_members.png"?(_(),U(f(ft),{key:0,class:"mention-suggestion__avatar",src:k.avatar},null,8,["src"])):Y("",!0),I("span",JA,H(k.nick||k.userID),1)],42,YA))),128)),E.value?(_(),O("div",{key:0,ref_key:"sentinelRef",ref:i,class:"mention-suggestion__sentinel"},[v.value?(_(),O("div",XA,[G[1]||(G[1]=I("div",{class:"mention-suggestion__spinner"},null,-1)),I("span",null,H(f(o)("MessageInput.loading")),1)])):b.value.length===0&&!v.value?(_(),O("div",QA,H(f(o)("MessageInput.no_matching_members")),1)):Y("",!0)],512)):Y("",!0)],512)]),_:1})]),_:1})]),_:1},8,["open"]))}}),ex=Z(ZA,[["__scopeId","data-v-bb944499"]]);function tx(t){var e;const{char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:a,startOfLine:s,$position:i}=t,l=o&&!r,c=U$(n),u=new RegExp(`\\s${c}$`),d=s?"^":"",p=r?"":c,h=l?new RegExp(`${d}${c}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${d}(?:^)?${c}[^\\s${p}]*`,"gm"),m=((e=i.nodeBefore)===null||e===void 0?void 0:e.isText)&&i.nodeBefore.text;if(!m)return null;const g=i.pos-m.length,v=Array.from(m.matchAll(h)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const b=v.input.slice(Math.max(0,v.index-1),v.index),w=new RegExp(`^[${a==null?void 0:a.join("")}\0]?$`).test(b);if(a!==null&&!w)return null;const E=g+v.index;let y=E+v[0].length;return l&&u.test(m.slice(y-1,y+1))&&(v[0]+=" ",y+=1),E<i.pos&&y>=i.pos?{range:{from:E,to:y},query:v[0].slice(n.length),text:v[0]}:null}const nx=new Ze("suggestion");function ox({pluginKey:t=nx,editor:e,char:n="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:a=[" "],startOfLine:s=!1,decorationTag:i="span",decorationClass:l="suggestion",command:c=()=>null,items:u=()=>[],render:d=()=>({}),allow:p=()=>!0,findSuggestionMatch:h=tx}){let m;const g=d==null?void 0:d(),v=new je({key:t,view(){return{update:async(b,w)=>{var E,y,P,C,T,M,x;const L=(E=this.key)===null||E===void 0?void 0:E.getState(w),q=(y=this.key)===null||y===void 0?void 0:y.getState(b.state),$=L.active&&q.active&&L.range.from!==q.range.from,D=!L.active&&q.active,G=L.active&&!q.active,k=!D&&!G&&L.query!==q.query,N=D||$&&k,F=k||$,K=G||$&&k;if(!N&&!F&&!K)return;const J=K&&!N?L:q,pe=b.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);m={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:le=>c({editor:e,range:J.range,props:le}),decorationNode:pe,clientRect:pe?()=>{var le;const{decorationId:_e}=(le=this.key)===null||le===void 0?void 0:le.getState(e.state),Ae=b.dom.querySelector(`[data-decoration-id="${_e}"]`);return(Ae==null?void 0:Ae.getBoundingClientRect())||null}:null},N&&((P=g==null?void 0:g.onBeforeStart)===null||P===void 0||P.call(g,m)),F&&((C=g==null?void 0:g.onBeforeUpdate)===null||C===void 0||C.call(g,m)),(F||N)&&(m.items=await u({editor:e,query:J.query})),K&&((T=g==null?void 0:g.onExit)===null||T===void 0||T.call(g,m)),F&&((M=g==null?void 0:g.onUpdate)===null||M===void 0||M.call(g,m)),N&&((x=g==null?void 0:g.onStart)===null||x===void 0||x.call(g,m))},destroy:()=>{var b;m&&((b=g==null?void 0:g.onExit)===null||b===void 0||b.call(g,m))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(b,w,E,y){const{isEditable:P}=e,{composing:C}=e.view,{selection:T}=b,{empty:M,from:x}=T,L={...w};if(L.composing=C,P&&(M||e.view.composing)){(x<w.range.from||x>w.range.to)&&!C&&!w.composing&&(L.active=!1);const q=h({char:n,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:a,startOfLine:s,$position:T.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;q&&p({editor:e,state:y,range:q.range,isActive:w.active})?(L.active=!0,L.decorationId=w.decorationId?w.decorationId:$,L.range=q.range,L.query=q.query,L.text=q.text):L.active=!1}else L.active=!1;return L.active||(L.decorationId=null,L.range={from:0,to:0},L.query=null,L.text=null),L}},props:{handleKeyDown(b,w){var E;const{active:y,range:P}=v.getState(b.state);return y&&((E=g==null?void 0:g.onKeyDown)===null||E===void 0?void 0:E.call(g,{view:b,event:w,range:P}))||!1},decorations(b){const{active:w,range:E,decorationId:y}=v.getState(b);return w?At.create(b.doc,[An.inline(E.from,E.to,{nodeName:i,class:l,"data-decoration-id":y})]):null}}});return v}function rx({editor:t,overrideSuggestionOptions:e,extensionName:n,char:o="@"}){const r=new Ze;return{editor:t,char:o,pluginKey:r,command:({editor:a,range:s,props:i})=>{var l,c,u;const d=a.view.state.selection.$to.nodeAfter;!((l=d==null?void 0:d.text)===null||l===void 0)&&l.startsWith(" ")&&(s.to+=1),a.chain().focus().insertContentAt(s,[{type:n,attrs:{...i,mentionSuggestionChar:o}},{type:"text",text:" "}]).run(),(u=(c=a.view.dom.ownerDocument.defaultView)===null||c===void 0?void 0:c.getSelection())===null||u===void 0||u.collapseToEnd()},allow:({state:a,range:s})=>{const i=a.doc.resolve(s.from),l=a.schema.nodes[n];return!!i.parent.type.contentMatch.matchType(l)},...e}}function yv(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>rx({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function fh(t,e){const n=yv(t);return n.find(r=>r.char===e)||(n.length?n[0]:null)}const ax=rt.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,o;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(o=t.attrs.label)!==null&&o!==void 0?o:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var o,r;return["span",Be(this.HTMLAttributes,t.HTMLAttributes),`${(o=n==null?void 0:n.char)!==null&&o!==void 0?o:"@"}${(r=e.attrs.label)!==null&&r!==void 0?r:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=fh(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Be({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const o={...this.options};o.HTMLAttributes=Be({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:o,node:t,suggestion:n});return typeof r=="string"?["span",Be({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},renderText({node:t}){const e={options:this.options,node:t,suggestion:fh(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:o}=e,{empty:r,anchor:a}=o;if(!r)return!1;e.doc.nodesBetween(a-1,a,(l,c)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",c,c+l.nodeSize),!1});let s=new _n,i=0;return e.doc.nodesBetween(a-1,a,(l,c)=>{if(l.type.name===this.name)return n=!0,s=l,i=c,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,i,i+s.nodeSize),n})}},addProseMirrorPlugins(){return yv(this).map(ox)}});function sx(){return ax.configure({deleteTriggerWithBackspace:!0,HTMLAttributes:{class:"uikit-message-input-mention-tag"},suggestion:{char:"@",items:()=>[],render:()=>{let t=null,e=null;const n=()=>{e!=null&&e.parentNode&&e.parentNode.removeChild(e),t==null||t.destroy(),t=null,e=null};return{onStart:o=>{var r;const{activeConversation:a}=Rt(),{memberCount:s,groupType:i}=Ya();((r=a.value)==null?void 0:r.type)===Ge.GROUP&&s.value&&s.value>1&&i.value!==vo.AVCHATROOM&&(t=new wI(ex,{props:o,editor:o.editor}),t.element&&(e=t.element,document.body.appendChild(e)))},onUpdate(o){t==null||t.updateProps(o)},onKeyDown(o){var r,a;return o.event.key==="Escape"?(n(),!0):((a=(r=t==null?void 0:t.ref)==null?void 0:r.onKeyDown)==null?void 0:a.call(r,o))||!1},onExit(){n()}}}}})}function ix(t={}){const{placeholder:e="",maxLength:n,showPlaceholderOnlyWhenEditable:o=!0,onEnter:r}=t;return[kA.configure({heading:!1,blockquote:!1,codeBlock:!1,bulletList:!1,orderedList:!1,listItem:!1,horizontalRule:!1,bold:!1,italic:!1,strike:!1,code:!1}),CA.configure({limit:n}),MA(r),TA(),IA(),sx(),SI.configure({placeholder:e,showOnlyWhenEditable:o})]}const lx="_disabled_ihh75_11",cx="_editor_ihh75_21",Fr={"input-wrapper":"_input-wrapper_ihh75_1",disabled:lx,"input-prefix":"_input-prefix_ihh75_15","input-suffix":"_input-suffix_ihh75_16",editor:cx},ux=z({__name:"TextEditor",props:{autoFocus:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},maxLength:{default:void 0}},setup(t){const e=t,{t:n,language:o}=ve(),{activeConversation:r}=Rt(),{sendMessage:a,setEditorInstance:s,setContent:i}=eo();let l=null;const c=B(()=>e.placeholder??n("MessageInput.enter_a_message")),u=()=>{a(),i("")},d=bI({autofocus:e.autoFocus,editable:!e.disabled,extensions:ix({placeholder:c.value,maxLength:e.maxLength,showPlaceholderOnlyWhenEditable:e.placeholder===void 0,onEnter:u}),onUpdate:()=>{yt.enterTypingState(),l&&clearTimeout(l),l=setTimeout(()=>{yt.leaveTypingState(),l=null},3e3)}});return ce(d,p=>{s(p??null)},{immediate:!0}),ce(()=>e.disabled,p=>{var h;(h=d.value)==null||h.setEditable(!p),p&&i("")}),ce([c,o],()=>{if(!d.value)return;const p=d.value.extensionManager.extensions.find(h=>h.name==="placeholder");p&&(p.options.placeholder=c.value,d.value.view.updateState(d.value.state))}),ce(()=>e.maxLength,p=>{if(!d.value)return;const h=d.value.extensionManager.extensions.find(m=>m.name==="characterCount");h&&(h.options.limit=p)}),ce(r,(p,h)=>{(p==null?void 0:p.conversationID)!==(h==null?void 0:h.conversationID)&&i("")}),Da(()=>{s(null)}),(p,h)=>(_(),O("div",{class:S([f(Fr)["input-wrapper"],e.disabled&&f(Fr).disabled])},[I("div",{class:S(f(Fr)["input-prefix"])},[ee(p.$slots,"inputPrefix")],2),V(f(_I),{editor:f(d),class:S([f(Fr).editor,"message-input"])},null,8,["editor","class"]),I("div",{class:S(f(Fr)["input-suffix"])},[ee(p.$slots,"inputSuffix")],2)],2))}});function dx(t){if(typeof t=="string")try{return!!JSON.parse(t)}catch{return!1}return!1}function px(t){return dx(t)?JSON.parse(t):t}function xo(t,e,n){if(!t)return e;try{const o=t.trim();return!o||o==="undefined"?e:o==="null"?null:JSON.parse(o,n)??e}catch{return e}}function Wn(t){try{const e=xo(t.payload.data,{});if(e.businessID===1&&e.data){const n=xo(e.data,{});if(n.businessID==="av_call"||n.businessID==="rtc_call")return!0}}catch{return!1}return!1}function Pa(t){if(!Kl.getService(qn.TUICalling.SERVICE.NAME)){ia(sa.CALL_KIT_NOT_INTEGRATED);return}const{createCallOfflinePushInfo:e}=hu(),n=e();Kl.callService({serviceName:qn.TUICalling.SERVICE.NAME,method:qn.TUICalling.SERVICE.METHOD.START_CALL,params:{...t,version:"v3",...n&&!t.offlinePushInfo?{offlinePushInfo:n}:{}}})}function _v(t){const e=xo(t.payload.data,void 0);if(!e)return;const n=xo(e.data,void 0);return n?{description:t.payload.description,extension:t.payload.extension,data:{businessID:e.businessID,timeout:e.timeout,data:{businessID:n.businessID,call_end:n.call_end,call_type:n.call_type,data:{cmd:n.data.cmd,inviter:n.data.inviter,message:n.data.message,room_id:n.data.room_id,str_room_id:n.data.str_room_id},platform:n.platform,room_id:n.room_id,userData:n.userData,version:n.version},inviteID:e.inviteID,groupID:e.groupID,actionType:e.actionType,inviter:e.inviter,inviteeList:e.inviteeList}}:void 0}function hx(t){if(!t||t<=0)return"00:00";const e=Math.floor(t/3600),n=Math.floor(t%3600/60),o=Math.floor(t%60);return e>0?`${e.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${n.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`}function mh(t,e=12){return!t||t.length<=e?t:`${t.substring(0,e)}...`}function fx(t){return Ct.getFriendRemark([t])[t]||""}const Bc=new Map,gh=new Map;function Zu(t,e){var n,o,r,a,s,i,l,c,u,d,p;const h=_v(t);if(!h||h.data.businessID!==1)return"";const{data:m}=h,g=m.data,v=t.fromAccount||t.from,b=fx(v),w=oe.getMyUserID();let E=b||t.nameCard||t.nick||v;switch(E=mh(E),m.actionType){case 1:return(((n=g==null?void 0:g.data)==null?void 0:n.cmd)==="audioCall"||((o=g==null?void 0:g.data)==null?void 0:o.cmd)==="videoCall")&&m.groupID?e("CallMessage.start_call",{messageSender:E}):((r=g==null?void 0:g.data)==null?void 0:r.cmd)==="hangup"?m.groupID?e("CallMessage.call_ended"):`${e("CallMessage.call_duration")}: ${hx(g==null?void 0:g.call_end)}`:((a=g==null?void 0:g.data)==null?void 0:a.cmd)==="switchToAudio"?e("CallMessage.switch_to_audio_call"):((s=g==null?void 0:g.data)==null?void 0:s.cmd)==="switchToVideo"?e("CallMessage.switch_to_video_call"):e("CallMessage.start_call",{messageSender:""});case 2:return m.groupID?`${E} ${e("CallMessage.cancel_call")}`:m.inviter===w?e("CallMessage.canceled"):e("CallMessage.canceled_by_recipient");case 3:return((i=g==null?void 0:g.data)==null?void 0:i.cmd)==="switchToAudio"?e("CallMessage.switch_to_audio_call"):((l=g==null?void 0:g.data)==null?void 0:l.cmd)==="switchToVideo"?e("CallMessage.switch_to_video_call"):m.groupID?`${E} ${e("CallMessage.answered")}`:e("CallMessage.answered");case 4:return m.groupID?`${E} ${e("CallMessage.decline_call")}`:(g==null?void 0:g.line_busy)==="line_busy"||((c=g==null?void 0:g.data)==null?void 0:c.message)==="lineBusy"?m.inviter===w?e("CallMessage.line_busy"):e("CallMessage.missed_due_to_busy"):m.inviter===w?e("CallMessage.declined_by_recipient"):e("CallMessage.declined");case 5:if(((u=g==null?void 0:g.data)==null?void 0:u.cmd)==="switchToAudio")return e("CallMessage.switch_to_audio_call");if(((d=g==null?void 0:g.data)==null?void 0:d.cmd)==="switchToVideo")return e("CallMessage.switch_to_video_call");if(m.groupID){if(v===m.inviter){mx(m.inviteeList);let y="";return(p=m.inviteeList)==null||p.forEach(P=>{const C=Bc.get(P)||P;y+=`${mh(C)}、`}),y=y.substring(0,y.lastIndexOf("、")),`${y} ${e("CallMessage.no_answer")}`}return`${E} ${e("CallMessage.no_answer")}`}return m.inviter===w?e("CallMessage.no_answer_from_recipient"):e("CallMessage.no_answer_timeout");default:return""}}function mx(t=[]){if(t.length===0)return;const e=Ct.getFriendRemark(t),n=[];t.forEach(o=>{const r=e[o];r?Bc.set(o,r):gh.has(o)||(n.push(o),gh.set(o,1))}),n.length>0&&Ei.getUserProfile({userIDList:n}).then(o=>{(o.data||[]).forEach(r=>{const{userID:a,nick:s}=r,i=s||a;Bc.set(a,i)})}).catch(()=>{})}const vh=1,gx=80,vx=9,yx=1,_x=z({__name:"AudioCallPicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=qt(),{t:o}=ve(),{activeConversation:r}=Rt(),{allMembers:a,getGroupMemberList:s,memberCount:i,currentUserID:l}=Ya(),c=A(!1),u=A(),d=B(()=>{var C;return((C=r.value)==null?void 0:C.type)===Ge.C2C}),p=B(()=>{var C;return(((C=a.value)==null?void 0:C.map(T=>({key:T.userID,label:T.nick||T.userID,avatarUrl:T.avatar})))??[]).filter(T=>T.key!==l.value)}),h=B(()=>!(!r.value||e.disabled));function m(){var C,T;const M=(T=(C=r.value)==null?void 0:C.userProfile)==null?void 0:T.userID;if(!M){console.warn("No peer user ID found for private call");return}try{Pa({userIDList:[M],chatGroupID:void 0,type:vh})}catch(x){console.error("Failed to start private audio call:",x)}}function g(){var C,T;if(((C=r.value)==null?void 0:C.type)!==Ge.GROUP)return;const M=((T=a.value)==null?void 0:T.length)||0,x=i.value||0;M<x&&s({count:gx,offset:M})}function v(){g(),c.value=!0}function b(){c.value=!1}function w(){var C,T;const M=(T=(C=r.value)==null?void 0:C.groupProfile)==null?void 0:T.groupID;if(!u.value||!M){console.warn("Missing group information for group call");return}const x=u.value.getSelectedItems();if(!Array.isArray(x)||x.length===0){console.warn("No members selected for group call");return}const L=x.map(q=>q.key);try{Pa({userIDList:L,chatGroupID:M,type:vh}),b()}catch(q){console.error("Failed to start group audio call:",q)}}function E(){if(!h.value){console.warn("Cannot start audio call");return}d.value?m():v()}const y=()=>{var C;((C=r.value)==null?void 0:C.type)===Ge.GROUP&&g()},P=()=>w();return(C,T)=>(_(),U(f(ae),null,{default:j(()=>[I("div",{class:S(f(ke)(f(n)["audio-call-picker__button"],{[f(n).disabled]:e.disabled})),onClick:E},[ee(C.$slots,"default",{},()=>[V(f(Cy),{size:e.iconSize,class:S(f(n)["audio-call-picker__icon"])},null,8,["size","class"])])],2),V(f(ki),{visible:c.value,title:f(o)("MessageInput.select_call_members"),cancelText:f(o)("MessageInput.cancel"),cancel:b,close:b,confirmText:f(o)("MessageInput.initiate_call"),confirm:P,customClasses:["group-call-dialog"],appendTo:"body"},{default:j(()=>[V(f($i),{ref_key:"groupMemberPickerRef",ref:u,"display-mode":"list","data-source":p.value,"max-count":vx,"min-count":yx,class:"group-member-picker",style:{width:"100%"},onReachEnd:y},null,8,["data-source"])]),_:1},8,["visible","title","cancelText","confirmText"])]),_:3}))}}),bx="_disabled_1xb1g_16",Sx={"audio-call-picker__button":"_audio-call-picker__button_1xb1g_1",disabled:bx,"audio-call-picker__icon":"_audio-call-picker__icon_1xb1g_22"},kx={$style:Sx},bv=Z(_x,[["__cssModules",kx]]),yh=2,Ex=80,Cx=9,Mx=1,$x=z({__name:"VideoCallPicker",props:{label:{default:""},iconSize:{default:20},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=qt(),{t:o}=ve(),{activeConversation:r}=Rt(),{allMembers:a,getGroupMemberList:s,memberCount:i,currentUserID:l}=Ya(),c=A(!1),u=A(),d=B(()=>{var T;return((T=r.value)==null?void 0:T.type)===Ge.C2C}),p=B(()=>{var T;return(((T=a.value)==null?void 0:T.map(M=>({key:M.userID,label:M.nick||M.userID,avatarUrl:M.avatar})))??[]).filter(M=>M.key!==l.value)}),h=B(()=>!(!r.value||e.disabled));function m(){var T,M;return(M=(T=r.value)==null?void 0:T.userProfile)==null?void 0:M.userID}function g(){const T=m();if(!T){console.warn("No peer user ID found for private call");return}try{Pa({userIDList:[T],chatGroupID:"",type:yh})}catch(M){console.error("Failed to start private video call:",M)}}function v(){var T,M;if(((T=r.value)==null?void 0:T.type)!==Ge.GROUP)return;const x=((M=a.value)==null?void 0:M.length)||0,L=i.value||0;x<L&&s({count:Ex,offset:x})}function b(){v(),c.value=!0}function w(){c.value=!1}function E(){var T,M;const x=(M=(T=r.value)==null?void 0:T.groupProfile)==null?void 0:M.groupID;if(!u.value||!x){console.warn("Missing group information for group call");return}const L=u.value.getSelectedItems();if(!Array.isArray(L)||L.length===0){console.warn("No members selected for group call");return}const q=L.map($=>$.key);try{Pa({userIDList:q,chatGroupID:x,type:yh}),w()}catch($){console.error("Failed to start group video call:",$)}}function y(){if(!h.value){console.warn("Cannot start video call");return}d.value?g():b()}const P=()=>{var T;((T=r.value)==null?void 0:T.type)===Ge.GROUP&&v()},C=()=>E();return(T,M)=>(_(),U(f(ae),null,{default:j(()=>[I("div",{class:S(f(ke)(f(n)["video-call-picker__button"],{[f(n).disabled]:e.disabled})),onClick:y},[ee(T.$slots,"default",{},()=>[V(f(My),{size:e.iconSize,class:S(f(n)["video-call-picker__icon"])},null,8,["size","class"])])],2),V(f(ki),{visible:c.value,title:f(o)("MessageInput.select_call_members"),cancelText:f(o)("MessageInput.cancel"),cancel:w,close:w,confirmText:f(o)("MessageInput.initiate_call"),confirm:C,customClasses:["group-call-dialog"],appendTo:"body"},{default:j(()=>[V(f($i),{ref_key:"groupMemberPickerRef",ref:u,"display-mode":"list","data-source":p.value,"max-count":Cx,"min-count":Mx,class:"group-member-picker",style:{width:"100%"},onReachEnd:P},null,8,["data-source"])]),_:1},8,["visible","title","cancelText","confirmText"])]),_:3}))}}),Tx="_disabled_18fa2_16",Ix={"video-call-picker__button":"_video-call-picker__button_18fa2_1",disabled:Tx,"video-call-picker__icon":"_video-call-picker__icon_18fa2_22"},Ax={$style:Ix},wv=Z($x,[["__cssModules",Ax]]);async function xx(t){var e;if((e=navigator.clipboard)!=null&&e.writeText)try{return await navigator.clipboard.writeText(t),!0}catch(n){console.warn("Clipboard API failed:",n)}try{const n=document.createElement("textarea");if(n.value=t,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),navigator.userAgent.match(/ipad|iphone/i)){n.contentEditable="true",n.readOnly=!1;const r=document.createRange();r.selectNodeContents(n);const a=window.getSelection();a&&(a.removeAllRanges(),a.addRange(r),n.setSelectionRange(0,999999))}else n.select();const o=document.execCommand("copy");return document.body.removeChild(n),o}catch(n){console.warn("execCommand failed:",n)}throw new Error("Failed to copy text to clipboard, please copy manually")}let _h;const gi=A([]),ed=A(!1),vi=A([]),yi=A(void 0);function Ox(t){gi.value=[...new Set([...gi.value,...t])]}function Rx(t){ed.value=t}function Px(t){vi.value=[...new Set([...vi.value,...t])]}function Dx(t){const{messageIDList:e,conversationIDList:n,isMergeForward:o}=t;if(e.length===0||n.length===0||o===void 0)throw new Error("Invalid forward message parameters");const{enableReadReceipt:r}=Fa(),{createChatOfflinePushInfo:a,isEnabled:s}=hu(),i=n.map(u=>Re.getConversationModel(u)),l=e.map(u=>Re.getMessageModel(u)).sort((u,d)=>u.time-d.time),c=i.map(u=>{const d=s()?a({conversation:u,messageType:ue.MERGER,payload:{}}):void 0;return yt.sendForwardMessage([u],l,{needMerge:o,params:{needReadReceipt:!!r},offlinePushInfo:d,...t==null?void 0:t.sendForwardMessageOptions})});return Promise.allSettled(c)}function Nx(t){Re.update(He.CHAT,"quoteMessage",{message:t,type:"quote"})}function Sv(){Re.update(He.CHAT,"quoteMessage",{message:void 0,type:"quote"}),yi.value=void 0}function Lx(t){return xx(Ir(t.payload.text||""))}function Ux(t){return t.deleteMessage()}function Bx(t){return t.revokeMessage()}function kv(){Sv(),gi.value=[],ed.value=!1,vi.value=[]}function td(){return{forwardMessageIDList:gi,isForwardMessageSelectionDone:ed,forwardConversationIDList:vi,quotedMessage:yi,setForwardMessageIDList:Ox,setIsForwardMessageSelectionDone:Rx,setForwardConversationIDList:Px,forwardMessage:Dx,quoteMessage:Nx,clearQuotedMessage:Sv,copyTextMessage:Lx,deleteMessage:Ux,recallMessage:Bx,resetMessageActionState:kv}}function Fx(){function t(n){n.message===void 0?yi.value=void 0:yi.value=n.message}function e(n){n!==_h&&(kv(),_h=n)}Re.watch(He.CHAT,{quoteMessage:t}),Re.watch(He.CONV,{currentConversationID:e})}Fx();const jx="_quoted__message__preview_1u7zw_1",Gx="_quoted__message__preview__content_1u7zw_15",qx="_quoted__message__preview__close_1u7zw_44",Ho={quoted__message__preview:jx,"slide-in":"_slide-in_1u7zw_1",quoted__message__preview__content:Gx,"quoted__message__preview__content--header":"_quoted__message__preview__content--header_1u7zw_23","quoted__message__preview__content--title":"_quoted__message__preview__content--title_1u7zw_29","quoted__message__preview__content--text":"_quoted__message__preview__content--text_1u7zw_34",quoted__message__preview__close:qx},Hx=z({__name:"QuotedMessagePreview",setup(t){const{t:e}=ve(),{focusEditor:n}=eo(),{quotedMessage:o,clearQuotedMessage:r}=td();st(()=>{r()}),ce(o,i=>{i&&n()});const a=()=>{r()},s=i=>{var l;if(!i)return"no reference";switch(i.type){case ue.TEXT:return Ir(((l=i.payload)==null?void 0:l.text)||"");case ue.IMAGE:return e("MessageInput.image");case ue.AUDIO:return e("MessageInput.audio");case ue.VIDEO:return e("MessageInput.video");case ue.FILE:return e("MessageInput.file");case ue.LOCATION:return e("MessageInput.location");case ue.CUSTOM:return e("MessageInput.custom_message");default:return e("MessageInput.unknown")}};return(i,l)=>f(o)?(_(),O("div",{key:0,class:S(f(Ho).quoted__message__preview)},[I("div",{class:S(f(Ho).quoted__message__preview__content)},[I("div",{class:S(f(Ho)["quoted__message__preview__content--header"])},[I("div",{class:S(f(Ho)["quoted__message__preview__content--title"])},H(f(o).nick||f(o).from),3)],2),I("div",{class:S(f(Ho)["quoted__message__preview__content--text"])},H(s(f(o))),3)],2),V(f(Er),{class:S(f(Ho).quoted__message__preview__close),size:"16",onClick:a},null,8,["class"])],2)):Y("",!0)}}),Vx=z({__name:"SendButton",props:{onClick:{type:Function},disabled:{type:Boolean}},setup(t){const e=t,{t:n}=ve();function o(r){!e.disabled&&e.onClick&&e.onClick(r)}return(r,a)=>(_(),U(f(Tt),{type:"primary",radius:"round",size:"medium",disabled:t.disabled,onClick:o},{default:j(()=>[ge(H(f(n)("MessageInput.send")),1)]),_:1},8,["disabled"]))}}),lo={"message-input":"_message-input_2z5ho_1","message-input__toolbar":"_message-input__toolbar_2z5ho_12","message-input__wrapper":"_message-input__wrapper_2z5ho_20","message-input__leftInline":"_message-input__leftInline_2z5ho_25","message-input__rightInline":"_message-input__rightInline_2z5ho_25","message-input__actions":"_message-input__actions_2z5ho_29","message-input__footerToolbar":"_message-input__footerToolbar_2z5ho_35"},zx=z({__name:"MessageInput",props:{autoFocus:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},hideSendButton:{type:Boolean,default:!1},placeholder:{default:void 0},attachmentPickerMode:{default:"collapsed"},maxLength:{default:void 0},actions:{default:()=>["EmojiPicker","ImagePicker","FilePicker","VideoPicker"]},slots:{}},setup(t){const e=[{key:"EmojiPicker",component:Wf},{key:"AttachmentPicker",component:Od},{key:"FilePicker",component:yu},{key:"ImagePicker",component:_u},{key:"VideoPicker",component:zf},{key:"AudioCallPicker",component:bv},{key:"VideoCallPicker",component:wv}],n=t,{setContent:o,sendMessage:r}=eo(),a=(u,d)=>Object.fromEntries(d.map(p=>[p,u[p]]).filter(([,p])=>p!==void 0)),s=u=>{const{component:d=()=>null}=e.find(({key:p})=>p===u)??{};return{Component:d,props:{disabled:n.disabled}}},i=u=>{var d;const{key:p,component:h,...m}=u,g=((d=e.find(({key:v})=>v===p))==null?void 0:d.component)??(()=>null);return{Component:h??g,props:a(m,["label","className","style","iconSize"])}},l=B(()=>n.actions.map(u=>typeof u=="string"?s(u):i(u)).filter(({Component:u})=>u!==null)),c=()=>{r(),o("")};return(u,d)=>(_(),O("div",{class:S([f(lo)["message-input"]])},[ee(u.$slots,"headerToolbar",{},()=>[I("div",{class:S(f(lo)["message-input__toolbar"])},[(_(!0),O(ie,null,we(l.value,(p,h)=>(_(),U(se(p.Component),Me({key:h},{ref_for:!0},{...p.props,...p.Component===f(Od)?{attachmentPickerMode:t.attachmentPickerMode}:{}}),null,16))),128))],2)]),I("div",{class:S(f(lo)["message-input__wrapper"])},[V(f(Hx)),I("div",{class:S(f(lo)["message-input__leftInline"])},[ee(u.$slots,"leftInline")],2),ee(u.$slots,"textEditor",{},()=>[(_(),U(f(ux),{key:t.disabled?"disabled-editor":"enabled-editor",autoFocus:t.autoFocus,disabled:t.disabled,placeholder:t.placeholder,maxLength:t.maxLength},{inputPrefix:j(()=>[ee(u.$slots,"inputPrefix")]),inputSuffix:j(()=>[ee(u.$slots,"inputSuffix")]),_:3},8,["autoFocus","disabled","placeholder","maxLength"]))]),I("div",{class:S(f(lo)["message-input__rightInline"])},[ee(u.$slots,"rightInline")],2)],2),ee(u.$slots,"footerToolbar",{},()=>[I("div",{class:S(f(lo)["message-input__footerToolbar"])},[t.hideSendButton?Y("",!0):(_(),U(f(Vx),{key:0,class:S(f(lo)["message-input__send-button"]),disabled:n.disabled,onClick:c},null,8,["class","disabled"]))],2)])],2))}}),Wx={file:"File",image:"Image",video:"Video",audio:"Audio",location:"Location",custom_message:"Custom Message",unknown:"Unknown",enter_a_message:"Enter a message",send:"Send",select_call_members:"Select call members",cancel:"Cancel",confirm:"Confirm",initiate_call:"Initiate call",loading:"Loading...",no_matching_members:"No matching members",at_all_members:"All members",invalid_image_type:"Invalid image type"},Kx={text:"[Text Message]",image:"[Image Message]",video:"[Video Message]",file:"[File Message]",audio:"[Audio Message]",face:"[Sticker Message]",location:"[Location Message]",merger:"[Forward Message]",custom:"[Custom Message]"},Yx={OfflinePush:Kx,MessageInput:Wx},Jx={file:"文件",image:"图片",video:"视频",audio:"音频",location:"位置",custom_message:"自定义消息",unknown:"未知",enter_a_message:"输入消息",send:"发送",select_call_members:"选择成员",cancel:"取消",confirm:"确认",initiate_call:"发起通话",loading:"加载中...",no_matching_members:"暂无匹配成员",at_all_members:"所有人",invalid_image_type:"无效的图片类型"},Xx={text:"[文本消息]",image:"[图片消息]",video:"[视频消息]",file:"[文件消息]",audio:"[语音消息]",face:"[动画表情]",location:"[地理位置]",merger:"[转发消息]",custom:"[自定义消息]"},Qx={MessageInput:Jx,OfflinePush:Xx},_i={"en-US":Yx,"zh-CN":Qx};un("en-US",{translation:{MessageInput:_i["en-US"].MessageInput,OfflinePush:_i["en-US"].OfflinePush}});un("zh-CN",{translation:{MessageInput:_i["zh-CN"].MessageInput,OfflinePush:_i["zh-CN"].OfflinePush}});const dq=zx,pq=Wf,hq=yu,fq=_u,mq=bv,gq=wv,Ev=A([]),Cv=A([]),Mv=A([]),$v=A(0),Tv=A([]),Iv=A([]),el=A([]);function Zx(t,e){let n;return(...o)=>{clearTimeout(n),n=setTimeout(()=>t(...o),e)}}const eO=async t=>{try{const e={to:t.userID,source:t.addSource};return t.remark&&(e.remark=t.remark),t.groupName&&(e.groupName=t.groupName),t.wording&&(e.wording=t.wording),t.type&&(e.type=t.type),await Ct.addFriend(e)}catch(e){throw console.error("[ContactListState addFriend] error",e),e}},tO=async()=>{try{return await Ct.setFriendApplicationRead()}catch(t){throw console.error("[ContactListState markFriendApplicationAsRead] error",t),t}},nO=async t=>{try{return await Ct.acceptFriendApplication({userID:t.userID,remark:t.remark||"",type:t.type})}catch(e){throw console.error("[ContactListState acceptFriendApplication] error",e),e}},oO=async t=>{try{return await Ct.refuseFriendApplication(t)}catch(e){throw console.error("[ContactListState refuseFriendApplication] error",e),e}},rO=async t=>{try{return await Ct.deleteFriend(t)}catch(e){throw console.error("[ContactListState deleteFriend] error",e),e}},aO=async t=>{try{return await Ct.updateFriend({userID:t.userID,remark:t.remark})}catch(e){throw console.error("[ContactListState setFriendRemark] error",e),e}},sO=async t=>{try{return await Ei.addToBlacklist({userIDList:t})}catch(e){throw console.error("[ContactListState addToBlacklist] error",e),e}},iO=async t=>{try{return await Ei.removeFromBlacklist({userIDList:t})}catch(e){throw console.error("[ContactListState removeFromBlacklist] error",e),e}},lO=async t=>{try{return await Ct.createFriendGroup(t)}catch(e){throw console.error("[ContactListState createFriendGroup] error",e),e}},cO=async t=>{try{return await Ct.deleteFriendGroup(t)}catch(e){throw console.error("[ContactListState deleteFriendGroup] error",e),e}},uO=async t=>{try{return await Ct.addToFriendGroup(t)}catch(e){throw console.error("[ContactListState addToFriendGroup] error",e),e}},dO=async t=>{try{return await Ct.removeFromFriendGroup(t)}catch(e){throw console.error("[ContactListState removeFromFriendGroup] error",e),e}},pO=async t=>{try{return await Ct.renameFriendGroup(t)}catch(e){throw console.error("[ContactListState renameFriendGroup] error",e),e}},hO=async t=>{try{return await ze.joinGroup(t)}catch(e){throw console.error("[ContactListState joinGroup] error",e),e}},nd=t=>{el.value=t},fO=async t=>{try{const e=await ze.handleGroupApplication({handleAction:"Agree",handleMessage:t.handleMessage||"",application:t.application}),n=el.value.filter(o=>o!==t.application);return nd(n),e}catch(e){throw console.error("[ContactListState acceptGroupApplication] error",e),e}},mO=async t=>{try{const e=await ze.handleGroupApplication({handleAction:"Reject",handleMessage:t.handleMessage||"",application:t.application}),n=el.value.filter(o=>o!==t.application);return nd(n),e}catch(e){throw console.error("[ContactListState refuseGroupApplication] error",e),e}},bh=t=>{Ev.value=t},gO=t=>{Cv.value=t},vO=t=>{Mv.value=t},yO=t=>{$v.value=t},_O=t=>{Tv.value=t},bO=t=>{Iv.value=t},wO=t=>{gO(t)},SO=t=>{vO(t)},kO=t=>{if(t.length>0){const e=t.map(n=>({...n.profile,remark:n.remark||""}));bh(e)}else bh([])},EO=t=>{_O(t)},CO=t=>{const e=t.filter(n=>n.type===oe.TYPES.SNS_APPLICATION_SENT_TO_ME);bO(e)},MO=t=>{yO(t)},Av=Zx(async()=>{try{const t=await ze.getGroupApplicationList(),{applicationList:e}=t.data;return nd(e),t}catch(t){throw console.error("[ContactListState getGroupApplicationList] error",t),t}},300),$O=t=>{t.filter(e=>e.payload.operationType===1||e.payload.operationType===23).length>0&&Av()},TO=()=>{Re.watch(He.USER,{userProfile:t=>{t!=null&&t.userID&&Av()}}),Re.watch(He.GRP,{groupList:wO,groupSystemNoticeList:$O}),Re.watch(He.USER,{userBlacklist:SO}),Re.watch(He.FRIEND,{friendList:kO,friendApplicationList:CO,friendApplicationUnreadCount:MO,friendGroupList:EO})};TO();function IO(){return{friendList:Ev,groupList:Cv,blackList:Mv,friendApplicationUnreadCount:$v,friendGroupList:Tv,friendApplicationList:Iv,groupApplicationList:el,addFriend:eO,markFriendApplicationAsRead:tO,acceptFriendApplication:nO,refuseFriendApplication:oO,addToBlacklist:sO,removeFromBlacklist:iO,deleteFriend:rO,setFriendRemark:aO,createFriendGroup:lO,deleteFriendGroup:cO,addToFriendGroup:uO,removeFromFriendGroup:dO,renameFriendGroup:pO,joinGroup:hO,acceptGroupApplication:fO,refuseGroupApplication:mO}}const oa={keyword:"",results:new Map,isLoading:!1,error:null,searchAdvancedParams:new Map,selectedSearchType:"all"},Ue=ur({[de.STANDARD]:{...oa},[de.EMBEDDED]:{...oa},[de.EXACT]:{...oa},[de.MINI]:{...oa}}),ra={[Ce.MESSAGE]:or(async(t,e)=>{try{return await us.searchCloudMessages({...e,keyword:t})}catch(n){throw console.error("[searchState searchCloudMessages] error",n),n}},300),[Ce.CHAT_MESSAGE]:or(async(t,e)=>{try{return await us.searchCloudMessages({...e,keyword:t})}catch(n){throw console.error("[searchState searchCloudMessages] error",n),n}},300),[Ce.USER]:or(async(t,e)=>{try{return await us.searchCloudUsers({...e,keyword:t})}catch(n){throw console.error("[searchState searchCloudUsers] error",n),n}},300),[Ce.GROUP]:or(async(t,e)=>{try{return await us.searchCloudGroups({...e,keyword:t})}catch(n){throw console.error("[searchState searchCloudGroups] error",n),n}},300)},Gl={[Ce.USER]:or(async t=>{try{const e={resultList:[],hasMore:!1,cursor:"",totalCount:0,params:{keyword:t}},n=await Promise.all([Ei.getUserProfile({userIDList:[t]}),Ct.checkFriend({userIDList:[t],type:oe.TYPES.SNS_CHECK_TYPE_BOTH})]);return n[0].data.length>0&&(e.resultList=[{profile:n[0].data[0],relation:n[1].data.successUserIDList[0]}],e.totalCount=1),e}catch(e){throw console.error("[searchState getUserProfile] error",e),e}},300),[Ce.GROUP]:or(async t=>{try{const e={resultList:[],hasMore:!1,cursor:"",totalCount:0,params:{keyword:t}},n=await ze.searchGroupByID(t);return n.data.group&&(e.resultList=[{groupInfo:n.data.group}],e.totalCount=1),e}catch(e){throw console.error("[searchState searchGroupByID] error",e),e}},300)},wh=(t,e)=>{const n=Ue[de.EXACT],o=new Map;o.set(e,t),Object.assign(n,{results:o})},AO=async(t,e)=>{const{keyword:n}=Ue[t];if(e)try{const o=Gl[e],r=await(o==null?void 0:o(n));wh(r,e)}catch(o){throw console.error(`[searchState search] error variant is ${t}, type is ${e}`,o),o}else Object.keys(Gl).forEach(async o=>{const r=o;try{const a=Gl[r],s=await(a==null?void 0:a(n));wh(s,r)}catch(a){throw console.error(`[searchState search] error variant is ${t}, type is ${r}`,a),a}})},Kn=async(t,e)=>{const n=Ue[t];if(n.keyword&&Object.assign(Ue[t],{isLoading:!0,error:null}),t===de.EXACT)return AO(t,e);try{const o=[],r=e||n.selectedSearchType;t===de.EMBEDDED?o.push({type:Ce.CHAT_MESSAGE,search:ra[Ce.CHAT_MESSAGE]}):r==="all"?Object.keys(ra).forEach(a=>{a!==Ce.CHAT_MESSAGE&&o.push({type:a,search:ra[a]})}):o.push({type:r,search:ra[r]}),await Promise.all(o.map(async a=>{var s;const i=n.searchAdvancedParams.get(a.type)||{};return(s=a.search)==null?void 0:s.call(a,n.keyword,i)})),Object.assign(Ue[t],{isLoading:!1})}catch(o){Object.assign(Ue[t],{error:o,isLoading:!1})}return Promise.resolve()},xO=(t,e)=>{const n=Ue[t],{searchAdvancedParams:o,selectedSearchType:r}=n,a={...n,error:null,isLoading:!1,keyword:e.trimEnd(),searchAdvancedParams:new Map,results:new Map};if(e!==n.keyword){if(t===de.EMBEDDED){const{conversationID:s}=o.get(Ce.CHAT_MESSAGE);a.searchAdvancedParams.set(Ce.CHAT_MESSAGE,{conversationID:s})}r!=="all"&&a.searchAdvancedParams.set(r,o.get(r)),Object.assign(Ue[t],a),e&&(t===de.EXACT?Kn(t):t!==de.EMBEDDED?Object.keys(ra).forEach(s=>{s!==Ce.CHAT_MESSAGE&&Kn(t,s)}):Kn(t))}},xv=t=>{Object.assign(Ue[t],oa)},OO=(t,e)=>{const n=Ue[t];if(t===de.EXACT&&xv(t),n.selectedSearchType===e)return;const o={...n,selectedSearchType:e===Ce.CHAT_MESSAGE?Ce.MESSAGE:e},r=[];n.keyword&&e==="all"&&n.searchAdvancedParams.forEach((a,s)=>{(a||!n.results.has(s))&&(s!==Ce.CHAT_MESSAGE&&r.push(s),o.results.delete(s),o.searchAdvancedParams.delete(s))}),Object.assign(Ue[t],o),r.length>0&&r.forEach(a=>{Kn(t,a)})},Ov=(t,e)=>{const n=Ue[t],{searchAdvancedParams:o}=n,{conversationID:r}=e,a=r?Ce.CHAT_MESSAGE:Ce.MESSAGE,s=new Map([[a,e]]),i=[a],l=n.results.get(Ce.CHAT_MESSAGE);if(!r&&l){const h=l.params;s.set(Ce.CHAT_MESSAGE,{conversationID:h.conversationID,...e,cursor:""}),i.push(Ce.CHAT_MESSAGE)}const c=new Map([...o,...s]);Object.assign(Ue[t],{searchAdvancedParams:c,results:n.results});const u=c.get(r?Ce.CHAT_MESSAGE:Ce.MESSAGE),{senderUserIDList:d=[],messageTypeList:p=[]}=u||{};(n.keyword||(d==null?void 0:d.length)>0&&p.length>0)&&i.forEach(h=>{Kn(t,h)})},RO=(t,e)=>{const n=Ue[t],o=new Map;o.set(Ce.USER,{...e,cursor:""}),Object.assign(Ue[t],{searchAdvancedParams:new Map([...n.searchAdvancedParams,...o])}),n.keyword&&Kn(t,Ce.USER)},PO=(t,e)=>{const n=Ue[t],o=new Map;o.set(Ce.GROUP,{...e,cursor:""}),Object.assign(Ue[t],{searchAdvancedParams:new Map([...n.searchAdvancedParams,...o])}),n.keyword&&Kn(t,Ce.GROUP)},tl=(t,e)=>{const{params:n={}}=t;Object.entries(Ue).forEach(([o,r])=>{if(o===de.EXACT)return;const a={...r.searchAdvancedParams.get(e),keyword:r.keyword};if(JSON.stringify(n)===JSON.stringify(a)){const s=new Map;s.set(e,t);const i=new Map([...r.results,...s]),l=o===de.STANDARD,c=e===Ce.CHAT_MESSAGE;Object.assign(Ue[o],{selectedSearchType:l&&c?Ce.MESSAGE:r.selectedSearchType,results:i})}})},DO=async(t,e)=>{var n;const o=Ue[t],r=e||o.selectedSearchType,a=o.searchAdvancedParams.get(r)||{},s=(n=o.results)==null?void 0:n.get(r);a.cursor=(s==null?void 0:s.cursor)||"",Object.assign(Ue[t],{searchAdvancedParams:new Map(o.searchAdvancedParams).set(r,a)}),Kn(t,e)},NO=t=>{tl(t,Ce.MESSAGE)},LO=t=>{tl(t,Ce.CHAT_MESSAGE)},UO=t=>{tl(t,Ce.USER)},BO=t=>{tl(t,Ce.GROUP)},FO=()=>{Re.watch(He.CONV,{currentConversationID:t=>{xv(de.EMBEDDED),Ov(de.EMBEDDED,{conversationID:t})}}),Re.watch(He.SEARCH,{searchMessagesResult:NO,searchChatMessagesResult:LO,searchUserResult:UO,searchGroupResult:BO})};FO();function od(t){const e=!t||t!==de.EMBEDDED&&t!==de.EXACT?de.STANDARD:t,n=B(()=>Ue[e]);return{keyword:B(()=>n.value.keyword),results:B(()=>n.value.results),isLoading:B(()=>n.value.isLoading),error:B(()=>n.value.error),searchAdvancedParams:B(()=>n.value.searchAdvancedParams),selectedSearchType:B(()=>n.value.selectedSearchType),setKeyword:o=>xO(e,o),loadMore:o=>DO(e,o),setSelectedType:o=>OO(e,o),setSearchMessageAdvancedParams:o=>Ov(e,o),setSearchUserAdvancedParams:o=>RO(e,o),setSearchGroupAdvancedParams:o=>PO(e,o)}}const jO={"action.search":"Search","action.cancel":"Cancel","action.confirm":"Confirm","action.enterChat":"Enter Chat","action.locateToChat":"Locate to Chat","action.readMore":"Read More","action.filter":"Filter","type.all":"All","type.messages":"Messages","type.users":"Users","type.groups":"Groups","input.placeholder.keywords":"Please enter keywords to search","input.selectTime":"Select Time","status.loading":"Loading...","status.noContent":"No Content","loadMore.default":"Load More","loadMore.messages":"Load More Messages","loadMore.users":"Load More Users","loadMore.groups":"Load More Groups","results.title":"Search Messages","results.relatedTo":"{{count}} texts related to","results.relatedToSuffix":"related texts","results.foundMessages":"Found {{count}} messages","messageType.image":"Image Message","messageType.videoCover":"Video Cover","messageType.custom":"Custom Message","messageType.unsupported":"Unsupported Message Type","filter.title":"Filter Users","filter.gender":"Gender","filter.age":"Age","filter.gender.any":"Any","filter.gender.male":"Male","filter.gender.female":"Female","filter.gender.secret":"Secret","filter.age.yearsOld":"years old","timeFilter.allTime":"All Time","timeFilter.today":"Today","timeFilter.last3Days":"Last 3 Days","timeFilter.last7Days":"Last 7 Days"},GO={Time:"Time",January:"January",February:"February",March:"March",April:"April",May:"May",June:"June",July:"July",August:"August",September:"September",October:"October",November:"November",December:"December",Monday:"Mon",Tuesday:"Tue",Wednesday:"Wed",Thursday:"Thu",Friday:"Fri",Saturday:"Sat",Sunday:"Sun"},qO={Search:jO,DateRangePicker:GO},HO={"action.search":"搜索","action.cancel":"取消","action.confirm":"确定","action.enterChat":"进入聊天","action.locateToChat":"定位到聊天","action.readMore":"查看更多","action.filter":"筛选","type.all":"全部","type.messages":"消息","type.users":"用户","type.groups":"群组","input.placeholder.keywords":"请输入关键词搜索","input.selectTime":"选择时间","status.loading":"加载中...","status.noContent":"暂无内容","loadMore.default":"加载更多","loadMore.messages":"加载更多消息","loadMore.users":"加载更多用户","loadMore.groups":"加载更多群组","results.title":"搜索消息","results.relatedTo":"{{count}} 条与","results.relatedToSuffix":"的消息","results.foundMessages":"发现 {{count}} 条消息","messageType.image":"图片消息","messageType.videoCover":"视频封面","messageType.custom":"自定义消息","messageType.unsupported":"不支持的消息类型","filter.title":"筛选用户","filter.gender":"性别","filter.age":"年龄","filter.gender.any":"不限","filter.gender.male":"男","filter.gender.female":"女","filter.gender.secret":"保密","filter.age.yearsOld":"岁","timeFilter.allTime":"全部时间","timeFilter.today":"今天","timeFilter.last3Days":"最近 3 天","timeFilter.last7Days":"最近 7 天"},VO={Time:"时间",January:"一月",February:"二月",March:"三月",April:"四月",May:"五月",June:"六月",July:"七月",August:"八月",September:"九月",October:"十月",November:"十一月",December:"十二月",Monday:"一",Tuesday:"二",Wednesday:"三",Thursday:"四",Friday:"五",Saturday:"六",Sunday:"日"},zO={Search:HO,DateRangePicker:VO},WO=z({__name:"SearchTab",props:{activeTab:{}},emits:["tab-change"],setup(t,{emit:e}){const n=e,{t:o}=ve(),r=B(()=>[{key:"all",label:o("Search.type.all")},{key:Q.MESSAGE,label:o("Search.type.messages")},{key:Q.USER,label:o("Search.type.users")},{key:Q.GROUP,label:o("Search.type.groups")}]),a=s=>{n("tab-change",s)};return(s,i)=>(_(),O("div",{class:S(s.$style.SearchTab)},[(_(!0),O(ie,null,we(r.value,l=>(_(),U(f(Tt),{key:l.key,type:"text",class:S([s.$style.SearchTab__item,{[s.$style["SearchTab__item--active"]]:t.activeTab===l.key}]),onClick:c=>a(l.key)},{default:j(()=>[ge(H(l.label),1)]),_:2},1032,["class","onClick"]))),128))],2))}}),KO="_SearchTab_1ksml_1",YO="_SearchTab__item_1ksml_11",JO={SearchTab:KO,SearchTab__item:YO,"SearchTab__item--active":"_SearchTab__item--active_1ksml_29"},XO={$style:JO},QO=Z(WO,[["__cssModules",XO]]),ZO=["onClick"],eR=["onClick"],tR=["onClick"],nR=["onClick"],oR=["onClick"],rR=["onClick"],aR=z({__name:"DateRangePicker",props:{value:{},onChange:{type:Function},className:{}},setup(t){const e=t,{t:n}=ve(),o=A(new Date),r=A((()=>{const k=new Date;return k.setMonth(k.getMonth()+1),k})()),a=A([null,null]),s=A(!1),i=A(!1),l=A(o.value.getFullYear()),c=A(r.value.getFullYear()),u=A(),d=A(),p=A(!1),h=[n("DateRangePicker.January"),n("DateRangePicker.February"),n("DateRangePicker.March"),n("DateRangePicker.April"),n("DateRangePicker.May"),n("DateRangePicker.June"),n("DateRangePicker.July"),n("DateRangePicker.August"),n("DateRangePicker.September"),n("DateRangePicker.October"),n("DateRangePicker.November"),n("DateRangePicker.December")],m=[n("DateRangePicker.Monday"),n("DateRangePicker.Tuesday"),n("DateRangePicker.Wednesday"),n("DateRangePicker.Thursday"),n("DateRangePicker.Friday"),n("DateRangePicker.Saturday"),n("DateRangePicker.Sunday")],g=k=>{const N=new Date(k);return N.setHours(0,0,0,0),N},v=k=>{const N=new Date(k);return N.setHours(23,59,59,999),N};ce(()=>e.value,k=>{a.value=k||[null,null]},{immediate:!0});const b=k=>{u.value&&!u.value.contains(k.target)&&(s.value=!1),d.value&&!d.value.contains(k.target)&&(i.value=!1)};qe(()=>{document.addEventListener("mousedown",b)}),st(()=>{document.removeEventListener("mousedown",b)});const w=k=>{const N=k.getFullYear(),F=k.getMonth(),K=new Date(N,F,1),J=new Date(N,F+1,0),pe=[],le=K.getDay()===0?6:K.getDay()-1;for(let _e=le;_e>0;_e-=1){const Ae=new Date(N,F,1-_e);pe.push({date:Ae,isCurrentMonth:!1})}for(let _e=1;_e<=J.getDate();_e+=1)pe.push({date:new Date(N,F,_e),isCurrentMonth:!0});for(let _e=1;pe.length<42;_e+=1){const Ae=new Date(N,F+1,_e);pe.push({date:Ae,isCurrentMonth:!1})}return pe},E=k=>{var N;let F;if(!a.value[0]||a.value[0]&&a.value[1])F=[g(k),null];else{const[K]=a.value;K&&k<K?F=[g(k),v(K)]:F=[g(K),v(k)]}p.value=!0,a.value=F,(N=e.onChange)==null||N.call(e,F),p.value=!1},y=(k,N)=>{const F=N?r.value:o.value,K=new Date(k.getFullYear(),k.getMonth(),1),J=new Date(F.getFullYear(),F.getMonth(),1);N&&K>=J||!N&&K<=J||(N?o.value=k:r.value=k)},P=(k,N)=>{const F=k?o.value:r.value,K=new Date(F);K.setMonth(K.getMonth()+(N?1:-1)),y(K,k)},C=(k,N)=>{const F=k?o.value:r.value,K=new Date(F);K.setFullYear(K.getFullYear()+(N?1:-1)),y(K,k)},T=k=>{k?(l.value=o.value.getFullYear(),s.value=!s.value,i.value=!1):(c.value=r.value.getFullYear(),i.value=!i.value,s.value=!1)},M=(k,N)=>{k?l.value=N:c.value=N},x=(k,N)=>{const F=k?l.value:c.value,K=new Date(F,N,1);y(K,k),k?s.value=!1:i.value=!1},L=k=>{const[N,F]=a.value;if(!N||!F)return!1;const K=k.setHours(0,0,0,0),J=new Date(N).setHours(0,0,0,0),pe=new Date(F).setHours(0,0,0,0);return K>=J&&K<=pe},q=k=>{const[N]=a.value;if(!N)return!1;const F=k.setHours(0,0,0,0);return new Date(N).setHours(0,0,0,0)===F},$=k=>{const[,N]=a.value;if(!N)return!1;const F=k.setHours(0,0,0,0);return new Date(N).setHours(0,0,0,0)===F},D=k=>{const N=new Date,F=k.setHours(0,0,0,0),K=N.setHours(0,0,0,0);return F===K},G=()=>{var k;(k=e.onChange)==null||k.call(e,[null,null])};return(k,N)=>f(Oe)?(_(),O("div",{key:0,class:S(k.$style["SearchDateRangePicker__h5-mask"]),onClick:G},[I("div",{class:S(k.$style["SearchDateRangePicker__h5-panel"]),onClick:N[7]||(N[7]=yn(()=>{},["stop"]))},[I("div",{class:S(k.$style["SearchDateRangePicker__h5-header"])},H(f(n)("DateRangePicker.Time")),3),I("div",{class:S(k.$style.SearchDateRangePicker__calendar)},[I("div",{class:S(k.$style["SearchDateRangePicker__calendar-header"])},[I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[0]||(N[0]=F=>C(!0,!1))}," << ",2),I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[1]||(N[1]=F=>P(!0,!1))}," < ",2),I("span",{class:S(k.$style["SearchDateRangePicker__current-month-year"]),onClick:N[2]||(N[2]=F=>T(!0))},H(o.value.getFullYear())+" "+H(h[o.value.getMonth()]),3),I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[3]||(N[3]=F=>P(!0,!0))}," > ",2),I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[4]||(N[4]=F=>C(!0,!0))}," >> ",2),s.value?(_(),O("div",{key:0,ref_key:"pickerRefLeft",ref:u,class:S(k.$style["SearchDateRangePicker__picker-dropdown"])},[I("div",{class:S(k.$style["SearchDateRangePicker__picker-header"])},[I("button",{class:S(k.$style["SearchDateRangePicker__picker-nav-button"]),onClick:N[5]||(N[5]=F=>M(!0,l.value-1))}," < ",2),I("span",{class:S(k.$style["SearchDateRangePicker__picker-year-text"])},H(l.value),3),I("button",{class:S(k.$style["SearchDateRangePicker__picker-nav-button"]),onClick:N[6]||(N[6]=F=>M(!0,l.value+1))}," > ",2)],2),I("div",{class:S(k.$style["SearchDateRangePicker__picker-months"])},[(_(),O(ie,null,we(h,(F,K)=>I("button",{key:F,class:S(k.$style["SearchDateRangePicker__picker-month-button"]),onClick:J=>x(!0,K)},H(F),11,ZO)),64))],2)],2)):Y("",!0)],2),I("div",{class:S(k.$style["SearchDateRangePicker__week-days"])},[(_(),O(ie,null,we(m,F=>I("div",{key:F,class:S(k.$style["SearchDateRangePicker__week-day"])},H(F),3)),64))],2),I("div",{class:S(k.$style.SearchDateRangePicker__days)},[(_(!0),O(ie,null,we(w(o.value),({date:F,isCurrentMonth:K},J)=>(_(),O("div",{key:J,class:S([k.$style.SearchDateRangePicker__day,{[k.$style["SearchDateRangePicker__day--selected"]]:L(F),[k.$style["SearchDateRangePicker__day--start"]]:q(F)&&K,[k.$style["SearchDateRangePicker__day--end"]]:$(F)&&K,[k.$style["SearchDateRangePicker__day--other-month"]]:!K,[k.$style["SearchDateRangePicker__day--today"]]:D(F)&&K}]),onClick:pe=>K&&E(F)},H(F.getDate()),11,eR))),128))],2)],2)],2)],2)):(_(),O("div",{key:1,class:S([k.$style.SearchDateRangePicker,t.className])},[I("div",{class:S(k.$style.SearchDateRangePicker__calendars)},[I("div",{class:S(k.$style.SearchDateRangePicker__calendar)},[I("div",{class:S(k.$style["SearchDateRangePicker__calendar-header"])},[I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[8]||(N[8]=F=>C(!0,!1))}," << ",2),I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[9]||(N[9]=F=>P(!0,!1))}," < ",2),I("span",{class:S(k.$style["SearchDateRangePicker__current-month-year"]),onClick:N[10]||(N[10]=F=>T(!0))},H(o.value.getFullYear())+" "+H(h[o.value.getMonth()]),3),I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[11]||(N[11]=F=>P(!0,!0))}," > ",2),I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[12]||(N[12]=F=>C(!0,!0))}," >> ",2),s.value?(_(),O("div",{key:0,ref_key:"pickerRefLeft",ref:u,class:S(k.$style["SearchDateRangePicker__picker-dropdown"])},[I("div",{class:S(k.$style["SearchDateRangePicker__picker-header"])},[I("button",{class:S(k.$style["SearchDateRangePicker__picker-nav-button"]),onClick:N[13]||(N[13]=F=>M(!0,l.value-1))}," < ",2),I("span",{class:S(k.$style["SearchDateRangePicker__picker-year-text"])},H(l.value),3),I("button",{class:S(k.$style["SearchDateRangePicker__picker-nav-button"]),onClick:N[14]||(N[14]=F=>M(!0,l.value+1))}," > ",2)],2),I("div",{class:S(k.$style["SearchDateRangePicker__picker-months"])},[(_(),O(ie,null,we(h,(F,K)=>I("button",{key:F,class:S(k.$style["SearchDateRangePicker__picker-month-button"]),onClick:J=>x(!0,K)},H(F),11,tR)),64))],2)],2)):Y("",!0)],2),I("div",{class:S(k.$style["SearchDateRangePicker__week-days"])},[(_(),O(ie,null,we(m,F=>I("div",{key:F,class:S(k.$style["SearchDateRangePicker__week-day"])},H(F),3)),64))],2),I("div",{class:S(k.$style.SearchDateRangePicker__days)},[(_(!0),O(ie,null,we(w(o.value),({date:F,isCurrentMonth:K},J)=>(_(),O("div",{key:J,class:S([k.$style.SearchDateRangePicker__day,{[k.$style["SearchDateRangePicker__day--selected"]]:L(F),[k.$style["SearchDateRangePicker__day--start"]]:q(F)&&K,[k.$style["SearchDateRangePicker__day--end"]]:$(F)&&K,[k.$style["SearchDateRangePicker__day--other-month"]]:!K,[k.$style["SearchDateRangePicker__day--today"]]:D(F)&&K}]),onClick:pe=>K&&E(F)},H(F.getDate()),11,nR))),128))],2)],2),I("div",{class:S(k.$style.SearchDateRangePicker__calendar)},[I("div",{class:S(k.$style["SearchDateRangePicker__calendar-header"])},[I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[15]||(N[15]=F=>C(!1,!1))}," << ",2),I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[16]||(N[16]=F=>P(!1,!1))}," < ",2),I("span",{class:S(k.$style["SearchDateRangePicker__current-month-year"]),onClick:N[17]||(N[17]=F=>T(!1))},H(r.value.getFullYear())+" "+H(h[r.value.getMonth()]),3),I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[18]||(N[18]=F=>P(!1,!0))}," > ",2),I("button",{class:S(k.$style["SearchDateRangePicker__nav-button"]),onClick:N[19]||(N[19]=F=>C(!1,!0))}," >> ",2),i.value?(_(),O("div",{key:0,ref_key:"pickerRefRight",ref:d,class:S(k.$style["SearchDateRangePicker__picker-dropdown"])},[I("div",{class:S(k.$style["SearchDateRangePicker__picker-header"])},[I("button",{class:S(k.$style["SearchDateRangePicker__picker-nav-button"]),onClick:N[20]||(N[20]=F=>M(!1,c.value-1))}," < ",2),I("span",{class:S(k.$style["SearchDateRangePicker__picker-year-text"])},H(c.value),3),I("button",{class:S(k.$style["SearchDateRangePicker__picker-nav-button"]),onClick:N[21]||(N[21]=F=>M(!1,c.value+1))}," > ",2)],2),I("div",{class:S(k.$style["SearchDateRangePicker__picker-months"])},[(_(),O(ie,null,we(h,(F,K)=>I("button",{key:F,class:S(k.$style["SearchDateRangePicker__picker-month-button"]),onClick:J=>x(!1,K)},H(F),11,oR)),64))],2)],2)):Y("",!0)],2),I("div",{class:S(k.$style["SearchDateRangePicker__week-days"])},[(_(),O(ie,null,we(m,F=>I("div",{key:F,class:S(k.$style["SearchDateRangePicker__week-day"])},H(F),3)),64))],2),I("div",{class:S(k.$style.SearchDateRangePicker__days)},[(_(!0),O(ie,null,we(w(r.value),({date:F,isCurrentMonth:K},J)=>(_(),O("div",{key:J,class:S([k.$style.SearchDateRangePicker__day,{[k.$style["SearchDateRangePicker__day--selected"]]:L(F),[k.$style["SearchDateRangePicker__day--start"]]:q(F)&&K,[k.$style["SearchDateRangePicker__day--end"]]:$(F)&&K,[k.$style["SearchDateRangePicker__day--other-month"]]:!K,[k.$style["SearchDateRangePicker__day--today"]]:D(F)&&K}]),onClick:pe=>K&&E(F)},H(F.getDate()),11,rR))),128))],2)],2)],2)],2))}}),sR="_SearchDateRangePicker_5227q_1",iR="_SearchDateRangePicker__calendars_5227q_10",lR="_SearchDateRangePicker__calendar_5227q_10",cR="_SearchDateRangePicker__days_5227q_135",uR="_SearchDateRangePicker__day_5227q_135",dR="_slideUp_5227q_1",pR={SearchDateRangePicker:sR,SearchDateRangePicker__calendars:iR,SearchDateRangePicker__calendar:lR,"SearchDateRangePicker__calendar-header":"_SearchDateRangePicker__calendar-header_5227q_22","SearchDateRangePicker__current-month-year":"_SearchDateRangePicker__current-month-year_5227q_31","SearchDateRangePicker__nav-button":"_SearchDateRangePicker__nav-button_5227q_45","SearchDateRangePicker__picker-dropdown":"_SearchDateRangePicker__picker-dropdown_5227q_62","SearchDateRangePicker__picker-header":"_SearchDateRangePicker__picker-header_5227q_75","SearchDateRangePicker__picker-nav-button":"_SearchDateRangePicker__picker-nav-button_5227q_82","SearchDateRangePicker__picker-year-text":"_SearchDateRangePicker__picker-year-text_5227q_94","SearchDateRangePicker__picker-months":"_SearchDateRangePicker__picker-months_5227q_100","SearchDateRangePicker__picker-month-button":"_SearchDateRangePicker__picker-month-button_5227q_106","SearchDateRangePicker__week-days":"_SearchDateRangePicker__week-days_5227q_122","SearchDateRangePicker__week-day":"_SearchDateRangePicker__week-day_5227q_122",SearchDateRangePicker__days:cR,SearchDateRangePicker__day:uR,"SearchDateRangePicker__day--today":"_SearchDateRangePicker__day--today_5227q_156","SearchDateRangePicker__day--other-month":"_SearchDateRangePicker__day--other-month_5227q_160","SearchDateRangePicker__day--selected":"_SearchDateRangePicker__day--selected_5227q_167","SearchDateRangePicker__day--start":"_SearchDateRangePicker__day--start_5227q_172","SearchDateRangePicker__day--end":"_SearchDateRangePicker__day--end_5227q_172","SearchDateRangePicker__h5-mask":"_SearchDateRangePicker__h5-mask_5227q_204","SearchDateRangePicker__h5-panel":"_SearchDateRangePicker__h5-panel_5227q_217",slideUp:dR,"SearchDateRangePicker__h5-header":"_SearchDateRangePicker__h5-header_5227q_230","SearchDateRangePicker__h5-footer":"_SearchDateRangePicker__h5-footer_5227q_238","SearchDateRangePicker__h5-cancel":"_SearchDateRangePicker__h5-cancel_5227q_246","SearchDateRangePicker__h5-confirm":"_SearchDateRangePicker__h5-confirm_5227q_258","SearchDateRangePicker__h5-quick-options":"_SearchDateRangePicker__h5-quick-options_5227q_271","SearchDateRangePicker__h5-quick-option":"_SearchDateRangePicker__h5-quick-option_5227q_271","SearchDateRangePicker__h5-quick-option--active":"_SearchDateRangePicker__h5-quick-option--active_5227q_290"},hR={$style:pR},fR=Z(aR,[["__cssModules",hR]]),mR=z({__name:"MessageAdvanced",props:{advancedParams:{},onAdvancedParamsChange:{type:Function}},setup(t){const e=t,{t:n}=ve(),o=A(!1),r=A([null,null]),a=A(),s=A(""),i=[{label:n("Search.timeFilter.today"),value:"today"},{label:n("Search.timeFilter.last3Days"),value:"last3days"},{label:n("Search.timeFilter.last7Days"),value:"last7days"}],l=w=>{a.value&&!a.value.contains(w.target)&&(o.value=!1)};qe(()=>{document.addEventListener("mousedown",l)}),st(()=>{document.removeEventListener("mousedown",l)});const c=w=>{const E=new Date(w);return E.setHours(0,0,0,0),E},u=w=>{const E=new Date(w);return E.setHours(23,59,59,999),E};ce(()=>e.advancedParams,w=>{const E=w==null?void 0:w.get(Q.MESSAGE);let y=[null,null];if(E!=null&&E.timePosition&&E!=null&&E.timePeriod){const P=new Date(E.timePosition*1e3);y=[new Date((E.timePosition-E.timePeriod)*1e3),P]}r.value=y},{immediate:!0});const d=(w,E,y)=>{if(!w||!E)return!1;const P=u(new Date).getTime(),C=new Date;C.setDate(C.getDate()-(y-1));const T=c(C).getTime();return E===P&&w===T};function p([w,E]){const y=w==null?void 0:w.getTime(),P=E==null?void 0:E.getTime(),C=[{option:"today",days:1},{option:"last3days",days:3},{option:"last7days",days:7}].find(({days:T})=>d(y,P,T));return(C==null?void 0:C.option)||""}ce(r,w=>{var E,y;if(!s.value){const P=(E=w[0])==null?void 0:E.getTime(),C=(y=w[1])==null?void 0:y.getTime(),T=[{option:"today",days:1},{option:"last3days",days:3},{option:"last7days",days:7}].find(({days:M})=>d(P,C,M));s.value=(T==null?void 0:T.option)||""}},{immediate:!0});const h=()=>{const[w,E]=r.value;return!w||!E?n("Search.timeFilter.allTime"):`${w.toLocaleDateString()} - ${E.toLocaleDateString()}`},m=()=>{o.value=!o.value},g=(w,E)=>{const[y,P]=w,C={timePosition:0,timePeriod:0};if(y&&P){const T=Math.floor(y.getTime()/1e3);C.timePosition=Math.floor(P.getTime()/1e3),C.timePeriod=C.timePosition-T}if(E!==void 0&&(s.value=E),e.onAdvancedParamsChange){const T=new Map(e.advancedParams||[]);T.set(Q.MESSAGE,{...T.get(Q.MESSAGE),...C}),e.onAdvancedParamsChange(T)}},v=w=>{var E,y;const[P,C]=w;if(!P&&!C&&(o.value=!1),!P||!C)return;o.value=!1;const T=(P==null?void 0:P.getTime())===((E=r.value[0])==null?void 0:E.getTime()),M=(C==null?void 0:C.getTime())===((y=r.value[1])==null?void 0:y.getTime());T&&M||(g(w),s.value=p(w))},b=w=>{const E=w===s.value?"":w,y=new Date;let P=null,C=null;if(w!==s.value)switch(w){case"today":P=c(y),C=u(y);break;case"last3days":{const T=new Date(y);T.setDate(y.getDate()-2),P=c(T),C=u(y);break}case"last7days":{const T=new Date(y);T.setDate(y.getDate()-6),P=c(T),C=u(y);break}default:P=null,C=null;break}g([P,C],E)};return(w,E)=>(_(),O("div",{class:S(w.$style.SearchMessageAdvanced)},[I("div",{ref_key:"datePickerRef",ref:a,class:S(w.$style["SearchMessageAdvanced__filter-row"])},[I("div",{class:S(w.$style["SearchMessageAdvanced__filter-select"]),onClick:m},[I("span",{class:S(w.$style["SearchMessageAdvanced__filter-label"])},H(f(n)("Search.input.selectTime"))+": ",3),I("span",{class:S(w.$style["SearchMessageAdvanced__filter-value"])},H(h()),3),I("span",{class:S([w.$style.SearchMessageAdvanced__arrow,{[w.$style["SearchMessageAdvanced__arrow--up"]]:o.value}])}," ▼ ",2)],2),I("div",{class:S(w.$style["SearchMessageAdvanced__quick-options"])},[(_(),O(ie,null,we(i,y=>V(f(Tt),{key:y.value,type:"text",class:S([w.$style["SearchMessageAdvanced__quick-option"],{[w.$style["SearchMessageAdvanced__quick-option--active"]]:s.value===y.value}]),onClick:P=>b(y.value)},{default:j(()=>[ge(H(y.label),1)]),_:2},1032,["class","onClick"])),64))],2),o.value?(_(),O("div",{key:0,class:S(w.$style["SearchMessageAdvanced__date-picker-dropdown"])},[V(f(fR),{value:r.value,onChange:v},null,8,["value"])],2)):Y("",!0)],2)],2))}}),gR="_SearchMessageAdvanced_pcwzj_1",vR="_SearchMessageAdvanced__arrow_pcwzj_35",yR={SearchMessageAdvanced:gR,"SearchMessageAdvanced__filter-row":"_SearchMessageAdvanced__filter-row_pcwzj_8","SearchMessageAdvanced__filter-select":"_SearchMessageAdvanced__filter-select_pcwzj_15","SearchMessageAdvanced__filter-label":"_SearchMessageAdvanced__filter-label_pcwzj_24","SearchMessageAdvanced__filter-value":"_SearchMessageAdvanced__filter-value_pcwzj_29",SearchMessageAdvanced__arrow:vR,"SearchMessageAdvanced__arrow--up":"_SearchMessageAdvanced__arrow--up_pcwzj_41","SearchMessageAdvanced__quick-options":"_SearchMessageAdvanced__quick-options_pcwzj_45","SearchMessageAdvanced__quick-option":"_SearchMessageAdvanced__quick-option_pcwzj_45","SearchMessageAdvanced__quick-option--active":"_SearchMessageAdvanced__quick-option--active_pcwzj_68","SearchMessageAdvanced__date-picker-dropdown":"_SearchMessageAdvanced__date-picker-dropdown_pcwzj_73"},_R={$style:yR},bR=Z(mR,[["__cssModules",_R]]),wR=z({__name:"Slider",props:{value:{},min:{default:0},max:{default:99},onChange:{}},setup(t){const e=t,n=A(),o=(i,l,c)=>Math.max(l,Math.min(c,i)),r=i=>(i-e.min)/(e.max-e.min)*100,a=(i,l)=>{var c;const u="touches"in i?i.touches[0].clientX:i.clientX,d=n.value;if(!d)return;const p=d.getBoundingClientRect(),h=o((u-p.left)/p.width,0,1),m=Math.round(h*(e.max-e.min)+e.min);let g=e.value;l==="min"?g=[o(m,e.min,e.value[1]),e.value[1]]:g=[e.value[0],o(m,e.value[0],e.max)],(c=e.onChange)==null||c.call(e,g)},s=(i,l)=>{a(l,i);const c=d=>a(d,i),u=()=>{window.removeEventListener("mousemove",c),window.removeEventListener("touchmove",c),window.removeEventListener("mouseup",u),window.removeEventListener("touchend",u)};window.addEventListener("mousemove",c),window.addEventListener("touchmove",c),window.addEventListener("mouseup",u),window.addEventListener("touchend",u)};return(i,l)=>(_(),O("div",{class:S(i.$style.SearchSlider)},[I("div",{class:S(i.$style.SearchSlider__rail),ref_key:"trackRef",ref:n},[I("div",{class:S(i.$style.SearchSlider__track),style:De({left:`${r(t.value[0])}%`,width:`${r(t.value[1])-r(t.value[0])}%`})},null,6),I("div",{class:S(i.$style.SearchSlider__thumb),style:De({left:`${r(t.value[0])}%`}),onMousedown:l[0]||(l[0]=c=>s("min",c)),onTouchstart:l[1]||(l[1]=c=>s("min",c))},null,38),I("div",{class:S(i.$style.SearchSlider__thumb),style:De({left:`${r(t.value[1])}%`}),onMousedown:l[2]||(l[2]=c=>s("max",c)),onTouchstart:l[3]||(l[3]=c=>s("max",c))},null,38)],2)],2))}}),SR="_SearchSlider_1at06_1",kR="_SearchSlider__rail_1at06_5",ER="_SearchSlider__track_1at06_13",CR="_SearchSlider__thumb_1at06_21",MR={SearchSlider:SR,SearchSlider__rail:kR,SearchSlider__track:ER,SearchSlider__thumb:CR},$R={$style:MR},TR=Z(wR,[["__cssModules",$R]]),IR=["onClick"],AR=["value"],xR=["value"],OR=["onClick"],RR=z({__name:"UserAdvanced",props:{advancedParams:{},onAdvancedParamsChange:{type:Function}},setup(t){const e=t,{t:n}=ve(),o=$=>{const D=new Date,G=new Date(Math.floor($/1e4),Math.floor($%1e4/100)-1,$%100);let k=D.getFullYear()-G.getFullYear();const N=D.getMonth()-G.getMonth();return(N<0||N===0&&D.getDate()<G.getDate())&&(k-=1),k},r=$=>{if(!$)return;const D=new Date;return(D.getFullYear()-$)*1e4+(D.getMonth()+1)*100+D.getDate()},a=A({}),s=A(!1),i=A(!1),l=A(!1),c=A({min:void 0,max:void 0}),u=A("不限"),d=A(),p=A(),h=[{value:"不限",label:n("Search.filter.gender.any")},{value:oe.TYPES.GENDER_MALE,label:n("Search.filter.gender.male")},{value:oe.TYPES.GENDER_FEMALE,label:n("Search.filter.gender.female")}],m=$=>{d.value&&!d.value.contains($.target)&&(s.value=!1),p.value&&!p.value.contains($.target)&&(i.value=!1)};qe(()=>{document.addEventListener("mousedown",m)}),st(()=>{document.removeEventListener("mousedown",m)}),ce(()=>e.advancedParams,$=>{const D=($==null?void 0:$.get(Q.USER))||{};a.value={...a.value,...D},u.value=(D==null?void 0:D.gender)||"不限",c.value={min:D!=null&&D.maxBirthday?o(D==null?void 0:D.maxBirthday):void 0,max:D!=null&&D.miniBirthday?o(D==null?void 0:D.miniBirthday):void 0}},{immediate:!0});const g=$=>{if(e.onAdvancedParamsChange){const D=new Map(e.advancedParams||[]);D.set(Q.USER,{...a.value,gender:$==="不限"?void 0:$}),e.onAdvancedParamsChange(D)}s.value=!1},v=$=>{if(e.onAdvancedParamsChange){const D=new Map(e.advancedParams||[]);D.set(Q.USER,{...a.value,miniBirthday:r($.max),maxBirthday:r($.min)}),e.onAdvancedParamsChange(D)}i.value=!1},b=($,D)=>{if(D==="")c.value={...c.value,[$]:void 0};else{const G=Math.max(0,Math.min(99,parseInt(D,10)||0));c.value={...c.value,[$]:G}}},w=()=>{l.value=!l.value},E=()=>{const{min:$,max:D}=c.value;v({min:$,max:D})},y=()=>{var $,D,G;w();const k=(($=a.value)==null?void 0:$.gender)===u.value,N=((D=a.value)==null?void 0:D.miniBirthday)===r(c.value.max),F=((G=a.value)==null?void 0:G.maxBirthday)===r(c.value.min);if(!(k&&N&&F)&&e.onAdvancedParamsChange){const K=new Map(e.advancedParams||[]);K.set(Q.USER,{...a.value,gender:u.value==="不限"?void 0:u.value,miniBirthday:c.value.max!==99?r(c.value.max):void 0,maxBirthday:c.value.min!==0?r(c.value.min):void 0}),e.onAdvancedParamsChange(K)}},P=$=>{u.value=$,s.value=!1},C=$=>{s.value=$,$&&(i.value=!1)},T=$=>{i.value=$,$&&(s.value=!1)},M=$=>{c.value=$},x=B(()=>{var $;return($=a.value)!=null&&$.maxBirthday?o(a.value.maxBirthday):void 0}),L=B(()=>{var $;return($=a.value)!=null&&$.miniBirthday?o(a.value.miniBirthday):void 0}),q=$=>{switch($){case oe.TYPES.GENDER_MALE:return n("Search.filter.gender.male");case oe.TYPES.GENDER_FEMALE:return n("Search.filter.gender.female");default:return n("Search.filter.gender.any")}};return($,D)=>{var G;return _(),O("div",{class:S($.$style.SearchUserAdvanced)},[I("div",{class:S($.$style["SearchUserAdvanced__filter-row"])},[I("div",{class:S($.$style["SearchUserAdvanced__filter-select"]),onClick:D[0]||(D[0]=k=>f(Oe)?w():C(!s.value))},[I("span",{class:S($.$style["SearchUserAdvanced__filter-label"])},H(f(n)("Search.filter.gender"))+": ",3),I("span",{class:S($.$style["SearchUserAdvanced__filter-value"])},H(q(((G=a.value)==null?void 0:G.gender)||f(n)("Search.filter.gender.any"))),3),I("span",{class:S([$.$style.SearchUserAdvanced__arrow,{[$.$style["SearchUserAdvanced__arrow--up"]]:s.value}])}," ▼ ",2)],2),!f(Oe)&&s.value?(_(),O("div",{key:0,ref_key:"genderRef",ref:d,class:S($.$style.SearchUserAdvanced__dropdown)},[(_(),O(ie,null,we(h,k=>I("div",{key:k.value,class:S($.$style.SearchUserAdvanced__option),onClick:N=>g(k.value)},H(k.label),11,IR)),64))],2)):Y("",!0)],2),I("div",{ref_key:"ageRef",ref:p,class:S($.$style["SearchUserAdvanced__filter-row"])},[I("div",{class:S($.$style["SearchUserAdvanced__filter-select"]),onClick:D[1]||(D[1]=k=>f(Oe)?w():T(!i.value))},[I("span",{class:S($.$style["SearchUserAdvanced__filter-label"])},H(f(n)("Search.filter.age"))+": ",3),I("span",{class:S($.$style["SearchUserAdvanced__filter-value"])},H(`${x.value||"0"}-${L.value||"99"} ${f(n)("Search.filter.age.yearsOld")}`),3),f(Oe)?Y("",!0):(_(),O("span",{key:0,class:S([$.$style.SearchUserAdvanced__arrow,{[$.$style["SearchUserAdvanced__arrow--up"]]:i.value}])}," ▼ ",2))],2),!f(Oe)&&i.value?(_(),O("div",{key:0,class:S($.$style.SearchUserAdvanced__dropdown)},[I("div",{class:S($.$style["SearchUserAdvanced__age-inputs"])},[I("input",{type:"number",min:"0",max:"99",value:c.value.min??"",placeholder:"0",class:S($.$style["SearchUserAdvanced__age-input"]),onInput:D[2]||(D[2]=k=>b("min",k.target.value))},null,42,AR),D[7]||(D[7]=I("span",null,"-",-1)),I("input",{type:"number",min:"0",max:"99",value:c.value.max??"",placeholder:"99",class:S($.$style["SearchUserAdvanced__age-input"]),onInput:D[3]||(D[3]=k=>b("max",k.target.value))},null,42,xR),I("span",null,H(f(n)("Search.filter.age.yearsOld")),1),V(f(Tt),{class:S($.$style["SearchUserAdvanced__confirm-button"]),onClick:E},{default:j(()=>[ge(H(f(n)("Search.action.confirm")),1)]),_:1},8,["class"])],2)],2)):Y("",!0)],2),f(Oe)?(_(),O("div",{key:0,class:S($.$style["SearchUserAdvanced__filter-row-right"]),onClick:w},[V(f($y),{class:S($.$style["SearchUserAdvanced__filter-icon"])},null,8,["class"]),I("span",{class:S($.$style["SearchUserAdvanced__filter-text"])},H(f(n)("Search.filter.title")),3)],2)):Y("",!0),l.value?(_(),O("div",{key:1,class:S($.$style["SearchUserAdvanced__filter-page"])},[I("div",{class:S($.$style["SearchUserAdvanced__filter-page-header"])},[I("div",{class:S($.$style["SearchUserAdvanced__back-button"]),onClick:w},[V(f(Gc),{size:"24"})],2),I("div",{class:S($.$style["SearchUserAdvanced__header-title"])},H(f(n)("Search.filter.title")),3)],2),I("div",{class:S($.$style["SearchUserAdvanced__filter-page-main"])},[I("div",{class:S([$.$style["SearchUserAdvanced__filter-page-row"],$.$style["SearchUserAdvanced__bottom-line"]]),onClick:D[4]||(D[4]=k=>C(!0))},[I("span",{class:S($.$style["SearchUserAdvanced__filter-page-label"])},H(f(n)("Search.filter.gender")),3),I("div",{class:S($.$style["SearchUserAdvanced__filter-page-value"])},[I("span",null,H(q(u.value)),1),I("span",{class:S($.$style.SearchUserAdvanced__arrow)},">",2)],2)],2),s.value?(_(),O("div",{key:0,class:S($.$style["SearchUserAdvanced__action-sheet-mask"])},[I("div",{ref_key:"genderRef",ref:d,class:S($.$style["SearchUserAdvanced__action-sheet-panel"])},[(_(),O(ie,null,we(h,k=>I("div",{key:k.value,class:S($.$style["SearchUserAdvanced__action-sheet-option"]),onClick:N=>P(k.value)},H(k.label),11,OR)),64)),I("div",{class:S($.$style["SearchUserAdvanced__action-sheet-cancel"]),onClick:D[5]||(D[5]=k=>C(!1))},H(f(n)("Search.action.cancel")),3)],2)],2)):Y("",!0),I("div",{class:S($.$style["SearchUserAdvanced__filter-page-row"])},[I("span",{class:S($.$style["SearchUserAdvanced__filter-page-label"])},H(f(n)("Search.filter.age")),3),I("div",{class:S($.$style["SearchUserAdvanced__filter-page-value"])},[I("span",null,H(`${c.value.min??0}-${c.value.max??99}`),1)],2)],2),V(f(TR),{value:[c.value.min??0,c.value.max??99],min:0,max:99,onChange:D[6]||(D[6]=k=>M({min:k[0],max:k[1]}))},null,8,["value"])],2),I("div",{class:S($.$style["SearchUserAdvanced__filter-page-footer"])},[V(f(Tt),{class:S($.$style["SearchUserAdvanced__filter-confirm-button"]),onClick:y},{default:j(()=>[ge(H(f(n)("Search.action.confirm")),1)]),_:1},8,["class"])],2)],2)):Y("",!0)],2)}}}),PR="_SearchUserAdvanced_1c2w8_1",DR="_SearchUserAdvanced__arrow_1c2w8_32",NR="_SearchUserAdvanced__dropdown_1c2w8_42",LR="_SearchUserAdvanced__option_1c2w8_54",UR={SearchUserAdvanced:PR,"SearchUserAdvanced__filter-row":"_SearchUserAdvanced__filter-row_1c2w8_8","SearchUserAdvanced__filter-select":"_SearchUserAdvanced__filter-select_1c2w8_12","SearchUserAdvanced__filter-label":"_SearchUserAdvanced__filter-label_1c2w8_21","SearchUserAdvanced__filter-value":"_SearchUserAdvanced__filter-value_1c2w8_26",SearchUserAdvanced__arrow:DR,"SearchUserAdvanced__arrow--up":"_SearchUserAdvanced__arrow--up_1c2w8_38",SearchUserAdvanced__dropdown:NR,SearchUserAdvanced__option:LR,"SearchUserAdvanced__age-inputs":"_SearchUserAdvanced__age-inputs_1c2w8_67","SearchUserAdvanced__age-input":"_SearchUserAdvanced__age-input_1c2w8_67","SearchUserAdvanced__confirm-button":"_SearchUserAdvanced__confirm-button_1c2w8_108","SearchUserAdvanced__action-sheet-mask":"_SearchUserAdvanced__action-sheet-mask_1c2w8_127","SearchUserAdvanced__action-sheet-panel":"_SearchUserAdvanced__action-sheet-panel_1c2w8_140","SearchUserAdvanced-slideUp":"_SearchUserAdvanced-slideUp_1c2w8_1","SearchUserAdvanced__action-sheet-option":"_SearchUserAdvanced__action-sheet-option_1c2w8_157","SearchUserAdvanced__action-sheet-cancel":"_SearchUserAdvanced__action-sheet-cancel_1c2w8_171","SearchUserAdvanced__action-sheet-confirm":"_SearchUserAdvanced__action-sheet-confirm_1c2w8_180","SearchUserAdvanced__filter-row-right":"_SearchUserAdvanced__filter-row-right_1c2w8_189","SearchUserAdvanced__filter-icon":"_SearchUserAdvanced__filter-icon_1c2w8_196","SearchUserAdvanced__filter-text":"_SearchUserAdvanced__filter-text_1c2w8_200","SearchUserAdvanced__age-inputs-sheet":"_SearchUserAdvanced__age-inputs-sheet_1c2w8_205","SearchUserAdvanced__filter-page":"_SearchUserAdvanced__filter-page_1c2w8_213","SearchUserAdvanced__filter-page-header":"_SearchUserAdvanced__filter-page-header_1c2w8_226","SearchUserAdvanced__back-button":"_SearchUserAdvanced__back-button_1c2w8_233","SearchUserAdvanced__header-title":"_SearchUserAdvanced__header-title_1c2w8_240","SearchUserAdvanced__filter-page-main":"_SearchUserAdvanced__filter-page-main_1c2w8_249","SearchUserAdvanced__bottom-line":"_SearchUserAdvanced__bottom-line_1c2w8_258","SearchUserAdvanced__filter-page-row":"_SearchUserAdvanced__filter-page-row_1c2w8_262","SearchUserAdvanced__filter-page-label":"_SearchUserAdvanced__filter-page-label_1c2w8_270","SearchUserAdvanced__filter-page-value":"_SearchUserAdvanced__filter-page-value_1c2w8_275","SearchUserAdvanced__filter-page-footer":"_SearchUserAdvanced__filter-page-footer_1c2w8_283","SearchUserAdvanced__filter-confirm-button":"_SearchUserAdvanced__filter-confirm-button_1c2w8_288"},BR={$style:UR},FR=Z(RR,[["__cssModules",BR]]),jR=z({__name:"SearchAdvanced",props:{variant:{default:de.STANDARD},searchType:{default:"all"},advancedParams:{},onAdvancedParamsChange:{}},setup(t){const e=t,{setSelectedType:n}=od(e.variant),o=s=>{n(s)},r=s=>{const i=s.get(Q.MESSAGE);i&&e.onAdvancedParamsChange(Q.MESSAGE,i)},a=s=>{const i=s.get(Q.USER);i&&e.onAdvancedParamsChange(Q.USER,i)};return(s,i)=>(_(),O("div",{class:S(s.$style.SearchAdvanced)},[t.variant===f(de).STANDARD?(_(),U(f(QO),{key:0,"active-tab":t.searchType,onTabChange:o},null,8,["active-tab"])):Y("",!0),t.variant===f(de).STANDARD&&t.searchType===f(Q).MESSAGE?(_(),U(f(bR),{key:1,variant:t.variant,"advanced-params":t.advancedParams,onAdvancedParamsChange:r},null,8,["variant","advanced-params"])):Y("",!0),t.variant===f(de).STANDARD&&t.searchType===f(Q).USER?(_(),U(f(FR),{key:2,variant:t.variant,"advanced-params":t.advancedParams,onAdvancedParamsChange:a},null,8,["variant","advanced-params"])):Y("",!0)],2))}}),GR="_SearchAdvanced_ubuea_1",qR={SearchAdvanced:GR,"SearchAdvanced__mode-toggle":"_SearchAdvanced__mode-toggle_ubuea_5","SearchAdvanced__mode-toggle-icon":"_SearchAdvanced__mode-toggle-icon_ubuea_17","SearchAdvanced__mode-toggle-desc":"_SearchAdvanced__mode-toggle-desc_ubuea_27","SearchAdvanced__date-picker-dropdown":"_SearchAdvanced__date-picker-dropdown_ubuea_41"},HR={$style:qR},VR=Z(jR,[["__cssModules",HR]]),zR={key:1},WR=z({__name:"SearchBar",props:{value:{default:""},onChange:{},onKeyDown:{},onClear:{},placeholder:{},SearchIcon:{},ClearIcon:{},className:{default:""},style:{default:()=>({})},onFocus:{},onBlur:{},autoFocus:{type:Boolean,default:!1},variant:{default:de.STANDARD}},setup(t){const e=t,n=A(e.value);ce(()=>e.value,d=>{n.value=d||""});const{t:o}=ve(),r=B(()=>e.variant!==de.MINI&&e.variant!==de.EXACT&&Oe),a={[de.EXACT]:o("Search.action.search"),[de.STANDARD]:o("Search.action.search"),[de.MINI]:o("Search.action.search"),[de.EMBEDDED]:o("Search.results.title")},s=d=>{var p;const h={target:{value:String(d)}};(p=e.onChange)==null||p.call(e,h)},i=d=>{var p;(p=e.onFocus)==null||p.call(e,d)},l=d=>{var p;(p=e.onBlur)==null||p.call(e,d)},c=d=>{var p;if(d){const h=new KeyboardEvent("keydown",{key:"Enter"});(p=e.onKeyDown)==null||p.call(e,h)}},u=()=>{var d;n.value="",(d=e.onClear)==null||d.call(e)};return(d,p)=>(_(),O("div",{class:S([d.$style.SearchBar,r.value&&d.$style["SearchBar--h5"],t.className]),style:De(t.style)},[r.value?(_(),O("div",{key:0,class:S(d.$style.SearchBar__left),onClick:u},[V(f(Gc),{size:24})],2)):Y("",!0),V(f(Wl),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=h=>n.value=h),placeholder:t.placeholder||a[t.variant||f(de).STANDARD],onInput:s,onFocus:i,onBlur:l,onDone:c},{prefix:j(()=>[t.SearchIcon?(_(),U(se(t.SearchIcon),{key:0})):(_(),U(f(jh),{key:1}))]),suffix:j(()=>[!r.value&&n.value?(_(),O("div",{key:0,class:S(d.$style.SearchBar__actions)},[I("div",{class:S(d.$style["SearchBar__clear-icon"]),onClick:u},[t.ClearIcon?(_(),U(se(t.ClearIcon),{key:0})):(_(),U(f(Ty),{key:1,class:"clearIcon"}))],2)],2)):Y("",!0)]),_:1},8,["modelValue","placeholder"]),r.value?(_(),O("div",{key:1,class:S(d.$style.SearchBar__right),onClick:u},[t.ClearIcon?(_(),U(se(t.ClearIcon),{key:0})):(_(),O("span",zR,H(f(o)("Search.action.cancel")),1))],2)):Y("",!0)],6))}}),KR="_SearchBar_1jsx0_1",YR="_SearchBar__left_1jsx0_7",JR="_SearchBar__right_1jsx0_10",XR="_SearchBar__icon_1jsx0_14",QR="_SearchBar__input_1jsx0_19",ZR="_clearIcon_1jsx0_78",eP="_SearchBar__button_1jsx0_88",tP="_SearchBar__actions_1jsx0_92",nP={SearchBar:KR,SearchBar__left:YR,SearchBar__right:JR,SearchBar__icon:XR,SearchBar__input:QR,"tui-input":"_tui-input_1jsx0_22","tui-input__native-input":"_tui-input__native-input_1jsx0_25","tui-input__prefix-icon":"_tui-input__prefix-icon_1jsx0_42","tui-input__clear-icon":"_tui-input__clear-icon_1jsx0_53","SearchBar__clear-icon":"_SearchBar__clear-icon_1jsx0_71",clearIcon:ZR,"SearchBar__clear-icon--default":"_SearchBar__clear-icon--default_1jsx0_84",SearchBar__button:eP,SearchBar__actions:tP,"SearchBar--h5":"_SearchBar--h5_1jsx0_97"},oP={$style:nP},Rv=Z(WR,[["__cssModules",oP]]);function rP(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sh(t){return!t||typeof t!="string"?String(t||""):t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const Sn=(t,e,n="highlight")=>{const o=Sh(t),r=Sh(e);if(!t||typeof t!="string"||!r||typeof r!="string")return o;const a=r.trim();if(!a)return o;try{const s=new RegExp(`(${rP(a)})`,"gi"),i=o.split(s);return i.length===1?o:i.map((l,c)=>l.toLowerCase()===a.toLowerCase()?`<span key="${c}" class="${n}">${l}</span>`:l).join("")}catch(s){return console.warn("Error highlighting text:",s),o}},aP=["innerHTML"],sP=["innerHTML"],iP=z({__name:"Conversation",props:{keyword:{},data:{},type:{},className:{},style:{},onClick:{type:Function}},setup(t){const e=t,{t:n}=ve(),o=B(()=>e.data.conversation),r=B(()=>e.data.messageCount),a=B(()=>e.data.messageList),s=B(()=>{var d;return(d=o.value)==null?void 0:d.type}),i=B(()=>{var d,p,h,m;return s.value===oe.TYPES.CONV_C2C?(p=(d=o.value)==null?void 0:d.userProfile)==null?void 0:p.avatar:(m=(h=o.value)==null?void 0:h.groupProfile)==null?void 0:m.avatar}),l=B(()=>{var d,p,h,m,g,v,b,w;return s.value===oe.TYPES.CONV_C2C?((p=(d=o.value)==null?void 0:d.userProfile)==null?void 0:p.nick)||((m=(h=o.value)==null?void 0:h.userProfile)==null?void 0:m.userID):((v=(g=o.value)==null?void 0:g.groupProfile)==null?void 0:v.name)||((w=(b=o.value)==null?void 0:b.groupProfile)==null?void 0:w.groupID)}),c=B(()=>{var d,p,h;return((h=(p=(d=a.value)==null?void 0:d[0])==null?void 0:p.payload)==null?void 0:h.text)||n("Search.results.foundMessages",{count:r.value})}),u=()=>{var d;(d=e.onClick)==null||d.call(e,e.data,Q.MESSAGE)};return(d,p)=>(_(),O("div",{class:S(d.$style.conversationItem),onClick:u},[I("div",{class:S(d.$style.avatarWrapper)},[V(f(ft),{src:i.value,alt:l.value},null,8,["src","alt"])],2),I("div",{class:S(d.$style.conversationContent)},[I("div",{class:S(d.$style.conversationHeader)},[I("span",{class:S(d.$style.name),innerHTML:f(Sn)(l.value,t.keyword,d.$style.highlight)},null,10,aP)],2),I("div",{class:S(d.$style.showText),innerHTML:f(Sn)(c.value,t.keyword,d.$style.highlight)},null,10,sP)],2)],2))}}),lP="_conversationItem_1211h_12",cP="_avatarWrapper_1211h_19",uP="_conversationContent_1211h_23",dP="_conversationHeader_1211h_29",pP="_name_1211h_36",hP="_showText_1211h_46",fP={conversationItem:lP,avatarWrapper:cP,conversationContent:uP,conversationHeader:dP,name:pP,showText:hP},mP={$style:fP},gP=Z(iP,[["__cssModules",mP]]),vP=["innerHTML"],yP=["innerHTML"],_P=z({__name:"User",props:{keyword:{},data:{},type:{},className:{},style:{},onClick:{type:Function}},setup(t){const{t:e}=ve(),n=i=>{const l=new Date,c=new Date(i);let u=l.getFullYear()-c.getFullYear();const d=l.getMonth()-c.getMonth();return(d<0||d===0&&l.getDate()<c.getDate())&&(u=u-1),u},o=t,r=B(()=>o.data.profile),a=i=>{switch(i){case oe.TYPES.GENDER_MALE:return e("Search.filter.gender.male");case oe.TYPES.GENDER_FEMALE:return e("Search.filter.gender.female");default:return e("Search.filter.gender.secret")}},s=()=>{var i;(i=o.onClick)==null||i.call(o,o.data,Q.USER)};return(i,l)=>{var c,u,d,p,h,m,g,v,b,w;return _(),O("div",{class:S(i.$style.SearchUser),onClick:s},[I("div",{class:S(i.$style.SearchUser__avatar)},[V(f(ft),{src:(c=r.value)==null?void 0:c.avatar,alt:((u=r.value)==null?void 0:u.nick)||((d=r.value)==null?void 0:d.userID)},null,8,["src","alt"])],2),I("div",{class:S(i.$style.SearchUser__profile)},[I("div",{class:S(i.$style.SearchUser__nickname),innerHTML:f(Sn)(((p=r.value)==null?void 0:p.nick)||((h=r.value)==null?void 0:h.userID),t.keyword,i.$style.SearchUser__highlight)},null,10,vP),(m=r.value)!=null&&m.selfSignature?(_(),O("div",{key:0,class:S(i.$style.SearchUser__signature),innerHTML:f(Sn)((g=r.value)==null?void 0:g.selfSignature,t.keyword,i.$style.SearchUser__highlight)},null,10,yP)):(_(),O("div",{key:1,class:S(i.$style.SearchUser__signature)},H(a((v=r.value)==null?void 0:v.gender))+" "+H(((b=r.value)==null?void 0:b.birthday)&&`${n((w=r.value)==null?void 0:w.birthday)}${f(e)("Search.filter.age.yearsOld")}`),3))],2)],2)}}}),bP="_SearchUser_15dti_12",wP="_SearchUser__avatar_15dti_19",SP="_SearchUser__profile_15dti_27",kP="_SearchUser__nickname_15dti_33",EP="_SearchUser__signature_15dti_44",CP={SearchUser:bP,SearchUser__avatar:wP,SearchUser__profile:SP,SearchUser__nickname:kP,SearchUser__signature:EP},MP={$style:CP},$P=Z(_P,[["__cssModules",MP]]),TP=["innerHTML"],IP=["innerHTML"],AP=z({__name:"Group",props:{keyword:{},data:{},type:{},className:{},style:{},onClick:{type:Function}},setup(t){const e=t,n=B(()=>e.data.groupInfo),o=()=>{var r;(r=e.onClick)==null||r.call(e,e.data,Q.GROUP)};return(r,a)=>{var s,i,l,c;return _(),O("div",{class:S(r.$style.SearchGroup),onClick:o},[I("div",{class:S(r.$style.SearchGroup__avatar)},[V(f(ft),{src:n.value.avatar,alt:((s=n.value)==null?void 0:s.name)||((i=n.value)==null?void 0:i.groupID)},null,8,["src","alt"])],2),I("div",{class:S(r.$style.SearchGroup__info)},[I("div",{class:S(r.$style.SearchGroup__name),innerHTML:f(Sn)(((l=n.value)==null?void 0:l.name)||((c=n.value)==null?void 0:c.groupID),t.keyword,r.$style.SearchGroup__highlight)},null,10,TP),n.value?(_(),O("div",{key:0,class:S(r.$style.SearchGroup__intro),innerHTML:f(Sn)(n.value.introduction,t.keyword,r.$style.SearchGroup__highlight)},null,10,IP)):Y("",!0)],2)],2)}}}),xP="_SearchGroup_1672l_12",OP="_SearchGroup__avatar_1672l_19",RP="_SearchGroup__info_1672l_27",PP="_SearchGroup__name_1672l_33",DP="_SearchGroup__intro_1672l_45",NP={SearchGroup:xP,SearchGroup__avatar:OP,SearchGroup__info:RP,SearchGroup__name:PP,SearchGroup__intro:DP},LP={$style:NP},UP=Z(AP,[["__cssModules",LP]]),BP=["innerHTML"],FP=z({__name:"Message",props:{keyword:{},data:{},type:{},className:{},style:{},onClick:{type:Function}},setup(t){const e=qt(),n=g=>new Date(g*1e3).toLocaleString(),o=t,{t:r}=ve(),{nick:a,avatar:s,nameCard:i,from:l,time:c}=o.data,u=B(()=>i||a||l),d=B(()=>o.keyword?Sn(u.value,o.keyword,e.SearchMessage__highlight):u.value),p=(g,v)=>g.text&&Array.isArray(g.text)?g.text.map((b,w)=>b.name==="text"?he("span",{key:w,innerHTML:Sn(b.text,v,e.SearchMessage__highlight)}):b.name==="img"?he("img",{key:w,src:b.src,alt:b.emojiKey||"",class:e["SearchMessage__emoji-img"],draggable:!1,"data-emoji-key":b.emojiKey||""}):null).filter(Boolean):he("span",{innerHTML:Sn(g.text,v,e.SearchMessage__highlight)}),h=(g,v)=>{var b;const w=((b=g.getMessageContent)==null?void 0:b.call(g))||{};switch(g.type){case oe.TYPES.MSG_TEXT:return he("div",{class:e.SearchMessage__text},p(w,v));case oe.TYPES.MSG_IMAGE:return he("img",{src:w.url,class:e["SearchMessage__image-thumb"],alt:r("Search.messageType.image")});case oe.TYPES.MSG_VIDEO:return he("div",{class:e["SearchMessage__video-thumb"]},[he("img",{src:w.snapshotUrl,alt:r("Search.messageType.videoCover")}),he("span",{class:e["SearchMessage__play-icon"]},[he("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[he("circle",{cx:"12",cy:"12",r:"12",fill:"rgba(43,93,245,0.15)"}),he("polygon",{points:"9,7 18,12 9,17",fill:"#2B5DF5"})])])]);case oe.TYPES.MSG_FILE:return he("div",{class:e["SearchMessage__file-box"]},[he("span",{class:e.SearchMessage__text},w.name),he("span",{class:e.SearchMessage__text},w.size)]);case oe.TYPES.MSG_AUDIO:return he("div",{class:e["SearchMessage__audio-box"]},[he("span",{class:e["SearchMessage__audio-icon"]},[he("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[he("rect",{x:"3",y:"7",width:"4",height:"6",rx:"1",fill:"#2B5DF5"}),he("rect",{x:"8",y:"5",width:"4",height:"10",rx:"1",fill:"#2B5DF5",fillOpacity:"0.7"}),he("rect",{x:"13",y:"9",width:"4",height:"2",rx:"1",fill:"#2B5DF5",fillOpacity:"0.4"})])]),he("span",`${w.second}s`)]);case oe.TYPES.MSG_LOCATION:return w.businessID==="text_link"?he("span",{class:e.SearchMessage__text},[w.text,he("a",{href:w.link,target:"_blank",rel:"noopener noreferrer"},`${r("Search.action.readMore")}>>>`)]):he("span",r("Search.messageType.custom"));default:return he("span",r("Search.messageType.unsupported"))}},m=()=>{var g;(g=o.onClick)==null||g.call(o,o.data,Q.CHAT_MESSAGE)};return(g,v)=>(_(),O("div",{class:S(f(e).SearchMessage)},[I("div",{class:S(f(e)["SearchMessage__avatar-wrapper"])},[V(f(ft),{src:f(s),alt:u.value},null,8,["src","alt"])],2),I("div",{class:S(f(e).SearchMessage__content)},[I("div",{class:S(f(e).SearchMessage__header)},[I("span",{class:S(f(e).SearchMessage__name),innerHTML:d.value},null,10,BP),f(c)?(_(),O("span",{key:0,class:S(f(e).SearchMessage__time)},H(n(f(c))),3)):Y("",!0)],2),I("div",{class:S(f(e).SearchMessage__container)},[I("div",{class:S(f(e)["SearchMessage__container-content"])},[(_(),U(se(h(t.data,t.keyword))))],2),I("div",{class:S(f(e)["SearchMessage__container-action"]),onClick:m},H(f(r)("Search.action.locateToChat")),3)],2)],2)],2))}}),jP="_SearchMessage_r84bo_12",GP="_SearchMessage__avatar_r84bo_19",qP="_SearchMessage__content_r84bo_30",HP="_SearchMessage__header_r84bo_36",VP="_SearchMessage__name_r84bo_43",zP="_SearchMessage__time_r84bo_53",WP="_SearchMessage__container_r84bo_62",KP="_SearchMessage__text_r84bo_91",YP={SearchMessage:jP,"SearchMessage__avatar-wrapper":"_SearchMessage__avatar-wrapper_r84bo_19",SearchMessage__avatar:GP,SearchMessage__content:qP,SearchMessage__header:HP,SearchMessage__name:VP,SearchMessage__time:zP,SearchMessage__container:WP,"SearchMessage__container-action":"_SearchMessage__container-action_r84bo_67","SearchMessage__container-content":"_SearchMessage__container-content_r84bo_71",SearchMessage__text:KP,"SearchMessage__emoji-img":"_SearchMessage__emoji-img_r84bo_103","SearchMessage__image-thumb":"_SearchMessage__image-thumb_r84bo_110","SearchMessage__video-thumb":"_SearchMessage__video-thumb_r84bo_118","SearchMessage__play-icon":"_SearchMessage__play-icon_r84bo_133","SearchMessage__face-img":"_SearchMessage__face-img_r84bo_142","SearchMessage__file-box":"_SearchMessage__file-box_r84bo_148","SearchMessage__audio-box":"_SearchMessage__audio-box_r84bo_155","SearchMessage__audio-icon":"_SearchMessage__audio-icon_r84bo_162"},JP={$style:YP},XP=Z(FP,[["__cssModules",JP]]),QP=z({__name:"SearchResultsItem",props:{keyword:{},onClick:{},data:{},type:{},className:{default:""}},setup(t){return(e,n)=>(_(),O("div",{class:S([e.$style.SearchResultsItem,t.className])},[t.type===f(Q).MESSAGE?(_(),U(se(f(gP)),{key:0,data:t.data,keyword:t.keyword,onClick:t.onClick},null,8,["data","keyword","onClick"])):t.type===f(Q).USER?(_(),U(se(f($P)),{key:1,data:t.data,keyword:t.keyword,onClick:t.onClick},null,8,["data","keyword","onClick"])):t.type===f(Q).GROUP?(_(),U(se(f(UP)),{key:2,data:t.data,keyword:t.keyword,onClick:t.onClick},null,8,["data","keyword","onClick"])):t.type===f(Q).CHAT_MESSAGE?(_(),U(se(f(XP)),{key:3,data:t.data,keyword:t.keyword,onClick:t.onClick},null,8,["data","keyword","onClick"])):Y("",!0)],2))}}),ZP="_SearchResultsItem_1vvfd_1",eD={SearchResultsItem:ZP},tD={$style:eD},nD=Z(QP,[["__cssModules",tD]]),oD=z({__name:"EmptyResult",props:{text:{default:""}},setup(t){const e=t,{t:n}=ve(),o=B(()=>e.text||n("Search.status.noContent"));return(r,a)=>(_(),O("div",{class:S(r.$style.SearchEmpty)},[V(f(Iy),{size:"88px"}),I("div",{class:S(r.$style.SearchEmpty__text)},[I("p",{class:S(r.$style.SearchEmpty__title)},H(o.value),3)],2)],2))}}),rD="_SearchEmpty_jaw56_1",aD="_SearchEmpty__icon_jaw56_11",sD="_SearchEmpty__text_jaw56_17",iD="_SearchEmpty__title_jaw56_21",lD={SearchEmpty:rD,SearchEmpty__icon:aD,SearchEmpty__text:sD,SearchEmpty__title:iD},cD={$style:lD},uD=Z(oD,[["__cssModules",cD]]),dD=z({__name:"Loading",props:{text:{}},setup(t){return(e,n)=>(_(),O("div",{class:S(e.$style.SearchLoading)},H(t.text),3))}}),pD="_SearchLoading_1od6j_1",hD={SearchLoading:pD,"SearchLoading-spin":"_SearchLoading-spin_1od6j_1"},fD={$style:hD},mD=Z(dD,[["__cssModules",fD]]),gD={key:0},vD={key:2},yD={key:3},_D={key:4},bD={key:5},wD={key:1},SD={key:0},kD={key:1},ED=z({__name:"SearchResults",props:{results:{},isLoading:{type:Boolean,default:!1},error:{},keyword:{default:""},typeLabels:{default:()=>df},onLoadMore:{},onResultItemClick:{},SearchResultsPresearch:{},SearchResultsLoading:{default:mD},SearchResultsEmpty:{default:uD},SearchResultItem:{type:[Object,Function],default:nD},variant:{default:de.STANDARD},searchType:{default:"all"}},setup(t){const e=t,n=qt(),{t:o}=ve(),r=new Map([[Q.MESSAGE,3],[Q.USER,3],[Q.GROUP,3]]),a=A(r),s=A(""),i=A(!1),l=A(void 0);function c(){var y;const P=e.results,{conversation:C}=((y=P==null?void 0:P.get(Q.CHAT_MESSAGE))==null?void 0:y.resultList[0])||{},{resultList:T=[]}=(P==null?void 0:P.get(Q.MESSAGE))||{},M=T.find($=>{const{conversationID:D}=$.conversation||{};return D===(C==null?void 0:C.conversationID)}),x=e.variant===de.STANDARD&&e.searchType===Q.MESSAGE,L=e.variant===de.EMBEDDED,q=x&&M&&!Oe||L?C:void 0;l.value=q,L&&Oe&&(i.value=!0)}ce([()=>e.results,()=>e.searchType,()=>e.variant],c,{deep:!0}),ce(()=>e.keyword,()=>{e.variant===de.MINI&&(a.value=new Map(r))}),ce(()=>e.isLoading,y=>{y===!1&&(s.value="")});const u=B(()=>e.results?Array.from(e.results.values()).every(y=>y.totalCount===0):!1),d=B(()=>{if(!e.results||e.variant===de.EMBEDDED)return new Map;if(e.variant===de.MINI){const P=new Map;return e.results.forEach((C,T)=>{const M=a.value.get(T)||0;T!==Q.CHAT_MESSAGE&&P.set(T,{...C,resultList:M!==0?C.resultList.slice(0,M):C.resultList,hasMore:M!==0?C.resultList.length>M:C.hasMore})}),P}const y=new Map;return e.searchType==="all"?e.results.forEach((P,C)=>{C!==Q.CHAT_MESSAGE&&y.set(C,P)}):e.results.has(e.searchType)?y.set(e.searchType,e.results.get(e.searchType)):e.searchType===Q.MESSAGE&&e.results.has(Q.CHAT_MESSAGE)&&y.set(e.searchType,e.results.get(Q.CHAT_MESSAGE)),y}),p=B(()=>{var y,P;return(P=(y=e.results)==null?void 0:y.get(Q.CHAT_MESSAGE))==null?void 0:P.resultList[0]}),h=B(()=>e.variant!==de.EXACT?[Q.MESSAGE,Q.USER,Q.GROUP]:[Q.USER,Q.GROUP]),m=y=>y===Q.CHAT_MESSAGE||y===Q.MESSAGE?o("Search.loadMore.messages"):y===Q.USER?o("Search.loadMore.users"):y===Q.GROUP?o("Search.loadMore.groups"):o("Search.loadMore.default"),g=(y,P)=>{if(y!==Q.MESSAGE||!p.value)return"";const{conversationID:C}=P.conversation||{},{conversationID:T}=p.value.conversation||{};return C===T?n["SearchResults__item--active"]:""},v=y=>{var P;e.variant===de.MINI&&(a.value=new Map(a.value).set(y,0)),s.value=y,(P=e.onLoadMore)==null||P.call(e,y)},b=(y,P)=>{var C;P===Q.MESSAGE&&(i.value=!0,s.value=Q.CHAT_MESSAGE),(C=e.onResultItemClick)==null||C.call(e,y,P)},w=()=>{i.value=!1},E=(y,P,C)=>{var T;if(y===Q.MESSAGE)return`${y}-${(T=P.conversation)==null?void 0:T.conversationID}-${C}`;if(y===Q.CHAT_MESSAGE)return`${y}-${P==null?void 0:P.ID}-${C}`;if(y===Q.USER)return`${y}-${P==null?void 0:P.profile.userID}-${C}`;if(y===Q.GROUP)return`${y}-${P==null?void 0:P.groupInfo.groupID}-${C}`};return(y,P)=>{var C,T,M,x,L,q,$,D,G,k,N,F,K,J,pe;return t.keyword?t.error?(_(),O("div",{key:1,class:S(f(n).SearchResults__error)},H(t.error.message),3)):!((C=t.results)!=null&&C.size)&&t.isLoading?(_(),O("div",vD,[(_(),U(se(t.SearchResultsLoading)))])):!((T=t.results)!=null&&T.size)&&!t.isLoading?(_(),O("div",yD,[(_(),U(se(t.SearchResultsEmpty)))])):t.results.size>0&&u.value?(_(),O("div",_D,[(_(),U(se(t.SearchResultsEmpty)))])):t.searchType!=="all"&&((x=(M=t.results)==null?void 0:M.get(t.searchType))==null?void 0:x.totalCount)===0?(_(),O("div",bD,[(_(),U(se(t.SearchResultsEmpty)))])):i.value&&f(Oe)?(_(),O("div",{key:6,class:S([t.variant===f(de).EMBEDDED?f(n)["SearchResults--embedded"]:f(n)["SearchResults__message-detail-page"]])},[s.value===f(Q).CHAT_MESSAGE?(_(),U(se(t.SearchResultsLoading),{key:0})):(_(),O("div",wD,[t.variant!==f(de).EMBEDDED?(_(),O("div",{key:0,class:S(f(n)["SearchResults__message-detail-header"])},[V(f(Gc),{onClick:w}),I("span",{class:S(f(n)["SearchResults__message-detail-title"])},[ge(H(f(o)("Search.results.relatedTo",{count:((q=(L=t.results)==null?void 0:L.get(f(Q).CHAT_MESSAGE))==null?void 0:q.totalCount)||0}))+" "+H(f(o)("Search.results.relatedToSuffix"))+" ",1),I("span",{class:S(f(n).SearchResults__highlight)}," "+H(t.keyword)+" ",3)],2)],2)):Y("",!0),I("div",{class:S(f(n)["SearchResults__message-detail-content"])},[(_(!0),O(ie,null,we(($=p.value)==null?void 0:$.messageList,(le,_e)=>(_(),O("div",{key:`${le.ID}-${_e}`},[(_(),U(se(t.SearchResultItem),Me({data:le,type:f(Q).CHAT_MESSAGE,keyword:t.keyword},{ref_for:!0},t.onResultItemClick&&{onClick:t.onResultItemClick}),null,16,["data","type","keyword"]))]))),128)),(G=(D=t.results)==null?void 0:D.get(f(Q).CHAT_MESSAGE))!=null&&G.hasMore?(_(),O("div",{key:0,class:S(f(n)["SearchResults__section-footer"])},[V(f(Tt),{class:S(f(n)["SearchResults__load-more-button"]),type:"text",disabled:t.isLoading,onClick:P[0]||(P[0]=()=>{var le;return(le=t.onLoadMore)==null?void 0:le.call(t,f(Q).CHAT_MESSAGE)})},{default:j(()=>[ge(H(t.isLoading?f(o)("Search.status.loading"):m(f(Q).CHAT_MESSAGE)),1)]),_:1},8,["class","disabled"])],2)):Y("",!0)],2)]))],2)):(_(),O("div",{key:7,class:S(f(n).SearchResults)},[((k=d.value)==null?void 0:k.size)>0?(_(),O("div",{key:0,class:S(f(n).SearchResults__list)},[(_(!0),O(ie,null,we(h.value,le=>(_(),O("div",{key:le,class:S(f(n)["SearchResults__result-section"])},[d.value.get(le)&&d.value.get(le).totalCount>0?(_(),O("div",SD,[t.searchType==="all"?(_(),O("div",{key:0,class:S(f(n)["SearchResults__section-header"])},[I("h3",null,H(f(o)(t.typeLabels[le])),1)],2)):Y("",!0),I("div",{class:S(f(n)["SearchResults__result-items"])},[(_(!0),O(ie,null,we(d.value.get(le).resultList,(_e,Ae)=>(_(),O("div",{key:E(le,_e,Ae),class:S(g(le,_e))},[(_(),U(se(t.SearchResultItem),{data:_e,type:le,keyword:t.keyword,class:S(f(n)["SearchResults__item-border"]),onClick:b},null,8,["data","type","keyword","class"]))],2))),128))],2),d.value.get(le).hasMore?(_(),O("div",{key:1,class:S(f(n)["SearchResults__section-footer"])},[V(f(Tt),{class:S(f(n)["SearchResults__load-more-button"]),type:"text",disabled:s.value===le,onClick:()=>v(le)},{default:j(()=>[ge(H(s.value===le?f(o)("Search.status.loading"):m(le)),1)]),_:2},1032,["class","disabled","onClick"])],2)):Y("",!0)])):Y("",!0)],2))),128))],2)):Y("",!0),l.value&&!f(Oe)?(_(),O("div",{key:1,class:S(f(n).SearchResults__list)},[s.value===f(Q).CHAT_MESSAGE?(_(),U(se(t.SearchResultsLoading),{key:0})):(_(),O("div",kD,[t.variant===f(de).STANDARD?(_(),O("div",{key:0,class:S(f(n)["SearchResults__section-header"])},[I("span",{class:S(f(n)["SearchResults__section-header-title"])},[ge(H(f(o)("Search.results.relatedTo",{count:((F=(N=t.results)==null?void 0:N.get(f(Q).CHAT_MESSAGE))==null?void 0:F.totalCount)||0}))+" ",1),I("span",{class:S(f(n).SearchResults__highlight)}," "+H(t.keyword)+" ",3),ge(" "+H(f(o)("Search.results.relatedToSuffix")),1)],2),V(f(Tt),{class:S(f(n)["SearchResults__section-header-action"]),type:"text",onClick:P[1]||(P[1]=()=>b(p.value,f(Q).CHAT_MESSAGE))},{default:j(()=>[ge(H(f(o)("Search.action.enterChat"))+" ",1),V(f(Ay),{class:S(f(n).SearchResults__highlight)},null,8,["class"])]),_:1},8,["class"])],2)):Y("",!0),I("div",{class:S(f(n)["SearchResults__result-items"])},[(_(!0),O(ie,null,we((K=p.value)==null?void 0:K.messageList,(le,_e)=>(_(),O("div",{key:`${le.ID}-${_e}`},[(_(),U(se(t.SearchResultItem),{data:le,type:f(Q).CHAT_MESSAGE,keyword:t.keyword,onClick:b},null,8,["data","type","keyword"]))]))),128))],2),(pe=(J=t.results)==null?void 0:J.get(f(Q).CHAT_MESSAGE))!=null&&pe.hasMore?(_(),O("div",{key:1,class:S(f(n)["SearchResults__section-footer"])},[V(f(Tt),{class:S(f(n)["SearchResults__load-more-button"]),type:"text",disabled:t.isLoading,onClick:P[2]||(P[2]=()=>{var le;return(le=t.onLoadMore)==null?void 0:le.call(t,f(Q).CHAT_MESSAGE)})},{default:j(()=>[ge(H(t.isLoading?f(o)("Search.status.loading"):m(f(Q).CHAT_MESSAGE)),1)]),_:1},8,["class","disabled"])],2)):Y("",!0)]))],2)):Y("",!0)],2)):(_(),O("div",gD,[t.SearchResultsPresearch?(_(),U(se(t.SearchResultsPresearch),{key:0})):(_(),U(se(t.SearchResultsEmpty),{key:1,text:f(o)("Search.input.placeholder.keywords")},null,8,["text"]))]))}}}),CD="_SearchResults_rr0x3_12",MD="_SearchResults__list_rr0x3_67",$D="_SearchResults__error_rr0x3_85",TD="_SearchResults__highlight_rr0x3_112",ID={SearchResults:CD,"SearchResults__section-header":"_SearchResults__section-header_rr0x3_22","SearchResults__item-border":"_SearchResults__item-border_rr0x3_39","SearchResults__load-more-button":"_SearchResults__load-more-button_rr0x3_52",SearchResults__list:MD,SearchResults__error:$D,"SearchResults__load-more-container":"_SearchResults__load-more-container_rr0x3_92","SearchResults__load-more-error":"_SearchResults__load-more-error_rr0x3_99","SearchResults__section-header-title":"_SearchResults__section-header-title_rr0x3_105",SearchResults__highlight:TD,"SearchResults__item--active":"_SearchResults__item--active_rr0x3_117","SearchResults__section-header-action":"_SearchResults__section-header-action_rr0x3_121","SearchResults--embedded":"_SearchResults--embedded_rr0x3_132","SearchResults__message-detail-page":"_SearchResults__message-detail-page_rr0x3_140","SearchResults__message-detail-header":"_SearchResults__message-detail-header_rr0x3_152","SearchResults__message-detail-title":"_SearchResults__message-detail-title_rr0x3_163","SearchResults__message-detail-content":"_SearchResults__message-detail-content_rr0x3_176","SearchResults__result-section":"_SearchResults__result-section_rr0x3_191","SearchResults__result-items":"_SearchResults__result-items_rr0x3_196","SearchResults__section-footer":"_SearchResults__section-footer_rr0x3_201"},AD={$style:ID},xD=Z(ED,[["__cssModules",AD]]),OD=z({__name:"Search",props:{variant:{default:de.MINI},SearchBar:{type:[Object,Function],default:Rv},SearchResults:{type:[Object,Function],default:xD},SearchAdvanced:{type:[Object,Function],default:VR},SearchResultsPresearch:{default:void 0},SearchResultsLoading:{default:void 0},SearchResultsEmpty:{default:void 0},SearchResultItem:{type:[Object,Function],default:void 0},debounceTime:{default:300},autoFocus:{type:Boolean,default:!1},className:{default:""},style:{default:()=>({})},onKeywordChange:{},onSearchComplete:{},onResultItemClick:{},onError:{}},setup(t){const e=t,{keyword:n,results:o,isLoading:r,error:a,selectedSearchType:s,searchAdvancedParams:i,setKeyword:l,setSelectedType:c,loadMore:u,setSearchMessageAdvancedParams:d,setSearchUserAdvancedParams:p,setSearchGroupAdvancedParams:h}=od(e.variant),m=A(n.value),g=A(!1),v=gv(async M=>{var x;try{g.value=!0,await l(M)}catch(L){(x=e.onError)==null||x.call(e,L)}},e.debounceTime);ce(m,M=>{g.value||v(M)},{immediate:!1}),ce(n,M=>{if(g.value){g.value=!1;return}m.value=M});const b=M=>{var x;const L=M.target,{value:q}=L;m.value=q,(x=e.onKeywordChange)==null||x.call(e,q),e.variant!==de.EXACT&&v(q)},w=M=>{var x;M.key==="Enter"&&((x=v.cancel)==null||x.call(v),g.value=!0,l(m.value))},E=()=>{var M,x;m.value="",(M=v.cancel)==null||M.call(v),g.value=!0,l(""),(x=e.onKeywordChange)==null||x.call(e,"")},y=(M,x)=>{const L=i.value.get(M)||{};switch(M){case Q.MESSAGE:d({...L,...x});break;case Q.USER:p({...L,...x});break;case Q.GROUP:h({...L,...x});break}},P=(M,x)=>{if(e.onResultItemClick&&e.onResultItemClick(M,x),x===Q.MESSAGE){const{conversationID:L=""}=M.conversation||{};y(Q.MESSAGE,{conversationID:L})}},C=M=>{e.variant===de.STANDARD&&M!==Q.CHAT_MESSAGE&&c(M),u==null||u(M)},T=M=>{M.stopPropagation()};return(M,x)=>(_(),O("div",{class:S([M.$style.Search,e.className]),style:De(e.style),onClick:T},[(_(),U(se(t.SearchBar),{value:m.value,"on-change":b,"on-key-down":w,"on-clear":E,"auto-focus":t.autoFocus,variant:t.variant},null,40,["value","auto-focus","variant"])),(_(),U(se(t.SearchAdvanced),{variant:t.variant,"search-type":f(s),"advanced-params":f(i),"on-advanced-params-change":y},null,40,["variant","search-type","advanced-params"])),(_(),U(se(t.SearchResults),{results:f(o),"is-loading":f(r),error:f(a),keyword:f(n),"type-labels":f(df),"search-type":f(s),"on-result-item-click":P,"on-load-more":C,SearchResultsPresearch:t.SearchResultsPresearch,SearchResultsLoading:t.SearchResultsLoading,SearchResultsEmpty:t.SearchResultsEmpty,SearchResultItem:t.SearchResultItem,variant:t.variant},null,40,["results","is-loading","error","keyword","type-labels","search-type","SearchResultsPresearch","SearchResultsLoading","SearchResultsEmpty","SearchResultItem","variant"]))],6))}}),RD="_Search_gblqf_1",PD={Search:RD},DD={$style:PD},ND=Z(OD,[["__cssModules",DD]]),ql=ND,Ts=Rv;un("en-US",{translation:qO});un("zh-CN",{translation:zO});const kh=A(!1),Eh=A(!1),rd=()=>({enableCreate:kh,enableSearch:Eh,setEnableCreate:t=>{kh.value=t},setEnableSearch:t=>{Eh.value=t}}),LD=["onClick"],UD=["onClick"],BD=z({__name:"ConversationActions",props:{conversation:{},className:{},style:{},onMarkConversationUnread:{},onConversationPin:{},onConversationMute:{},onConversationDelete:{},customConversationActions:{},PopupIcon:{},PopupElements:{},onClick:{},onClose:{},enablePin:{type:Boolean,default:!0},enableMute:{type:Boolean,default:!0},enableDelete:{type:Boolean,default:!0},enableMarkUnread:{type:Boolean,default:!0}},emits:["click","close","dropdownVisibleChange","markConversationUnread","conversationPin","conversationMute","conversationDelete"],setup(t,{emit:e}){const n=t,o=e,{t:r}=ve(),{markConversationUnread:a}=Rt(),s=A(!0),i=A({}),l=B(()=>Object.entries(i.value).filter(([,h])=>h.enable!==!1).reduce((h,[m,g])=>(h[m]=g,h),{})),c=()=>({pin:{enable:!!n.enablePin,label:n.conversation.isPinned?r("TUIConversation.Unpin"):r("TUIConversation.Pin"),onClick:(h,m)=>{h.pinConversation(),o("conversationPin",h,m)}},mute:{enable:!!n.enableMute,label:n.conversation.isMuted?r("TUIConversation.Unmute"):r("TUIConversation.Mute"),onClick:(h,m)=>{h.muteConversation(),o("conversationMute",h,m)}},markUnread:{enable:!!n.enableMarkUnread,label:s.value?r("TUIConversation.MarkRead"):r("TUIConversation.MarkUnRead"),onClick:(h,m)=>{a(h.conversationID,!s.value),o("markConversationUnread",h,m)}},delete:{enable:!!n.enableDelete,label:r("TUIConversation.Delete"),onClick:(h,m)=>{h.deleteConversation(),o("conversationDelete",h,m)}}});ce(()=>n.conversation,h=>{var m;if(h.unreadCount>0)s.value=!0;else{const g=oe.TYPES.CONV_MARK_TYPE_UNREAD,v=(m=h==null?void 0:h.markList)==null?void 0:m.includes(g);s.value=v}},{immediate:!0}),ce([()=>n.conversation,()=>n.customConversationActions],([h,m])=>{i.value={...c(),...m||{}}},{immediate:!0,deep:!0});const u=(h,m)=>{o("click",h,m,n.conversation);const g=i.value[m];g&&g.onClick(n.conversation,h),n.onClose&&n.onClose()},d=h=>{h.stopPropagation(),h.target===h.currentTarget&&Oe&&n.onClose&&n.onClose()},p=h=>{o("dropdownVisibleChange",h)};return(h,m)=>(_(),O("div",{class:S([h.$style.conversationActions,{[h.$style.conversationActions__h5]:f(Oe)},t.className]),style:De(t.style),onClick:d},[f(Oe)?(_(),O("div",{key:0,class:S(h.$style.conversationActions__h5__container),onClick:m[0]||(m[0]=yn(()=>{},["stop"]))},[(_(!0),O(ie,null,we(l.value,(g,v)=>(_(),O("div",{key:v,class:S([h.$style.conversationActions__item,{[h.$style["conversationActions__item--delete"]]:v==="delete"}]),onClick:b=>u(b,v)},H(g.label),11,LD))),128))],2)):(_(),U(f(qh),{key:1,trigger:"click",teleported:!0,placement:"bottom-end",onVisibleChange:p},{dropdown:j(()=>[(_(!0),O(ie,null,we(l.value,(g,v)=>(_(),O("div",{key:v,class:S([h.$style.conversationActions__item,{[h.$style["conversationActions__item--delete"]]:v==="delete"}]),onClick:b=>u(b,v)},H(g.label),11,UD))),128))]),default:j(()=>[I("div",{class:S(h.$style["conversationActions__popup-icon"])},[V(f(xy),{size:"18px"})],2)]),_:1}))],6))}}),FD="_conversationActions_qrz2h_1",jD="_conversationActions__h5_qrz2h_10",GD="_conversationActions__h5__container_qrz2h_22",qD="_conversationActions__item_qrz2h_27",HD={conversationActions:FD,"conversationActions__popup-icon":"_conversationActions__popup-icon_qrz2h_5",conversationActions__h5:jD,conversationActions__h5__container:GD,conversationActions__item:qD,"conversationActions__item--delete":"_conversationActions__item--delete_qrz2h_52"},VD={$style:HD},ad=Z(BD,[["__cssModules",VD]]),zD=z({__name:"ConversationSearch",props:{visible:{type:Boolean,default:!0},Search:{type:[Object,Function],default:()=>ql},variant:{},SearchBar:{type:[Object,Function],default:()=>Ts},SearchResults:{},SearchAdvanced:{},SearchResultsPresearch:{},SearchResultsLoading:{},SearchResultsEmpty:{},SearchResultItem:{},debounceTime:{},autoFocus:{type:Boolean},className:{},style:{},onKeywordChange:{},onSearchComplete:{},onResultItemClick:{},onError:{}},emits:["keywordChange","resultItemClick","searchComplete","error"],setup(t,{emit:e}){const n=t,o=e,r=A(!1),a=A(!1),s=A(de.MINI),{t:i}=ve(),{keyword:l,setKeyword:c,setSelectedType:u}=od(),{setActiveConversation:d}=Rt(),p=()=>{a.value=!1,s.value=de.MINI,c("")},h=w=>{r.value=!!w;const E=!w&&s.value===de.MINI,y=!Rs&&s.value===de.STANDARD&&!w;(E||y)&&p(),o("keywordChange",w)},m=w=>{const{profile:E}=w||{},y=`C2C${E.userID}`;d(y),p()},g=w=>{const{conversation:E}=w||{};E?d(E.conversationID):ut.error({message:i("TUIConversation.You are not in the group, please join the group first")}),p()},v=w=>{const{conversationID:E=""}=w||{},{conversationID:y=""}=(w==null?void 0:w.conversation)||{},P=y||E;P&&(d(P),p())},b=(w,E)=>{if(n.onResultItemClick){o("resultItemClick",w,E);return}switch(E){case Q.USER:m(w);break;case Q.GROUP:g(w);break;case Q.CHAT_MESSAGE:v(w);break;default:s.value===de.MINI&&(a.value=!0,s.value=de.STANDARD,u(E));break}};return ce(l,h,{immediate:!0}),(w,E)=>t.visible?(_(),O("div",{key:0,class:S([w.$style.conversationSearch,t.className,{[w.$style["conversationSearch--active"]]:r.value&&!a.value}]),style:De(t.style)},[I("div",{class:S([w.$style.conversationSearch])},[a.value?(_(),U(se(f(Ts)),{key:0,class:S(w.$style.conversationSearch__bar)},null,8,["class"])):Y("",!0),a.value?Y("",!0):(_(),O("div",{key:1,class:S(w.$style.conversationSearch__box)},[(_(),U(se(f(ql)),{class:S([w.$style.conversationSearch__content,{[w.$style["searchContainer--h5"]]:!f(Rs)}]),variant:f(de).MINI,SearchBar:f(Ts),SearchResultsPresearch:t.SearchResultsPresearch||(()=>he("div")),SearchResultsLoading:t.SearchResultsLoading,SearchResultsEmpty:t.SearchResultsEmpty,SearchResultItem:t.SearchResultItem,onResultItemClick:b,onSearchComplete:t.onSearchComplete,onError:t.onError},null,40,["class","variant","SearchBar","SearchResultsPresearch","SearchResultsLoading","SearchResultsEmpty","SearchResultItem","onSearchComplete","onError"]))],2)),V(f(ki),{appendTo:"body",customClasses:[w.$style.conversationSearch__advanced],visible:a.value,"show-close":!1,"show-confirm":!1,"show-cancel":!1,onClose:p},{footer:j(()=>[...E[0]||(E[0]=[I("div",null,null,-1)])]),default:j(()=>[(_(),U(se(f(ql)),{class:S([w.$style.conversationSearch__content,{[w.$style["searchContainer--h5"]]:!f(Rs)}]),variant:f(de).STANDARD,SearchBar:f(Ts),SearchResultsPresearch:t.SearchResultsPresearch,SearchResultsLoading:t.SearchResultsLoading,SearchResultsEmpty:t.SearchResultsEmpty,SearchResultItem:t.SearchResultItem,onResultItemClick:b,onSearchComplete:t.onSearchComplete,onError:t.onError},null,40,["class","variant","SearchBar","SearchResultsPresearch","SearchResultsLoading","SearchResultsEmpty","SearchResultItem","onSearchComplete","onError"]))]),_:1},8,["customClasses","visible"])],2)],6)):Y("",!0)}}),WD="_conversationSearch_1cu1j_1",KD="_conversationSearch__bar_1cu1j_11",YD="_SearchBar_1cu1j_23",JD="_conversationSearch__box_1cu1j_27",XD="_conversationSearch__advanced_1cu1j_30",QD="_searchBtn_1cu1j_42",ZD={conversationSearch:WD,conversationSearch__bar:KD,"conversationSearch--active":"_conversationSearch--active_1cu1j_15",SearchBar:YD,conversationSearch__box:JD,conversationSearch__advanced:XD,"conversationSearch__advanced--h5":"_conversationSearch__advanced--h5_1cu1j_34",searchBtn:QD},eN={$style:ZD},tN=Z(zD,[["__cssModules",eN]]),nN=t=>{switch(t){case dt.WORK:return tb;case dt.PUBLIC:return nb;case dt.MEETING:return ob;case dt.AVCHATROOM:return rb;case dt.COMMUNITY:return ab;default:return""}},sd=()=>({getDefaultAvatar:nN}),oN=["onClick"],rN=["onClick"],aN=z({__name:"ConversationCreateButton",props:{onClick:{},size:{default:24}},emits:["click"],setup(t,{emit:e}){const{t:n}=ve(),{enableSearch:o}=rd(),r=e,a=Na([{icon:Oy,key:qs.C2C,label:n("TUIConversation.Start C2C Chat")},{icon:Ry,key:qs.GROUP,label:n("TUIConversation.Start Group Chat")}]),s=i=>{r("click",i)};return(i,l)=>f(o)?(_(),U(f(qh),{key:1,trigger:"click",placement:"bottom-end"},{dropdown:j(()=>[I("div",{class:S([i.$style["conversation-create-dropdown"]])},[I("ul",{class:S([i.$style["conversation-create-list"]])},[(_(!0),O(ie,null,we(a.value,(c,u)=>(_(),O("li",{key:u,class:S([i.$style["conversation-create-item"]]),onClick:()=>s(c.key)},[(_(),U(se(c.icon))),I("span",{class:S([i.$style["conversation-create-text"]])},H(c.label),3)],10,rN))),128))],2)],2)]),default:j(()=>[V(f(Py),{class:S([i.$style["conversation-create-button"]]),size:`${t.size}px`},null,8,["class","size"])]),_:1})):(_(),O("ul",{key:0,class:S([i.$style["conversation-create-list"],{[i.$style["conversation-create-list--detail"]]:!f(o)}])},[(_(!0),O(ie,null,we(a.value,(c,u)=>(_(),O("li",{key:u,class:S([i.$style["conversation-create-item"]]),onClick:()=>s(c.key)},[(_(),U(se(c.icon))),I("span",{class:S([i.$style["conversation-create-text"]])},H(c.label),3)],10,oN))),128))],2))}}),sN={"conversation-create-button":"_conversation-create-button_1102w_1","conversation-create-dropdown":"_conversation-create-dropdown_1102w_8","conversation-create-list":"_conversation-create-list_1102w_14","conversation-create-list--detail":"_conversation-create-list--detail_1102w_23","conversation-create-item":"_conversation-create-item_1102w_30","conversation-create-text":"_conversation-create-text_1102w_40"},iN={$style:sN},lN=Z(aN,[["__cssModules",iN]]),cN=[{type:dt.WORK,name:"Work",des:"Users can join the group only via invitation by existing members. The invitation does not need to be agreed by the invitee or approved by the group owner. See the documentation for details."},{type:dt.PUBLIC,name:"Public",des:"After a public group is created, the group owner can designate group admins. To join the group, a user needs to search the group ID and send a request, which needs to be approved by the group owner or an admin before the user can join the group. See the documentation for details."},{type:dt.MEETING,name:"Meeting",des:"After the group is created, a user can join and quit the group freely and can view the messages sent before joining the group. It is suitable for scenarios that integrate Tencent Real-Time Communication (TRTC), such as audio and video conferences and online education. See the documentation for details."},{type:dt.AVCHATROOM,name:"AVChatRoom",des:"After a group is created, a user can join and quit the group freely. The group can have an unlimited number of members, but it does not store message history. It can be combined with Live Video Broadcasting (LVB) to support on-screen comment scenarios. See the documentation for details."},{type:dt.COMMUNITY,name:"Community",des:"After creation, you can enter and leave at will, support up to 100,000 people, support historical message storage, and after users search for group ID and initiate a group application, they can join the group without administrator approval. See product documentation for details."}],uN=["onClick"],dN=z({__name:"ConversationGroupTypeInfo",props:{groupType:{},setGroupType:{type:Function}},setup(t){const e=t,{t:n}=ve(),{getDefaultAvatar:o}=sd(),r=a=>{e.setGroupType(a)};return(a,s)=>(_(),O("div",{class:S(a.$style.conversationGroupTypeInfo)},[(_(!0),O(ie,null,we(f(cN),({type:i,name:l,des:c})=>(_(),O("div",{key:i,role:"presentation",class:S([a.$style.conversationGroupTypeInfo__box,{[a.$style["conversationGroupTypeInfo__box--active"]]:i===t.groupType}]),onClick:u=>r(i)},[I("div",{class:S(a.$style.conversationGroupTypeInfo__header)},[I("div",{class:S(a.$style.conversationGroupTypeInfo__title)},[V(f(ft),{size:"sm",src:f(o)(i)},null,8,["src"]),ge(" "+H(f(n)(`TUIConversation.${l}`)),1)],2),i===t.groupType?(_(),U(f(jc),{key:0,class:S(a.$style.conversationGroupTypeInfo__activeIcon)},null,8,["class"])):Y("",!0)],2),I("div",{class:S(a.$style.conversationGroupTypeInfo__description)},[ge(H(f(n)(`TUIConversation.${c}`))+" ",1),I("a",{class:S(a.$style.conversationGroupTypeInfo__document),target:"_blank",href:"https://trtc.io/document/33529?platform=web&product=chat&menulabel=uikit#group-types",rel:"bookmark noreferrer"},H(f(n)("TUIConversation.See the documentation for details")),3)],2)],10,uN))),128))],2))}}),pN="_conversationGroupTypeInfo_5gwpz_1",hN="_conversationGroupTypeInfo__box_5gwpz_19",fN="_conversationGroupTypeInfo__header_5gwpz_35",mN="_conversationGroupTypeInfo__title_5gwpz_40",gN="_conversationGroupTypeInfo__description_5gwpz_46",vN="_conversationGroupTypeInfo__document_5gwpz_52",yN="_conversationGroupTypeInfo__activeIcon_5gwpz_60",_N={conversationGroupTypeInfo:pN,conversationGroupTypeInfo__box:hN,"conversationGroupTypeInfo__box--active":"_conversationGroupTypeInfo__box--active_5gwpz_32",conversationGroupTypeInfo__header:fN,conversationGroupTypeInfo__title:mN,conversationGroupTypeInfo__description:gN,conversationGroupTypeInfo__document:vN,conversationGroupTypeInfo__activeIcon:yN},bN={$style:_N},wN=Z(dN,[["__cssModules",bN]]),SN=z({__name:"ConversationCreateGroupDetail",props:{profileList:{},pageState:{},groupInfo:{},onUpdateGroupInfo:{type:Function},setPageState:{type:Function}},emits:["update:page-state","beforeCreateConversation","conversationCreated","update-group-info"],setup(t,{emit:e}){const n=t,o=e,{t:r}=ve(),{getDefaultAvatar:a}=sd(),s=A(n.groupInfo),i=(l,c)=>{switch(c){case uo.NAME:s.value.name=l;break;case uo.GROUP_ID:s.value.groupID=l;break;case uo.TYPE:s.value.type=l,s.value.avatar=a(s.value.type);break}o("update-group-info",s.value)};return(l,c)=>(_(),O("div",{class:S([l.$style.conversationCreateGroupDetail,f(Oe)&&l.$style["conversationCreateGroupDetail--h5"]])},[t.pageState!==f(Pe).GROUP_TYPE?(_(),O("div",{key:0,class:S(l.$style.conversationCreateGroupDetail__main)},[I("div",{class:S(l.$style.conversationCreateGroupDetail__box)},[I("label",{class:S(l.$style.from__label),for:"group-avatar"},H(f(r)("TUIConversation.Group Avatar")),3),V(f(ft),{size:"sm",src:s.value.avatar},null,8,["src"])],2),I("div",{class:S(l.$style.conversationCreateGroupDetail__box)},[I("label",{class:S(l.$style.from__label),for:"group-name"},H(f(r)("TUIConversation.Group Name")),3),V(f(Wl),{id:"group-name",modelValue:s.value.name,"onUpdate:modelValue":[c[0]||(c[0]=u=>s.value.name=u),c[1]||(c[1]=u=>i(String(u),f(uo).NAME))],clearable:"",class:S(l.$style.conversationCreateGroupDetail__inputText),"max-length":30,border:!1,placeholder:f(r)("TUIConversation.Group Name")},null,8,["modelValue","class","placeholder"])],2),I("div",{class:S(l.$style.conversationCreateGroupDetail__box)},[I("label",{class:S(l.$style.from__label),for:"group-id"},H(f(r)("TUIConversation.Group ID")),3),V(f(Wl),{id:"group-id",modelValue:s.value.groupID,"onUpdate:modelValue":[c[2]||(c[2]=u=>s.value.groupID=u),c[3]||(c[3]=u=>i(String(u),f(uo).GROUP_ID))],clearable:"",class:S(l.$style.conversationCreateGroupDetail__inputText),border:!1,placeholder:f(r)("TUIConversation.Group ID")},null,8,["modelValue","class","placeholder"])],2),I("div",{class:S(l.$style.conversationCreateGroupDetail__box),style:{alignItems:"flex-start"}},[I("label",{class:S(l.$style.from__label),for:"group-type"},H(f(r)("TUIConversation.Group Type")),3),V(f(wN),{id:"group-type","group-type":s.value.type,"set-group-type":u=>i(u,f(uo).TYPE)},null,8,["group-type","set-group-type"])],2)],2)):Y("",!0)],2))}}),kN="_conversationCreateGroupDetail_2btfa_1",EN="_conversationCreateGroupDetail__nextContainer_2btfa_9",CN="_conversationCreateGroupDetail__next_2btfa_9",MN="_conversationCreateGroupDetail__main_2btfa_23",$N="_conversationCreateGroupDetail__box_2btfa_40",TN="_conversationCreateGroupDetail__inputText_2btfa_48",IN="_from__label_2btfa_54",AN={conversationCreateGroupDetail:kN,"conversationCreateGroupDetail--h5":"_conversationCreateGroupDetail--h5_2btfa_6",conversationCreateGroupDetail__nextContainer:EN,conversationCreateGroupDetail__next:CN,conversationCreateGroupDetail__main:MN,conversationCreateGroupDetail__box:$N,conversationCreateGroupDetail__inputText:TN,from__label:IN},xN={$style:AN},ON=Z(SN,[["__cssModules",xN]]),RN=z({__name:"ConversationCreateUserSelectList",props:{isCreateGroup:{type:Boolean},selectList:{},setSelectList:{type:Function}},emits:["update:is-create-group","update:select-list"],setup(t,{emit:e}){const n=t,o=e,{friendList:r}=IO(),a=B(()=>n.selectList.map(l=>{const{userID:c,nick:u,avatar:d,remark:p}=l;return{key:c,label:p||u||c,avatarUrl:d}})),s=B(()=>r.value.map(l=>{const{userID:c,nick:u,avatar:d,remark:p}=l;return{key:c,label:p||u||c,avatarUrl:d}})),i=l=>{const c=r.value.filter(u=>l.some(d=>d.key===u.userID));o("update:select-list",c),n.setSelectList(c)};return(l,c)=>(_(),O("div",{class:S([l.$style.conversationCreateUserSelectList,f(Oe)&&l.$style["conversationCreateUserSelectList--h5"]])},[V(f($i),{displayMode:"list","data-source":s.value,"default-selected-items":a.value,maxCount:t.isCreateGroup?void 0:1,onSelectedChange:i},null,8,["data-source","default-selected-items","maxCount"])],2))}}),PN="_conversationCreateUserSelectList_pa6me_1",DN={conversationCreateUserSelectList:PN,"conversationCreateUserSelectList--h5":"_conversationCreateUserSelectList--h5_pa6me_7"},NN={$style:DN},LN=Z(RN,[["__cssModules",NN]]),Ch=20,UN=z({__name:"ConversationCreate",props:{onBeforeCreateConversation:{},onConversationCreated:{},conversationList:{default:()=>[]}},emits:["update:visible","beforeCreateConversation","conversationCreated"],setup(t,{emit:e}){const{t:n}=ve(),{enableSearch:o}=rd(),{getDefaultAvatar:r}=sd(),{loginUserInfo:a}=sf(),{createC2CConversation:s,createGroupConversation:i}=Rt(),l={avatar:r(dt.WORK),name:"",groupID:"",type:dt.WORK},c=t,u=e,d=A(!1),p=A(!1),h=A(Pe.USER_SELECT),m=A([]),g=A({avatar:r(dt.WORK),name:"",groupID:"",type:dt.WORK}),v=J=>{p.value=J},b=J=>{h.value=J},w=J=>{m.value=J},E=J=>{J===qs.GROUP?v(!0):v(!1),d.value=!0},y=J=>{d.value=J},P=()=>{y(!1),g.value=l,p.value=!1,h.value=Pe.USER_SELECT,m.value=[]},C=J=>{var pe;P(),Cr.switchConversation(J.conversationID),u("conversationCreated",J),(pe=c.onConversationCreated)==null||pe.call(c,J)},T={[Pe.USER_SELECT]:n("TUIConversation.Add Participants"),[Pe.CREATE_DETAIL]:n("TUIConversation.New group chat"),[Pe.GROUP_TYPE]:n("TUIConversation.New group chat")},M={[Pe.USER_SELECT]:n("TUIConversation.Next"),[Pe.CREATE_DETAIL]:n("TUIConversation.Start chat"),[Pe.GROUP_TYPE]:n("TUIConversation.Confirm")},x={[Pe.USER_SELECT]:n("TUIConversation.Cancel"),[Pe.CREATE_DETAIL]:n("TUIConversation.Prev"),[Pe.GROUP_TYPE]:n("TUIConversation.Prev")},L=B(()=>p.value?x[h.value]:n("TUIConversation.Cancel")),q=B(()=>p.value?T[h.value]:n("TUIConversation.Start chat")),$=B(()=>p.value?M[h.value]:n("TUIConversation.Start chat")),D=J=>{g.value=J},G=async()=>{var J;const{userID:pe}=m.value[0];u("beforeCreateConversation",pe),(J=c.onBeforeCreateConversation)==null||J.call(c,pe);try{const le=await s(pe);C(le)}catch(le){ut.error({message:le.message})}},k=async()=>{var J;const pe={...g.value,memberList:m.value.map(le=>({userID:le.userID}))};u("beforeCreateConversation",pe),(J=c.onBeforeCreateConversation)==null||J.call(c,pe);try{const le=await i(pe);C(le)}catch(le){le.code===10021?ut.error({message:n("TUIConversation.group_id_already_used")}):ut.error({message:le.message})}},N=J=>{var pe,le;const _e=`${((pe=a.value)==null?void 0:pe.userName)||((le=a.value)==null?void 0:le.userId)||""}、${J.map(Ae=>(Ae==null?void 0:Ae.remark)||(Ae==null?void 0:Ae.nick)||(Ae==null?void 0:Ae.userID)).join("、")}`;return _e.length>=Ch?_e.slice(0,Ch):_e},F=()=>{if(m.value.length===0){ut.error({message:n("TUIConversation.Participant cannot be empty")});return}p.value?h.value===Pe.USER_SELECT?(g.value.name=N(m.value),b(Pe.CREATE_DETAIL)):h.value===Pe.CREATE_DETAIL?(k(),y(!1)):b(Pe.CREATE_DETAIL):(G(),y(!1))},K=()=>{h.value===Pe.USER_SELECT?(y(!1),P()):h.value===Pe.CREATE_DETAIL?b(Pe.USER_SELECT):h.value===Pe.GROUP_TYPE&&b(Pe.CREATE_DETAIL)};return(J,pe)=>(_(),O("div",{class:S(["conversationCreate__container",{conversationCreate__detail:!f(o)}])},[V(lN,{onClick:E}),V(f(ki),{appendTo:"body",visible:d.value,title:q.value,"confirm-text":$.value,"cancel-text":L.value,"custom-classes":[f(Oe)?"conversationCreate__dialog":""],onConfirm:F,onCancel:K,onClose:P},{default:j(()=>[h.value===f(Pe).USER_SELECT?(_(),U(LN,{key:0,"is-create-group":p.value,"select-list":m.value,"set-select-list":w,"set-page-state":b},null,8,["is-create-group","select-list"])):(_(),U(ON,{key:1,"page-state":h.value,"profile-list":m.value,"group-info":g.value,"set-page-state":b,onUpdateGroupInfo:D},null,8,["page-state","profile-list","group-info"]))]),_:1},8,["visible","title","confirm-text","cancel-text","custom-classes"])],2))}}),BN=Z(UN,[["__scopeId","data-v-df093e81"]]);function FN(t,e=12){return t.length>e?`${t.slice(0,e)}...`:t}function jN(t){const{t:e}=nt,{nick:n,payload:o}=t,{newGroupProfile:r,memberList:a,operatorID:s}=o;let i="";const l=n||s,c=Object.keys(r)[0];switch(c){case"muteAllMembers":r[c]?i=`${e("MessageList.administrator")} ${l} ${e("MessageList.enabled_mute_all_members")}`:i=`${e("MessageList.administrator")} ${l} ${e("MessageList.disabled_mute_all_members")}`;break;case"ownerID":i=`${a[0].nick||a[0].userID} ${e("MessageList.became_new_group_owner")}`;break;case"groupName":i=`${l} ${e("MessageList.changed_group_name_to")} ${r[c]}`;break;case"notification":i=`${l} ${e("MessageList.published_new_announcement")}`;break}return i}function Pv(t){var e,n,o,r,a,s;const i={text:""},{t:l}=nt;let c=(t==null?void 0:t.nick)||((n=(e=t==null?void 0:t.payload)==null?void 0:e.userIDList)==null?void 0:n.join(","));switch(((r=(o=t==null?void 0:t.payload)==null?void 0:o.memberList)==null?void 0:r.length)>0&&(c="",(s=(a=t==null?void 0:t.payload)==null?void 0:a.memberList)==null||s.map(u=>{const d=(u==null?void 0:u.nick)||(u==null?void 0:u.userID);return c+=`${FN(d)},`,u}),c=c==null?void 0:c.slice(0,-1)),t.payload.operationType){case oe.TYPES.GRP_TIP_MBR_JOIN:i.text=`${c} ${l("MessageList.joined_group")}`;break;case oe.TYPES.GRP_TIP_MBR_QUIT:i.text=`${l("MessageList.group_member")}: ${c} ${l("MessageList.left_group")}`;break;case oe.TYPES.GRP_TIP_MBR_KICKED_OUT:i.text=`${l("MessageList.group_member")}: ${c} ${l("MessageList.was")} ${l("MessageList.kicked_out_of_group")}`;break;case oe.TYPES.GRP_TIP_MBR_SET_ADMIN:i.text=`${l("MessageList.group_member")}: ${c} ${l("MessageList.became_admin")}`;break;case oe.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:i.text=`${l("MessageList.group_member")}: ${c} ${l("MessageList.admin_privileges_revoked")}`;break;case oe.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:i.text=jN(t);break;case oe.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:t.payload.memberList.forEach(u=>{u.muteTime>0?i.text=`${l("MessageList.group_member")}: ${c} ${l("MessageList.was_muted")}`:i.text=`${l("MessageList.group_member")}: ${c} ${l("MessageList.was_unmuted")}`});break;default:i.text=`[${l("MessageList.group_tip_message")}]`;break}return i}const GN=(t,e)=>{var n;const{draftText:o}=t||{};if(o)return typeof o=="string"?o:xo(o,{abstract:""}).abstract;const r={4:e("TUIConversation.you_have_been_removed_from_the_group"),5:e("TUIConversation.the_group_chat_has_been_disbanded"),8:e("TUIConversation.you_have_left_the_group_chat")};if(t.operationType&&r[t.operationType])return r[t.operationType];const{lastMessage:a}=t;if(!a)return"";const s=t.type===Ge.GROUP,i=a,{type:l,payload:c}=i;let u="";if(a!=null&&a.isRevoked)u=e("TUIConversation.recalled_a_message");else switch(l){case ue.TEXT:u=Ir(c.text||"");break;case ue.IMAGE:u=`[${e("TUIConversation.Image")}]`;break;case ue.AUDIO:u=`[${e("TUIConversation.Audio")}]`;break;case ue.VIDEO:u=`[${e("TUIConversation.Video")}]`;break;case ue.FILE:u=`[${e("TUIConversation.File")}]`;break;case ue.CUSTOM:{const d=xo(c==null?void 0:c.data,{businessID:void 0});if((d==null?void 0:d.businessID)===1)try{u=Zu(i,e)}catch{u=`[${e("TUIConversation.call_message")}]`}else u=a.payload.description||`[${e("TUIConversation.Custom")}]`;break}case ue.LOCATION:u=`[${e("TUIConversation.Location")}]`;break;case ue.FACE:u=`[${e("TUIConversation.Face")}]`;break;case ue.MERGER:u=`[${e("TUIConversation.Chat History")}]`;break;case ue.GRP_TIP:return(n=Pv(i))==null?void 0:n.text;default:u=`[${e("TUIConversation.unknown_message")}]`;break}if(s){let d="";return(a==null?void 0:a.fromAccount)===oe.getMyUserID()?d=e("TUIConversation.me"):d=t.remark||(i==null?void 0:i.nameCard)||(a==null?void 0:a.nick)||a.fromAccount,d?`${d}: ${u}`:u}return u},qN=z({__name:"ConversationPreviewAbstract",props:{conversation:{}},setup(t){const e=t,{t:n}=ve(),o=B(()=>{var s;const{draftText:i=""}=(e==null?void 0:e.conversation)||{};return((s=px(i))==null?void 0:s.abstract)||i}),r=B(()=>GN(e.conversation,n)),a=B(()=>{const{type:s,groupAtInfoList:i}=(e==null?void 0:e.conversation)||{};if(s!==Ge.GROUP||!(i!=null&&i.length))return"";const l=[`[${n("TUIConversation.someone_at_me")}]`,`[${n("TUIConversation.at_all")}]`,`[${n("TUIConversation.at_all")}][${n("TUIConversation.someone_at_me")}]`];let c="";return i.forEach(u=>{var d;const p=(d=u==null?void 0:u.atTypeArray)==null?void 0:d[0];p&&p>=1&&p<=3&&(c=l[p-1])}),c});return(s,i)=>(_(),O("div",{class:S(s.$style.conversationPreview__abstract)},[o.value?(_(),O(ie,{key:0},[I("label",{class:S(s.$style.conversationPreview__abstract__drafts)},"["+H(f(n)("TUIConversation.Drafts"))+"]",3),ge(" "+H(" ")+" "+H(o.value),1)],64)):(_(),O(ie,{key:1},[a.value?(_(),O("label",{key:0,class:S(s.$style["conversationPreview__abstract__at-info"])},H(a.value),3)):Y("",!0),ge(" "+H(r.value),1)],64))],2))}}),HN="_conversationPreview_4im8s_12",VN="_conversationPreview__avatar_4im8s_34",zN="_conversationPreview__content_4im8s_38",WN="_conversationPreview__header_4im8s_42",KN="_conversationPreview__title_4im8s_48",YN="_conversationPreview__time_4im8s_58",JN="_conversationPreview__footer_4im8s_65",XN="_conversationPreview__abstract_4im8s_70",QN="_conversationPreview__abstract__drafts_4im8s_80",ZN="_conversationPreview__external_4im8s_86",eL="_conversationPreview__unread_4im8s_95",tL="_conversationPreview__actions_4im8s_115",nL={conversationPreview:HN,"conversationPreview--active":"_conversationPreview--active_4im8s_28","conversationPreview--pin":"_conversationPreview--pin_4im8s_31",conversationPreview__avatar:VN,conversationPreview__content:zN,conversationPreview__header:WN,conversationPreview__title:KN,conversationPreview__time:YN,conversationPreview__footer:JN,conversationPreview__abstract:XN,conversationPreview__abstract__drafts:QN,"conversationPreview__abstract__at-info":"_conversationPreview__abstract__at-info_4im8s_83",conversationPreview__external:ZN,conversationPreview__unread:eL,"unread-count":"_unread-count_4im8s_102",conversationPreview__actions:tL},oL={$style:nL},Dv=Z(qN,[["__cssModules",oL]]),Nv=6048e5,rL=864e5,Mh=Symbol.for("constructDateFrom");function Ot(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Mh in t?t[Mh](e):t instanceof Date?new t.constructor(e):new Date(e)}function Ht(t,e){return Ot(e||t,t)}function aL(t,e,n){const o=Ht(t,void 0);return isNaN(e)?Ot(t,NaN):(o.setDate(o.getDate()+e),o)}let sL={};function nl(){return sL}function Oo(t,e){var n,o,r,a;const s=nl(),i=(e==null?void 0:e.weekStartsOn)??((o=(n=e==null?void 0:e.locale)==null?void 0:n.options)==null?void 0:o.weekStartsOn)??s.weekStartsOn??((a=(r=s.locale)==null?void 0:r.options)==null?void 0:a.weekStartsOn)??0,l=Ht(t,e==null?void 0:e.in),c=l.getDay(),u=(c<i?7:0)+c-i;return l.setDate(l.getDate()-u),l.setHours(0,0,0,0),l}function bi(t,e){return Oo(t,{...e,weekStartsOn:1})}function Lv(t,e){const n=Ht(t,void 0),o=n.getFullYear(),r=Ot(n,0);r.setFullYear(o+1,0,4),r.setHours(0,0,0,0);const a=bi(r),s=Ot(n,0);s.setFullYear(o,0,4),s.setHours(0,0,0,0);const i=bi(s);return n.getTime()>=a.getTime()?o+1:n.getTime()>=i.getTime()?o:o-1}function $h(t){const e=Ht(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function ol(t,...e){const n=Ot.bind(null,t||e.find(o=>typeof o=="object"));return e.map(n)}function wi(t,e){const n=Ht(t,void 0);return n.setHours(0,0,0,0),n}function iL(t,e,n){const[o,r]=ol(void 0,t,e),a=wi(o),s=wi(r),i=+a-$h(a),l=+s-$h(s);return Math.round((i-l)/rL)}function lL(t,e){const n=Lv(t),o=Ot(t,0);return o.setFullYear(n,0,4),o.setHours(0,0,0,0),bi(o)}function id(t){return Ot(t,Date.now())}function Uv(t,e,n){const[o,r]=ol(void 0,t,e);return+wi(o)==+wi(r)}function cL(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function uL(t){return!(!cL(t)&&typeof t!="number"||isNaN(+Ht(t)))}function dL(t,e){const n=Ht(t,void 0);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const pL={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},hL=(t,e,n)=>{let o;const r=pL[t];return typeof r=="string"?o=r:e===1?o=r.one:o=r.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function cr(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const fL={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},mL={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},gL={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},vL={date:cr({formats:fL,defaultWidth:"full"}),time:cr({formats:mL,defaultWidth:"full"}),dateTime:cr({formats:gL,defaultWidth:"full"})},yL={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},_L=(t,e,n,o)=>yL[t];function Zt(t){return(e,n)=>{const o=n!=null&&n.context?String(n.context):"standalone";let r;if(o==="formatting"&&t.formattingValues){const s=t.defaultFormattingWidth||t.defaultWidth,i=n!=null&&n.width?String(n.width):s;r=t.formattingValues[i]||t.formattingValues[s]}else{const s=t.defaultWidth,i=n!=null&&n.width?String(n.width):t.defaultWidth;r=t.values[i]||t.values[s]}const a=t.argumentCallback?t.argumentCallback(e):e;return r[a]}}const bL={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},wL={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},SL={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},kL={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},EL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},CL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ML=(t,e)=>{const n=Number(t),o=n%100;if(o>20||o<10)switch(o%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},$L={ordinalNumber:ML,era:Zt({values:bL,defaultWidth:"wide"}),quarter:Zt({values:wL,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Zt({values:SL,defaultWidth:"wide"}),day:Zt({values:kL,defaultWidth:"wide"}),dayPeriod:Zt({values:EL,defaultWidth:"wide",formattingValues:CL,defaultFormattingWidth:"wide"})};function en(t){return(e,n={})=>{const o=n.width,r=o&&t.matchPatterns[o]||t.matchPatterns[t.defaultMatchWidth],a=e.match(r);if(!a)return null;const s=a[0],i=o&&t.parsePatterns[o]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(i)?IL(i,d=>d.test(s)):TL(i,d=>d.test(s));let c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=e.slice(s.length);return{value:c,rest:u}}}function TL(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function IL(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function Bv(t){return(e,n={})=>{const o=e.match(t.matchPattern);if(!o)return null;const r=o[0],a=e.match(t.parsePattern);if(!a)return null;let s=t.valueCallback?t.valueCallback(a[0]):a[0];s=n.valueCallback?n.valueCallback(s):s;const i=e.slice(r.length);return{value:s,rest:i}}}const AL=/^(\d+)(th|st|nd|rd)?/i,xL=/\d+/i,OL={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},RL={any:[/^b/i,/^(a|c)/i]},PL={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},DL={any:[/1/i,/2/i,/3/i,/4/i]},NL={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},LL={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},UL={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},BL={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},FL={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},jL={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},GL={ordinalNumber:Bv({matchPattern:AL,parsePattern:xL,valueCallback:t=>parseInt(t,10)}),era:en({matchPatterns:OL,defaultMatchWidth:"wide",parsePatterns:RL,defaultParseWidth:"any"}),quarter:en({matchPatterns:PL,defaultMatchWidth:"wide",parsePatterns:DL,defaultParseWidth:"any",valueCallback:t=>t+1}),month:en({matchPatterns:NL,defaultMatchWidth:"wide",parsePatterns:LL,defaultParseWidth:"any"}),day:en({matchPatterns:UL,defaultMatchWidth:"wide",parsePatterns:BL,defaultParseWidth:"any"}),dayPeriod:en({matchPatterns:FL,defaultMatchWidth:"any",parsePatterns:jL,defaultParseWidth:"any"})},Fv={code:"en-US",formatDistance:hL,formatLong:vL,formatRelative:_L,localize:$L,match:GL,options:{weekStartsOn:0,firstWeekContainsDate:1}};function qL(t,e){const n=Ht(t,void 0);return iL(n,dL(n))+1}function HL(t,e){const n=Ht(t,void 0),o=+bi(n)-+lL(n);return Math.round(o/Nv)+1}function jv(t,e){var n,o,r,a;const s=Ht(t,e==null?void 0:e.in),i=s.getFullYear(),l=nl(),c=(e==null?void 0:e.firstWeekContainsDate)??((o=(n=e==null?void 0:e.locale)==null?void 0:n.options)==null?void 0:o.firstWeekContainsDate)??l.firstWeekContainsDate??((a=(r=l.locale)==null?void 0:r.options)==null?void 0:a.firstWeekContainsDate)??1,u=Ot((e==null?void 0:e.in)||t,0);u.setFullYear(i+1,0,c),u.setHours(0,0,0,0);const d=Oo(u,e),p=Ot((e==null?void 0:e.in)||t,0);p.setFullYear(i,0,c),p.setHours(0,0,0,0);const h=Oo(p,e);return+s>=+d?i+1:+s>=+h?i:i-1}function VL(t,e){var n,o,r,a;const s=nl(),i=(e==null?void 0:e.firstWeekContainsDate)??((o=(n=e==null?void 0:e.locale)==null?void 0:n.options)==null?void 0:o.firstWeekContainsDate)??s.firstWeekContainsDate??((a=(r=s.locale)==null?void 0:r.options)==null?void 0:a.firstWeekContainsDate)??1,l=jv(t,e),c=Ot((e==null?void 0:e.in)||t,0);return c.setFullYear(l,0,i),c.setHours(0,0,0,0),Oo(c,e)}function zL(t,e){const n=Ht(t,e==null?void 0:e.in),o=+Oo(n,e)-+VL(n,e);return Math.round(o/Nv)+1}function Te(t,e){const n=t<0?"-":"",o=Math.abs(t).toString().padStart(e,"0");return n+o}const Nn={y(t,e){const n=t.getFullYear(),o=n>0?n:1-n;return Te(e==="yy"?o%100:o,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Te(n+1,2)},d(t,e){return Te(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Te(t.getHours()%12||12,e.length)},H(t,e){return Te(t.getHours(),e.length)},m(t,e){return Te(t.getMinutes(),e.length)},s(t,e){return Te(t.getSeconds(),e.length)},S(t,e){const n=e.length,o=t.getMilliseconds(),r=Math.trunc(o*Math.pow(10,n-3));return Te(r,e.length)}},Vo={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Th={G:function(t,e,n){const o=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(o,{width:"abbreviated"});case"GGGGG":return n.era(o,{width:"narrow"});case"GGGG":default:return n.era(o,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const o=t.getFullYear(),r=o>0?o:1-o;return n.ordinalNumber(r,{unit:"year"})}return Nn.y(t,e)},Y:function(t,e,n,o){const r=jv(t,o),a=r>0?r:1-r;if(e==="YY"){const s=a%100;return Te(s,2)}return e==="Yo"?n.ordinalNumber(a,{unit:"year"}):Te(a,e.length)},R:function(t,e){const n=Lv(t);return Te(n,e.length)},u:function(t,e){const n=t.getFullYear();return Te(n,e.length)},Q:function(t,e,n){const o=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(o);case"QQ":return Te(o,2);case"Qo":return n.ordinalNumber(o,{unit:"quarter"});case"QQQ":return n.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(o,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(o,{width:"wide",context:"formatting"})}},q:function(t,e,n){const o=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(o);case"qq":return Te(o,2);case"qo":return n.ordinalNumber(o,{unit:"quarter"});case"qqq":return n.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(o,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(o,{width:"wide",context:"standalone"})}},M:function(t,e,n){const o=t.getMonth();switch(e){case"M":case"MM":return Nn.M(t,e);case"Mo":return n.ordinalNumber(o+1,{unit:"month"});case"MMM":return n.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(o,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(o,{width:"wide",context:"formatting"})}},L:function(t,e,n){const o=t.getMonth();switch(e){case"L":return String(o+1);case"LL":return Te(o+1,2);case"Lo":return n.ordinalNumber(o+1,{unit:"month"});case"LLL":return n.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(o,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(o,{width:"wide",context:"standalone"})}},w:function(t,e,n,o){const r=zL(t,o);return e==="wo"?n.ordinalNumber(r,{unit:"week"}):Te(r,e.length)},I:function(t,e,n){const o=HL(t);return e==="Io"?n.ordinalNumber(o,{unit:"week"}):Te(o,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Nn.d(t,e)},D:function(t,e,n){const o=qL(t);return e==="Do"?n.ordinalNumber(o,{unit:"dayOfYear"}):Te(o,e.length)},E:function(t,e,n){const o=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(o,{width:"short",context:"formatting"});case"EEEE":default:return n.day(o,{width:"wide",context:"formatting"})}},e:function(t,e,n,o){const r=t.getDay(),a=(r-o.weekStartsOn+8)%7||7;switch(e){case"e":return String(a);case"ee":return Te(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});case"eeee":default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(t,e,n,o){const r=t.getDay(),a=(r-o.weekStartsOn+8)%7||7;switch(e){case"c":return String(a);case"cc":return Te(a,e.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});case"cccc":default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(t,e,n){const o=t.getDay(),r=o===0?7:o;switch(e){case"i":return String(r);case"ii":return Te(r,e.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(o,{width:"short",context:"formatting"});case"iiii":default:return n.day(o,{width:"wide",context:"formatting"})}},a:function(t,e,n){const o=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(t,e,n){const o=t.getHours();let r;switch(o===12?r=Vo.noon:o===0?r=Vo.midnight:r=o/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,e,n){const o=t.getHours();let r;switch(o>=17?r=Vo.evening:o>=12?r=Vo.afternoon:o>=4?r=Vo.morning:r=Vo.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let o=t.getHours()%12;return o===0&&(o=12),n.ordinalNumber(o,{unit:"hour"})}return Nn.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Nn.H(t,e)},K:function(t,e,n){const o=t.getHours()%12;return e==="Ko"?n.ordinalNumber(o,{unit:"hour"}):Te(o,e.length)},k:function(t,e,n){let o=t.getHours();return o===0&&(o=24),e==="ko"?n.ordinalNumber(o,{unit:"hour"}):Te(o,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Nn.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Nn.s(t,e)},S:function(t,e){return Nn.S(t,e)},X:function(t,e,n){const o=t.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return Ah(o);case"XXXX":case"XX":return fo(o);case"XXXXX":case"XXX":default:return fo(o,":")}},x:function(t,e,n){const o=t.getTimezoneOffset();switch(e){case"x":return Ah(o);case"xxxx":case"xx":return fo(o);case"xxxxx":case"xxx":default:return fo(o,":")}},O:function(t,e,n){const o=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ih(o,":");case"OOOO":default:return"GMT"+fo(o,":")}},z:function(t,e,n){const o=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ih(o,":");case"zzzz":default:return"GMT"+fo(o,":")}},t:function(t,e,n){const o=Math.trunc(+t/1e3);return Te(o,e.length)},T:function(t,e,n){return Te(+t,e.length)}};function Ih(t,e=""){const n=t>0?"-":"+",o=Math.abs(t),r=Math.trunc(o/60),a=o%60;return a===0?n+String(r):n+String(r)+e+Te(a,2)}function Ah(t,e){return t%60===0?(t>0?"-":"+")+Te(Math.abs(t)/60,2):fo(t,e)}function fo(t,e=""){const n=t>0?"-":"+",o=Math.abs(t),r=Te(Math.trunc(o/60),2),a=Te(o%60,2);return n+r+e+a}const xh=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Gv=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},WL=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],o=n[1],r=n[2];if(!r)return xh(t,e);let a;switch(o){case"P":a=e.dateTime({width:"short"});break;case"PP":a=e.dateTime({width:"medium"});break;case"PPP":a=e.dateTime({width:"long"});break;case"PPPP":default:a=e.dateTime({width:"full"});break}return a.replace("{{date}}",xh(o,e)).replace("{{time}}",Gv(r,e))},KL={p:Gv,P:WL},YL=/^D+$/,JL=/^Y+$/,XL=["D","DD","YY","YYYY"];function QL(t){return YL.test(t)}function ZL(t){return JL.test(t)}function e2(t,e,n){const o=t2(t,e,n);if(console.warn(o),XL.includes(t))throw new RangeError(o)}function t2(t,e,n){const o=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${o} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const n2=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,o2=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,r2=/^'([^]*?)'?$/,a2=/''/g,s2=/[a-zA-Z]/;function co(t,e,n){var o,r,a,s,i,l,c,u;const d=nl(),p=(n==null?void 0:n.locale)??d.locale??Fv,h=(n==null?void 0:n.firstWeekContainsDate)??((r=(o=n==null?void 0:n.locale)==null?void 0:o.options)==null?void 0:r.firstWeekContainsDate)??d.firstWeekContainsDate??((s=(a=d.locale)==null?void 0:a.options)==null?void 0:s.firstWeekContainsDate)??1,m=(n==null?void 0:n.weekStartsOn)??((l=(i=n==null?void 0:n.locale)==null?void 0:i.options)==null?void 0:l.weekStartsOn)??d.weekStartsOn??((u=(c=d.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,g=Ht(t,n==null?void 0:n.in);if(!uL(g))throw new RangeError("Invalid time value");let v=e.match(o2).map(w=>{const E=w[0];if(E==="p"||E==="P"){const y=KL[E];return y(w,p.formatLong)}return w}).join("").match(n2).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const E=w[0];if(E==="'")return{isToken:!1,value:i2(w)};if(Th[E])return{isToken:!0,value:w};if(E.match(s2))throw new RangeError("Format string contains an unescaped latin alphabet character `"+E+"`");return{isToken:!1,value:w}});p.localize.preprocessor&&(v=p.localize.preprocessor(g,v));const b={firstWeekContainsDate:h,weekStartsOn:m,locale:p};return v.map(w=>{if(!w.isToken)return w.value;const E=w.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&ZL(E)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&QL(E))&&e2(E,e,String(t));const y=Th[E[0]];return y(g,E,p.localize,b)}).join("")}function i2(t){const e=t.match(r2);return e?e[1].replace(a2,"'"):t}function qv(t,e,n){const[o,r]=ol(n==null?void 0:n.in,t,e);return+Oo(o,n)==+Oo(r,n)}function l2(t,e,n){const[o,r]=ol(void 0,t,e);return o.getFullYear()===r.getFullYear()}function c2(t,e){return l2(Ot(t,t),id(t))}function u2(t,e){return Uv(Ot(t,t),id(t))}function d2(t,e,n){return aL(t,-1)}function p2(t,e){return Uv(Ot(t,t),d2(id(t)))}const h2={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},f2=(t,e,n)=>{let o;const r=h2[t];return typeof r=="string"?o=r:e===1?o=r.one:o=r.other.replace("{{count}}",String(e)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?o+"内":o+"前":o},m2={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},g2={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},v2={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},y2={date:cr({formats:m2,defaultWidth:"full"}),time:cr({formats:g2,defaultWidth:"full"}),dateTime:cr({formats:v2,defaultWidth:"full"})};function Oh(t,e,n){const o="eeee p";return qv(t,e,n)?o:t.getTime()>e.getTime()?"'下个'"+o:"'上个'"+o}const _2={lastWeek:Oh,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Oh,other:"PP p"},b2=(t,e,n,o)=>{const r=_2[t];return typeof r=="function"?r(e,n,o):r},w2={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},S2={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},k2={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},E2={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},C2={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},M2={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},$2=(t,e)=>{const n=Number(t);switch(e==null?void 0:e.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},T2={ordinalNumber:$2,era:Zt({values:w2,defaultWidth:"wide"}),quarter:Zt({values:S2,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Zt({values:k2,defaultWidth:"wide"}),day:Zt({values:E2,defaultWidth:"wide"}),dayPeriod:Zt({values:C2,defaultWidth:"wide",formattingValues:M2,defaultFormattingWidth:"wide"})},I2=/^(第\s*)?\d+(日|时|分|秒)?/i,A2=/\d+/i,x2={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},O2={any:[/^(前)/i,/^(公元)/i]},R2={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},P2={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},D2={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},N2={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},L2={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},U2={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},B2={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},F2={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},j2={ordinalNumber:Bv({matchPattern:I2,parsePattern:A2,valueCallback:t=>parseInt(t,10)}),era:en({matchPatterns:x2,defaultMatchWidth:"wide",parsePatterns:O2,defaultParseWidth:"any"}),quarter:en({matchPatterns:R2,defaultMatchWidth:"wide",parsePatterns:P2,defaultParseWidth:"any",valueCallback:t=>t+1}),month:en({matchPatterns:D2,defaultMatchWidth:"wide",parsePatterns:N2,defaultParseWidth:"any"}),day:en({matchPatterns:L2,defaultMatchWidth:"wide",parsePatterns:U2,defaultParseWidth:"any"}),dayPeriod:en({matchPatterns:B2,defaultMatchWidth:"any",parsePatterns:F2,defaultParseWidth:"any"})},G2={code:"zh-CN",formatDistance:f2,formatLong:y2,formatRelative:b2,localize:T2,match:j2,options:{weekStartsOn:1,firstWeekContainsDate:4}};function Hv({time:t,language:e="en-US"}){const{t:n}=ve(),o={"zh-CN":G2,"en-US":Fv},r="HH:mm",a=o[e]||o["en-US"],s=n("MessageList.yesterday",{defaultValue:"Yesterday"});return t?u2(t)?co(t,r,{locale:a}):p2(t)?`${s} ${co(t,r,{locale:a})}`:qv(t,new Date,{weekStartsOn:1})?`${co(t,"EEEE",{locale:a})} ${co(t,r)}`:c2(t)?e.startsWith("zh")?co(t,"M月d日 HH:mm",{locale:a}):co(t,"MMMM d HH:mm",{locale:a}):co(t,"yyyy/MM/dd HH:mm",{locale:a}):""}function Vv(t){const{language:e}=ve();return Hv({time:t,language:e.value})}const q2=z({__name:"ConversationPreviewTimestamp",props:{conversation:{}},setup(t){const e=t,{language:n}=ve(),o=B(()=>{var r,a;return Hv({time:Number(((a=(r=e.conversation)==null?void 0:r.lastMessage)==null?void 0:a.lastTime)||0)*1e3,language:n.value})||""});return(r,a)=>(_(),O("div",{class:S(r.$style.conversationPreview__time)},H(o.value),3))}}),H2="_conversationPreview_4im8s_12",V2="_conversationPreview__avatar_4im8s_34",z2="_conversationPreview__content_4im8s_38",W2="_conversationPreview__header_4im8s_42",K2="_conversationPreview__title_4im8s_48",Y2="_conversationPreview__time_4im8s_58",J2="_conversationPreview__footer_4im8s_65",X2="_conversationPreview__abstract_4im8s_70",Q2="_conversationPreview__abstract__drafts_4im8s_80",Z2="_conversationPreview__external_4im8s_86",eU="_conversationPreview__unread_4im8s_95",tU="_conversationPreview__actions_4im8s_115",nU={conversationPreview:H2,"conversationPreview--active":"_conversationPreview--active_4im8s_28","conversationPreview--pin":"_conversationPreview--pin_4im8s_31",conversationPreview__avatar:V2,conversationPreview__content:z2,conversationPreview__header:W2,conversationPreview__title:K2,conversationPreview__time:Y2,conversationPreview__footer:J2,conversationPreview__abstract:X2,conversationPreview__abstract__drafts:Q2,"conversationPreview__abstract__at-info":"_conversationPreview__abstract__at-info_4im8s_83",conversationPreview__external:Z2,conversationPreview__unread:eU,"unread-count":"_unread-count_4im8s_102",conversationPreview__actions:tU},oU={$style:nU},zv=Z(q2,[["__cssModules",oU]]),rU=z({__name:"ConversationPreviewTitle",props:{conversation:{}},setup(t){const e=t,n=B(()=>{var o,r;return((r=(o=e==null?void 0:e.conversation)==null?void 0:o.getShowName)==null?void 0:r.call(o))||""});return(o,r)=>(_(),O("div",{class:S([o.$style.conversationPreview__title,o.$style.textEllipsis])},H(n.value),3))}}),aU="_conversationPreview_4im8s_12",sU="_conversationPreview__avatar_4im8s_34",iU="_conversationPreview__content_4im8s_38",lU="_conversationPreview__header_4im8s_42",cU="_conversationPreview__title_4im8s_48",uU="_conversationPreview__time_4im8s_58",dU="_conversationPreview__footer_4im8s_65",pU="_conversationPreview__abstract_4im8s_70",hU="_conversationPreview__abstract__drafts_4im8s_80",fU="_conversationPreview__external_4im8s_86",mU="_conversationPreview__unread_4im8s_95",gU="_conversationPreview__actions_4im8s_115",vU={conversationPreview:aU,"conversationPreview--active":"_conversationPreview--active_4im8s_28","conversationPreview--pin":"_conversationPreview--pin_4im8s_31",conversationPreview__avatar:sU,conversationPreview__content:iU,conversationPreview__header:lU,conversationPreview__title:cU,conversationPreview__time:uU,conversationPreview__footer:dU,conversationPreview__abstract:pU,conversationPreview__abstract__drafts:hU,"conversationPreview__abstract__at-info":"_conversationPreview__abstract__at-info_4im8s_83",conversationPreview__external:fU,conversationPreview__unread:mU,"unread-count":"_unread-count_4im8s_102",conversationPreview__actions:gU},yU={$style:vU},Wv=Z(rU,[["__cssModules",yU]]),_U=z({__name:"ConversationPreviewUnread",props:{conversation:{}},setup(t){const e=t,n=B(()=>{var o,r;return(r=(o=e.conversation)==null?void 0:o.markList)==null?void 0:r.includes(oe.TYPES.CONV_MARK_TYPE_UNREAD)});return(o,r)=>{var a,s,i,l;return _(),O("div",{class:S(o.$style.conversationPreview__unread)},[(a=t.conversation)!=null&&a.isMuted?(_(),U(f(Dy),{key:0})):((s=t.conversation)==null?void 0:s.unreadCount)>99?(_(),O("span",{key:1,class:S(o.$style["unread-count"])},"99+",2)):((i=t.conversation)==null?void 0:i.unreadCount)>0?(_(),O("span",{key:2,class:S(o.$style["unread-count"])},H((l=t.conversation)==null?void 0:l.unreadCount),3)):n.value?(_(),O("span",{key:3,class:S(o.$style["unread-count"])},"1",2)):Y("",!0)],2)}}}),bU="_conversationPreview_4im8s_12",wU="_conversationPreview__avatar_4im8s_34",SU="_conversationPreview__content_4im8s_38",kU="_conversationPreview__header_4im8s_42",EU="_conversationPreview__title_4im8s_48",CU="_conversationPreview__time_4im8s_58",MU="_conversationPreview__footer_4im8s_65",$U="_conversationPreview__abstract_4im8s_70",TU="_conversationPreview__abstract__drafts_4im8s_80",IU="_conversationPreview__external_4im8s_86",AU="_conversationPreview__unread_4im8s_95",xU="_conversationPreview__actions_4im8s_115",OU={conversationPreview:bU,"conversationPreview--active":"_conversationPreview--active_4im8s_28","conversationPreview--pin":"_conversationPreview--pin_4im8s_31",conversationPreview__avatar:wU,conversationPreview__content:SU,conversationPreview__header:kU,conversationPreview__title:EU,conversationPreview__time:CU,conversationPreview__footer:MU,conversationPreview__abstract:$U,conversationPreview__abstract__drafts:TU,"conversationPreview__abstract__at-info":"_conversationPreview__abstract__at-info_4im8s_83",conversationPreview__external:IU,conversationPreview__unread:AU,"unread-count":"_unread-count_4im8s_102",conversationPreview__actions:xU},RU={$style:OU},Kv=Z(_U,[["__cssModules",RU]]);function PU(t){const e=A(!1),n=()=>{e.value=!0},o=()=>{e.value=!1};return qe(()=>{const r=t.value;r&&(r.addEventListener("mouseenter",n),r.addEventListener("mouseleave",o))}),st(()=>{const r=t.value;r&&(r.removeEventListener("mouseenter",n),r.removeEventListener("mouseleave",o))}),{isHovered:e}}const DU=()=>{};function NU(t,e){const n=t??DU,{delay:o=500,preventDefault:r=!0,cancelOutsideElement:a=!0,cancelOnMove:s=!0,onContextMenu:i}={};let l=5;typeof s=="number"&&(l=s);const c=A(!1);let u=null,d=null;const p=v=>{u&&(clearTimeout(u),u=null),d=null,c.value=!1},h=v=>{p(),r&&v.preventDefault(),d={x:v.clientX,y:v.clientY},u=setTimeout(()=>{n(v),c.value=!0,p()},o)},m=v=>{if(!d||!s)return;const b=Math.abs(v.clientX-d.x),w=Math.abs(v.clientY-d.y);(b>l||w>l)&&p()},g=v=>{p()};return st(()=>{u&&clearTimeout(u)}),{getEventHandlers:()=>{if(t===null)return{};const v={onPointerdown:h,onPointermove:m,onPointerup:g};return i&&(v.onContextmenu=i),a&&(v.onPointerleave=g),v},isLongPressActive:c}}const LU=z({__name:"ConversationPreviewUI",props:{conversation:{},isSelected:{type:Boolean,default:!1},enableActions:{type:Boolean,default:!0},Avatar:{type:[Object,Function],default:()=>ft},Title:{default:()=>Wv},LastMessageAbstract:{default:()=>Dv},LastMessageTimestamp:{default:()=>zv},Unread:{default:()=>Kv},ConversationActions:{type:[Object,Function],default:()=>ad},onSelectConversation:{},actionsConfig:{},className:{},style:{},children:{}},emits:["selectConversation"],setup(t,{emit:e}){const n=t,o=e,{activeConversation:r,setActiveConversation:a}=Rt(),s=A(),i=A(!1),l=A(!1),{isHovered:c}=PU(s),{getEventHandlers:u}=NU(()=>{Oe&&(i.value=!0)}),d=u();ce(c,g=>{if(!Oe){if(!g&&l.value)return;i.value=g}});const p=()=>{o("selectConversation",n.conversation),a(n.conversation.conversationID)},h=()=>{i.value=!1},m=g=>{console.log("[ConversationPreview] dropdown visible changed:",g),l.value=g,!g&&!c.value&&(i.value=!1)};return(g,v)=>{var b,w,E,y,P,C,T,M;return _(),O("div",null,[I("div",Me({ref_key:"conversationPreviewRef",ref:s,class:[g.$style.conversationPreview,t.className,f(Oe)&&[g.$style["conversationPreview--mobile"]],(t.isSelected||((b=t.conversation)==null?void 0:b.conversationID)===((w=f(r))==null?void 0:w.conversationID))&&[g.$style["conversationPreview--active"]],!((E=t.conversation)!=null&&E.isMuted)&&(((y=t.conversation)==null?void 0:y.unreadCount)>0||((C=(P=t.conversation)==null?void 0:P.markList)==null?void 0:C.includes(f(oe).TYPES.CONV_MARK_TYPE_UNREAD)))&&[g.$style["conversationPreview--unread"]],((T=t.conversation)==null?void 0:T.isPinned)&&[g.$style["conversationPreview--pin"]],((M=t.conversation)==null?void 0:M.isMuted)&&[g.$style["conversationPreview--mute"]]],style:t.style},f(d),{onClick:p}),[ee(g.$slots,"default",{},()=>{var x,L,q,$,D,G,k,N;return[I("div",{class:S(g.$style.conversationPreview__avatar)},[(_(),U(se(t.Avatar),{src:(L=(x=t.conversation)==null?void 0:x.getAvatar)==null?void 0:L.call(x),unreadCount:(q=t.conversation)!=null&&q.isMuted&&(D=($=t.conversation)==null?void 0:$.markList)!=null&&D.includes(f(oe).TYPES.CONV_MARK_TYPE_UNREAD)?1:void 0,isDotUnreadCount:((G=t.conversation)==null?void 0:G.isMuted)&&((N=(k=t.conversation)==null?void 0:k.markList)==null?void 0:N.includes(f(oe).TYPES.CONV_MARK_TYPE_UNREAD))},null,8,["src","unreadCount","isDotUnreadCount"]))],2),I("div",{class:S(g.$style.conversationPreview__content)},[(_(),U(se(t.Title),{conversation:t.conversation},null,8,["conversation"])),(_(),U(se(t.LastMessageAbstract),{conversation:t.conversation},null,8,["conversation"]))],2),I("div",{class:S(g.$style.conversationPreview__external)},[(_(),U(se(t.Unread),{conversation:t.conversation},null,8,["conversation"])),t.enableActions&&i.value&&!f(Oe)?(_(),U(se(t.ConversationActions),Me({key:0,conversation:t.conversation},t.actionsConfig,{onClose:h,onDropdownVisibleChange:m}),null,16,["conversation"])):(_(),U(se(t.LastMessageTimestamp),{key:1,conversation:t.conversation},null,8,["conversation"]))],2)]})],16),f(Oe)&&t.enableActions&&i.value?(_(),U(se(t.ConversationActions),Me({key:0,conversation:t.conversation},t.actionsConfig,{onClose:h}),null,16,["conversation"])):Y("",!0)])}}}),UU="_conversationPreview_4im8s_12",BU="_conversationPreview__avatar_4im8s_34",FU="_conversationPreview__content_4im8s_38",jU="_conversationPreview__header_4im8s_42",GU="_conversationPreview__title_4im8s_48",qU="_conversationPreview__time_4im8s_58",HU="_conversationPreview__footer_4im8s_65",VU="_conversationPreview__abstract_4im8s_70",zU="_conversationPreview__abstract__drafts_4im8s_80",WU="_conversationPreview__external_4im8s_86",KU="_conversationPreview__unread_4im8s_95",YU="_conversationPreview__actions_4im8s_115",JU={conversationPreview:UU,"conversationPreview--active":"_conversationPreview--active_4im8s_28","conversationPreview--pin":"_conversationPreview--pin_4im8s_31",conversationPreview__avatar:BU,conversationPreview__content:FU,conversationPreview__header:jU,conversationPreview__title:GU,conversationPreview__time:qU,conversationPreview__footer:HU,conversationPreview__abstract:VU,conversationPreview__abstract__drafts:zU,"conversationPreview__abstract__at-info":"_conversationPreview__abstract__at-info_4im8s_83",conversationPreview__external:WU,conversationPreview__unread:KU,"unread-count":"_unread-count_4im8s_102",conversationPreview__actions:YU},XU={$style:JU},Yv=Z(LU,[["__cssModules",XU]]),QU="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKwAAACoCAYAAAB9oAXOAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA2iSURBVHgB7Z3NbxNnHsef2EnsvLDZtoe2h3VWqlpVLYEKVW3VhlRqL7xsOCwnsruC4wb+gEZ72r1syx9QXo5IJRwQB16y4sIFDAKEQCQ5IBBoAycOBKK82Qmx9/c1M+zEHnvG43l5Zvz9SGY88ZjEMx//5vf8nmee6VDENfPz8wN9fX05eTrU0dExsLGxkcNS1rHMWTbN1fkvFvAol8vW5dNUKoXnM+l0emFxcXHm3XffXVDElg5FbCkWi0OyGCqVSpCz8pD1ARUOFYHxEJlnZH0mk8nMKEJhTdbX14dFEAi6N2Q53bJgCDwlf99MV1dXXrUhbSuscXrfKxIMiwB7lX6COrEgX648BJbUJN/b2/tUtQFtJSwk7e/vHzOi6LBKEPLFy8tnmky6vG0hLE73ciAnND3V+47IOymLqWw2O6USRmKFNU754/IUj8RLWoc5eRxNUtRNnLBo3cspf0xyuzHVvqLWIFH3tOyXo3EXNzHCWk77icpN/Sbu4sZe2JWVlZxE02MUtTniKm5shTVy1An1JkclHombuLETlo0p/xFpX8kZ6oT0pv2iNCdWwiJPlWhwTNXvqyetMSfp1RGde9FiISxP/+Gic5qgvbCMqpFRqeFKmjCpNEJbYRlVteHY8vLyUV2GPGopLEpV6XT6kmJU1YU5qXGP6pAipJRmrK2tjYus1xRl1YlBaYxdLRQKkZ/ttIqw0q36s2IKoDNl9Savjaz8pYWwyFfldHOavVXxQKoI09IQ/msUKULkwjJfjS2R5LWR5rAYWUVZY8ugHLuLxrVvoRFZhDU+KGRl92qMMbp1R8O6SDKSCCuyYqwqKgGUNeaIrL+XxVVJ7cZUCIQeYQ1ZjymSNMqS0x6RnDbQnrFQhaWsiSdwaUMT1shZrymSdFCrHQkqpw0lh7U0sEjy6ZCGWGDVg8CFRZ1VFqcVG1htg9EQ+8049r4SqLDsFGhrKnVa9GIqHwlU2FQqhchKWduXQWmA/aZ8JDBhJYcxZ1ohbYw4sFNc+LfyiUCExRBBWUwoQt4w7tfQRN/LWkbeyl4ssgl04ZZKpZFWB8v4GmGRYBuNLMpKNoHKgR+NMF+FNa7BYiOL1GNQHPlJtYBvKQG7XYlLylI9GvU694EvEdYoELORRdzQIbnsr15TA1+ElW8MUwHSDJ5Tg5ZTAmOiC44TIM3iKTVoWVjJXacVoyvxxlwmk9nezBtaSgnQm6UoK/FOznDINZ4jLDsIiB+gQ0Fc2u52KiTPEdZoaFFW0hLoUGimAeYpwhrRdVoR4g+4tGa7m25bTxHWiK6E+EWHOPWrqw1VkzC6koBwVeZqOsIyupKA6JC0wDGXbSrCMrqSgHG84rapCMvoSgIG4wwONNxAuYTRlYSBU13WdYQVWTl3Kwkcqcua92Gzf125hGMGSFggykqA/KNUDGpecxVhC4XCXkVZSUggysrC9ozuNiXYqwgJj0qJa35+vuYFR2HR2BLjQ5n7kxALmNOiZqyKo7BsbJEoQFrQ29tbEygdhZUEmNGVRAEKAnuq04KGwhrpACMsiQTDvU1pQUNhmQ6QqJGa7KYGv1NKwOoAiRJMjrwpaDbsOJD665xREyMkEqo7EepGWMlfhykriZrqToS6wnZ2dnJuV6IF0onw1sW6wpZKJeavRAcq5S1zpVGjixGW6MJQsVisPLEVdmlpaYj5K9EFw8VKALUVVlpkjK5EN+oLq5gOEL3ApTP1hZXaF4UlWiFpwVYsGWFJXBjCQJgaYSW6DrDBRXTDcHKgRtjV1VVGV6IlfX19uRphU6kUoyvRlaEaYXm7TaIrSFftGl2MsERHMNTwD3bC8nJuoiVoeNlWCRQhepJjSkBig0TYnF2ji8ISbWFKQGJFzTVdxWLxlSJET8q+3n6ekKChsCRWUFgSKzoVIQbS4FbNIlUlFSYdJ0+ebP6v1IhDhw65ukepjkCQU6dOxbYqA1kPHjwY5v4vd5ZKpX9Zf7Jt27a/tzpi6/Hjx91YfvTRR2t26+T/yP4uKJ8Ja/+HHV3lC77QOT4+/k/rD6Ws9WdZZFULPH/+vJJq7Nixo2i3Tt6AA+73PkHUtu7v6nUVY2R/LbDRRWIDIqxdT5fjHZUJiQjbCEthiZbYRljkCYoQPXlqJywjLNER3J7eNodlhCVaIm7O1gi7vr4+owjRkHQ6XRth+/r6mBIQLVlcXJyxbXQxLSC6ASdxS/p6HQdMC4huVJy0FVaiLIUlWiERtr6wihGW6EW5obCsFBDdkArBLJa2wvb398+w4UV0AS5mMpmGKQFglCW68NbFusJKN9iUIiR6cEXMWxfrCvv69etYRNi7d+9mnLYpFosd2O7mzZtZKT67GgOM7bA93ufmPRgo/fDhw268R5Zdbv9/RRwx81dQ90D09vbm45DHYjT91atXe+q9DjEuXLjQ/+zZs661tbWOc+fObXGSfHZ2thvbLS8vp/D/O70HX4jLly/33b9/P4PfcePGjd6zZ89uqSc65L59+3ZWGrfhXmMSQ+BgV1dX3lx3ihzapwU//PDDCqSyEwrCQKQPPvhgY9euXcsjIyOr33777eqDBw8yV65c6YVo1e9B1Ltz507Ptm3bij/++OPK7t27l7/88svC9PR09vz58/3VEppfiKWlpZT5O/bv37+I1/C7X7x4kbZuD1nv3buXmZ+fT3/xxRe8ZMgB2V9563pDYaUDIa80R1qPZYiCC+2s0kKUixcv9kPWnTt3rmA7/PyTTz5ZGx0dXYIwEM0UEPIiUkNmSL1jx463Fwdu3bq1CAkRPSGh+R7zC4Hn+Bu2bNlSwnMssY7n+BsQsfHclBXyf/XVVwVze1IX1F83Bc2G8xJ0d3dPyUFSumMKAnlw6n///fdfQzxESat4dtvjgatJzStLIfN77723Ue89+Xy+BynCp59+Wnzy5En3O++8s4Eob34hrNvv27dv6datW5WIjS8IUoyXL1+mv/vuu9XBwcF1Rdxw3brimEMVCoVLEmmHVROYjYlvvvmmYLceFIh4iGDIDT/77LO1Dz/88LXTe9BQEsk7RbzS559/XqwWrxpEyUePHlXek8vl1j/++ON1N9vLF6ILcsvvWAsysuL34UuCK3K//vrrQvW6ihHyt1/LZrOj1p85CisRdlze+LMiJFzKGxsbh6Xxf8b6Q8dyjbTQJtnrRSLievUPHIU1LkpkrxcJFQmSkxJday4mcFVEL5VKvyhCwmNT75YV14VraXzN8f4HJAwkus5JY2u73WuupyoSWY8rQoKn3OiM7lpYqckeZ+OLhMT1ei80E2EX5DGpCAmQeo0tk6ZmL5SCPIUlQYJ04GijDZoS1rgSQfvxBSSeOEVX0PT8sCxxkYBwjK6gaWGNcbKMssRX3ERX4GkA8crKSi6dTk8rQvwB4wa2uxHW05Txxn/MuizxBbfRFXi+RAM3US4Wi9Ps/SKtIB69ktx1xK2wnm/KYdRlGWVJK5ThkFtZQcsXwRUKBUTZnCKkSRqNGaiH5whrIuH8sCKkeVDGOqKapGVhUeZSbICR5igbDa2my6O+XBdvNMCuMTUgbkAqINF1tJnc1aTlCAvQAGNqQFxSGT7oRVbgi7CAqQFxAWQ9Xn1hYTP4OlUOUwPSCPHjv9JL+j3uVaA84luEBUZq8CcO9CbVGB0E+1qRFfgqLDByE47oIlZwUaHnvNWK78ICKQYjl2U+S0BFVnHihPKBQKd79DLNEUkWkgbc7+np+V75RCAR1iSTyfxFcpeWTwMknqDeKo+/KR8JVFhLI4zSthmtdA40IpQZoKXUNSQf4BKHIrYHcqxfyrHeZ975xU9Cm7Ic0srimiJJB42skSBkBYGmBFbwATB9oiJJBrIeDkpWEPpNIaSnYyydTh9TJGmYsnrudnVDJHcxobSJIxRZQWS33WFDLBkE2cCyI7Qcthp8QPmgLHnFGJSuwpQVRH5jM8xxkEqlLnGEV7zAyCsMZvG7zupEZBHWBB/Y6FzgtPTxAJe3XMMwwbBlBVrdOlLy2glZTCiiK5UB2D09Pf9QEaHdvU4LhcK4LCbYGNMLjGdVPo668oqWN+dlXqsVZWNcwL4oUoBqIs9h7cCOkZbnTsUxtVFTSQGiylft0P7255LXjsk3fILRNlQQVdEYPuJl7oAg0TLCWpFIO2lUEThdfTiYUXVEN1mB9hHWiuzEYcltjzHaBoK2UdVKrIQ1QflLdu44Kwm+AFErM1HK2cxxyvaoiaWwwKgkILcdU8QrldP/6urq0VYvvw6L2AprQnE9gaiaN07/sRrLEXthTSiuK0xRj+qcpzYiMcICkRYLq7gYp5moz+iBSo6KKovslzNhjqwKgkQeTIiLSoIcoGE5UD8ZVYV2E/dtY2p5eflEXHJUJxJ/EAuFAhZ78ZCDd8D4cVI/d9mY12wmzqf9RrRN1KmKugcsM9LEfR+UK/+8udnflHzOM0mJpna0ZX5nlVdW98jBHrbUdHXfJ6agkHJK/u68nPL/k2RJrbR7g6SC1CEhAHrRMHfCHnkMaSSwVVA0mKbkdD+bxNO9GyisDdKThgXkHRI5IO9WtVliE7/2X3nTiiEnrsKQLxEknY17694vKKxL5ufnsRjIZrNDItGAyAuZfyfPc5h5HK9BaDxv0GX8tkhvXHz51GjJP5MHBkjPyun9abuc3r3wP+xQ4AyUexAyAAAAAElFTkSuQmCC",ZU="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKsAAACoCAYAAACffB63AAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA1KSURBVHgB7Z27bxNdGsZP7Dh2AmwWGgQCg7iJixIudYK+1ZZJ8dWhoQ37D2Sl1X7lZsttkg0N2oI0S7EF6VdKBB2IRFwEAkFAIAoCUUhw7NjZ9zFnshNn7BmP5z7PTxrGdgzE42fe9znvuXUp4piVlZX+ffv2FeXhQFdXV3+1Wi3iLM9xLpreWmzyT6zi2N7eNp+XM5kMHi9ls9nVtbW1pUOHDq0qsocuRSzZ3NwckNNArVaDMOuHPO9XwVAXLw4R8pI8X8rn80sq5VCsmkqlMiTigDhHAhamU1a1eOfk91vK5XILKmWkVqw6pY+IAIbkyx9R0ROnHatyYy1AvGJHFvr6+pZVwkmVWCHQ/fv3j+noOaQShNx0C/KZZpMs3FSIFSlevsSJiKZ3zxHhzspprlAozKkEkVix6jQ/Lg9xJF6gTUCEnUxKtE2cWNGKlzQ/Jl5uTKVXpHtAtJXrMhln0SZGrKZUnygv6jVxFm3sxbqxsVGUKDpFkbZHHEUbW7FqTzqhfnpS4pI4iTZ2YmXDyXvQ7SuZaVp6ySZVhImVWOFLJQpMqeZ976QzME7hVlR7x2IhVqb8YImqNYi8WBlNQ6NeoxVrMKsiQmTFymgaGabX19cnozBsMZJiRTkqm83eV4ymUWFZatijYduCjIoY5XJ5XIQ6ryjUKIFa9nypVAo1y0UqskpX6d8U037UmQyrxBUJscKfSoq5y16oeIBB4NLovRG0LQhdrPSnsSVwHxuqZ8UIKQo1ttSDjJ6rFgihRVb9ISFUdpnGGN1VOxrEhMZQIqsIFWNN0eKnUGOOnoo+L3ZuTPlM4JFVC3VKkcQhHvaWeFjferwCFSuFmnz8FGxgYtUedV6RNDDsh4cNxLOaGlMkBUijy5cqge9iRR1VTncVG1OpQTe67urv3jN8FSsL/qmm/t2jd1J5hK9izWQyiKgUanopohtdeYRvYhXPYqyAQlIMxnvoAUod44tYMcxPThOKkJ+MezG80PPSlfap7J0iu0C3bK1WG+5k4IunkRVmWjeoKFSyC1QIOm1weSpWPWeKDSrSjKLWiCs8swHsSiVOkSrRqJu1CTyJrLr4ywYVcQSm1ruxA56IVe4Upn/SDq7sQMc2QC9CwX5/0jbt2oGOxSpedVExqhJ3LOfz+UGnb+7IBqCXSlGoxD1FrSFHuI6sLP4TL0BngWhp0MnyRK4jq25UUaikI9BZ4LSx5Sqy6qi6qAjxiGq1OmjXFesqsuqoSohnYF8Iu/e0HVkZVYlf2JWy2o6sjKrEL7A1VKuftxVZGVVJADSdGdtWZGVUJX6D3SGb/cxxZGVUJUHQqu7qOLKKULl2KvEdXXe1nALjOLJyDAAJCkTXQqFwovF1R5G1VCqNKAqVBASiK0bzNb7u1AaMKEICxKqMZStWNKxE6b6vvUlIAwONswlsxcqGFQkDWIG+vr5dQdJWrGJ2GVVJWOyyny2rAaytkrBZX18/YdRcW0ZWWgASNlJz3YmudjaAVQASKmJDdwJmxukbCQkJ+8gqfnVIr2BMSGiYOwiairW7u5trq5JIIB0EdS02FWutVqNfJVGhrsVWnpWRlUSF5pH1+/fvA/SrJCpAi9iqyFKsuVyOUZVEjZ9ivX379p3p6emT5h8oEhpra2uZR48e5RXZQdpQA914IPXUm5lM5ubMzMx/5MV/yHPYAEWC5ePHj9knT54UPn/+XP9erl27tqlIHez8093w2q8i2l/v3btXu3z5cuncuXMVRXxFvFjXq1evcq9fv+75+vVrVpFm7Ij1rRwnjVfX19czDx486JO7vHb48OGtq1evbh44cKCmiGdApE+fPu158eJFvlwu70ljPT0924rsgEbWzkUSzwor8JsyidbMqVOnymfOnCkfPXq0qohrGlN9IwcPHqziOstRyefzFKyJPXf0w4cP/yLp6K/v37/PWf2Fffv20SK0iZHqcU2biRQZ7MqVK5tHjhzZUsSSPWLVi7tOoEX6+PHj/IcPH3JWaQqiPX78eOXSpUtlWgRrnKT68+fPl8+ePctr6AArsWKfzZ152xDtp0+fuiV15eFlrf4RWoTdINU/f/483yo7nT59Gjf6JlO9c6zEil2MLccFvHv3Lvfs2bOeVqlMvoRyWi3C27dvuyFSpnp/2CPWUql0HzsZt/pLhkV48+ZNj9XPETkuXLiweeLEia2kpzcnqR6ZB9eCIu0MK7HOO9163alFSGLpC6l+eXk5hxu2lR9lqvcOKxvgapmgly9f9khhO5d0i2BXemKq9w+ryPqukxFXTiwCSl/yZVbjEm2Z6qOBVWT9pjzAiUW4efOm7XYyUWB2dvZ3TPXh0618AlFTDqT9MiyCtJJj2/fdKFT0MiHVSyRlx0iAeLLRcCvg8VZWVjLNomscwU0nZbxuZA9FAsO3yOqkIaJiAn7Xxs8BT44j7bXlIPHUsya5IZLEhmPc8ESsaao5prm2HDYd1VmdpPqLFy+Wk9oQcVJbRk/eyZMnWc7ygLbFaqR6jGxvFVnOnj1bSUvN8cuXL1lcE1oEf3EsVqQ/jMm0G+6W5pojrpGIFqOtuq1uZFyjY8eOVWgR3GE7kMVJqsfwwGKxuMXC+P+BRWjlazEWGBaBwyqdYyXWKYmcN+wmsbEP3BlojOFa2lkElr7s2SXWO3fu/F7E92+5wH9kqvcWo/SFDGUVbSFaTs5sTV2Q09PTv2Sz2d+2t7d/sXoTLqKk+QonsXmDnUXgzAtr6mKdmZmxFCBTvb/AImDmRbPpL3EZ6BMUVo2mb4ODg72cxOY/CAI47CwC+YlZrG9rtdq/RKh3rl279kSRwEBQuH79+g8nvWNppi5WEekfxsfH/2u8KBWBVS55GTzmYZWYnKnIDth82HL1NSeTBgkJEhHrgmWqEaEuKUIihIh1qZkvolhJpGgq1kqlQrGSSCH9AEtNVwzudJYrIV6BxlWhUDjRaloLomvojSy/lyvn6tKxoJ7pm4o1k8nMRWE7zMXFxYLyEYo1Fszhj6aF562tLfpWEgngV3FuGln7+voWotA5EKdZsMR74FdzudwCHrfckgVjW0WsY4qQkJDe1bne3t4beNyy/1mEuqAICRGJrHPG45Zi7enpmVOEhMtOwLSLrKvok1WEhAC0J22nZeO57TA0lLAUISEgfnXW/NxWrNISm0WLTBESPLuyuq1YYQUUB7aQgJEAOWu2AMDRaHQJx5OKkGDZYz8db33NgS0kKCSqLhcKhcHG1x3P8xGhTitCAqBZJncsVqm5TrOhRQLCslzaTmTFOIFZRYiPWDWsDNqa7lupVChW4iutGvNtiXX//v1L7NEiftEqqoK2F1JgGYv4hZ222hYrxrkyuhKvsYuqwHGd1czGxkYxm80uKkI8olqtDtqJ1dV6SvofZd2VeIKTqApcRVb9H/Rj/wH2apFOQO1evOqwE7G6XqlO110ZXUlHQENOhFp/r+qQUqmE6Opo3yxCzDQbA9CMjtcAlRB+SxHigna107FYUcpSbGyRNtGNqrZKoB3bAP0fo7E1TztAnID0L1F11KlXNfBkKXA0tmgHiFPQU9WuUIFn69bTDhAniFDR+nc1IMoTG2BAO0BagfQvvZ/Dhw4dcjUu2tMdQbQdGOUgbdKILv6PuhUq8Hz7Gu1FODKLNOLKp5rxZa8lKfTCu9K/EoNJrYmO8NSzNsItioik/qXe3t5h5QG+7mKXz+dvwFQrkkrw3ctxQ3mEr2I1Nbgo2JThtvDfCl9tgIGUswbkl7/P4YTpoL51ZVfXqGRWT5edCkSsAIKV07wiaWDYa6GCwHZexi9frVbZJZt8bvkhVBBYZDWQHoyxbDY7pUgSgVB9W1sicLECCjaR+CpUEIpYARtdycCvxpQVgXnWRvDh8CFZ1oov+O6CEioILbIaYA2CTCZznyO14oUfdVQ7QousBviwuuOAS8HHBKzIg6F+QQoVhB5ZzYiPnZDThCKRBYOnpa//zyoEIiVWUCqVxuU0wYZXtNBjlD0ZPeWWyIkV0MdGizD8qRWhe1YrcFGkhYlhZRwTGzJI+2H4UysiGVnNiI8dkzt7glE2WHQ0vdXu3H4/iWRkNYNeEV0t4BLxAWGKppFahzfykdWMXMAh8bJTjLL+EMVoaiZWYjVAiUsu7DgrBt6gu0ynJYtFeqJnLMUKdMUAXnZMEdcg5f/48WOykynSQRFbsRpQtO6QaDovQv1TFFr5Tom9WA0oWmdokf49qr60FYkRqwFFuxd4UlRT5LrMBjVCyg8SJ1YDvaPMUJprtPLZv8ln/+f6+vp0HDypHYkVq0GpVMJpBEcaoq3uw1+Ma6pvReLFaiCRFicj2o4lbaUYvZHenHzO2SREUStSI1YzZuHKeUS+6KG41Wx1BJ2T33tB0vxcUgVqJpVibUSLF71jWNsAlmEgauLV4kTjaA7rRyUtxTuBYrVAeshwgnAHRBgQbv1xUAI2hInZE3IDQaBLcW7FewXF6pCVlRWc+guFwoAIqB8CFiH3y+MiVvzGzyBmPG4h6p0CvJ4ouay7OjHxri5QSenLaUjpbvgfSaO6652WGSQAAAAASUVORK5CYII=",eB=z({__name:"ConversationPlaceHolder",props:{type:{default:Nt.NO_CONVERSATIONS},className:{default:""},iconSize:{default:42},searchString:{default:""},retry:{type:Function,default:void 0}},setup(t){const e=t,{t:n}=ve(),o=B(()=>{switch(e.type){case Nt.LOADING:return n("TUIConversation.Loading");case Nt.NO_CONVERSATIONS:return n("TUIConversation.No conversations");case Nt.WRONG:return n("TUIConversation.Load failed");default:return""}});return(r,a)=>(_(),O("div",{class:S([r.$style.conversationPlaceHolder,t.className])},[I("div",{class:S(r.$style.conversationPlaceHolder__icon)},[t.type===f(Nt).LOADING?(_(),U(f(Ny),{key:0,class:S(r.$style.conversationPlaceHolder__loading)},null,8,["class"])):t.type===f(Nt).NO_CONVERSATIONS?(_(),O("div",{key:1,class:S(r.$style.conversationPlaceHolder__empty)},[I("img",{class:S(r.$style.conversationPlaceHolder__emptyIcon),src:QU,alt:"empty"},null,2)],2)):t.type===f(Nt).WRONG?(_(),O("div",{key:2,class:S(r.$style.conversationPlaceHolder__error)},[I("img",{class:S(r.$style.conversationPlaceHolder__errorIcon),src:ZU,alt:"error"},null,2)],2)):Y("",!0)],2),o.value?(_(),O("div",{key:0,class:S(r.$style.conversationPlaceHolder__label)},H(t.searchString?`${o.value} '${t.searchString}'`:o.value),3)):Y("",!0),t.type===f(Nt).WRONG&&t.retry?(_(),U(f(Tt),{key:1,type:"primary",onClick:t.retry},{default:j(()=>[ge(H(f(n)("TUIConversation.Retry")),1)]),_:1},8,["onClick"])):Y("",!0)],2))}}),tB="_conversationPlaceHolder_15avc_1",nB="_conversationPlaceHolder__icon_15avc_10",oB="_conversationPlaceHolder__label_15avc_13",rB="_conversationPlaceHolder__loading_15avc_18",aB="_spin_15avc_1",sB="_conversationPlaceHolder__emptyIcon_15avc_24",iB="_conversationPlaceHolder__errorIcon_15avc_31",lB={conversationPlaceHolder:tB,conversationPlaceHolder__icon:nB,conversationPlaceHolder__label:oB,conversationPlaceHolder__loading:rB,spin:aB,"conversationPlaceHolder-empty":"_conversationPlaceHolder-empty_15avc_24",conversationPlaceHolder__emptyIcon:sB,"conversationPlaceHolder-error":"_conversationPlaceHolder-error_15avc_31",conversationPlaceHolder__errorIcon:iB},cB={$style:lB},Hl=Z(eB,[["__cssModules",cB]]),uB=z({__name:"ConversationListContent",props:{children:{},empty:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},PlaceholderEmptyList:{default:()=>he(Hl,{type:Nt.NO_CONVERSATIONS})},PlaceholderLoading:{default:()=>he(Hl,{type:Nt.LOADING})},PlaceholderLoadError:{default:()=>he(Hl,{type:Nt.WRONG})},className:{},style:{}},setup(t){return(e,n)=>(_(),O("div",{class:S([e.$style.conversationListContent,t.className]),style:De(t.style)},[!t.error&&!t.loading&&!t.empty?ee(e.$slots,"default",{key:0}):t.error?(_(),U(se(t.PlaceholderLoadError),{key:1})):t.loading?(_(),U(se(t.PlaceholderLoading),{key:2})):t.empty?(_(),U(se(t.PlaceholderEmptyList),{key:3})):Y("",!0)],6))}}),dB="_conversationListContent_1o134_1",pB={conversationListContent:dB,"placeholder-error":"_placeholder-error_1o134_19","placeholder-loading":"_placeholder-loading_1o134_20","placeholder-empty":"_placeholder-empty_1o134_21"},hB={$style:pB},fB=Z(uB,[["__cssModules",hB]]),mB=z({__name:"ConversationListHeader",props:{children:{},left:{default:void 0},right:{default:void 0},className:{default:void 0},style:{default:()=>({})}},setup(t){return(e,n)=>(_(),O("div",{class:S([e.$style.conversationListHeader,t.className]),style:De(t.style)},[t.left||e.$slots.left?(_(),O("div",{key:0,class:S(e.$style.conversationListHeader__left)},[t.left?(_(),U(se(t.left),{key:0})):ee(e.$slots,"left",{key:1})],2)):Y("",!0),ee(e.$slots,"default"),t.right||e.$slots.right?(_(),O("div",{key:1,class:S(e.$style.conversationListHeader__right)},[t.right?(_(),U(se(t.right),{key:0})):ee(e.$slots,"right",{key:1})],2)):Y("",!0)],6))}}),gB="_conversationListHeader_7vfmy_1",vB="_conversationListHeader__left_7vfmy_11",yB="_conversationListHeader__right_7vfmy_11",_B="_conversationListHeader__content_7vfmy_18",bB={conversationListHeader:gB,conversationListHeader__left:vB,conversationListHeader__right:yB,conversationListHeader__content:_B},wB={$style:bB},SB=Z(mB,[["__cssModules",wB]]),kB=z({__name:"ConversationPreview",props:{Preview:{type:[Object,Function],default:()=>Yv},conversation:{},isSelected:{type:Boolean,default:!1},enableActions:{type:Boolean,default:!0},Avatar:{type:[Object,Function],default:()=>ft},Title:{},LastMessageAbstract:{},LastMessageTimestamp:{},Unread:{},ConversationActions:{type:[Object,Function],default:()=>ad},onSelectConversation:{},actionsConfig:{},className:{},style:{},children:{}},emits:["selectConversation"],setup(t,{emit:e}){const n=t,o=e,r=B(()=>he(n.Title||Wv,{conversation:n.conversation})),a=B(()=>he(n.LastMessageTimestamp||zv,{conversation:n.conversation})),s=B(()=>he(n.LastMessageAbstract||Dv,{conversation:n.conversation})),i=B(()=>he(n.Unread||Kv,{conversation:n.conversation})),l=c=>{o("selectConversation",c)};return(c,u)=>(_(),O("div",null,[(_(),U(se(t.Preview),{conversation:t.conversation,isSelected:t.isSelected,enableActions:t.enableActions,Avatar:t.Avatar,ConversationActions:t.ConversationActions,Title:r.value,LastMessageTimestamp:a.value,LastMessageAbstract:s.value,Unread:i.value,actionsConfig:t.actionsConfig,className:t.className,style:De(t.style),onSelectConversation:l},{default:j(()=>[ee(c.$slots,"default")]),_:3},40,["conversation","isSelected","enableActions","Avatar","ConversationActions","Title","LastMessageTimestamp","LastMessageAbstract","Unread","actionsConfig","className","style"]))]))}}),EB=z({__name:"ConversationList",props:{children:{},enableSearch:{type:Boolean,default:!0},enableCreate:{type:Boolean,default:!0},enableActions:{type:Boolean,default:!0},actionsConfig:{},Header:{type:[Object,Function],default:()=>SB},List:{type:[Object,Function],default:()=>fB},Preview:{type:[Object,Function],default:()=>Yv},ConversationCreate:{type:[Object,Function],default:()=>BN},ConversationSearch:{default:()=>tN},ConversationActions:{type:[Object,Function],default:()=>ad},PlaceholderEmptyList:{default:void 0},PlaceholderLoading:{default:void 0},PlaceholderLoadError:{default:void 0},Avatar:{type:[Object,Function],default:()=>ft},filter:{},sort:{},onSelectConversation:{},onBeforeCreateConversation:{},onConversationCreated:{},className:{},style:{}},emits:["selectConversation","beforeCreateConversation","conversationCreated"],setup(t,{emit:e}){const n=t,o=e,{enableActions:r,actionsConfig:a,enableCreate:s,enableSearch:i,onBeforeCreateConversation:l,onConversationCreated:c}=n,{conversationList:u,setActiveConversation:d}=Rt(),{setEnableCreate:p,setEnableSearch:h}=rd(),m=A([]),g=B(()=>{if(!u.value)return[];let M=u.value;return n.filter&&typeof n.filter=="function"&&(M=n.filter(M)),n.sort&&typeof n.sort=="function"&&(M=n.sort(M)),M}),v=A(!1),b=A({}),w=B(()=>s),E=B(()=>i);p(w.value),h(E.value),ce(()=>[a,m.value],([M,x])=>{if(!(!M&&!x)){if(M){b.value=M;return}if(x&&x.length>0){const L={};x.forEach(q=>{const $=`enable${q.charAt(0).toUpperCase()}${q.slice(1)}`;L[$]=L[$]??!0}),b.value=L}}},{immediate:!0});const y=M=>{d(M.conversationID),o("selectConversation",M)},P=M=>{v.value=M},C=M=>(o("beforeCreateConversation",M),l?l(M):M),T=M=>{o("conversationCreated",M),c&&c(M)};return(M,x)=>(_(),O("div",{class:S([M.$style.conversationList,t.className,{[M.$style["conversationList--mobile"]]:f(Oe)}]),style:De(t.style)},[t.Header?(_(),U(se(t.Header),{key:0,class:S({[M.$style.conversationList__headerCreating]:v.value})},{default:j(()=>[E.value?(_(),U(se(t.ConversationSearch),{key:0})):Y("",!0),w.value?(_(),U(se(t.ConversationCreate),{key:1,"conversation-list":f(u),"onUpdate:visible":P,onBeforeCreate:C,onCreated:T},null,40,["conversation-list"])):Y("",!0)]),_:1},8,["class"])):Y("",!0),(_(),U(se(t.List),{empty:g.value.length===0,loading:!f(u),error:!1,PlaceholderEmptyList:t.PlaceholderEmptyList,PlaceholderLoading:t.PlaceholderLoading,PlaceholderLoadError:t.PlaceholderLoadError},{default:j(()=>[(_(!0),O(ie,null,we(g.value,L=>(_(),U(f(kB),{key:L.conversationID,conversation:L,"enable-actions":f(r),Avatar:t.Avatar,Preview:t.Preview,ConversationActions:t.ConversationActions,"actions-config":b.value,onSelectConversation:y},null,8,["conversation","enable-actions","Avatar","Preview","ConversationActions","actions-config"]))),128))]),_:1},8,["empty","loading","PlaceholderEmptyList","PlaceholderLoading","PlaceholderLoadError"]))],6))}}),CB="_conversationList_chbuy_1",MB={conversationList:CB},$B={$style:MB},TB=Z(EB,[["__cssModules",$B]]),IB={TUIConversation:{Loading:"Loading...","No conversations":"No conversations","Load failed":"Load failed",Retry:"Retry","You are not in the group, please join the group first":"You are not in the group, please join the group first","Start chat":"Start Chat","Start C2C Chat":"Start C2C Chat","Start Group Chat":"Start Group Chat","Add Participants":"Add Participants",Search:"Search","New group chat":"New group chat",Next:"Next",Prev:"Prev",Cancel:"Cancel",Create:"Create","Group Avatar":"Group Avatar","Group Name":"Group Name","Group ID":"Group ID","Group Type":"Group Type",Participants:"Participants",Private:"Work",Work:"Work",Public:"Public",Meeting:"Meeting",AVChatRoom:"AVChatRoom",Community:"Community","Users can join the group only via invitation by existing members. The invitation does not need to be agreed by the invitee or approved by the group owner. See the documentation for details.":"Users can join the group only via invitation by existing members. The invitation does not need to be agreed by the invitee or approved by the group owner. ","After a public group is created, the group owner can designate group admins. To join the group, a user needs to search the group ID and send a request, which needs to be approved by the group owner or an admin before the user can join the group. See the documentation for details.":"After a public group is created, the group owner can designate group admins. To join the group, a user needs to search the group ID and send a request, which needs to be approved by the group owner or an admin before the user can join the group.","After the group is created, a user can join and quit the group freely and can view the messages sent before joining the group. It is suitable for scenarios that integrate Tencent Real-Time Communication (TRTC), such as audio and video conferences and online education. See the documentation for details.":"After the group is created, a user can join and quit the group freely and can view the messages sent before joining the group. It is suitable for scenarios that integrate Tencent Real-Time Communication (TRTC), such as audio and video conferences and online education.","After a group is created, a user can join and quit the group freely. The group can have an unlimited number of members, but it does not store message history. It can be combined with Live Video Broadcasting (LVB) to support on-screen comment scenarios. See the documentation for details.":"After a group is created, a user can join and quit the group freely. The group can have an unlimited number of members, but it does not store message history. It can be combined with Live Video Broadcasting (LVB) to support on-screen comment scenarios.","After creation, you can enter and leave at will, support up to 100,000 people, support historical message storage, and after users search for group ID and initiate a group application, they can join the group without administrator approval. See product documentation for details.":"After creation, you can enter and leave at will, support up to 100,000 people, support historical message storage, and after users search for group ID and initiate a group application, they can join the group without administrator approval.","See the documentation for details":"See the documentation for details.",Pin:"Pin",Unpin:"Unpin",Mute:"Mute",Unmute:"Unmute",MarkRead:"Mark as Read",MarkUnRead:"Mark as Unread",Delete:"Delete",Details:"Details",Drafts:"Drafts",Image:"Image",Audio:"Audio",Video:"Video",File:"File",Custom:"Custom",Location:"Location",Face:"Face","Chat History":"Chat History",call_message:"Call Message",unknown_message:"Unknown Message",me:"Me",recalled_a_message:"recalled a message",you_have_been_removed_from_the_group:"You have been removed from the group by the group administrator",the_group_chat_has_been_disbanded:"The group chat has been disbanded",you_have_left_the_group_chat:"You have left the group chat",someone_at_me:"You were mentioned",at_all:"@All",group_id_already_used:"The group ID for creating the group chat is already in use, please choose a different group ID."}},AB={TUIConversation:{Loading:"加载中...","No conversations":"暂无会话","Load failed":"加载失败",Retry:"重试","You are not in the group, please join the group first":"你不在群组中,请先加入群组","Start chat":"发起会话","Start C2C Chat":"发起单人会话","Start Group Chat":"发起多人会话","Add Participants":"添加成员",Search:"搜索","New group chat":"新建群聊",Next:"下一步",Prev:"上一步",Cancel:"取消",Create:"创建","Group Avatar":"群头像","Group Name":"群名称","Group ID":"群ID","Group Type":"群类型",Participants:"群成员",Private:"工作群",Work:"工作群",Public:"公开群",Meeting:"会议群",AVChatRoom:"直播群",Community:"社群","Users can join the group only via invitation by existing members. The invitation does not need to be agreed by the invitee or approved by the group owner. See the documentation for details.":"用户只能通过现有成员的邀请加入群组。邀请无需被邀请人同意或群主批准。","After a public group is created, the group owner can designate group admins. To join the group, a user needs to search the group ID and send a request, which needs to be approved by the group owner or an admin before the user can join the group. See the documentation for details.":"公共群组创建后,群主可以指定群管理员。用户加入群组需要搜索群ID并发送请求,群主或管理员批准后方可加入。","After the group is created, a user can join and quit the group freely and can view the messages sent before joining the group. It is suitable for scenarios that integrate Tencent Real-Time Communication (TRTC), such as audio and video conferences and online education. See the documentation for details.":"群组创建后,用户可以自由加入和退出群组,并可以查看加入群组前发送的消息。适用于音视频会议、在线教育等融合腾讯实时通信 (TRTC) 的场景。","After a group is created, a user can join and quit the group freely. The group can have an unlimited number of members, but it does not store message history. It can be combined with Live Video Broadcasting (LVB) to support on-screen comment scenarios. See the documentation for details.":"群组创建后,用户可以自由加入和退出群组。群组成员数量不限,但不保存消息历史记录。可以与直播 (LVB) 结合,支持屏幕评论场景。","After creation, you can enter and leave at will, support up to 100,000 people, support historical message storage, and after users search for group ID and initiate a group application, they can join the group without administrator approval. See product documentation for details.":"创建后可随意进出,最多支持10万人,支持历史消息存储,用户搜索群ID发起建群申请后,无需管理员审批即可加入。","See the documentation for details":"详情请参阅文档。",Pin:"置顶",Unpin:"取消置顶",Mute:"消息免打扰",Unmute:"取消免打扰",MarkRead:"标为已读",MarkUnRead:"标为未读",Delete:"删除",Details:"详情",Drafts:"草稿",Image:"图片",Audio:"音频",Video:"视频",File:"文件",Custom:"自定义消息",Location:"位置",Face:"动画表情","Chat History":"聊天记录",call_message:"通话消息",unknown_message:"消息",me:"我",recalled_a_message:"撤回了一条消息",you_have_been_removed_from_the_group:"你已被群管理员移出该群",the_group_chat_has_been_disbanded:"该群聊已解散",you_have_left_the_group_chat:"你已退出该群聊",someone_at_me:"有人@我",at_all:"@所有人",group_id_already_used:"当前创建群聊的群ID已被使用,请选择其他群ID"}};un("en-US",{translation:IB});un("zh-CN",{translation:AB});const vq=TB,xB={administrator:"Administrator",enabled_mute_all_members:"enabled mute all members",disabled_mute_all_members:"disabled mute all members",became_new_group_owner:"became the new group owner",changed_group_name_to:"changed group name to",published_new_announcement:"published new group notification",joined_group:"joined the group",group_member:"Group member",left_group:"left the group",was:"was",kicked_out_of_group:"kicked out of the group",became_admin:"became admin",admin_privileges_revoked:"admin privileges revoked",was_muted:"was muted",was_unmuted:"was unmuted",group_tip_message:"Group tip message",download_failed:"Download failed",create_group:"Create Group",unread:"Unread",all_read:"All Read",read:"Read",you:"You",recalled_a_message:"recalled a message",reedit:"Re-edit",origin_message_has_been_recalled:"Original message has been recalled",forward:"Forward",copy:"Copy",recall:"Recall",quote:"Quote",delete:"Delete",max_count_exceed:"Max Count Exceed",read_receipt_detail:"Read Receipt Detail",read_count:"Read Count",unread_count:"Unread Count",loading:"Loading",no_read_members:"No Read Members",no_more:"No More",no_unread_members:"No Unread Members",yesterday:"Yesterday",copy_success:"Copied",copy_failed:"Copy Failed",recall_success:"Message recalled",recall_failed:"Recall Failed",recall_time_limit_exceeded:"Recall time limit exceeded",delete_success:"Deleted",delete_failed:"Delete Failed"},OB={start_call:"{{messageSender}} start call",call_ended:"Call ended",call_duration:"Call duration",switch_to_audio_call:"Switch to audio call",switch_to_video_call:"Switch to video call",cancel_call:"Cancel call",canceled:"Canceled",canceled_by_recipient:"Call canceled by caller",answered:"Answered",decline_call:"Decline call",declined:"Declined",line_busy:"Line busy",missed_due_to_busy:"Missed due to busy line",declined_by_recipient:"Call declined by user",no_answer:"No answer",no_answer_from_recipient:"Call wasn't answered",no_answer_timeout:"Call not answered (timeout)"},RB={"[TUIEmoji_Smile]":"[Smile]","[TUIEmoji_Expect]":"[Expect]","[TUIEmoji_Blink]":"[Blink]","[TUIEmoji_Guffaw]":"[Guffaw]","[TUIEmoji_KindSmile]":"[KindSmile]","[TUIEmoji_Haha]":"[Haha]","[TUIEmoji_Cheerful]":"[Cheerful]","[TUIEmoji_Speechless]":"[Speechless]","[TUIEmoji_Amazed]":"[Amazed]","[TUIEmoji_Sorrow]":"[Sorrow]","[TUIEmoji_Complacent]":"[Complacent]","[TUIEmoji_Silly]":"[Silly]","[TUIEmoji_Lustful]":"[Lustful]","[TUIEmoji_Giggle]":"[Giggle]","[TUIEmoji_Kiss]":"[Kiss]","[TUIEmoji_Wail]":"[Wail]","[TUIEmoji_TearsLaugh]":"[TearsLaugh]","[TUIEmoji_Trapped]":"[Trapped]","[TUIEmoji_Mask]":"[Mask]","[TUIEmoji_Fear]":"[Fear]","[TUIEmoji_BareTeeth]":"[BareTeeth]","[TUIEmoji_FlareUp]":"[FlareUp]","[TUIEmoji_Yawn]":"[Yawn]","[TUIEmoji_Tact]":"[Tact]","[TUIEmoji_Stareyes]":"[StarEyes]","[TUIEmoji_ShutUp]":"[ShutUp]","[TUIEmoji_Sigh]":"[Sigh]","[TUIEmoji_Hehe]":"[Hehe]","[TUIEmoji_Silent]":"[Silent]","[TUIEmoji_Surprised]":"[Surprised]","[TUIEmoji_Askance]":"[Askance]","[TUIEmoji_Ok]":"[OK]","[TUIEmoji_Shit]":"[Shit]","[TUIEmoji_Monster]":"[Monster]","[TUIEmoji_Daemon]":"[Daemon]","[TUIEmoji_Rage]":"[Rage]","[TUIEmoji_Fool]":"[Fool]","[TUIEmoji_Pig]":"[Pig]","[TUIEmoji_Cow]":"[Cow]","[TUIEmoji_Ai]":"[AI]","[TUIEmoji_Skull]":"[Skull]","[TUIEmoji_Bombs]":"[Bombs]","[TUIEmoji_Coffee]":"[Coffee]","[TUIEmoji_Cake]":"[Cake]","[TUIEmoji_Beer]":"[Beer]","[TUIEmoji_Flower]":"[Flower]","[TUIEmoji_Watermelon]":"[Watermelon]","[TUIEmoji_Rich]":"[Rich]","[TUIEmoji_Heart]":"[Heart]","[TUIEmoji_Moon]":"[Moon]","[TUIEmoji_Sun]":"[Sun]","[TUIEmoji_Star]":"[Star]","[TUIEmoji_RedPacket]":"[RedPacket]","[TUIEmoji_Celebrate]":"[Celebrate]","[TUIEmoji_Bless]":"[Bless]","[TUIEmoji_Fortune]":"[Fortune]","[TUIEmoji_Convinced]":"[Convinced]","[TUIEmoji_Prohibit]":"[Prohibit]","[TUIEmoji_666]":"[666]","[TUIEmoji_857]":"[857]","[TUIEmoji_Knife]":"[Knife]","[TUIEmoji_Like]":"[Like]"},PB={administrator:"管理员",enabled_mute_all_members:"开启全员禁言",disabled_mute_all_members:"取消全员禁言",became_new_group_owner:"成为新的群主",changed_group_name_to:"修改群名为",published_new_announcement:"发布新公告",joined_group:"加入群组",group_member:"群成员",left_group:"退出群组",was:"被",kicked_out_of_group:"踢出群组",became_admin:"成为管理员",admin_privileges_revoked:"被撤销管理员",was_muted:"被禁言",was_unmuted:"被取消禁言",group_tip_message:"群提示消息",download_failed:"下载失败",create_group:"创建群组",unread:"未读",all_read:"全部已读",read:"已读",you:"你",recalled_a_message:"撤回了一条消息",reedit:"重新编辑",origin_message_has_been_recalled:"原消息已被撤回",forward:"转发",copy:"复制",recall:"撤回",quote:"引用",delete:"删除",max_count_exceed:"超过最大数量限制",read_receipt_detail:"已读详情",read_count:"已读人数",unread_count:"未读人数",loading:"加载中",no_read_members:"暂无已读成员",no_more:"已加载全部",no_unread_members:"暂无未读成员",yesterday:"昨天",copy_success:"已复制",copy_failed:"复制失败",recall_success:"消息已撤回",recall_failed:"撤回失败",recall_time_limit_exceeded:"撤回时间限制已过期",delete_success:"删除成功",delete_failed:"删除失败"},DB={start_call:"{{messageSender}} 发起通话",call_ended:"通话结束",call_duration:"通话时长",switch_to_audio_call:"切换语音通话",switch_to_video_call:"切换视频通话",cancel_call:"取消通话",canceled:"已取消",canceled_by_recipient:"对方已取消",answered:"已接听",decline_call:"拒绝通话",declined:"已拒绝",line_busy:"对方忙线中",missed_due_to_busy:"忙线未接听",declined_by_recipient:"对方已拒绝",no_answer:"无应答",no_answer_from_recipient:"对方无应答",no_answer_timeout:"超时无应答"},NB={"[TUIEmoji_Smile]":"[微笑]","[TUIEmoji_Expect]":"[期待]","[TUIEmoji_Blink]":"[眨眼]","[TUIEmoji_Guffaw]":"[大笑]","[TUIEmoji_KindSmile]":"[姨母笑]","[TUIEmoji_Haha]":"[哈哈哈]","[TUIEmoji_Cheerful]":"[愉快]","[TUIEmoji_Speechless]":"[无语]","[TUIEmoji_Amazed]":"[惊讶]","[TUIEmoji_Sorrow]":"[悲伤]","[TUIEmoji_Complacent]":"[得意]","[TUIEmoji_Silly]":"[傻了]","[TUIEmoji_Lustful]":"[色]","[TUIEmoji_Giggle]":"[憨笑]","[TUIEmoji_Kiss]":"[亲亲]","[TUIEmoji_Wail]":"[大哭]","[TUIEmoji_TearsLaugh]":"[哭笑]","[TUIEmoji_Trapped]":"[困]","[TUIEmoji_Mask]":"[口罩]","[TUIEmoji_Fear]":"[恐惧]","[TUIEmoji_BareTeeth]":"[龇牙]","[TUIEmoji_FlareUp]":"[发怒]","[TUIEmoji_Yawn]":"[打哈欠]","[TUIEmoji_Tact]":"[机智]","[TUIEmoji_Stareyes]":"[星星眼]","[TUIEmoji_ShutUp]":"[闭嘴]","[TUIEmoji_Sigh]":"[叹气]","[TUIEmoji_Hehe]":"[呵呵]","[TUIEmoji_Silent]":"[收声]","[TUIEmoji_Surprised]":"[惊喜]","[TUIEmoji_Askance]":"[白眼]","[TUIEmoji_Ok]":"[OK]","[TUIEmoji_Shit]":"[便便]","[TUIEmoji_Monster]":"[怪兽]","[TUIEmoji_Daemon]":"[恶魔]","[TUIEmoji_Rage]":"[恶魔怒]","[TUIEmoji_Fool]":"[衰]","[TUIEmoji_Pig]":"[猪]","[TUIEmoji_Cow]":"[牛]","[TUIEmoji_Ai]":"[AI]","[TUIEmoji_Skull]":"[骷髅]","[TUIEmoji_Bombs]":"[炸弹]","[TUIEmoji_Coffee]":"[咖啡]","[TUIEmoji_Cake]":"[蛋糕]","[TUIEmoji_Beer]":"[啤酒]","[TUIEmoji_Flower]":"[花]","[TUIEmoji_Watermelon]":"[瓜]","[TUIEmoji_Rich]":"[壕]","[TUIEmoji_Heart]":"[爱心]","[TUIEmoji_Moon]":"[月亮]","[TUIEmoji_Sun]":"[太阳]","[TUIEmoji_Star]":"[星星]","[TUIEmoji_RedPacket]":"[红包]","[TUIEmoji_Celebrate]":"[庆祝]","[TUIEmoji_Bless]":"[福]","[TUIEmoji_Fortune]":"[发]","[TUIEmoji_Convinced]":"[服]","[TUIEmoji_Prohibit]":"[禁]","[TUIEmoji_666]":"[666]","[TUIEmoji_857]":"[857]","[TUIEmoji_Knife]":"[刀]","[TUIEmoji_Like]":"[赞]"},Jv={"en-US":{MessageList:xB,CallMessage:OB,Emoji:RB},"zh-CN":{MessageList:PB,CallMessage:DB,Emoji:NB}},Xv=Symbol("MessageListContext");function LB(t){const e=Hc(Xv,null);if(e===null)throw new Error(`<${t}> must be used within Parent MessageList.`);return e}const UB="menu.itemSelect",BB=["Enter"," "],FB=["ArrowDown","PageUp","Home"],Qv=["ArrowUp","PageDown","End"],jB=[...FB,...Qv];function Zv(t){return t?"open":"closed"}function GB(t){const e=Qe();for(const n of t)if(n===e||(n.focus(),Qe()!==e))return}function qB(t,e){const{x:n,y:o}=t;let r=!1;for(let a=0,s=e.length-1;a<e.length;s=a++){const i=e[a].x,l=e[a].y,c=e[s].x,u=e[s].y;l>o!=u>o&&n<(c-i)*(o-l)/(u-l)+i&&(r=!r)}return r}function HB(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return qB(n,e)}function Si(t){return t.pointerType==="mouse"}const[Or,VB]=dn("DialogRoot");var zB=z({inheritAttrs:!1,__name:"DialogRoot",props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1,default:!1},modal:{type:Boolean,required:!1,default:!0}},emits:["update:open"],setup(t,{emit:e}){const n=t,o=Ti(n,"open",e,{defaultValue:n.defaultOpen,passive:n.open===void 0}),r=A(),a=A(),{modal:s}=rn(n);return VB({open:o,modal:s,openModal:()=>{o.value=!0},onOpenChange:i=>{o.value=i},onOpenToggle:()=>{o.value=!o.value},contentId:"",titleId:"",descriptionId:"",triggerElement:r,contentElement:a}),(i,l)=>ee(i.$slots,"default",{open:f(o),close:()=>o.value=!1})}}),WB=zB,KB=z({__name:"DialogContentImpl",props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=Or(),{forwardRef:a,currentElement:s}=Ne();return r.titleId||(r.titleId=Ks(void 0,"reka-dialog-title")),r.descriptionId||(r.descriptionId=Ks(void 0,"reka-dialog-description")),qe(()=>{r.contentElement=s,Qe()!==document.body&&(r.triggerElement.value=Qe())}),(i,l)=>(_(),U(f(eu),{"as-child":"",loop:"",trapped:n.trapFocus,onMountAutoFocus:l[5]||(l[5]=c=>o("openAutoFocus",c)),onUnmountAutoFocus:l[6]||(l[6]=c=>o("closeAutoFocus",c))},{default:j(()=>[V(f(Zc),Me({id:f(r).contentId,ref:f(a),as:i.as,"as-child":i.asChild,"disable-outside-pointer-events":i.disableOutsidePointerEvents,role:"dialog","aria-describedby":f(r).descriptionId,"aria-labelledby":f(r).titleId,"data-state":f(Zv)(f(r).open.value)},i.$attrs,{onDismiss:l[0]||(l[0]=c=>f(r).onOpenChange(!1)),onEscapeKeyDown:l[1]||(l[1]=c=>o("escapeKeyDown",c)),onFocusOutside:l[2]||(l[2]=c=>o("focusOutside",c)),onInteractOutside:l[3]||(l[3]=c=>o("interactOutside",c)),onPointerDownOutside:l[4]||(l[4]=c=>o("pointerDownOutside",c))}),{default:j(()=>[ee(i.$slots,"default")]),_:3},16,["id","as","as-child","disable-outside-pointer-events","aria-describedby","aria-labelledby","data-state"])]),_:3},8,["trapped"]))}}),ey=KB,YB=z({__name:"DialogContentModal",props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=Or(),a=Ua(o),{forwardRef:s,currentElement:i}=Ne();return Qc(i),(l,c)=>(_(),U(ey,Me({...n,...f(a)},{ref:f(s),"trap-focus":f(r).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:c[0]||(c[0]=u=>{var d;u.defaultPrevented||(u.preventDefault(),(d=f(r).triggerElement.value)==null||d.focus())}),onPointerDownOutside:c[1]||(c[1]=u=>{const d=u.detail.originalEvent,p=d.button===0&&d.ctrlKey===!0;(d.button===2||p)&&u.preventDefault()}),onFocusOutside:c[2]||(c[2]=u=>{u.preventDefault()})}),{default:j(()=>[ee(l.$slots,"default")]),_:3},16,["trap-focus"]))}}),JB=YB,XB=z({__name:"DialogContentNonModal",props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=Ua(e);Ne();const r=Or(),a=A(!1),s=A(!1);return(i,l)=>(_(),U(ey,Me({...n,...f(o)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:l[0]||(l[0]=c=>{var u;c.defaultPrevented||(a.value||(u=f(r).triggerElement.value)==null||u.focus(),c.preventDefault()),a.value=!1,s.value=!1}),onInteractOutside:l[1]||(l[1]=c=>{var u;c.defaultPrevented||(a.value=!0,c.detail.originalEvent.type==="pointerdown"&&(s.value=!0));const d=c.target;(u=f(r).triggerElement.value)!=null&&u.contains(d)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&s.value&&c.preventDefault()})}),{default:j(()=>[ee(i.$slots,"default")]),_:3},16))}}),QB=XB,ZB=z({__name:"DialogContent",props:{forceMount:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=Or(),a=Ua(o),{forwardRef:s}=Ne();return(i,l)=>(_(),U(f(Ii),{present:i.forceMount||f(r).open.value},{default:j(()=>[f(r).modal.value?(_(),U(JB,Me({key:0,ref:f(s)},{...n,...f(a),...i.$attrs}),{default:j(()=>[ee(i.$slots,"default")]),_:3},16)):(_(),U(QB,Me({key:1,ref:f(s)},{...n,...f(a),...i.$attrs}),{default:j(()=>[ee(i.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),eF=ZB,tF=z({__name:"DialogOverlayImpl",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=Or();return Xc(!0),Ne(),(n,o)=>(_(),U(f(an),{as:n.as,"as-child":n.asChild,"data-state":f(e).open.value?"open":"closed",style:{"pointer-events":"auto"}},{default:j(()=>[ee(n.$slots,"default")]),_:3},8,["as","as-child","data-state"]))}}),nF=tF,oF=z({__name:"DialogOverlay",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=Or(),{forwardRef:n}=Ne();return(o,r)=>{var a;return(a=f(e))!=null&&a.modal.value?(_(),U(f(Ii),{key:0,present:o.forceMount||f(e).open.value},{default:j(()=>[V(nF,Me(o.$attrs,{ref:f(n),as:o.as,"as-child":o.asChild}),{default:j(()=>[ee(o.$slots,"default")]),_:3},16,["as","as-child"])]),_:3},8,["present"])):Y("v-if",!0)}}}),rF=oF,aF=z({__name:"DialogPortal",props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(t){const e=t;return(n,o)=>(_(),U(f(tu),kn(Ro(e)),{default:j(()=>[ee(n.$slots,"default")]),_:3},16))}}),sF=aF;const iF=z({__name:"Modal",props:{open:{type:Boolean,default:!1},closeOnOverlay:{type:Boolean,default:!0},contentClass:{default:""}},emits:["onClose"],setup(t,{emit:e}){const n=e,o=a=>{n("onClose",a)},r=a=>{a||o("escape")};return(a,s)=>(_(),U(f(WB),{open:t.open,"onUpdate:open":r},{default:j(()=>[V(f(sF),{to:"body"},{default:j(()=>[V(f(rF),{class:"modal-overlay",onClick:s[0]||(s[0]=i=>t.closeOnOverlay&&o("overlay"))}),V(f(eF),{class:S(["modal-content",t.contentClass])},{default:j(()=>[ee(a.$slots,"default",{},void 0,!0)]),_:3},8,["class"])]),_:3})]),_:3},8,["open"]))}}),ty=Z(iF,[["__scopeId","data-v-1d8533fb"]]),lF=z({__name:"ReadReceiptInfo",props:{messageID:{default:""},open:{type:Boolean,default:!1},readCount:{default:0},unreadCount:{default:0},className:{default:void 0},style:{default:void 0}},emits:["onClose"],setup(t,{emit:e}){const n=t,o=e,{t:r}=ve(),a=A("read"),s=A(),i=A(),l=A([]),c=A(""),u=A(!1),d=A(!1),p=A(!1),h=A([]),m=A(""),g=A(!1),v=A(!1),b=A(!1),w=B(()=>{if(!n.messageID)throw new Error("ReadReceiptInfo::Message ID is required");return Re.getMessageModel(n.messageID)}),E=async(L="")=>{const q=w.value;if(q){L===""&&(u.value=!1),d.value=!0;try{const $=await yt.getGroupMessageReadMemberList({message:q,filter:0,cursor:L,count:100});if($.code===0&&$.data){const{isCompleted:D,cursor:G,readUserInfoList:k=[]}=$.data;c.value=G,u.value=D,L===""?l.value=k:l.value=[...l.value,...k]}}catch($){console.error("Failed to load read users:",$)}finally{d.value=!1}}},y=async(L="")=>{const q=w.value;if(q){L===""&&(g.value=!1),v.value=!0;try{const $=await yt.getGroupMessageReadMemberList({message:q,filter:1,cursor:L,count:50});if($.code===0&&$.data){const{isCompleted:D,cursor:G,unreadUserInfoList:k=[]}=$.data;m.value=G,g.value=D,L===""?h.value=k:h.value=[...h.value,...k]}}catch($){console.error("Failed to load unread users:",$)}finally{v.value=!1}}},P=()=>{l.value=[],c.value="",u.value=!1,p.value=!1},C=()=>{h.value=[],m.value="",g.value=!1,b.value=!1},T=L=>{a.value=L},M=L=>{const q=L.target,{scrollTop:$,scrollHeight:D,clientHeight:G}=q;D-$-G<50&&(a.value==="read"&&!u.value&&!d.value&&c.value?E(c.value):a.value==="unread"&&!g.value&&!v.value&&m.value&&y(m.value))},x=(L,q)=>{o("onClose",L,q)};return ce(()=>n.open,L=>{L&&(P(),C(),E(),y())}),ce([()=>n.readCount,()=>n.unreadCount],()=>{n.open&&n.messageID&&(a.value==="read"?E():y())}),ce(()=>[l.value.length,d.value],()=>{let L;return l.value.length>0&&!d.value&&(L=setTimeout(()=>{p.value=!0},50)),()=>clearTimeout(L)}),ce(()=>[h.value.length,v.value],()=>{let L;return h.value.length>0&&!v.value&&(L=setTimeout(()=>{b.value=!0},50)),()=>clearTimeout(L)}),(L,q)=>(_(),U(f(ty),{open:t.open,"content-class":"readReceiptInfo",onOnClose:x},{default:j(()=>[V(f(ae),{class:"read-receipt-info__header"},{default:j(()=>[V(f(Er),{class:"read-receipt-info__close-icon",onClick:x}),V(f(ae),{class:"read-receipt-info__title"},{default:j(()=>[ge(H(f(r)("MessageList.read_receipt_detail")),1)]),_:1})]),_:1}),V(f(ae),{class:"read-receipt-info__tabs"},{default:j(()=>[I("button",{class:S(["read-receipt-info__tab-button",{"read-receipt-info__tab-button--active":a.value==="read"}]),onClick:q[0]||(q[0]=$=>T("read"))},H(f(r)("MessageList.read"))+" ("+H(t.readCount)+") ",3),I("button",{class:S(["read-receipt-info__tab-button",{"read-receipt-info__tab-button--active":a.value==="unread"}]),onClick:q[1]||(q[1]=$=>T("unread"))},H(f(r)("MessageList.unread"))+" ("+H(t.unreadCount)+") ",3)]),_:1}),V(f(ae),{class:"read-receipt-info__content"},{default:j(()=>[a.value==="read"?(_(),U(f(ae),{key:0,ref_key:"readListRef",ref:s,class:"read-receipt-info__user-list",onScroll:M},{default:j(()=>[l.value.length===0?(_(),O(ie,{key:0},[d.value?(_(),U(f(ae),{key:0,class:"read-receipt-info__loading"},{default:j(()=>[V(f(nr),{class:"read-receipt-info__loading-icon"}),V(f(ae),{class:"read-receipt-info__loading-text"},{default:j(()=>[ge(H(f(r)("MessageList.loading")),1)]),_:1})]),_:1})):(_(),U(f(ae),{key:1,class:"read-receipt-info__empty"},{default:j(()=>[ge(H(f(r)("MessageList.no_read_members")),1)]),_:1}))],64)):(_(),O("div",{key:1,class:S(["read-receipt-info__user-list-container",{"read-receipt-info__user-list-container--visible":p.value}])},[(_(!0),O(ie,null,we(l.value,$=>(_(),U(f(ae),{key:$.userID,class:"read-receipt-info__user-item"},{default:j(()=>[V(f(ft),{src:$.avatar??"",alt:$.nick||$.userID},null,8,["src","alt"]),V(f(ae),{class:"read-receipt-info__user-item-info"},{default:j(()=>[V(f(ae),{class:"read-receipt-info__user-item-name"},{default:j(()=>[ge(H($.nick||$.userID),1)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128)),d.value?(_(),U(f(ae),{key:0,class:"read-receipt-info__loading"},{default:j(()=>[V(f(nr),{class:"read-receipt-info__loading-icon"}),V(f(ae),{class:"read-receipt-info__loading-text"},{default:j(()=>[ge(H(f(r)("MessageList.loading")),1)]),_:1})]),_:1})):Y("",!0),u.value?(_(),U(f(ae),{key:1,class:"read-receipt-info__list-end"},{default:j(()=>[ge(H(f(r)("MessageList.no_more")),1)]),_:1})):Y("",!0)],2))]),_:1},512)):Y("",!0),a.value==="unread"?(_(),U(f(ae),{key:1,ref_key:"unreadListRef",ref:i,class:"read-receipt-info__user-list",onScroll:M},{default:j(()=>[h.value.length===0?(_(),O(ie,{key:0},[v.value?(_(),U(f(ae),{key:0,class:"read-receipt-info__loading"},{default:j(()=>[V(f(nr),{class:"read-receipt-info__loading-icon"}),V(f(ae),{class:"read-receipt-info__loading-text"},{default:j(()=>[ge(H(f(r)("MessageList.loading")),1)]),_:1})]),_:1})):(_(),U(f(ae),{key:1,class:"read-receipt-info__empty"},{default:j(()=>[ge(H(f(r)("MessageList.no_unread_members")),1)]),_:1}))],64)):(_(),O("div",{key:1,class:S(["read-receipt-info__user-list-container",{"read-receipt-info__user-list-container--visible":b.value}])},[(_(!0),O(ie,null,we(h.value,$=>(_(),U(f(ae),{key:$.userID,class:"read-receipt-info__user-item"},{default:j(()=>[V(f(ft),{src:$.avatar??"",alt:$.nick||$.userID},null,8,["src","alt"]),V(f(ae),{class:"read-receipt-info__user-item-info"},{default:j(()=>[V(f(ae),{class:"read-receipt-info__user-item-name"},{default:j(()=>[ge(H($.nick||$.userID),1)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128)),v.value?(_(),U(f(ae),{key:0,class:"read-receipt-info__loading"},{default:j(()=>[V(f(nr),{class:"read-receipt-info__loading-icon"}),V(f(ae),{class:"read-receipt-info__loading-text"},{default:j(()=>[ge(H(f(r)("MessageList.loading")),1)]),_:1})]),_:1})):Y("",!0),g.value?(_(),U(f(ae),{key:1,class:"read-receipt-info__list-end"},{default:j(()=>[ge(H(f(r)("MessageList.no_more")),1)]),_:1})):Y("",!0)],2))]),_:1},512)):Y("",!0)]),_:1})]),_:1},8,["open"]))}}),cF=Z(lF,[["__scopeId","data-v-ecd91a73"]]),jr=new Map,Fc="AUDIO_PLAY_EVENT",uF=t=>new CustomEvent(Fc,{detail:{audioId:t}});function dF(t){const{url:e}=t,n=t.audioId||`audio-${e}`,o=A(!1),r=A(0),a=A(void 0),s=A(!0),i=A(null),l=()=>{i.value&&(window.dispatchEvent(uF(n)),i.value.play(),o.value=!0)},c=()=>{i.value&&(i.value.pause(),o.value=!1)},u=()=>{i.value&&(i.value.pause(),i.value.currentTime=0,o.value=!1,r.value=0)},d=g=>{if(!i.value||a.value===void 0)return;const v=Math.max(0,Math.min(1,g));i.value.currentTime=a.value*v,r.value=v},p=()=>{!i.value||!a.value||(r.value=i.value.currentTime/a.value)},h=()=>{o.value=!1,r.value=0},m=g=>{g.detail.audioId!==n&&o.value&&c()};return qe(()=>{window.addEventListener(Fc,m);let g=jr.get(n);const v=()=>{g&&(g.duration===1/0?(g.currentTime=1e101,g.ontimeupdate=()=>{g&&(a.value=g.duration,g.ontimeupdate=null,g.currentTime=0)}):a.value=g.duration,s.value=!1)},b=()=>{console.error("Audio load error:",e),s.value=!1};!g||g.src!==e?(s.value=!0,a.value=void 0,g&&(g.pause(),g.src="",g.load(),g.removeEventListener("loadedmetadata",v),g.removeEventListener("error",b),g.removeEventListener("timeupdate",p),g.removeEventListener("ended",h)),g=new Audio(e),g.addEventListener("loadedmetadata",v),g.addEventListener("error",b),g.addEventListener("timeupdate",p),g.addEventListener("ended",h),jr.set(n,g),i.value=g,o.value=!1,r.value=0):(i.value=g,g.removeEventListener("timeupdate",p),g.removeEventListener("ended",h),g.addEventListener("timeupdate",p),g.addEventListener("ended",h),g.duration&&(a.value=g.duration,s.value=!1))}),st(()=>{if(window.removeEventListener(Fc,m),jr.has(n)){const g=jr.get(n);g.removeEventListener("timeupdate",p),g.removeEventListener("ended",h),g.pause(),g.src="",g.load(),jr.delete(n)}}),{isPlaying:o,progress:r,duration:a,isLoading:s,play:l,pause:c,stop:u,setProgress:d}}const pF={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},hF={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"play-button__play-icon"},fF=z({__name:"PlayButton",props:{isPlaying:{type:Boolean}},emits:["click"],setup(t,{emit:e}){const n=e,o=()=>{n("click")};return(r,a)=>(_(),O("button",{class:S(["play-button",{"play-button--playing":t.isPlaying}]),onClick:o},[t.isPlaying?(_(),O("svg",pF,[...a[0]||(a[0]=[I("rect",{x:"6",y:"4",width:"4",height:"16"},null,-1),I("rect",{x:"14",y:"4",width:"4",height:"16"},null,-1)])])):(_(),O("svg",hF,[...a[1]||(a[1]=[I("polygon",{points:"5 3 19 12 5 21 5 3"},null,-1)])]))],2))}}),mF=Z(fF,[["__scopeId","data-v-9309cd38"]]),gF=z({__name:"WaveForm",props:{progress:{},barsCount:{default:30},width:{default:"100%"}},emits:["seek"],setup(t,{emit:e}){const n=t,o=e,r=B(()=>({width:typeof n.width=="number"?`${n.width}px`:n.width})),a=Array.from({length:n.barsCount},()=>Math.random()*16+4),s=B(()=>{const l=n.progress||0;return l===0?Array(n.barsCount).fill(!1):Array.from({length:n.barsCount},(c,u)=>{const d=u/n.barsCount;return l>=d})}),i=l=>{const c=l.currentTarget.getBoundingClientRect(),u=(l.clientX-c.left)/c.width,d=Math.max(0,Math.min(1,u));o("seek",d)};return(l,c)=>(_(),O("div",{class:"wave-form",style:De(r.value),onClick:i},[(_(!0),O(ie,null,we(f(a),(u,d)=>(_(),O("div",{key:d,class:S(["wave-form__bar",{"wave-form__bar--active":s.value[d]}]),style:De({height:`${u}px`})},null,6))),128))],4))}}),vF=Z(gF,[["__scopeId","data-v-93c67ced"]]),yF=z({__name:"AudioMessage",props:{message:{}},setup(t){const e=t,n=B(()=>e.message.getMessageContent()),o=B(()=>{const d=n.value.second;return d<=5?10:d<=10?14:18}),r=B(()=>`audio-${e.message.ID}`),{isPlaying:a,progress:s,play:i,pause:l,setProgress:c}=dF({url:n.value.url,audioId:r.value}),u=d=>{const p=Math.floor(d/60),h=Math.floor(d%60);return`${p.toString().padStart(2,"0")}:${h.toString().padStart(2,"0")}`};return(d,p)=>(_(),U(f(ae),{class:"audio-message"},{default:j(()=>[V(f(ae),{class:"audio-message__content"},{default:j(()=>[V(mF,{"is-playing":f(a),onClick:p[0]||(p[0]=h=>f(a)?f(l)():f(i)())},null,8,["is-playing"]),V(vF,{progress:f(s),"bars-count":o.value,onSeek:f(c)},null,8,["progress","bars-count","onSeek"]),V(f(ae),{class:"audio-message__duration"},{default:j(()=>[ge(H(u(n.value.second)),1)]),_:1})]),_:1})]),_:1}))}}),_F=Z(yF,[["__scopeId","data-v-b2418d6b"]]),bF=z({__name:"CallMessage",props:{message:{}},setup(t){const e=t,{t:n}=ve(),o=qt(),{activeConversation:r}=Rt(),a=B(()=>Zu(e.message,n)),s=B(()=>_v(e.message)),i=()=>{var l;!r.value||!s.value||e.message.conversationType===Ge.GROUP||Pa({type:s.value.data.data.call_type,userIDList:[(l=r.value.userProfile)==null?void 0:l.userID]})};return(l,c)=>e.message.conversationType===f(Ge).C2C?(_(),U(f(ae),{key:0,gap:8,dir:"row",class:S(f(o)["call-message-c2c"]),onClick:i},{default:j(()=>{var u;return[((u=s.value)==null?void 0:u.data.data.call_type)===1?(_(),U(f(Ly),{key:0,class:S(f(o)["call-message-c2c__icon"])},null,8,["class"])):(_(),U(f(Uy),{key:1,class:S(f(o)["call-message-c2c__icon"])},null,8,["class"])),ge(" "+H(a.value),1)]}),_:1},8,["class"])):(_(),U(f(ae),{key:1,class:S(f(o)["call-message-group"])},{default:j(()=>[ge(H(a.value),1)]),_:1},8,["class"]))}}),wF={"call-message-c2c":"_call-message-c2c_u2zzk_1","call-message-c2c__icon":"_call-message-c2c__icon_u2zzk_7","call-message-group":"_call-message-group_u2zzk_11"},SF={$style:wF},kF=Z(bF,[["__cssModules",SF]]),EF=["href"],CF=z({__name:"CustomMessage",props:{message:{}},setup(t){const e=t,n=qt(),o=B(()=>Wn(e.message)),r=B(()=>{try{const a=e.message.payload,s=JSON.parse((a==null?void 0:a.data)||"{}");if((s==null?void 0:s.businessID)==="text_link"){const{text:i,link:l}=s;return{text:i,link:l}}return null}catch{return null}});return(a,s)=>o.value?(_(),U(f(kF),{key:0,message:e.message,class:S(f(n)["custom-message"])},null,8,["message","class"])):r.value?(_(),U(f(ae),{key:1,class:S(f(n)["custom-message"])},{default:j(()=>[I("div",null,H(r.value.text),1),I("a",{href:r.value.link},"read more >>>",8,EF)]),_:1},8,["class"])):(_(),O("div",{key:2,class:S(f(n)["custom-message"])}," [custom message] ",2))}}),MF={"custom-message":"_custom-message_a7uj7_1"},$F={$style:MF},TF=Z(CF,[["__cssModules",$F]]),IF=["src","alt"],AF=z({__name:"FaceMessage",props:{message:{default:()=>({})}},setup(t){const e={url:"https://web.sdk.qcloud.com/im/assets/face-elem/yz13@2x.png",name:"yz13@2x"};return(n,o)=>(_(),O("div",{class:S(f(ke)("face-message"))},[I("img",{src:e.url,alt:e.name},null,8,IF)],2))}}),xF=Z(AF,[["__scopeId","data-v-eb892ba9"]]),OF=z({__name:"FileMessage",props:{message:{default:()=>({})}},setup(t){const{t:e}=ve(),n=t,o=B(()=>n.message.getMessageContent()),r=async a=>{if(a.metaKey||a.ctrlKey)window.open(o.value.url,"_blank");else try{a.preventDefault();const s=await fetch(o.value.url);if(!s.ok)throw new Error("Download failed");const i=await s.blob(),l=window.URL.createObjectURL(i),c=document.createElement("a");c.href=l,c.download=o.value.name,c.click(),window.URL.revokeObjectURL(l)}catch{ut.error({message:e("MessageList.download_failed")})}};return(a,s)=>(_(),U(f(ae),{class:S(f(ke)("file-message")),onClick:r},{default:j(()=>[V(f(ae),{class:"file-message__icon"},{default:j(()=>[V(f(Gh))]),_:1}),V(f(ae),{class:"file-message__middle"},{default:j(()=>[V(f(ae),{class:"file-message__name"},{default:j(()=>[ge(H(o.value.name),1)]),_:1}),V(f(ae),{class:"file-message__size"},{default:j(()=>[ge(H(o.value.size),1)]),_:1})]),_:1}),V(f(ae),{class:"file-message__download"},{default:j(()=>[V(f(By))]),_:1})]),_:1},8,["class"]))}}),RF=Z(OF,[["__scopeId","data-v-10a5779a"]]),Rh=z({__name:"GroupTipMessage",props:{message:{}},setup(t){const e=t,{t:n}=ve(),o=e.message.getMessageContent(),r=B(()=>o.businessID==="group_create"?`${o.showName||""} ${n("MessageList.create_group")}`:Wn(e.message)&&e.message.conversationType===Ge.GROUP?Zu(e.message,n):Pv(e.message).text);return(a,s)=>(_(),O("div",{class:S(f(ke)("group-tip-message"))},H(r.value),3))}}),PF={class:"image-preview__content"},DF={class:"image-preview__inner"},NF={class:"image-preview__viewport"},LF=["src","alt"],UF={key:1,class:"image-preview__error"},BF=.5,FF=3,jF=z({inheritAttrs:!1,__name:"ImagePreview",props:{open:{type:Boolean},src:{},alt:{}},emits:["close"],setup(t,{emit:e}){const n=t,o=e,r=A(1),a=A({x:0,y:0}),s=A(!1),i=A({x:0,y:0}),l=A(!1);let c=null,u=1;function d(x){return Math.min(FF,Math.max(BF,x))}function p(){r.value=1,a.value={x:0,y:0}}function h(){o("close"),p()}function m(){l.value=!0}function g(x){x.preventDefault();const L=x.deltaY>0?-.2:.2,q=d(r.value+L);r.value=q}function v(){r.value=r.value===1?2:1,r.value===1&&(a.value={x:0,y:0})}function b(x){var L;s.value=!0,i.value={x:x.clientX,y:x.clientY},(L=x.target)==null||L.setPointerCapture(x.pointerId)}function w(x){if(!s.value)return;const L=x.clientX-i.value.x,q=x.clientY-i.value.y;a.value={x:a.value.x+L,y:a.value.y+q},i.value={x:x.clientX,y:x.clientY}}function E(x){var L;s.value=!1,(L=x.target)==null||L.releasePointerCapture(x.pointerId)}function y(x){if(x.length<2)return null;const[L,q]=[x[0],x[1]],$=L.clientX-q.clientX,D=L.clientY-q.clientY;return Math.hypot($,D)}function P(x){x.touches.length===2&&(c=y(x.touches),u=r.value)}function C(x){if(x.touches.length===2&&c){x.preventDefault();const L=y(x.touches);if(!L)return;const q=L/c;r.value=d(u*q)}}function T(){c=null}function M(x){x.key==="Escape"&&h()}return ce(()=>n.open,x=>{x||(p(),l.value=!1)}),qe(()=>{window.addEventListener("keydown",M)}),st(()=>{window.removeEventListener("keydown",M)}),(x,L)=>(_(),U(qc,{to:"body"},[t.open?(_(),O("div",Me({key:0,class:"image-preview"},x.$attrs),[I("div",{class:"image-preview__mask",onClick:h}),I("button",{class:"image-preview__close",type:"button","aria-label":"Close preview",onClick:h}),I("div",PF,[I("div",DF,[I("div",NF,[I("div",{class:S(f(ke)("image-preview__img-wrap",{"image-preview__img-wrap--error":l.value}))},[l.value?(_(),O("div",UF,[...L[0]||(L[0]=[I("div",{class:"image-preview__error-icon"},null,-1),I("span",{class:"image-preview__error-text"},"Preview failed",-1)])])):(_(),O("img",{key:0,src:t.src,alt:t.alt||"image preview",style:De({transform:`translate3d(${a.value.x}px, ${a.value.y}px, 0) scale(${r.value})`}),class:"image-preview__img",draggable:"false",onError:m,onWheel:yn(g,["prevent"]),onDblclick:yn(v,["prevent"]),onPointerdown:b,onPointermove:w,onPointerup:E,onPointercancel:E,onTouchstartPassive:P,onTouchmove:yn(C,["prevent"]),onTouchend:T,onTouchcancel:T},null,44,LF))],2)])])])],16)):Y("",!0)]))}}),GF=Z(jF,[["__scopeId","data-v-31cf7b43"]]),qF={key:0,class:"image-placeholder"},HF={key:1,class:"image-error"},VF=["alt"],Is=320,Ph=50,Vl=4/3,zF=z({inheritAttrs:!1,__name:"ImageMessage",props:{message:{},isLastMessage:{type:Boolean,default:!1}},setup(t){const e=t,n=B(()=>e.message.getMessageContent()),o=C=>{if(C.startsWith("blob:"))return"loading";const T=new Image;return T.src=C,T.complete&&T.naturalWidth>0?"loaded":"loading"},r=A(o(n.value.url)),a=A(n.value.width&&n.value.height?{width:n.value.width,height:n.value.height,aspectRatio:n.value.width/n.value.height}:null),s=A(null),i=A(null);let l=null;const c=A(!1);let u=null;const d=B(()=>n.value.url.startsWith("blob")),p=C=>new Promise((T,M)=>{const x=new Image;x.onload=()=>{T({width:x.naturalWidth,height:x.naturalHeight})},x.onerror=M,x.src=C}),h=B(()=>{if(!a.value)return{height:Is,width:Is*Vl,aspectRatio:Vl};const{width:C,height:T,aspectRatio:M}=a.value;let x=C,L=T;return L>Is&&(L=Is,x=L*M),L<Ph&&(L=Ph,x=L*M),{width:x,height:L,aspectRatio:M}}),m=async()=>{if(await Fe(),!!s.value){if(r.value==="loaded"){s.value.src=n.value.url;return}l=new IntersectionObserver(C=>{C[0].isIntersecting&&(s.value&&(s.value.src=n.value.url),l&&l.disconnect())},{threshold:.1}),l.observe(s.value)}},g=async()=>{if(d.value&&!a.value)try{const C=await p(n.value.url);C&&(a.value={width:C.width,height:C.height,aspectRatio:C.width/C.height})}catch{a.value={width:400,height:300,aspectRatio:Vl}}},v=C=>{const T=C.target;(!a.value||d.value)&&(a.value={width:T.naturalWidth,height:T.naturalHeight,aspectRatio:T.naturalWidth/T.naturalHeight}),r.value="loaded"},b=()=>{r.value="error"};function w(){r.value==="loaded"&&n.value.url&&(c.value=!0)}function E(){c.value=!1}function y(){typeof document>"u"||(u=document.body.style.overflow,document.body.style.overflow="hidden")}function P(){typeof document>"u"||u!==null&&(document.body.style.overflow=u,u=null)}return ce(()=>n.value.url,()=>{r.value=o(n.value.url),a.value=n.value.width&&n.value.height?{width:n.value.width,height:n.value.height,aspectRatio:n.value.width/n.value.height}:null,m(),g()}),ce(c,C=>{C?y():P()}),qe(()=>{m(),g()}),st(()=>{l&&l.disconnect(),P()}),(C,T)=>(_(),O(ie,null,[I("div",Me({ref_key:"containerRef",ref:i},C.$attrs,{class:f(ke)("image-message",{"image-message--loading":r.value==="loading","image-message--error":r.value==="error","image-message--loaded":r.value==="loaded"}),style:{width:`${h.value.width}px`,height:`${h.value.height}px`,aspectRatio:`${h.value.aspectRatio}`},role:"button",tabindex:"0",onClick:w}),[r.value==="loading"?(_(),O("div",qF)):Y("",!0),r.value==="error"?(_(),O("div",HF,[...T[0]||(T[0]=[I("div",{class:"image-error__icon"},null,-1),I("span",{class:"image-error__text"},"Load failed",-1)])])):(_(),O("img",{key:2,ref_key:"imageRef",ref:s,class:S(f(ke)("image",{"image--visible":r.value==="loaded"})),alt:n.value.showName||"image message",loading:"lazy",onLoad:v,onError:b},null,42,VF))],16),V(GF,{open:c.value,src:n.value.url,alt:n.value.showName||"image message preview",onClose:E},null,8,["open","src","alt"])],64))}}),WF=Z(zF,[["__scopeId","data-v-6babc4a1"]]),KF={};function YF(t,e){return _(),O("div",null," [undefined location Message] ")}const JF=Z(KF,[["render",YF]]),XF={};function QF(t,e){return _(),O("div",null,"undefined merger Message")}const ZF=Z(XF,[["render",QF]]),ej=z({__name:"RecalledMessage",props:{message:{},class:{default:void 0},style:{default:void 0}},setup(t){const e=t,{t:n}=ve(),{setContent:o,focusEditor:r}=eo(),a=B(()=>e.message.type===ue.TEXT),s=B(()=>e.message.flow==="out"),i=B(()=>e.message.nick||e.message.from||"");function l(){const c=e.message.payload.text;o(c),r()}return(c,u)=>(_(),U(f(ae),{class:S(f(ke)("recalled-message",e.class)),style:De(e.style)},{default:j(()=>[s.value?(_(),O(ie,{key:0},[ge(H(`${f(n)("MessageList.you")} ${f(n)("MessageList.recalled_a_message")}`)+" ",1),a.value?(_(),U(f(ae),{key:0,role:"button",class:"recalled-message__button",onClick:l},{default:j(()=>[ge(H(f(n)("MessageList.reedit")),1)]),_:1})):Y("",!0)],64)):(_(),O(ie,{key:1},[ge(H(`${i.value} ${f(n)("MessageList.recalled_a_message")}`),1)],64))]),_:1},8,["class","style"]))}}),tj=Z(ej,[["__scopeId","data-v-63c123ed"]]),nj=(t,e)=>{const n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),r=n.top>=o.top&&n.top<=o.bottom,a=n.bottom>=o.top&&n.bottom<=o.bottom,s=n.top<=o.top&&n.bottom>=o.bottom;return r||a||s},ny=()=>({scrollToBottom:(t={})=>new Promise(e=>{const n=document.querySelector("#messageScrollList");if(!n){e();return}const o={behavior:"instant",block:"end",...t},r=o.behavior==="instant"?"auto":o.behavior||"auto";requestAnimationFrame(()=>{if(n.scrollTo({top:n.scrollHeight,behavior:r}),r==="smooth"){const a=()=>{n.removeEventListener("scrollend",a),setTimeout(()=>{n.scrollTo({top:n.scrollHeight,behavior:"auto"}),e()},100)};"onscrollend"in window?n.addEventListener("scrollend",a):setTimeout(()=>{n.scrollTo({top:n.scrollHeight,behavior:"auto"}),e()},500)}else e()})}),scrollToMessage:(t,e={})=>new Promise((n,o)=>{const r=document.querySelector(`[data-message-id="${t}"]`),a=document.querySelector("#messageScrollList");if(!r||!a){o(new Error("Target message or scrollable container not found"));return}if(e.skipIfVisible&&nj(r,a)){n();return}const s={behavior:"smooth",block:"center",...e},i=s.behavior==="instant"?"auto":s.behavior,l=r.offsetTop;let c=l;s.block==="center"?c=l-(a.clientHeight-r.clientHeight)/2:s.block==="end"&&(c=l+r.clientHeight-a.clientHeight),c=Math.max(0,Math.min(c,a.scrollHeight-a.clientHeight)),requestAnimationFrame(()=>{if(a.scrollTo({top:c,behavior:i}),i==="smooth"){const u=()=>{a.removeEventListener("scrollend",u),n()};"onscrollend"in window?a.addEventListener("scrollend",u):setTimeout(()=>{n()},500)}else n()})})}),oj={key:0,class:"text-message__content__text"},rj=["src","alt"],aj=z({__name:"TextMessage",props:{message:{default:()=>({})}},setup(t){const e=t,{t:n}=ve(),{scrollToMessage:o}=ny(),{highlightMessageIDSet:r,recalledMessageIDSet:a,highlightMessage:s}=Fa(),i=B(()=>e.message.getMessageContent()),l=B(()=>{var d,p,h,m;const g=xo((d=e.message)==null?void 0:d.cloudCustomData,{}),v=((p=g==null?void 0:g.messageReply)==null?void 0:p.messageAbstract)||"",b=((h=g==null?void 0:g.messageReply)==null?void 0:h.messageSender)||"",w=((m=g==null?void 0:g.messageReply)==null?void 0:m.messageID)||"";return{content:v,sender:b,messageID:w}}),c=B(()=>a.value.has(l.value.messageID)),u=()=>{if(l.value.messageID){const{messageID:d}=l.value,p=Re.getMessageModel(d);if(c.value||!p||p.isDeleted||p.isRevoked){ut.error({message:n("MessageList.origin_message_has_been_recalled")});return}r.value.has(d)||s({messageID:d,duration:3e3}),o(d,{block:"center",skipIfVisible:!0,behavior:"instant"}).catch(()=>{})}};return(d,p)=>(_(),U(f(ae),{class:"text-message"},{default:j(()=>[l.value.content?(_(),U(f(ae),{key:0,class:S(f(ke)("text-message__reference",{"text-danger":c.value})),onClick:u},{default:j(()=>[c.value?(_(),O(ie,{key:0},[ge(H(f(n)("MessageList.origin_message_has_been_recalled")),1)],64)):(_(),O(ie,{key:1},[V(f(ae),{class:"text-message__reference__header"},{default:j(()=>[ge(H(l.value.sender),1)]),_:1}),V(f(ae),{class:"text-message__reference__content"},{default:j(()=>[ge(H(l.value.content),1)]),_:1})],64))]),_:1},8,["class"])):Y("",!0),V(f(ae),{class:"text-message__content"},{default:j(()=>[(_(!0),O(ie,null,we(i.value.text,(h,m)=>(_(),O(ie,{key:m},[h.name==="text"?(_(),O("span",oj,H(h.text),1)):(_(),O("img",{key:1,class:"text-message__content__img",src:h.src,alt:h.emojiKey||""},null,8,rj))],64))),128))]),_:1})]),_:1}))}}),sj=Z(aj,[["__scopeId","data-v-222fe9af"]]),ij={key:0,class:"video-placeholder"},lj=["src","poster"],cj=z({__name:"VideoMessage",props:{message:{default:()=>({})},isLastInChunk:{type:Boolean,default:!1}},setup(t){const e=t,n=(u,d)=>u===200&&d===200,o=B(()=>e.message.getMessageContent()),r=A(null),a=A(!1),s=B(()=>{if(r.value)return r.value;const u=o.value;return n(u.snapshotWidth,u.snapshotHeight)?null:u.snapshotWidth&&u.snapshotHeight?{height:u.snapshotHeight,aspectRatio:u.snapshotWidth/u.snapshotHeight}:null}),i=B(()=>{if(!s.value)return{height:200,aspectRatio:.75};const{aspectRatio:u}=s.value;return u>1?{aspectRatio:u,height:200}:{aspectRatio:u,height:300}}),l=B(()=>e.message.flow==="out"),c=u=>{const d=u.target;r.value={aspectRatio:d.videoWidth/d.videoHeight,height:d.videoHeight},a.value=!0};return ce(()=>e.message.ID,()=>{a.value=!1,r.value=null}),(u,d)=>(_(),U(f(ae),{class:S(f(ke)("video-message",{"video-message--last--self":l.value&&t.isLastInChunk,"video-message--last--other":!l.value&&t.isLastInChunk,"video-message--loaded":a.value})),style:De({maxHeight:`${i.value.height}px`,aspectRatio:s.value?`${i.value.aspectRatio}`:"auto",width:a.value?void 0:`${i.value.height*i.value.aspectRatio}px`})},{default:j(()=>[a.value?Y("",!0):(_(),O("div",ij)),I("video",{class:"video-message__video",src:o.value.url,poster:o.value.snapshotUrl,controls:"",muted:"",autoplay:!1,onLoadedmetadata:c},null,40,lj)]),_:1},8,["class","style"]))}}),uj=Z(cj,[["__scopeId","data-v-a02e7d43"]]),Dh={copy:{key:"copy",label:"copy",visible:t=>t.type===ue.TEXT,icon:Hy},recall:{key:"recall",label:"recall",visible:t=>!Wn(t)&&t.flow==="out"&&t.status==="success"&&Date.now()-t.time*1e3<120*1e3,icon:qy},quote:{key:"quote",label:"quote",visible:t=>!Wn(t),icon:Gy},forward:{key:"forward",label:"forward",visible:t=>!Wn(t),icon:jy},delete:{key:"delete",label:"delete",icon:Fy,visible:!0,style:{color:"var(--text-color-error)"}}},dj=["copy","recall","quote","forward","delete"];function pj(t){const e=td(),n={copy:r=>{e.copyTextMessage(r).then(()=>ut.success({message:nt.t("MessageList.copy_success")})).catch(()=>ut.error({message:nt.t("MessageList.copy_failed")}))},recall:r=>{e.recallMessage(r).then(()=>ut.success({message:nt.t("MessageList.recall_success")})).catch(a=>ut.error({message:a.code===20016?nt.t("MessageList.recall_time_limit_exceeded"):nt.t("MessageList.recall_failed")}))},quote:e.quoteMessage,forward:r=>{e.setForwardMessageIDList([r.ID]),e.setIsForwardMessageSelectionDone(!0)},delete:r=>{e.deleteMessage(r).then(()=>ut.success({message:nt.t("MessageList.delete_success")})).catch(()=>ut.error({message:nt.t("MessageList.delete_failed")}))}},o=dj.map(r=>typeof r=="string"?{...Dh[r],onClick:n[r]}:{...Dh[r.key]||{},...r,onClick:r.onClick||n[r.key]});return B(()=>o).value}const hj=["INPUT","TEXTAREA"];function Nh(t,e,n,o={}){if(!e||o.enableIgnoredElement&&hj.includes(e.nodeName))return null;const{arrowKeyOptions:r="both",attributeName:a="[data-reka-collection-item]",itemsArray:s=[],loop:i=!0,dir:l="ltr",preventScroll:c=!0,focus:u=!1}=o,[d,p,h,m,g,v]=[t.key==="ArrowRight",t.key==="ArrowLeft",t.key==="ArrowUp",t.key==="ArrowDown",t.key==="Home",t.key==="End"],b=h||m,w=d||p;if(!g&&!v&&(!b&&!w||r==="vertical"&&w||r==="horizontal"&&b))return null;const E=n?Array.from(n.querySelectorAll(a)):s;if(!E.length)return null;c&&t.preventDefault();let y=null;return w||b?y=oy(E,e,{goForward:b?m:l==="ltr"?d:p,loop:i}):g?y=E.at(0)||null:v&&(y=E.at(-1)||null),u&&(y==null||y.focus()),y}function oy(t,e,n,o=t.includes(e)?t.length:t.length+1){if(--o===0)return null;const r=t.indexOf(e);let a;if(r===-1?a=n.goForward?0:t.length-1:a=n.goForward?r+1:r-1,!n.loop&&(a<0||a>=t.length))return null;const s=(a+t.length)%t.length,i=t[s];return i?i.hasAttribute("disabled")&&i.getAttribute("disabled")!=="false"?oy(t,i,n,o):i:null}function ld(t){const e=hf({dir:A("ltr")});return B(()=>{var n;return(t==null?void 0:t.value)||((n=e.dir)==null?void 0:n.value)||"ltr"})}function fj(t){const e=Lw("",1e3);return{search:e,handleTypeaheadSearch:(n,o)=>{e.value=e.value+n;{const r=Qe(),a=o.map(u=>{var d,p;return{...u,textValue:((d=u.value)==null?void 0:d.textValue)??((p=u.ref.textContent)==null?void 0:p.trim())??""}}),s=a.find(u=>u.ref===r),i=a.map(u=>u.textValue),l=gj(i,e.value,s==null?void 0:s.textValue),c=a.find(u=>u.textValue===l);return c&&c.ref.focus(),c==null?void 0:c.ref}},resetTypeahead:()=>{e.value=""}}}function mj(t,e){return t.map((n,o)=>t[(e+o)%t.length])}function gj(t,e,n){const o=e.length>1&&Array.from(e).every(i=>i===e[0])?e[0]:e,r=n?t.indexOf(n):-1;let a=mj(t,Math.max(r,0));o.length===1&&(a=a.filter(i=>i!==n));const s=a.find(i=>i.toLowerCase().startsWith(o.toLowerCase()));return s!==n?s:void 0}function Lh(){const t=A(),e=B(()=>{var n,o;return["#text","#comment"].includes((n=t.value)==null?void 0:n.$el.nodeName)?(o=t.value)==null?void 0:o.$el.nextElementSibling:Mr(t)});return{primitiveElement:t,currentElement:e}}const Uh="data-reka-collection-item";function ry(t={}){const{key:e="",isProvider:n=!1}=t,o=`${e}CollectionProvider`;let r;if(n){const u=A(new Map);r={collectionRef:A(),itemMap:u},Vc(o,r)}else r=Hc(o);const a=(u=!1)=>{const d=r.collectionRef.value;if(!d)return[];const p=Array.from(d.querySelectorAll(`[${Uh}]`)),h=Array.from(r.itemMap.value.values()).sort((m,g)=>p.indexOf(m.ref)-p.indexOf(g.ref));return u?h:h.filter(m=>m.ref.dataset.disabled!=="")},s=z({name:"CollectionSlot",inheritAttrs:!1,setup(u,{slots:d,attrs:p}){const{primitiveElement:h,currentElement:m}=Lh();return ce(m,()=>{r.collectionRef.value=m.value}),()=>he(Xl,{ref:h,...p},d)}}),i=z({name:"CollectionItem",inheritAttrs:!1,props:{value:{validator:()=>!0}},setup(u,{slots:d,attrs:p}){const{primitiveElement:h,currentElement:m}=Lh();return Wt(g=>{if(m.value){const v=zc(m.value);r.itemMap.value.set(v,{ref:m.value,value:u.value}),g(()=>r.itemMap.value.delete(v))}}),()=>he(Xl,{...p,[Uh]:"",ref:h},d)}}),l=B(()=>Array.from(r.itemMap.value.values())),c=B(()=>r.itemMap.value.size);return{getItems:a,reactiveItems:l,itemMapSize:c,CollectionSlot:s,CollectionItem:i}}const vj="rovingFocusGroup.onEntryFocus",yj={bubbles:!1,cancelable:!0};function _j(t,e=!1){const n=Qe();for(const o of t)if(o===n||(o.focus({preventScroll:e}),Qe()!==n))return}const[yq,bj]=dn("RovingFocusGroup");var wj=z({__name:"RovingFocusGroup",props:{orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!1},currentTabStopId:{type:[String,null],required:!1},defaultCurrentTabStopId:{type:String,required:!1},preventScrollOnEntryFocus:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["entryFocus","update:currentTabStopId"],setup(t,{expose:e,emit:n}){const o=t,r=n,{loop:a,orientation:s,dir:i}=rn(o),l=ld(i),c=Ti(o,"currentTabStopId",r,{defaultValue:o.defaultCurrentTabStopId,passive:o.currentTabStopId===void 0}),u=A(!1),d=A(!1),p=A(0),{getItems:h,CollectionSlot:m}=ry({isProvider:!0});function g(b){const w=!d.value;if(b.currentTarget&&b.target===b.currentTarget&&w&&!u.value){const E=new CustomEvent(vj,yj);if(b.currentTarget.dispatchEvent(E),r("entryFocus",E),!E.defaultPrevented){const y=h().map(x=>x.ref).filter(x=>x.dataset.disabled!==""),P=y.find(x=>x.getAttribute("data-active")===""),C=y.find(x=>x.getAttribute("data-highlighted")===""),T=y.find(x=>x.id===c.value),M=[P,C,T,...y].filter(Boolean);_j(M,o.preventScrollOnEntryFocus)}}d.value=!1}function v(){setTimeout(()=>{d.value=!1},1)}return e({getItems:h}),bj({loop:a,dir:l,orientation:s,currentTabStopId:c,onItemFocus:b=>{c.value=b},onItemShiftTab:()=>{u.value=!0},onFocusableItemAdd:()=>{p.value++},onFocusableItemRemove:()=>{p.value--}}),(b,w)=>(_(),U(f(m),null,{default:j(()=>[V(f(an),{tabindex:u.value||p.value===0?-1:0,"data-orientation":f(s),as:b.as,"as-child":b.asChild,dir:f(l),style:{outline:"none"},onMousedown:w[0]||(w[0]=E=>d.value=!0),onMouseup:v,onFocus:g,onBlur:w[1]||(w[1]=E=>u.value=!1)},{default:j(()=>[ee(b.$slots,"default")]),_:3},8,["tabindex","data-orientation","as","as-child","dir"])]),_:3}))}}),Sj=wj,kj=z({__name:"MenuAnchor",props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=t;return(n,o)=>(_(),U(f(nu),kn(Ro(e)),{default:j(()=>[ee(n.$slots,"default")]),_:3},16))}}),Ej=kj;function Cj(){const t=A(!1);return qe(()=>{Hs("keydown",()=>{t.value=!0},{capture:!0,passive:!0}),Hs(["pointerdown","pointermove"],()=>{t.value=!1},{capture:!0,passive:!0})}),t}const Mj=mf(Cj),[rl,$j]=dn(["MenuRoot","MenuSub"],"MenuContext"),[cd,Tj]=dn("MenuRoot");var Ij=z({__name:"MenuRoot",props:{open:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},modal:{type:Boolean,required:!1,default:!0}},emits:["update:open"],setup(t,{emit:e}){const n=t,o=e,{modal:r,dir:a}=rn(n),s=ld(a),i=Ti(n,"open",o),l=A(),c=Mj();return $j({open:i,onOpenChange:u=>{i.value=u},content:l,onContentChange:u=>{l.value=u}}),Tj({onClose:()=>{i.value=!1},isUsingKeyboardRef:c,dir:s,modal:r}),(u,d)=>(_(),U(f(kf),null,{default:j(()=>[ee(u.$slots,"default")]),_:3}))}}),Aj=Ij;const[ay,xj]=dn("MenuContent");var Oj=z({__name:"MenuContentImpl",props:zh({loop:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},disableOutsideScroll:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},{...Pf}),emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","entryFocus","openAutoFocus","closeAutoFocus","dismiss"],setup(t,{emit:e}){const n=t,o=e,r=rl(),a=cd(),{trapFocus:s,disableOutsidePointerEvents:i,loop:l}=rn(n);bf(),Xc(i.value);const c=A(""),u=A(0),d=A(0),p=A(null),h=A("right"),m=A(0),g=A(null),v=A(),{forwardRef:b,currentElement:w}=Ne(),{handleTypeaheadSearch:E}=fj(),y=A();function P(k){const N=Nh(k,y.value||Qe(),w.value,{loop:l.value,arrowKeyOptions:"vertical",dir:a==null?void 0:a.dir.value,focus:!1,attributeName:"[data-reka-collection-item]:not([data-disabled])"});N&&(y.value=N,N.scrollIntoView({block:"nearest"}))}function C(){y.value&&y.value.click()}const T=A(),M=A();ce(y,k=>{M.value&&(k===void 0||k!==M.value.trigger.value)&&(M.value.onOpenChange(!1),M.value=void 0)}),ce(w,k=>{r.onContentChange(k)}),st(()=>{window.clearTimeout(u.value)});function x(k){var N,F;return h.value===((N=p.value)==null?void 0:N.side)&&HB(k,(F=p.value)==null?void 0:F.area)}async function L(k){var N;o("openAutoFocus",k),!k.defaultPrevented&&(k.preventDefault(),(N=w.value)==null||N.focus({preventScroll:!0}))}function q(k){var N;if(k.defaultPrevented)return;const F=k.target,K=F.closest("[data-reka-menu-content]")===k.currentTarget,J=["input","textarea"].includes(F.tagName.toLowerCase()),pe=k.ctrlKey||k.altKey||k.metaKey,le=k.key.length===1,_e=Nh(k,Qe(),w.value,{loop:l.value,arrowKeyOptions:"vertical",dir:a==null?void 0:a.dir.value,focus:!0,attributeName:"[data-reka-collection-item]:not([data-disabled])"});if(_e)return _e==null?void 0:_e.focus();if(k.code==="Space")return;const Ae=((N=v.value)==null?void 0:N.getItems())??[];if(K&&(k.key==="Tab"&&k.preventDefault(),!pe&&le&&!J&&E(k.key,Ae)),k.target!==w.value||!jB.includes(k.key))return;k.preventDefault();const Mt=[...Ae.map(vt=>vt.ref)];Qv.includes(k.key)&&Mt.reverse(),GB(Mt)}function $(k){var N,F;(F=(N=k==null?void 0:k.currentTarget)==null?void 0:N.contains)!=null&&F.call(N,k.target)||(window.clearTimeout(u.value),c.value="")}function D(k){var N;if(!Si(k))return;const F=k.target,K=m.value!==k.clientX;if((N=k==null?void 0:k.currentTarget)!=null&&N.contains(F)&&K){const J=k.clientX>m.value?"right":"left";h.value=J,m.value=k.clientX}}function G(k){Si(k)&&T.value&&T.value.focus()}return xj({onItemEnter:k=>!!x(k),onItemLeave:k=>{var N,F;x(k)||(["INPUT","TEXTAREA"].includes(((N=Qe())==null?void 0:N.tagName)||"")||(F=w.value)==null||F.focus(),g.value=null)},onTriggerLeave:k=>!!x(k),searchRef:c,highlightedElement:y,onKeydownNavigation:P,onKeydownEnter:C,filterElement:T,onFilterElementChange:k=>{T.value=k},activeSubmenuContext:M,pointerGraceTimerRef:d,onPointerGraceIntentChange:k=>{p.value=k}}),(k,N)=>(_(),U(f(eu),{"as-child":"",trapped:f(s),onMountAutoFocus:L,onUnmountAutoFocus:N[7]||(N[7]=F=>o("closeAutoFocus",F))},{default:j(()=>[V(f(Zc),{"as-child":"","disable-outside-pointer-events":f(i),onEscapeKeyDown:N[2]||(N[2]=F=>o("escapeKeyDown",F)),onPointerDownOutside:N[3]||(N[3]=F=>o("pointerDownOutside",F)),onFocusOutside:N[4]||(N[4]=F=>o("focusOutside",F)),onInteractOutside:N[5]||(N[5]=F=>o("interactOutside",F)),onDismiss:N[6]||(N[6]=F=>o("dismiss"))},{default:j(()=>[V(f(Sj),{ref_key:"rovingFocusGroupRef",ref:v,"current-tab-stop-id":g.value,"onUpdate:currentTabStopId":N[0]||(N[0]=F=>g.value=F),"as-child":"",orientation:"vertical",dir:f(a).dir.value,loop:f(l),onEntryFocus:N[1]||(N[1]=F=>{o("entryFocus",F),f(a).isUsingKeyboardRef.value||F.preventDefault()})},{default:j(()=>[V(f(Df),{ref:f(b),role:"menu",as:k.as,"as-child":k.asChild,"aria-orientation":"vertical","data-reka-menu-content":"","data-state":f(Zv)(f(r).open.value),dir:f(a).dir.value,side:k.side,"side-offset":k.sideOffset,align:k.align,"align-offset":k.alignOffset,"avoid-collisions":k.avoidCollisions,"collision-boundary":k.collisionBoundary,"collision-padding":k.collisionPadding,"arrow-padding":k.arrowPadding,"prioritize-position":k.prioritizePosition,"position-strategy":k.positionStrategy,"update-position-strategy":k.updatePositionStrategy,sticky:k.sticky,"hide-when-detached":k.hideWhenDetached,reference:k.reference,onKeydown:q,onBlur:$,onPointermove:D,onPointerenter:G},{default:j(()=>[ee(k.$slots,"default")]),_:3},8,["as","as-child","data-state","dir","side","side-offset","align","align-offset","avoid-collisions","collision-boundary","collision-padding","arrow-padding","prioritize-position","position-strategy","update-position-strategy","sticky","hide-when-detached","reference"])]),_:3},8,["current-tab-stop-id","dir","loop"])]),_:3},8,["disable-outside-pointer-events"])]),_:3},8,["trapped"]))}}),sy=Oj,Rj=z({inheritAttrs:!1,__name:"MenuItemImpl",props:{disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(t){const e=t,n=ay(),{forwardRef:o,currentElement:r}=Ne(),{CollectionItem:a}=ry(),s=A(!1),i=B(()=>s.value||n.highlightedElement.value===r.value);async function l(u){var d;if(!u.defaultPrevented&&Si(u)){if(e.disabled)n.onItemLeave(u);else if(!n.onItemEnter(u)){const p=u.currentTarget;n.highlightedElement.value=p,["INPUT","TEXTAREA"].includes(((d=Qe())==null?void 0:d.tagName)||"")||p.focus({preventScroll:!0})}}}async function c(u){await Fe(),!u.defaultPrevented&&Si(u)&&n.onItemLeave(u)}return(u,d)=>(_(),U(f(a),{value:{textValue:u.textValue}},{default:j(()=>[V(f(an),Me({ref:f(o),role:"menuitem",tabindex:"-1"},u.$attrs,{as:u.as,"as-child":u.asChild,"aria-disabled":u.disabled||void 0,"data-disabled":u.disabled?"":void 0,"data-highlighted":i.value?"":void 0,onPointermove:l,onPointerleave:c,onFocus:d[0]||(d[0]=async p=>{await Fe(),!(p.defaultPrevented||u.disabled)&&(s.value=!0,f(n).highlightedElement.value=p.currentTarget)}),onBlur:d[1]||(d[1]=async p=>{await Fe(),!p.defaultPrevented&&(s.value=!1)})}),{default:j(()=>[ee(u.$slots,"default")]),_:3},16,["as","as-child","aria-disabled","data-disabled","data-highlighted"])]),_:3},8,["value"]))}}),Pj=Rj,Dj=z({__name:"MenuItem",props:{disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["select"],setup(t,{emit:e}){const n=t,o=e,{forwardRef:r,currentElement:a}=Ne(),s=cd(),i=ay(),l=A(!1);async function c(){const u=a.value;if(!n.disabled&&u){const d=new CustomEvent(UB,{bubbles:!0,cancelable:!0});o("select",d),await Fe(),d.defaultPrevented?l.value=!1:s.onClose()}}return(u,d)=>(_(),U(Pj,Me(n,{ref:f(r),onClick:c,onPointerdown:d[0]||(d[0]=()=>{l.value=!0}),onPointerup:d[1]||(d[1]=async p=>{var h;await Fe(),!p.defaultPrevented&&(l.value||(h=p.currentTarget)==null||h.click())}),onKeydown:d[2]||(d[2]=async p=>{const h=f(i).searchRef.value!=="";u.disabled||h&&p.key===" "||f(BB).includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})}),{default:j(()=>[ee(u.$slots,"default")]),_:3},16))}}),Nj=Dj,Lj=z({__name:"MenuRootContentModal",props:{loop:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","entryFocus","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,o=e,r=Po(n,o),a=rl(),{forwardRef:s,currentElement:i}=Ne();return Qc(i),(l,c)=>(_(),U(sy,Me(f(r),{ref:f(s),"trap-focus":f(a).open.value,"disable-outside-pointer-events":f(a).open.value,"disable-outside-scroll":!0,onDismiss:c[0]||(c[0]=u=>f(a).onOpenChange(!1)),onFocusOutside:c[1]||(c[1]=yn(u=>o("focusOutside",u),["prevent"]))}),{default:j(()=>[ee(l.$slots,"default")]),_:3},16,["trap-focus","disable-outside-pointer-events"]))}}),Uj=Lj,Bj=z({__name:"MenuRootContentNonModal",props:{loop:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","entryFocus","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=Po(t,e),o=rl();return(r,a)=>(_(),U(sy,Me(f(n),{"trap-focus":!1,"disable-outside-pointer-events":!1,"disable-outside-scroll":!1,onDismiss:a[0]||(a[0]=s=>f(o).onOpenChange(!1))}),{default:j(()=>[ee(r.$slots,"default")]),_:3},16))}}),Fj=Bj,jj=z({__name:"MenuContent",props:{forceMount:{type:Boolean,required:!1},loop:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","entryFocus","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=Po(t,e),o=rl(),r=cd();return(a,s)=>(_(),U(f(Ii),{present:a.forceMount||f(o).open.value},{default:j(()=>[f(r).modal.value?(_(),U(Uj,kn(Me({key:0},{...a.$attrs,...f(n)})),{default:j(()=>[ee(a.$slots,"default")]),_:3},16)):(_(),U(Fj,kn(Me({key:1},{...a.$attrs,...f(n)})),{default:j(()=>[ee(a.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),Gj=jj,qj=z({__name:"MenuPortal",props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(t){const e=t;return(n,o)=>(_(),U(f(tu),kn(Ro(e)),{default:j(()=>[ee(n.$slots,"default")]),_:3},16))}}),Hj=qj;const[iy,Vj]=dn("ContextMenuRoot");var zj=z({inheritAttrs:!1,__name:"ContextMenuRoot",props:{pressOpenDelay:{type:Number,required:!1,default:700},dir:{type:String,required:!1},modal:{type:Boolean,required:!1,default:!0}},emits:["update:open"],setup(t,{emit:e}){const n=t,o=e,{dir:r,modal:a,pressOpenDelay:s}=rn(n);Ne();const i=ld(r),l=A(!1),c=A();return Vj({open:l,onOpenChange:u=>{l.value=u},dir:i,modal:a,triggerElement:c,pressOpenDelay:s}),ce(l,u=>{o("update:open",u)}),(u,d)=>(_(),U(f(Aj),{open:l.value,"onUpdate:open":d[0]||(d[0]=p=>l.value=p),dir:f(i),modal:f(a)},{default:j(()=>[ee(u.$slots,"default")]),_:3},8,["open","dir","modal"]))}}),Wj=zj,Kj=z({__name:"ContextMenuContent",props:{forceMount:{type:Boolean,required:!1},loop:{type:Boolean,required:!1},sideFlip:{type:Boolean,required:!1},alignOffset:{type:Number,required:!1,default:0},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1,default:!0},collisionBoundary:{type:null,required:!1,default:()=>[]},collisionPadding:{type:[Number,Object],required:!1,default:0},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1,default:"partial"},hideWhenDetached:{type:Boolean,required:!1,default:!1},positionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","closeAutoFocus"],setup(t,{emit:e}){const n=Po(t,e);Ne();const o=iy(),r=A(!1);return(a,s)=>(_(),U(f(Gj),Me(f(n),{side:"right","side-offset":2,align:"start","update-position-strategy":"always",style:{"--reka-context-menu-content-transform-origin":"var(--reka-popper-transform-origin)","--reka-context-menu-content-available-width":"var(--reka-popper-available-width)","--reka-context-menu-content-available-height":"var(--reka-popper-available-height)","--reka-context-menu-trigger-width":"var(--reka-popper-anchor-width)","--reka-context-menu-trigger-height":"var(--reka-popper-anchor-height)"},onCloseAutoFocus:s[0]||(s[0]=i=>{!i.defaultPrevented&&r.value&&i.preventDefault(),r.value=!1}),onInteractOutside:s[1]||(s[1]=i=>{i.detail.originalEvent.button===2&&i.target===f(o).triggerElement.value&&i.preventDefault(),!i.defaultPrevented&&!f(o).modal.value&&(r.value=!0)})}),{default:j(()=>[ee(a.$slots,"default")]),_:3},16))}}),Yj=Kj,Jj=z({__name:"ContextMenuItem",props:{disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["select"],setup(t,{emit:e}){const n=t,o=Ua(e);return Ne(),(r,a)=>(_(),U(f(Nj),kn(Ro({...n,...f(o)})),{default:j(()=>[ee(r.$slots,"default")]),_:3},16))}}),Xj=Jj,Qj=z({__name:"ContextMenuPortal",props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(t){const e=t;return(n,o)=>(_(),U(f(Hj),kn(Ro(e)),{default:j(()=>[ee(n.$slots,"default")]),_:3},16))}}),Zj=Qj;function Bh(t){return t.pointerType!=="mouse"}var eG=z({inheritAttrs:!1,__name:"ContextMenuTrigger",props:{disabled:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"span"}},setup(t){const e=t,{disabled:n}=rn(e),{forwardRef:o,currentElement:r}=Ne(),a=iy(),s=A({x:0,y:0}),i=B(()=>({getBoundingClientRect:()=>({width:0,height:0,left:s.value.x,right:s.value.x,top:s.value.y,bottom:s.value.y,...s.value})})),l=A(0);function c(){window.clearTimeout(l.value)}function u(m){s.value={x:m.clientX,y:m.clientY},a.onOpenChange(!0)}async function d(m){n.value||(await Fe(),m.defaultPrevented||(c(),u(m),m.preventDefault()))}async function p(m){n.value||(await Fe(),Bh(m)&&!m.defaultPrevented&&(c(),l.value=window.setTimeout(()=>u(m),a.pressOpenDelay.value)))}async function h(m){n.value||(await Fe(),Bh(m)&&!m.defaultPrevented&&c())}return qe(()=>{r.value&&(a.triggerElement.value=r.value)}),(m,g)=>(_(),O(ie,null,[V(f(Ej),{as:"template",reference:i.value},null,8,["reference"]),V(f(an),Me({ref:f(o),as:m.as,"as-child":m.asChild,"data-state":f(a).open.value?"open":"closed","data-disabled":f(n)?"":void 0,style:{WebkitTouchCallout:"none",pointerEvents:"auto"}},m.$attrs,{onContextmenu:d,onPointerdown:p,onPointermove:h,onPointercancel:h,onPointerup:h}),{default:j(()=>[ee(m.$slots,"default")]),_:3},16,["as","as-child","data-state","data-disabled"])],64))}}),tG=eG;const nG="_slideIn_twbzd_1",oG="_slideOut_twbzd_1",rG={"message-action-dropdown":"_message-action-dropdown_twbzd_1",slideIn:nG,slideOut:oG},aG={key:0},sG=z({__name:"MessageActionDropdown",props:{message:{default:()=>({})},messageActionList:{default:void 0}},setup(t){const e=t,{t:n}=ve(),o=pj(),r=B(()=>(e.messageActionList??o).filter(i=>i.visible===void 0?!0:typeof i.visible=="function"?i.visible(e.message):i.visible)),a=i=>{var l;(l=i.onClick)==null||l.call(i,e.message)},s=document.body;return(i,l)=>r.value.length<=0?ee(i.$slots,"default",{key:0},void 0,!0):(_(),U(f(Wj),{key:1},{default:j(()=>[V(f(tG),{"as-child":""},{default:j(()=>[ee(i.$slots,"default",{},void 0,!0)]),_:3}),V(f(Zj),{to:f(s)},{default:j(()=>[V(f(Yj),{class:S(f(ke)(f(rG)["message-action-dropdown"]))},{default:j(()=>[(_(!0),O(ie,null,we(r.value,c=>(_(),U(f(Xj),{key:c.key,as:"button",class:S(f(ke)("message-action-dropdown__item",c.className)),style:De(c.style),onSelect:u=>a(c)},{default:j(()=>[c.component&&c.visible?(_(),U(se(c.component),{key:0,message:t.message},null,8,["message"])):c.visible?(_(),O(ie,{key:1},[I("span",null,H(f(n)(`MessageList.${c.label}`,{defaultValue:c.label})),1),c.icon?(_(),O(ie,{key:0},[typeof c.icon=="string"?(_(),O("span",aG,H(c.icon),1)):(_(),U(se(c.icon),{key:1,class:S(f(ke)("message-action-dropdown__icon"))},null,8,["class"]))],64)):Y("",!0)],64)):Y("",!0)]),_:2},1032,["class","style","onSelect"]))),128))]),_:1},8,["class"])]),_:1},8,["to"])]),_:3}))}}),iG=Z(sG,[["__scopeId","data-v-b360635f"]]),lG={key:0,class:"has-risk-content"},cG=z({__name:"MessageBubble",props:{message:{default:()=>({})},alignment:{default:"two-sided"},isLastInChunk:{type:Boolean,default:!0},messageActionList:{default:void 0}},setup(t){const e=[oe.TYPES.MSG_IMAGE,oe.TYPES.MSG_VIDEO],n=t,{highlightMessageIDSet:o}=Fa(),r=B(()=>e.includes(n.message.type)),a=B(()=>o.value.has(n.message.ID));return(s,i)=>(_(),O("div",{class:S(["message-bubble",f(ke)({[`bubble-${t.message.flow}`]:t.message.flow&&!0,"all-round-radius":!t.isLastInChunk,"media-bubble":e.includes(t.message.type),"highlight--normal":a.value,"highlight--media":a.value&&r.value})])},[t.message.hasRiskContent?(_(),O("div",lG," hasRiskContent ")):(_(),U(f(iG),{key:1,messageActionList:t.messageActionList,message:t.message},{default:j(()=>[ee(s.$slots,"default",{},void 0,!0)]),_:3},8,["messageActionList","message"]))],2))}}),uG=Z(cG,[["__scopeId","data-v-1f4671de"]]),dG=z({__name:"MessageStatusIcon",props:{status:{}},setup(t){return(e,n)=>(_(),U(f(ae),null,{default:j(()=>[t.status==="unSend"?(_(),U(f(nr),{key:0,class:"message-meta__status--unSend",size:14})):t.status==="success"?(_(),U(f(Vy),{key:1,size:14})):t.status==="fail"?(_(),U(f(Fh),{key:2,size:14})):Y("",!0)]),_:1}))}}),pG=Z(dG,[["__scopeId","data-v-68770f71"]]),hG=z({__name:"MessageMeta",props:{isGroup:{type:Boolean},timestamp:{default:0},flow:{default:"in"},needReadReceipt:{type:Boolean,default:!1},readReceiptInfo:{default:void 0},status:{default:void 0}},emits:["onReadReceiptTextClick"],setup(t,{emit:e}){const n=t,o=e,{t:r}=ve(),a=qt(),s=B(()=>Vv(n.timestamp)),i=()=>{o("onReadReceiptTextClick")},l=B(()=>n.flow==="out"&&(!n.needReadReceipt||n.status==="unSend"||n.status==="fail")),c=B(()=>{if(!n.needReadReceipt||n.status!=="success"||!n.readReceiptInfo||n.flow==="in")return"";const{readCount:u,unreadCount:d,isPeerRead:p}=n.readReceiptInfo;return n.isGroup?d===void 0||u===void 0?"":d>0?`${d} ${r("MessageList.unread")} ·`:`${r("MessageList.all_read")} ·`:p?`${r("MessageList.read")} ·`:`${r("MessageList.unread")} ·`});return(u,d)=>(_(),U(f(ae),{class:S(f(a)["message-meta"]),dir:"row",align:"center"},{default:j(()=>[l.value?(_(),O(ie,{key:0},[n.status?(_(),U(pG,{key:0,status:n.status},null,8,["status"])):Y("",!0)],64)):c.value?(_(),O(ie,{key:1},[c.value&&!n.isGroup?(_(),O("span",{key:0,class:S(f(a)["message-meta__read-status"])},H(c.value),3)):c.value&&n.isGroup&&n.readReceiptInfo&&n.readReceiptInfo.unreadCount>0?(_(),O("span",{key:1,class:S(f(a)["message-meta__group-unread"]),onClick:i},H(c.value),3)):c.value&&n.isGroup?(_(),O("span",{key:2,class:S(f(a)["message-meta__group-all-read"])},H(c.value),3)):Y("",!0)],64)):Y("",!0),s.value?(_(),O("span",{key:2,class:S(f(a)["message-meta__time"])},H(s.value),3)):Y("",!0)]),_:1},8,["class"]))}}),fG={"message-meta":"_message-meta_rk5t7_1","message-meta__read-status":"_message-meta__read-status_rk5t7_6","message-meta__group-unread":"_message-meta__group-unread_rk5t7_9","message-meta__group-all-read":"_message-meta__group-all-read_rk5t7_18","message-meta__time":"_message-meta__time_rk5t7_21"},mG={$style:fG},gG=Z(hG,[["__cssModules",mG]]);function vG({isMessageOwner:t,alignment:e,isAggregated:n}){const o=e==="two-sided"&&t||e==="right",r=ke("message-layout",o?"message-layout--right":"message-layout--left"),a=ke("message-layout__wrapper",o?"message-layout__wrapper--right":"message-layout__wrapper--left",n?"message-layout__wrapper--aggregated":"",e==="two-sided"&&t?"message-layout__wrapper--no-padding":""),s=ke("message-layout__bubble",o?"message-layout__bubble--right":"message-layout__bubble--left",n?"message-layout__bubble--aggregated":""),i=ke("message-layout__avatar"),l=ke("message-layout__meta",o?"message-layout__meta--right":"message-layout__meta--left");return{layoutClasses:r,wrapperClasses:a,bubbleClasses:s,avatarClasses:i,metaClasses:l}}const yG=z({__name:"MessageLayout",props:{message:{default:()=>({})},nick:{default:void 0},isAggregated:{type:Boolean,default:!1},isHiddenMessageAvatar:{type:Boolean,default:!1},isHiddenMessageMeta:{type:Boolean,default:!1},isHiddenMessageNick:{type:Boolean,default:!1},isFirstInChunk:{type:Boolean,default:void 0},isLastInChunk:{type:Boolean,default:void 0},alignment:{default:"two-sided"},messageActionList:{default:void 0},className:{default:""},style:{default:void 0}},setup(t){const e=t,n=A(!1),o=B(()=>!!(e.message.type===ue.CUSTOM&&e.message.getMessageContent().businessID==="group_create"||e.message.type===ue.CUSTOM&&Wn(e.message)&&e.message.conversationType===Ge.GROUP)),r={[ue.TEXT]:sj,[ue.IMAGE]:WF,[ue.AUDIO]:_F,[ue.VIDEO]:uj,[ue.FILE]:RF,[ue.FACE]:xF,[ue.LOCATION]:JF,[ue.MERGER]:ZF,[ue.CUSTOM]:TF,[ue.GRP_TIP]:Rh},a=LB("MessageLayout"),s=B(()=>{const v=a==null?void 0:a.messageRenderers,{type:b}=e.message;return v!=null&&v[b]?v[b]:r[b]}),i=B(()=>e.message.flow==="out"),l=B(()=>vG({isMessageOwner:i.value,alignment:e.alignment,isAggregated:e.isAggregated})),c=B(()=>l.value.layoutClasses),u=B(()=>l.value.wrapperClasses),d=B(()=>l.value.avatarClasses),p=B(()=>l.value.bubbleClasses),h=B(()=>l.value.metaClasses);function m(){n.value=!0}function g(){n.value=!1}return(v,b)=>(_(),O(ie,null,[t.message.isRevoked?(_(),U(f(tj),{key:0,class:"message-recalled",message:t.message},null,8,["message"])):t.message.type===f(ue).GRP_TIP||o.value?(_(),U(f(Rh),{key:1,message:t.message},null,8,["message"])):s.value?(_(),U(f(ae),{key:2,"data-message-id":t.message.ID,class:S(c.value),style:De(t.style)},{default:j(()=>[t.isHiddenMessageAvatar?Y("",!0):(_(),U(f(ft),{key:0,class:S(f(ke)(d.value)),src:t.message.avatar},null,8,["class","src"])),V(f(ae),{class:S(f(ke)(u.value))},{default:j(()=>[t.isHiddenMessageNick?Y("",!0):(_(),U(f(ae),{key:0,class:S(f(ke)("message-layout__nick"))},{default:j(()=>[ge(H(e.nick||t.message.nameCard||t.message.nick||t.message.from),1)]),_:1},8,["class"])),V(f(uG),{class:S(p.value),message:t.message,alignment:t.alignment,isLastInChunk:!1,messageActionList:t.messageActionList},{default:j(()=>[(_(),U(se(s.value),{message:t.message},null,8,["message"]))]),_:1},8,["class","message","alignment","messageActionList"]),t.isHiddenMessageMeta?Y("",!0):(_(),U(f(gG),{key:1,class:S(h.value),status:t.message.status,flow:t.message.flow,timestamp:t.message.time*1e3,"need-read-receipt":t.message.needReadReceipt,"read-receipt-info":t.message.readReceiptInfo,"is-group":t.message.conversationType===f(Ge).GROUP,onOnReadReceiptTextClick:m},null,8,["class","status","flow","timestamp","need-read-receipt","read-receipt-info","is-group"]))]),_:1},8,["class"])]),_:1},8,["data-message-id","class","style"])):Y("",!0),V(f(cF),{open:n.value,messageID:t.message.ID,"read-count":t.message.readReceiptInfo.readCount,"unread-count":t.message.readReceiptInfo.unreadCount,"is-peer-read":t.message.readReceiptInfo.isPeerRead,onOnClose:g},null,8,["open","messageID","read-count","unread-count","is-peer-read"])],64))}}),_G=Z(yG,[["__scopeId","data-v-b0da155b"]]),bG=z({__name:"Message",props:{message:{},nick:{default:void 0},alignment:{default:"two-sided"},messageActionList:{default:void 0},isAggregated:{type:Boolean,default:!1},isFirstInChunk:{type:Boolean,default:void 0},isLastInChunk:{type:Boolean,default:void 0},isHiddenMessageAvatar:{type:Boolean,default:!1},isHiddenMessageNick:{type:Boolean,default:!1},isHiddenMessageMeta:{type:Boolean,default:!1}},setup(t){return(e,n)=>(_(),U(f(_G),{nick:t.nick,message:t.message,messageActionList:t.messageActionList,alignment:t.alignment,"is-aggregated":t.isAggregated,"is-first-in-chunk":t.isFirstInChunk,"is-last-in-chunk":t.isLastInChunk,"is-hidden-message-avatar":t.isHiddenMessageAvatar,"is-hidden-message-nick":t.isHiddenMessageNick,"is-hidden-message-meta":t.isHiddenMessageMeta},null,8,["nick","message","messageActionList","alignment","is-aggregated","is-first-in-chunk","is-last-in-chunk","is-hidden-message-avatar","is-hidden-message-nick","is-hidden-message-meta"]))}}),wG=["id"],SG=z({name:"ObserverView",inheritAttrs:!1,__name:"ObserverView",props:{id:{default:void 0},class:{default:void 0},style:{default:void 0},threshold:{default:0},rootMargin:{default:"0px"},root:{default:null},observerOptions:{default:void 0},disabled:{type:Boolean,default:!1},delay:{default:0}},emits:["onShow","onShowOnce","onHide"],setup(t,{emit:e}){const n=t,o=e,r=A(null),a=A(!1);let s=null,i=null;const l=()=>{if(!r.value||n.disabled)return;c();const u=n.observerOptions||{threshold:n.threshold,rootMargin:n.rootMargin,root:n.root?document.querySelector(n.root):null};s=new IntersectionObserver(d=>{d.forEach(p=>{if(p.isIntersecting){const h=()=>{o("onShow"),a.value||(o("onShowOnce"),a.value=!0)};n.delay&&n.delay>0?(i&&clearTimeout(i),i=window.setTimeout(h,n.delay)):h()}else o("onHide")})},u),s.observe(r.value)};function c(){s&&(s.disconnect(),s=null),i&&(clearTimeout(i),i=null)}return ce([()=>n.disabled,()=>n.threshold,()=>n.rootMargin,()=>n.root,()=>n.observerOptions],()=>{r.value&&l()}),qe(()=>{l()}),st(()=>{c()}),(u,d)=>(_(),O("div",Me({id:t.id,ref_key:"viewRef",ref:r,class:f(ke)("observer-view",n.class),style:t.style},u.$attrs),[ee(u.$slots,"default",{},void 0,!0)],16,wG))}}),kG=Z(SG,[["__scopeId","data-v-6f27edac"]]);function EG({enabled:t,containerSelector:e,messageSelector:n="[data-message-id]",getMessageIDFromDom:o,shouldSendReadReceipt:r=i=>i.flow==="in",intersectionThreshold:a=.5,delay:s=1e3}){let i=null;const l=new Map,c=new Set,u=Ju(()=>{if(l.size===0)return;const v=Array.from(l.values());yt.sendMessageReadReceipt(v).then(()=>{}).catch(b=>{Mi(b)}),l.clear()},s,{leading:!1,trailing:!0}),d=v=>{if(c.has(v))return!1;const b=Re.getMessageModel(v);return b&&r(b)?(l.set(v,b),c.add(v),u(),!0):!1},p=()=>{t&&(i=new IntersectionObserver(v=>{v.forEach(b=>{if(b.isIntersecting&&b.intersectionRatio>=a){const w=o(b.target);w&&d(w),i==null||i.unobserve(b.target)}})},{threshold:a,root:document.querySelector(e)}))},h=()=>{i==null||i.disconnect(),u.flush()};ce([()=>t,()=>e,()=>a],()=>{h(),p()},{immediate:!0});const m=()=>{if(!i||!t)return;const v=document.querySelector(e);v&&v.querySelectorAll(n).forEach(b=>{const w=o(b);if(!w||c.has(w))return;const E=Re.getMessageModel(w);E&&r(E)&&(i==null||i.observe(b))})},g=()=>{if(!t)return;const v=document.querySelector(e);if(!v)return;const b=v.getBoundingClientRect();v.querySelectorAll(n).forEach(w=>{const E=o(w);if(!E||c.has(E))return;const y=w.getBoundingClientRect();y.top<b.bottom&&y.bottom>b.top&&y.height>0&&d(E)})};return qe(()=>{p()}),st(()=>{h()}),{observeMessageList:m,manuallyMarkVisibleMessagesAsRead:g,resetProcessedMessages:()=>{c.clear(),l.clear()}}}const CG={class:"forward-header__title"},MG=z({__name:"MessageForward",setup(t){const{t:e}=ve(),{forwardMessageIDList:n,forwardConversationIDList:o,isForwardMessageSelectionDone:r,forwardMessage:a}=td(),{conversationList:s}=Rt(),i=A(null),l=B(()=>s.value?s.value.map(h=>{const{type:m,remark:g,groupProfile:v,userProfile:b}=h,w={key:h.conversationID,label:"",avatarUrl:h.getAvatar()||""};if(m===oe.TYPES.CONV_C2C){const E=g||(b==null?void 0:b.nick)||(b==null?void 0:b.userID);w.label=E||""}if(m===oe.TYPES.CONV_GROUP){const E=(v==null?void 0:v.name)||(v==null?void 0:v.groupID);w.label=E||""}return w}):[]),c=A(!0);function u(h){c.value=h.length===0,o.value=h.map(m=>m.key)}function d(){var h;if(!r.value)return;const m=(h=i.value)==null?void 0:h.getSelectedItems();m&&m.length>0&&(a({messageIDList:n.value,conversationIDList:m.map(g=>g.key),isMergeForward:!1}),p())}function p(){n.value=[],o.value=[],r.value=!1}return(h,m)=>(_(),U(f(ty),{open:f(r),"content-class":"forward-container",onOnClose:p},{default:j(()=>[V(f(ae),{class:"forward-header",dir:"row"},{default:j(()=>[V(f(Er),{size:"28",class:"forward-header__close",onClick:p}),I("span",CG,H(f(e)("MessageList.forward")),1),m[0]||(m[0]=I("div",{class:"forward-header__placeholder"},null,-1))]),_:1}),V(f($i),{ref_key:"userPickerRef",ref:i,"display-mode":"list","data-source":l.value,"max-count":10,"on-selected-change":u,"on-max-count-exceed":()=>{f(ut).error({message:f(e)("MessageList.max_count_exceed")})}},null,8,["data-source","on-max-count-exceed"]),V(f(ae),{class:"forward-footer"},{default:j(()=>[V(f(Tt),{radius:"rect",color:"blue",type:"primary",disabled:c.value,onClick:d},{default:j(()=>[ge(H(f(e)("MessageList.forward")),1)]),_:1},8,["disabled"])]),_:1})]),_:1},8,["open"]))}}),$G=Z(MG,[["__scopeId","data-v-c66c4f35"]]),TG=z({__name:"MessageTimeDivider",props:{previousMessage:{default:void 0},currentMessage:{default:()=>({})}},setup(t){const e=t,n=B(()=>{var r,a;if(!((r=e.currentMessage)!=null&&r.time))return!1;const s=((a=e.previousMessage)==null?void 0:a.time)||0;return e.currentMessage.time-s>300}),o=()=>{if(!n.value)return he(ie,null,[]);const r=e.currentMessage.time;return he("div",{class:"message-time-divider"},[he("span",{},Vv(r*1e3))])};return(r,a)=>(_(),U(se(o())))}}),IG=Z(TG,[["__scopeId","data-v-3ccc6b1e"]]),AG=z({__name:"ScrollToBottom",emits:["click"],setup(t,{emit:e}){const n=e;return(o,r)=>(_(),O("button",{class:S(o.$style["scroll-to-bottom__button"]),onClick:r[0]||(r[0]=a=>n("click"))},[V(f(zy),{customClass:o.$style["scroll-to-bottom__button--icon"],size:18},null,8,["customClass"])],2))}}),xG={"scroll-to-bottom__button":"_scroll-to-bottom__button_1dasy_1","scroll-to-bottom__button--icon":"_scroll-to-bottom__button--icon_1dasy_22"},OG={$style:xG},RG=Z(AG,[["__cssModules",OG]]),PG={class:"message-list"},DG={class:"message-chunk"},zl=150,NG=z({__name:"MessageList",props:{alignment:{default:"two-sided"},messageAggregationTime:{default:300},enableReadReceipt:{type:Boolean,default:!1},messageActionList:{default:void 0},filter:{type:Function,default:void 0},Message:{default:void 0},MessageTimeDivider:{default:void 0},conversationID:{default:void 0},messageRenderers:{default:void 0}},setup(t){const e=t,n=Hh();Vc(Xv,{slots:n,get messageRenderers(){return e.messageRenderers}});const o=A(!1),r=A(0),a=A(!1),s=A(null),i=A(!1),l=A(0),{messageList:c,loadMoreOlderMessage:u,activeConversationID:d,isDisableScroll:p,setIsDisableScroll:h,setEnableReadReceipt:m}=Fa(),{getGroupMemberList:g}=Ya(),{scrollToBottom:v}=ny(),{activeConversation:b,setActiveConversation:w}=Rt(),{observeMessageList:E,resetProcessedMessages:y}=EG({enabled:e.enableReadReceipt??!1,containerSelector:"#messageScrollList",getMessageIDFromDom:q=>q.dataset.messageId||""}),P=B(()=>{var q;return((q=b.value)==null?void 0:q.type)===Ge.GROUP}),C=B(()=>e.messageAggregationTime&&e.messageAggregationTime>0),T=B(()=>{if(!c.value)return[];const q=e.filter?c.value.filter(e.filter):c.value.filter(G=>!G.isDeleted);if(!e.messageAggregationTime||e.messageAggregationTime<=0)return q.map(G=>({timestamp:G.time,messages:[G],key:`chunk-${G.ID}`}));const $=[],D=e.messageAggregationTime;return q.forEach((G,k,N)=>{const F=G.time,K=$.length>0?$[$.length-1]:void 0,J=k>0?N[k-1]:void 0;!K||F-K.timestamp>D||K.messages[0].from!==G.from||G.isRevoked||J&&J.isRevoked||G.status==="fail"||J&&J.status==="fail"||G.hasRiskContent||J&&J.hasRiskContent||Wn(G)||J&&Wn(J)||J&&J.type===ue.CUSTOM&&J.getMessageContent().businessID==="group_create"?$.push({timestamp:F,messages:[G],key:`chunk-${G.ID}`}):K.messages.push(G)}),$}),M=Ju(()=>{s.value&&(r.value=s.value.scrollHeight-s.value.scrollTop-s.value.clientHeight,r.value>zl&&(h(!0),i.value=!0),r.value<zl&&(h(!1),i.value=!1))},100),x=async()=>{o.value=!1,h(!1),i.value=!1,y()},L=async()=>{var q;if(!(!o.value||a.value||!((q=c.value)!=null&&q.length))){if(h(!0),a.value=!0,!s.value){a.value=!1;return}if(l.value=s.value.scrollHeight-s.value.scrollTop-s.value.clientHeight,await u(),await Fe(),s.value){const $=s.value.scrollHeight-s.value.clientHeight-l.value;s.value.scrollTop=Math.max(0,Math.min(s.value.scrollHeight-s.value.clientHeight,$))}a.value=!1}};return ce(d,()=>{x()}),ce(c,(q,$)=>{if($===void 0&&q&&!o.value){Fe(()=>{v({behavior:"instant"}),o.value=!0,E()}),P.value&&g();return}if(!$||!q||!q.length)return;const D=q[q.length-1],G=$[$.length-1];(D==null?void 0:D.ID)!==(G==null?void 0:G.ID)&&(Fe(()=>{E()}),(D.flow==="out"||!p.value&&r.value<zl)&&v({behavior:"smooth"}))},{immediate:!0}),ce(()=>e.enableReadReceipt,q=>{m(q)},{immediate:!0}),ce(()=>e.conversationID,q=>{q&&w(q)},{immediate:!0}),qe(()=>{s.value&&s.value.addEventListener("scroll",M),x()}),st(()=>{s.value&&s.value.removeEventListener("scroll",M)}),(q,$)=>(_(),O("div",PG,[I("div",{id:"messageScrollList",ref_key:"scrollContainer",ref:s,class:"message-list-container"},[V(f(kG),{root:"#messageScrollList",rootMargin:"50px 0px 0px 0px",threshold:.1,onOnShow:L},{default:j(()=>[...$[1]||($[1]=[I("div",{id:"loadMore"},null,-1)])]),_:1}),(_(!0),O(ie,null,we(T.value,(D,G)=>(_(),U(f(ae),{key:D.key,class:S(f(ke)("message-chunk--container"))},{default:j(()=>[(_(),U(se(e.MessageTimeDivider||f(IG)),{previousMessage:G>0?T.value[G-1].messages[0]:void 0,currentMessage:D.messages[0]},null,8,["previousMessage","currentMessage"])),I("div",DG,[(_(!0),O(ie,null,we(D.messages,(k,N)=>(_(),U(se(e.Message||f(bG)),{key:k.ID,message:k,alignment:e.alignment,messageActionList:e.messageActionList,isAggregated:!!(C.value&&N!==0),"is-first-in-chunk":N===0,"is-last-in-chunk":N===D.messages.length-1,isHiddenMessageAvatar:!!(t.alignment==="two-sided"?C.value&&N!==0||k.flow==="out":C.value&&N!==0),"is-hidden-message-nick":!!(!P.value||(t.alignment==="two-sided"?C.value&&N!==0||k.flow==="out":C.value&&N!==0)),isHiddenMessageMeta:!!(C.value&&N!==D.messages.length-1)},null,8,["message","alignment","messageActionList","isAggregated","is-first-in-chunk","is-last-in-chunk","isHiddenMessageAvatar","is-hidden-message-nick","isHiddenMessageMeta"]))),128))])]),_:2},1032,["class"]))),128))],512),V(f($G)),i.value?(_(),U(f(RG),{key:0,class:S(f(ke)("scroll-to-bottom")),onClick:$[0]||($[0]=D=>f(v)({behavior:"smooth"}))},null,8,["class"])):Y("",!0)]))}}),LG=Z(NG,[["__scopeId","data-v-a1a9c72c"]]);un("en-US",{translation:{...Jv["en-US"]}});un("zh-CN",{translation:{...Jv["zh-CN"]}});const _q=LG;K_.getInstance().init();export{Rt as A,_q as C,hq as E,dq as M,mq as N,fq as O,gq as S,pq as a,sf as b,vq as u};
|