"use strict";var e=Object.defineProperty,o=Object.defineProperties,t=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,d=(o,t,n)=>t in o?e(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,i=require("../../../../../../../common/vendor.js");const c=i.index.getRecorderManager(),l=i.defineComponent({props:{show:{type:Boolean,default:()=>!1}},setup(e,l){const s=i.reactive({popupToggle:!1,isRecording:!1,canSend:!0,text:"按住说话",recorderManager:null,title:" ",recordTime:0,recordTimer:null});i.onMounted((()=>{c.onStop((e=>{clearInterval(s.recordTimer);let o={duration:e.duration?e.duration:1e3*s.recordTime,tempFilePath:e.tempFilePath,fileSize:e.fileSize?e.fileSize:48*s.recordTime/8*1024};i.index.hideLoading(),s.canSend&&(o.duration<1e3?i.index.showToast({title:"录音时间太短",icon:"none"}):i.index.$TUIKit.TUIChatServer.sendAudioMessage(o)),s.popupToggle=!1,s.isRecording=!1,s.canSend=!0,s.title=" ",s.text="按住说话"}))}));return p=((e,o)=>{for(var t in o||(o={}))r.call(o,t)&&d(e,t,o[t]);if(n)for(var t of n(o))a.call(o,t)&&d(e,t,o[t]);return e})({},i.toRefs(s)),o(p,t({sendUploadMessage:e=>{Video.TUIServer.sendVideoMessage(e.target)},handleLongPress:e=>{s.popupToggle=!0,c.start({duration:6e4,sampleRate:44100,numberOfChannels:1,encodeBitRate:192e3,format:"aac"}),s.startPoint=e.target,s.title="正在录音",s.isRecording=!0,s.recordTime=0,s.recordTimer=setInterval((()=>{s.recordTime++}),1e3)},handleTouchEnd:()=>{s.isRecording=!1,s.popupToggle=!1,s.text="按住说话",i.index.hideLoading(),c.stop()},handleTouchMove:e=>{s.isRecording&&(e.currentTarget.offsetTop-e.changedTouches[e.changedTouches.length-1].clientY>100?(s.text="抬起停止",s.title="松开手指，取消发送",s.canSend=!1):e.currentTarget.offsetTop-e.changedTouches[e.changedTouches.length-1].clientY>20?(s.text="抬起停止",s.title="上划可取消",s.canSend=!0):(s.text="抬起停止",s.title="正在录音",s.canSend=!0))}}));var p}});var s=i._export_sfc(l,[["render",function(e,o,t,n,r,a){return i.e({a:i.t(e.text),b:e.popupToggle},e.popupToggle?{c:i.t(e.title),d:i.o(((...o)=>e.handleLongPress&&e.handleLongPress(...o))),e:i.o(((...o)=>e.handleTouchMove&&e.handleTouchMove(...o))),f:i.o(((...o)=>e.handleTouchEnd&&e.handleTouchEnd(...o)))}:{},{g:i.o(((...o)=>e.handleLongPress&&e.handleLongPress(...o))),h:i.o(((...o)=>e.handleTouchMove&&e.handleTouchMove(...o))),i:i.o(((...o)=>e.handleTouchEnd&&e.handleTouchEnd(...o)))})}],["__scopeId","data-v-6a920cd0"]]);wx.createComponent(s);
