"use strict";const e=require("../../../../../../common/vendor.js");require("../../../../../adapter-vue.js");const s=require("../../../../../utils/env.js"),a=require("../../../../common/Toast/index.js"),t=require("./interface.js"),o=require("../../../emoji-config/index.js"),r=require("../../../../common/Toast/type.js"),u=e.defineComponent({__name:"index",props:{message:{default:()=>({})}},emits:["scrollTo","blinkMessage"],setup(u,{emit:n}){const m=n,c=u;let T=0;const i=e.ref(""),l=e.ref(!1),g=e.ref({}),E=e.computed((()=>{var s;try{const a=JSON.parse((null==(s=c.message)?void 0:s.cloudCustomData)||"{}"),t=e.Jt.getMessageModel(a.messageReply.messageID);return null==t?void 0:t.isRevoked}catch(a){return!0}}));async function p(){var t;if(E.value)return;const o=null==(t=g.value)?void 0:t.messageID,u=e.Jt.getData(e.o.CHAT,"messageList").some((e=>e.ID===o));if(o&&u)try{const a=await e.T("#messageScrollList","messageList"),t=await e.T("#tui-"+o,"messageList"),{scrollTop:r}=await e.P("#messageScrollList","messageList"),u=t.top+r-a.top-T++%2,n=t.top<a.top;if(!s.isUniFrameWork&&window){const e=document.getElementById("messageScrollList");n&&e&&(e.scrollTop=u)}else s.isUniFrameWork&&n&&m("scrollTo",u);m("blinkMessage",o)}catch(n){console.error(n)}else a.Toast({message:e.Wt.t("TUIChat.无法定位到原消息"),type:r.TOAST_TYPE.WARNING})}return e.onMounted((()=>{var s;try{const a=JSON.parse((null==(s=c.message)?void 0:s.cloudCustomData)||"{}");l.value=Boolean(a.messageReply),l.value&&(g.value=a.messageReply,i.value=function(s){let a="",o="";switch(s.messageType){case t.MessageQuoteTypeEnum.TYPE_TEXT:a="[文本]";break;case t.MessageQuoteTypeEnum.TYPE_CUSTOM:a="[自定义消息]";break;case t.MessageQuoteTypeEnum.TYPE_IMAGE:a="[图片]";break;case t.MessageQuoteTypeEnum.TYPE_SOUND:a="[音频]";break;case t.MessageQuoteTypeEnum.TYPE_VIDEO:a="[视频]";break;case t.MessageQuoteTypeEnum.TYPE_FILE:a="[文件]";break;case t.MessageQuoteTypeEnum.TYPE_LOCATION:a="[地理位置]";break;case t.MessageQuoteTypeEnum.TYPE_FACE:a="[动画表情]";break;case t.MessageQuoteTypeEnum.TYPE_GROUP_TIPS:a="[群提示]";break;case t.MessageQuoteTypeEnum.TYPE_MERGER:a="[聊天记录]";break;default:a="[消息]"}[t.MessageQuoteTypeEnum.TYPE_TEXT,t.MessageQuoteTypeEnum.TYPE_MERGER].includes(s.messageType)&&(o=s.messageAbstract);return o||e.Wt.t(`TUIChat.${a}`)}(g.value))}catch(a){l.value=!1}})),(s,a)=>e.e({a:e.unref(l)},e.unref(l)?e.e({b:e.unref(E)},e.unref(E)?{c:e.t(e.unref(e.Wt).t("TUIChat.引用内容已撤回"))}:{d:e.t(e.unref(g).messageSender),e:e.t(e.unref(o.transformTextWithKeysToEmojiNames)(e.unref(i)))},{f:"out"===s.message.flow?1:"",g:e.o$1(p)}):{})}}),n=e._export_sfc(u,[["__scopeId","data-v-ccb106a9"]]);wx.createComponent(n);
