if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((a=>t.resolve(e()).then((()=>a))),(a=>t.resolve(e()).then((()=>{throw a}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";function t(e,t,...a){uni.__log__?uni.__log__(e,t,...a):console[e].apply(console,[...a,t])}const a={development:{baseURL:"http://115.190.167.176:20002",timeout:3e4},production:{baseURL:"https://fhapp.ddn-ai.cloud",timeout:3e4}},o="production",i=a[o].baseURL,s=a[o].timeout,l={getAppConfig:"/api/config/app"},n={create:"/api/complaints"},r={plaza:"/api/works/plaza",findBySource:"/api/works/source",publishRevivalVideo:"/api/works/publish/revival-video",unpublish:"/api/works/unpublish"};function c(e){return e.startsWith("http://")||e.startsWith("https://")?e:`${i}${e}`}const d=(e,t)=>{const a=e.__vccOpts||e;for(const[o,i]of t)a[o]=i;return a};const u=d({components:{VideoSelectModal:d({props:{show:{type:Boolean,default:!1}},data:()=>({loading:!1,videos:[],selectedVideoId:"",selectedVideo:null}),watch:{show(e){e&&this.loadVideos()}},methods:{isVideoUsableForCall(e){if(!e)return!1;const t=e.edited_video_url||e.videoUrl||e.local_video_path||e.video_url||e.localVideoPath,a=e.voice_id||e.voiceId;return!!t&&!!a},async loadVideos(){this.loading=!0;const e=uni.getStorageSync("userId")||"",o=uni.getStorageSync("token")||"",l=t=>new Promise((a=>{t?uni.request({url:`${t}/api/photo-revival/videos`,method:"GET",timeout:s,header:{"X-User-Id":e,Authorization:o?`Bearer ${o}`:""},success:e=>{a({ok:!0,baseUrl:t,res:e})},fail:e=>{a({ok:!1,baseUrl:t,err:e})}}):a({ok:!1,baseUrl:t,err:{errMsg:"invalid url"}})})),n=await l(i);let r=n;if(!n.ok&&a&&a.development&&a.development.baseURL){const e=a.development.baseURL;r=await l(e)}if(!r.ok)return t("error","at components/VideoSelectModal.vue:155","[VideoSelectModal] 加载视频列表失败:",r.err),uni.showToast({title:r.err&&r.err.errMsg?r.err.errMsg:"加载失败",icon:"none"}),this.videos=[],void(this.loading=!1);const c=r.res;if(200===c.statusCode){let e=[];return Array.isArray(c.data)?e=c.data:c.data&&Array.isArray(c.data.data)?e=c.data.data:c.data&&c.data.videos&&Array.isArray(c.data.videos)&&(e=c.data.videos),this.videos=(e||[]).filter((e=>this.isVideoUsableForCall(e))),void(this.loading=!1)}uni.showToast({title:`加载失败(HTTP ${c.statusCode})`,icon:"none"}),this.videos=[],this.loading=!1},selectVideo(e){this.selectedVideoId=e.id,this.selectedVideo=e},handleConfirm(){this.selectedVideo?(this.$emit("confirm",this.selectedVideo),this.handleClose()):uni.showToast({title:"请选择视频",icon:"none"})},handleClose(){this.selectedVideoId="",this.selectedVideo=null,this.$emit("close")},goToRevival(){this.handleClose(),uni.navigateTo({url:"/pages/revival/revival-original"})},formatTime(e){if(!e)return"";const t=new Date(e);return`${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}}},[["render",function(t,a,o,i,s,l){return o.show?(e.openBlock(),e.createElementBlock("view",{key:0,class:"modal-mask",onClick:a[5]||(a[5]=(...e)=>l.handleClose&&l.handleClose(...e))},[e.createElementVNode("view",{class:"modal-container",onClick:a[4]||(a[4]=e.withModifiers((()=>{}),["stop"]))},[e.createElementVNode("view",{class:"modal-header"},[e.createElementVNode("text",{class:"modal-title"},"📹 选择复活视频"),e.createElementVNode("text",{class:"modal-close",onClick:a[0]||(a[0]=(...e)=>l.handleClose&&l.handleClose(...e))},"✕")]),e.createElementVNode("view",{class:"modal-content"},[s.loading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"loading-box"},[e.createElementVNode("text",{class:"loading-text"},"⏳ 加载视频列表...")])):s.videos.length>0?(e.openBlock(),e.createElementBlock("scroll-view",{key:1,"scroll-y":"",class:"video-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.videos,(t=>(e.openBlock(),e.createElementBlock("view",{key:t.id,class:e.normalizeClass(["video-card",s.selectedVideoId===t.id?"selected":""]),onClick:e=>l.selectVideo(t)},[e.createElementVNode("view",{class:"video-cover"},[t.photo_url?(e.openBlock(),e.createElementBlock("image",{key:0,src:t.photo_url,class:"cover-image",mode:"aspectFill"},null,8,["src"])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"cover-placeholder"},[e.createElementVNode("text",{class:"placeholder-icon"},"🎬")])),s.selectedVideoId===t.id?(e.openBlock(),e.createElementBlock("view",{key:2,class:"selected-badge"},[e.createElementVNode("text",{class:"badge-icon"},"✓")])):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"video-info"},[e.createElementVNode("text",{class:"video-name"},e.toDisplayString(t.name||"复活视频"),1),e.createElementVNode("text",{class:"video-desc"},e.toDisplayString(t.text||"暂无描述"),1),e.createElementVNode("text",{class:"video-time"},e.toDisplayString(l.formatTime(t.create_time)),1)])],10,["onClick"])))),128))])):(e.openBlock(),e.createElementBlock("view",{key:2,class:"empty-box"},[e.createElementVNode("text",{class:"empty-icon"},"🎬"),e.createElementVNode("text",{class:"empty-text"},"暂无复活视频"),e.createElementVNode("text",{class:"empty-hint"},"请先去复活照片生成视频"),e.createElementVNode("button",{class:"go-revival-btn",onClick:a[1]||(a[1]=(...e)=>l.goToRevival&&l.goToRevival(...e))}," 🎬 去复活照片 ")]))]),e.createElementVNode("view",{class:"modal-footer"},[e.createElementVNode("button",{class:"modal-btn cancel",onClick:a[2]||(a[2]=(...e)=>l.handleClose&&l.handleClose(...e))},"取消"),e.createElementVNode("button",{class:"modal-btn confirm",disabled:!s.selectedVideoId,onClick:a[3]||(a[3]=(...e)=>l.handleConfirm&&l.handleConfirm(...e))}," 开始通话 ",8,["disabled"])])])])):e.createCommentVNode("",!0)}],["__scopeId","data-v-5b341767"]])},data:()=>({apiBase:i,title:"时光意境 · AI亲人重逢",showVideoSelect:!1,banners:[]}),onLoad(){this.loadHomeBanners()},methods:{resolveUrl(e){return e?e.startsWith("http://")||e.startsWith("https://")?e:`${this.apiBase}${e}`:""},async loadHomeBanners(){try{const e=await function(e){const{url:t,method:a="GET",data:o={},header:i={},timeout:l=s}=e,n=uni.getStorageSync("userId")||"",r=uni.getStorageSync("token")||"";return new Promise(((e,s)=>{uni.request({url:c(t),method:a,data:o,header:{"Content-Type":"application/json","X-User-Id":n||"",...r?{Authorization:`Bearer ${r}`}:{},...i},timeout:l,success:t=>{200===t.statusCode?e(t.data):401===t.statusCode?(uni.removeStorageSync("token"),uni.removeStorageSync("userId"),uni.removeStorageSync("userPhone"),uni.removeStorageSync("userNickname"),uni.removeStorageSync("username"),uni.showToast({title:"登录已过期,请重新登录",icon:"none"}),setTimeout((()=>{uni.reLaunch({url:"/pages/login/login"})}),1500),s(new Error("未授权"))):s(new Error(`请求失败: ${t.statusCode}`))},fail:e=>{s(e)}})}))}({url:"/api/system/home-banners",method:"GET"}),t=e&&e.success?e.data:[];Array.isArray(t)?this.banners=t.filter((e=>e&&e.url&&!1!==e.enabled)).sort(((e,t)=>(Number(e.sort)||0)-(Number(t.sort)||0))):this.banners=[]}catch(e){this.banners=[]}},handleBannerClick(e){if(e&&e.link){if(String(e.link).startsWith("/pages/"))return void uni.navigateTo({url:e.link});uni.setClipboardData({data:String(e.link)}),uni.showToast({title:"已复制链接",icon:"none"})}},checkLogin(){const e=uni.getStorageSync("token"),t=uni.getStorageSync("userId");return!(!e||!t)},goVoiceClone(){uni.switchTab({url:"/pages/revival/revival",fail:()=>{uni.navigateTo({url:"/pages/revival/revival"})}})},goPhotoRevival(){uni.navigateTo({url:"/pages/revival/revival-original"})},goPlaza(){uni.navigateTo({url:"/pages/plaza/plaza"})},startVideoCall(){this.checkLogin()?this.showVideoSelect=!0:uni.showModal({title:"提示",content:"请先登录后再使用此功能",confirmText:"去登录",cancelText:"取消",success:e=>{e.confirm&&uni.navigateTo({url:"/pages/login/login"})}})},goAICall(){uni.switchTab({url:"/pages/phone-call/phone-call",fail:()=>{uni.navigateTo({url:"/pages/phone-call/phone-call"})}})},handleVideoSelect(e){t("log","at pages/index/index.vue:195","[Index] 选择视频:",e),uni.navigateTo({url:`/pages/video-call-new/video-call-new?videoId=${e.id}&videoName=${encodeURIComponent(e.name||"复活视频")}&videoUrl=${encodeURIComponent(e.videoUrl||e.local_video_path||e.video_url)}&voiceId=${e.voice_id||e.voiceId}`})},goShortDrama(){uni.navigateTo({url:"/pages/short-drama/short-drama"})}}},[["render",function(t,a,o,i,s,l){const n=e.resolveComponent("VideoSelectModal");return e.openBlock(),e.createElementBlock("view",{class:"memorial-bg"},[e.createElementVNode("image",{class:"bg-image",src:`${s.apiBase}/static/bg.png`,mode:"aspectFill"},null,8,["src"]),e.createElementVNode("view",{class:"memorial-content"},[e.createElementVNode("view",{class:"header"},[e.createElementVNode("text",{class:"logo"},"时光意境 · AI亲人重逢"),e.createElementVNode("text",{class:"tagline"},"用科技温暖记忆,让告别不留遗憾")]),e.createElementVNode("view",{class:"memorial-quote"},[e.createElementVNode("swiper",{class:"banner-swiper",circular:!0,autoplay:!0,interval:3500,duration:500,"indicator-dots":!0,"indicator-color":"rgba(255,255,255,0.5)","indicator-active-color":"#8B7355"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.banners,((t,a)=>(e.openBlock(),e.createElementBlock("swiper-item",{key:a},[e.createElementVNode("view",{class:"banner-item",onClick:e=>l.handleBannerClick(t)},[e.createElementVNode("image",{class:"banner-image",src:l.resolveUrl(t.url),mode:"aspectFill"},null,8,["src"])],8,["onClick"])])))),128))])]),e.createElementVNode("view",{class:"feature-grid"},[e.createElementVNode("view",{class:"feature-item",onClick:a[0]||(a[0]=(...e)=>l.goPlaza&&l.goPlaza(...e))},[e.createElementVNode("view",{class:"feature-icon"},"🖼️"),e.createElementVNode("text",{class:"feature-name"},"作品广场")]),e.createElementVNode("view",{class:"feature-item",onClick:a[1]||(a[1]=(...e)=>l.goPhotoRevival&&l.goPhotoRevival(...e))},[e.createElementVNode("view",{class:"feature-icon"},"📸"),e.createElementVNode("text",{class:"feature-name"},"照片复活")]),e.createElementVNode("view",{class:"feature-item",onClick:a[2]||(a[2]=(...e)=>l.goShortDrama&&l.goShortDrama(...e))},[e.createElementVNode("view",{class:"feature-icon"},"🎬"),e.createElementVNode("text",{class:"feature-name"},"看短剧")]),e.createElementVNode("view",{class:"feature-item",onClick:a[3]||(a[3]=(...e)=>l.goAICall&&l.goAICall(...e))},[e.createElementVNode("view",{class:"feature-icon"},"📹"),e.createElementVNode("text",{class:"feature-name"},"视频通话")])]),e.createElementVNode("view",{class:"video-call-section"},[e.createElementVNode("button",{class:"video-call-btn",onClick:a[4]||(a[4]=(...e)=>l.startVideoCall&&l.startVideoCall(...e))},[e.createElementVNode("text",{class:"btn-icon"},"📹"),e.createElementVNode("text",{class:"btn-text"},"开始视频通话")])]),e.createElementVNode("view",{class:"cta-section"},[e.createElementVNode("text",{class:"cta-text"},'只需简单三步,即可与记忆中的亲人温暖"重逢"')])]),e.createVNode(n,{show:s.showVideoSelect,onClose:a[5]||(a[5]=e=>s.showVideoSelect=!1),onConfirm:l.handleVideoSelect},null,8,["show","onConfirm"])])}],["__scopeId","data-v-8244b31e"]]);const h=d({data:()=>({API_BASE:i,works:[],page:0,size:10,loading:!1,hasMore:!0,loadedOnce:!1,hasCachedWorks:!1,preloadQueue:[],activePreloads:0,maxConcurrentPreloads:2,preloadingKeys:{}}),onLoad(){try{const e=uni.getStorageSync("plaza_works_cache_v1");Array.isArray(e)&&e.length>0&&(this.works=e,this.hasCachedWorks=!0,this.loadedOnce=!0)}catch(e){this.hasCachedWorks=!1}this.loadWorks(!0)},onShow(){this.loadedOnce&&0!==this.works.length||this.loadWorks(!0)},methods:{normalizeMediaUrl(e){return e?e.startsWith("/")?`${this.API_BASE}${e}`:e.startsWith("http://115.190.167.176:20002")?e.replace("http://115.190.167.176:20002",this.API_BASE):e:e},generateCacheKey(e){let t=0;for(let a=0;a0;){const e=this.preloadQueue.shift();this.activePreloads+=1,this.preloadVideoToCache(e.url,e.cacheKey).finally((()=>{this.activePreloads=Math.max(0,this.activePreloads-1),this.processPreloadQueue()}))}},preloadVideoToCache(e,t){return new Promise((a=>{uni.downloadFile({url:e,timeout:6e4,success:o=>{200===o.statusCode?uni.saveFile({tempFilePath:o.tempFilePath,success:o=>{const i=o.savedFilePath;uni.setStorageSync(t,i);const s=uni.getStorageSync("video_cache_info")||{};s[t]={path:i,url:e,time:Date.now()},uni.setStorageSync("video_cache_info",s),a()},fail:()=>{a()}}):a()},fail:()=>{a()},complete:()=>{this.preloadingKeys&&t&&(this.preloadingKeys[t]=!1)}})}))},preloadWorks(e){Array.isArray(e)&&0!==e.length&&uni.getNetworkType({success:t=>{t&&"wifi"===t.networkType&&e.forEach((e=>{e&&e.contentUrl&&this.enqueuePreload(e.contentUrl)}))},fail:()=>{}})},getWorkTypeLabel:e=>({VOICE_CLONE:"声音克隆",PHOTO_REVIVAL:"照片复活",VIDEO_CALL:"视频对话"}[e]||"作品"),toggleLike(e){const t=uni.getStorageSync("token")||"",a=uni.getStorageSync("userId")||"";a?uni.request({url:`${this.API_BASE}/api/works/${e.id}/like`,method:"POST",header:{"X-User-Id":a,Authorization:t?`Bearer ${t}`:""},success:t=>{var a;if(200===t.statusCode&&t.data&&t.data.success&&t.data.data)return e.liked=!!t.data.data.liked,void(e.likeCount=t.data.data.likeCount||0);uni.showToast({title:(null==(a=t.data)?void 0:a.message)||"操作失败",icon:"none"})},fail:()=>{uni.showToast({title:"操作失败",icon:"none"})}}):uni.showToast({title:"请先登录",icon:"none"})},formatTime(e){if(!e)return"";const t=new Date(e);if(Number.isNaN(t.getTime()))return String(e);const a=e=>e<10?`0${e}`:`${e}`;return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())} ${a(t.getHours())}:${a(t.getMinutes())}:${a(t.getSeconds())}`},loadMore(){!this.loading&&this.hasMore&&this.loadWorks(!1)},loadWorks(e){if(this.loading)return;this.loading=!0;const t=uni.getStorageSync("token")||"",a=uni.getStorageSync("userId")||"";e&&(this.page=0,this.hasMore=!0,this.hasCachedWorks||(this.works=[])),uni.request({url:`${this.API_BASE}${r.plaza}?page=${this.page}&size=${this.size}`,method:"GET",header:{"X-User-Id":a,Authorization:t?`Bearer ${t}`:""},success:t=>{if(200===t.statusCode&&t.data){const o=(t.data.content||[]).map((e=>({...e,coverUrl:this.normalizeMediaUrl(e.coverUrl),contentUrl:this.normalizeMediaUrl(e.contentUrl),audioUrl:this.normalizeMediaUrl(e.audioUrl),workTypeLabel:this.getWorkTypeLabel(e.workType),likeCount:e.likeCount||0,liked:!!e.liked})));if(e){this.works=o,this.hasCachedWorks=!1;try{uni.setStorageSync("plaza_works_cache_v1",o)}catch(a){}}else this.works=this.works.concat(o);return this.page+=1,this.hasMore=!t.data.last,void(this.loadedOnce=!0)}uni.showToast({title:`加载失败(${t.statusCode})`,icon:"none"})},fail:()=>{uni.showToast({title:"加载失败",icon:"none"})},complete:()=>{this.loading=!1}})},viewWork(e){if(!e||!e.contentUrl&&!e.editedVideoUrl&&!e.edited_video_url)return void uni.showToast({title:"作品不可用",icon:"none"});const t=e.editedVideoUrl||e.edited_video_url||e.contentUrl;let a=`/pages/video-player/video-player?audioInVideo=1&url=${encodeURIComponent(t)}&title=${encodeURIComponent(e.title||"作品")}`;uni.navigateTo({url:a})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"plaza-container"},[e.createElementVNode("view",{class:"header"},[e.createElementVNode("text",{class:"title"},"作品广场"),e.createElementVNode("text",{class:"subtitle"},"发现大家发布的作品")]),e.createElementVNode("scroll-view",{"scroll-y":"",class:"works-list",onScrolltolower:a[1]||(a[1]=(...e)=>l.loadMore&&l.loadMore(...e))},[s.loading&&0===s.works.length?(e.openBlock(),e.createElementBlock("view",{key:0,class:"works-grid skeleton-grid"},[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(6,(t=>e.createElementVNode("view",{key:t,class:"work-card skeleton-card"},[e.createElementVNode("view",{class:"work-cover skeleton-cover"}),e.createElementVNode("view",{class:"work-info"},[e.createElementVNode("view",{class:"skeleton-line skeleton-title"}),e.createElementVNode("view",{class:"skeleton-line skeleton-sub"}),e.createElementVNode("view",{class:"skeleton-line skeleton-sub short"})])]))),64))])):s.loading||0!==s.works.length?(e.openBlock(),e.createElementBlock("view",{key:2,class:"works-grid"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.works,(t=>(e.openBlock(),e.createElementBlock("view",{key:t.id,class:"work-card",onClick:e=>l.viewWork(t)},[e.createElementVNode("view",{class:"work-cover"},[t.coverUrl?(e.openBlock(),e.createElementBlock("image",{key:0,src:t.coverUrl,mode:"aspectFill",class:"cover-img"},null,8,["src"])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"cover-placeholder"},[e.createElementVNode("text",{class:"placeholder-icon"},"🎬")])),e.createElementVNode("view",{class:"work-type"},e.toDisplayString(t.workTypeLabel),1)]),e.createElementVNode("view",{class:"work-info"},[e.createElementVNode("text",{class:"work-title"},e.toDisplayString(t.title),1),e.createElementVNode("text",{class:"work-author"},e.toDisplayString(t.userNickname||"匿名"),1),e.createElementVNode("text",{class:"work-time"},e.toDisplayString(l.formatTime(t.publishedAt||t.createdAt)),1),e.createElementVNode("view",{class:"work-actions",onClick:a[0]||(a[0]=e.withModifiers((()=>{}),["stop"]))},[e.createElementVNode("view",{class:e.normalizeClass(["like-btn",{liked:t.liked}]),onClick:e.withModifiers((e=>l.toggleLike(t)),["stop"])},[e.createElementVNode("text",{class:"like-icon"},e.toDisplayString(t.liked?"❤️":"🤍"),1),e.createElementVNode("text",{class:"like-count"},e.toDisplayString(t.likeCount||0),1)],10,["onClick"])])])],8,["onClick"])))),128))])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"empty-box"},[e.createElementVNode("text",{class:"empty-icon"},"🖼️"),e.createElementVNode("text",{class:"empty-text"},"暂无作品"),e.createElementVNode("text",{class:"empty-hint"},"快去发布你的第一个作品吧")])),s.loading&&s.works.length>0?(e.openBlock(),e.createElementBlock("view",{key:3,class:"loading-more"},[e.createElementVNode("text",{class:"loading-more-text"},"⏳ 加载更多...")])):e.createCommentVNode("",!0),!s.hasMore&&s.works.length>0?(e.openBlock(),e.createElementBlock("view",{key:4,class:"no-more"},[e.createElementVNode("text",{class:"no-more-text"},"没有更多了")])):e.createCommentVNode("",!0)],32)])}],["__scopeId","data-v-9812818e"]]);const v=d({name:"PaymentModal",props:{show:{type:Boolean,default:!1},serviceType:{type:String,required:!0},serviceName:{type:String,required:!0},serviceDesc:{type:String,default:""},price:{type:[String,Number],required:!0},orderNo:{type:String,default:""},paymentTips:{type:String,default:"点击确认支付后将开始处理您的请求"}},data:()=>({paying:!1,createTime:""}),watch:{show(e){e&&(this.createTime=this.formatTime(new Date))}},methods:{handleOverlayClick(){this.paying||this.handleClose()},handleClose(){this.paying||this.$emit("close")},async handleConfirm(){if(!this.paying){this.paying=!0;try{this.$emit("confirm",{serviceType:this.serviceType,orderNo:this.orderNo,price:this.price})}catch(e){t("error","at components/PaymentModal.vue:158","[PaymentModal] 支付失败:",e),this.paying=!1}}},paymentSuccess(){this.paying=!1,this.$emit("success")},paymentFailed(e){this.paying=!1,this.$emit("failed",e)},formatTime:e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")} ${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`}},[["render",function(t,a,o,i,s,l){return o.show?(e.openBlock(),e.createElementBlock("view",{key:0,class:"payment-modal-overlay",onClick:a[4]||(a[4]=(...e)=>l.handleOverlayClick&&l.handleOverlayClick(...e))},[e.createElementVNode("view",{class:"payment-modal",onClick:a[3]||(a[3]=e.withModifiers((()=>{}),["stop"]))},[e.createElementVNode("view",{class:"modal-decoration"},[e.createElementVNode("view",{class:"decoration-circle circle-1"}),e.createElementVNode("view",{class:"decoration-circle circle-2"}),e.createElementVNode("view",{class:"decoration-circle circle-3"})]),e.createElementVNode("view",{class:"close-btn",onClick:a[0]||(a[0]=(...e)=>l.handleClose&&l.handleClose(...e))},[e.createElementVNode("text",{class:"close-icon"},"✕")]),e.createElementVNode("view",{class:"icon-section"},[e.createElementVNode("view",{class:"icon-wrapper"},[e.createElementVNode("text",{class:"icon"},"💳")])]),e.createElementVNode("view",{class:"title-section"},[e.createElementVNode("text",{class:"main-title"},"确认支付"),e.createElementVNode("text",{class:"sub-title"},e.toDisplayString(o.serviceName),1)]),e.createElementVNode("view",{class:"price-display"},[e.createElementVNode("view",{class:"price-wrapper"},[e.createElementVNode("text",{class:"price-symbol"},"¥"),e.createElementVNode("text",{class:"price-value"},e.toDisplayString(o.price),1)]),e.createElementVNode("text",{class:"price-desc"},e.toDisplayString(o.serviceDesc),1)]),e.createElementVNode("view",{class:"order-details"},[e.createElementVNode("view",{class:"detail-item"},[e.createElementVNode("text",{class:"detail-label"},"订单编号"),e.createElementVNode("text",{class:"detail-value"},e.toDisplayString(o.orderNo.slice(-8)),1)]),e.createElementVNode("view",{class:"detail-divider"}),e.createElementVNode("view",{class:"detail-item"},[e.createElementVNode("text",{class:"detail-label"},"创建时间"),e.createElementVNode("text",{class:"detail-value"},e.toDisplayString(s.createTime),1)])]),e.createElementVNode("view",{class:"tips-section"},[e.createElementVNode("view",{class:"tips-content"},[e.createElementVNode("text",{class:"tips-icon"},"🔒"),e.createElementVNode("text",{class:"tips-text"},"安全支付 · 快速到账")])]),e.createElementVNode("view",{class:"action-buttons"},[e.createElementVNode("button",{class:"btn btn-cancel",onClick:a[1]||(a[1]=(...e)=>l.handleClose&&l.handleClose(...e)),disabled:s.paying}," 取消 ",8,["disabled"]),e.createElementVNode("button",{class:"btn btn-confirm",onClick:a[2]||(a[2]=(...e)=>l.handleConfirm&&l.handleConfirm(...e)),disabled:s.paying},[s.paying?(e.openBlock(),e.createElementBlock("text",{key:1,class:"paying-text"},[e.createElementVNode("text",{class:"loading-dot"},"●"),e.createElementVNode("text",{class:"loading-dot"},"●"),e.createElementVNode("text",{class:"loading-dot"},"●")])):(e.openBlock(),e.createElementBlock("text",{key:0},"立即支付"))],8,["disabled"])])])])):e.createCommentVNode("",!0)}],["__scopeId","data-v-71b49705"]]);function g(e){const t={"湾区大叔":"台湾","台湾小何":"台湾","双节棍小哥":"台湾","广州德哥":"广州","浩宇小哥":"大陆","湾湾小何":"台湾","北京小爷":"北京","京腔侃爷/Harmony":"北京","林北浩儿":"台湾","粤语小灿":"广东","泉州子轩":"福建","豫州子轩":"河南","呆萌川妹":"四川","广西远舟":"广西","妹坨洁儿":"湖南"};return(e||[]).map((e=>{if(!e)return e;if("OFFICIAL"!==(e.voice_type||"CLONE"))return e;const a=e.voice_name?String(e.voice_name):"",o=a&&t[a]?t[a]:"";return o&&a?0===a.indexOf(o+"-")?e:{...e,voice_name:`${o}-${a}`}:e}))}const m={CREATE_VOICE:"voice_clone",PHOTO_REVIVAL:"photo_revival",VOLCENGINE_VIDEO:"volcengine_video",SYNTHESIZE:"tts_synthesis",VIDEO_CALL:"video_call",AI_CALL:"conversation"},p={VOICE_CLONE:{type:"voice_clone",backendType:"CREATE_VOICE",name:"声音克隆",desc:"克隆您的声音,让AI学会您的音色",price:0,freeTrialCount:0},PHOTO_REVIVAL:{type:"photo_revival",backendType:"PHOTO_REVIVAL",name:"照片复活",desc:"让照片中的人开口说话",price:0,freeTrialCount:0},VOLCENGINE_VIDEO:{type:"volcengine_video",backendType:"VOLCENGINE_VIDEO",name:"火山视频复活",desc:"火山视频复活",price:0,freeTrialCount:0},TTS_SYNTHESIS:{type:"tts_synthesis",backendType:"SYNTHESIZE",name:"语音合成",desc:"使用已有音色合成语音",price:0,freeTrialCount:0},VIDEO_CALL:{type:"video_call",backendType:"VIDEO_CALL",name:"AI视频通话",desc:"AI视频通话",price:0,freeTrialCount:0},CONVERSATION:{type:"conversation",backendType:"AI_CALL",name:"实时对话",desc:"与AI进行实时语音对话",price:0,freeTrialCount:0}};let w=null,V=0;async function y(){const e=Date.now();return w&&e-V<3e5?(t("log","at utils/payment.js:124","[Payment] 使用缓存价格数据"),w):(t("log","at utils/payment.js:128","[Payment] 开始获取服务价格,API地址:",`${i}/api/pay/prices`),new Promise(((a,o)=>{uni.request({url:`${i}/api/pay/prices`,method:"GET",success:i=>{if(t("log","at utils/payment.js:135","[Payment] 价格API响应:",i),200===i.statusCode&&i.data){w=i.data,V=e,t("log","at utils/payment.js:141","[Payment] 后端返回价格数据:",i.data);let o=0;i.data.forEach((e=>{t("log","at utils/payment.js:146","[Payment] 处理价格项:",e);const a=m[e.serviceType];if(t("log","at utils/payment.js:148","[Payment] 映射类型:",e.serviceType,"->",a),a){const i=Object.keys(p).find((e=>p[e].type===a));i&&p[i]&&(t("log","at utils/payment.js:155","[Payment] 更新服务:",i,"价格:",e.price,"免费次数:",e.freeTrialCount),p[i].price=e.price,p[i].freeTrialCount=e.freeTrialCount||0,p[i].name=e.serviceName,p[i].desc=e.description||p[i].desc,o++)}else t("warn","at utils/payment.js:163","[Payment] 未找到映射的前端类型:",e.serviceType)})),t("log","at utils/payment.js:167","[Payment] 价格更新完成,共更新",o,"个服务"),t("log","at utils/payment.js:168","[Payment] 最终SERVICE_TYPES:",JSON.stringify(p,null,2)),a(i.data)}else{if(t("error","at utils/payment.js:171","[Payment] 获取价格失败,状态码:",i.statusCode),w)return void a(w);o(new Error("获取价格失败"))}},fail:e=>{t("error","at utils/payment.js:180","[Payment] 获取价格请求失败:",e),w?a(w):o(e)}})})))}function E(){return`ORD${Date.now()}${Math.floor(1e4*Math.random()).toString().padStart(4,"0")}`}function N(){return{userId:uni.getStorageSync("userId")||"",token:uni.getStorageSync("token")||""}}async function C(e){try{const{userId:a,token:o}=N();if(!a)return!1;const s=Object.values(p).find((t=>t.type===e)),l=s?s.backendType:e;return await new Promise((e=>{uni.request({url:`${i}/api/pay/check?userId=${a}&serviceType=${l}`,method:"GET",header:{"X-User-Id":a,Authorization:o?`Bearer ${o}`:""},success:a=>{if(200===a.statusCode&&a.data&&"boolean"==typeof a.data.paid){const o=a.data||{};if(t("log","at utils/payment.js:266","[Payment] /api/pay/check 响应:",l,o),!1===o.paid)return void e(!1);const i="number"==typeof o.remainingTotal?o.remainingTotal:"number"==typeof o.remaining?o.remaining:"number"==typeof o.remainingCount?o.remainingCount:"number"==typeof o.remainingTimes?o.remainingTimes:null,s="number"==typeof o.freeTrialRemaining?o.freeTrialRemaining:"number"==typeof o.freeTrialLeft?o.freeTrialLeft:null;return"number"==typeof i&&i>0||"number"==typeof s&&s>0?void e(!0):void e(!1)}e(!1)},fail:()=>e(!1)})}))}catch(a){return t("error","at utils/payment.js:299","[Payment] 后端资格校验异常:",a),!1}}async function k(e,a){try{if(await C(e))return t("log","at utils/payment.js:671","[Payment] 后端校验通过,跳过支付:",e),{success:!0,message:"已具备使用资格,无需支付",skipPayment:!0}}catch(i){t("error","at utils/payment.js:679","[Payment] 后端资格校验失败(忽略继续走支付):",i)}await y();const o=Object.values(p).find((t=>t.type===e));if(o&&0===o.price){t("log","at utils/payment.js:688","[Payment] 服务价格为0,跳过支付流程");const e={success:!0,orderNo:E(),payTime:(new Date).toISOString(),message:"免费服务,无需支付",free:!0};return uni.showToast({title:"免费使用",icon:"success",duration:1500}),t("log","at utils/payment.js:704","[Payment] 免费服务,直接返回成功:",e),e}try{t("log","at utils/payment.js:711","[Payment] APP环境 - 使用模拟支付流程"),t("log","at utils/payment.js:712","[Payment] 服务类型:",e),t("log","at utils/payment.js:713","[Payment] 用户ID:",a),uni.showLoading({title:"正在支付...",mask:!0}),await new Promise((e=>setTimeout(e,1500)));const o={success:!0,orderNo:E(),payTime:(new Date).toISOString(),message:"支付成功(模拟)",mock:!0};return uni.hideLoading(),uni.showToast({title:"支付成功",icon:"success",duration:2e3}),t("log","at utils/payment.js:741","[Payment] 模拟支付成功:",o),o}catch(s){throw uni.hideLoading(),t("error","at utils/payment.js:745","[Payment] 模拟支付失败:",s),s}}async function T(e,a,o,s){try{await y()}catch(n){}try{if(await C(a)){t("log","at utils/payment.js:893","[Payment] 后端校验通过,跳过支付弹窗:",a);try{const e=await async function(e){try{const{userId:t,token:a}=N();if(!t)return null;const o=Object.values(p).find((t=>t.type===e)),s=o?o.backendType:e;return await new Promise((e=>{uni.request({url:`${i}/api/pay/usage-preview?serviceType=${s}`,method:"GET",header:{"X-User-Id":t,Authorization:a?`Bearer ${a}`:""},success:t=>{200===t.statusCode&&t.data&&t.data.success?e(t.data):e(null)},fail:()=>e(null)})}))}catch(n){return null}}(a);e&&"FREE_TRIAL"===e.consumeType&&uni.showToast({title:"本次使用免费次数",icon:"none",duration:1500})}catch(n){}return void(o&&o({success:!0,skipPayment:!0,message:"已具备使用资格,无需支付"}))}}catch(n){t("error","at utils/payment.js:912","[Payment] 后端资格校验失败(忽略继续弹窗):",n)}const l=Object.values(p).find((e=>e.type===a));if(!l){const e=new Error("无效的服务类型");return t("error","at utils/payment.js:919","[Payment] 显示支付弹窗失败:",e),uni.showToast({title:"无效的服务类型",icon:"none"}),void(s&&s(e))}if(0!==l.price)(async function(e,a={}){try{await y();const o=Object.values(p).find((t=>t.type===e));if(!o)throw new Error("无效的服务类型");const i=E();return t("log","at utils/payment.js:323","[Payment] 创建订单:",{orderNo:i,serviceType:e,serviceName:o.name,amount:o.price}),{orderNo:i,serviceType:e,serviceName:o.name,amount:o.price,service:o,...a}}catch(o){throw t("error","at utils/payment.js:339","[Payment] 创建订单失败:",o),o}})(a).then((t=>{e.paymentModalData={show:!0,serviceType:l.type,serviceName:l.name,serviceDesc:l.desc,price:l.price,orderNo:t.orderNo},e._paymentOnSuccess=o,e._paymentOnFailed=s})).catch((e=>{t("error","at utils/payment.js:968","[Payment] 创建订单失败:",e),uni.showToast({title:e.message||"创建订单失败",icon:"none"}),s&&s(e)}));else{t("log","at utils/payment.js:932","[Payment] 服务价格为0,跳过支付弹窗,直接执行");try{const e=N().userId,t=await k(a,e);o&&o(t)}catch(r){t("error","at utils/payment.js:942","[Payment] 免费服务执行失败:",r),s&&s(r)}}}async function S(e,a){try{const t=N().userId,o=await k(a.serviceType,t);e.$refs.paymentModal&&e.$refs.paymentModal.paymentSuccess(),e.paymentModalData.show=!1,uni.showToast({title:"支付成功",icon:"success"}),e._paymentOnSuccess&&e._paymentOnSuccess(o),e._paymentResolve&&e._paymentResolve(o)}catch(o){t("error","at utils/payment.js:1014","[Payment] 支付失败:",o),e.$refs.paymentModal&&e.$refs.paymentModal.paymentFailed(o),uni.showToast({title:o.message||"支付失败",icon:"none"}),e._paymentOnFailed&&e._paymentOnFailed(o),e._paymentReject&&e._paymentReject(o)}}class f{static async ensurePermission(e,a={}){const{permissionName:o="权限",reason:i="使用相关功能",showGuide:s=!0}=a;return new Promise((a=>{if("undefined"==typeof plus)return t("warn","at utils/permission.js:26","[PermissionManager] plus API不可用"),void a(!1);let l=null;if("record"===e||"microphone"===e)l="RECORD_AUDIO";else if("camera"===e)l="CAMERA";else{if("location"!==e)return t("warn","at utils/permission.js:40",`[PermissionManager] 未知的权限类型: ${e}`),void a(!1);l="ACCESS_FINE_LOCATION"}plus.android.checkPermission(l,(e=>{1===e?a(!0):plus.android.requestPermission(l,(e=>{1===e?a(!0):(s&&uni.showModal({title:`需要${o}权限`,content:`${i}需要${o}权限才能使用。\n\n请前往:\n手机设置 → 应用管理 → 忆境 → 权限管理 → 开启${o}权限`,confirmText:"我知道了",showCancel:!1}),a(!1))}),(e=>{t("error","at utils/permission.js:72",`[PermissionManager] 请求${o}权限失败:`,e),s&&uni.showModal({title:`需要${o}权限`,content:`${i}需要${o}权限才能使用。\n\n请前往:\n手机设置 → 应用管理 → 时光意境 → 权限管理 → 开启${o}权限`,confirmText:"我知道了",showCancel:!1}),a(!1)}))}),(e=>{t("error","at utils/permission.js:86",`[PermissionManager] 检查${o}权限失败:`,e),a(!1)}))}))}}const x="/static/iconfont/delete.svg";const b=d({components:{PaymentModal:v},data:()=>({API_BASE:i,activeTab:"synthesize",loading:!1,message:{type:"",text:""},selectedFile:null,voiceDisplayName:"",voices:[],voiceTypeOptions:[{value:"CLONE",label:"克隆音色"},{value:"OFFICIAL",label:"官方音色(Flash/BigTTS)"}],selectedVoiceType:"CLONE",selectedVoiceTypeLabel:"克隆音色",selectedVoiceId:"",selectedVoiceName:"",selectedDialect:"",selectedLanguageHint:"",selectedLanguageHintLabel:"",selectedSupportsDialect:!1,selectedSupportsLanguageHints:!1,languageHintOptions:["中文(zh)","英文(en)","法语(fr)","德语(de)","日语(ja)","韩语(ko)","俄语(ru)"],dialectOptions:["广东话","东北话","甘肃话","贵州话","河南话","湖北话","江西话","闽南话","宁夏话","山西话","陕西话","山东话","上海话","四川话","天津话","云南话"],ttsText:"",ttsLoading:!1,audioUrl:null,templates:[],expandedCategory:"memorial",isRecording:!1,recorderManager:null,conversationVoiceId:"",conversationVoiceLabel:"",conversationDialect:"",conversationLanguageHint:"",conversationLanguageHintLabel:"",conversationVoiceType:"CLONE",conversationVoiceTypeLabel:"克隆音色",conversationSupportsDialect:!1,conversationSupportsLanguageHints:!1,recognizedText:"",aiResponse:"",conversationAudio:null,isProcessing:!1,memoryIdentity:"",memoryInfo:"",systemPrompt:"",audioFilePath:"",paymentModalData:{show:!1,serviceType:"",serviceName:"",serviceDesc:"",price:0,orderNo:"",paymentTips:"点击确认支付后将开始处理您的请求"},_paymentResolve:null,_paymentReject:null,_paymentOnSuccess:null,_paymentOnFailed:null}),computed:{apiBaseUrl(){return this.API_BASE},voicesOnly(){return(this.voices||[]).map((e=>({voice:e.voice,label:e.voice_name||e.voice,voice_type:e.voice_type,supportsDialect:e.supportsDialect,supportsLanguageHints:e.supportsLanguageHints})))},conversationDisplayVoices(){const e=(this.voices||[]).filter((e=>e&&(e.voice_type||"CLONE")===(this.conversationVoiceType||"CLONE")));if("OFFICIAL"!==(this.conversationVoiceType||"CLONE"))return e;const t=["Cherry","Kai","Mochi","Bunny"],a=["Cherry","Kai","Mochi","Bunny"];return g(e.filter((e=>!(e&&t.includes(e.voice)))).map(((e,t)=>({v:e,idx:t}))).sort(((e,t)=>{const o=a.indexOf(e.v.voice),i=a.indexOf(t.v.voice),s=-1===o?999:o,l=-1===i?999:i;return s!==l?s-l:e.idx-t.idx})).map((e=>e.v)))},displayVoices(){const e=(this.voices||[]).filter((e=>e&&(e.voice_type||"CLONE")===this.selectedVoiceType));if("OFFICIAL"!==(this.selectedVoiceType||"CLONE"))return e;const t=["Cherry","Kai","Mochi","Bunny"],a=["Cherry","Kai","Mochi","Bunny"];return g(e.filter((e=>!(e&&t.includes(e.voice)))).map(((e,t)=>({v:e,idx:t}))).sort(((e,t)=>{const o=a.indexOf(e.v.voice),i=a.indexOf(t.v.voice),s=-1===o?999:o,l=-1===i?999:i;return s!==l?s-l:e.idx-t.idx})).map((e=>e.v)))}},watch:{activeTab(e){this.conversationVoiceId="",this.conversationVoiceLabel="",this.conversationDialect="",this.conversationLanguageHint="",this.conversationLanguageHintLabel="",this.conversationSupportsDialect=!1,this.conversationSupportsLanguageHints=!1,"list"!==e&&"synthesize"!==e&&"conversation"!==e||this.loadVoices()}},onLoad(){this.useDefaultTemplates(),this.loadVoices(),this.loadTemplatesFromServer(),this.initRecorder()},onShow(){!this.checkLogin||!this.checkLogin()||this.voices&&0!==this.voices.length||this.loadVoices()},methods:{onVoiceTypeChange(e){const t=this.voiceTypeOptions[e.detail.value];this.selectedVoiceType=t?t.value:"CLONE",this.selectedVoiceTypeLabel=t?t.label:"克隆音色",this.selectedVoiceId="",this.selectedVoiceName="",this.selectedDialect="",this.selectedLanguageHint="",this.selectedLanguageHintLabel="",this.selectedSupportsDialect=!1,this.selectedSupportsLanguageHints=!1},onConversationVoiceTypeChange(e){const t=this.voiceTypeOptions[e.detail.value];this.conversationVoiceType=t?t.value:"CLONE",this.conversationVoiceTypeLabel=t?t.label:"克隆音色",this.conversationVoiceId="",this.conversationVoiceLabel="",this.conversationDialect="",this.conversationLanguageHint="",this.conversationLanguageHintLabel="",this.conversationSupportsDialect=!1,this.conversationSupportsLanguageHints=!1},showVoiceHelp(){uni.showModal({title:"💡 如何获取音色?",content:'1️⃣ 点击底部导航"声音克隆"\n\n2️⃣ 点击"上传音频"按钮\n\n3️⃣ 录制或上传10-20秒清晰人声\n\n4️⃣ 创建成功后即可在此选择使用\n\n💡 提示:音色质量越好,合成效果越自然',showCancel:!0,cancelText:"知道了",confirmText:"去创建",success:e=>{e.confirm&&uni.switchTab({url:"/pages/upload-audio/upload-audio"})}})},checkLogin(){const e=uni.getStorageSync("token"),t=uni.getStorageSync("userId");return!(!e||!t)},showMessage(e,t){this.message={type:e,text:t},setTimeout((()=>{this.message={type:"",text:""}}),5e3)},chooseAudioFile(){const e="undefined"!=typeof plus,t="undefined"!=typeof document&&!e,a="undefined"!=typeof wx;if(e)uni.showModal({title:"选择方式",content:"APP 环境请使用录音功能创建音色(推荐10-20秒清晰朗读)\n\n提示:如需上传音频文件,请使用手机浏览器访问本系统",confirmText:"开始录音",cancelText:"取消",success:e=>{e.confirm&&this.startRecordAudio()}});else if(t){const e=document.createElement("input");e.type="file",e.accept="audio/*,.mp3,.wav,.m4a,.aac",e.onchange=e=>{const t=e.target.files[0];if(t){if(t.size>10485760)return void this.showMessage("error","文件大小不能超过10MB");const e=URL.createObjectURL(t);this.selectedFile={path:e,name:t.name,size:t.size,file:t},this.showMessage("success",`已选择: ${t.name} (${(t.size/1024).toFixed(2)} KB)`)}},e.click()}else a&&uni.chooseMessageFile({count:1,type:"file",extension:[".mp3",".wav",".m4a",".aac"],success:e=>{const t=e.tempFiles[0];t.size>10485760?this.showMessage("error","文件大小不能超过10MB"):(this.selectedFile={path:t.path,name:t.name,size:t.size},this.showMessage("success",`已选择: ${t.name} (${(t.size/1024).toFixed(2)} KB)`))},fail:e=>{this.showMessage("error","选择文件失败: "+(e.errMsg||"未知错误"))}})},async startRecordAudio(){if(!(await f.ensurePermission("record",{permissionName:"麦克风",reason:"创建音色录音功能",showGuide:!0})))return void t("log","at pages/revival/revival.vue:625","[Revival] 麦克风权限未授权");const e=uni.getRecorderManager();e.onStart((()=>{this.showMessage("success","正在录音...")})),e.onStop((e=>{this.selectedFile={path:e.tempFilePath,name:"record_"+Date.now()+".mp3"},this.showMessage("success","录音完成")})),e.onError((e=>{t("error","at pages/revival/revival.vue:645","录音失败:",e),this.showMessage("error","录音失败")})),uni.showModal({title:"录音",content:"点击确定开始录音,录音时长10-20秒",success:t=>{t.confirm&&(e.start({format:"mp3",sampleRate:16e3}),setTimeout((()=>{e.stop()}),2e4))}})},async handleCreateVoice(){if(!this.checkLogin())return void uni.showModal({title:"提示",content:"请先登录后再使用此功能",confirmText:"去登录",cancelText:"取消",success:e=>{e.confirm&&uni.navigateTo({url:"/pages/login/login"})}});if(!this.selectedFile)return void this.showMessage("error","请先选择音频文件");if(!this.voiceDisplayName.trim())return void this.showMessage("error","请输入音色名称");const e=`voice${this.voices.length+1}`;this.loading=!0,t("log","at pages/revival/revival.vue:700","[Index] 开始上传音频文件..."),t("log","at pages/revival/revival.vue:701","[Index] 文件路径:",this.selectedFile.path),t("log","at pages/revival/revival.vue:702","[Index] 音色标识:",e),t("log","at pages/revival/revival.vue:703","[Index] 音色显示名称:",this.voiceDisplayName);const a=uni.getStorageSync("userId")||"",o=uni.getStorageSync("token")||"";uni.uploadFile({url:`${this.apiBaseUrl}/api/voice/create`,filePath:this.selectedFile.path,name:"audio",header:{"X-User-Id":a,Authorization:o?`Bearer ${o}`:""},formData:{name:e,displayName:this.voiceDisplayName},success:e=>{if(t("log","at pages/revival/revival.vue:760","[Index] 上传响应:",e),200===e.statusCode)try{const t=JSON.parse(e.data);t.success?(this.showMessage("success",`创建成功!音色: ${this.voiceDisplayName}`),this.selectedFile=null,this.voiceDisplayName="",this.loadVoices()):this.showMessage("error",t.message||"创建失败")}catch(a){t("error","at pages/revival/revival.vue:773","[Index] 解析响应失败:",a),this.showMessage("error","服务器响应格式错误")}else this.showMessage("error",`上传失败: HTTP ${e.statusCode}`)},fail:e=>{t("error","at pages/revival/revival.vue:781","[Index] 上传失败:",e),this.showMessage("error","上传失败: "+(e.errMsg||"未知错误"))},complete:()=>{this.loading=!1}})},async loadVoices(){this.loading=!0;const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";t("log","at pages/revival/revival.vue:798","[Revival] 加载音色 - userId:",e,"token:",a?"已设置":"未设置"),uni.request({url:`${this.apiBaseUrl}/api/voice/list`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:e=>{if(t("log","at pages/revival/revival.vue:808","[Revival] 音色列表响应:",e.data),e.data.success){const a=["Cherry","Kai","Mochi","Bunny"];this.voices=(e.data.voices||[]).filter((e=>!(e&&e.voice&&e.voice.startsWith("cosyvoice-v3-flash-")))).filter((e=>!(e&&e.voice&&a.includes(e.voice)))),t("log","at pages/revival/revival.vue:814","[Revival] 加载音色数量:",this.voices.length)}else t("error","at pages/revival/revival.vue:816","[Revival] 加载音色失败:",e.data.message)},fail:e=>{t("error","at pages/revival/revival.vue:820","[Revival] 请求失败:",e),this.showMessage("error","加载音色失败")},complete:()=>{this.loading=!1}})},handleDeleteVoice(e){uni.showModal({title:"确认删除",content:`确定删除音色 ${e}?`,success:a=>{if(a.confirm){t("log","at pages/revival/revival.vue:835","[Revival] 开始删除音色:",e);const a=uni.getStorageSync("userId")||"",o=uni.getStorageSync("token")||"";uni.showLoading({title:"删除中...",mask:!0}),uni.request({url:`${this.apiBaseUrl}/api/voice/delete/${e}`,method:"DELETE",header:{"X-User-Id":a,Authorization:o?`Bearer ${o}`:""},success:e=>{t("log","at pages/revival/revival.vue:854","[Revival] 删除音色响应:",e),uni.hideLoading(),200===e.statusCode?e.data&&e.data.success?(this.showMessage("success","删除成功"),this.loadVoices()):this.showMessage("error",e.data.message||"删除失败"):this.showMessage("error",`删除失败: HTTP ${e.statusCode}`)},fail:e=>{t("error","at pages/revival/revival.vue:870","[Revival] 删除音色失败:",e),uni.hideLoading(),this.showMessage("error","网络请求失败: "+(e.errMsg||"请检查网络连接"))}})}}})},onVoiceChange(e){const t=this.displayVoices[e.detail.value];this.selectedVoiceId=t.voice,this.selectedVoiceName=t.voice_name||t.voice,this.selectedVoiceType=t.voice_type||this.selectedVoiceType||"CLONE",this.selectedVoiceTypeLabel="OFFICIAL"===this.selectedVoiceType?"官方音色(Flash/BigTTS)":"克隆音色",this.selectedDialect="",this.selectedLanguageHint="",this.selectedLanguageHintLabel="",this.selectedSupportsDialect=!!t.supportsDialect,this.selectedSupportsLanguageHints=!!t.supportsLanguageHints,"OFFICIAL"===(this.selectedVoiceType||"CLONE")&&(this.selectedDialect="",this.selectedLanguageHint="",this.selectedLanguageHintLabel="",this.selectedSupportsDialect=!1,this.selectedSupportsLanguageHints=!1)},onDialectChange(e){this.selectedDialect=this.dialectOptions[e.detail.value]||""},onLanguageHintChange(e){const t=this.languageHintOptions[e.detail.value]||"";this.selectedLanguageHintLabel=t;const a=t.match(/\(([^)]+)\)/);this.selectedLanguageHint=a&&a[1]?a[1]:""},onConversationVoiceChange(e){const t=this.conversationDisplayVoices[e.detail.value];this.conversationVoiceId=t.voice,this.conversationVoiceLabel=t.voice_name||t.voice,this.conversationVoiceType=t.voice_type||this.conversationVoiceType||"CLONE",this.conversationVoiceTypeLabel="OFFICIAL"===this.conversationVoiceType?"官方音色(Flash)":"克隆音色",this.conversationDialect="",this.conversationLanguageHint="",this.conversationLanguageHintLabel="",this.conversationSupportsDialect=!!t.supportsDialect,this.conversationSupportsLanguageHints=!!t.supportsLanguageHints,"OFFICIAL"===(this.conversationVoiceType||"CLONE")&&(this.conversationDialect="",this.conversationLanguageHint="",this.conversationLanguageHintLabel="",this.conversationSupportsDialect=!1,this.conversationSupportsLanguageHints=!1)},onConversationDialectChange(e){this.conversationDialect=this.dialectOptions[e.detail.value]||""},onConversationLanguageHintChange(e){const t=this.languageHintOptions[e.detail.value]||"";this.conversationLanguageHintLabel=t;const a=t.match(/\(([^)]+)\)/);this.conversationLanguageHint=a&&a[1]?a[1]:""},toggleCategory(e){this.expandedCategory===e?this.expandedCategory="":this.expandedCategory=e},getTemplatesByCategory(e){return this.templates.filter((t=>t.category===e))},selectTemplate(e){this.ttsText=e.content,this.showMessage("success","已应用模板")},loadTemplatesFromServer(){const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";t("log","at pages/revival/revival.vue:966","[Templates] 尝试从服务器加载模板..."),uni.request({url:`${this.apiBaseUrl}/api/templates/list`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:e=>{t("log","at pages/revival/revival.vue:976","[Templates] 服务器响应:",e),e.data&&e.data.success&&e.data.templates&&e.data.templates.length>0?(this.templates=e.data.templates,t("log","at pages/revival/revival.vue:981","[Templates] 从服务器加载成功,数量:",this.templates.length)):e.data&&Array.isArray(e.data)&&e.data.length>0?(this.templates=e.data,t("log","at pages/revival/revival.vue:985","[Templates] 从服务器加载成功(数组格式),数量:",this.templates.length)):t("log","at pages/revival/revival.vue:988","[Templates] 服务器无数据,继续使用默认模板")},fail:e=>{t("log","at pages/revival/revival.vue:992","[Templates] 服务器请求失败,继续使用默认模板:",e)}})},useDefaultTemplates(){this.templates=[{category:"memorial",title:"思念",content:"妈妈,我好想你,你在那边还好吗?"},{category:"memorial",title:"感恩",content:"谢谢您一直以来对我的照顾和关爱。"},{category:"memorial",title:"告白",content:"有些话当时没说出口,现在想对您说..."},{category:"greeting",title:"问候",content:"今天天气很好,您最喜欢这样的天气了。"},{category:"greeting",title:"日常",content:"最近过得还好,就是很想您。"},{category:"memory",title:"回忆",content:"还记得小时候您做的红烧肉,真好吃。"},{category:"memory",title:"往事",content:"那年夏天,我们一起去海边的情景还历历在目。"}],t("log","at pages/revival/revival.vue:1009","[Templates] 使用默认模板,数量:",this.templates.length)},async handleSynthesize(){this.checkLogin()?this.ttsText.trim()&&this.selectedVoiceId?T(this,p.TTS_SYNTHESIS.type,(()=>{this.executeSynthesize()}),(e=>{t("error","at pages/revival/revival.vue:1045","[Payment] 支付失败:",e)})):this.showMessage("error","请输入文本并选择音色"):uni.showModal({title:"提示",content:"请先登录后再使用此功能",confirmText:"去登录",cancelText:"取消",success:e=>{e.confirm&&uni.navigateTo({url:"/pages/login/login"})}})},executeSynthesize(){this.ttsLoading=!0,this.audioUrl=null;const e=this.selectedVoiceId&&this.selectedVoiceId.startsWith("cosyvoice-v3-plus-")?"/api/tts/cosy-synthesize":"/api/tts/synthesize";t("log","at pages/revival/revival.vue:1058","[TTS] 发送合成请求:",{url:`${this.apiBaseUrl}${e}`,text:this.ttsText,voiceId:this.selectedVoiceId,dialect:this.selectedDialect});const a=uni.getStorageSync("userId")||"",o=uni.getStorageSync("token")||"",i={text:this.ttsText,voiceId:this.selectedVoiceId,voiceType:this.selectedVoiceType};"OFFICIAL"!==(this.selectedVoiceType||"CLONE")&&this.selectedSupportsDialect&&this.selectedDialect&&(i.dialect=this.selectedDialect),"OFFICIAL"!==(this.selectedVoiceType||"CLONE")&&this.selectedSupportsLanguageHints&&this.selectedLanguageHint&&(i.languageHints=this.selectedLanguageHint),uni.request({url:`${this.apiBaseUrl}${e}`,method:"POST",header:{"X-User-Id":a,Authorization:o?`Bearer ${o}`:"","content-type":"application/x-www-form-urlencoded"},data:i,success:e=>{t("log","at pages/revival/revival.vue:1090","[TTS] 请求成功:",e),402!==e.statusCode?200===e.statusCode?e.data&&e.data.success?(this.showMessage("success","合成成功!"),this.audioUrl=`${this.apiBaseUrl}/api/tts/download/${e.data.audioFile}`,t("log","at pages/revival/revival.vue:1133","[TTS] 音频URL:",this.audioUrl)):uni.showModal({title:"生成失败",content:"合成失败:"+(e.data&&e.data.message?e.data.message:"未知错误")+"\n\n你可以点击“重试”再次生成。\n若已支付但多次生成失败,请联系客服补发(提供订单号/支付时间截图)。",confirmText:"重试",cancelText:"我知道了",success:e=>{e.confirm&&this.executeSynthesize()}}):uni.showModal({title:"生成失败",content:(e.data&&e.data.message?e.data.message:"生成失败")+"\n\n你可以点击“重试”再次生成。\n若已支付但多次生成失败,请联系客服补发(提供订单号/支付时间截图)。",confirmText:"重试",cancelText:"我知道了",success:e=>{e.confirm&&this.executeSynthesize()}}):uni.showModal({title:"需要付费",content:e.data&&e.data.message?e.data.message:"免费次数已用完,请先完成支付",confirmText:"去支付",cancelText:"取消",success:e=>{e.confirm&&T(this,p.TTS_SYNTHESIS.type,(()=>{this.executeSynthesize()}),(e=>{t("error","at pages/revival/revival.vue:1107","[Payment] 支付失败:",e)}))}})},fail:e=>{t("error","at pages/revival/revival.vue:1149","[TTS] 请求失败:",e),uni.showModal({title:"生成失败",content:"网络请求失败:"+(e.errMsg||"请检查网络连接")+"\n\n你可以点击“重试”再次生成。\n若已支付但多次生成失败,请联系客服补发(提供订单号/支付时间截图)。",confirmText:"重试",cancelText:"我知道了",success:e=>{e.confirm&&this.executeSynthesize()}})},complete:()=>{this.ttsLoading=!1}})},initRecorder(){this.recorderManager=uni.getRecorderManager(),this.recorderManager.onStop((e=>{this.audioFilePath=e.tempFilePath,this.handleConversation()})),this.recorderManager.onError((e=>{t("error","at pages/revival/revival.vue:1177","[Revival] 录音失败:",e),this.isRecording=!1;e.errMsg&&(e.errMsg.includes("permission")||e.errMsg.includes("authorize")||e.errMsg.includes("denied")||e.errMsg.includes("占用"))?uni.showModal({title:"需要麦克风权限",content:"录音功能需要麦克风权限才能使用。\n\n请前往:\n手机设置 → 应用管理 → 时光意境 → 权限管理 → 开启麦克风权限",confirmText:"我知道了",showCancel:!1}):this.showMessage("error","录音失败: "+(e.errMsg||"未知错误"))}))},startRecording(){this.checkLogin()?T(this,p.CONVERSATION.type,(()=>{this.executeRecording()}),(e=>{t("error","at pages/revival/revival.vue:1230","[Payment] 支付失败:",e)})):uni.showModal({title:"提示",content:"请先登录后再使用此功能",confirmText:"去登录",cancelText:"取消",success:e=>{e.confirm&&uni.navigateTo({url:"/pages/login/login"})}})},executeRecording(){this.recorderManager.start({format:"mp3",sampleRate:16e3,numberOfChannels:1}),this.isRecording=!0,this.recognizedText="",this.aiResponse="",this.conversationAudio=null,this.showMessage("success","开始录音...")},stopRecording(){this.recorderManager.stop(),this.isRecording=!1,this.showMessage("success","处理中...")},buildSystemPrompt(){if(this.memoryIdentity||this.memoryInfo){if(this.memoryIdentity){let e=`你是${this.memoryIdentity},你已经去世。用户正在和你对话。`;return e+="\n\n你的性格特点:\n\n亲切、真实、克制",e+="\n\n你的行事风格:\n\n直接回答,不绕弯",e+="\n\n你的语言特点:\n\n自然口语,语气温和",this.memoryInfo&&(e+=`\n\n补充设定(请严格遵循):\n\n${this.memoryInfo}`),e+="\n\n注意:不要使用括号(包括()和())来描述动作、心理、背景。",e+="\n\n规则:\n\n1. 不要虚构不存在的事,不要编造记忆或经历。\n2. 不要回忆以前(除非用户明确提到并且你能基于已有设定回答)。\n3. 不要使用任何称呼(因为用户可能是任何身份)。\n4. 不要使用emoji/颜文字/特殊符号。\n5. 顺应用户话题,亲切回答问题。\n6. 时刻记住自己是逝者。\n7. 每次回复保持在20~50字之间。",e}let e="你是一位已经去世的人。用户正在和你对话。";return e+="\n\n你的性格特点:\n\n亲切、真实、克制",e+="\n\n你的行事风格:\n\n直接回答,不绕弯",e+="\n\n你的语言特点:\n\n自然口语,语气温和",this.memoryInfo&&(e+=`\n\n补充设定(请严格遵循):\n\n${this.memoryInfo}`),e+="\n\n你可以将动作、神情语气、心理活动、故事背景放在()中来表示,为对话提供补充信息。",e+="\n\n规则:\n\n1. 不要虚构不存在的事,不要编造记忆或经历。\n2. 不要回忆以前(除非用户明确提到并且你能基于已有设定回答)。\n3. 不要使用任何称呼(因为用户可能是任何身份)。\n4. 不要使用emoji/颜文字/特殊符号。\n5. 顺应用户话题,亲切回答问题。\n6. 时刻记住自己是逝者。\n7. 每次回复保持在20~50字之间。",e}let e="你是一位已经去世的人。用户正在和你对话。";return e+="\n\n你的性格特点:\n\n亲切、真实、克制",e+="\n\n你的行事风格:\n\n直接回答,不绕弯",e+="\n\n你的语言特点:\n\n自然口语,语气温和",e+="\n\n注意:不要使用括号(包括()和())来描述动作、心理、背景。",e+="\n\n规则:\n\n1. 不要虚构不存在的事,不要编造记忆或经历。\n2. 不要回忆以前(除非用户明确提到并且你能基于已有设定回答)。\n3. 不要使用任何称呼(因为用户可能是任何身份)。\n4. 不要使用emoji/颜文字/特殊符号。\n5. 顺应用户话题,亲切回答问题。\n6. 时刻记住自己是逝者。\n7. 每次回复保持在20~50字之间。","你是一位已经去世的人。用户正在和你对话。\n\n你的性格特点:\n\n亲切、真实、克制\n\n你的行事风格:\n\n直接回答,不绕弯\n\n你的语言特点:\n\n自然口语,语气温和\n\n注意:不要使用括号(包括()和())来描述动作、心理、背景。\n\n规则:\n\n1. 不要虚构不存在的事,不要编造记忆或经历。\n2. 不要回忆以前(除非用户明确提到并且你能基于已有设定回答)。\n3. 不要使用任何称呼(因为用户可能是任何身份)。\n4. 不要使用emoji/颜文字/特殊符号。\n5. 顺应用户话题,亲切回答问题。\n6. 时刻记住自己是逝者。\n7. 每次回复保持在20~50字之间。"},handleConversation(){this.isProcessing=!0;const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"",o={voiceId:this.conversationVoiceId||"",voiceType:this.conversationVoiceType||"CLONE",saveHistory:"false"},i=this.buildSystemPrompt();o.systemPrompt=i,"OFFICIAL"!==(this.conversationVoiceType||"CLONE")&&this.conversationSupportsDialect&&this.conversationDialect&&(o.dialect=this.conversationDialect),"OFFICIAL"!==(this.conversationVoiceType||"CLONE")&&this.conversationSupportsLanguageHints&&this.conversationLanguageHint&&(o.languageHints=this.conversationLanguageHint),uni.uploadFile({url:`${this.apiBaseUrl}/api/conversation/talk`,filePath:this.audioFilePath,name:"audio",formData:o,header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:e=>{t("log","at pages/revival/revival.vue:1319","[Index] 对话响应状态码:",e.statusCode),t("log","at pages/revival/revival.vue:1320","[Index] 对话响应数据:",e.data);let a=null;try{a="string"==typeof e.data?JSON.parse(e.data):e.data}catch(i){a=null}if(200!==e.statusCode){const t=a&&a.message?a.message:"对话失败: HTTP "+e.statusCode;return void uni.showModal({title:"对话失败",content:t+"\n\n请重试。若已支付但多次失败,请联系客服补发(提供订单号/支付时间截图)。",showCancel:!1,confirmText:"我知道了"})}if(a&&a.success)return this.recognizedText=a.recognizedText,this.aiResponse=a.aiResponse,this.conversationAudio=`${this.apiBaseUrl}/api/conversation/audio/${a.audioFile}`,void this.showMessage("success","对话成功!");const o=a&&a.message?a.message:"对话失败";uni.showModal({title:"对话失败",content:o+"\n\n请重试。若已支付但多次失败,请联系客服补发(提供订单号/支付时间截图)。",confirmText:"重试",cancelText:"我知道了",success:e=>{e.confirm&&this.handleConversation()}})},fail:e=>{t("error","at pages/revival/revival.vue:1362","[Index] 对话请求失败:",e),uni.showModal({title:"对话失败",content:"网络请求失败:"+(e.errMsg||"未知错误")+"\n\n请重试。若已支付但多次失败,请联系客服补发(提供订单号/支付时间截图)。",confirmText:"重试",cancelText:"我知道了",success:e=>{e.confirm&&this.handleConversation()}})},complete:()=>{this.isProcessing=!1}})},handleApplyMemory(){if(!this.memoryIdentity.trim())return void this.showMessage("error","请填写身份信息");this.systemPrompt=this.buildSystemPrompt();const e=uni.getStorageSync("userId")||"",t=uni.getStorageSync("token")||"";uni.request({url:`${this.apiBaseUrl}/api/conversation/set-prompt`,method:"POST",header:{"X-User-Id":e,Authorization:t?`Bearer ${t}`:"","content-type":"application/x-www-form-urlencoded"},data:{prompt:this.systemPrompt},success:e=>{e.data.success&&this.showMessage("success","✓ 记忆设定已应用")}})},goToRevival(){t("log","at pages/revival/revival.vue:1411","[Revival] 点击复活照片,准备跳转"),uni.navigateTo({url:"/pages/revival/revival-original",success:()=>{t("log","at pages/revival/revival.vue:1415","[Revival] 跳转成功")},fail:e=>{t("error","at pages/revival/revival.vue:1418","[Revival] 跳转失败:",e),uni.showToast({title:"页面跳转失败",icon:"none"})}})},goToPhoneCall(){uni.switchTab({url:"/pages/phone-call/phone-call"})},goToUpload(){uni.navigateTo({url:"/pages/upload-audio/upload-audio"})},handleClearHistory(){const e=uni.getStorageSync("userId")||"",t=uni.getStorageSync("token")||"";uni.request({url:`${this.apiBaseUrl}/api/conversation/clear-history`,method:"POST",header:{"X-User-Id":e,Authorization:t?`Bearer ${t}`:""},success:e=>{e.data.success&&(this.recognizedText="",this.aiResponse="",this.conversationAudio=null,this.showMessage("success","已清空"))}})},formatTime(e){if(!e)return"未知时间";const t=new Date(e<1e10?1e3*e:e);if(isNaN(t.getTime()))return"无效时间";return`${t.getFullYear()}年${String(t.getMonth()+1).padStart(2,"0")}月${String(t.getDate()).padStart(2,"0")}日 ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`},handlePaymentClose(){this.paymentModalData.show=!1,this._paymentReject&&this._paymentReject(new Error("用户取消支付"))},async handlePaymentConfirm(e){await S(this,e)}}},[["render",function(t,a,o,i,s,l){const n=e.resolveComponent("PaymentModal");return e.openBlock(),e.createElementBlock("view",{class:"memorial-bg"},[e.createElementVNode("view",{class:"memorial-content"},[e.createElementVNode("view",{class:"header"},[e.createElementVNode("text",{class:"logo"},"AI声音克隆"),e.createElementVNode("text",{class:"tagline"},"克隆亲人声音 · 语音合成 · 实时对话")]),s.message.text?(e.openBlock(),e.createElementBlock("view",{key:0,class:e.normalizeClass(["message",s.message.type])},e.toDisplayString(s.message.text),3)):e.createCommentVNode("",!0),e.createElementVNode("view",{class:"create-voice-btn-wrapper"},[e.createElementVNode("button",{class:"create-voice-btn",onClick:a[0]||(a[0]=(...e)=>l.goToUpload&&l.goToUpload(...e))}," 📤 创建音色 ")]),e.createElementVNode("view",{class:"tabs"},[e.createElementVNode("view",{class:e.normalizeClass(["tab-item","synthesize"===s.activeTab?"active":""]),onClick:a[1]||(a[1]=e=>s.activeTab="synthesize")}," 🔊 合成 ",2),e.createElementVNode("view",{class:e.normalizeClass(["tab-item","conversation"===s.activeTab?"active":""]),onClick:a[2]||(a[2]=e=>s.activeTab="conversation")}," 💬 对话 ",2),e.createElementVNode("view",{class:e.normalizeClass(["tab-item","list"===s.activeTab?"active":""]),onClick:a[3]||(a[3]=e=>s.activeTab="list")}," 📋 列表 ",2)])]),e.createElementVNode("scroll-view",{"scroll-y":"",class:"content"},["synthesize"===s.activeTab?(e.openBlock(),e.createElementBlock("view",{key:0,class:"tab-content"},[e.createElementVNode("view",{class:"section-title"},"🎵 语音合成"),e.createElementVNode("view",{class:"form-section"},[e.createElementVNode("view",{class:"form-label-with-help"},[e.createElementVNode("text",{class:"form-label"},"选择音色类型"),e.createElementVNode("text",{class:"help-icon",onClick:a[4]||(a[4]=(...e)=>l.showVoiceHelp&&l.showVoiceHelp(...e))},"❓")]),e.createElementVNode("picker",{mode:"selector",range:s.voiceTypeOptions,"range-key":"label",onChange:a[5]||(a[5]=(...e)=>l.onVoiceTypeChange&&l.onVoiceTypeChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.selectedVoiceTypeLabel),1)],40,["range"]),e.createElementVNode("picker",{mode:"selector",range:l.displayVoices,"range-key":"voice_name",onChange:a[6]||(a[6]=(...e)=>l.onVoiceChange&&l.onVoiceChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.selectedVoiceName||"请选择音色"),1)],40,["range"]),e.createElementVNode("view",{class:"hint-text"},'💡 请先在"声音克隆"页面创建音色')]),s.selectedSupportsDialect&&"OFFICIAL"!==(s.selectedVoiceType||"CLONE")?(e.openBlock(),e.createElementBlock("view",{key:0,class:"form-section"},[e.createElementVNode("view",{class:"form-label"},"方言"),e.createElementVNode("picker",{mode:"selector",range:s.dialectOptions,onChange:a[7]||(a[7]=(...e)=>l.onDialectChange&&l.onDialectChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.selectedDialect||"请选择方言(可选)"),1)],40,["range"])])):e.createCommentVNode("",!0),s.selectedSupportsLanguageHints&&"OFFICIAL"!==(s.selectedVoiceType||"CLONE")?(e.openBlock(),e.createElementBlock("view",{key:1,class:"form-section"},[e.createElementVNode("view",{class:"form-label"},"语言提示(可选)"),e.createElementVNode("picker",{mode:"selector",range:s.languageHintOptions,onChange:a[8]||(a[8]=(...e)=>l.onLanguageHintChange&&l.onLanguageHintChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.selectedLanguageHintLabel||"请选择语言(可选)"),1)],40,["range"]),e.createElementVNode("view",{class:"hint-text"},"💡 仅处理第一个值;不设置不生效")])):e.createCommentVNode("",!0),e.createElementVNode("view",{class:"form-section"},[e.createElementVNode("view",{class:"form-label"}," 文案模板"),0===s.templates.length?(e.openBlock(),e.createElementBlock("view",{key:0,class:"empty-template"},[e.createElementVNode("text",null,"⏳ 加载中...")])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"template-categories"},[e.createElementVNode("view",{class:"category-group"},[e.createElementVNode("view",{class:"category-header",onClick:a[9]||(a[9]=e=>l.toggleCategory("memorial"))},[e.createElementVNode("text",{class:"category-name"},"💭 缅怀类"),e.createElementVNode("text",{class:e.normalizeClass(["category-arrow",{"arrow-open":"memorial"===s.expandedCategory}])},"▼",2)]),"memorial"===s.expandedCategory?(e.openBlock(),e.createElementBlock("view",{key:0,class:"category-content"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.getTemplatesByCategory("memorial"),((t,a)=>(e.openBlock(),e.createElementBlock("view",{key:a,class:"template-item",onClick:e=>l.selectTemplate(t)},[e.createElementVNode("text",{class:"template-title"},e.toDisplayString(t.title),1),e.createElementVNode("text",{class:"template-preview"},e.toDisplayString(t.content),1)],8,["onClick"])))),128))])):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"category-group"},[e.createElementVNode("view",{class:"category-header",onClick:a[10]||(a[10]=e=>l.toggleCategory("greeting"))},[e.createElementVNode("text",{class:"category-name"},"👋 问候类"),e.createElementVNode("text",{class:e.normalizeClass(["category-arrow",{"arrow-open":"greeting"===s.expandedCategory}])},"▼",2)]),"greeting"===s.expandedCategory?(e.openBlock(),e.createElementBlock("view",{key:0,class:"category-content"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.getTemplatesByCategory("greeting"),((t,a)=>(e.openBlock(),e.createElementBlock("view",{key:a,class:"template-item",onClick:e=>l.selectTemplate(t)},[e.createElementVNode("text",{class:"template-title"},e.toDisplayString(t.title),1),e.createElementVNode("text",{class:"template-preview"},e.toDisplayString(t.content),1)],8,["onClick"])))),128))])):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"category-group"},[e.createElementVNode("view",{class:"category-header",onClick:a[11]||(a[11]=e=>l.toggleCategory("memory"))},[e.createElementVNode("text",{class:"category-name"},"📖 回忆类"),e.createElementVNode("text",{class:e.normalizeClass(["category-arrow",{"arrow-open":"memory"===s.expandedCategory}])},"▼",2)]),"memory"===s.expandedCategory?(e.openBlock(),e.createElementBlock("view",{key:0,class:"category-content"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.getTemplatesByCategory("memory"),((t,a)=>(e.openBlock(),e.createElementBlock("view",{key:a,class:"template-item",onClick:e=>l.selectTemplate(t)},[e.createElementVNode("text",{class:"template-title"},e.toDisplayString(t.title),1),e.createElementVNode("text",{class:"template-preview"},e.toDisplayString(t.content),1)],8,["onClick"])))),128))])):e.createCommentVNode("",!0)])]))]),e.createElementVNode("view",{class:"form-section"},[e.createElementVNode("view",{class:"form-label"},"输入文本(最多100字)"),e.withDirectives(e.createElementVNode("textarea",{class:"textarea","onUpdate:modelValue":a[12]||(a[12]=e=>s.ttsText=e),placeholder:"请输入要合成的文本...",maxlength:"100"},null,512),[[e.vModelText,s.ttsText]]),e.createElementVNode("view",{class:e.normalizeClass(["char-count",{"char-warning":s.ttsText.length>=90}])},e.toDisplayString(s.ttsText.length)+" / 100 ",3)]),e.createElementVNode("button",{class:"primary-btn",disabled:s.ttsLoading||!s.ttsText.trim()||!s.selectedVoiceId,onClick:a[13]||(a[13]=(...e)=>l.handleSynthesize&&l.handleSynthesize(...e))},e.toDisplayString(s.ttsLoading?"⏳ 合成中...":"🔊 开始合成"),9,["disabled"]),s.audioUrl?(e.openBlock(),e.createElementBlock("view",{key:2,class:"audio-result"},[e.createElementVNode("view",{class:"result-title"},"✅ 合成成功!"),e.createElementVNode("audio",{src:s.audioUrl,controls:"",style:{width:"100%"}},null,8,["src"])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),"conversation"===s.activeTab?(e.openBlock(),e.createElementBlock("view",{key:1,class:"tab-content"},[e.createElementVNode("view",{class:"section-title"},"💬 实时语音对话"),e.createElementVNode("view",{class:"memory-card"},[e.createElementVNode("view",{class:"card-header"},[e.createElementVNode("text",{class:"card-title"},"💭 记忆设定"),e.createElementVNode("text",{class:"card-hint"},"填写越详细,AI模拟越真实")]),e.createElementVNode("view",{class:"memory-form"},[e.createElementVNode("view",{class:"form-item"},[e.createElementVNode("view",{class:"item-label"},[e.createElementVNode("text",{class:"label-text"},"身份"),e.createElementVNode("text",{class:"label-required"},"*")]),e.withDirectives(e.createElementVNode("input",{class:"form-input","onUpdate:modelValue":a[14]||(a[14]=e=>s.memoryIdentity=e),placeholder:"例如:我的母亲",maxlength:"50"},null,512),[[e.vModelText,s.memoryIdentity]])]),e.createElementVNode("view",{class:"form-item"},[e.createElementVNode("view",{class:"item-label"},[e.createElementVNode("text",{class:"label-text"},"基础信息")]),e.withDirectives(e.createElementVNode("textarea",{class:"form-textarea","onUpdate:modelValue":a[15]||(a[15]=e=>s.memoryInfo=e),placeholder:"例如:退休教师,喜欢养花,做饭很拿手...",maxlength:"200"},null,512),[[e.vModelText,s.memoryInfo]]),e.createElementVNode("text",{class:"form-count"},e.toDisplayString(s.memoryInfo.length)+"/200",1)]),e.createElementVNode("button",{class:"apply-btn",onClick:a[16]||(a[16]=(...e)=>l.handleApplyMemory&&l.handleApplyMemory(...e))},[e.createElementVNode("text",{class:"btn-icon"},"✓"),e.createElementVNode("text",null,"应用设定")])])]),e.createElementVNode("view",{class:"form-section"},[e.createElementVNode("view",{class:"form-label"},"选择回复音色"),e.createElementVNode("picker",{mode:"selector",range:s.voiceTypeOptions,"range-key":"label",onChange:a[17]||(a[17]=(...e)=>l.onConversationVoiceTypeChange&&l.onConversationVoiceTypeChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.conversationVoiceTypeLabel),1)],40,["range"]),e.createElementVNode("picker",{mode:"selector",range:l.conversationDisplayVoices,"range-key":"voice_name",onChange:a[18]||(a[18]=(...e)=>l.onConversationVoiceChange&&l.onConversationVoiceChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.conversationVoiceLabel||"请选择音色"),1)],40,["range"])]),s.conversationSupportsDialect&&"OFFICIAL"!==(s.conversationVoiceType||"CLONE")?(e.openBlock(),e.createElementBlock("view",{key:0,class:"form-section"},[e.createElementVNode("view",{class:"form-label"},"方言"),e.createElementVNode("picker",{mode:"selector",range:s.dialectOptions,onChange:a[19]||(a[19]=(...e)=>l.onConversationDialectChange&&l.onConversationDialectChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.conversationDialect||"请选择方言(可选)"),1)],40,["range"])])):e.createCommentVNode("",!0),s.conversationSupportsLanguageHints&&"OFFICIAL"!==(s.conversationVoiceType||"CLONE")?(e.openBlock(),e.createElementBlock("view",{key:1,class:"form-section"},[e.createElementVNode("view",{class:"form-label"},"语言提示(可选)"),e.createElementVNode("picker",{mode:"selector",range:s.languageHintOptions,onChange:a[20]||(a[20]=(...e)=>l.onConversationLanguageHintChange&&l.onConversationLanguageHintChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.conversationLanguageHintLabel||"请选择语言(可选)"),1)],40,["range"]),e.createElementVNode("view",{class:"hint-text"},"💡 仅处理第一个值;不设置不生效")])):e.createCommentVNode("",!0),e.createElementVNode("view",{class:"record-buttons"},[s.isRecording||s.isProcessing?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("view",{key:0,class:"record-btn start",onClick:a[21]||(a[21]=(...e)=>l.startRecording&&l.startRecording(...e))}," 🎤 开始说话 ")),s.isRecording?(e.openBlock(),e.createElementBlock("view",{key:1,class:"record-btn stop",onClick:a[22]||(a[22]=(...e)=>l.stopRecording&&l.stopRecording(...e))}," ⏹️ 停止录音 ")):e.createCommentVNode("",!0),s.isProcessing?(e.openBlock(),e.createElementBlock("view",{key:2,class:"record-btn processing"}," ⏳ 处理中... ")):e.createCommentVNode("",!0),e.createElementVNode("view",{class:e.normalizeClass(["small-btn",{disabled:s.isRecording||s.isProcessing}]),onClick:a[23]||(a[23]=e=>s.isRecording||s.isProcessing?null:l.handleClearHistory())},[e.createElementVNode("image",{src:x,class:"delete-icon",mode:"aspectFit",style:{width:"44upx",height:"44upx"}})],2)]),s.recognizedText?(e.openBlock(),e.createElementBlock("view",{key:2,class:"result-box user"},[e.createElementVNode("view",{class:"result-label"},"🎤 您说:"),e.createElementVNode("text",null,e.toDisplayString(s.recognizedText),1)])):e.createCommentVNode("",!0),s.aiResponse?(e.openBlock(),e.createElementBlock("view",{key:3,class:"result-box ai"},[e.createElementVNode("view",{class:"result-label"},"💬 AI回复:"),e.createElementVNode("text",null,e.toDisplayString(s.aiResponse),1)])):e.createCommentVNode("",!0),s.conversationAudio?(e.openBlock(),e.createElementBlock("view",{key:4,class:"result-box audio"},[e.createElementVNode("view",{class:"result-label"},"🔊 语音回复:"),e.createElementVNode("audio",{src:s.conversationAudio,controls:"",style:{width:"100%"}},null,8,["src"])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),"list"===s.activeTab?(e.openBlock(),e.createElementBlock("view",{key:2,class:"tab-content"},[e.createElementVNode("view",{class:"list-header"},[e.createElementVNode("view",{class:"section-title"},"我的音色"),e.createElementVNode("button",{class:"small-btn refresh-btn",disabled:s.loading,onClick:a[24]||(a[24]=(...e)=>l.loadVoices&&l.loadVoices(...e))},e.toDisplayString(s.loading?"⏳":"🔄"),9,["disabled"])]),s.loading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"loading"},"⏳ 加载中...")):0===s.voices.length?(e.openBlock(),e.createElementBlock("view",{key:1,class:"empty"},"🎤 暂无音色")):(e.openBlock(),e.createElementBlock("view",{key:2},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.voices,(t=>(e.openBlock(),e.createElementBlock("view",{key:t.voice,class:"voice-item"},[e.createElementVNode("view",{class:"voice-info"},[e.createElementVNode("text",{class:"voice-name"},[e.createTextVNode(e.toDisplayString(t.voice_name||t.voice)+" ",1),t.is_public?(e.openBlock(),e.createElementBlock("text",{key:0,class:"public-badge"},"公共")):e.createCommentVNode("",!0)]),e.createElementVNode("text",{class:"voice-detail"},e.toDisplayString(l.formatTime(t.create_time,"YYYY-MM-DD HH:mm:ss")),1)]),t.is_public?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"delete-btn",onClick:e=>l.handleDeleteVoice(t.voice)},[e.createElementVNode("image",{src:x,class:"delete-icon",mode:"aspectFit"})],8,["onClick"]))])))),128))]))])):e.createCommentVNode("",!0)]),e.createVNode(n,{ref:"paymentModal",show:s.paymentModalData.show,serviceType:s.paymentModalData.serviceType,serviceName:s.paymentModalData.serviceName,serviceDesc:s.paymentModalData.serviceDesc,price:s.paymentModalData.price,orderNo:s.paymentModalData.orderNo,paymentTips:s.paymentModalData.paymentTips,onClose:l.handlePaymentClose,onConfirm:l.handlePaymentConfirm},null,8,["show","serviceType","serviceName","serviceDesc","price","orderNo","paymentTips","onClose","onConfirm"])])}],["__scopeId","data-v-36d23b76"]]);const P=d({components:{PaymentModal:v},data:()=>({API_BASE:i,photoFile:null,photoPreview:"",modelOptions:[{value:"veo",label:"Veo",hint:"需要音色,生成说话人视频",disabled:!1,maintenanceMsg:""},{value:"volcengine",label:"火山引擎",hint:"需要音色,生成说话人视频",disabled:!1,maintenanceMsg:""}],selectedModel:"veo",selectedModelName:"Veo",modelHint:"需要音色,生成说话人视频",voices:[],voiceTypeOptions:[{value:"CLONE",label:"克隆音色"},{value:"OFFICIAL",label:"官方音色(Flash)"}],selectedVoiceType:"CLONE",selectedVoiceTypeLabel:"克隆音色",selectedVoiceId:"",selectedVoiceName:"",selectedDialect:"",selectedLanguageHint:"",selectedLanguageHintLabel:"",selectedSupportsDialect:!1,selectedSupportsLanguageHints:!1,languageHintOptions:["中文(zh)","英文(en)","法语(fr)","德语(de)","日语(ja)","韩语(ko)","俄语(ru)"],dialectOptions:["广东话","东北话","甘肃话","贵州话","河南话","湖北话","江西话","闽南话","宁夏话","山西话","陕西话","山东话","上海话","四川话","天津话","云南话"],videoTitle:"",text:"",showHelpModal:!1,loading:!1,loadingText:"",progress:[],videoUrl:"",audioUrl:"",localVideoPath:"",localAudioPath:"",isPlaying:!1,videoRetried:!1,paymentModalData:{show:!1,serviceType:"",serviceName:"",serviceDesc:"",price:0,orderNo:"",paymentTips:"点击确认支付后将开始生成视频"},_paymentResolve:null,_paymentReject:null,_paymentOnSuccess:null,_paymentOnFailed:null}),computed:{displayVoices(){const e=(this.voices||[]).filter((e=>e&&(e.voice_type||"CLONE")===this.selectedVoiceType));if("OFFICIAL"!==(this.selectedVoiceType||"CLONE"))return e;const t={"湾区大叔":"台湾","台湾小何":"台湾","双节棍小哥":"台湾","广州德哥":"广州","浩宇小哥":"大陆"};return e.map((e=>{const a=e&&e.voice_name?String(e.voice_name):"",o=a&&t[a]?t[a]:"";return o?{...e,voice_name:`${o}-${a}`}:e}))},canGenerate(){const e=this.modelOptions.find((e=>e.value===this.selectedModel));return(!e||!e.disabled)&&(this.photoFile&&this.videoTitle&&this.text&&this.selectedVoiceId)}},onLoad(){this.loadVoices(),this.loadModelStatus()},methods:{onVoiceTypeChange(e){const t=this.voiceTypeOptions[e.detail.value];this.selectedVoiceType=t?t.value:"CLONE",this.selectedVoiceTypeLabel=t?t.label:"克隆音色",this.selectedVoiceId="",this.selectedVoiceName="",this.selectedDialect="",this.selectedLanguageHint="",this.selectedLanguageHintLabel="",this.selectedSupportsDialect=!1,this.selectedSupportsLanguageHints=!1},showVoiceHelp(){this.showHelpModal=!0},goToUpload(){this.showHelpModal=!1,uni.navigateTo({url:"/pages/upload-audio/upload-audio"})},getCurrentModelMaintenanceMsg(){const e=this.modelOptions.find((e=>e.value===this.selectedModel));return e&&e.disabled?e.maintenanceMsg:""},onModelChange(e){const a=e.detail.value,o=this.modelOptions[a];this.selectedModel=o.value,this.selectedModelName=o.label,this.modelHint=o.hint,t("log","at pages/revival/revival-original.vue:396","[Revival] 选择模型:",this.selectedModel)},choosePhoto(){uni.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:e=>{this.photoFile={path:e.tempFilePaths[0],name:"photo.jpg"},this.photoPreview=e.tempFilePaths[0]},fail:e=>{uni.showToast({title:"选择照片失败",icon:"none"})}})},chooseAudio(){uni.showActionSheet({itemList:["选择音频文件","录音"],success:e=>{0===e.tapIndex?this.chooseAudioFileFromSystem():1===e.tapIndex&&this.startRecordAudio()}})},chooseAudioFileFromSystem(){if("Android"===plus.os.name){const e=plus.android.importClass("android.content.Intent"),a=plus.android.runtimeMainActivity(),o=new e(e.ACTION_GET_CONTENT);o.setType("audio/*"),o.addCategory(e.CATEGORY_OPENABLE),a.startActivityForResult(o,1001),a.onActivityResult=(e,a,o)=>{if(1001===e&&-1===a){const e=o.getData(),a=e.toString();t("log","at pages/revival/revival-original.vue:484","[Revival] URI:",a),a.startsWith("content://")?this.copyContentUriToLocalForAudio(e,a):plus.io.resolveLocalFileSystemURL(a,(e=>{t("log","at pages/revival/revival-original.vue:493","[Revival] 真实路径:",e.fullPath);const a=e.name,o=a.substring(a.lastIndexOf(".")).toLowerCase();-1!==[".mp3",".wav",".m4a",".aac"].indexOf(o)?(this.audioFile={path:e.fullPath,name:a},t("log","at pages/revival/revival-original.vue:512","[Revival] 已选择音频:",this.audioFile),uni.showToast({title:"已选择: "+a,icon:"success",duration:2e3})):uni.showToast({title:"请选择音频文件",icon:"none"})}),(e=>{t("error","at pages/revival/revival-original.vue:520","[Revival] 路径转换失败:",e),uni.showToast({title:"文件路径获取失败",icon:"none"})}))}}}else uni.showModal({title:"提示",content:"iOS暂不支持选择文件,请使用录音功能",showCancel:!1,success:()=>{this.startRecordAudio()}})},copyContentUriToLocalForAudio(e,a){try{t("log","at pages/revival/revival-original.vue:547","[Revival] 开始处理content URI...");const a=plus.android.runtimeMainActivity().getContentResolver();let i="audio_"+Date.now()+".mp3";try{const t=plus.android.invoke(a,"query",e,null,null,null,null);if(t){if(plus.android.invoke(t,"moveToFirst")){const e=plus.android.invoke(t,"getColumnIndex","_display_name");e>=0&&(i=plus.android.invoke(t,"getString",e))}plus.android.invoke(t,"close")}}catch(o){t("log","at pages/revival/revival-original.vue:569","[Revival] 无法获取文件名,使用默认名称:",o.message)}-1===i.indexOf(".")&&(i+=".mp3"),t("log","at pages/revival/revival-original.vue:577","[Revival] 文件名:",i);const s=i.substring(i.lastIndexOf(".")).toLowerCase();if(-1===[".mp3",".wav",".m4a",".aac"].indexOf(s))return void uni.showToast({title:"请选择音频文件",icon:"none"});const l=plus.io.convertLocalFileSystemURL("_doc/")+i;t("log","at pages/revival/revival-original.vue:593","[Revival] 临时文件路径:",l);const n=plus.android.importClass("java.io.FileOutputStream"),r=plus.android.importClass("java.io.File"),c=plus.android.invoke(a,"openInputStream",e);if(!c)throw new Error("无法打开输入流");const d=new n(new r(l)),u=plus.android.newObject("byte[]",4096);let h;for(;(h=plus.android.invoke(c,"read",u))>0;)plus.android.invoke(d,"write",u,0,h);plus.android.invoke(d,"flush"),plus.android.invoke(d,"close"),plus.android.invoke(c,"close"),t("log","at pages/revival/revival-original.vue:621","[Revival] 文件复制成功"),this.audioFile={path:l,name:i},t("log","at pages/revival/revival-original.vue:629","[Revival] 文件选择成功:",this.audioFile),uni.showToast({title:"已选择: "+i,icon:"success",duration:2e3})}catch(o){t("error","at pages/revival/revival-original.vue:637","[Revival] 处理content URI异常:",o),uni.showToast({title:"文件处理失败: "+o.message,icon:"none"})}},async startRecordAudio(){if(!(await f.ensurePermission("record",{permissionName:"麦克风",reason:"创建音色录音功能",showGuide:!0})))return void t("log","at pages/revival/revival-original.vue:657","[Revival] 麦克风权限未授权");const e=uni.getRecorderManager();e.onStart((()=>{t("log","at pages/revival/revival-original.vue:664","[Revival] 开始录音"),uni.showToast({title:"正在录音...",icon:"none",duration:1e4})})),e.onStop((e=>{t("log","at pages/revival/revival-original.vue:673","[Revival] 录音完成:",e.tempFilePath),this.audioFile={path:e.tempFilePath,name:"record_"+Date.now()+".mp3"},uni.showToast({title:"录音完成",icon:"success"})})),e.onError((e=>{t("error","at pages/revival/revival-original.vue:685","[Revival] 录音失败:",e);e.errMsg&&(e.errMsg.includes("permission")||e.errMsg.includes("authorize")||e.errMsg.includes("denied")||e.errMsg.includes("占用"))?uni.showModal({title:"需要麦克风权限",content:"录音功能需要麦克风权限才能使用。\n\n请前往:\n手机设置 → 应用管理 → 时光意境 → 权限管理 → 开启麦克风权限",confirmText:"我知道了",showCancel:!1}):uni.showToast({title:"录音失败: "+(e.errMsg||"未知错误"),icon:"none",duration:3e3})})),uni.showModal({title:"录音",content:"点击确定开始录音,录音时长10-20秒",success:t=>{t.confirm&&(e.start({format:"mp3",sampleRate:16e3}),setTimeout((()=>{e.stop()}),2e4))}})},loadModelStatus(){t("log","at pages/revival/revival-original.vue:735","[Revival] 开始加载模型状态..."),uni.request({url:`${this.API_BASE}/api/system/model-status`,method:"GET",success:e=>{if(t("log","at pages/revival/revival-original.vue:740","[Revival] 模型状态响应:",e),200===e.statusCode&&e.data&&e.data.success){const a=e.data.data;if("true"===a.veo_disabled){const e=this.modelOptions.find((e=>"veo"===e.value));e&&(e.disabled=!0,e.maintenanceMsg=a.veo_message||"官方接口参数更新,正在处理中,暂不可用")}if("true"===a.volcengine_disabled){const e=this.modelOptions.find((e=>"volcengine"===e.value));e&&(e.disabled=!0,e.maintenanceMsg=a.volcengine_message||"官方接口参数更新,正在处理中,暂不可用")}t("log","at pages/revival/revival-original.vue:762","[Revival] 模型状态已更新:",this.modelOptions)}},fail:e=>{t("error","at pages/revival/revival-original.vue:766","[Revival] 加载模型状态失败:",e)}})},loadVoices(){t("log","at pages/revival/revival-original.vue:773","[Revival] 开始加载音色列表..."),t("log","at pages/revival/revival-original.vue:774","[Revival] API地址:",`${this.API_BASE}/api/voice/list`);const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";t("log","at pages/revival/revival-original.vue:779","[Revival] 用户ID:",e),uni.request({url:`${this.API_BASE}/api/voice/list`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:e=>{if(t("log","at pages/revival/revival-original.vue:789","[Revival] API响应状态码:",e.statusCode),t("log","at pages/revival/revival-original.vue:790","[Revival] API响应数据:",e.data),200===e.statusCode)if(e.data&&e.data.voices){const a=["Cherry","Kai","Mochi","Bunny"];this.voices=(e.data.voices||[]).filter((e=>!(e&&e.voice&&a.includes(e.voice)))),t("log","at pages/revival/revival-original.vue:797","[Revival] 音色列表:",this.voices),t("log","at pages/revival/revival-original.vue:798","[Revival] 音色数量:",this.voices.length),this.voices.length>0?(this.selectedVoiceId=this.voices[0].voice,this.selectedVoiceName=this.voices[0].voice_name||this.voices[0].voice,this.selectedDialect="",t("log","at pages/revival/revival-original.vue:804","[Revival] 默认选中音色:",this.selectedVoiceId)):(t("log","at pages/revival/revival-original.vue:806","[Revival] 音色列表为空"),uni.showToast({title:"暂无可用音色,请先创建",icon:"none"}))}else t("error","at pages/revival/revival-original.vue:813","[Revival] 响应数据格式错误:",e.data),this.voices=[];else t("error","at pages/revival/revival-original.vue:817","[Revival] 请求失败,状态码:",e.statusCode)},fail:e=>{t("error","at pages/revival/revival-original.vue:821","[Revival] 加载音色列表失败:",e),uni.showToast({title:"加载音色列表失败",icon:"none"})}})},onVoiceChange(e){const t=this.displayVoices[e.detail.value];this.selectedVoiceId=t.voice,this.selectedVoiceName=t.voice_name||t.voice,this.selectedVoiceType=t.voice_type||this.selectedVoiceType||"CLONE",this.selectedVoiceTypeLabel="OFFICIAL"===this.selectedVoiceType?"官方音色(Flash)":"克隆音色",this.selectedDialect="",this.selectedLanguageHint="",this.selectedLanguageHintLabel="",this.selectedSupportsDialect=!!t.supportsDialect,this.selectedSupportsLanguageHints=!!t.supportsLanguageHints,"OFFICIAL"===(this.selectedVoiceType||"CLONE")&&(this.selectedDialect="",this.selectedLanguageHint="",this.selectedLanguageHintLabel="",this.selectedSupportsDialect=!1,this.selectedSupportsLanguageHints=!1)},onDialectChange(e){this.selectedDialect=this.dialectOptions[e.detail.value]||""},onLanguageHintChange(e){const t=this.languageHintOptions[e.detail.value]||"";this.selectedLanguageHintLabel=t;const a=t.match(/\(([^)]+)\)/);this.selectedLanguageHint=a&&a[1]?a[1]:""},async handleGenerate(){const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";if(!e)return void uni.showModal({title:"提示",content:"请先登录后再继续",confirmText:"去登录",cancelText:"取消",success:e=>{e.confirm&&uni.navigateTo({url:"/pages/login/login"})}});const o="volcengine"===this.selectedModel?"VOLCENGINE_VIDEO":"PHOTO_REVIVAL",s="volcengine"===this.selectedModel?p.VOLCENGINE_VIDEO.type:p.PHOTO_REVIVAL.type;let l=null;try{l=await new Promise(((t,s)=>{uni.request({url:`${i}/api/pay/usage-preview?serviceType=${o}`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:e=>{200===e.statusCode&&e.data&&e.data.success?t(e.data):s(new Error(e.data&&e.data.message?e.data.message:"预检失败: HTTP "+e.statusCode))},fail:e=>s(new Error(e&&e.errMsg?e.errMsg:"预检失败"))})}))}catch(n){return void uni.showModal({title:"检查次数失败",content:n&&n.message?n.message:"检查剩余次数失败,请稍后重试",showCancel:!1,confirmText:"我知道了"})}(l&&"number"==typeof l.remainingTotalCount?l.remainingTotalCount:0)<=0?T(this,s,(()=>{this.executeGenerate()}),(e=>{t("error","at pages/revival/revival-original.vue:925","[Payment] 支付失败:",e)})):this.executeGenerate()},async executeGenerate(){this.loading=!0,this.progress=[],this.videoUrl="",this.audioUrl="";try{"volcengine"===this.selectedModel?await this.generateWithVolcengine():await this.generateWithExistingVoice()}catch(e){e.message.includes("响应超时")||e.message.includes("历史记录")?(this.addProgress("⚠️ "+e.message,"warning"),uni.showModal({title:"提示",content:e.message,showCancel:!0,cancelText:"知道了",confirmText:"查看历史",success:e=>{e.confirm&&uni.navigateTo({url:"/pages/revival/revival-history"})}})):(this.addProgress("生成失败: "+e.message,"error"),uni.showModal({title:"生成失败",content:(e.message||"生成失败")+"\n\n你可以点击“重试”再次生成。\n若已支付但多次生成失败,请联系客服补发(提供订单号/支付时间截图)。",confirmText:"重试",cancelText:"我知道了",success:e=>{e.confirm&&this.executeGenerate()}}))}finally{this.loading=!1}},async generateWithVolcengine(){return new Promise(((e,a)=>{this.addProgress("📤 正在上传照片...","loading"),uni.showModal({title:"🎬 视频生成中",content:"火山引擎视频生成通常需要1-3分钟。\n\n您可以最小化APP做其他事情,生成完成后会弹出提示。\n\n请保持网络连接稳定。",showCancel:!1,confirmText:"我知道了"}),setTimeout((()=>{this.addProgress("🎬 正在生成视频(通常1-3分钟)...","loading")}),2e3);const o=uni.getStorageSync("userId")||"",i=uni.getStorageSync("token")||"";t("log","at pages/revival/revival-original.vue:1009","[Revival-Volcengine] 准备上传照片:",this.photoFile),t("log","at pages/revival/revival-original.vue:1010","[Revival-Volcengine] 用户ID:",o),t("log","at pages/revival/revival-original.vue:1011","[Revival-Volcengine] API地址:",`${this.API_BASE}/api/photo-revival/volcengine-video`),uni.uploadFile({url:`${this.API_BASE}/api/photo-revival/volcengine-video`,filePath:this.photoFile.path,name:"photo",timeout:36e5,header:{"X-User-Id":o,Authorization:i?`Bearer ${i}`:""},formData:(()=>{const e={voiceId:this.selectedVoiceId,voiceType:this.selectedVoiceType,text:this.text,duration:8,name:this.videoTitle};return this.selectedSupportsDialect&&this.selectedDialect&&(e.dialect=this.selectedDialect),this.selectedSupportsLanguageHints&&this.selectedLanguageHint&&(e.languageHints=this.selectedLanguageHint),e})(),success:o=>{t("log","at pages/revival/revival-original.vue:1039","[Revival-Volcengine] 上传响应:",o);let i=null;try{i=JSON.parse(o.data)}catch(l){i=null}if(402===o.statusCode)return t("warn","at pages/revival/revival-original.vue:1048","[Revival-Volcengine] HTTP 402:次数不足,需要付费"),this.addProgress("⚠️ 次数不足,请先付费","warning"),uni.showModal({title:"需要付费",content:i&&i.message?i.message:"次数不足,请先完成支付后再生成",confirmText:"去支付",cancelText:"取消",success:e=>{e.confirm&&T(this,p.PHOTO_REVIVAL.type,(()=>{uni.showToast({title:"支付成功,请重新点击生成",icon:"none"})}),(()=>{}))}}),void a(new Error(i&&i.message?i.message:"次数不足,请先付费"));if(504===o.statusCode)return t("warn","at pages/revival/revival-original.vue:1073","[Revival-Volcengine] HTTP 504:请求超时,但后端可能仍在生成中"),setTimeout((()=>{uni.showModal({title:"⏰ 响应超时",content:"网络响应超时(HTTP 504),但视频可能仍在后台生成中。\n\n是否立即查看历史记录?",confirmText:"查看历史",cancelText:"稍后查看",success:e=>{e.confirm&&uni.navigateTo({url:"/pages/revival/revival-history"})}})}),800),this.addProgress("⏳ 网络响应超时(HTTP 504),视频可能仍在后台生成中,请稍后到历史记录查看","loading"),void e();if(200===o.statusCode){if(i&&"success"===i.status)return this.addProgress("✅ 视频生成完成","done"),this.videoRetried=!1,uni.showToast({title:"生成成功!",icon:"success"}),void e();const o=i&&i.message?i.message:"生成失败";return t("error","at pages/revival/revival-original.vue:1106","[Revival-Volcengine] 后端返回错误:",o),void a(new Error(o))}const s=i&&i.message?i.message:"上传失败: HTTP "+o.statusCode;a(new Error(s))},fail:e=>{t("error","at pages/revival/revival-original.vue:1117","[Revival-Volcengine] 上传响应超时:",e),setTimeout((()=>{uni.showModal({title:"⏰ 响应超时",content:"网络响应超时,但视频可能已经生成成功。\n\n是否立即查看历史记录?",confirmText:"查看历史",cancelText:"稍后查看",success:e=>{e.confirm&&uni.navigateTo({url:"/pages/revival/revival-history"})}})}),3e3),a(new Error("网络响应超时,视频可能正在生成中,请稍后在历史记录中查看"))}})}))},async generateWithNewVoice(){throw this.addProgress("正在创建音色...","loading"),uni.showModal({title:"提示",content:'APP环境暂不支持创建新音色,请使用"已有音色"模式,或在电脑端创建音色后使用',showCancel:!1}),new Error("APP环境暂不支持创建新音色")},generateWithExistingVoice(){return new Promise(((e,a)=>{this.addProgress("⏳ 正在上传照片...","loading"),uni.showModal({title:"⏳ 视频生成中",content:"视频生成通常需要2-5分钟,高峰期可能需要10-30分钟。\n\n您可以最小化APP做其他事情,生成完成后会弹出提示。\n\n请保持网络连接稳定。",showCancel:!1,confirmText:"我知道了"}),setTimeout((()=>{this.addProgress("🎵 正在合成语音...","loading")}),2e3),setTimeout((()=>{this.addProgress("🎬 正在生成视频(通常2-5分钟,高峰期可能更久)...","loading")}),5e3);const o=uni.getStorageSync("userId")||"",i=uni.getStorageSync("token")||"";t("log","at pages/revival/revival-original.vue:1233","[Revival] 准备上传照片:",this.photoFile),t("log","at pages/revival/revival-original.vue:1234","[Revival] 照片路径:",this.photoFile.path),t("log","at pages/revival/revival-original.vue:1235","[Revival] 用户ID:",o),t("log","at pages/revival/revival-original.vue:1236","[Revival] Token:",i?"已设置":"未设置"),t("log","at pages/revival/revival-original.vue:1237","[Revival] API地址:",`${this.API_BASE}/api/photo-revival/revive-quick`),o||(t("warn","at pages/revival/revival-original.vue:1241","[Revival] ⚠️ 警告:用户ID为空,视频可能无法正确保存到数据库"),uni.showModal({title:"提示",content:"检测到您未登录,视频将无法保存到历史记录。是否继续?",success:e=>{e.confirm||a(new Error("用户取消操作"))}})),uni.uploadFile({url:`${this.API_BASE}/api/photo-revival/revive-quick`,filePath:this.photoFile.path,name:"photo",timeout:36e5,header:{"X-User-Id":o,Authorization:i?`Bearer ${i}`:""},formData:(()=>{const e={voiceId:this.selectedVoiceId,voiceType:this.selectedVoiceType,text:this.text,name:this.videoTitle,serverUrl:this.API_BASE};return this.selectedSupportsDialect&&this.selectedDialect&&(e.dialect=this.selectedDialect),this.selectedSupportsLanguageHints&&this.selectedLanguageHint&&(e.languageHints=this.selectedLanguageHint),e})(),success:o=>{t("log","at pages/revival/revival-original.vue:1280","[Revival] 上传响应:",o);let i=null;try{i=JSON.parse(o.data)}catch(l){i=null}if(504===o.statusCode)return t("warn","at pages/revival/revival-original.vue:1289","[Revival] HTTP 504:请求超时,但后端可能仍在生成中"),setTimeout((()=>{uni.showModal({title:"⏰ 响应超时",content:"网络响应超时(HTTP 504),但视频可能仍在后台生成中。\n\n是否立即查看历史记录?",confirmText:"查看历史",cancelText:"稍后查看",success:e=>{e.confirm&&uni.navigateTo({url:"/pages/revival/revival-history"})}})}),800),this.addProgress("⏳ 网络响应超时(HTTP 504),视频可能仍在后台生成中,请稍后到历史记录查看","loading"),void e();if(200===o.statusCode){if(i&&"success"===i.status)return this.handleResult(i),void e();const o=i&&i.message?i.message:"生成失败";return t("error","at pages/revival/revival-original.vue:1317","[Revival] 后端返回错误:",o),void a(new Error(o))}const s=i&&i.message?i.message:"上传失败: HTTP "+o.statusCode;a(new Error(s))},fail:e=>{t("error","at pages/revival/revival-original.vue:1329","[Revival] 上传响应超时:",e),setTimeout((()=>{uni.showModal({title:"⏰ 响应超时",content:"网络响应超时,但视频可能已经生成成功。\n\n是否立即查看历史记录?",confirmText:"查看历史",cancelText:"稍后查看",success:e=>{e.confirm&&uni.navigateTo({url:"/pages/revival/revival-history"})}})}),3e3),a(new Error("网络响应超时,视频可能正在生成中,请稍后在历史记录中查看"))}})}))},async handleResult(e){if("success"!==e.status)throw new Error(e.message||"生成失败");"new"===this.mode&&this.addProgress("✅ 音色创建完成","done"),this.addProgress("✅ 语音合成完成","done"),this.addProgress("✅ 视频生成完成","done"),this.videoUrl=e.videoUrl,this.audioUrl=e.audioUrl,this.videoRetried=!1,this.saveToHistory(e),uni.showModal({title:"🎉 生成成功!",content:'视频已生成完成!\n\n点击"查看视频"可以立即查看和播放视频。',cancelText:"稍后查看",confirmText:"查看视频",success:e=>{e.confirm&&this.scrollToResult()}}),"new"===this.mode&&this.loadVoices()},togglePlay(){this.isPlaying?this.pausePlayback():this.startPlayback()},startPlayback(){const e=uni.createVideoContext("resultVideo",this),t=uni.createInnerAudioContext();t.src=this.audioUrl,e.play(),t.play(),this.isPlaying=!0,this.audioContext=t},pausePlayback(){uni.createVideoContext("resultVideo",this).pause(),this.audioContext&&this.audioContext.pause(),this.isPlaying=!1},onVideoPlay(){this.isPlaying=!0},onVideoPause(){this.isPlaying=!1,this.audioContext&&this.audioContext.pause()},onVideoEnded(){this.isPlaying=!1,this.audioContext&&this.audioContext.stop()},onVideoLoaded(e){t("log","at pages/revival/revival-original.vue:1455","[Revival] 视频加载成功:",e)},onVideoError(e){if(t("error","at pages/revival/revival-original.vue:1460","[Revival] 视频加载失败:",e),t("error","at pages/revival/revival-original.vue:1461","[Revival] 视频URL:",this.videoUrl),t("error","at pages/revival/revival-original.vue:1462","[Revival] 错误详情:",e.detail),!this.videoRetried)return t("log","at pages/revival/revival-original.vue:1466","[Revival] 尝试重新加载视频..."),this.videoRetried=!0,void setTimeout((()=>{uni.createVideoContext("resultVideo",this).stop();const e=this.videoUrl;this.videoUrl="",this.$nextTick((()=>{this.videoUrl=e+"?t="+Date.now()}))}),500);uni.showModal({title:"视频加载失败",content:"无法播放视频,可能是网络或格式问题。\n\n您可以尝试:\n1. 检查网络连接\n2. 返回后重新进入播放\n3. 重新生成视频或稍后再试",showCancel:!1})},onVideoWaiting(e){t("log","at pages/revival/revival-original.vue:1490","[Revival] 视频缓冲中...",e)},onVideoTimeUpdate(e){},scrollToResult(){this.$nextTick((()=>{uni.createSelectorQuery().in(this).select(".result-section").boundingClientRect((e=>{e&&uni.pageScrollTo({scrollTop:e.top-100,duration:300})})).exec()}))},addProgress(e,t){this.progress.push({text:e,status:t}),this.loadingText=e},goToHistory(){uni.navigateTo({url:"/pages/revival/revival-history"})},viewVideo(){if(t("log","at pages/revival/revival-original.vue:1531","[Revival] 准备播放视频"),t("log","at pages/revival/revival-original.vue:1532","[Revival] videoUrl:",this.videoUrl),t("log","at pages/revival/revival-original.vue:1533","[Revival] audioUrl:",this.audioUrl),!this.videoUrl)return void uni.showToast({title:"视频地址不存在",icon:"none"});let e=`/pages/video-player/video-player?url=${encodeURIComponent(this.videoUrl)}&title=${encodeURIComponent("复活视频")}`;e+="&audioInVideo=1",t("log","at pages/revival/revival-original.vue:1545","[Revival] 跳转播放页:",e),uni.navigateTo({url:e,success:()=>{t("log","at pages/revival/revival-original.vue:1551","[Revival] 跳转播放页面成功")},fail:e=>{t("error","at pages/revival/revival-original.vue:1554","[Revival] 跳转播放页面失败:",e),uni.showToast({title:"跳转失败",icon:"none"})}})},handlePaymentClose(){this.paymentModalData.show=!1,this._paymentReject&&this._paymentReject(new Error("用户取消支付"))},async handlePaymentConfirm(e){await S(this,e)},manualSaveToHistory(){if(!this.videoUrl)return void uni.showToast({title:"没有可保存的记录",icon:"none"});const e={photoUrl:this.photoPreview,videoUrl:this.videoUrl,audioUrl:this.audioUrl,voiceId:this.selectedVoiceId};this.saveToHistory(e),uni.showToast({title:"已保存到历史",icon:"success"})},async downloadVideoToLocal(e){try{t("log","at pages/revival/revival-original.vue:1603","[Revival] 开始下载视频到本地:",e);const a=await new Promise(((a,o)=>{uni.downloadFile({url:e,success:e=>{200===e.statusCode?(t("log","at pages/revival/revival-original.vue:1611","[Revival] 视频下载成功:",e.tempFilePath),a(e.tempFilePath)):o(new Error("下载失败,状态码: "+e.statusCode))},fail:e=>{t("error","at pages/revival/revival-original.vue:1618","[Revival] 视频下载失败:",e),o(e)}})})),o=await this.saveFilePermanently(a,"video");this.localVideoPath=o,t("log","at pages/revival/revival-original.vue:1628","[Revival] 视频已保存到:",o)}catch(a){t("error","at pages/revival/revival-original.vue:1630","[Revival] 下载视频失败:",a),uni.showToast({title:"视频下载失败,将使用在线播放",icon:"none"})}},saveFilePermanently:async(e,a)=>new Promise(((o,i)=>{const s=uni.getFileSystemManager(),l=`${uni.env.USER_DATA_PATH}/revival_${a}s/`,n=l+`${a}_${Date.now()}.${"video"===a?"mp4":"mp3"}`;s.mkdir({dirPath:l,recursive:!0,success:()=>{s.copyFile({srcPath:e,destPath:n,success:()=>{t("log","at pages/revival/revival-original.vue:1656",`[Revival] ${a}已保存到永久存储:`,n),o(n)},fail:i=>{t("error","at pages/revival/revival-original.vue:1660",`[Revival] 保存${a}失败:`,i),o(e)}})},fail:a=>{t("error","at pages/revival/revival-original.vue:1667","[Revival] 创建目录失败:",a),o(e)}})})),saveToHistory(e){try{t("log","at pages/revival/revival-original.vue:1678","[Revival] 开始保存历史记录"),t("log","at pages/revival/revival-original.vue:1679","[Revival] 结果数据:",e);let a=[];const o=uni.getStorageSync("generation_history");o&&(a=JSON.parse(o));const i={type:"revival",timestamp:Date.now(),text:this.text,voiceId:"existing"===this.mode?this.selectedVoiceId:e.voiceId||this.selectedVoiceId,photoUrl:this.photoPreview,videoUrl:e.videoUrl,audioUrl:e.audioUrl};t("log","at pages/revival/revival-original.vue:1699","[Revival] 保存记录:",i),a.unshift(i),a.length>100&&(a=a.slice(0,100)),uni.setStorageSync("generation_history",JSON.stringify(a)),t("log","at pages/revival/revival-original.vue:1710","[Revival] 已保存到历史记录,当前共",a.length,"条")}catch(a){t("error","at pages/revival/revival-original.vue:1712","[Revival] 保存历史记录失败:",a)}},downloadVideo(){uni.showLoading({title:"正在保存..."}),uni.downloadFile({url:this.videoUrl,success:e=>{200===e.statusCode?uni.saveVideoToPhotosAlbum({filePath:e.tempFilePath,success:()=>{uni.hideLoading(),uni.showToast({title:"保存成功",icon:"success"})},fail:e=>{uni.hideLoading(),uni.showToast({title:"保存失败: "+e.errMsg,icon:"none"})}}):(uni.hideLoading(),uni.showToast({title:"下载失败",icon:"none"}))},fail:e=>{uni.hideLoading(),uni.showToast({title:"下载失败: "+e.errMsg,icon:"none"})}})},startVideoCall(){if(!this.videoUrl||!this.selectedVoiceId)return void uni.showToast({title:"缺少必要信息",icon:"none"});const e="new"===this.mode?this.voiceName:"对方";uni.navigateTo({url:`/pages/video-call/video-call?idleVideo=${encodeURIComponent(this.videoUrl)}&talkingVideo=${encodeURIComponent(this.videoUrl)}&voiceId=${this.selectedVoiceId}&callerName=${encodeURIComponent(e)}`})}}},[["render",function(t,a,o,i,s,l){const n=e.resolveComponent("PaymentModal");return e.openBlock(),e.createElementBlock("view",{class:"revival-container"},[e.createElementVNode("view",{class:"hero"},[e.createElementVNode("view",{class:"hero-text"},[e.createElementVNode("text",{class:"hero-title"},"照片复活"),e.createElementVNode("text",{class:"hero-subtitle"},"让记忆中的人再次开口说话")]),e.createElementVNode("button",{class:"history-btn",onClick:a[0]||(a[0]=(...e)=>l.goToHistory&&l.goToHistory(...e))}," 📜 历史 ")]),s.showHelpModal?(e.openBlock(),e.createElementBlock("view",{key:0,class:"help-modal",onClick:a[5]||(a[5]=e=>s.showHelpModal=!1)},[e.createElementVNode("view",{class:"help-content",onClick:a[4]||(a[4]=e.withModifiers((()=>{}),["stop"]))},[e.createElementVNode("view",{class:"help-header"},[e.createElementVNode("text",{class:"help-title"},"💡 如何获取音色?"),e.createElementVNode("text",{class:"close-btn",onClick:a[1]||(a[1]=e=>s.showHelpModal=!1)},"✕")]),e.createElementVNode("scroll-view",{"scroll-y":"",class:"help-body"},[e.createElementVNode("view",{class:"help-step"},[e.createElementVNode("text",{class:"help-step-title"},'1️⃣ 点击底部导航"声音克隆"'),e.createElementVNode("image",{class:"help-image",src:`${s.API_BASE}/static/1.jpg`,mode:"widthFix"},null,8,["src"])]),e.createElementVNode("view",{class:"help-step"},[e.createElementVNode("text",{class:"help-step-title"},'2️⃣ 点击"上传音频"按钮'),e.createElementVNode("image",{class:"help-image",src:`${s.API_BASE}/static/2.jpg`,mode:"widthFix"},null,8,["src"])]),e.createElementVNode("view",{class:"help-step"},[e.createElementVNode("text",{class:"help-step-title"},"3️⃣ 录制或上传10-20秒清晰人声"),e.createElementVNode("text",{class:"help-step-desc"},"建议录制清晰的普通话朗读,避免背景噪音")]),e.createElementVNode("view",{class:"help-step"},[e.createElementVNode("text",{class:"help-step-title"},"4️⃣ 创建成功后即可在此选择使用"),e.createElementVNode("text",{class:"help-step-desc"},"💡 提示:音色质量越好,合成效果越自然")])]),e.createElementVNode("view",{class:"help-footer"},[e.createElementVNode("button",{class:"help-btn secondary",onClick:a[2]||(a[2]=e=>s.showHelpModal=!1)},"知道了"),e.createElementVNode("button",{class:"help-btn primary",onClick:a[3]||(a[3]=(...e)=>l.goToUpload&&l.goToUpload(...e))},"去创建")])])])):e.createCommentVNode("",!0),e.createElementVNode("scroll-view",{"scroll-y":"",class:"content"},[e.createElementVNode("view",{class:"tips-card"},[e.createElementVNode("view",{class:"tips-title"},"合规提示"),e.createElementVNode("view",{class:"tips-item"},"照片中避免:未成年人、明显真人正脸/疑似公众人物、裸露低俗、血腥暴力、涉政涉恐等内容"),e.createElementVNode("view",{class:"tips-item"},"避免:平台截图/水印/二维码/账号昵称/大量文字(图片中的文字也会被审核)"),e.createElementVNode("view",{class:"tips-item"},"建议:使用清晰、无水印、无UI、背景干净的照片;台词避免敏感词")]),e.createElementVNode("view",{class:"step-card"},[e.createElementVNode("view",{class:"step-header"},[e.createElementVNode("view",{class:"step-number"},"1"),e.createElementVNode("text",{class:"step-title"},"上传照片")]),e.createElementVNode("view",{class:"upload-btn",onClick:a[6]||(a[6]=(...e)=>l.choosePhoto&&l.choosePhoto(...e))},[e.withDirectives(e.createElementVNode("image",{src:s.photoPreview,class:"preview-img",mode:"aspectFill",style:{width:"100%",height:"100%",position:"absolute",top:"0",left:"0","z-index":"10"}},null,8,["src"]),[[e.vShow,s.photoPreview]]),e.withDirectives(e.createElementVNode("view",{class:"upload-placeholder"},[e.createElementVNode("text",{class:"icon"},"📷"),e.createElementVNode("text",null,"点击选择照片")],512),[[e.vShow,!s.photoPreview]])])]),e.createElementVNode("view",{class:"step-card"},[e.createElementVNode("view",{class:"step-header"},[e.createElementVNode("view",{class:"step-number"},"2"),e.createElementVNode("text",{class:"step-title"},"输入标题")]),e.withDirectives(e.createElementVNode("input",{class:"input-field","onUpdate:modelValue":a[7]||(a[7]=e=>s.videoTitle=e),placeholder:"给这个视频起个名字...",maxlength:"20"},null,512),[[e.vModelText,s.videoTitle]]),e.createElementVNode("view",{class:"char-count"},e.toDisplayString(s.videoTitle.length)+" / 20",1),e.createElementVNode("view",{class:"input-hint"},"💡 标题将显示在历史记录和AI通话页面")]),e.createElementVNode("view",{class:"step-card"},[e.createElementVNode("view",{class:"step-header"},[e.createElementVNode("view",{class:"step-number"},"3"),e.createElementVNode("text",{class:"step-title"},"选择模型")]),e.createElementVNode("picker",{mode:"selector",range:s.modelOptions,"range-key":"label",onChange:a[8]||(a[8]=(...e)=>l.onModelChange&&l.onModelChange(...e)),class:"picker-large"},[e.createElementVNode("view",{class:"picker"},e.toDisplayString(s.selectedModelName||"请选择模型"),1)],40,["range"]),l.getCurrentModelMaintenanceMsg()?(e.openBlock(),e.createElementBlock("view",{key:0,class:"maintenance-warning"}," ⚠️ "+e.toDisplayString(l.getCurrentModelMaintenanceMsg()),1)):(e.openBlock(),e.createElementBlock("view",{key:1,class:"input-hint"},"💡 "+e.toDisplayString(s.modelHint),1))]),e.createElementVNode("view",{class:"step-card"},[e.createElementVNode("view",{class:"step-header"},[e.createElementVNode("view",{class:"step-number"},"4"),e.createElementVNode("text",{class:"step-title"},"选择音色"),e.createElementVNode("text",{class:"help-icon",onClick:a[9]||(a[9]=(...e)=>l.showVoiceHelp&&l.showVoiceHelp(...e))},"❓")]),e.createElementVNode("view",{class:"voice-section"},[e.createElementVNode("picker",{mode:"selector",range:s.voiceTypeOptions,"range-key":"label",onChange:a[10]||(a[10]=(...e)=>l.onVoiceTypeChange&&l.onVoiceTypeChange(...e)),class:"picker-large"},[e.createElementVNode("view",{class:"picker"},e.toDisplayString(s.selectedVoiceTypeLabel),1)],40,["range"]),e.createElementVNode("picker",{mode:"selector",range:l.displayVoices,"range-key":"voice_name",onChange:a[11]||(a[11]=(...e)=>l.onVoiceChange&&l.onVoiceChange(...e)),class:"picker-large"},[e.createElementVNode("view",{class:"picker"},e.toDisplayString(s.selectedVoiceName||"请选择音色"),1)],40,["range"]),e.createElementVNode("view",{class:"input-hint"},'💡 请先在"声音克隆"页面创建音色')]),s.selectedSupportsDialect&&"OFFICIAL"!==(s.selectedVoiceType||"CLONE")?(e.openBlock(),e.createElementBlock("view",{key:0,class:"voice-section"},[e.createElementVNode("view",{class:"input-hint"},"方言"),e.createElementVNode("picker",{mode:"selector",range:s.dialectOptions,onChange:a[12]||(a[12]=(...e)=>l.onDialectChange&&l.onDialectChange(...e)),class:"picker-large"},[e.createElementVNode("view",{class:"picker"},e.toDisplayString(s.selectedDialect||"请选择方言(可选)"),1)],40,["range"])])):e.createCommentVNode("",!0),s.selectedSupportsLanguageHints&&"OFFICIAL"!==(s.selectedVoiceType||"CLONE")?(e.openBlock(),e.createElementBlock("view",{key:1,class:"voice-section"},[e.createElementVNode("view",{class:"input-hint"},"语言提示(可选)"),e.createElementVNode("picker",{mode:"selector",range:s.languageHintOptions,onChange:a[13]||(a[13]=(...e)=>l.onLanguageHintChange&&l.onLanguageHintChange(...e)),class:"picker-large"},[e.createElementVNode("view",{class:"picker"},e.toDisplayString(s.selectedLanguageHintLabel||"请选择语言(可选)"),1)],40,["range"])])):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"step-card"},[e.createElementVNode("view",{class:"step-header"},[e.createElementVNode("view",{class:"step-number"},"5"),e.createElementVNode("text",{class:"step-title"},"输入台词")]),e.withDirectives(e.createElementVNode("textarea",{class:"textarea","onUpdate:modelValue":a[14]||(a[14]=e=>s.text=e),placeholder:"输入想让照片中的人说的话...",maxlength:"500"},null,512),[[e.vModelText,s.text]]),e.createElementVNode("view",{class:"char-count"},e.toDisplayString(s.text.length)+" / 500",1)]),e.createElementVNode("button",{class:"generate-btn",disabled:s.loading||!l.canGenerate,onClick:a[15]||(a[15]=(...e)=>l.handleGenerate&&l.handleGenerate(...e))},[s.loading?(e.openBlock(),e.createElementBlock("text",{key:0},e.toDisplayString(s.loadingText),1)):(e.openBlock(),e.createElementBlock("text",{key:1},"🎬 开始生成视频"))],8,["disabled"]),s.progress.length>0?(e.openBlock(),e.createElementBlock("view",{key:0,class:"progress-section"},[e.createElementVNode("view",{class:"progress-title"},"生成进度"),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.progress,((t,a)=>(e.openBlock(),e.createElementBlock("view",{key:a,class:"progress-item"},[e.createElementVNode("text",{class:e.normalizeClass(["progress-icon",t.status])},e.toDisplayString("done"===t.status?"✅":"error"===t.status?"❌":"⏳"),3),e.createElementVNode("text",{class:"progress-text"},e.toDisplayString(t.text),1)])))),128))])):e.createCommentVNode("",!0),s.videoUrl?(e.openBlock(),e.createElementBlock("view",{key:1,class:"result-section"},[e.createElementVNode("view",{class:"result-title"},"🎉 生成成功!"),e.createElementVNode("video",{id:"resultVideo",src:s.videoUrl,class:"result-video","show-center-play-btn":!1,controls:!1,muted:!0,autoplay:!1,loop:!1,"enable-play-gesture":!0,"object-fit":"contain","show-loading":!0,"enable-progress-gesture":!1,poster:s.photoPreview,onPlay:a[16]||(a[16]=(...e)=>l.onVideoPlay&&l.onVideoPlay(...e)),onPause:a[17]||(a[17]=(...e)=>l.onVideoPause&&l.onVideoPause(...e)),onEnded:a[18]||(a[18]=(...e)=>l.onVideoEnded&&l.onVideoEnded(...e)),onError:a[19]||(a[19]=(...e)=>l.onVideoError&&l.onVideoError(...e)),onLoadedmetadata:a[20]||(a[20]=(...e)=>l.onVideoLoaded&&l.onVideoLoaded(...e)),onWaiting:a[21]||(a[21]=(...e)=>l.onVideoWaiting&&l.onVideoWaiting(...e)),onTimeupdate:a[22]||(a[22]=(...e)=>l.onVideoTimeUpdate&&l.onVideoTimeUpdate(...e))},null,40,["src","poster"]),e.createElementVNode("audio",{id:"resultAudio",src:s.audioUrl,style:{display:"none"}},null,8,["src"]),e.createElementVNode("view",{class:"play-controls"},[e.createElementVNode("button",{class:"play-btn",onClick:a[23]||(a[23]=(...e)=>l.viewVideo&&l.viewVideo(...e))}," ▶️ 播放 ")]),e.createElementVNode("button",{class:"download-btn",onClick:a[24]||(a[24]=(...e)=>l.downloadVideo&&l.downloadVideo(...e))}," 💾 保存到相册 ")])):e.createCommentVNode("",!0)]),e.createVNode(n,{ref:"paymentModal",show:s.paymentModalData.show,serviceType:s.paymentModalData.serviceType,serviceName:s.paymentModalData.serviceName,serviceDesc:s.paymentModalData.serviceDesc,price:s.paymentModalData.price,orderNo:s.paymentModalData.orderNo,paymentTips:s.paymentModalData.paymentTips,onClose:l.handlePaymentClose,onConfirm:l.handlePaymentConfirm},null,8,["show","serviceType","serviceName","serviceDesc","price","orderNo","paymentTips","onClose","onConfirm"])])}],["__scopeId","data-v-4d2562d2"]]);const I=d({data:()=>({API_BASE:i,videos:[],loading:!1,precacheQueue:[],precaching:!1,precacheInFlight:{},publishDialogVisible:!1,publishTitle:"",publishTargetVideo:null,shareTargetVideo:null}),onLoad(){this.loadVideos()},onShareAppMessage(){const e=this.shareTargetVideo||{},t=e&&(e.name||"").trim()?e.name:"我的视频",a=e&&e.photo_url?e.photo_url:void 0,o=e&&(e.edited_video_url||e.local_video_path||e.video_url)?String(e.edited_video_url||e.local_video_path||e.video_url):"";return{title:t,path:"/pages/video-player/video-player?audioInVideo=1&url="+encodeURIComponent(o)+"&title="+encodeURIComponent(t),imageUrl:a}},onShareTimeline(){const e=this.shareTargetVideo||{},t=e&&(e.name||"").trim()?e.name:"我的视频",a=e&&e.photo_url?e.photo_url:void 0,o=e&&(e.edited_video_url||e.local_video_path||e.video_url)?String(e.edited_video_url||e.local_video_path||e.video_url):"";return{title:t,query:"url="+encodeURIComponent(o)+"&title="+encodeURIComponent(t),imageUrl:a}},methods:{normalizeMediaUrl(e){return e?e.startsWith("/")?`${this.API_BASE}${e}`:e.startsWith("http://115.190.167.176:20002")?e.replace("http://115.190.167.176:20002",this.API_BASE):e:e},ensureLoginOrRedirect(){const e=uni.getStorageSync("token")||"",t=uni.getStorageSync("userId")||"";return!(!e||!t)||(uni.showToast({title:"请先登录",icon:"none"}),setTimeout((()=>{uni.navigateTo({url:"/pages/login/login"})}),800),!1)},isVideoPublishable(e){if(!e)return!1;return!!(e.edited_video_url||e.local_video_path||e.video_url||e.videoUrl||e.localVideoPath)},openPublishDialog(e){this.publishTargetVideo=e,this.publishTitle=e&&e.name?e.name:"复活视频",this.publishDialogVisible=!0},closePublishDialog(){this.publishDialogVisible=!1,this.publishTitle="",this.publishTargetVideo=null},confirmPublish(){const e=this.publishTargetVideo;if(!e)return void this.closePublishDialog();const t=(this.publishTitle||"").trim();t?t.length>20?uni.showToast({title:"标题不能超过20字",icon:"none"}):(this.closePublishDialog(),this.publishVideo(e,t)):uni.showToast({title:"请输入标题",icon:"none"})},publishVideo(e,t){const a=uni.getStorageSync("token")||"",o=uni.getStorageSync("userId")||"";a&&o?(uni.showLoading({title:"发布中..."}),uni.request({url:`${this.API_BASE}/api/works/publish/revival-video`,method:"POST",header:{"Content-Type":"application/json","X-User-Id":o,Authorization:a?`Bearer ${a}`:""},data:{userId:Number(o),revivalVideoId:e.id,title:t},success:t=>{var a;200===t.statusCode&&t.data&&t.data.success?(e.published=!0,e.workId=t.data.data&&t.data.data.id,uni.showToast({title:"发布成功",icon:"success"})):uni.showToast({title:(null==(a=t.data)?void 0:a.message)||"发布失败",icon:"none"})},fail:()=>{uni.showToast({title:"发布失败",icon:"none"})},complete:()=>{uni.hideLoading()}})):uni.showToast({title:"请先登录",icon:"none"})},loadVideos(){if(!this.ensureLoginOrRedirect())return this.loading=!1,void(this.videos=[]);this.loading=!0;const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";uni.request({url:`${this.API_BASE}/api/photo-revival/videos`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:a=>{t("log","at pages/revival/revival-history.vue:287","[RevivalHistory] API响应:",a.data),t("log","at pages/revival/revival-history.vue:288","[RevivalHistory] 用户ID:",e),a.data.success&&(this.videos=(a.data.videos||[]).map((e=>({...e,photo_url:this.normalizeMediaUrl(e&&e.photo_url?String(e.photo_url):""),video_url:this.normalizeMediaUrl(e&&e.video_url?String(e.video_url):""),edited_video_url:this.normalizeMediaUrl(e&&e.edited_video_url?String(e.edited_video_url):""),local_video_path:this.normalizeMediaUrl(e&&e.local_video_path?String(e.local_video_path):""),audio_url:this.normalizeMediaUrl(e&&e.audio_url?String(e.audio_url):""),published:!1,workId:null}))),t("log","at pages/revival/revival-history.vue:300","[RevivalHistory] 加载视频数量:",this.videos.length),this.checkVideosCache(),this.loadPublishStatus())},fail:e=>{t("error","at pages/revival/revival-history.vue:308","[RevivalHistory] 加载失败:",e),uni.showToast({title:"加载失败",icon:"none"})},complete:()=>{this.loading=!1}})},loadPublishStatus(){const e=uni.getStorageSync("token")||"",t=uni.getStorageSync("userId")||"";this.videos.forEach((a=>{uni.request({url:`${this.API_BASE}/api/works/source?sourceType=REVIVAL_VIDEO&sourceId=${a.id}`,method:"GET",header:{"X-User-Id":t,Authorization:e?`Bearer ${e}`:""},success:e=>{200===e.statusCode&&e.data&&(a.published=1===e.data.published,a.workId=e.data.id)}})}))},togglePublish(e){const t=uni.getStorageSync("token")||"",a=uni.getStorageSync("userId")||"";t&&a?e.published?uni.showModal({title:"取消发布",content:"确定要从作品广场下架该作品吗?",success:o=>{o.confirm&&(uni.showLoading({title:"处理中..."}),uni.request({url:`${this.API_BASE}/api/works/unpublish?workId=${e.workId}&userId=${a}`,method:"POST",header:{"X-User-Id":a,Authorization:t?`Bearer ${t}`:""},success:t=>{var a;200===t.statusCode&&t.data&&t.data.success?(e.published=!1,uni.showToast({title:"已取消发布",icon:"success"})):uni.showToast({title:(null==(a=t.data)?void 0:a.message)||"操作失败",icon:"none"})},fail:()=>{uni.showToast({title:"操作失败",icon:"none"})},complete:()=>{uni.hideLoading()}}))}}):this.openPublishDialog(e):uni.showToast({title:"请先登录",icon:"none"})},checkVideosCache(){let e=0;this.videos.forEach((t=>{const a=t.edited_video_url||t.local_video_path||t.video_url;if(a){const o=this.normalizeMediaUrl(a),i=this.generateCacheKey(o),s=uni.getStorageSync(i);t.isCached=!!s,!t.isCached&&"undefined"!=typeof plus&&e<3&&(e++,this.enqueuePrecache(o))}}))},enqueuePrecache(e){e&&(this.precacheInFlight[e]||-1===this.precacheQueue.indexOf(e)&&(this.precacheQueue.push(e),this.processPrecacheQueue()))},async processPrecacheQueue(){if(!this.precaching&&this.precacheQueue.length){this.precaching=!0;try{for(;this.precacheQueue.length;){const t=this.precacheQueue.shift();if(t&&!this.precacheInFlight[t]){this.precacheInFlight[t]=!0;try{await this.precacheVideoApp(t)}catch(e){}finally{delete this.precacheInFlight[t]}}}}finally{this.precaching=!1}}},precacheVideoApp(e){return new Promise(((t,a)=>{if("undefined"==typeof plus)return void t();const o=this.generateCacheKey(e);uni.getStorageSync(o)?t():uni.downloadFile({url:e,success:i=>{200===i.statusCode?uni.saveFile({tempFilePath:i.tempFilePath,success:a=>{const i=a.savedFilePath;uni.setStorageSync(o,i);const s=uni.getStorageSync("video_cache_info")||{};s[o]={path:i,url:e,time:Date.now()},uni.setStorageSync("video_cache_info",s),t(i)},fail:e=>{a(e)}}):a(new Error("download failed"))},fail:e=>{a(e)}})}))},generateCacheKey(e){let t=0;for(let a=0;a{t("log","at pages/revival/revival-history.vue:518","[RevivalHistory] 跳转成功")},fail:e=>{t("error","at pages/revival/revival-history.vue:521","[RevivalHistory] 跳转失败:",e),uni.showToast({title:"跳转失败: "+e.errMsg,icon:"none"})}})},playVideo(e){const a=e&&e.local_video_path?String(e.local_video_path):"",o=e.edited_video_url||e.local_video_path||e.video_url,i=o?String(o):"";if(e.edited_video_url||-1!==a.indexOf("/static/videos/revival_")||i.indexOf("/static/videos/revival_"),!o)return void uni.showToast({title:"视频地址不存在",icon:"none"});let s=`/pages/video-player/video-player?audioInVideo=1&url=${encodeURIComponent(o)}&title=${encodeURIComponent(e.name||"复活视频")}`;uni.navigateTo({url:s,fail:e=>{t("error","at pages/revival/revival-history.vue:550","[RevivalHistory] 跳转失败:",e),uni.showToast({title:"播放失败,请稍后重试",icon:"none"})}})},prepareShare(e){this.shareTargetVideo=e||null},shareVideo(e){t("log","at pages/revival/revival-history.vue:565","[RevivalHistory] 分享视频:",e);e.edited_video_url||e.local_video_path||e.video_url?uni.showActionSheet({itemList:["保存到相册","复制链接"],success:t=>{0===t.tapIndex?this.saveVideoToAlbum(e):1===t.tapIndex&&this.copyVideoLink(e)}}):uni.showToast({title:"视频地址不存在",icon:"none"})},async copyVideoLink(e){const t=e.edited_video_url||e.local_video_path||e.video_url;t?uni.setClipboardData({data:t,success:()=>{uni.showToast({title:"链接已复制",icon:"success"})}}):uni.showToast({title:"视频地址不存在",icon:"none"})},async saveVideoToAlbum(e){const a=e.edited_video_url||e.local_video_path||e.video_url;t("log","at pages/revival/revival-history.vue:611","[RevivalHistory] 保存视频:",a),this.saveVideoOnly(a)},saveVideoOnly(e){uni.showLoading({title:"保存中..."}),e.startsWith("file://")||e.startsWith("wxfile://")?uni.saveVideoToPhotosAlbum({filePath:e,success:()=>{uni.hideLoading(),uni.showToast({title:"保存成功",icon:"success"})},fail:e=>{uni.hideLoading(),t("error","at pages/revival/revival-history.vue:634","[RevivalHistory] 保存失败:",e),e.errMsg.includes("auth")?uni.showModal({title:"需要授权",content:"请授权保存到相册",success:e=>{e.confirm&&uni.openSetting()}}):uni.showToast({title:"保存失败",icon:"none"})}}):uni.downloadFile({url:e,success:e=>{200===e.statusCode?uni.saveVideoToPhotosAlbum({filePath:e.tempFilePath,success:()=>{uni.hideLoading(),uni.showToast({title:"保存成功",icon:"success"})},fail:e=>{uni.hideLoading(),t("error","at pages/revival/revival-history.vue:670","[RevivalHistory] 保存失败:",e),e.errMsg.includes("auth")?uni.showModal({title:"需要授权",content:"请授权保存到相册",success:e=>{e.confirm&&uni.openSetting()}}):uni.showToast({title:"保存失败",icon:"none"})}}):(uni.hideLoading(),uni.showToast({title:"下载失败",icon:"none"}))},fail:e=>{uni.hideLoading(),t("error","at pages/revival/revival-history.vue:699","[RevivalHistory] 下载失败:",e),uni.showToast({title:"下载失败",icon:"none"})}})},async deleteVideo(e){uni.showModal({title:"确认删除",content:`确定要删除视频"${e.name||"复活视频"}"吗?`,success:t=>{if(t.confirm){const t=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";uni.request({url:`${i}/api/photo-revival/videos/${e.id}`,method:"DELETE",header:{"X-User-Id":t,Authorization:a?`Bearer ${a}`:""},success:e=>{var t;200===e.statusCode&&e.data&&e.data.success?(uni.showToast({title:"删除成功",icon:"success"}),this.loadVideos()):uni.showToast({title:(null==(t=e.data)?void 0:t.message)||"删除失败",icon:"none"})},fail:e=>{uni.showToast({title:"删除失败,请重试",icon:"none"})}})}}})},formatTime(e){if(!e)return"";const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`},formatDuration(e){if(!e)return"";return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"history-container"},[e.createElementVNode("view",{class:"header"},[e.createElementVNode("text",{class:"title"},"我的视频"),e.createElementVNode("text",{class:"subtitle"},e.toDisplayString(s.videos.length)+" 个作品",1)]),e.createElementVNode("scroll-view",{"scroll-y":"",class:"video-list"},[s.loading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"loading-box"},[e.createElementVNode("text",{class:"loading-text"},"⏳ 加载中...")])):0===s.videos.length?(e.openBlock(),e.createElementBlock("view",{key:1,class:"empty-box"},[e.createElementVNode("text",{class:"empty-icon"},"📹"),e.createElementVNode("text",{class:"empty-text"},"暂无复活视频"),e.createElementVNode("text",{class:"empty-hint"},"快去复活你的第一张照片吧")])):(e.openBlock(),e.createElementBlock("view",{key:2,class:"video-grid"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.videos,(t=>(e.openBlock(),e.createElementBlock("view",{key:t.id,class:"video-card",onClick:e=>l.viewVideo(t)},[e.createElementVNode("view",{class:"video-cover"},[t.photo_url?(e.openBlock(),e.createElementBlock("image",{key:0,src:t.photo_url,class:"cover-image",mode:"aspectFill"},null,8,["src"])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"cover-placeholder"},[e.createElementVNode("text",{class:"placeholder-icon"},"📹")])),e.createElementVNode("view",{class:"play-overlay"},[e.createElementVNode("text",{class:"play-icon"},"▶")]),t.isCached?(e.openBlock(),e.createElementBlock("view",{key:2,class:"cache-badge"},[e.createElementVNode("text",{class:"cache-text"},"已缓存")])):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"video-info"},[e.createElementVNode("text",{class:"video-title"},e.toDisplayString(t.name||"复活视频"),1),t.text?(e.openBlock(),e.createElementBlock("text",{key:0,class:"video-text"},e.toDisplayString(t.text),1)):e.createCommentVNode("",!0),e.createElementVNode("view",{class:"video-meta"},[e.createElementVNode("text",{class:"video-time"},e.toDisplayString(l.formatTime(t.create_time)),1)])]),e.createElementVNode("view",{class:"video-actions"},[e.createElementVNode("view",{class:"action-btn",onClick:e.withModifiers((e=>l.viewVideo(t)),["stop"])},[e.createElementVNode("text",{class:"action-icon"},"▶️"),e.createElementVNode("text",{class:"action-text"},"播放")],8,["onClick"]),e.createElementVNode("view",{class:"action-btn share",onClick:e.withModifiers((e=>l.shareVideo(t)),["stop"])},[e.createElementVNode("text",{class:"action-icon"},"🔗"),e.createElementVNode("text",{class:"action-text"},"分享")],8,["onClick"]),l.isVideoPublishable(t)?(e.openBlock(),e.createElementBlock("view",{key:0,class:"action-btn publish",onClick:e.withModifiers((e=>l.togglePublish(t)),["stop"])},[e.createElementVNode("text",{class:"action-icon"},e.toDisplayString(t.published?"↩️":"📢"),1),e.createElementVNode("text",{class:"action-text"},e.toDisplayString(t.published?"下架":"发布"),1)],8,["onClick"])):e.createCommentVNode("",!0),e.createElementVNode("view",{class:"action-btn delete",onClick:e.withModifiers((e=>l.deleteVideo(t)),["stop"])},[e.createElementVNode("text",{class:"action-icon"},"🗑️"),e.createElementVNode("text",{class:"action-text"},"删除")],8,["onClick"])])],8,["onClick"])))),128))]))]),s.publishDialogVisible?(e.openBlock(),e.createElementBlock("view",{key:0,class:"publish-mask",onClick:a[4]||(a[4]=(...e)=>l.closePublishDialog&&l.closePublishDialog(...e))},[e.createElementVNode("view",{class:"publish-dialog",onClick:a[3]||(a[3]=e.withModifiers((()=>{}),["stop"]))},[e.createElementVNode("view",{class:"publish-title"},"发布作品"),e.withDirectives(e.createElementVNode("input",{class:"publish-input","onUpdate:modelValue":a[0]||(a[0]=e=>s.publishTitle=e),placeholder:"请输入标题(最多20字)",maxlength:"20"},null,512),[[e.vModelText,s.publishTitle]]),e.createElementVNode("view",{class:"publish-actions"},[e.createElementVNode("view",{class:"publish-btn cancel",onClick:a[1]||(a[1]=(...e)=>l.closePublishDialog&&l.closePublishDialog(...e))},"取消"),e.createElementVNode("view",{class:"publish-btn confirm",onClick:a[2]||(a[2]=(...e)=>l.confirmPublish&&l.confirmPublish(...e))},"发布")])])])):e.createCommentVNode("",!0)])}],["__scopeId","data-v-e53ce536"]]);const A=d({computed:{shouldShowPlayButton(){return!this.videoHasStarted||!this.isLoopingRestart&&!this.videoWaiting&&(!this.isVideoPlaying&&!!this.userPaused)}},data:()=>({API_BASE:i,videoUrl:"",audioUrl:"",videoTitle:"视频播放",audioInVideo:!1,hasAudio:!1,audioContext:null,videoContext:null,audioDuration:0,videoDuration:0,isAudioPlaying:!1,videoLoopTimer:null,audioStarted:!1,audioReady:!1,audioEnded:!1,pendingAudioStart:!1,pendingVideoPlay:!1,audioStartDelaySec:1,lastVideoTime:0,enableSilencePause:!1,silenceSegments:[],silenceLoaded:!1,pausedBySilence:!1,lastAudioTime:0,isLoopingRestart:!1,userPaused:!1,pausedByAudioEnd:!1,videoEndedWaitingAudio:!1,videoWaiting:!1,videoEnded:!1,lastVideoTimeUpdateAt:0,playbackWatchdogTimer:null,lastWaitingRecoverAt:0,localVideoPath:"",isVideoDownloading:!1,isVideoReady:!1,videoHasStarted:!1,isVideoPlaying:!1,appNetworkFallbackTimer:null,appFallbackTriggered:!1,hasShownStorageLimitToast:!1,cacheKey:"",audioCacheKey:"",audioStartTime:0,videoStartTime:0,audioPauseTime:0}),onLoad(e){t("log","at pages/video-player/video-player.vue:119","[VideoPlayer] 接收参数:",e),t("log","at pages/video-player/video-player.vue:120","[VideoPlayer] BUILD_MARK_NO_EXTERNAL_AUDIO=2026-01-08-01");const a="1"===e.audioInVideo||"true"===e.audioInVideo;if(e.videoUrl?this.videoUrl=decodeURIComponent(e.videoUrl):e.url&&(this.videoUrl=decodeURIComponent(e.url)),void 0!==e.audioDelay&&null!==e.audioDelay&&""!==String(e.audioDelay).trim()){const t=Number(e.audioDelay);!Number.isNaN(t)&&t>=0&&(this.audioStartDelaySec=t)}if(void 0!==e.silencePause&&null!==e.silencePause&&""!==String(e.silencePause).trim()){const t=String(e.silencePause).trim();this.enableSilencePause="1"===t||"true"===t}this.videoUrl=this.normalizeMediaUrl(this.videoUrl);const o=!(!this.videoUrl||-1===this.videoUrl.indexOf("/static/videos/revival_")),i=a||o;this.audioInVideo=i,t("log","at pages/video-player/video-player.vue:141","[VideoPlayer] audioInVideo判定: audioInVideoParam=",a,"matchInVideo=",o,"videoUrl=",this.videoUrl),this.cacheKey=this.generateCacheKey(this.videoUrl),this.videoEnded=!1,this.loadVideo(),e.title&&(this.videoTitle=decodeURIComponent(e.title)),this.hasAudio=!1,this.audioUrl="",i?(this.hasAudio=!0,t("log","at pages/video-player/video-player.vue:154","[VideoPlayer] audioInVideo=1,使用视频自带音轨")):e.audioUrl&&t("log","at pages/video-player/video-player.vue:156","[VideoPlayer] 已忽略外部 audioUrl 参数(禁用外部音频)"),this.$nextTick((()=>{this.videoContext=uni.createVideoContext("videoPlayer",this)}))},onUnload(){this.stopVideoLoop(),this.stopPlaybackWatchdog(),this.audioContext&&this.audioContext.destroy()},methods:{handleTogglePlay(){if(this.videoContext){if(this.isVideoPlaying)return this.userPaused=!0,void this.videoContext.pause();this.userPaused=!1,this.videoContext.play()}else this.$nextTick((()=>{this.videoContext=uni.createVideoContext("videoPlayer",this),this.userPaused=!1,this.videoContext&&this.videoContext.play&&this.videoContext.play()}))},startPlaybackWatchdog(){this.playbackWatchdogTimer||(this.lastVideoTimeUpdateAt=Date.now(),this.playbackWatchdogTimer=setInterval((()=>{if(!this.videoContext)return;if(this.userPaused)return;if(this.videoEnded)return;if(!this.videoHasStarted)return;if(this.audioEnded)return;const e=Date.now();this.isVideoPlaying&&this.lastVideoTimeUpdateAt&&e-this.lastVideoTimeUpdateAt>2500&&(t("log","at pages/video-player/video-player.vue:204","[VideoPlayer] 检测到视频疑似卡住(无timeupdate),尝试恢复播放。lastVideoTime=",this.lastVideoTime),this.videoContext.play())}),1500))},stopPlaybackWatchdog(){this.playbackWatchdogTimer&&(clearInterval(this.playbackWatchdogTimer),this.playbackWatchdogTimer=null)},goBack(){uni.navigateBack()},generateCacheKey(e){let t=0;for(let a=0;a{t("log","at pages/video-player/video-player.vue:280","[VideoPlayer] 缓存文件有效,直接使用"),this.localVideoPath=this.toPlayableLocalPath(e),this.isVideoReady=!0,this.isVideoDownloading=!1,this.$nextTick((()=>{this.videoContext||(this.videoContext=uni.createVideoContext("videoPlayer",this)),setTimeout((()=>{this.videoContext&&(this.userPaused||this.videoEnded||this.videoHasStarted||this.videoContext.play&&this.videoContext.play())}),80)}))},fail:()=>{t("log","at pages/video-player/video-player.vue:299","[VideoPlayer] 缓存文件已失效,重新下载"),uni.removeStorageSync(this.cacheKey),this.localVideoPath=this.videoUrl,this.downloadAndCacheVideo(),this.isVideoReady=!0,this.$nextTick((()=>{this.videoContext||(this.videoContext=uni.createVideoContext("videoPlayer",this)),setTimeout((()=>{this.videoContext&&(this.userPaused||this.videoEnded||this.videoHasStarted||this.videoContext.play&&this.videoContext.play())}),80)}))}});else{if(t("log","at pages/video-player/video-player.vue:321","[VideoPlayer] 无缓存,先在线播放,后台下载缓存"),"undefined"!=typeof plus)return void this.tryAppNetworkPlaybackThenFallback();this.localVideoPath=this.videoUrl,this.isVideoReady=!0,this.downloadAndCacheVideo(),this.$nextTick((()=>{this.videoContext||(this.videoContext=uni.createVideoContext("videoPlayer",this)),setTimeout((()=>{this.videoContext&&(this.userPaused||this.videoEnded||this.videoHasStarted||this.videoContext.play&&this.videoContext.play())}),80)}))}},tryAppNetworkPlaybackThenFallback(){this.appFallbackTriggered=!1,this.appNetworkFallbackTimer&&(clearTimeout(this.appNetworkFallbackTimer),this.appNetworkFallbackTimer=null),this.localVideoPath=this.videoUrl,this.isVideoReady=!0,this.$nextTick((()=>{this.videoContext||(this.videoContext=uni.createVideoContext("videoPlayer",this)),setTimeout((()=>{this.videoContext&&(this.userPaused||this.videoEnded||this.videoHasStarted||this.videoContext.play&&this.videoContext.play())}),80)})),this.appNetworkFallbackTimer=setTimeout((()=>{this.videoHasStarted||this.appFallbackTriggered||(t("log","at pages/video-player/video-player.vue:371","[VideoPlayer] App网络直连未能快速开始播放,切换为下载兜底"),this.appFallbackTriggered=!0,this.downloadForPlaybackAndCache())}),1800)},downloadForPlaybackAndCache(){t("log","at pages/video-player/video-player.vue:378","[VideoPlayer] App无缓存:先下载临时文件播放,再写入缓存:",this.videoUrl),this.isVideoDownloading=!0,uni.downloadFile({url:this.videoUrl,success:e=>{if(200!==e.statusCode)return t("error","at pages/video-player/video-player.vue:384","[VideoPlayer] App临时下载失败,状态码:",e.statusCode),this.isVideoDownloading=!1,this.isVideoReady=!0,void(this.localVideoPath=this.videoUrl);const a=e.tempFilePath;this.localVideoPath=this.toPlayableLocalPath(a),this.isVideoReady=!0,this.isVideoDownloading=!1,this.$nextTick((()=>{this.videoContext||(this.videoContext=uni.createVideoContext("videoPlayer",this)),setTimeout((()=>{this.videoContext&&(this.userPaused||this.videoEnded||this.videoHasStarted||this.videoContext.play&&this.videoContext.play())}),80)})),uni.saveFile({tempFilePath:a,success:e=>{const t=e.savedFilePath;uni.setStorageSync(this.cacheKey,t);const a=uni.getStorageSync("video_cache_info")||{};a[this.cacheKey]={path:t,url:this.videoUrl,time:Date.now()},uni.setStorageSync("video_cache_info",a)},fail:()=>{}})},fail:e=>{t("error","at pages/video-player/video-player.vue:424","[VideoPlayer] App临时下载失败:",e),this.isVideoDownloading=!1,this.isVideoReady=!0,this.localVideoPath=this.videoUrl}})},downloadAndCacheVideo(){t("log","at pages/video-player/video-player.vue:434","[VideoPlayer] 开始下载视频:",this.videoUrl),this.isVideoDownloading=!0,uni.downloadFile({url:this.videoUrl,success:e=>{200===e.statusCode?(t("log","at pages/video-player/video-player.vue:441","[VideoPlayer] 视频下载成功,保存到本地存储"),uni.saveFile({tempFilePath:e.tempFilePath,success:e=>{const a=e.savedFilePath;t("log","at pages/video-player/video-player.vue:447","[VideoPlayer] 视频已保存:",a),uni.setStorageSync(this.cacheKey,a);const o=uni.getStorageSync("video_cache_info")||{};o[this.cacheKey]={path:a,url:this.videoUrl,time:Date.now()},uni.setStorageSync("video_cache_info",o),this.videoHasStarted?t("log","at pages/video-player/video-player.vue:464","[VideoPlayer] 下载完成,已在播放中,不切换src(下次生效)"):(t("log","at pages/video-player/video-player.vue:461","[VideoPlayer] 下载完成,使用本地文件播放"),this.localVideoPath=this.toPlayableLocalPath(a)),this.isVideoReady=!0,this.isVideoDownloading=!1},fail:e=>{const a=e&&e.errMsg?String(e.errMsg):"";a.includes("exceeded")&&a.includes("storage")?this.hasShownStorageLimitToast=!0:t("error","at pages/video-player/video-player.vue:477","[VideoPlayer] 保存视频失败:",e),this.isVideoReady=!0,this.isVideoDownloading=!1}})):(t("error","at pages/video-player/video-player.vue:484","[VideoPlayer] 视频下载失败,状态码:",e.statusCode),this.isVideoDownloading=!1,this.localVideoPath||(this.localVideoPath=this.videoUrl),this.isVideoReady=!0)},fail:e=>{t("error","at pages/video-player/video-player.vue:494","[VideoPlayer] 视频下载失败:",e),this.localVideoPath||(this.localVideoPath=this.videoUrl),this.isVideoReady=!0,this.isVideoDownloading=!1,uni.showToast({title:"下载失败,使用在线播放",icon:"none"})}})},initAudio(){if(!this.audioUrl)return;this.audioContext=uni.createInnerAudioContext(),this.audioContext.src=this.audioUrl,this.audioContext.autoplay=!1,this.audioReady=!1,this.audioEnded=!1,this.pausedBySilence=!1,this.lastAudioTime=0,this.lastAudioTimeUpdateAt=0,this.silenceSegments=[],this.silenceLoaded=!1,this.audioCacheKey=this.generateAudioCacheKey(this.audioUrl);const e=uni.getStorageSync(this.audioCacheKey);e&&uni.getSavedFileInfo({filePath:e,success:()=>{t("log","at pages/video-player/video-player.vue:530","[VideoPlayer] 找到缓存音频:",e),this.audioContext&&(this.audioContext.src=e)},fail:()=>{uni.removeStorageSync(this.audioCacheKey)}}),e||uni.downloadFile({url:this.audioUrl,timeout:6e4,success:e=>{200===e.statusCode&&this.audioContext&&uni.saveFile({tempFilePath:e.tempFilePath,success:e=>{const a=e.savedFilePath;t("log","at pages/video-player/video-player.vue:551","[VideoPlayer] 音频已缓存:",a),uni.setStorageSync(this.audioCacheKey,a),this.audioContext&&(this.audioContext.src=a)},fail:()=>{t("log","at pages/video-player/video-player.vue:558","[VideoPlayer] 音频缓存失败,使用临时文件播放"),this.audioContext.src=e.tempFilePath}})},fail:e=>{t("error","at pages/video-player/video-player.vue:565","[VideoPlayer] 音频下载失败,回退到URL直连:",e)}}),this.enableSilencePause&&this.fetchSilenceSegments(),this.audioContext.onCanplay((()=>{this.audioReady=!0;const e=Number(this.audioContext.duration);if(!Number.isNaN(e)&&e>0&&(this.audioDuration=e),t("log","at pages/video-player/video-player.vue:580","[VideoPlayer] 音频时长:",this.audioDuration,"秒"),!this.audioStarted&&!this.audioEnded&&this.videoHasStarted&&this.lastVideoTime>=this.audioStartDelaySec){const e=Math.max(0,(this.lastVideoTime||0)-(this.audioStartDelaySec||0));return t("log","at pages/video-player/video-player.vue:584","[VideoPlayer] 音频已就绪且视频已到达延迟点,开始播放音频,seek=",e),void this.startAudioFromVideoTime(e)}})),setTimeout((()=>{if(this.audioContext){const e=Number(this.audioContext.duration);!Number.isNaN(e)&&e>0&&(this.audioDuration=e),t("log","at pages/video-player/video-player.vue:597","[VideoPlayer] 音频时长(延迟校准):",this.audioDuration,"秒")}}),200),this.audioContext.onPlay((()=>{t("log","at pages/video-player/video-player.vue:602","[VideoPlayer] 音频开始播放"),this.isAudioPlaying=!0})),this.audioContext.onTimeUpdate&&this.audioContext.onTimeUpdate((()=>{if(!this.audioContext)return;const e=Number(this.audioContext.currentTime)||0;this.lastAudioTime=e,this.lastAudioTimeUpdateAt=Date.now(),this.enableSilencePause&&this.handleAudioTimeUpdate(e)})),this.audioContext.onPause((()=>{t("log","at pages/video-player/video-player.vue:619","[VideoPlayer] 音频被暂停,当前位置:",this.audioContext.currentTime,"秒"),this.isAudioPlaying=!1})),this.audioContext.onStop((()=>{t("log","at pages/video-player/video-player.vue:624","[VideoPlayer] 音频被停止"),this.isAudioPlaying=!1})),this.audioContext.onWaiting((()=>{t("log","at pages/video-player/video-player.vue:629","[VideoPlayer] 音频加载中...")})),this.audioContext.onError((e=>{t("error","at pages/video-player/video-player.vue:633","[VideoPlayer] 音频播放失败:",e)})),this.audioContext.onEnded((()=>{t("log","at pages/video-player/video-player.vue:637","[VideoPlayer] 音频播放结束,总时长:",this.audioContext.duration,"秒,播放到:",this.audioContext.currentTime,"秒"),this.isAudioPlaying=!1,this.audioEnded=!0,this.pausedBySilence=!1,this.videoEndedWaitingAudio=!1,this.stopVideoLoop();const e=Number(this.audioContext.currentTime)||0,a=Math.max(e,Number(this.lastAudioTime)||0),o=Number(this.audioDuration)||Number(this.audioContext.duration)||0,i=o>0&&(a>=o-.6||a/o>=.95),s=this.videoDuration&&this.lastVideoTime>=this.videoDuration-.3;this.videoContext&&(i||s)?(t("log","at pages/video-player/video-player.vue:658","[VideoPlayer] 音频结束,联动停止视频。audioEndedForSure=",i,"videoNearEnd=",s),this.videoWaiting=!1,this.userPaused=!0,this.pausedByAudioEnd=!0,this.stopPlaybackWatchdog(),this.videoContext.pause(),setTimeout((()=>{this.videoContext&&this.audioEnded&&this.pausedByAudioEnd&&this.videoContext.pause&&this.videoContext.pause()}),180),this.isVideoPlaying=!1):t("log","at pages/video-player/video-player.vue:674","[VideoPlayer] 音频 onEnded 触发但无法确认已到结尾,跳过联动停止视频。audioDur=",o,"audioCur=",e,"lastAudioTime=",this.lastAudioTime)}))},fetchSilenceSegments(){if(!this.audioUrl)return;const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";a&&uni.request({url:`${this.API_BASE}/api/video/silence-detect`,method:"POST",timeout:12e4,header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:"","Content-Type":"application/json"},data:{audioUrl:this.audioUrl},success:e=>{var a,o,i,s,l;if(!(200===e.statusCode&&(!0===(null==(a=e.data)?void 0:a.success)||"true"===(null==(o=e.data)?void 0:o.success)||1===(null==(i=e.data)?void 0:i.success)||"1"===(null==(s=e.data)?void 0:s.success))))return void t("warn","at pages/video-player/video-player.vue:706","[VideoPlayer] 静音检测失败:",e.data);const n=Array.isArray(null==(l=e.data)?void 0:l.segments)?e.data.segments:[];this.silenceSegments=n.map((e=>({start:Number(e.start)||0,end:Number(e.end)||0}))).filter((e=>e.end>e.start)).sort(((e,t)=>e.start-t.start)),this.silenceLoaded=!0,t("log","at pages/video-player/video-player.vue:718","[VideoPlayer] 静音区间数量:",this.silenceSegments.length)},fail:e=>{t("error","at pages/video-player/video-player.vue:721","[VideoPlayer] 静音检测请求失败:",e)}})},handleAudioTimeUpdate(e){if(!this.videoContext||!this.hasAudio)return;if(!this.enableSilencePause)return;if(!this.silenceLoaded||0===this.silenceSegments.length)return;if(this.audioEnded)return;let a=!1;for(const t of this.silenceSegments){if(e>=t.start&&e{this.videoContext&&(this.userPaused||this.videoEnded||this.pausedBySilence||this.audioEnded||(t("log","at pages/video-player/video-player.vue:919","[VideoPlayer] waiting后尝试恢复视频播放"),this.videoContext.play()))}),600))},onVideoEnded(){if(t("log","at pages/video-player/video-player.vue:925","[VideoPlayer] 视频播放结束","lastVideoTime=",this.lastVideoTime,"videoDuration=",this.videoDuration,"audioEnded=",this.audioEnded),this.isVideoPlaying=!1,this.videoEnded=!0,this.stopPlaybackWatchdog(),this.audioInVideo){this.videoWaiting=!1,this.userPaused=!0,this.pausedByAudioEnd=!0,this.audioEnded=!0,this.stopPlaybackWatchdog(),this.stopVideoLoop();try{this.videoContext&&this.videoContext.seek&&this.videoDuration&&this.videoContext.seek(Math.max(0,Number(this.videoDuration)-.05))}catch(i){}return void(this.videoContext&&this.videoContext.pause&&this.videoContext.pause())}if(this.hasAudio&&this.audioContext&&!this.audioEnded){this.videoEndedWaitingAudio=!0,this.videoWaiting=!1,t("log","at pages/video-player/video-player.vue:954","[VideoPlayer] 音频未结束:视频停在末帧等待音频播完(不循环不重播)");try{this.videoContext&&this.videoContext.seek&&this.videoDuration&&this.videoContext.seek(Math.max(0,Number(this.videoDuration)-.05))}catch(i){}return void(this.videoContext&&this.videoContext.pause&&this.videoContext.pause())}if(this.hasAudio&&this.audioContext&&!this.audioEnded){const e=Number(this.audioContext.currentTime)||0,a=Math.max(e,Number(this.lastAudioTime)||0),o=Number(this.audioDuration)||Number(this.audioContext.duration)||0;if(o>0&&(a>=o-.6||a/o>=.95))return t("log","at pages/video-player/video-player.vue:975","[VideoPlayer] 检测到音频已到结尾(兜底推断),停止视频循环并暂停视频。audioCurStable=",a,"audioDur=",o),this.audioEnded=!0,this.stopVideoLoop(),void(this.videoContext&&this.videoContext.pause&&this.videoContext.pause())}const e=Number(this.videoDuration)||0,a=Number(this.lastVideoTime)||0,o=!e&&a>0&&a<3||e>0&&a>0&&a{this.videoContext&&this.videoContext.play&&this.videoContext.play()}),120)}))}},onTimeUpdate(e){if(!e||!e.detail)return;const a=e.detail.currentTime;if(this.lastVideoTime=a,this.lastVideoTimeUpdateAt=Date.now(),this.hasAudio&&this.audioContext&&!this.audioStarted&&!this.audioEnded&&a>=this.audioStartDelaySec){if(this.audioReady){const e=Math.max(0,(a||0)-(this.audioStartDelaySec||0));return t("log","at pages/video-player/video-player.vue:1029","[VideoPlayer] 视频到达延迟点,开始播放音频,seek=",e),void this.startAudioFromVideoTime(e)}this.pendingAudioStart=!0}},startVideoLoop(){this.videoLoopTimer||t("log","at pages/video-player/video-player.vue:1044","[VideoPlayer] 视频循环已启动")},stopVideoLoop(){this.videoLoopTimer&&(clearInterval(this.videoLoopTimer),this.videoLoopTimer=null,t("log","at pages/video-player/video-player.vue:1052","[VideoPlayer] 视频循环已停止"))}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"player-container"},[e.createElementVNode("view",{class:"header"},[e.createElementVNode("view",{class:"back-btn",onClick:a[0]||(a[0]=(...e)=>l.goBack&&l.goBack(...e))},"← 返回"),e.createElementVNode("text",{class:"title"},e.toDisplayString(s.videoTitle),1),e.createElementVNode("view",{class:"placeholder"})]),s.isVideoReady?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("view",{key:0,class:"loading-overlay"},[e.createElementVNode("view",{class:"loading-content"},[e.createElementVNode("view",{class:"loading-spinner"}),e.createElementVNode("text",{class:"loading-text"},"视频加载中..."),e.createElementVNode("text",{class:"loading-hint"},"首次加载可能需要几秒钟")])])),s.localVideoPath?(e.openBlock(),e.createElementBlock("video",{key:1,id:"videoPlayer",src:s.localVideoPath,class:"video-player",controls:!1,muted:!!s.audioUrl,"show-center-play-btn":!1,"enable-play-gesture":!0,"object-fit":"contain","show-fullscreen-btn":!1,"show-play-btn":!1,"show-progress":!1,"enable-progress-gesture":!1,"enable-auto-rotation":!1,"show-mute-btn":!1,"show-loading":!1,onError:a[1]||(a[1]=(...e)=>l.onVideoError&&l.onVideoError(...e)),onPlay:a[2]||(a[2]=(...e)=>l.onVideoPlay&&l.onVideoPlay(...e)),onPause:a[3]||(a[3]=(...e)=>l.onVideoPause&&l.onVideoPause(...e)),onWaiting:a[4]||(a[4]=(...e)=>l.onVideoWaiting&&l.onVideoWaiting(...e)),onEnded:a[5]||(a[5]=(...e)=>l.onVideoEnded&&l.onVideoEnded(...e)),onTimeupdate:a[6]||(a[6]=(...e)=>l.onTimeUpdate&&l.onTimeUpdate(...e)),onLoadedmetadata:a[7]||(a[7]=(...e)=>l.onVideoLoadedMetadata&&l.onVideoLoadedMetadata(...e))},null,40,["src","muted"])):e.createCommentVNode("",!0),s.localVideoPath?(e.openBlock(),e.createElementBlock("view",{key:2,class:"play-overlay",onClick:a[8]||(a[8]=(...e)=>l.handleTogglePlay&&l.handleTogglePlay(...e))},[l.shouldShowPlayButton?(e.openBlock(),e.createElementBlock("view",{key:0,class:"play-button"})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])}],["__scopeId","data-v-f5752058"]]);const B=d({data:()=>({API_BASE:i,idleVideoUrl:"",talkingVideoUrl:"",currentVideoUrl:"",isVideoLoading:!0,videoContext:null,hasPlayedInitial:!1,callerName:"对方",voiceId:"",selectedDialect:"",selectedLanguageHint:"",selectedLanguageHintLabel:"",languageHintOptions:["中文(zh)","英文(en)","法语(fr)","德语(de)","日语(ja)","韩语(ko)","俄语(ru)"],dialectOptions:["广东话","东北话","甘肃话","贵州话","河南话","湖北话","江西话","闽南话","宁夏话","山西话","陕西话","山东话","上海话","四川话","天津话","云南话"],callDuration:"00:00",callStartTime:null,durationTimer:null,isIdle:!0,isSpeaking:!1,isRecording:!1,isProcessing:!1,processingText:"处理中...",messages:[],systemPrompt:"你是一位温暖的对话者,用亲切的语气与对方交流。",recorderManager:null,audioFilePath:"",audioContext:null,vadEnabled:!0,vadVoiceThreshold:.004,vadSilenceMs:2500,vadMaxDurationMs:6e4,vadSpeaking:!1,vadSilenceStart:null,vadMaxTimer:null,recordingStartTime:null,vadLastSoundTime:null,vadLastFrameTime:null,vadWatchTimer:null,autoListen:!0,autoLoopTimer:null,scrollTop:0}),onLoad(e){t("log","at pages/video-call/video-call.vue:171","[VideoCall] 页面参数:",e),this.idleVideoUrl=decodeURIComponent(e.idleVideo||""),this.talkingVideoUrl=decodeURIComponent(e.talkingVideo||this.idleVideoUrl),this.voiceId=e.voiceId||"",this.callerName=decodeURIComponent(e.callerName||"对方"),t("log","at pages/video-call/video-call.vue:179","[VideoCall] 待机视频URL:",this.idleVideoUrl),t("log","at pages/video-call/video-call.vue:180","[VideoCall] 说话视频URL:",this.talkingVideoUrl),t("log","at pages/video-call/video-call.vue:181","[VideoCall] 音色ID:",this.voiceId),this.downloadAndConvertVideo(),this.startCallTimer(),this.initRecorder(),this.initAudioContext(),this.initVideoContext(),this.startAutoLoop()},onUnload(){this.durationTimer&&clearInterval(this.durationTimer),this.vadMaxTimer&&(clearTimeout(this.vadMaxTimer),this.vadMaxTimer=null),this.vadWatchTimer&&(clearInterval(this.vadWatchTimer),this.vadWatchTimer=null),this.autoLoopTimer&&(clearInterval(this.autoLoopTimer),this.autoLoopTimer=null),this.audioContext&&this.audioContext.destroy()},methods:{async downloadAndConvertVideo(){if(!this.idleVideoUrl)return void uni.showToast({title:"视频URL无效",icon:"none"});t("log","at pages/video-call/video-call.vue:227","[VideoCall] ========== 视频加载 =========="),t("log","at pages/video-call/video-call.vue:228","[VideoCall] 原始URL:",this.idleVideoUrl);const e=new URL(i).hostname,a=this.idleVideoUrl.includes("/static/videos/")||this.idleVideoUrl.includes(e);return this.idleVideoUrl.includes("grsai.com")||this.idleVideoUrl.includes("file49")?(t("log","at pages/video-call/video-call.vue:242","[VideoCall] 检测到外部视频链接,直接使用URL播放"),this.currentVideoUrl=this.idleVideoUrl,this.talkingVideoUrl=this.idleVideoUrl,void t("log","at pages/video-call/video-call.vue:245","[VideoCall] ========== 视频准备完成 ==========")):a?(t("log","at pages/video-call/video-call.vue:250","[VideoCall] 检测到本地服务器视频,直接使用URL播放"),this.currentVideoUrl=this.idleVideoUrl,this.talkingVideoUrl=this.idleVideoUrl,void t("log","at pages/video-call/video-call.vue:253","[VideoCall] ========== 视频准备完成 ==========")):(t("log","at pages/video-call/video-call.vue:258","[VideoCall] 本地服务器视频,开始下载..."),uni.showLoading({title:"视频加载中...",mask:!0}),void uni.downloadFile({url:this.idleVideoUrl,success:e=>{if(t("log","at pages/video-call/video-call.vue:268","[VideoCall] 下载响应状态码:",e.statusCode),200===e.statusCode)if(t("log","at pages/video-call/video-call.vue:271","[VideoCall] ✅ 视频下载成功"),t("log","at pages/video-call/video-call.vue:272","[VideoCall] 临时路径:",e.tempFilePath),"undefined"!=typeof plus&&plus.io)try{t("log","at pages/video-call/video-call.vue:278","[VideoCall] 开始转换路径...");const a=plus.io.convertLocalFileSystemURL(e.tempFilePath);t("log","at pages/video-call/video-call.vue:280","[VideoCall] ✅ 路径转换成功"),t("log","at pages/video-call/video-call.vue:281","[VideoCall] 转换后路径:",a),this.currentVideoUrl=a,this.idleVideoUrl=a,this.talkingVideoUrl=a,uni.hideLoading(),t("log","at pages/video-call/video-call.vue:288","[VideoCall] ========== 视频准备完成 ==========")}catch(a){t("error","at pages/video-call/video-call.vue:290","[VideoCall] ❌ 路径转换失败:",a),t("log","at pages/video-call/video-call.vue:291","[VideoCall] 使用临时路径作为备选方案"),this.currentVideoUrl=e.tempFilePath,this.idleVideoUrl=e.tempFilePath,this.talkingVideoUrl=e.tempFilePath,uni.hideLoading()}else t("log","at pages/video-call/video-call.vue:300","[VideoCall] plus.io 不可用,使用临时路径"),this.currentVideoUrl=e.tempFilePath,this.idleVideoUrl=e.tempFilePath,this.talkingVideoUrl=e.tempFilePath,uni.hideLoading();else t("error","at pages/video-call/video-call.vue:317","[VideoCall] ❌ 视频下载失败,状态码:",e.statusCode),this.handleDownloadError()},fail:e=>{t("error","at pages/video-call/video-call.vue:322","[VideoCall] ❌ 视频下载失败:",e),t("error","at pages/video-call/video-call.vue:323","[VideoCall] 错误详情:",JSON.stringify(e)),this.handleDownloadError()}}))},handleDownloadError(){uni.hideLoading(),t("log","at pages/video-call/video-call.vue:333","[VideoCall] 下载失败,直接使用原URL播放"),this.currentVideoUrl=this.idleVideoUrl,uni.showToast({title:"将直接播放网络视频",icon:"none",duration:2e3})},initRecorder(){this.recorderManager=uni.getRecorderManager(),this.recorderManager.onStart((()=>{t("log","at pages/video-call/video-call.vue:348","[VideoCall] 开始录音")})),this.recorderManager.onStop((e=>{t("log","at pages/video-call/video-call.vue:352","[VideoCall] 录音完成:",e.tempFilePath),this.resetVADState();if((e.duration||Date.now()-(this.recordingStartTime||Date.now()))<400)return t("warn","at pages/video-call/video-call.vue:357","[VideoCall] 录音过短,忽略本次"),void(this.isProcessing=!1);this.audioFilePath=e.tempFilePath,this.processConversation()})),this.recorderManager.onFrameRecorded&&this.recorderManager.onFrameRecorded((e=>{this.vadEnabled&&!this.isProcessing&&this.handleVADFrame(e.frameBuffer)})),this.recorderManager.onError((e=>{t("error","at pages/video-call/video-call.vue:373","[VideoCall] 录音失败:",e),t("error","at pages/video-call/video-call.vue:374","[VideoCall] 错误详情:",JSON.stringify(e)),this.isRecording=!1,this.resetVADState();let a="录音失败";e.errMsg&&(a=e.errMsg.includes("permission")?"录音权限被拒绝,请在设置中允许录音权限":e.errMsg.includes("busy")?"录音设备忙,请稍后再试":`录音失败: ${e.errMsg}`),uni.showModal({title:"录音失败",content:a+"\n\n请检查:\n1. 是否授予录音权限\n2. 麦克风是否被其他应用占用\n3. 设备是否支持录音",showCancel:!1,confirmText:"知道了"})}))},initVideoContext(){this.$nextTick((()=>{this.videoContext=uni.createVideoContext("videoPlayer",this),t("log","at pages/video-call/video-call.vue:402","[VideoCall] 视频控制器初始化完成")}))},initAudioContext(){this.audioContext=uni.createInnerAudioContext(),this.audioContext.onPlay((()=>{t("log","at pages/video-call/video-call.vue:411","[VideoCall] 开始播放AI回复")})),this.audioContext.onEnded((()=>{t("log","at pages/video-call/video-call.vue:415","[VideoCall] AI回复播放完成"),this.isSpeaking=!1,this.isIdle=!0})),this.audioContext.onError((e=>{t("error","at pages/video-call/video-call.vue:422","[VideoCall] 音频播放失败:",e),this.isSpeaking=!1,this.isIdle=!0}))},startCallTimer(){this.callStartTime=Date.now(),this.durationTimer=setInterval((()=>{const e=Math.floor((Date.now()-this.callStartTime)/1e3),t=Math.floor(e/60).toString().padStart(2,"0"),a=(e%60).toString().padStart(2,"0");this.callDuration=`${t}:${a}`}),1e3)},startTalking(){this.isProcessing||(this.resetVADState(),this.recordingStartTime=Date.now(),this.vadLastSoundTime=this.recordingStartTime,this.vadLastFrameTime=this.recordingStartTime,this.isRecording=!0,this.vadMaxTimer=setTimeout((()=>{this.stopTalkingFromVAD("max_duration")}),this.vadMaxDurationMs),this.vadWatchTimer=setInterval((()=>{if(!this.isRecording)return;const e=Date.now(),t=e-(this.recordingStartTime||e);e-(this.vadLastFrameTime||e)>12e3?this.stopTalkingFromVAD("no_frame"):t>1500&&this.vadSpeaking&&e-(this.vadLastSoundTime||e)>this.vadSilenceMs&&this.stopTalkingFromVAD("silence")}),300),this.recorderManager.start({format:"mp3",sampleRate:16e3,numberOfChannels:1,encodeBitRate:48e3,frameSize:32}),uni.showToast({title:"正在聆听(自动识别说话)",icon:"none",duration:1e4}))},stopTalking(){this.stopTalkingFromVAD("manual")},stopTalkingFromVAD(e="vad"){this.isRecording=!1,this.recorderManager.stop(),this.isProcessing=!0,this.processingText="识别中...",this.resetVADState(),t("log","at pages/video-call/video-call.vue:499","[VideoCall] 停止录音,原因:",e)},resetVADState(){this.vadSpeaking=!1,this.vadSilenceStart=null,this.vadLastSoundTime=null,this.vadLastFrameTime=null,this.vadMaxTimer&&(clearTimeout(this.vadMaxTimer),this.vadMaxTimer=null),this.vadWatchTimer&&(clearInterval(this.vadWatchTimer),this.vadWatchTimer=null)},onDialectChange(e){this.selectedDialect=this.dialectOptions[e.detail.value]||""},onLanguageHintChange(e){const t=this.languageHintOptions[e.detail.value]||"";this.selectedLanguageHintLabel=t;const a=t.match(/\(([^)]+)\)/);this.selectedLanguageHint=a&&a[1]?a[1]:""},handleVADFrame(e){if(!e||0===e.byteLength)return;this.vadLastFrameTime=Date.now();if(this.calculateRms(e)>this.vadVoiceThreshold)return this.vadSpeaking=!0,this.vadSilenceStart=null,void(this.vadLastSoundTime=Date.now());this.vadSpeaking&&(this.vadSilenceStart?Date.now()-this.vadSilenceStart>this.vadSilenceMs&&this.stopTalkingFromVAD("silence"):this.vadSilenceStart=Date.now())},calculateRms(e){const t=new DataView(e),a=t.byteLength/2;if(0===a)return 0;let o=0;for(let i=0;i{this.autoListen&&(this.isRecording||this.isProcessing||this.startTalking())}),2e3))},async processConversation(){try{this.processingText="正在识别...",t("log","at pages/video-call/video-call.vue:585","[VideoCall] 开始对话请求"),t("log","at pages/video-call/video-call.vue:586","[VideoCall] 音频文件:",this.audioFilePath),t("log","at pages/video-call/video-call.vue:587","[VideoCall] 音色ID:",this.voiceId);const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";uni.uploadFile({url:`${this.API_BASE}/api/conversation/talk`,filePath:this.audioFilePath,name:"audio",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},formData:(()=>{const e=this.voiceId||"",t=(()=>{const t=(e||"").trim();if(!t)return"CLONE";return["Cherry","Kai","Mochi","Bunny","Jada","Dylan","Li","Marcus","Roy","Peter","Sunny","Eric","Rocky","Kiki"].includes(t)||t.startsWith("BV")||t.endsWith("_streaming")||t.endsWith("_offline")||t.endsWith("_bigtts")?"OFFICIAL":"CLONE"})(),a={voiceId:e,voiceType:t};return this.voiceId&&this.voiceId.startsWith("cosyvoice-v3-plus-")&&this.selectedDialect&&(a.dialect=this.selectedDialect),this.voiceId&&this.voiceId.startsWith("cosyvoice-v3-plus-")&&this.selectedLanguageHint&&(a.languageHints=this.selectedLanguageHint),a})(),success:e=>{t("log","at pages/video-call/video-call.vue:621","[VideoCall] 对话响应状态码:",e.statusCode),t("log","at pages/video-call/video-call.vue:622","[VideoCall] 对话响应数据:",e.data);try{const a="string"==typeof e.data?JSON.parse(e.data):e.data;a.success?(t("log","at pages/video-call/video-call.vue:628","[VideoCall] 对话成功"),t("log","at pages/video-call/video-call.vue:629","[VideoCall] 识别文本:",a.recognizedText),t("log","at pages/video-call/video-call.vue:630","[VideoCall] AI回复:",a.aiResponse),t("log","at pages/video-call/video-call.vue:631","[VideoCall] 音频文件:",a.audioFile),this.addMessage("user",a.recognizedText),this.addMessage("ai",a.aiResponse),this.playAIResponse(a.audioFile)):(t("error","at pages/video-call/video-call.vue:642","[VideoCall] 对话失败:",a.message),uni.showToast({title:a.message||"对话失败",icon:"none"}),this.isProcessing=!1)}catch(a){t("error","at pages/video-call/video-call.vue:650","[VideoCall] JSON解析失败:",a),t("error","at pages/video-call/video-call.vue:651","[VideoCall] 原始响应:",e.data),uni.showToast({title:"服务器响应格式错误",icon:"none"}),this.isProcessing=!1}},fail:e=>{t("error","at pages/video-call/video-call.vue:660","[VideoCall] 对话失败:",e),uni.showToast({title:"对话失败",icon:"none"}),this.isProcessing=!1}})}catch(e){t("error","at pages/video-call/video-call.vue:669","[VideoCall] 对话失败:",e),uni.showToast({title:"对话失败: "+e.message,icon:"none"}),this.isProcessing=!1}},playAIResponse(e){this.processingText="正在回复...",this.isIdle=!1,this.isSpeaking=!0,this.audioContext.src=`${this.API_BASE}/api/conversation/audio/${e}`,this.audioContext.play(),this.isProcessing=!1},addMessage(e,t){const a=new Date,o=`${a.getHours()}:${a.getMinutes().toString().padStart(2,"0")}`;this.messages.push({role:e,content:t,time:o}),this.$nextTick((()=>{this.scrollTop=999999}))},onVideoPlay(){t("log","at pages/video-call/video-call.vue:715","[VideoCall] 视频开始播放"),this.isVideoLoading=!1},onVideoPause(){t("log","at pages/video-call/video-call.vue:721","[VideoCall] 视频暂停")},onVideoEnded(){t("log","at pages/video-call/video-call.vue:726","[VideoCall] 视频播放结束"),!this.isIdle&&this.isSpeaking&&t("log","at pages/video-call/video-call.vue:729","[VideoCall] 视频循环播放")},onVideoLoaded(e){t("log","at pages/video-call/video-call.vue:735","[VideoCall] 视频元数据加载成功:",e),this.isVideoLoading=!1},onVideoCanPlay(){t("log","at pages/video-call/video-call.vue:741","[VideoCall] 视频可以播放"),this.isVideoLoading=!1},onVideoWaiting(){t("log","at pages/video-call/video-call.vue:747","[VideoCall] 视频缓冲中..."),this.isVideoLoading=!0},onVideoTimeUpdate(e){!this.hasPlayedInitial&&e.detail&&e.detail.currentTime>=1&&(t("log","at pages/video-call/video-call.vue:754","[VideoCall] 视频已播放1秒,暂停等待AI回复"),this.hasPlayedInitial=!0,this.videoContext&&this.videoContext.pause())},onVideoError(e){t("error","at pages/video-call/video-call.vue:764","[VideoCall] 视频加载失败:",e),t("error","at pages/video-call/video-call.vue:765","[VideoCall] 视频URL:",this.currentVideoUrl),t("error","at pages/video-call/video-call.vue:766","[VideoCall] 错误详情:",JSON.stringify(e)),this.isVideoLoading=!1;const a=e.detail&&e.detail.errMsg?e.detail.errMsg:"未知错误",o=e.detail&&e.detail.errCode?e.detail.errCode:"N/A";uni.showModal({title:"视频加载失败",content:`错误代码: ${o}\n错误信息: ${a}\n\n视频URL:\n${this.currentVideoUrl}\n\n请检查:\n1. URL是否有效\n2. 网络连接\n3. 视频格式是否支持\n4. HTTP权限配置`,showCancel:!1,confirmText:"知道了"})},hangUp(){uni.showModal({title:"结束通话",content:"确定要结束通话吗?",success:e=>{e.confirm&&(this.isRecording&&this.recorderManager.stop(),this.audioContext&&this.audioContext.stop(),uni.navigateBack())}})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"video-call-container"},[e.createElementVNode("view",{class:"header"},[e.createElementVNode("text",{class:"caller-name"},"📹 与"+e.toDisplayString(s.callerName)+"视频通话",1),e.createElementVNode("text",{class:"call-duration"},e.toDisplayString(s.callDuration),1)]),e.createElementVNode("view",{class:"video-section"},[s.currentVideoUrl?(e.openBlock(),e.createElementBlock("video",{key:0,src:s.currentVideoUrl,loop:!1,autoplay:!0,id:"videoPlayer","show-center-play-btn":!1,"show-play-btn":!1,controls:!1,"enable-progress-gesture":!1,"show-progress":!1,"show-fullscreen-btn":!1,"show-loading":!0,"object-fit":"contain",poster:"",class:"video-player",onPlay:a[0]||(a[0]=(...e)=>l.onVideoPlay&&l.onVideoPlay(...e)),onPause:a[1]||(a[1]=(...e)=>l.onVideoPause&&l.onVideoPause(...e)),onEnded:a[2]||(a[2]=(...e)=>l.onVideoEnded&&l.onVideoEnded(...e)),onError:a[3]||(a[3]=(...e)=>l.onVideoError&&l.onVideoError(...e)),onLoadedmetadata:a[4]||(a[4]=(...e)=>l.onVideoLoaded&&l.onVideoLoaded(...e)),onWaiting:a[5]||(a[5]=(...e)=>l.onVideoWaiting&&l.onVideoWaiting(...e)),onCanplay:a[6]||(a[6]=(...e)=>l.onVideoCanPlay&&l.onVideoCanPlay(...e)),onTimeupdate:a[7]||(a[7]=(...e)=>l.onVideoTimeUpdate&&l.onVideoTimeUpdate(...e))},null,40,["src"])):e.createCommentVNode("",!0),s.isVideoLoading?(e.openBlock(),e.createElementBlock("view",{key:1,class:"video-loading"},[e.createElementVNode("text",null,"📹 视频加载中...")])):e.createCommentVNode("",!0),s.isSpeaking?(e.openBlock(),e.createElementBlock("view",{key:2,class:"speaking-indicator"},[e.createElementVNode("text",{class:"pulse"},"🔊 正在说话...")])):e.createCommentVNode("",!0)]),e.createElementVNode("scroll-view",{"scroll-y":"",class:"chat-history","scroll-top":s.scrollTop,"scroll-with-animation":""},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.messages,((t,a)=>(e.openBlock(),e.createElementBlock("view",{key:a,class:e.normalizeClass(["message","user"===t.role?"user-message":"ai-message"])},[e.createElementVNode("view",{class:"message-avatar"},e.toDisplayString("user"===t.role?"👤":"🤖"),1),e.createElementVNode("view",{class:"message-content"},[e.createElementVNode("text",{class:"message-text"},e.toDisplayString(t.content),1),e.createElementVNode("text",{class:"message-time"},e.toDisplayString(t.time),1)])],2)))),128)),0===s.messages.length?(e.openBlock(),e.createElementBlock("view",{key:0,class:"empty-hint"},[e.createElementVNode("text",null,"👋 开始对话吧")])):e.createCommentVNode("",!0)],8,["scroll-top"]),e.createElementVNode("view",{class:"controls"},[s.voiceId&&s.voiceId.startsWith("cosyvoice-v3-plus-")?(e.openBlock(),e.createElementBlock("view",{key:0,class:"form-section"},[e.createElementVNode("view",{class:"form-label"},"方言"),e.createElementVNode("picker",{mode:"selector",range:s.dialectOptions,onChange:a[8]||(a[8]=(...e)=>l.onDialectChange&&l.onDialectChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.selectedDialect||"请选择方言(可选)"),1)],40,["range"])])):e.createCommentVNode("",!0),s.voiceId&&s.voiceId.startsWith("cosyvoice-v3-plus-")?(e.openBlock(),e.createElementBlock("view",{key:1,class:"form-section"},[e.createElementVNode("view",{class:"form-label"},"语言提示(可选)"),e.createElementVNode("picker",{mode:"selector",range:s.languageHintOptions,onChange:a[9]||(a[9]=(...e)=>l.onLanguageHintChange&&l.onLanguageHintChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.selectedLanguageHintLabel||"请选择语言(可选)"),1)],40,["range"]),e.createElementVNode("view",{class:"hint-text"},"💡 仅处理第一个值;不设置不生效")])):e.createCommentVNode("",!0),e.createElementVNode("view",{class:"control-row"},[s.isRecording||s.isProcessing?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"talk-btn",onClick:a[10]||(a[10]=(...e)=>l.startTalking&&l.startTalking(...e))}," 🎤 开始说话 ")),s.isRecording?(e.openBlock(),e.createElementBlock("button",{key:1,class:"talk-btn recording",onClick:a[11]||(a[11]=(...e)=>l.stopTalking&&l.stopTalking(...e))}," ⏹️ 停止录音 ")):e.createCommentVNode("",!0),s.isProcessing?(e.openBlock(),e.createElementBlock("button",{key:2,class:"talk-btn processing",disabled:""}," ⏳ "+e.toDisplayString(s.processingText),1)):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"control-row"},[e.createElementVNode("button",{class:"hangup-btn",onClick:a[12]||(a[12]=(...e)=>l.hangUp&&l.hangUp(...e))}," 📞 挂断 ")])])])}],["__scopeId","data-v-dcdfee56"]]);const D=d({components:{PaymentModal:v},data:()=>({API_BASE:i,loadOptions:null,lastUserId:null,loading:!1,videos:[],selectedVideoId:"",selectedVideoName:"",selectedVideoUrl:"",selectedPhotoUrl:"",selectedVoiceId:"",selectedDialect:"",selectedLanguageHint:"",selectedLanguageHintLabel:"",languageHintOptions:["中文(zh)","英文(en)","法语(fr)","德语(de)","日语(ja)","韩语(ko)","俄语(ru)"],dialectOptions:["广东话","东北话","甘肃话","贵州话","河南话","湖北话","江西话","闽南话","宁夏话","山西话","陕西话","山东话","上海话","四川话","天津话","云南话"],isConnecting:!1,connectingText:"正在接通...",videoCache:{},downloadingVideos:{},localVideoUrl:"",cacheProgress:{},preCachingInProgress:!1,videoPreloadStatus:{},callStarted:!1,callStatus:"视频通话中",callDuration:"00:00",callStartTime:null,durationTimer:null,messages:[],recognizingText:"",scrollTop:0,isRecording:!1,isProcessing:!1,isSpeaking:!1,processingText:"正在聆听...",recorderManager:null,audioFilePath:"",recordingStartTime:null,autoListen:!1,autoLoopTimer:null,longPressTimer:null,isTouching:!1,stopFallbackTimer:null,stopFallbackRetries:0,stopFallbackActive:!1,vadEnabled:!0,vadVoiceThreshold:.004,vadSilenceMs:600,vadMaxDurationMs:15e3,vadSpeaking:!1,vadSilenceStart:null,vadMaxTimer:null,vadLastSoundTime:null,vadLastFrameTime:null,vadWatchTimer:null,audioContext:null,audioCacheKey:"",currentAudioSrc:"",pendingAudioUrl:"",audioTriedFallback:!1,audioSessionId:0,audioPlayedInSession:!1,audioPlayStartAt:0,audioTriedRedownload:!1,audioTriedRecreateContext:!1,audioPlayInvokedInSession:!1,audioPlayTargetSessionId:0,audioDiagnosedInSession:!1,videoContext:null,audioContextActivated:!1,videoInitialPlayed:!1,processingTimeout:null,showSettingsDialog:!1,dialogMemoryIdentity:"",dialogMemoryInfo:"",dialogMemoryCatchphrase:"",systemPrompt:"",paymentModalData:{show:!1,serviceType:"",serviceName:"",serviceDesc:"",price:0,orderNo:"",paymentTips:"点击确认支付后将开始视频通话"},_paymentResolve:null,_paymentReject:null,_paymentOnSuccess:null,_paymentOnFailed:null}),async onLoad(e){t("log","at pages/video-call-new/video-call-new.vue:442","[VideoCallNew] 页面加载",e),this.loadOptions=e;const a=uni.getStorageSync("userId");this.lastUserId=a,await this.loadVideoCache(),e&&e.videoId?(this.selectedVideoId=e.videoId,this.selectedVideoName=decodeURIComponent(e.videoName||"复活视频"),this.selectedVideoUrl=decodeURIComponent(e.videoUrl||""),this.selectedVoiceId=e.voiceId||"",this.selectedDialect="",t("log","at pages/video-call-new/video-call-new.vue:462","[VideoCallNew] 从URL参数加载视频信息"),t("log","at pages/video-call-new/video-call-new.vue:463","[VideoCallNew] 视频ID:",this.selectedVideoId),t("log","at pages/video-call-new/video-call-new.vue:464","[VideoCallNew] 视频名称:",this.selectedVideoName),t("log","at pages/video-call-new/video-call-new.vue:465","[VideoCallNew] 视频URL:",this.selectedVideoUrl),t("log","at pages/video-call-new/video-call-new.vue:466","[VideoCallNew] 音色ID:",this.selectedVoiceId),await this.checkAndLoadLocalVideo(this.selectedVideoId,this.selectedVideoUrl),this.initRecorder(),this.initAudioContext(),this.initVideoContext(),this.startAutoLoop(),setTimeout((()=>{this.startVideoCallDirect()}),300)):(this.loadVideos(),this.initRecorder(),this.initAudioContext(),this.initVideoContext(),this.startAutoLoop())},onShow(){t("log","at pages/video-call-new/video-call-new.vue:492","[VideoCallNew] 页面显示");const e=uni.getStorageSync("userId");e!==this.lastUserId&&(t("log","at pages/video-call-new/video-call-new.vue:499","[VideoCallNew] 检测到用户切换"),t("log","at pages/video-call-new/video-call-new.vue:500","[VideoCallNew] 上次用户ID:",this.lastUserId,"当前用户ID:",e),this.lastUserId=e),this.callStarted||this.loadOptions&&this.loadOptions.videoId||(t("log","at pages/video-call-new/video-call-new.vue:507","[VideoCallNew] 页面重新显示,刷新视频列表"),this.loadVideos())},onUnload(){this.cleanup()},methods:{isVideoUsableForCall(e){if(!e)return!1;const t=e.edited_video_url||e.videoUrl||e.local_video_path||e.video_url||e.localVideoPath,a=e.voice_id||e.voiceId;return!!t&&!!a},async loadVideos(){this.loading=!0;const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";await this.loadVideoCache(),uni.request({url:`${this.API_BASE}/api/photo-revival/videos`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:e=>{if(t("log","at pages/video-call-new/video-call-new.vue:543","[VideoCallNew] 视频列表响应:",e.data),200===e.statusCode){let a=[];Array.isArray(e.data)?a=e.data:e.data&&Array.isArray(e.data.data)?a=e.data.data:(e.data&&e.data.videos&&Array.isArray(e.data.videos)||e.data&&e.data.success&&Array.isArray(e.data.videos))&&(a=e.data.videos),this.videos=(a||[]).filter((e=>this.isVideoUsableForCall(e))),t("log","at pages/video-call-new/video-call-new.vue:559","[VideoCallNew] 加载视频列表成功:",this.videos.length)}},fail:e=>{t("error","at pages/video-call-new/video-call-new.vue:563","[VideoCallNew] 加载视频列表失败:",e),uni.showToast({title:"加载失败",icon:"none"})},complete:()=>{this.loading=!1}})},selectVideo(e){this.selectedVideoId=e.id,this.selectedVideoName=e.name||"复活视频",this.selectedVideoUrl=e.edited_video_url||e.videoUrl||e.local_video_path||e.video_url||e.localVideoPath,this.selectedPhotoUrl=e.photoUrl||e.photo_url||e.photoPath||"",this.selectedVoiceId=e.voice_id||e.voiceId,this.selectedDialect="",this.selectedLanguageHint="",this.selectedLanguageHintLabel="",t("log","at pages/video-call-new/video-call-new.vue:586","[VideoCallNew] 选择视频:",this.selectedVideoId),t("log","at pages/video-call-new/video-call-new.vue:587","[VideoCallNew] 视频URL:",this.selectedVideoUrl),t("log","at pages/video-call-new/video-call-new.vue:588","[VideoCallNew] 照片URL:",this.selectedPhotoUrl),t("log","at pages/video-call-new/video-call-new.vue:589","[VideoCallNew] 音色ID:",this.selectedVoiceId)},async startVideoCall(e){this.selectVideo(e),this.selectedVideoId&&this.selectedVoiceId?this.selectedVideoUrl?(t("log","at pages/video-call-new/video-call-new.vue:613","[VideoCallNew] 准备视频通话,视频ID:",this.selectedVideoId),t("log","at pages/video-call-new/video-call-new.vue:614","[VideoCallNew] 视频URL:",this.selectedVideoUrl),await this.checkAndLoadLocalVideo(this.selectedVideoId,this.selectedVideoUrl),T(this,p.VIDEO_CALL.type,(()=>{this.showCallSettings()}),(e=>{t("error","at pages/video-call-new/video-call-new.vue:628","[Payment] 支付失败:",e)}))):uni.showToast({title:"视频地址不存在",icon:"none"}):uni.showToast({title:"该视频无法进行通话",icon:"none"})},async startVideoCallDirect(){return this.selectedVideoId&&this.selectedVoiceId?this.selectedVideoUrl?(t("log","at pages/video-call-new/video-call-new.vue:657","[VideoCallNew] 直接开始视频通话"),t("log","at pages/video-call-new/video-call-new.vue:658","[VideoCallNew] 视频ID:",this.selectedVideoId),t("log","at pages/video-call-new/video-call-new.vue:659","[VideoCallNew] 当前使用URL:",this.localVideoUrl||this.selectedVideoUrl),void T(this,p.VIDEO_CALL.type,(()=>{this.showCallSettings()}),(e=>{t("error","at pages/video-call-new/video-call-new.vue:670","[Payment] 支付失败:",e),setTimeout((()=>{uni.navigateBack()}),1e3)}))):(uni.showToast({title:"视频地址不存在",icon:"none"}),void setTimeout((()=>{uni.navigateBack()}),1500)):(uni.showToast({title:"视频信息不完整",icon:"none"}),void setTimeout((()=>{uni.navigateBack()}),1500))},showCallSettings(){this.dialogMemoryIdentity="",this.dialogMemoryInfo="",this.dialogMemoryCatchphrase="",this.showSettingsDialog=!0},closeSettingsDialog(){this.showSettingsDialog=!1},confirmSettings(){if(t("log","at pages/video-call-new/video-call-new.vue:697","[VideoCallNew] 开始视频通话"),t("log","at pages/video-call-new/video-call-new.vue:698","[VideoCallNew] 使用视频的音色ID:",this.selectedVoiceId),this.showSettingsDialog=!1,this.videoInitialPlayed=!1,this.isConnecting=!0,this.connectingText="正在接通...",this.dialogMemoryIdentity||this.dialogMemoryInfo)if(this.dialogMemoryIdentity){let e=`你是${this.dialogMemoryIdentity},你已经去世。用户正在和你对话。`;e+="\n\n你的性格特点:\n\n亲切、真实、克制",e+="\n\n你的行事风格:\n\n直接回答,不绕弯",e+="\n\n你的语言特点:\n\n自然口语,语气温和",this.dialogMemoryInfo&&(e+=`\n\n补充设定(请严格遵循):\n\n${this.dialogMemoryInfo}`),e+="\n\n注意:不要使用括号(包括()和())来描述动作、心理、背景。",e+="\n\n规则:\n\n1. 不要虚构不存在的事,不要编造记忆或经历。\n2. 不要回忆以前(除非用户明确提到并且你能基于已有设定回答)。\n3. 不要使用任何称呼(因为用户可能是任何身份)。\n4. 不要使用emoji/颜文字/特殊符号。\n5. 顺应用户话题,亲切回答问题。\n6. 时刻记住自己是逝者。\n7. 每次回复保持在20~50字之间。",this.systemPrompt=e}else{let e="你是一位已经去世的人。用户正在和你对话。";e+="\n\n你的性格特点:\n\n亲切、真实、克制",e+="\n\n你的行事风格:\n\n直接回答,不绕弯",e+="\n\n你的语言特点:\n\n自然口语,语气温和",this.dialogMemoryInfo&&(e+=`\n\n补充设定(请严格遵循):\n\n${this.dialogMemoryInfo}`),e+="\n\n注意:不要使用括号(包括()和())来描述动作、心理、背景。",e+="\n\n规则:\n\n1. 不要虚构不存在的事,不要编造记忆或经历。\n2. 不要回忆以前(除非用户明确提到并且你能基于已有设定回答)。\n3. 不要使用任何称呼(因为用户可能是任何身份)。\n4. 不要使用emoji/颜文字/特殊符号。\n5. 顺应用户话题,亲切回答问题。\n6. 时刻记住自己是逝者。\n7. 每次回复保持在20~50字之间。",this.systemPrompt=e}else{let e="你是一位已经去世的人。用户正在和你对话。";e+="\n\n你的性格特点:\n\n亲切、真实、克制",e+="\n\n你的行事风格:\n\n直接回答,不绕弯",e+="\n\n你的语言特点:\n\n自然口语,语气温和",e+="\n\n注意:不要使用括号(包括()和())来描述动作、心理、背景。",e+="\n\n规则:\n\n1. 不要虚构不存在的事,不要编造记忆或经历。\n2. 不要回忆以前(除非用户明确提到并且你能基于已有设定回答)。\n3. 不要使用任何称呼(因为用户可能是任何身份)。\n4. 不要使用emoji/颜文字/特殊符号。\n5. 顺应用户话题,亲切回答问题。\n6. 时刻记住自己是逝者。\n7. 每次回复保持在20~50字之间。",this.systemPrompt=e}t("log","at pages/video-call-new/video-call-new.vue:744","[VideoCallNew] 系统提示词:",this.systemPrompt),this.callStarted=!0,this.startCallTimer(),this.$nextTick((()=>{this.videoContext=uni.createVideoContext("callVideo",this),t("log","at pages/video-call-new/video-call-new.vue:755","[VideoCallNew] 重新初始化视频上下文"),t("log","at pages/video-call-new/video-call-new.vue:756","[VideoCallNew] 当前视频URL:",this.localVideoUrl||this.selectedVideoUrl),setTimeout((()=>{this.videoContext&&!this.videoInitialPlayed&&(t("log","at pages/video-call-new/video-call-new.vue:761","[VideoCallNew] 视频上下文已初始化,自动播放一秒避免黑屏"),this.videoInitialPlayed=!0,this.videoContext.seek(0),this.videoContext.play(),setTimeout((()=>{this.videoContext&&!this.isSpeaking&&(this.videoContext.pause(),t("log","at pages/video-call-new/video-call-new.vue:770","[VideoCallNew] 视频已播放一秒,暂停等待AI回复"))}),1e3))}),500)}))},startCallTimer(){this.callStartTime=Date.now(),this.durationTimer=setInterval((()=>{const e=Math.floor((Date.now()-this.callStartTime)/1e3),a=Math.floor(e/60).toString().padStart(2,"0"),o=(e%60).toString().padStart(2,"0");this.callDuration=`${a}:${o}`,e>=600&&(t("log","at pages/video-call-new/video-call-new.vue:789","[VideoCallNew] 通话时长已达10分钟,自动挂断"),this.autoEndCall())}),1e3)},initRecorder(){this.recorderManager=uni.getRecorderManager(),t("log","at pages/video-call-new/video-call-new.vue:799","[VAD] RecorderManager 对象:",this.recorderManager),t("log","at pages/video-call-new/video-call-new.vue:800","[VAD] onFrameRecorded 方法存在:",typeof this.recorderManager.onFrameRecorded),this.recorderManager.onStart((()=>{t("log","at pages/video-call-new/video-call-new.vue:803","[VideoCallNew] 开始录音")})),this.recorderManager.onStop((e=>{t("log","at pages/video-call-new/video-call-new.vue:807","[VideoCallNew] 录音完成:",e.tempFilePath),this.isRecording=!1,this.isTouching=!1,this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null),this.stopFallbackTimer&&(clearTimeout(this.stopFallbackTimer),this.stopFallbackTimer=null),this.stopFallbackActive=!1,this.stopFallbackRetries=0,this.resetVADState();if((e.duration||Date.now()-(this.recordingStartTime||Date.now()))<400)return t("warn","at pages/video-call-new/video-call-new.vue:824","[VideoCallNew] 录音过短,已忽略"),this.isProcessing=!1,void(this.callStatus="通话中");this.audioFilePath=e.tempFilePath,this.processConversation()})),"function"==typeof this.recorderManager.onFrameRecorded?(t("log","at pages/video-call-new/video-call-new.vue:836","[VAD] ✅ onFrameRecorded 支持,已绑定帧回调"),this.recorderManager.onFrameRecorded((e=>{t("log","at pages/video-call-new/video-call-new.vue:838","[VAD] 🎯 收到帧数据!大小:",e.frameBuffer?e.frameBuffer.byteLength:0,"bytes"),this.vadEnabled&&!this.isProcessing?this.handleVADFrame(e.frameBuffer):t("log","at pages/video-call-new/video-call-new.vue:840","[VAD] VAD已禁用或正在处理,跳过")}))):(t("error","at pages/video-call-new/video-call-new.vue:846","[VAD] ❌ onFrameRecorded 不支持,VAD功能将无法使用"),t("error","at pages/video-call-new/video-call-new.vue:847","[VAD] recorderManager 类型:",typeof this.recorderManager),t("error","at pages/video-call-new/video-call-new.vue:848","[VAD] 可用方法:",Object.keys(this.recorderManager)),this.vadEnabled=!1),this.recorderManager.onError((e=>{t("error","at pages/video-call-new/video-call-new.vue:853","[VideoCallNew] 录音失败:",e),this.isRecording=!1,this.resetVADState();e.errMsg&&(e.errMsg.includes("permission")||e.errMsg.includes("authorize")||e.errMsg.includes("denied")||e.errMsg.includes("占用"))?uni.showModal({title:"需要麦克风权限",content:"录音功能需要麦克风权限才能使用。\n\n请前往:\n手机设置 → 应用管理 → 时光意境 → 权限管理 → 开启麦克风权限",confirmText:"我知道了",showCancel:!1}):uni.showToast({title:"录音失败: "+(e.errMsg||"未知错误"),icon:"none",duration:3e3})}))},initVideoContext(){this.videoContext=uni.createVideoContext("callVideo",this)},initAudioContext(){if(!this.audioContext){this.audioContext=uni.createInnerAudioContext(),this.audioContext.volume=1;try{this.audioContext.obeyMuteSwitch=!1}catch(e){t("warn","at pages/video-call-new/video-call-new.vue:899","[VideoCallNew] 设置obeyMuteSwitch失败:",e)}t("log","at pages/video-call-new/video-call-new.vue:901","[VideoCallNew] 🔊 音频上下文初始化完成,音量设置为最大"),this.audioContext.onCanplay((()=>{t("log","at pages/video-call-new/video-call-new.vue:904","[VideoCallNew] ✅ 音频已准备好,可以播放"),this.tryPlayAudioForSession("canplay")})),this.audioContext.onEnded((()=>{t("log","at pages/video-call-new/video-call-new.vue:909","[VideoCallNew] AI回复播放完成"),this.isSpeaking=!1,this.callStatus="通话中",this.videoContext&&this.videoContext.pause()})),this.audioContext.onError((a=>{this.isSpeaking&&!this.audioDiagnosedInSession&&this.pendingAudioUrl&&(this.audioDiagnosedInSession=!0,this.diagnoseAudioUrl(this.pendingAudioUrl));const o=!(!a||!(67===a.errCode||a.errMsg&&String(a.errMsg).includes("decode"))),i=!(!this.pendingAudioUrl||this.currentAudioSrc!==this.pendingAudioUrl&&this.audioContext.src!==this.pendingAudioUrl);if(this.isSpeaking&&!this.audioTriedFallback&&o&&i&&this.pendingAudioUrl&&this.audioContext){this.audioTriedFallback=!0,t("warn","at pages/video-call-new/video-call-new.vue:928","[VideoCallNew] 音频播放失败,尝试回退本地重试一次。errCode=",a.errCode,"errMsg=",a.errMsg);const o=this.audioSessionId;return void this.downloadAudioTemp(this.pendingAudioUrl).then((a=>{if(o===this.audioSessionId&&a&&this.audioContext&&this.isSpeaking&&a!==this.pendingAudioUrl&&a!==this.currentAudioSrc&&a!==this.audioContext.src){try{this.audioContext.stop()}catch(e){}this.currentAudioSrc=a,this.audioContext.src=a,setTimeout((()=>{if(o===this.audioSessionId&&this.audioContext&&this.isSpeaking)try{this.audioContext.play(),t("log","at pages/video-call-new/video-call-new.vue:947","[VideoCallNew] ✅ 已使用本地音频回退重试播放")}catch(e){}}),150)}}))}if(this.isSpeaking&&o&&!this.audioTriedRecreateContext&&this.audioContext){this.audioTriedRecreateContext=!0;const a=this.audioSessionId,o=this.currentAudioSrc||this.audioContext&&this.audioContext.src||this.pendingAudioUrl;return t("warn","at pages/video-call-new/video-call-new.vue:960","[VideoCallNew] decode fail,尝试重建音频上下文并重试一次"),void this.recreateAudioContext().then((()=>{a===this.audioSessionId&&this.audioContext&&this.isSpeaking&&o&&(this.audioContext.src=o,this.currentAudioSrc=o,setTimeout((()=>{if(a===this.audioSessionId&&this.audioContext&&this.isSpeaking)try{this.audioContext.play(),t("log","at pages/video-call-new/video-call-new.vue:971","[VideoCallNew] ✅ 已重建音频上下文并重试播放")}catch(e){}}),200))}))}const s=!!(this.audioContext&&this.audioContext.src&&String(this.audioContext.src).startsWith("wxfile://store_"));if(this.isSpeaking&&o&&!this.audioTriedRedownload&&s&&this.pendingAudioUrl&&this.audioContext){this.audioTriedRedownload=!0;const a=this.audioSessionId;return t("warn","at pages/video-call-new/video-call-new.vue:984","[VideoCallNew] 本地缓存音频解码失败,清缓存并重新下载临时文件重试一次"),void this.clearAudioCacheForUrl(this.pendingAudioUrl).finally((()=>{this.downloadAudioTemp(this.pendingAudioUrl).then((o=>{if(a===this.audioSessionId&&o&&this.audioContext&&this.isSpeaking){try{this.audioContext.stop()}catch(e){}this.currentAudioSrc=o,this.audioContext.src=o,setTimeout((()=>{if(a===this.audioSessionId&&this.audioContext&&this.isSpeaking)try{this.audioContext.play(),t("log","at pages/video-call-new/video-call-new.vue:1001","[VideoCallNew] ✅ 已使用重新下载的临时音频重试播放")}catch(e){}}),200)}}))}))}t("error","at pages/video-call-new/video-call-new.vue:1010","[VideoCallNew] ❌ 音频播放失败:",JSON.stringify(a)),t("error","at pages/video-call-new/video-call-new.vue:1011","[VideoCallNew] 错误详情 - errMsg:",a.errMsg,"errCode:",a.errCode),this.isSpeaking=!1,this.callStatus="通话中",this.isProcessing=!1,uni.showToast({title:"音频播放失败",icon:"none",duration:2e3}),this.videoContext&&this.videoContext.pause()})),this.audioContext.onPlay((()=>{t("log","at pages/video-call-new/video-call-new.vue:1026","[VideoCallNew] ▶️ 音频播放事件触发"),this.audioPlayedInSession=!0,this.audioPlayStartAt=Date.now(),this.videoContext&&this.videoContext.play()})),this.audioContext.onPause((()=>{t("log","at pages/video-call-new/video-call-new.vue:1036","[VideoCallNew] ⏸️ 音频暂停事件触发"),this.isSpeaking&&(t("warn","at pages/video-call-new/video-call-new.vue:1039","[VideoCallNew] ⚠️ AI说话时音频被暂停,尝试恢复播放..."),setTimeout((()=>{if(this.isSpeaking&&this.audioContext)try{this.audioContext.play(),t("log","at pages/video-call-new/video-call-new.vue:1044","[VideoCallNew] ✅ 音频已恢复播放")}catch(e){t("error","at pages/video-call-new/video-call-new.vue:1046","[VideoCallNew] ❌ 恢复音频播放失败:",e)}}),100))})),this.audioContext.onWaiting((()=>{t("log","at pages/video-call-new/video-call-new.vue:1054","[VideoCallNew] ⏳ 音频加载中...")})),this.audioContext.onStop((()=>{t("log","at pages/video-call-new/video-call-new.vue:1058","[VideoCallNew] 音频停止事件触发")})),this.audioContext.onWaiting((()=>{t("log","at pages/video-call-new/video-call-new.vue:1062","[VideoCallNew] 音频等待加载")})),this.audioContext.onCanplay((()=>{t("log","at pages/video-call-new/video-call-new.vue:1066","[VideoCallNew] 音频可以播放"),this.tryPlayAudioForSession("canplay2")}))}},tryPlayAudioForSession(e){const a=this.audioPlayTargetSessionId;if(a&&a===this.audioSessionId&&this.audioContext&&this.isSpeaking&&!this.audioPlayInvokedInSession){this.audioPlayInvokedInSession=!0;try{this.audioContext.play(),t("log","at pages/video-call-new/video-call-new.vue:1079","[VideoCallNew] ✅ 已触发音频播放(",e,")")}catch(o){t("error","at pages/video-call-new/video-call-new.vue:1081","[VideoCallNew] ❌ 触发音频播放失败(",e,"):",o)}}},recreateAudioContext(){return new Promise((e=>{try{if(this.audioContext){try{this.audioContext.stop()}catch(t){}try{this.audioContext.destroy()}catch(t){}}}catch(t){}this.audioContext=null,this.initAudioContext(),setTimeout((()=>e()),50)}))},diagnoseAudioUrl(e){if(e){t("log","at pages/video-call-new/video-call-new.vue:1111","[VideoCallNew] 🔍 音频诊断:开始下载以检测是否为有效mp3",e);try{uni.request({url:e,method:"HEAD",timeout:2e4,success:e=>{t("log","at pages/video-call-new/video-call-new.vue:1118","[VideoCallNew] 🔍 音频诊断:HEAD statusCode=",e.statusCode),t("log","at pages/video-call-new/video-call-new.vue:1119","[VideoCallNew] 🔍 音频诊断:HEAD headers=",e.header||{})},fail:e=>{t("log","at pages/video-call-new/video-call-new.vue:1122","[VideoCallNew] 🔍 音频诊断:HEAD失败",e)}})}catch(a){}uni.downloadFile({url:e,timeout:2e4,success:e=>{if(t("log","at pages/video-call-new/video-call-new.vue:1132","[VideoCallNew] 🔍 音频诊断:downloadFile statusCode=",e.statusCode),200===e.statusCode&&e.tempFilePath)try{const o=uni.getFileSystemManager();try{o.readFile({filePath:e.tempFilePath,position:0,length:16,success:e=>{let o="";try{const t=new Uint8Array(e.data);o=Array.from(t).map((e=>e.toString(16).padStart(2,"0"))).join(" ")}catch(a){o=""}t("log","at pages/video-call-new/video-call-new.vue:1149","[VideoCallNew] 🔍 音频诊断:file header(16 bytes)=",o)},fail:e=>{t("log","at pages/video-call-new/video-call-new.vue:1152","[VideoCallNew] 🔍 音频诊断:readFile失败",e)}})}catch(a){}o.getFileInfo({filePath:e.tempFilePath,success:a=>{t("log","at pages/video-call-new/video-call-new.vue:1161","[VideoCallNew] 🔍 音频诊断:tempFile size=",a.size,"path=",e.tempFilePath)},fail:e=>{t("log","at pages/video-call-new/video-call-new.vue:1164","[VideoCallNew] 🔍 音频诊断:getFileInfo失败",e)}})}catch(a){t("log","at pages/video-call-new/video-call-new.vue:1168","[VideoCallNew] 🔍 音频诊断异常:",a)}},fail:e=>{t("log","at pages/video-call-new/video-call-new.vue:1172","[VideoCallNew] 🔍 音频诊断:downloadFile失败",e)}})}},generateAudioCacheKey(e){if(!e)return"";let t=0;for(let a=0;a{if(!e)return void t("");const a=this.generateAudioCacheKey(e);this.audioCacheKey=a;const o=uni.getStorageSync(a);o?uni.getSavedFileInfo({filePath:o,success:()=>{t(o)},fail:()=>{try{uni.removeStorageSync(a)}catch(e){}t("")}}):uni.downloadFile({url:e,timeout:6e4,success:e=>{200===e.statusCode?uni.saveFile({tempFilePath:e.tempFilePath,success:e=>{try{uni.setStorageSync(a,e.savedFilePath)}catch(o){}t(e.savedFilePath)},fail:()=>{t(e.tempFilePath)}}):t("")},fail:()=>{t("")}})}))},clearAudioCacheForUrl(e){return new Promise((t=>{try{const o=this.generateAudioCacheKey(e),i=uni.getStorageSync(o);try{uni.removeStorageSync(o)}catch(a){}if(i)return void uni.removeSavedFile({filePath:i,complete:()=>{t()}})}catch(a){}t()}))},downloadAudioTemp:e=>new Promise((t=>{e?uni.downloadFile({url:e,timeout:2e4,success:e=>{200===e.statusCode&&e.tempFilePath?t(e.tempFilePath):t("")},fail:()=>{t("")}}):t("")})),handleTouchStart(e){t("log","at pages/video-call-new/video-call-new.vue:1283","[VideoCallNew] ========== 触摸开始 =========="),t("log","at pages/video-call-new/video-call-new.vue:1284","[VideoCallNew] 事件对象:",e),t("log","at pages/video-call-new/video-call-new.vue:1285","[VideoCallNew] isProcessing:",this.isProcessing,"isRecording:",this.isRecording),this.isProcessing||this.isRecording?t("log","at pages/video-call-new/video-call-new.vue:1288","[VideoCallNew] 跳过:正在处理或录音中"):(this.isTouching=!0,this.longPressTimer=setTimeout((()=>{this.isTouching&&(t("log","at pages/video-call-new/video-call-new.vue:1297","[VideoCallNew] 长按触发,开始录音"),this.startRecording(!0))}),300))},handleTouchEnd(e){t("log","at pages/video-call-new/video-call-new.vue:1305","[VideoCallNew] ========== 触摸结束 =========="),t("log","at pages/video-call-new/video-call-new.vue:1306","[VideoCallNew] 事件对象:",e),this.isTouching=!1,this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null),this.isRecording&&(t("log","at pages/video-call-new/video-call-new.vue:1317","[VideoCallNew] 松开手指,发送录音"),this.stopRecordingInternal("manual"))},onDialectChange(e){this.selectedDialect=this.dialectOptions[e.detail.value]||""},onLanguageHintChange(e){const t=this.languageHintOptions[e.detail.value]||"";this.selectedLanguageHintLabel=t;const a=t.match(/\(([^)]+)\)/);this.selectedLanguageHint=a&&a[1]?a[1]:""},handleTouchCancel(e){t("log","at pages/video-call-new/video-call-new.vue:1335","[VideoCallNew] ========== 触摸取消 =========="),t("log","at pages/video-call-new/video-call-new.vue:1336","[VideoCallNew] 事件对象:",e),this.isTouching=!1,this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null),this.isRecording&&(t("log","at pages/video-call-new/video-call-new.vue:1347","[VideoCallNew] 触摸取消,停止录音"),this.isRecording=!1,this.recorderManager.stop(),this.resetVADState(),uni.showToast({title:"已取消录音",icon:"none",duration:1500}))},handleGlobalTouchEnd(e){t("log","at pages/video-call-new/video-call-new.vue:1360","[VideoCallNew] ========== 全局触摸结束兜底 ==========",e),this.isTouching=!1,this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null),this.isRecording&&this.stopRecordingInternal("manual")},handleGlobalTouchCancel(e){t("log","at pages/video-call-new/video-call-new.vue:1372","[VideoCallNew] ========== 全局触摸取消兜底 ==========",e),this.isTouching=!1,this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null),this.isRecording&&(this.isRecording=!1,this.recorderManager.stop(),this.resetVADState(),uni.showToast({title:"已取消录音",icon:"none",duration:1500}))},startRecording(e=!1){if(this.isProcessing)return;if(this.isSpeaking&&!e)return;this.resetVADState(),this.recordingStartTime=Date.now(),this.vadLastSoundTime=this.recordingStartTime,this.vadLastFrameTime=this.recordingStartTime,this.isRecording=!0,t("log","at pages/video-call-new/video-call-new.vue:1403","[VAD] 开始录音,时间:",(new Date).toLocaleTimeString());this.vadEnabled&&!e&&(this.vadMaxTimer=setTimeout((()=>{t("log","at pages/video-call-new/video-call-new.vue:1408","[VAD] 达到最大录音时长15秒,强制停止"),this.stopRecordingInternal("max_duration")}),this.vadMaxDurationMs),this.vadWatchTimer=setInterval((()=>{if(!this.isRecording)return;const e=Date.now(),a=e-(this.recordingStartTime||e),o=e-(this.vadLastSoundTime||e);return e-(this.vadLastFrameTime||e)>8e3?(t("log","at pages/video-call-new/video-call-new.vue:1419","[VAD] 无帧回调超时,停止录音"),void this.stopRecordingInternal("no_frame")):!this.vadSpeaking&&a>2500?(t("log","at pages/video-call-new/video-call-new.vue:1426","[VAD] 未检测到语音,自动停止录音"),void this.stopRecordingInternal("no_speech")):a>500&&this.vadSpeaking&&o>this.vadSilenceMs?(t("log","at pages/video-call-new/video-call-new.vue:1433","[VAD] 检测到静音超时"),t("log","at pages/video-call-new/video-call-new.vue:1434","[VAD] 录音总时长:",a,"ms, 静音时长:",o,"ms"),void this.stopRecordingInternal("silence")):void 0}),150));const a={format:"mp3",sampleRate:16e3,numberOfChannels:1,encodeBitRate:32e3};e&&(a.duration=6e5),this.vadEnabled&&this.recorderManager.onFrameRecorded&&(a.frameSize=200,t("log","at pages/video-call-new/video-call-new.vue:1455","[VAD] 启用帧回调,frameSize: 200ms")),t("log","at pages/video-call-new/video-call-new.vue:1458","[VAD] 录音参数:",JSON.stringify(a)),this.recorderManager.start(a),this.callStatus="正在录音(自动识别说话)"},stopRecording(){this.isRecording&&this.stopRecordingInternal("manual")},stopRecordingInternal(e="manual"){if(this.isRecording){if(this.isRecording=!1,this.recorderManager.stop(),this.stopFallbackActive=!0,this.stopFallbackRetries=0,this.stopFallbackTimer&&(clearTimeout(this.stopFallbackTimer),this.stopFallbackTimer=null),this.stopFallbackTimer=setTimeout((()=>{this.retryStopRecording()}),1200),this.isProcessing=!0,this.processingText="正在聆听...",this.callStatus="处理中...",this.recognizingText="",this.resetVADState(),t("log","at pages/video-call-new/video-call-new.vue:1492","[VideoCallNew] 停止录音,原因:",e),!this.audioContextActivated)try{const e=uni.createInnerAudioContext();e.src="data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA=",e.volume=0,e.play(),setTimeout((()=>{e.destroy()}),100),this.audioContextActivated=!0,t("log","at pages/video-call-new/video-call-new.vue:1505","[VideoCallNew] 音频上下文已激活")}catch(a){t("warn","at pages/video-call-new/video-call-new.vue:1507","[VideoCallNew] 激活音频上下文失败:",a)}this.processingTimeout=setTimeout((()=>{this.isProcessing&&(t("warn","at pages/video-call-new/video-call-new.vue:1514","[VideoCallNew] 处理超时,重置状态"),this.isProcessing=!1,this.callStatus="通话中",uni.showToast({title:"处理超时,请重试",icon:"none"}))}),3e4)}},retryStopRecording(){if(this.stopFallbackActive&&this.recorderManager){if(this.stopFallbackRetries+=1,this.stopFallbackRetries>2)return this.stopFallbackActive=!1,this.stopFallbackTimer=null,this.isProcessing=!1,void(this.callStatus="通话中");try{this.recorderManager.stop()}catch(e){}this.stopFallbackTimer=setTimeout((()=>{this.retryStopRecording()}),1200)}},resetVADState(){this.vadSpeaking=!1,this.vadSilenceStart=null,this.vadLastSoundTime=null,this.vadLastFrameTime=null,this.vadMaxTimer&&(clearTimeout(this.vadMaxTimer),this.vadMaxTimer=null),this.vadWatchTimer&&(clearInterval(this.vadWatchTimer),this.vadWatchTimer=null)},handleVADFrame(e){if(!e||0===e.byteLength)return;this.vadLastFrameTime=Date.now();const a=this.calculateRms(e);if(a>this.vadVoiceThreshold)return this.vadSpeaking||t("log","at pages/video-call-new/video-call-new.vue:1569","[VAD] 检测到语音开始,音量:",a.toFixed(4)),this.vadSpeaking=!0,this.vadSilenceStart=null,void(this.vadLastSoundTime=Date.now());this.vadSpeaking?this.vadSilenceStart||(this.vadSilenceStart=Date.now(),t("log","at pages/video-call-new/video-call-new.vue:1581","[VAD] 检测到静音开始,音量:",a.toFixed(4))):Math.random()<.1&&t("log","at pages/video-call-new/video-call-new.vue:1586","[VAD] 等待语音中,当前音量:",a.toFixed(4),"阈值:",this.vadVoiceThreshold)},calculateRms(e){const t=new DataView(e),a=t.byteLength/2;if(0===a)return 0;let o=0;for(let i=0;i{this.callStarted&&this.autoListen&&(this.isSpeaking||this.isRecording||this.isProcessing||this.startRecording(!1))}),2e3))},async processConversation(){try{this.processingText="正在识别...";const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";setTimeout((()=>{this.isProcessing&&(this.processingText="正在思考...")}),800),setTimeout((()=>{this.isProcessing&&(this.processingText="正在回复...")}),2e3),uni.uploadFile({url:`${this.API_BASE}/api/conversation/talk`,filePath:this.audioFilePath,name:"audio",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},formData:(()=>{const e=this.selectedVoiceId,t=(()=>{const t=(e||"").trim();if(!t)return"CLONE";return["Cherry","Kai","Mochi","Bunny","Jada","Dylan","Li","Marcus","Roy","Peter","Sunny","Eric","Rocky","Kiki"].includes(t)||t.startsWith("BV")||t.endsWith("_streaming")||t.endsWith("_offline")||t.endsWith("_bigtts")?"OFFICIAL":"CLONE"})(),a={voiceId:e,voiceType:t,serviceType:"VIDEO_CALL",systemPrompt:this.systemPrompt||"",saveHistory:"false"};return this.selectedDialect&&(a.dialect=this.selectedDialect),this.selectedLanguageHint&&(a.languageHints=this.selectedLanguageHint),a})(),success:e=>{if(this.processingTimeout&&(clearTimeout(this.processingTimeout),this.processingTimeout=null),t("log","at pages/video-call-new/video-call-new.vue:1681","[VideoCallNew] 对话响应:",e),200===e.statusCode){const a=JSON.parse(e.data);if(a.success)this.addMessage("user",a.recognizedText),this.addMessage("ai",a.aiResponse),this.playAIResponse(a.audioFile);else{const e=a.message||"未识别到语音内容";t("error","at pages/video-call-new/video-call-new.vue:1698","[VideoCallNew] 识别失败:",e),uni.showModal({title:"对话失败",content:e+"\n\n请重试。若已支付但多次失败,请联系客服补发(提供订单号/支付时间截图)。",showCancel:!1,confirmText:"我知道了"}),this.isProcessing=!1,this.callStatus="通话中"}}else{t("error","at pages/video-call-new/video-call-new.vue:1710","[VideoCallNew] 请求失败,状态码:",e.statusCode);let o=null;try{o=JSON.parse(e.data)}catch(a){o=null}const i=o&&o.message?o.message:"对话请求失败: HTTP "+e.statusCode;uni.showModal({title:"对话失败",content:i+"\n\n请重试。若已支付但多次失败,请联系客服补发(提供订单号/支付时间截图)。",showCancel:!1,confirmText:"我知道了"}),this.isProcessing=!1,this.callStatus="通话中"}},fail:e=>{this.processingTimeout&&(clearTimeout(this.processingTimeout),this.processingTimeout=null),t("error","at pages/video-call-new/video-call-new.vue:1735","[VideoCallNew] 对话失败:",e),uni.showModal({title:"对话失败",content:"网络请求失败:"+(e.errMsg||"未知错误")+"\n\n请重试。若已支付但多次失败,请联系客服补发(提供订单号/支付时间截图)。",showCancel:!1,confirmText:"我知道了"}),this.isProcessing=!1,this.callStatus="通话中"}})}catch(e){this.processingTimeout&&(clearTimeout(this.processingTimeout),this.processingTimeout=null),t("error","at pages/video-call-new/video-call-new.vue:1753","[VideoCallNew] 对话失败:",e),uni.showModal({title:"对话失败",content:(e.message||"未知错误")+"\n\n请重试。若已支付但多次失败,请联系客服补发(提供订单号/支付时间截图)。",showCancel:!1,confirmText:"我知道了"}),this.isProcessing=!1,this.callStatus="通话中"}},async playAIResponse(e){if(!e)return t("error","at pages/video-call-new/video-call-new.vue:1768","[VideoCallNew] ❌ 音频文件为空"),uni.showToast({title:"音频文件缺失",icon:"none"}),this.isProcessing=!1,void(this.callStatus="通话中");this.processingText="正在回复...";const a=`${this.API_BASE}/api/conversation/audio/${e}`;if(t("log","at pages/video-call-new/video-call-new.vue:1781","[VideoCallNew] 🎵 准备播放音频:",a),t("log","at pages/video-call-new/video-call-new.vue:1782","[VideoCallNew] 📁 音频文件名:",e),this.audioContext)try{t("log","at pages/video-call-new/video-call-new.vue:1790","[VideoCallNew] 停止之前的音频..."),this.audioContext.stop()}catch(s){t("warn","at pages/video-call-new/video-call-new.vue:1793","[VideoCallNew] 停止音频实例失败:",s)}else t("log","at pages/video-call-new/video-call-new.vue:1786","[VideoCallNew] 初始化音频上下文..."),this.initAudioContext();this.audioSessionId+=1;const o=this.audioSessionId;this.audioPlayedInSession=!1,this.audioPlayStartAt=0,this.audioTriedRedownload=!1,this.audioTriedRecreateContext=!1,this.audioPlayInvokedInSession=!1,this.audioPlayTargetSessionId=o,this.audioDiagnosedInSession=!1,this.pendingAudioUrl=a,this.audioTriedFallback=!1;let i=a;try{const e=await this.downloadAudioTemp(a);o===this.audioSessionId&&e&&(i=e)}catch(s){}if(o===this.audioSessionId&&this.audioContext){this.currentAudioSrc=i,this.audioContext.src=i,this.audioContext.volume=1;try{this.audioContext.obeyMuteSwitch=!1}catch(s){t("warn","at pages/video-call-new/video-call-new.vue:1826","[VideoCallNew] 设置obeyMuteSwitch失败:",s)}t("log","at pages/video-call-new/video-call-new.vue:1828","[VideoCallNew] 🔊 音频源已设置:",this.audioContext.src),t("log","at pages/video-call-new/video-call-new.vue:1829","[VideoCallNew] 🔊 音频音量:",this.audioContext.volume),t("log","at pages/video-call-new/video-call-new.vue:1830","[VideoCallNew] 📢 如果声音过小,请检查:1.手机系统音量 2.媒体音量 3.静音开关"),t("log","at pages/video-call-new/video-call-new.vue:1833","[VideoCallNew] 🎬 AI开始回复,从第1秒开始循环播放视频"),this.isSpeaking=!0,this.callStatus="对方正在说话...",this.videoContext&&(this.videoContext.seek(1),setTimeout((()=>{this.videoContext&&this.videoContext.play()}),100)),t("log","at pages/video-call-new/video-call-new.vue:1846","[VideoCallNew] ▶️ 开始播放音频..."),setTimeout((()=>{o===this.audioSessionId&&this.tryPlayAudioForSession("timer")}),500),this.isProcessing=!1}},addMessage(e,t){const a=new Date,o=`${a.getHours()}:${a.getMinutes().toString().padStart(2,"0")}`;this.messages.push({role:e,content:t,time:o}),this.$nextTick((()=>{this.scrollTop=999999}))},handleClearHistory(e){t("log","at pages/video-call-new/video-call-new.vue:1875","[VideoCallNew] ========== 清空按钮被点击 =========="),t("log","at pages/video-call-new/video-call-new.vue:1876","[VideoCallNew] 事件对象:",e),uni.showToast({title:"清空按钮已点击",icon:"none",duration:1e3}),uni.showModal({title:"确认清空",content:"确定要清空对话历史吗?",confirmColor:"#8B7355",success:e=>{e.confirm&&this.clearHistory()}})},clearHistory(){const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";uni.request({url:`${this.API_BASE}/api/conversation/clear-history`,method:"POST",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:e=>{var t;e.data&&e.data.success?(this.messages=[],uni.showToast({title:"已清空",icon:"success"})):uni.showToast({title:(null==(t=e.data)?void 0:t.message)||"清空失败",icon:"none"})},fail:e=>{t("error","at pages/video-call-new/video-call-new.vue:1923","[VideoCallNew] 清空历史失败:",e),uni.showToast({title:"清空失败,请稍后重试",icon:"none"})}})},autoEndCall(){this.durationTimer&&(clearInterval(this.durationTimer),this.durationTimer=null),this.cleanup(),uni.showModal({title:"通话已结束",content:"您本次通话已达10分钟时长上限,通话已自动结束。",showCancel:!1,confirmText:"好的",confirmColor:"#8B7355",success:e=>{e.confirm&&uni.reLaunch({url:"/pages/index/index"})}})},endCall(e){t("log","at pages/video-call-new/video-call-new.vue:1965","[VideoCallNew] ========== 挂断按钮被点击 =========="),t("log","at pages/video-call-new/video-call-new.vue:1966","[VideoCallNew] 事件对象:",e),uni.showToast({title:"挂断按钮已点击",icon:"none",duration:1e3}),uni.showModal({title:"结束通话",content:`通话时长:${this.callDuration}\n确定要结束通话吗?`,confirmColor:"#eb3349",success:e=>{e.confirm&&(uni.showLoading({title:"正在挂断...",mask:!0}),setTimeout((()=>{uni.hideLoading(),this.cleanup(),uni.showToast({title:"通话已结束",icon:"success",duration:1500}),setTimeout((()=>{uni.reLaunch({url:"/pages/index/index"})}),1500)}),800))}})},goBack(){this.callStarted?this.endCall():uni.navigateBack()},goToRevival(){t("log","at pages/video-call-new/video-call-new.vue:2019","[VideoCallNew] 跳转到复活照片页面"),uni.navigateTo({url:"/pages/revival/revival-original",fail:e=>{t("error","at pages/video-call-new/video-call-new.vue:2023","[VideoCallNew] 跳转失败:",e)}})},onVideoMetadataLoaded(){t("log","at pages/video-call-new/video-call-new.vue:2030","[VideoCallNew] 视频元数据加载完成,可以开始播放"),this.isConnecting&&(this.connectingText="已接通",setTimeout((()=>{this.isConnecting=!1,uni.showToast({title:"通话已接通",icon:"success",duration:1500})}),300))},onVideoLoaded(){t("log","at pages/video-call-new/video-call-new.vue:2049","[VideoCallNew] 视频数据加载成功"),t("log","at pages/video-call-new/video-call-new.vue:2050","[VideoCallNew] 当前视频URL:",this.selectedVideoUrl),!this.videoContext||this.isSpeaking||this.videoInitialPlayed||(t("log","at pages/video-call-new/video-call-new.vue:2054","[VideoCallNew] 视频数据加载完成,自动播放一秒避免黑屏"),this.videoInitialPlayed=!0,this.videoContext.seek(0),this.videoContext.play(),setTimeout((()=>{this.videoContext&&!this.isSpeaking&&(this.videoContext.pause(),t("log","at pages/video-call-new/video-call-new.vue:2063","[VideoCallNew] 视频已播放一秒,暂停等待AI回复"))}),1e3))},onVideoPreloaded(e){t("log","at pages/video-call-new/video-call-new.vue:2071","[VideoCallNew] 视频预加载完成:",e),this.videoPreloadStatus[e]=!0,this.$forceUpdate()},onVideoPlay(){t("log","at pages/video-call-new/video-call-new.vue:2078","[VideoCallNew] 视频开始播放")},onVideoPause(){t("log","at pages/video-call-new/video-call-new.vue:2083","[VideoCallNew] 视频已暂停")},onVideoTimeUpdate(e){},onVideoError(e){t("error","at pages/video-call-new/video-call-new.vue:2093","[VideoCallNew] 视频加载失败:",e),t("error","at pages/video-call-new/video-call-new.vue:2094","[VideoCallNew] 视频URL:",this.selectedVideoUrl),t("error","at pages/video-call-new/video-call-new.vue:2095","[VideoCallNew] 错误详情:",JSON.stringify(e)),uni.showToast({title:"视频加载失败",icon:"none",duration:3e3})},async loadVideoCache(){try{const e=uni.getStorageSync("videoCache");t("log","at pages/video-call-new/video-call-new.vue:2107","[VideoCallNew] 💾 读取缓存数据:",e),e?(this.videoCache=JSON.parse(e),t("log","at pages/video-call-new/video-call-new.vue:2110","[VideoCallNew] ✅ 加载视频缓存信息:",Object.keys(this.videoCache).length,"个视频"),t("log","at pages/video-call-new/video-call-new.vue:2111","[VideoCallNew] 缓存详情:",this.videoCache)):(t("log","at pages/video-call-new/video-call-new.vue:2113","[VideoCallNew] ⚠️ 未找到缓存数据"),this.videoCache={})}catch(e){t("error","at pages/video-call-new/video-call-new.vue:2117","[VideoCallNew] ❌ 加载视频缓存失败:",e),this.videoCache={}}},async saveVideoCache(){try{const e=JSON.stringify(this.videoCache);uni.setStorageSync("videoCache",e),t("log","at pages/video-call-new/video-call-new.vue:2127","[VideoCallNew] 💾 保存视频缓存信息成功"),t("log","at pages/video-call-new/video-call-new.vue:2128","[VideoCallNew] 保存内容:",e);uni.getStorageSync("videoCache")?t("log","at pages/video-call-new/video-call-new.vue:2133","[VideoCallNew] ✅ 验证保存成功"):t("error","at pages/video-call-new/video-call-new.vue:2135","[VideoCallNew] ❌ 验证保存失败,数据未持久化")}catch(e){t("error","at pages/video-call-new/video-call-new.vue:2138","[VideoCallNew] ❌ 保存视频缓存失败:",e)}},async checkAndLoadLocalVideo(e,a){if(e&&a){if(t("log","at pages/video-call-new/video-call-new.vue:2149","[VideoCallNew] 🔍 开始检查视频缓存"),t("log","at pages/video-call-new/video-call-new.vue:2150","[VideoCallNew] 视频ID:",e),t("log","at pages/video-call-new/video-call-new.vue:2151","[VideoCallNew] 当前缓存对象:",this.videoCache),t("log","at pages/video-call-new/video-call-new.vue:2152","[VideoCallNew] 缓存中是否有该ID:",e in this.videoCache),this.videoCache[e]){const a=this.videoCache[e];t("log","at pages/video-call-new/video-call-new.vue:2157","[VideoCallNew] 📝 发现缓存记录,验证文件:",a);const o=await this.checkFileExists(a);if(t("log","at pages/video-call-new/video-call-new.vue:2161","[VideoCallNew] 文件存在性检查结果:",o),o)return this.localVideoUrl=a,t("log","at pages/video-call-new/video-call-new.vue:2165","[VideoCallNew] ✅ 本地视频文件存在,使用缓存"),void t("log","at pages/video-call-new/video-call-new.vue:2166","[VideoCallNew] 已设置 localVideoUrl:",this.localVideoUrl);t("warn","at pages/video-call-new/video-call-new.vue:2169","[VideoCallNew] ⚠️ 缓存记录存在但文件丢失,清除缓存"),delete this.videoCache[e],await this.saveVideoCache()}else t("log","at pages/video-call-new/video-call-new.vue:2174","[VideoCallNew] ❌ 缓存中未找到视频ID:",e);t("log","at pages/video-call-new/video-call-new.vue:2178","[VideoCallNew] � 未找到缓存,先使用原始URL播放,同时后台下载"),this.localVideoUrl="",this.startBackgroundDownload(a,e)}else t("warn","at pages/video-call-new/video-call-new.vue:2145","[VideoCallNew] ⚠️ 视频ID或URL为空")},async preloadAllVideos(){if(this.preCachingInProgress)return void t("log","at pages/video-call-new/video-call-new.vue:2188","[VideoCallNew] 预缓存已在进行中,跳过");this.preCachingInProgress=!0,t("log","at pages/video-call-new/video-call-new.vue:2193","[VideoCallNew] 🚀 开始预缓存所有视频");const e=[...this.videos].sort(((e,t)=>{const a=e.created_at||e.createdAt||0;return(t.created_at||t.createdAt||0)-a}));let a=0,o=0;for(const i of e){const s=i.id,l=i.edited_video_url||i.videoUrl||i.local_video_path||i.video_url||i.localVideoPath;if(s&&l){if(this.videoCache[s]){const e=this.videoCache[s];if(await this.checkFileExists(e)){a++,this.cacheProgress[s]={progress:100,status:"completed"},t("log","at pages/video-call-new/video-call-new.vue:2222",`[VideoCallNew] ✅ 视频已缓存: ${i.name||s}`);continue}delete this.videoCache[s],await this.saveVideoCache()}o++,t("log","at pages/video-call-new/video-call-new.vue:2233",`[VideoCallNew] 📥 开始预缓存 [${o}/${e.length-a}]: ${i.name||s}`),this.cacheProgress[s]={progress:0,status:"downloading"},this.startBackgroundDownload(l,s,i.name).catch((e=>{t("error","at pages/video-call-new/video-call-new.vue:2240",`[VideoCallNew] 预缓存失败: ${i.name}`,e),this.cacheProgress[s]={progress:0,status:"failed"}})),await new Promise((e=>setTimeout(e,200)))}else t("warn","at pages/video-call-new/video-call-new.vue:2210","[VideoCallNew] 视频缺少ID或URL,跳过:",i.name)}t("log","at pages/video-call-new/video-call-new.vue:2248",`[VideoCallNew] 🎉 预缓存启动完成: 已缓存 ${a} 个,正在下载 ${o} 个`),this.preCachingInProgress=!1},async startBackgroundDownload(e,a,o=""){if(!e||!a)return;if(this.downloadingVideos[a])return void t("log","at pages/video-call-new/video-call-new.vue:2260","[VideoCallNew] 视频已在下载队列中");t("log","at pages/video-call-new/video-call-new.vue:2264",`[VideoCallNew] 📥 开始后台下载视频: ${o||a}`,e);const i=new Promise(((i,s)=>{uni.downloadFile({url:e,success:e=>{200===e.statusCode?(t("log","at pages/video-call-new/video-call-new.vue:2271","[VideoCallNew] 视频下载成功,临时路径:",e.tempFilePath),uni.saveFile({tempFilePath:e.tempFilePath,success:e=>{t("log","at pages/video-call-new/video-call-new.vue:2277",`[VideoCallNew] ✅ 视频保存成功 ${o||a}:`,e.savedFilePath),this.videoCache[a]=e.savedFilePath,this.selectedVideoId===a&&(this.localVideoUrl=e.savedFilePath,t("log","at pages/video-call-new/video-call-new.vue:2284","[VideoCallNew] 🎯 当前视频缓存完成,已更新播放源"),this.callStarted&&uni.showToast({title:"已切换到本地播放",icon:"success",duration:1500})),this.saveVideoCache(),this.cacheProgress[a]&&(this.cacheProgress[a]={progress:100,status:"completed"}),t("log","at pages/video-call-new/video-call-new.vue:2302","[VideoCallNew] 💾 缓存已更新,下次启动将直接使用"),delete this.downloadingVideos[a],i(e.savedFilePath)},fail:s=>{t("error","at pages/video-call-new/video-call-new.vue:2308",`[VideoCallNew] 视频保存失败 ${o||a}:`,s),this.selectedVideoId===a&&(this.localVideoUrl=e.tempFilePath),this.cacheProgress[a]&&(this.cacheProgress[a]={progress:100,status:"failed"}),delete this.downloadingVideos[a],i(e.tempFilePath)}})):(t("error","at pages/video-call-new/video-call-new.vue:2325",`[VideoCallNew] 视频下载失败 ${o||a},状态码:`,e.statusCode),this.cacheProgress[a]&&(this.cacheProgress[a]={progress:0,status:"failed"}),delete this.downloadingVideos[a],s(new Error("下载失败")))},fail:e=>{t("error","at pages/video-call-new/video-call-new.vue:2337",`[VideoCallNew] 视频下载失败 ${o||a}:`,e),this.cacheProgress[a]&&(this.cacheProgress[a]={progress:0,status:"failed"}),delete this.downloadingVideos[a],s(e)}}).onProgressUpdate((e=>{const i=e.progress||0;this.cacheProgress[a]&&(this.cacheProgress[a].progress=i),i%20==0&&t("log","at pages/video-call-new/video-call-new.vue:2357",`[VideoCallNew] 下载进度 ${o||a}: ${i}%`)}))}));this.downloadingVideos[a]=i;try{await i}catch(s){t("error","at pages/video-call-new/video-call-new.vue:2367","[VideoCallNew] 下载视频异常:",s)}},checkFileExists:async e=>new Promise((a=>{try{if("function"!=typeof uni.getFileSystemManager)return t("log","at pages/video-call-new/video-call-new.vue:2377","[VideoCallNew] 💡 当前平台不支持FileSystemManager,信任缓存记录"),void a(!0);uni.getFileSystemManager().access({path:e,success:()=>{t("log","at pages/video-call-new/video-call-new.vue:2386","[VideoCallNew] ✅ 文件存在验证通过"),a(!0)},fail:()=>{t("warn","at pages/video-call-new/video-call-new.vue:2390","[VideoCallNew] ❌ 文件不存在"),a(!1)}})}catch(o){t("warn","at pages/video-call-new/video-call-new.vue:2395","[VideoCallNew] ⚠️ 检查文件存在性异常:",o),t("log","at pages/video-call-new/video-call-new.vue:2397","[VideoCallNew] 💡 异常情况下信任缓存记录"),a(!0)}})),cleanup(){if(t("log","at pages/video-call-new/video-call-new.vue:2405","[VideoCallNew] 开始清理资源"),this.durationTimer&&(clearInterval(this.durationTimer),this.durationTimer=null),this.processingTimeout&&(clearTimeout(this.processingTimeout),this.processingTimeout=null),this.stopFallbackTimer&&(clearTimeout(this.stopFallbackTimer),this.stopFallbackTimer=null),this.stopFallbackActive=!1,this.stopFallbackRetries=0,this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null),this.audioContext){try{this.audioContext.stop(),this.audioContext.destroy()}catch(e){t("warn","at pages/video-call-new/video-call-new.vue:2430","[VideoCallNew] 清理音频上下文失败:",e)}this.audioContext=null}if(this.recorderManager){try{this.isRecording&&this.recorderManager.stop()}catch(e){t("warn","at pages/video-call-new/video-call-new.vue:2440","[VideoCallNew] 清理录音管理器失败:",e)}this.recorderManager=null}this.vadMaxTimer&&(clearTimeout(this.vadMaxTimer),this.vadMaxTimer=null),this.vadWatchTimer&&(clearInterval(this.vadWatchTimer),this.vadWatchTimer=null),this.autoLoopTimer&&(clearInterval(this.autoLoopTimer),this.autoLoopTimer=null),t("log","at pages/video-call-new/video-call-new.vue:2457","[VideoCallNew] 资源清理完成")},formatTime(e){if(!e)return"";const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`},handlePaymentClose(){this.paymentModalData.show=!1,this._paymentReject&&this._paymentReject(new Error("用户取消支付"))},async handlePaymentConfirm(e){await S(this,e)}}},[["render",function(t,a,o,i,s,l){const n=e.resolveComponent("PaymentModal");return e.openBlock(),e.createElementBlock("view",{class:"video-call-container",onTouchend:a[19]||(a[19]=(...e)=>l.handleGlobalTouchEnd&&l.handleGlobalTouchEnd(...e)),onTouchcancel:a[20]||(a[20]=(...e)=>l.handleGlobalTouchCancel&&l.handleGlobalTouchCancel(...e))},[e.createElementVNode("view",{class:"header"},[e.createElementVNode("text",{class:"header-title"},"视频通话"),e.createElementVNode("view",{class:"placeholder"})]),s.callStarted?(e.openBlock(),e.createElementBlock("view",{key:1,class:"call-active-section"},[s.isConnecting?(e.openBlock(),e.createElementBlock("view",{key:0,class:"connecting-overlay"},[e.createElementVNode("view",{class:"connecting-bg"},[s.selectedPhotoUrl?(e.openBlock(),e.createElementBlock("image",{key:0,src:s.selectedPhotoUrl,class:"bg-avatar",mode:"aspectFill"},null,8,["src"])):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"connecting-content"},[e.createElementVNode("view",{class:"avatar-container"},[s.selectedPhotoUrl?(e.openBlock(),e.createElementBlock("image",{key:0,src:s.selectedPhotoUrl,class:"avatar-img",mode:"aspectFill"},null,8,["src"])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"avatar-placeholder"},"📹"))]),e.createElementVNode("text",{class:"connecting-name"},e.toDisplayString(s.selectedVideoName),1),e.createElementVNode("view",{class:"connecting-status"},[e.createElementVNode("view",{class:"status-dots"},[e.createElementVNode("view",{class:"dot dot-1"}),e.createElementVNode("view",{class:"dot dot-2"}),e.createElementVNode("view",{class:"dot dot-3"})]),e.createElementVNode("text",{class:"status-text"},e.toDisplayString(s.connectingText),1)])])])):e.createCommentVNode("",!0),e.createElementVNode("view",{class:e.normalizeClass(["video-fullscreen",{"video-hidden":s.isConnecting}])},[s.selectedVideoUrl?(e.openBlock(),e.createElementBlock("video",{key:0,id:"callVideo",src:s.localVideoUrl||s.selectedVideoUrl,class:"video-player",loop:!0,muted:!0,autoplay:!1,controls:!1,"show-center-play-btn":!1,"show-play-btn":!1,"show-fullscreen-btn":!1,"show-progress":!1,"enable-progress-gesture":!1,preload:"auto","object-fit":"cover",onError:a[0]||(a[0]=(...e)=>l.onVideoError&&l.onVideoError(...e)),onLoadeddata:a[1]||(a[1]=(...e)=>l.onVideoLoaded&&l.onVideoLoaded(...e)),onLoadedmetadata:a[2]||(a[2]=(...e)=>l.onVideoMetadataLoaded&&l.onVideoMetadataLoaded(...e)),onPlay:a[3]||(a[3]=(...e)=>l.onVideoPlay&&l.onVideoPlay(...e)),onPause:a[4]||(a[4]=(...e)=>l.onVideoPause&&l.onVideoPause(...e))},null,40,["src"])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"video-placeholder"},[e.createElementVNode("text",{class:"placeholder-icon"},"📹"),e.createElementVNode("text",{class:"placeholder-text"},"视频加载中...")]))],2),e.createElementVNode("view",{class:"call-status-bar"},[e.createElementVNode("view",{class:"status-info"},[e.createElementVNode("text",{class:"call-name"},e.toDisplayString(s.selectedVideoName),1),e.createElementVNode("text",{class:"call-time"},e.toDisplayString(s.callDuration),1),s.isRecording||s.isProcessing?(e.openBlock(),e.createElementBlock("view",{key:0,class:"listening-chip listening-active"},[e.createElementVNode("view",{class:"listening-icon"},"💗"),e.createElementVNode("text",{class:"listening-text"},"TA在听你说")])):e.createCommentVNode("",!0)])]),e.createElementVNode("view",{class:"call-controls"},[s.selectedVoiceId&&s.selectedVoiceId.startsWith("cosyvoice-v3-plus-")?(e.openBlock(),e.createElementBlock("view",{key:0,class:"form-section",style:{position:"relative","z-index":"1002"}},[e.createElementVNode("view",{class:"form-label"},"方言"),e.createElementVNode("picker",{mode:"selector",range:s.dialectOptions,onChange:a[5]||(a[5]=(...e)=>l.onDialectChange&&l.onDialectChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.selectedDialect||"请选择方言(可选)"),1)],40,["range"])])):e.createCommentVNode("",!0),s.selectedVoiceId&&s.selectedVoiceId.startsWith("cosyvoice-v3-plus-")?(e.openBlock(),e.createElementBlock("view",{key:1,class:"form-section",style:{position:"relative","z-index":"1002"}},[e.createElementVNode("view",{class:"form-label"},"语言提示(可选)"),e.createElementVNode("picker",{mode:"selector",range:s.languageHintOptions,onChange:a[6]||(a[6]=(...e)=>l.onLanguageHintChange&&l.onLanguageHintChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.selectedLanguageHintLabel||"请选择语言(可选)"),1)],40,["range"]),e.createElementVNode("view",{class:"hint-text"},"💡 仅处理第一个值;不设置不生效")])):e.createCommentVNode("",!0),e.createElementVNode("view",{class:"control-buttons",style:{position:"relative","z-index":"1002"}},[e.createElementVNode("view",{class:"control-btn",style:{"pointer-events":"auto","z-index":"1003"},onClick:a[7]||(a[7]=(...e)=>l.handleClearHistory&&l.handleClearHistory(...e))},[e.createElementVNode("view",{class:"btn-circle"},[e.createElementVNode("view",{class:"icon-delete"})]),e.createElementVNode("text",{class:"btn-label"},"清空")]),e.createElementVNode("view",{class:"control-btn mic-btn",style:{"pointer-events":"auto","z-index":"1003"},onTouchstart:a[8]||(a[8]=(...e)=>l.handleTouchStart&&l.handleTouchStart(...e)),onTouchend:a[9]||(a[9]=(...e)=>l.handleTouchEnd&&l.handleTouchEnd(...e)),onTouchcancel:a[10]||(a[10]=(...e)=>l.handleTouchCancel&&l.handleTouchCancel(...e))},[e.createElementVNode("view",{class:e.normalizeClass(["speak-button",{recording:s.isRecording,processing:s.isProcessing}])},[s.isRecording?(e.openBlock(),e.createElementBlock("view",{key:0,class:"speak-ring"})):e.createCommentVNode("",!0),s.isRecording?(e.openBlock(),e.createElementBlock("view",{key:1,class:"speak-ring-outer"})):e.createCommentVNode("",!0),e.createElementVNode("view",{class:"speak-button-inner"},[s.isRecording||s.isProcessing?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("view",{key:0,class:"icon-mic-new"})),s.isRecording?(e.openBlock(),e.createElementBlock("view",{key:1,class:"icon-wave-container"},[e.createElementVNode("view",{class:"wave-bar",style:{"animation-delay":"0s"}}),e.createElementVNode("view",{class:"wave-bar",style:{"animation-delay":"0.1s"}}),e.createElementVNode("view",{class:"wave-bar",style:{"animation-delay":"0.2s"}}),e.createElementVNode("view",{class:"wave-bar",style:{"animation-delay":"0.15s"}}),e.createElementVNode("view",{class:"wave-bar",style:{"animation-delay":"0.05s"}})])):e.createCommentVNode("",!0),s.isProcessing?(e.openBlock(),e.createElementBlock("view",{key:2,class:"icon-loading-new"})):e.createCommentVNode("",!0)])],2),e.createElementVNode("text",{class:e.normalizeClass(["btn-label-new",{active:s.isRecording}])},e.toDisplayString(s.isRecording?"松开发送":s.isProcessing?"聆听中...":"长按说话"),3)],32),e.createElementVNode("view",{class:"control-btn",style:{"pointer-events":"auto","z-index":"1003"},onClick:a[11]||(a[11]=(...e)=>l.endCall&&l.endCall(...e))},[e.createElementVNode("view",{class:"btn-circle end-call"},[e.createElementVNode("view",{class:"icon-hangup"})]),e.createElementVNode("text",{class:"btn-label"},"挂断")])])])])):(e.openBlock(),e.createElementBlock("view",{key:0,class:"select-video-section"},[s.loading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"loading-box"},[e.createElementVNode("text",{class:"loading-text"},"⏳ 加载视频列表...")])):s.videos.length>0?(e.openBlock(),e.createElementBlock("scroll-view",{key:1,"scroll-y":"",class:"video-list"},[e.createElementVNode("view",{class:"list-header"},[e.createElementVNode("text",{class:"list-title"},"选择要通话的视频"),e.createElementVNode("text",{class:"list-count"},"共 "+e.toDisplayString(s.videos.length)+" 个",1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.videos,(t=>(e.openBlock(),e.createElementBlock("view",{key:t.id,class:"video-item",onClick:e=>l.startVideoCall(t)},[e.createElementVNode("view",{class:"item-cover"},[t.photo_url?(e.openBlock(),e.createElementBlock("image",{key:0,src:t.photo_url,class:"cover-img",mode:"aspectFill"},null,8,["src"])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"cover-placeholder"},[e.createElementVNode("text",{class:"placeholder-icon"},"📹")])),t.edited_video_url||t.videoUrl||t.local_video_path||t.video_url||t.localVideoPath?(e.openBlock(),e.createElementBlock("video",{key:2,id:"preload-video-"+t.id,src:t.edited_video_url||t.videoUrl||t.local_video_path||t.video_url||t.localVideoPath,class:"preload-video",muted:!0,autoplay:!1,controls:!1,"show-center-play-btn":!1,"show-play-btn":!1,"enable-progress-gesture":!1,onLoadedmetadata:e=>l.onVideoPreloaded(t.id)},null,40,["id","src","onLoadedmetadata"])):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"item-info"},[e.createElementVNode("view",{class:"info-name-row"},[e.createElementVNode("text",{class:"info-name"},e.toDisplayString(t.name||"复活视频"),1),s.videoPreloadStatus[t.id]?(e.openBlock(),e.createElementBlock("view",{key:0,class:"cache-badge"},[e.createElementVNode("text",{class:"cache-badge-text completed"},"✓ 已就绪")])):s.cacheProgress[t.id]?(e.openBlock(),e.createElementBlock("view",{key:1,class:"cache-badge"},["completed"===s.cacheProgress[t.id].status?(e.openBlock(),e.createElementBlock("text",{key:0,class:"cache-badge-text completed"},"✓ 已缓存")):"downloading"===s.cacheProgress[t.id].status?(e.openBlock(),e.createElementBlock("text",{key:1,class:"cache-badge-text downloading"},e.toDisplayString(s.cacheProgress[t.id].progress)+"%",1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),e.createElementVNode("text",{class:"info-text"},e.toDisplayString(t.text||"暂无描述"),1)]),e.createElementVNode("view",{class:"item-action"},[e.createElementVNode("view",{class:"call-icon"},[e.createElementVNode("text",{class:"icon-text"},"📞")])])],8,["onClick"])))),128))])):e.createCommentVNode("",!0)])),s.showSettingsDialog?(e.openBlock(),e.createElementBlock("view",{key:2,class:"settings-dialog-mask",onClick:a[18]||(a[18]=(...e)=>l.closeSettingsDialog&&l.closeSettingsDialog(...e))},[e.createElementVNode("view",{class:"settings-dialog",onClick:a[17]||(a[17]=e.withModifiers((()=>{}),["stop"]))},[e.createElementVNode("view",{class:"dialog-header"},[e.createElementVNode("text",{class:"dialog-title"},"💭 通话设置"),e.createElementVNode("text",{class:"dialog-close",onClick:a[12]||(a[12]=(...e)=>l.closeSettingsDialog&&l.closeSettingsDialog(...e))},"✕")]),e.createElementVNode("view",{class:"dialog-content"},[e.createElementVNode("view",{class:"dialog-section"},[e.createElementVNode("view",{class:"section-label"},"💭 记忆设定(可选)"),e.createElementVNode("text",{class:"section-hint"},"设置对话记忆,让AI更真实地模拟对方"),e.createElementVNode("view",{class:"memory-item"},[e.createElementVNode("text",{class:"memory-label"},"身份"),e.withDirectives(e.createElementVNode("input",{class:"memory-input","onUpdate:modelValue":a[13]||(a[13]=e=>s.dialogMemoryIdentity=e),placeholder:"例如:我的母亲",maxlength:"50"},null,512),[[e.vModelText,s.dialogMemoryIdentity]])]),e.createElementVNode("view",{class:"memory-item"},[e.createElementVNode("text",{class:"memory-label"},"性格特点"),e.withDirectives(e.createElementVNode("textarea",{class:"memory-textarea","onUpdate:modelValue":a[14]||(a[14]=e=>s.dialogMemoryInfo=e),placeholder:"例如:温柔体贴,喜欢养花,做饭很拿手...",maxlength:"200"},null,512),[[e.vModelText,s.dialogMemoryInfo]])])])]),e.createElementVNode("view",{class:"dialog-footer"},[e.createElementVNode("button",{class:"dialog-btn cancel",onClick:a[15]||(a[15]=(...e)=>l.closeSettingsDialog&&l.closeSettingsDialog(...e))},"取消"),e.createElementVNode("button",{class:"dialog-btn confirm",onClick:a[16]||(a[16]=(...e)=>l.confirmSettings&&l.confirmSettings(...e))},"开始通话")])])])):e.createCommentVNode("",!0),e.createVNode(n,{ref:"paymentModal",show:s.paymentModalData.show,serviceType:s.paymentModalData.serviceType,serviceName:s.paymentModalData.serviceName,serviceDesc:s.paymentModalData.serviceDesc,price:s.paymentModalData.price,orderNo:s.paymentModalData.orderNo,paymentTips:s.paymentModalData.paymentTips,onClose:l.handlePaymentClose,onConfirm:l.handlePaymentConfirm},null,8,["show","serviceType","serviceName","serviceDesc","price","orderNo","paymentTips","onClose","onConfirm"])],32)}],["__scopeId","data-v-cdf1da45"]]);const L=d({data:()=>({userInfo:{nickname:"",phone:""},worksCount:0,historyCount:0,isLoggedIn:!1,quotaItems:[],quotaLoading:!1}),computed:{displayPhone(){const e=(this.userInfo.phone||"").trim();return e?e.startsWith("wx_")?"":e:""}},onLoad(){this.loadUserInfo(),this.loadStats(),this.loadQuotaSummary()},onShow(){this.loadUserInfo(),this.loadStats(),this.loadQuotaSummary()},onShareAppMessage:()=>({title:"时光意境 · AI亲人重逢",path:"/pages/index/index"}),methods:{loadUserInfo(){const e=uni.getStorageSync("token"),t=uni.getStorageSync("userId");this.isLoggedIn=!(!e||!t);const a=uni.getStorageSync("userInfo"),o=uni.getStorageSync("userNickname"),i=uni.getStorageSync("userPhone");if(o)this.userInfo.nickname=o;else if(a&&a.nickname)this.userInfo.nickname=a.nickname;else{const e=uni.getStorageSync("nickname");e&&(this.userInfo.nickname=e)}i?this.userInfo.phone=i:a&&a.phone&&(this.userInfo.phone=a.phone)},async loadStats(){const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";e&&a&&(uni.request({url:`${i}/api/photo-revival/videos`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:e=>{e.data&&e.data.success&&e.data.videos&&(this.worksCount=e.data.videos.length)},fail:e=>{t("error","at pages/history/history.vue:208","[Stats] 加载视频数量失败:",e)}}),uni.request({url:`${i}/api/history?userId=${e}&page=0&size=1000`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:e=>{e.data&&(void 0!==e.data.totalElements?this.historyCount=e.data.totalElements:e.data.content&&Array.isArray(e.data.content)&&(this.historyCount=e.data.content.length))},fail:e=>{t("error","at pages/history/history.vue:230","[Stats] 加载历史记录数量失败:",e)}}))},loadQuotaSummary(){const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";e&&a?(this.quotaLoading=!0,uni.request({url:`${i}/api/pay/usage-summary?userId=${e}`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:e=>{e.data&&e.data.success&&Array.isArray(e.data.items)?this.quotaItems=e.data.items.filter((e=>e&&e.remainingTotalCount>0)).slice(0,5):this.quotaItems=[]},fail:e=>{t("error","at pages/history/history.vue:261","[Quota] 加载剩余次数失败:",e),this.quotaItems=[]},complete:()=>{this.quotaLoading=!1}})):this.quotaItems=[]},editProfile(){uni.navigateTo({url:"/pages/profile/edit-profile"})},goToMyWorks(){uni.navigateTo({url:"/pages/revival/revival-history"})},goToHistory(){uni.navigateTo({url:"/pages/revival/revival-history"})},goToSettings(){uni.navigateTo({url:"/pages/settings/settings"})},goToComplaint(){uni.navigateTo({url:"/pages/settings/complaint"})},goToAbout(){uni.navigateTo({url:"/pages/settings/about"})},goToCustomerService(){uni.navigateTo({url:"/pages/customer-service/customer-service"})},shareApp(){uni.showActionSheet({itemList:["复制链接","分享给好友"],success:e=>{0===e.tapIndex?this.copyDownloadLink():1===e.tapIndex&&this.shareToFriends()}})},copyDownloadLink(){const e=`${i}/static/1.txt`;uni.setClipboardData({data:e,success:()=>{uni.showToast({title:"链接已复制",icon:"success"})}})},shareToFriends(){const e="推荐一款AI声音克隆应用「时光意境」,可以克隆声音、复活照片,快来体验吧!\n下载地址:"+`${i}/static/1.txt`;if("Android"===plus.os.name){const t=plus.android.importClass("android.content.Intent"),a=plus.android.runtimeMainActivity(),o=new t(t.ACTION_SEND);o.setType("text/plain"),o.putExtra(t.EXTRA_TEXT,e),a.startActivity(t.createChooser(o,"分享到"))}else uni.setClipboardData({data:e,success:()=>{uni.showToast({title:"分享内容已复制,快去粘贴分享吧",icon:"none",duration:2e3})}})},goToLogin(){uni.navigateTo({url:"/pages/login/login"})},handleLogout(){uni.showModal({title:"退出登录",content:"确定要退出登录吗?",success:e=>{e.confirm&&(uni.removeStorageSync("token"),uni.removeStorageSync("userId"),uni.removeStorageSync("userInfo"),uni.removeStorageSync("nickname"),uni.removeStorageSync("userNickname"),uni.removeStorageSync("userPhone"),uni.removeStorageSync("username"),uni.removeStorageSync("avatarUrl"),uni.showToast({title:"已退出登录",icon:"success",duration:1500}),setTimeout((()=>{uni.reLaunch({url:"/pages/login/login"})}),1500))}})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"my-container"},[e.createElementVNode("view",{class:"user-section"},[e.createElementVNode("view",{class:"user-info"},[e.createElementVNode("view",{class:"avatar"},[e.createElementVNode("text",{class:"avatar-text"},e.toDisplayString(s.userInfo.nickname?s.userInfo.nickname[0]:"我"),1)]),e.createElementVNode("view",{class:"user-details"},[e.createElementVNode("text",{class:"nickname"},e.toDisplayString(s.isLoggedIn?s.userInfo.nickname||"未设置昵称":"未登录"),1),s.isLoggedIn?l.displayPhone?(e.openBlock(),e.createElementBlock("text",{key:1,class:"user-id"},e.toDisplayString(l.displayPhone),1)):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("text",{key:0,class:"user-id"},"点击登录按钮登录"))])]),s.isLoggedIn?(e.openBlock(),e.createElementBlock("view",{key:0,class:"edit-btn",onClick:a[0]||(a[0]=(...e)=>l.editProfile&&l.editProfile(...e))},[e.createElementVNode("text",null,"编辑")])):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"stats-section"},[e.createElementVNode("view",{class:"stat-item",onClick:a[1]||(a[1]=(...e)=>l.goToMyWorks&&l.goToMyWorks(...e))},[e.createElementVNode("text",{class:"stat-number"},e.toDisplayString(s.worksCount),1),e.createElementVNode("text",{class:"stat-label"},"我的视频")]),e.createElementVNode("view",{class:"stat-divider"}),e.createElementVNode("view",{class:"stat-item",onClick:a[2]||(a[2]=(...e)=>l.goToHistory&&l.goToHistory(...e))},[e.createElementVNode("text",{class:"stat-number"},e.toDisplayString(s.historyCount),1),e.createElementVNode("text",{class:"stat-label"},"历史记录")])]),s.isLoggedIn?(e.openBlock(),e.createElementBlock("view",{key:0,class:"quota-section"},[e.createElementVNode("view",{class:"quota-header"},[e.createElementVNode("text",{class:"quota-title"},"剩余可用次数"),s.quotaLoading?(e.openBlock(),e.createElementBlock("text",{key:0,class:"quota-sub"},"加载中...")):(e.openBlock(),e.createElementBlock("text",{key:1,class:"quota-sub"},"含已购次数/失败补发次数"))]),s.quotaItems&&s.quotaItems.length?(e.openBlock(),e.createElementBlock("view",{key:0,class:"quota-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.quotaItems,((t,a)=>(e.openBlock(),e.createElementBlock("view",{class:"quota-item",key:a},[e.createElementVNode("text",{class:"quota-name"},e.toDisplayString(t.serviceName||t.serviceType),1),e.createElementVNode("text",{class:"quota-count"},e.toDisplayString(t.remainingTotalCount),1)])))),128))])):s.quotaLoading?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("view",{key:1,class:"quota-empty"},[e.createElementVNode("text",null,"暂无可用次数")]))])):e.createCommentVNode("",!0),e.createElementVNode("view",{class:"menu-section"},[e.createElementVNode("view",{class:"menu-group"},[e.createElementVNode("view",{class:"menu-item",onClick:a[3]||(a[3]=(...e)=>l.goToMyWorks&&l.goToMyWorks(...e))},[e.createElementVNode("view",{class:"menu-icon works-icon"},"🎬"),e.createElementVNode("text",{class:"menu-text"},"我的视频"),e.createElementVNode("text",{class:"menu-arrow"},"›")]),e.createElementVNode("view",{class:"menu-item",onClick:a[4]||(a[4]=(...e)=>l.goToHistory&&l.goToHistory(...e))},[e.createElementVNode("view",{class:"menu-icon history-icon"},"🕐"),e.createElementVNode("text",{class:"menu-text"},"历史记录"),e.createElementVNode("text",{class:"menu-arrow"},"›")])]),e.createElementVNode("view",{class:"menu-group"},[e.createElementVNode("view",{class:"menu-item",onClick:a[5]||(a[5]=(...e)=>l.goToCustomerService&&l.goToCustomerService(...e))},[e.createElementVNode("view",{class:"menu-icon service-icon"},"💬"),e.createElementVNode("text",{class:"menu-text"},"智能客服"),e.createElementVNode("text",{class:"menu-arrow"},"›")]),e.createElementVNode("view",{class:"menu-item",onClick:a[6]||(a[6]=(...e)=>l.goToSettings&&l.goToSettings(...e))},[e.createElementVNode("view",{class:"menu-icon settings-icon"},"⚙️"),e.createElementVNode("text",{class:"menu-text"},"设置"),e.createElementVNode("text",{class:"menu-arrow"},"›")]),e.createElementVNode("view",{class:"menu-item",onClick:a[7]||(a[7]=(...e)=>l.goToComplaint&&l.goToComplaint(...e))},[e.createElementVNode("view",{class:"menu-icon complaint-icon"},"📝"),e.createElementVNode("text",{class:"menu-text"},"投诉建议"),e.createElementVNode("text",{class:"menu-arrow"},"›")]),e.createElementVNode("view",{class:"menu-item",onClick:a[8]||(a[8]=(...e)=>l.goToAbout&&l.goToAbout(...e))},[e.createElementVNode("view",{class:"menu-icon about-icon"},"ℹ️"),e.createElementVNode("text",{class:"menu-text"},"关于我们"),e.createElementVNode("text",{class:"menu-arrow"},"›")]),e.createElementVNode("view",{class:"menu-item",onClick:a[9]||(a[9]=(...e)=>l.shareApp&&l.shareApp(...e))},[e.createElementVNode("view",{class:"menu-icon share-icon"},"🔗"),e.createElementVNode("text",{class:"menu-text"},"分享给好友"),e.createElementVNode("text",{class:"menu-arrow"},"›")])])]),e.createElementVNode("view",{class:"logout-section"},[s.isLoggedIn?(e.openBlock(),e.createElementBlock("button",{key:0,class:"logout-btn",onClick:a[10]||(a[10]=(...e)=>l.handleLogout&&l.handleLogout(...e))},"退出登录")):(e.openBlock(),e.createElementBlock("button",{key:1,class:"login-btn",onClick:a[11]||(a[11]=(...e)=>l.goToLogin&&l.goToLogin(...e))},"登录"))])])}],["__scopeId","data-v-ca476d9a"]]);const M=d({data:()=>({API_BASE:i,lastUserId:null,loading:!1,videos:[],selectedVideoId:"",selectedVideoName:"",selectedVideoUrl:"",selectedVoiceId:"",selectedDialect:"",selectedLanguageHint:"",selectedLanguageHintLabel:"",languageHintOptions:["中文(zh)","英文(en)","法语(fr)","德语(de)","日语(ja)","韩语(ko)","俄语(ru)"],dialectOptions:["广东话","东北话","甘肃话","贵州话","河南话","湖北话","江西话","闽南话","宁夏话","山西话","陕西话","山东话","上海话","四川话","天津话","云南话"],callStarted:!1,callStatus:"视频通话中",callDuration:"00:00",callStartTime:null,durationTimer:null,messages:[],scrollTop:0,isRecording:!1,isProcessing:!1,isSpeaking:!1,processingText:"处理中...",recorderManager:null,audioFilePath:"",audioContext:null,showSettingsDialog:!1,dialogMemoryIdentity:"",dialogMemoryInfo:"",dialogMemoryCatchphrase:""}),onLoad(){t("log","at pages/phone-call/phone-call.vue:283","[PhoneCall] 页面加载");const e=uni.getStorageSync("userId");this.lastUserId=e,this.loadVideos(),this.initRecorder(),this.initAudioContext()},onShow(){t("log","at pages/phone-call/phone-call.vue:292","[PhoneCall] 页面显示");const e=uni.getStorageSync("userId");this.lastUserId=e,this.callStarted||this.$nextTick((()=>{setTimeout((()=>{this.loadVideos()}),100)}))},onUnload(){this.cleanup()},methods:{async loadVideos(){this.loading=!0;const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";uni.request({url:`${this.API_BASE}/api/photo-revival/videos`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:e=>{if(t("log","at pages/phone-call/phone-call.vue:329","[PhoneCall] 视频列表响应状态码:",e.statusCode),t("log","at pages/phone-call/phone-call.vue:330","[PhoneCall] 视频列表响应数据:",e.data),t("log","at pages/phone-call/phone-call.vue:331","[PhoneCall] 数据类型:",typeof e.data),200===e.statusCode){let a=[];Array.isArray(e.data)?a=e.data:e.data&&Array.isArray(e.data.data)?a=e.data.data:e.data&&e.data.videos&&Array.isArray(e.data.videos)&&(a=e.data.videos),a=a.filter((e=>{const t=e.name&&(e.name.startsWith("生成失败")||e.name.startsWith("生成失败:")),a=e.edited_video_url||e.video_url||e.local_video_path||e.videoUrl||e.localVideoPath,o=a&&""!==a.trim();return!t&&o})),this.videos=a,t("log","at pages/phone-call/phone-call.vue:363","[PhoneCall] 加载视频列表成功:",this.videos.length),t("log","at pages/phone-call/phone-call.vue:364","[PhoneCall] 视频列表:",this.videos)}else t("error","at pages/phone-call/phone-call.vue:366","[PhoneCall] 响应状态码异常:",e.statusCode)},fail:e=>{t("error","at pages/phone-call/phone-call.vue:370","[PhoneCall] 加载视频列表失败:",e),uni.showToast({title:"加载失败",icon:"none"})},complete:()=>{this.loading=!1}})},selectVideo(e){t("log","at pages/phone-call/phone-call.vue:384","[PhoneCall] 选择视频:",e),this.selectedVideoId=e.id,this.selectedVideoName=e.name||"复活视频",this.selectedVideoUrl=e.edited_video_url||e.local_video_path||e.video_url,this.selectedVoiceId=e.voice_id,this.selectedDialect="",this.selectedLanguageHint="",this.selectedLanguageHintLabel="",t("log","at pages/phone-call/phone-call.vue:392","[PhoneCall] 选择视频:",this.selectedVideoId,"名称:",this.selectedVideoName),t("log","at pages/phone-call/phone-call.vue:393","[PhoneCall] 视频URL:",this.selectedVideoUrl)},onDialectChange(e){this.selectedDialect=this.dialectOptions[e.detail.value]||""},onLanguageHintChange(e){const t=this.languageHintOptions[e.detail.value]||"";this.selectedLanguageHintLabel=t;const a=t.match(/\(([^)]+)\)/);this.selectedLanguageHint=a&&a[1]?a[1]:""},startCall(){if(!this.selectedVideoId)return void uni.showToast({title:"请先选择视频",icon:"none"});t("log","at pages/phone-call/phone-call.vue:417","[PhoneCall] 准备视频通话,视频ID:",this.selectedVideoId);const e=this.videos.find((e=>e.id===this.selectedVideoId));if(!e)return void uni.showToast({title:"视频信息丢失",icon:"none"});const a=e.edited_video_url||e.videoUrl||e.local_video_path||e.video_url||e.localVideoPath||"",o=e.name||"复活视频",i=this.selectedVoiceId||"";t("log","at pages/phone-call/phone-call.vue:434","[PhoneCall] 跳转参数:",{videoId:this.selectedVideoId,videoName:o,videoUrl:a,voiceId:i}),uni.navigateTo({url:`/pages/video-call-new/video-call-new?videoId=${this.selectedVideoId}&videoName=${encodeURIComponent(o)}&videoUrl=${encodeURIComponent(a)}&voiceId=${i}`,success:()=>{t("log","at pages/phone-call/phone-call.vue:445","[PhoneCall] 跳转到视频通话页面成功")},fail:e=>{t("error","at pages/phone-call/phone-call.vue:448","[PhoneCall] 跳转失败:",e),uni.showToast({title:"跳转失败",icon:"none"})}})},closeSettingsDialog(){this.showSettingsDialog=!1},confirmSettings(){this.showSettingsDialog=!1},startCallTimer(){this.callStartTime=Date.now(),this.durationTimer=setInterval((()=>{const e=Math.floor((Date.now()-this.callStartTime)/1e3),t=Math.floor(e/60).toString().padStart(2,"0"),a=(e%60).toString().padStart(2,"0");this.callDuration=`${t}:${a}`}),1e3)},initRecorder(){this.recorderManager=uni.getRecorderManager(),this.recorderManager.onStart((()=>{t("log","at pages/phone-call/phone-call.vue:483","[PhoneCall] 开始录音")})),this.recorderManager.onStop((e=>{t("log","at pages/phone-call/phone-call.vue:487","[PhoneCall] 录音完成:",e.tempFilePath),this.audioFilePath=e.tempFilePath,this.processConversation()})),this.recorderManager.onError((e=>{t("error","at pages/phone-call/phone-call.vue:493","[PhoneCall] 录音失败:",e),this.isRecording=!1,uni.showToast({title:"录音失败",icon:"none"})}))},initAudioContext(){this.audioContext=uni.createInnerAudioContext(),this.audioContext.onPlay((()=>{t("log","at pages/phone-call/phone-call.vue:507","[PhoneCall] 开始播放AI回复"),this.isSpeaking=!0,this.callStatus="对方正在说话...",uni.vibrateShort({type:"light"})})),this.audioContext.onEnded((()=>{t("log","at pages/phone-call/phone-call.vue:518","[PhoneCall] AI回复播放完成"),this.isSpeaking=!1,this.callStatus="通话中"})),this.audioContext.onError((e=>{t("error","at pages/phone-call/phone-call.vue:524","[PhoneCall] 音频播放失败:",e),this.isSpeaking=!1,this.callStatus="通话中"}))},startRecording(){this.isProcessing||(this.isRecording=!0,this.recorderManager.start({format:"mp3",sampleRate:16e3}),this.callStatus="正在录音...",uni.vibrateShort({type:"medium"}))},stopRecording(){this.isRecording&&(this.isRecording=!1,this.recorderManager.stop(),this.isProcessing=!0,this.processingText="识别中...",this.callStatus="处理中...")},async processConversation(){try{this.processingText="正在识别...";const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";uni.uploadFile({url:`${this.API_BASE}/api/conversation/talk`,filePath:this.audioFilePath,name:"audio",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},formData:(()=>{const e=this.selectedVoiceId,t=(()=>{const t=(e||"").trim();if(!t)return"CLONE";return["Cherry","Kai","Mochi","Bunny","Jada","Dylan","Li","Marcus","Roy","Peter","Sunny","Eric","Rocky","Kiki"].includes(t)||t.startsWith("BV")||t.endsWith("_streaming")||t.endsWith("_offline")||t.endsWith("_bigtts")?"OFFICIAL":"CLONE"})(),a={voiceId:e,voiceType:t};return this.selectedDialect&&(a.dialect=this.selectedDialect),this.selectedLanguageHint&&(a.languageHints=this.selectedLanguageHint),a})(),success:e=>{if(t("log","at pages/phone-call/phone-call.vue:595","[PhoneCall] 对话响应:",e),200!==e.statusCode)throw new Error("对话请求失败");{const t=JSON.parse(e.data);if(!t.success)throw new Error(t.message||"对话失败");this.addMessage("user",t.recognizedText),this.addMessage("ai",t.aiResponse),this.playAIResponse(t.audioFile)}},fail:e=>{t("error","at pages/phone-call/phone-call.vue:617","[PhoneCall] 对话失败:",e),uni.showToast({title:"对话失败",icon:"none"}),this.isProcessing=!1,this.callStatus="通话中"}})}catch(e){t("error","at pages/phone-call/phone-call.vue:627","[PhoneCall] 对话失败:",e),uni.showToast({title:"对话失败: "+e.message,icon:"none"}),this.isProcessing=!1,this.callStatus="通话中"}},playAIResponse(e){this.processingText="正在回复...",this.audioContext.src=`${this.API_BASE}/api/conversation/audio/${e}`,this.audioContext.play(),this.isProcessing=!1},addMessage(e,t){const a=new Date,o=`${a.getHours()}:${a.getMinutes().toString().padStart(2,"0")}`;this.messages.push({role:e,content:t,time:o}),this.$nextTick((()=>{this.scrollTop=999999}))},handleClearHistory(){uni.showModal({title:"确认清空",content:"确定要清空对话历史吗?",success:e=>{if(e.confirm){const e=uni.getStorageSync("userId")||"",t=uni.getStorageSync("token")||"";uni.request({url:`${this.API_BASE}/api/conversation/clear-history`,method:"POST",header:{"X-User-Id":e,Authorization:t?`Bearer ${t}`:""},success:e=>{e.data.success&&(this.messages=[],uni.showToast({title:"已清空",icon:"success"}))}})}}})},endCall(){uni.showModal({title:"结束通话",content:`通话时长:${this.callDuration}\n确定要结束通话吗?`,confirmColor:"#eb3349",success:e=>{e.confirm&&(uni.vibrateShort({type:"heavy"}),uni.showLoading({title:"正在挂断...",mask:!0}),setTimeout((()=>{uni.hideLoading(),this.cleanup(),uni.showToast({title:"通话已结束",icon:"success",duration:1500,success:()=>{setTimeout((()=>{uni.navigateBack()}),1500)}})}),800))}})},goToRevival(){t("log","at pages/phone-call/phone-call.vue:737","[PhoneCall] 跳转到复活照片页面"),uni.navigateTo({url:"/pages/revival/revival-original",success:()=>{t("log","at pages/phone-call/phone-call.vue:741","[PhoneCall] 跳转成功")},fail:e=>{t("error","at pages/phone-call/phone-call.vue:744","[PhoneCall] 跳转失败:",e)}})},cleanup(){this.durationTimer&&clearInterval(this.durationTimer),this.audioContext&&this.audioContext.destroy(),this.recorderManager&&this.recorderManager.stop()},formatTime(e){if(!e)return"";let t=e;String(e).length<=10&&(t=1e3*e);const a=new Date(t);if(isNaN(a.getTime()))return"时间格式错误";return`${a.getFullYear()}年${String(a.getMonth()+1).padStart(2,"0")}月${String(a.getDate()).padStart(2,"0")}日 ${String(a.getHours()).padStart(2,"0")}:${String(a.getMinutes()).padStart(2,"0")}`}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"phone-call-container"},[e.createElementVNode("view",{class:"memorial-content"},[e.createElementVNode("view",{class:"revival-btn-section"},[e.createElementVNode("button",{class:"revival-btn",onClick:a[0]||(a[0]=(...e)=>l.goToRevival&&l.goToRevival(...e))},[e.createElementVNode("text",{class:"btn-icon"},"🎬"),e.createElementVNode("text",{class:"btn-text"},"复活照片")])]),s.callStarted?(e.openBlock(),e.createElementBlock("view",{key:1,class:"call-active-section"},[e.createElementVNode("view",{class:"video-call-card"},[e.createElementVNode("view",{class:"video-container"},[s.selectedVideoUrl?(e.openBlock(),e.createElementBlock("video",{key:0,src:s.selectedVideoUrl,class:"video-player",loop:!0,autoplay:!1,controls:!1,"show-center-play-btn":!1,"object-fit":"contain"},null,8,["src"])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"video-placeholder"},[e.createElementVNode("text",{class:"placeholder-icon"},"🎬"),e.createElementVNode("text",{class:"placeholder-text"},"视频加载中...")]))]),e.createElementVNode("text",{class:"call-video-name"},e.toDisplayString(s.selectedVideoName),1),e.createElementVNode("text",{class:e.normalizeClass(["call-status",{"status-active":s.isSpeaking||s.isRecording}])},e.toDisplayString(s.callStatus),3),e.createElementVNode("text",{class:"call-duration"},e.toDisplayString(s.callDuration),1)]),e.createElementVNode("scroll-view",{"scroll-y":"",class:"chat-history","scroll-top":s.scrollTop},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.messages,((t,a)=>(e.openBlock(),e.createElementBlock("view",{key:a,class:e.normalizeClass(["message-item",t.role])},[e.createElementVNode("view",{class:"message-avatar"},e.toDisplayString("user"===t.role?"👤":"🤖"),1),e.createElementVNode("view",{class:"message-bubble"},[e.createElementVNode("text",{class:"message-text"},e.toDisplayString(t.content),1),e.createElementVNode("text",{class:"message-time"},e.toDisplayString(t.time),1)])],2)))),128)),0===s.messages.length?(e.openBlock(),e.createElementBlock("view",{key:0,class:"empty-chat"},[e.createElementVNode("text",{class:"empty-chat-icon"},"💬"),e.createElementVNode("text",{class:"empty-chat-text"},"按住下方按钮开始说话")])):e.createCommentVNode("",!0)],8,["scroll-top"]),e.createElementVNode("view",{class:"controls"},[s.selectedVoiceId&&s.selectedVoiceId.startsWith("cosyvoice-v3-plus-")?(e.openBlock(),e.createElementBlock("view",{key:0,class:"form-section"},[e.createElementVNode("view",{class:"form-label"},"方言"),e.createElementVNode("picker",{mode:"selector",range:s.dialectOptions,onChange:a[2]||(a[2]=(...e)=>l.onDialectChange&&l.onDialectChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.selectedDialect||"请选择方言(可选)"),1)],40,["range"])])):e.createCommentVNode("",!0),s.selectedVoiceId&&s.selectedVoiceId.startsWith("cosyvoice-v3-plus-")?(e.openBlock(),e.createElementBlock("view",{key:1,class:"form-section"},[e.createElementVNode("view",{class:"form-label"},"语言提示(可选)"),e.createElementVNode("picker",{mode:"selector",range:s.languageHintOptions,onChange:a[3]||(a[3]=(...e)=>l.onLanguageHintChange&&l.onLanguageHintChange(...e))},[e.createElementVNode("view",{class:"picker-large"},e.toDisplayString(s.selectedLanguageHintLabel||"请选择语言(可选)"),1)],40,["range"]),e.createElementVNode("view",{class:"hint-text"},"💡 仅处理第一个值;不设置不生效")])):e.createCommentVNode("",!0),e.createElementVNode("view",{class:"record-control"},[s.isRecording||s.isProcessing?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"record-btn idle",onTouchstart:a[4]||(a[4]=(...e)=>l.startRecording&&l.startRecording(...e)),onTouchend:a[5]||(a[5]=(...e)=>l.stopRecording&&l.stopRecording(...e))},[e.createElementVNode("view",{class:"record-btn-icon"},"🎤"),e.createElementVNode("text",{class:"record-btn-text"},"按住说话")],32)),s.isRecording?(e.openBlock(),e.createElementBlock("button",{key:1,class:"record-btn recording",onTouchend:a[6]||(a[6]=(...e)=>l.stopRecording&&l.stopRecording(...e))},[e.createElementVNode("view",{class:"record-btn-icon pulse"},"🔴"),e.createElementVNode("text",{class:"record-btn-text"},"松开发送")],32)):e.createCommentVNode("",!0),s.isProcessing?(e.openBlock(),e.createElementBlock("button",{key:2,class:"record-btn processing",disabled:""},[e.createElementVNode("view",{class:"record-btn-icon"},"⏳"),e.createElementVNode("text",{class:"record-btn-text"},e.toDisplayString(s.processingText),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"action-buttons"},[e.createElementVNode("button",{class:"action-btn",onClick:a[7]||(a[7]=(...e)=>l.handleClearHistory&&l.handleClearHistory(...e))},[e.createElementVNode("image",{src:x,class:"delete-icon",mode:"aspectFit"}),e.createElementVNode("text",{class:"action-btn-text"},"清空")]),e.createElementVNode("button",{class:"action-btn end-call",onClick:a[8]||(a[8]=(...e)=>l.endCall&&l.endCall(...e))},[e.createElementVNode("text",{class:"action-btn-icon"},"📵"),e.createElementVNode("text",{class:"action-btn-text"},"挂断")])])])])):(e.openBlock(),e.createElementBlock("view",{key:0,class:"select-video-section"},[e.createElementVNode("view",{class:"section-card"},[e.createElementVNode("view",{class:"card-title"},"🎬 选择复活视频"),e.createElementVNode("view",{class:"card-desc"},"选择一个已生成的复活视频开始视频通话"),s.loading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"loading-box"},[e.createElementVNode("text",{class:"loading-text"},"⏳ 加载视频列表...")])):s.videos.length>0?(e.openBlock(),e.createElementBlock("view",{key:1,class:"video-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.videos,(t=>(e.openBlock(),e.createElementBlock("view",{key:t.id,class:e.normalizeClass(["video-card",s.selectedVideoId===t.id?"selected":""]),onClick:e=>l.selectVideo(t)},[e.createElementVNode("view",{class:"video-card-icon"},"🎬"),e.createElementVNode("view",{class:"video-card-content"},[e.createElementVNode("text",{class:"video-card-name"},e.toDisplayString(t.name||"复活视频"),1),e.createElementVNode("text",{class:"video-card-desc"},e.toDisplayString(t.text||"暂无描述"),1),e.createElementVNode("text",{class:"video-card-time"},e.toDisplayString(l.formatTime(t.create_time)),1)]),s.selectedVideoId===t.id?(e.openBlock(),e.createElementBlock("view",{key:0,class:"video-card-check"},"✓")):e.createCommentVNode("",!0)],10,["onClick"])))),128))])):(e.openBlock(),e.createElementBlock("view",{key:2,class:"empty-box"},[e.createElementVNode("text",{class:"empty-icon"},"🎬"),e.createElementVNode("text",{class:"empty-text"},"暂无复活视频"),e.createElementVNode("text",{class:"empty-hint"},'请先点击上方"复活照片"生成视频')])),s.videos.length>0?(e.openBlock(),e.createElementBlock("button",{key:3,class:"start-call-btn",disabled:!s.selectedVideoId,onClick:a[1]||(a[1]=(...e)=>l.startCall&&l.startCall(...e))},[s.selectedVideoId?(e.openBlock(),e.createElementBlock("text",{key:0},"📞 开始视频通话")):(e.openBlock(),e.createElementBlock("text",{key:1},"请先选择视频"))],8,["disabled"])):e.createCommentVNode("",!0)])]))]),s.showSettingsDialog?(e.openBlock(),e.createElementBlock("view",{key:0,class:"settings-dialog-mask",onClick:a[16]||(a[16]=(...e)=>l.closeSettingsDialog&&l.closeSettingsDialog(...e))},[e.createElementVNode("view",{class:"settings-dialog",onClick:a[15]||(a[15]=e.withModifiers((()=>{}),["stop"]))},[e.createElementVNode("view",{class:"dialog-header"},[e.createElementVNode("text",{class:"dialog-title"},"💭 通话设置"),e.createElementVNode("text",{class:"dialog-close",onClick:a[9]||(a[9]=(...e)=>l.closeSettingsDialog&&l.closeSettingsDialog(...e))},"✕")]),e.createElementVNode("view",{class:"dialog-content"},[e.createElementVNode("view",{class:"dialog-section"},[e.createElementVNode("view",{class:"section-label"},"💭 记忆设定(可选)"),e.createElementVNode("text",{class:"section-hint"},"设置对话记忆,让AI更真实地模拟对方"),e.createElementVNode("view",{class:"memory-item"},[e.createElementVNode("text",{class:"memory-label"},"身份"),e.withDirectives(e.createElementVNode("input",{class:"memory-input","onUpdate:modelValue":a[10]||(a[10]=e=>s.dialogMemoryIdentity=e),placeholder:"例如:我的母亲",maxlength:"50"},null,512),[[e.vModelText,s.dialogMemoryIdentity]])]),e.createElementVNode("view",{class:"memory-item"},[e.createElementVNode("text",{class:"memory-label"},"性格特点"),e.withDirectives(e.createElementVNode("textarea",{class:"memory-textarea","onUpdate:modelValue":a[11]||(a[11]=e=>s.dialogMemoryInfo=e),placeholder:"例如:温柔体贴,喜欢养花,做饭很拿手...",maxlength:"200"},null,512),[[e.vModelText,s.dialogMemoryInfo]])]),e.createElementVNode("view",{class:"memory-item"},[e.createElementVNode("text",{class:"memory-label"},"口头禅"),e.withDirectives(e.createElementVNode("input",{class:"memory-input","onUpdate:modelValue":a[12]||(a[12]=e=>s.dialogMemoryCatchphrase=e),placeholder:"例如:哎呀、你说是不是",maxlength:"100"},null,512),[[e.vModelText,s.dialogMemoryCatchphrase]])])])]),e.createElementVNode("view",{class:"dialog-footer"},[e.createElementVNode("button",{class:"dialog-btn cancel",onClick:a[13]||(a[13]=(...e)=>l.closeSettingsDialog&&l.closeSettingsDialog(...e))},"取消"),e.createElementVNode("button",{class:"dialog-btn confirm",onClick:a[14]||(a[14]=(...e)=>l.confirmSettings&&l.confirmSettings(...e))},"开始通话")])])])):e.createCommentVNode("",!0)])}],["__scopeId","data-v-707d9eb8"]]);const _=d({data:()=>({phone:"",password:"",showPassword:!1,loading:!1,agreedPrivacy:!1}),methods:{togglePassword(){this.showPassword=!this.showPassword},onPrivacyChange(e){this.agreedPrivacy=e.detail.value.includes("privacy")},viewPrivacy(){uni.navigateTo({url:"/pages/settings/privacy-policy"})},async handleLogin(){if(this.phone)if(/^1[3-9]\d{9}$/.test(this.phone))if(this.password)if(this.agreedPrivacy){this.loading=!0;try{const e=await uni.request({url:`${i}/api/users/login`,method:"POST",header:{"Content-Type":"application/json"},data:{phone:this.phone,password:this.password}}),{statusCode:t,data:a}=e[1]||e;if(200===t&&a&&a.success){const e=a.user||{};uni.setStorageSync("token",a.token||""),uni.setStorageSync("userId",String(e.id||"")),uni.setStorageSync("userPhone",e.phone||""),uni.setStorageSync("userNickname",e.nickname||""),uni.setStorageSync("username",e.username||""),uni.setStorageSync("userInfo",{id:e.id,phone:e.phone,nickname:e.nickname,username:e.username,avatarUrl:e.avatarUrl}),uni.showToast({title:"登录成功",icon:"success",duration:1500}),setTimeout((()=>{const e=getCurrentPages(),t=e[e.length-2];t&&"pages/history/history"===t.route?uni.navigateBack():uni.switchTab({url:"/pages/history/history"})}),1500)}else{const e=(null==a?void 0:a.message)||"登录失败";uni.showToast({title:e,icon:"none",duration:2e3})}}catch(e){t("error","at pages/login/login.vue:304","[Login] 请求失败:",e),uni.showToast({title:"网络错误,请重试",icon:"none",duration:2e3})}finally{this.loading=!1}}else uni.showToast({title:"请先同意隐私政策",icon:"none"});else uni.showToast({title:"请输入密码",icon:"none"});else uni.showToast({title:"手机号格式不正确",icon:"none"});else uni.showToast({title:"请输入手机号",icon:"none"})},forgotPassword(){uni.navigateTo({url:"/pages/forgot-password/forgot-password"})},goToRegister(){uni.navigateTo({url:"/pages/register/register"})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"login-container"},[e.createElementVNode("view",{class:"login-content"},[e.createElementVNode("view",{class:"logo-section"},[e.createElementVNode("view",{class:"logo-circle"},[e.createElementVNode("text",{class:"logo-icon"},"🕊️")]),e.createElementVNode("text",{class:"app-name"},"时光意境"),e.createElementVNode("text",{class:"app-slogan"},"用科技温暖记忆")]),e.createElementVNode("view",{class:"form-section"},[e.createElementVNode("view",{class:"input-group"},[e.createElementVNode("view",{class:"input-icon"},"📱"),e.withDirectives(e.createElementVNode("input",{class:"input-field","onUpdate:modelValue":a[0]||(a[0]=e=>s.phone=e),type:"number",maxlength:"11",placeholder:"请输入手机号"},null,512),[[e.vModelText,s.phone]])]),e.createElementVNode("view",{class:"input-group"},[e.createElementVNode("view",{class:"input-icon"},"🔐"),e.withDirectives(e.createElementVNode("input",{class:"input-field","onUpdate:modelValue":a[1]||(a[1]=e=>s.password=e),password:!s.showPassword,placeholder:"请输入密码"},null,8,["password"]),[[e.vModelText,s.password]]),e.createElementVNode("view",{class:"eye-icon",onClick:a[2]||(a[2]=(...e)=>l.togglePassword&&l.togglePassword(...e))},e.toDisplayString(s.showPassword?"👁️":"👁️‍🗨️"),1)]),e.createElementVNode("view",{class:"forgot-password",onClick:a[3]||(a[3]=(...e)=>l.forgotPassword&&l.forgotPassword(...e))}," 忘记密码? "),e.createElementVNode("view",{class:"privacy-checkbox"},[e.createElementVNode("checkbox-group",{onChange:a[5]||(a[5]=(...e)=>l.onPrivacyChange&&l.onPrivacyChange(...e))},[e.createElementVNode("label",{class:"checkbox-label"},[e.createElementVNode("checkbox",{checked:s.agreedPrivacy,value:"privacy",color:"#8B7355"},null,8,["checked"]),e.createElementVNode("text",{class:"checkbox-text"},[e.createTextVNode(" 我已阅读并同意 "),e.createElementVNode("text",{class:"privacy-link",onClick:a[4]||(a[4]=e.withModifiers(((...e)=>l.viewPrivacy&&l.viewPrivacy(...e)),["stop"]))},"《隐私政策》")])])],32)]),e.createElementVNode("button",{class:"login-btn",onClick:a[6]||(a[6]=(...e)=>l.handleLogin&&l.handleLogin(...e)),disabled:s.loading||!s.agreedPrivacy},[s.loading?(e.openBlock(),e.createElementBlock("text",{key:0},"登录中...")):(e.openBlock(),e.createElementBlock("text",{key:1},"登 录"))],8,["disabled"]),e.createElementVNode("view",{class:"register-section"},[e.createElementVNode("text",{class:"register-text"},"还没有账号?"),e.createElementVNode("text",{class:"register-link",onClick:a[7]||(a[7]=(...e)=>l.goToRegister&&l.goToRegister(...e))},"立即注册")])])])])}],["__scopeId","data-v-84297333"]]);const U=d({data:()=>({phone:"",code:"",password:"",confirmPassword:"",showPassword:!1,showConfirmPassword:!1,agreed:!1,loading:!1,counting:!1,countdown:60,codeText:"获取验证码"}),methods:{goBack(){uni.navigateBack()},togglePassword(){this.showPassword=!this.showPassword},toggleConfirmPassword(){this.showConfirmPassword=!this.showConfirmPassword},checkboxChange(e){this.agreed=e.detail.value.includes("agree")},sendCode(){this.phone?/^1[3-9]\d{9}$/.test(this.phone)?uni.request({url:`${i}/api/sms/send`,method:"POST",header:{"Content-Type":"application/json"},data:{phone:this.phone,purpose:"REGISTER"},success:e=>{var a;if(t("log","at pages/register/register.vue:155","[SendCode] 响应:",e),200===e.statusCode){this.counting=!0,this.countdown=60;const e=setInterval((()=>{this.countdown--,this.codeText=`${this.countdown}秒后重试`,this.countdown<=0&&(clearInterval(e),this.counting=!1,this.codeText="获取验证码")}),1e3);uni.showToast({title:"验证码已发送",icon:"success"})}else uni.showToast({title:(null==(a=e.data)?void 0:a.message)||"发送失败",icon:"none"})},fail:e=>{t("error","at pages/register/register.vue:184","[SendCode] 请求失败:",e),uni.showToast({title:"网络错误,请重试",icon:"none"})}}):uni.showToast({title:"手机号格式不正确",icon:"none"}):uni.showToast({title:"请输入手机号",icon:"none"})},async handleRegister(){this.phone?/^1[3-9]\d{9}$/.test(this.phone)?this.code?this.password?this.password.length<6||this.password.length>20?uni.showToast({title:"密码长度为6-20位",icon:"none"}):this.password===this.confirmPassword?this.agreed?(this.loading=!0,uni.request({url:`${i}/api/users/register`,method:"POST",header:{"Content-Type":"application/json"},data:{username:"user_"+this.phone,phone:this.phone,password:this.password,code:this.code},success:e=>{var t;200===e.statusCode||e.data&&e.data.id?(uni.showToast({title:"注册成功,请登录",icon:"success",duration:1500}),setTimeout((()=>{uni.navigateTo({url:"/pages/login/login"})}),1500)):uni.showToast({title:(null==(t=e.data)?void 0:t.message)||"注册失败",icon:"none",duration:2e3})},fail:e=>{t("error","at pages/register/register.vue:288","[Register] 请求失败:",e),uni.showToast({title:"网络错误,请重试",icon:"none",duration:2e3})},complete:()=>{this.loading=!1}})):uni.showToast({title:"请阅读并同意用户协议",icon:"none"}):uni.showToast({title:"两次密码不一致",icon:"none"}):uni.showToast({title:"请设置密码",icon:"none"}):uni.showToast({title:"请输入验证码",icon:"none"}):uni.showToast({title:"手机号格式不正确",icon:"none"}):uni.showToast({title:"请输入手机号",icon:"none"})},showAgreement(){uni.showModal({title:"用户协议",content:"这里是用户协议的内容...",showCancel:!1})},showPrivacy(){uni.showModal({title:"隐私政策",content:"这里是隐私政策的内容...",showCancel:!1})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"register-container"},[e.createElementVNode("view",{class:"register-content"},[e.createElementVNode("view",{class:"header"},[e.createElementVNode("view",{class:"back-btn",onClick:a[0]||(a[0]=(...e)=>l.goBack&&l.goBack(...e))},[e.createElementVNode("text",null,"← 返回")]),e.createElementVNode("text",{class:"title"},"注册账号")]),e.createElementVNode("view",{class:"form-section"},[e.createElementVNode("view",{class:"input-group"},[e.createElementVNode("view",{class:"input-icon"},"📱"),e.withDirectives(e.createElementVNode("input",{class:"input-field","onUpdate:modelValue":a[1]||(a[1]=e=>s.phone=e),type:"number",maxlength:"11",placeholder:"请输入手机号"},null,512),[[e.vModelText,s.phone]])]),e.createElementVNode("view",{class:"input-group"},[e.createElementVNode("view",{class:"input-icon"},"✉️"),e.withDirectives(e.createElementVNode("input",{class:"input-field","onUpdate:modelValue":a[2]||(a[2]=e=>s.code=e),type:"number",maxlength:"6",placeholder:"请输入验证码"},null,512),[[e.vModelText,s.code]]),e.createElementVNode("button",{class:"code-btn",onClick:a[3]||(a[3]=(...e)=>l.sendCode&&l.sendCode(...e)),disabled:s.counting},e.toDisplayString(s.codeText),9,["disabled"])]),e.createElementVNode("view",{class:"input-group"},[e.createElementVNode("view",{class:"input-icon"},"🔐"),e.withDirectives(e.createElementVNode("input",{class:"input-field","onUpdate:modelValue":a[4]||(a[4]=e=>s.password=e),password:!s.showPassword,placeholder:"请设置密码(6-20位)"},null,8,["password"]),[[e.vModelText,s.password]]),e.createElementVNode("view",{class:"eye-icon",onClick:a[5]||(a[5]=(...e)=>l.togglePassword&&l.togglePassword(...e))},e.toDisplayString(s.showPassword?"👁️":"👁️‍🗨️"),1)]),e.createElementVNode("view",{class:"input-group"},[e.createElementVNode("view",{class:"input-icon"},"🔐"),e.withDirectives(e.createElementVNode("input",{class:"input-field","onUpdate:modelValue":a[6]||(a[6]=e=>s.confirmPassword=e),password:!s.showConfirmPassword,placeholder:"请确认密码"},null,8,["password"]),[[e.vModelText,s.confirmPassword]]),e.createElementVNode("view",{class:"eye-icon",onClick:a[7]||(a[7]=(...e)=>l.toggleConfirmPassword&&l.toggleConfirmPassword(...e))},e.toDisplayString(s.showConfirmPassword?"👁️":"👁️‍🗨️"),1)]),e.createElementVNode("view",{class:"agreement"},[e.createElementVNode("checkbox-group",{onChange:a[10]||(a[10]=(...e)=>l.checkboxChange&&l.checkboxChange(...e))},[e.createElementVNode("label",{class:"agreement-label"},[e.createElementVNode("checkbox",{value:"agree",checked:s.agreed,color:"#8B7355"},null,8,["checked"]),e.createElementVNode("text",{class:"agreement-text"},"我已阅读并同意"),e.createElementVNode("text",{class:"agreement-link",onClick:a[8]||(a[8]=e.withModifiers(((...e)=>l.showAgreement&&l.showAgreement(...e)),["stop"]))},"《用户协议》"),e.createElementVNode("text",{class:"agreement-text"},"和"),e.createElementVNode("text",{class:"agreement-link",onClick:a[9]||(a[9]=e.withModifiers(((...e)=>l.showPrivacy&&l.showPrivacy(...e)),["stop"]))},"《隐私政策》")])],32)]),e.createElementVNode("button",{class:"register-btn",onClick:a[11]||(a[11]=(...e)=>l.handleRegister&&l.handleRegister(...e)),disabled:s.loading},[s.loading?(e.openBlock(),e.createElementBlock("text",{key:0},"注册中...")):(e.openBlock(),e.createElementBlock("text",{key:1},"立即注册"))],8,["disabled"])])])])}],["__scopeId","data-v-4b8d9e1d"]]);const R=d({data:()=>({phone:"",code:"",newPassword:"",confirmPassword:"",showPassword:!1,showConfirmPassword:!1,loading:!1,counting:!1,countdown:60,codeText:"获取验证码"}),methods:{goBack(){uni.navigateBack()},togglePassword(){this.showPassword=!this.showPassword},toggleConfirmPassword(){this.showConfirmPassword=!this.showConfirmPassword},async sendCode(){if(this.phone)if(/^1[3-9]\d{9}$/.test(this.phone))try{const e=await uni.request({url:`${i}/api/sms/send`,method:"POST",header:{"Content-Type":"application/json"},data:{phone:this.phone,purpose:"RESET_PASSWORD"}}),{statusCode:t,data:a}=e[1]||e;if(200===t){this.counting=!0,this.countdown=60;const e=setInterval((()=>{this.countdown--,this.codeText=`${this.countdown}秒后重试`,this.countdown<=0&&(clearInterval(e),this.counting=!1,this.codeText="获取验证码")}),1e3);uni.showToast({title:"验证码已发送",icon:"success"})}else uni.showToast({title:(null==a?void 0:a.message)||"发送失败",icon:"none"})}catch(e){t("error","at pages/forgot-password/forgot-password.vue:165","[ForgotPassword] 发送验证码失败:",e),uni.showToast({title:"网络错误,请重试",icon:"none"})}else uni.showToast({title:"手机号格式不正确",icon:"none"});else uni.showToast({title:"请输入手机号",icon:"none"})},async handleReset(){if(this.phone)if(/^1[3-9]\d{9}$/.test(this.phone))if(this.code)if(this.newPassword)if(this.newPassword.length<6||this.newPassword.length>20)uni.showToast({title:"密码长度为6-20位",icon:"none"});else if(this.newPassword===this.confirmPassword){this.loading=!0;try{const e=await uni.request({url:`${i}/api/users/forgot-password`,method:"POST",header:{"Content-Type":"application/json"},data:{phone:this.phone,code:this.code,newPassword:this.newPassword}}),{statusCode:t,data:a}=e[1]||e;204===t||200===t?(uni.showToast({title:"密码重置成功",icon:"success",duration:1500}),setTimeout((()=>{uni.navigateBack()}),1500)):uni.showToast({title:(null==a?void 0:a.message)||"重置失败",icon:"none",duration:2e3})}catch(e){t("error","at pages/forgot-password/forgot-password.vue:259","[ForgotPassword] 重置密码失败:",e),uni.showToast({title:"网络错误,请重试",icon:"none",duration:2e3})}finally{this.loading=!1}}else uni.showToast({title:"两次密码不一致",icon:"none"});else uni.showToast({title:"请输入新密码",icon:"none"});else uni.showToast({title:"请输入验证码",icon:"none"});else uni.showToast({title:"手机号格式不正确",icon:"none"});else uni.showToast({title:"请输入手机号",icon:"none"})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"forgot-password-container"},[e.createElementVNode("view",{class:"forgot-password-content"},[e.createElementVNode("view",{class:"header"}),e.createElementVNode("view",{class:"form-section"},[e.createElementVNode("view",{class:"input-group"},[e.createElementVNode("view",{class:"input-icon"},"📱"),e.withDirectives(e.createElementVNode("input",{class:"input-field","onUpdate:modelValue":a[0]||(a[0]=e=>s.phone=e),type:"number",maxlength:"11",placeholder:"请输入手机号"},null,512),[[e.vModelText,s.phone]])]),e.createElementVNode("view",{class:"input-group"},[e.createElementVNode("view",{class:"input-icon"},"✉️"),e.withDirectives(e.createElementVNode("input",{class:"input-field","onUpdate:modelValue":a[1]||(a[1]=e=>s.code=e),type:"number",maxlength:"6",placeholder:"请输入验证码"},null,512),[[e.vModelText,s.code]]),e.createElementVNode("button",{class:"code-btn",onClick:a[2]||(a[2]=(...e)=>l.sendCode&&l.sendCode(...e)),disabled:s.counting},e.toDisplayString(s.codeText),9,["disabled"])]),e.createElementVNode("view",{class:"input-group"},[e.createElementVNode("view",{class:"input-icon"},"🔐"),e.withDirectives(e.createElementVNode("input",{class:"input-field","onUpdate:modelValue":a[3]||(a[3]=e=>s.newPassword=e),password:!s.showPassword,placeholder:"请输入新密码(6-20位)"},null,8,["password"]),[[e.vModelText,s.newPassword]]),e.createElementVNode("view",{class:"eye-icon",onClick:a[4]||(a[4]=(...e)=>l.togglePassword&&l.togglePassword(...e))},e.toDisplayString(s.showPassword?"👁️":"👁️‍🗨️"),1)]),e.createElementVNode("view",{class:"input-group"},[e.createElementVNode("view",{class:"input-icon"},"🔐"),e.withDirectives(e.createElementVNode("input",{class:"input-field","onUpdate:modelValue":a[5]||(a[5]=e=>s.confirmPassword=e),password:!s.showConfirmPassword,placeholder:"请确认新密码"},null,8,["password"]),[[e.vModelText,s.confirmPassword]]),e.createElementVNode("view",{class:"eye-icon",onClick:a[6]||(a[6]=(...e)=>l.toggleConfirmPassword&&l.toggleConfirmPassword(...e))},e.toDisplayString(s.showConfirmPassword?"👁️":"👁️‍🗨️"),1)]),e.createElementVNode("button",{class:"reset-btn",onClick:a[7]||(a[7]=(...e)=>l.handleReset&&l.handleReset(...e)),disabled:s.loading},[s.loading?(e.openBlock(),e.createElementBlock("text",{key:0},"重置中...")):(e.openBlock(),e.createElementBlock("text",{key:1},"重置密码"))],8,["disabled"])])])])}],["__scopeId","data-v-e27ba262"]]);const F=d({data:()=>({API_BASE:i,activeTab:0,loading:!1,tabs:[{name:"全部",type:"all"},{name:"声音克隆",type:"voice"},{name:"照片复活",type:"photo"},{name:"视频对话",type:"video"}],allWorks:[{id:1,type:"voice",typeName:"声音克隆",title:"妈妈的声音",time:"2024-12-01 10:30",icon:"🎤",cover:""},{id:2,type:"photo",typeName:"照片复活",title:"爷爷的照片",time:"2024-11-28 15:20",icon:"📸",cover:""},{id:3,type:"video",typeName:"视频对话",title:"与奶奶的对话",time:"2024-11-25 09:15",icon:"🎬",cover:""}]}),computed:{currentWorks(){if(0===this.activeTab)return this.allWorks;const e=this.tabs[this.activeTab].type;return this.allWorks.filter((t=>t.type===e))}},onLoad(){this.loadWorks()},methods:{loadWorks(){this.loading=!0;const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";uni.request({url:`${this.API_BASE}/api/works?userId=${e}&page=0&size=100`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:a=>{t("log","at pages/my-works/my-works.vue:131","[Works] 用户ID:",e),t("log","at pages/my-works/my-works.vue:132","[Works] API响应:",a.data),a.data&&a.data.content&&(this.allWorks=a.data.content.map((e=>({id:e.id,type:this.getWorkTypeKey(e.workType),typeName:this.getWorkTypeName(e.workType),title:e.title||"作品",time:new Date(e.createdAt).toLocaleString("zh-CN"),icon:this.getIconByWorkType(e.workType),cover:e.coverUrl||""}))))},fail:e=>{t("error","at pages/my-works/my-works.vue:147","[Works] 加载失败:",e)},complete:()=>{this.loading=!1}})},getWorkTypeKey:e=>({VOICE_CLONE:"voice",PHOTO_REVIVAL:"photo",VIDEO_CALL:"video"}[e]||"voice"),getWorkTypeName:e=>({VOICE_CLONE:"声音克隆",PHOTO_REVIVAL:"照片复活",VIDEO_CALL:"视频对话"}[e]||"作品"),getIconByWorkType:e=>({VOICE_CLONE:"🎤",PHOTO_REVIVAL:"📸",VIDEO_CALL:"📞"}[e]||"📦"),viewWork(e){uni.showToast({title:"查看作品:"+e.title,icon:"none"})},shareWork(e){uni.showActionSheet({itemList:["分享到微信","分享到朋友圈","复制链接"],success:e=>{uni.showToast({title:"分享成功",icon:"success"})}})},deleteWork(e){uni.showModal({title:"确认删除",content:`确定要删除作品"${e.title}"吗?`,success:t=>{if(t.confirm){const t=this.allWorks.findIndex((t=>t.id===e.id));t>-1&&(this.allWorks.splice(t,1),uni.showToast({title:"删除成功",icon:"success"}))}}})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"works-container"},[e.createElementVNode("view",{class:"tabs"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.tabs,((t,a)=>(e.openBlock(),e.createElementBlock("view",{key:a,class:e.normalizeClass(["tab-item",s.activeTab===a?"active":""]),onClick:e=>s.activeTab=a},e.toDisplayString(t.name),11,["onClick"])))),128))]),e.createElementVNode("scroll-view",{"scroll-y":"",class:"works-list"},[s.loading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"loading-box"},[e.createElementVNode("text",{class:"loading-text"},"⏳ 加载中...")])):0===l.currentWorks.length?(e.openBlock(),e.createElementBlock("view",{key:1,class:"empty-box"},[e.createElementVNode("text",{class:"empty-icon"},"📦"),e.createElementVNode("text",{class:"empty-text"},"暂无作品"),e.createElementVNode("text",{class:"empty-hint"},"快去创建你的第一个作品吧")])):(e.openBlock(),e.createElementBlock("view",{key:2,class:"works-grid"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.currentWorks,(t=>(e.openBlock(),e.createElementBlock("view",{key:t.id,class:"work-card",onClick:e=>l.viewWork(t)},[e.createElementVNode("view",{class:"work-cover"},[t.cover?(e.openBlock(),e.createElementBlock("image",{key:0,src:t.cover,mode:"aspectFill",class:"cover-img"},null,8,["src"])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"cover-placeholder"},[e.createElementVNode("text",{class:"placeholder-icon"},e.toDisplayString(t.icon),1)])),e.createElementVNode("view",{class:"work-type"},e.toDisplayString(t.typeName),1)]),e.createElementVNode("view",{class:"work-info"},[e.createElementVNode("text",{class:"work-title"},e.toDisplayString(t.title),1),e.createElementVNode("text",{class:"work-time"},e.toDisplayString(t.time),1)]),e.createElementVNode("view",{class:"work-actions"},[e.createElementVNode("view",{class:"action-btn",onClick:e.withModifiers((e=>l.shareWork(t)),["stop"])},[e.createElementVNode("text",{class:"action-icon"},"📤")],8,["onClick"]),e.createElementVNode("view",{class:"action-btn",onClick:e.withModifiers((e=>l.deleteWork(t)),["stop"])},[e.createElementVNode("image",{src:x,class:"delete-icon",mode:"aspectFit"})],8,["onClick"])])],8,["onClick"])))),128))]))])])}],["__scopeId","data-v-375fbda9"]]);const $=d({data:()=>({phone:"",cacheSize:"12.5MB",userInfo:{nickname:"",avatar:""},useWechatService:!0,servicePhone:""}),onLoad(){this.loadSettings(),this.loadServiceConfig(),this.calculateCacheSize()},methods:{loadSettings(){const e=uni.getStorageSync("userInfo");e&&e.phone&&(this.phone=e.phone.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2"))},editProfile(){uni.navigateTo({url:"/pages/profile/edit-profile"})},changePassword(){uni.navigateTo({url:"/pages/settings/change-password"})},bindPhone(){uni.navigateTo({url:"/pages/settings/bind-phone"})},clearCache(){uni.showModal({title:"清除缓存",content:"确定要清除所有缓存吗?此操作将清除应用缓存数据(不包括登录信息)。",success:e=>{if(e.confirm){uni.showLoading({title:"清除中..."});try{const e=uni.getStorageInfoSync().keys||[],a=["token","userId","userInfo","userNickname","userPhone","username","avatarUrl","nickname"];e.forEach((e=>{a.includes(e)||uni.removeStorageSync(e)})),plus.cache.clear((()=>{t("log","at pages/settings/settings.vue:158","文件缓存已清除")})),plus.io.resolveLocalFileSystemURL("_doc/cache/",(e=>{e.removeRecursively((()=>{t("log","at pages/settings/settings.vue:166","图片缓存已清除")}),(e=>{t("error","at pages/settings/settings.vue:168","清除图片缓存失败:",e)}))}),(e=>{})),setTimeout((()=>{uni.hideLoading(),this.cacheSize="0MB",uni.showToast({title:"清除成功",icon:"success"}),this.calculateCacheSize()}),1e3)}catch(a){t("error","at pages/settings/settings.vue:187","清除缓存失败:",a),uni.hideLoading(),uni.showToast({title:"清除失败,请重试",icon:"none"})}}}})},calculateCacheSize(){try{const e=uni.getStorageInfoSync();let t=0;(e.keys||[]).forEach((e=>{const a=uni.getStorageSync(e);if(a){const e=JSON.stringify(a);t+=2*e.length}}));const a=(t/1024/1024).toFixed(2);this.cacheSize=a>0?`${a}MB`:"0MB"}catch(e){t("error","at pages/settings/settings.vue:221","计算缓存大小失败:",e),this.cacheSize="0MB"}},showPrivacy(){uni.navigateTo({url:"/pages/settings/privacy-policy"})},showAgreement(){uni.navigateTo({url:"/pages/settings/user-agreement"})},showAbout(){uni.navigateTo({url:"/pages/settings/about"})},async loadServiceConfig(){try{const e=uni.getStorageSync("appConfig");e&&e.common&&(this.useWechatService=!1!==e.common.useWechatService,this.servicePhone=e.common.servicePhone||"");const t=await uni.request({url:`${i}${l.getAppConfig}`,method:"GET",header:{"Content-Type":"application/json"}}),a=Array.isArray(t)?t[1]:t;if(a&&a.data&&a.data.success&&a.data.data){const e=a.data.data;uni.setStorageSync("appConfig",e),e.common&&(this.useWechatService=!1!==e.common.useWechatService,this.servicePhone=e.common.servicePhone||"")}}catch(e){t("error","at pages/settings/settings.vue:277","加载配置失败:",e)}},callService(){uni.makePhoneCall({phoneNumber:this.servicePhone})},handleLogout(){uni.showModal({title:"退出登录",content:"确定要退出登录吗?",success:e=>{e.confirm&&(uni.removeStorageSync("token"),uni.removeStorageSync("userId"),uni.removeStorageSync("userInfo"),uni.removeStorageSync("nickname"),uni.removeStorageSync("userNickname"),uni.removeStorageSync("userPhone"),uni.removeStorageSync("username"),uni.removeStorageSync("avatarUrl"),uni.showToast({title:"已退出登录",icon:"success",duration:1500}),setTimeout((()=>{uni.reLaunch({url:"/pages/login/login"})}),1500))}})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"settings-container"},[e.createElementVNode("view",{class:"settings-content"},[e.createElementVNode("view",{class:"setting-group"},[e.createElementVNode("view",{class:"group-title"},"账号设置"),e.createElementVNode("view",{class:"setting-item",onClick:a[0]||(a[0]=(...e)=>l.editProfile&&l.editProfile(...e))},[e.createElementVNode("view",{class:"item-left"},[e.createElementVNode("text",{class:"item-icon"},"👤"),e.createElementVNode("text",{class:"item-text"},"编辑资料")]),e.createElementVNode("text",{class:"item-arrow"},"›")]),e.createElementVNode("view",{class:"setting-item",onClick:a[1]||(a[1]=(...e)=>l.changePassword&&l.changePassword(...e))},[e.createElementVNode("view",{class:"item-left"},[e.createElementVNode("text",{class:"item-icon"},"🔐"),e.createElementVNode("text",{class:"item-text"},"修改密码")]),e.createElementVNode("text",{class:"item-arrow"},"›")]),e.createElementVNode("view",{class:"setting-item",onClick:a[2]||(a[2]=(...e)=>l.bindPhone&&l.bindPhone(...e))},[e.createElementVNode("view",{class:"item-left"},[e.createElementVNode("text",{class:"item-icon"},"📱"),e.createElementVNode("text",{class:"item-text"},"绑定手机")]),e.createElementVNode("view",{class:"item-right"},[e.createElementVNode("text",{class:"item-value"},e.toDisplayString(s.phone||"未绑定"),1),e.createElementVNode("text",{class:"item-arrow"},"›")])])]),e.createElementVNode("view",{class:"setting-group"},[e.createElementVNode("view",{class:"group-title"},"隐私设置"),e.createElementVNode("view",{class:"setting-item",onClick:a[3]||(a[3]=(...e)=>l.clearCache&&l.clearCache(...e))},[e.createElementVNode("view",{class:"item-left"},[e.createElementVNode("image",{src:x,class:"delete-icon",mode:"aspectFit"}),e.createElementVNode("text",{class:"item-text"},"清除缓存")]),e.createElementVNode("view",{class:"item-right"},[e.createElementVNode("text",{class:"item-value"},e.toDisplayString(s.cacheSize),1),e.createElementVNode("text",{class:"item-arrow"},"›")])]),e.createElementVNode("view",{class:"setting-item",onClick:a[4]||(a[4]=(...e)=>l.showPrivacy&&l.showPrivacy(...e))},[e.createElementVNode("view",{class:"item-left"},[e.createElementVNode("text",{class:"item-icon"},"🔒"),e.createElementVNode("text",{class:"item-text"},"隐私政策")]),e.createElementVNode("text",{class:"item-arrow"},"›")]),e.createElementVNode("view",{class:"setting-item",onClick:a[5]||(a[5]=(...e)=>l.showAgreement&&l.showAgreement(...e))},[e.createElementVNode("view",{class:"item-left"},[e.createElementVNode("text",{class:"item-icon"},"📄"),e.createElementVNode("text",{class:"item-text"},"用户协议")]),e.createElementVNode("text",{class:"item-arrow"},"›")])]),e.createElementVNode("view",{class:"setting-group"},[e.createElementVNode("view",{class:"group-title"},"关于"),e.createElementVNode("view",{class:"setting-item",onClick:a[6]||(a[6]=(...e)=>l.showAbout&&l.showAbout(...e))},[e.createElementVNode("view",{class:"item-left"},[e.createElementVNode("text",{class:"item-icon"},"ℹ️"),e.createElementVNode("text",{class:"item-text"},"关于我们")]),e.createElementVNode("text",{class:"item-arrow"},"›")])]),e.createElementVNode("view",{class:"logout-section"},[e.createElementVNode("button",{class:"logout-btn",onClick:a[7]||(a[7]=(...e)=>l.handleLogout&&l.handleLogout(...e))},"退出登录")])])])}],["__scopeId","data-v-87518627"]]);const O=d({data:()=>({nickname:""}),onLoad(){this.loadProfile()},methods:{loadProfile(){const e=uni.getStorageSync("userInfo");e&&(this.nickname=e.nickname||"")},async saveProfile(){if(!this.nickname.trim())return void uni.showToast({title:"请输入昵称",icon:"none"});const e=uni.getStorageSync("userInfo")||{},a=e.id||uni.getStorageSync("userId");if(!a)return void uni.showToast({title:"请先登录",icon:"none"});uni.showLoading({title:"保存中..."});const o=uni.getStorageSync("token");uni.request({url:`${i}/api/users/profile/${a}`,method:"PUT",header:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},data:{nickname:this.nickname.trim()},success:a=>{t("log","at pages/profile/edit-profile.vue:84","[EditProfile] API响应:",a.data),200===a.statusCode&&a.data.success?(e.nickname=this.nickname,uni.setStorageSync("userInfo",e),uni.setStorageSync("nickname",this.nickname),uni.setStorageSync("userNickname",this.nickname),uni.showToast({title:"保存成功",icon:"success"}),setTimeout((()=>{uni.navigateBack()}),1500)):uni.showToast({title:a.data.message||"保存失败",icon:"none"})},fail:e=>{t("error","at pages/profile/edit-profile.vue:109","[EditProfile] 请求失败:",e),uni.showToast({title:"网络错误,请重试",icon:"none"})},complete:()=>{uni.hideLoading()}})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"profile-container"},[e.createElementVNode("view",{class:"profile-content"},[e.createElementVNode("view",{class:"profile-item"},[e.createElementVNode("text",{class:"item-label"},"昵称"),e.withDirectives(e.createElementVNode("input",{class:"item-input","onUpdate:modelValue":a[0]||(a[0]=e=>s.nickname=e),placeholder:"请输入昵称",maxlength:"20"},null,512),[[e.vModelText,s.nickname]])]),e.createElementVNode("view",{class:"tip-text"},[e.createElementVNode("text",null,"💡 昵称将显示在个人中心和作品列表中")]),e.createElementVNode("button",{class:"save-btn",onClick:a[1]||(a[1]=(...e)=>l.saveProfile&&l.saveProfile(...e))},"保存")])])}],["__scopeId","data-v-38da1914"]]);const H=d({data:()=>({API_BASE:i,activeFilter:0,filters:["全部","今天","本周","本月"],loading:!1,records:[{id:1,type:"voice",icon:"🎤",title:"创建了声音克隆",desc:"妈妈的声音",time:"10:30",date:"2024-12-04"},{id:2,type:"photo",icon:"📸",title:"复活了照片",desc:"爷爷的照片",time:"15:20",date:"2024-12-03"},{id:3,type:"call",icon:"📞",title:"进行了AI通话",desc:"与奶奶的对话",time:"09:15",date:"2024-12-03"},{id:4,type:"voice",icon:"🎤",title:"语音合成",desc:"合成了一段语音",time:"14:30",date:"2024-12-02"}]}),computed:{currentRecords(){if(0===this.activeFilter)return this.records;if(1===this.activeFilter){const e=(new Date).toISOString().split("T")[0];return this.records.filter((t=>t.date===e))}if(2===this.activeFilter){const e=new Date,t=new Date(e.getTime()-6048e5);return this.records.filter((a=>{const o=new Date(a.date);return o>=t&&o<=e}))}{const e=new Date,t=new Date(e.getTime()-2592e6);return this.records.filter((a=>{const o=new Date(a.date);return o>=t&&o<=e}))}},groupedRecords(){const e={};return this.currentRecords.forEach((t=>{const a=this.getDateLabel(t.date);e[a]||(e[a]=[]),e[a].push(t)})),e}},onLoad(){this.loadHistory()},methods:{loadHistory(){this.loading=!0;const e=uni.getStorageSync("userId")||"",a=uni.getStorageSync("token")||"";uni.request({url:`${this.API_BASE}/api/history?userId=${e}&page=0&size=100`,method:"GET",header:{"X-User-Id":e,Authorization:a?`Bearer ${a}`:""},success:a=>{t("log","at pages/history-record/history-record.vue:175","[History] 用户ID:",e),t("log","at pages/history-record/history-record.vue:176","[History] API响应:",a.data),a.data&&a.data.content&&(t("log","at pages/history-record/history-record.vue:178","[History] 原始数据:",a.data.content),this.records=a.data.content.map((e=>{var a;const o=new Date(e.createdAt),i=String(o.getHours()).padStart(2,"0"),s=String(o.getMinutes()).padStart(2,"0"),l=o.getFullYear(),n=String(o.getMonth()+1).padStart(2,"0"),r=String(o.getDate()).padStart(2,"0");let c=0;null!==e.amount&&void 0!==e.amount&&(c=e.amount);const d={id:e.id,type:(null==(a=e.actionType)?void 0:a.toLowerCase())||"voice",actionType:e.actionType,icon:this.getIconByType(e.actionType),title:e.actionTitle||this.getDefaultTitle(e.actionType,c),desc:e.actionDesc||this.getDefaultDesc(e.actionType,c),time:`${i}:${s}`,date:`${l}-${n}-${r}`,amount:c,createdAt:e.createdAt};return t("log","at pages/history-record/history-record.vue:206","[History] 处理后的记录:",d),d})),t("log","at pages/history-record/history-record.vue:209","[History] 转换后的记录:",this.records))},fail:e=>{t("error","at pages/history-record/history-record.vue:213","[History] 加载失败:",e)},complete:()=>{this.loading=!1}})},handleFilterChange(e){t("log","at pages/history-record/history-record.vue:224","[Filter] 切换筛选:",this.filters[e]),this.activeFilter=e,t("log","at pages/history-record/history-record.vue:226","[Filter] 当前记录数:",this.records.length),t("log","at pages/history-record/history-record.vue:227","[Filter] 筛选后记录数:",this.currentRecords.length)},getDefaultTitle:(e,t)=>({CREATE_VOICE:t<0?"创建声音克隆":"声音克隆退款",SYNTHESIZE:t<0?"语音合成":"语音合成退款",PHOTO_REVIVAL:t<0?"照片复活":"照片复活退款",VIDEO_CALL:t<0?"视频通话":"视频通话退款",REFUND:"退款",RECHARGE:"充值"}[e]||"交易记录"),getDefaultDesc:(e,t)=>t>0?`退款金额: ¥${t.toFixed(2)}`:t<0?`消费金额: ¥${Math.abs(t).toFixed(2)}`:"",getIconByType:e=>({CREATE_VOICE:"🎤",SYNTHESIZE:"🎤",PHOTO_REVIVAL:"📸",VIDEO_CALL:"📞",AI_CALL:"💬",REFUND:"💵",RECHARGE:"💰"}[e]||"📋"),formatDate:e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,getDateLabel(e){const t=this.formatDate(new Date),a=this.formatDate(new Date(Date.now()-864e5));return e===t?"今天":e===a?"昨天":e},viewRecord(e){uni.showToast({title:"查看:"+e.title,icon:"none"})},deleteRecord(e){uni.showModal({title:"删除记录",content:`确定要删除"${e.title}"吗?`,success:a=>{if(a.confirm){const a=uni.getStorageSync("userId")||"",o=uni.getStorageSync("token")||"";uni.request({url:`${this.API_BASE}/api/history/${e.id}?userId=${a}`,method:"DELETE",header:{"X-User-Id":a,Authorization:o?`Bearer ${o}`:""},success:a=>{if(t("log","at pages/history-record/history-record.vue:312","[Delete] API响应:",a.data),200===a.statusCode){const t=this.records.findIndex((t=>t.id===e.id));t>-1&&this.records.splice(t,1),uni.showToast({title:"删除成功",icon:"success"})}else uni.showToast({title:"删除失败",icon:"none"})},fail:e=>{t("error","at pages/history-record/history-record.vue:331","[Delete] 删除失败:",e),uni.showToast({title:"删除失败",icon:"none"})}})}}})},clearAll(){0!==this.records.length?uni.showModal({title:"清空历史",content:"确定要清空所有历史记录吗?",success:e=>{if(e.confirm){const e=uni.getStorageSync("userId")||"",t=uni.getStorageSync("token")||"",a=this.records.map((a=>new Promise((o=>{uni.request({url:`${this.API_BASE}/api/history/${a.id}?userId=${e}`,method:"DELETE",header:{"X-User-Id":e,Authorization:t?`Bearer ${t}`:""},success:()=>o(!0),fail:()=>o(!1)})}))));Promise.all(a).then((()=>{this.records=[],uni.showToast({title:"已清空",icon:"success"})}))}}}):uni.showToast({title:"暂无记录",icon:"none"})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"history-container"},[e.createElementVNode("view",{class:"filter-section"},[e.createElementVNode("view",{class:"filter-bar"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.filters,((t,a)=>(e.openBlock(),e.createElementBlock("view",{key:a,class:e.normalizeClass(["filter-item",s.activeFilter===a?"active":""]),onClick:e=>l.handleFilterChange(a)},e.toDisplayString(t),11,["onClick"])))),128))]),e.createElementVNode("view",{class:"clear-btn-wrapper"},[e.createElementVNode("button",{class:"clear-btn",onClick:a[0]||(a[0]=(...e)=>l.clearAll&&l.clearAll(...e))},"清空")])]),e.createElementVNode("scroll-view",{"scroll-y":"",class:"history-list"},[s.loading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"loading-box"},[e.createElementVNode("text",{class:"loading-text"},"⏳ 加载中...")])):0===l.currentRecords.length?(e.openBlock(),e.createElementBlock("view",{key:1,class:"empty-box"},[e.createElementVNode("text",{class:"empty-icon"},"📋"),e.createElementVNode("text",{class:"empty-text"},"暂无历史记录")])):(e.openBlock(),e.createElementBlock("view",{key:2},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.groupedRecords,((t,a)=>(e.openBlock(),e.createElementBlock("view",{key:a,class:"date-group"},[e.createElementVNode("view",{class:"date-header"},e.toDisplayString(a),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t,(t=>(e.openBlock(),e.createElementBlock("view",{key:t.id,class:"history-item",onClick:e=>l.viewRecord(t)},[e.createElementVNode("view",{class:"item-icon"},e.toDisplayString(t.icon),1),e.createElementVNode("view",{class:"item-content"},[e.createElementVNode("text",{class:"item-title"},e.toDisplayString(t.title),1),e.createElementVNode("text",{class:"item-desc"},e.toDisplayString(t.desc),1),e.createElementVNode("view",{class:"item-footer"},[e.createElementVNode("text",{class:"item-time"},e.toDisplayString(t.time),1),null!==t.amount&&void 0!==t.amount?(e.openBlock(),e.createElementBlock("text",{key:0,class:e.normalizeClass(["item-amount",t.amount>0?"refund-amount":"deduct-amount"])},e.toDisplayString(t.amount>0?"+":"")+e.toDisplayString(Math.abs(t.amount).toFixed(2))+"元 ",3)):e.createCommentVNode("",!0)])]),e.createElementVNode("view",{class:"item-action",onClick:e.withModifiers((e=>l.deleteRecord(t)),["stop"])},[e.createElementVNode("image",{src:x,class:"delete-icon",mode:"aspectFit"})],8,["onClick"])],8,["onClick"])))),128))])))),128))]))])])}],["__scopeId","data-v-43a2851b"]]);const z=d({data:()=>({dramaUrl:"https://djcps.meinvclk.top/"}),onLoad(){},methods:{async loadDramaUrl(){try{const e=uni.getStorageSync("appConfig");if(e&&e.app&&e.app.dramaUrl)return void(this.dramaUrl=e.app.dramaUrl);const t=await uni.request({url:`${i}${l.getAppConfig}`,method:"GET",header:{"Content-Type":"application/json"}}),a=Array.isArray(t)?t[1]:t;if(a&&a.data&&a.data.success&&a.data.data){const e=a.data.data;uni.setStorageSync("appConfig",e),e.app&&e.app.dramaUrl&&(this.dramaUrl=e.app.dramaUrl)}}catch(e){t("error","at pages/short-drama/short-drama.vue:53","加载短剧URL失败:",e)}}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"drama-container"},[e.createElementVNode("web-view",{src:s.dramaUrl},null,8,["src"])])}],["__scopeId","data-v-1c8ee507"]]);const W=d({data:()=>({}),computed:{uploadUrl(){const e=uni.getStorageSync("token")||"",t=uni.getStorageSync("userId")||"",a=uni.getStorageSync("apiBase")||i;return`/static/upload.html?token=${encodeURIComponent(e)}&userId=${encodeURIComponent(t)}&apiBase=${encodeURIComponent(a)}`}},onShow(){const e=uni.getStorageSync("userId"),t=uni.getStorageSync("token");e&&t||uni.showModal({title:"需要登录",content:"请先登录后再创建音色",showCancel:!1,success:()=>{uni.reLaunch({url:"/pages/login/login"})}})}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"upload-page"},[e.createElementVNode("web-view",{src:l.uploadUrl},null,8,["src"])])}],["__scopeId","data-v-df6fcd98"]]);const j=d({data:()=>({oldPassword:"",newPassword:"",confirmPassword:"",submitting:!1}),methods:{validateForm(){return this.oldPassword?this.newPassword?this.newPassword.length<6||this.newPassword.length>20?(uni.showToast({title:"密码长度为6-20位",icon:"none"}),!1):this.newPassword!==this.confirmPassword?(uni.showToast({title:"两次密码输入不一致",icon:"none"}),!1):this.oldPassword!==this.newPassword||(uni.showToast({title:"新密码不能与旧密码相同",icon:"none"}),!1):(uni.showToast({title:"请输入新密码",icon:"none"}),!1):(uni.showToast({title:"请输入旧密码",icon:"none"}),!1)},async handleSubmit(){if(this.validateForm()){this.submitting=!0;try{await new Promise((e=>setTimeout(e,1500))),uni.showToast({title:"密码修改成功",icon:"success",duration:2e3}),setTimeout((()=>{uni.navigateBack()}),2e3)}catch(e){uni.showToast({title:e.message||"修改失败,请重试",icon:"none"})}finally{this.submitting=!1}}}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"change-password-container"},[e.createElementVNode("view",{class:"password-content"},[e.createElementVNode("view",{class:"page-header"},[e.createElementVNode("text",{class:"header-title"},"修改密码"),e.createElementVNode("text",{class:"header-subtitle"},"为了您的账号安全,请定期修改密码")]),e.createElementVNode("view",{class:"form-section"},[e.createElementVNode("view",{class:"form-item"},[e.createElementVNode("view",{class:"item-label"},[e.createElementVNode("text",{class:"label-icon"},"🔐"),e.createElementVNode("text",{class:"label-text"},"旧密码")]),e.withDirectives(e.createElementVNode("input",{class:"item-input",type:"password","onUpdate:modelValue":a[0]||(a[0]=e=>s.oldPassword=e),placeholder:"请输入旧密码","placeholder-class":"input-placeholder"},null,512),[[e.vModelText,s.oldPassword]])]),e.createElementVNode("view",{class:"form-item"},[e.createElementVNode("view",{class:"item-label"},[e.createElementVNode("text",{class:"label-icon"},"🔑"),e.createElementVNode("text",{class:"label-text"},"新密码")]),e.withDirectives(e.createElementVNode("input",{class:"item-input",type:"password","onUpdate:modelValue":a[1]||(a[1]=e=>s.newPassword=e),placeholder:"请输入新密码(6-20位)","placeholder-class":"input-placeholder"},null,512),[[e.vModelText,s.newPassword]])]),e.createElementVNode("view",{class:"form-item"},[e.createElementVNode("view",{class:"item-label"},[e.createElementVNode("text",{class:"label-icon"},"✅"),e.createElementVNode("text",{class:"label-text"},"确认密码")]),e.withDirectives(e.createElementVNode("input",{class:"item-input",type:"password","onUpdate:modelValue":a[2]||(a[2]=e=>s.confirmPassword=e),placeholder:"请再次输入新密码","placeholder-class":"input-placeholder"},null,512),[[e.vModelText,s.confirmPassword]])])]),e.createElementVNode("view",{class:"tips-section"},[e.createElementVNode("view",{class:"tips-title"},"密码要求:"),e.createElementVNode("view",{class:"tips-item"},"• 长度为6-20个字符"),e.createElementVNode("view",{class:"tips-item"},"• 建议包含字母、数字和符号"),e.createElementVNode("view",{class:"tips-item"},"• 不要使用过于简单的密码")]),e.createElementVNode("view",{class:"button-section"},[e.createElementVNode("button",{class:"submit-btn",onClick:a[3]||(a[3]=(...e)=>l.handleSubmit&&l.handleSubmit(...e)),disabled:s.submitting},e.toDisplayString(s.submitting?"提交中...":"确认修改"),9,["disabled"])])])])}],["__scopeId","data-v-34475fd0"]]);const q=d({data:()=>({phone:"",code:"",counting:!1,countdown:60,submitting:!1,timer:null}),onUnload(){this.timer&&clearInterval(this.timer)},methods:{validatePhone(){return this.phone?!!/^1[3-9]\d{9}$/.test(this.phone)||(uni.showToast({title:"请输入正确的手机号",icon:"none"}),!1):(uni.showToast({title:"请输入手机号",icon:"none"}),!1)},async sendCode(){if(this.validatePhone())try{await new Promise((e=>setTimeout(e,500))),uni.showToast({title:"验证码已发送",icon:"success"}),this.counting=!0,this.countdown=60,this.timer=setInterval((()=>{this.countdown--,this.countdown<=0&&(clearInterval(this.timer),this.counting=!1,this.countdown=60)}),1e3)}catch(e){uni.showToast({title:e.message||"发送失败,请重试",icon:"none"})}},validateForm(){return!!this.validatePhone()&&(this.code?6===this.code.length||(uni.showToast({title:"请输入6位验证码",icon:"none"}),!1):(uni.showToast({title:"请输入验证码",icon:"none"}),!1))},async handleSubmit(){if(this.validateForm()){this.submitting=!0;try{await new Promise((e=>setTimeout(e,1500)));const e=uni.getStorageSync("userInfo")||{};e.phone=this.phone,uni.setStorageSync("userInfo",e),uni.showToast({title:"绑定成功",icon:"success",duration:2e3}),setTimeout((()=>{uni.navigateBack()}),2e3)}catch(e){uni.showToast({title:e.message||"绑定失败,请重试",icon:"none"})}finally{this.submitting=!1}}}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"bind-phone-container"},[e.createElementVNode("view",{class:"bind-content"},[e.createElementVNode("view",{class:"page-header"},[e.createElementVNode("text",{class:"header-title"},"绑定手机号"),e.createElementVNode("text",{class:"header-subtitle"},"绑定手机号后可用于登录和找回密码")]),e.createElementVNode("view",{class:"form-section"},[e.createElementVNode("view",{class:"form-item"},[e.createElementVNode("view",{class:"item-label"},[e.createElementVNode("text",{class:"label-icon"},"📱"),e.createElementVNode("text",{class:"label-text"},"手机号码")]),e.withDirectives(e.createElementVNode("input",{class:"item-input",type:"number","onUpdate:modelValue":a[0]||(a[0]=e=>s.phone=e),placeholder:"请输入手机号","placeholder-class":"input-placeholder",maxlength:"11"},null,512),[[e.vModelText,s.phone]])]),e.createElementVNode("view",{class:"form-item"},[e.createElementVNode("view",{class:"item-label"},[e.createElementVNode("text",{class:"label-icon"},"🔢"),e.createElementVNode("text",{class:"label-text"},"验证码")]),e.createElementVNode("view",{class:"code-input-wrapper"},[e.withDirectives(e.createElementVNode("input",{class:"code-input",type:"number","onUpdate:modelValue":a[1]||(a[1]=e=>s.code=e),placeholder:"请输入验证码","placeholder-class":"input-placeholder",maxlength:"6"},null,512),[[e.vModelText,s.code]]),e.createElementVNode("button",{class:"send-code-btn",onClick:a[2]||(a[2]=(...e)=>l.sendCode&&l.sendCode(...e)),disabled:s.counting},e.toDisplayString(s.counting?`${s.countdown}秒后重发`:"发送验证码"),9,["disabled"])])])]),e.createElementVNode("view",{class:"tips-section"},[e.createElementVNode("view",{class:"tips-item"},"• 验证码将发送至您的手机"),e.createElementVNode("view",{class:"tips-item"},"• 请确保手机号码正确无误"),e.createElementVNode("view",{class:"tips-item"},"• 一个手机号只能绑定一个账号")]),e.createElementVNode("view",{class:"button-section"},[e.createElementVNode("button",{class:"submit-btn",onClick:a[3]||(a[3]=(...e)=>l.handleSubmit&&l.handleSubmit(...e)),disabled:s.submitting},e.toDisplayString(s.submitting?"提交中...":"确认绑定"),9,["disabled"])])])])}],["__scopeId","data-v-421b133e"]]);const G=d({data:()=>({serviceEmail:"",servicePhone:"",updateDate:""}),onLoad(){this.loadConfig()},methods:{async loadConfig(){try{const e=uni.getStorageSync("appConfig");e&&(e.common&&(this.serviceEmail=e.common.serviceEmail||"",this.servicePhone=e.common.servicePhone||""),e.privacy&&(this.updateDate=e.privacy.updateDate||""));const t=await uni.request({url:`${i}${l.getAppConfig}`,method:"GET",header:{"Content-Type":"application/json"}}),a=Array.isArray(t)?t[1]:t;if(a&&a.data&&a.data.success&&a.data.data){const e=a.data.data;uni.setStorageSync("appConfig",e),e.common&&(this.serviceEmail=e.common.serviceEmail||"",this.servicePhone=e.common.servicePhone||""),e.privacy&&(this.updateDate=e.privacy.updateDate||"")}}catch(e){t("error","at pages/settings/privacy-policy.vue:196","加载配置失败:",e)}},handleAgree(){uni.showToast({title:"感谢您的信任",icon:"success"}),setTimeout((()=>{uni.navigateBack()}),1500)}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"privacy-container"},[e.createElementVNode("view",{class:"privacy-content"},[e.createElementVNode("view",{class:"page-header"},[e.createElementVNode("text",{class:"header-title"},"隐私政策"),s.updateDate?(e.openBlock(),e.createElementBlock("text",{key:0,class:"header-subtitle"},"更新日期:"+e.toDisplayString(s.updateDate),1)):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"content-section"},[e.createElementVNode("scroll-view",{"scroll-y":"",class:"scroll-content"},[e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"引言"),e.createElementVNode("view",{class:"block-content"}," 欢迎使用时光意境·AI声音克隆应用。我们深知个人信息对您的重要性,并会尽全力保护您的个人信息安全可靠。我们致力于维持您对我们的信任,恪守以下原则,保护您的个人信息:权责一致原则、目的明确原则、选择同意原则、最少够用原则、确保安全原则、主体参与原则、公开透明原则等。 ")]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"一、我们如何收集和使用您的个人信息"),e.createElementVNode("view",{class:"block-subtitle"},"1.1 账号注册"),e.createElementVNode("view",{class:"block-content"}," 当您注册账号时,我们会收集您的手机号码、密码等信息,用于创建您的账号并保障账号安全。 "),e.createElementVNode("view",{class:"block-subtitle"},"1.2 服务使用"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"声音克隆"),e.createTextVNode(":我们会收集您上传的音频文件,用于创建专属音色"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"照片复活"),e.createTextVNode(":我们会收集您上传的照片和音频,用于生成复活视频"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"视频通话"),e.createTextVNode(":我们会收集您的语音对话内容,用于实现AI对话功能 ")]),e.createElementVNode("view",{class:"block-subtitle"},"1.3 设备信息"),e.createElementVNode("view",{class:"block-content"}," 为了保障服务的稳定性和安全性,我们可能会收集您的设备型号、操作系统版本、设备标识符等信息。 ")]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"二、我们如何使用Cookie和同类技术"),e.createElementVNode("view",{class:"block-content"}," 我们使用Cookie和类似技术来识别您的身份、记录您的偏好设置、提供更好的服务体验。您可以通过浏览器设置管理Cookie。 ")]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"三、我们如何共享、转让、公开披露您的个人信息"),e.createElementVNode("view",{class:"block-subtitle"},"3.1 共享"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" 我们不会与任何公司、组织和个人分享您的个人信息,但以下情况除外:"),e.createElementVNode("br"),e.createTextVNode(" • 事先获得您的明确同意"),e.createElementVNode("br"),e.createTextVNode(" • 根据法律法规或政府主管部门的要求"),e.createElementVNode("br"),e.createTextVNode(" • 与我们的关联公司共享,但仅限于实现本政策目的所必需 ")]),e.createElementVNode("view",{class:"block-subtitle"},"3.2 转让"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" 我们不会将您的个人信息转让给任何公司、组织和个人,但以下情况除外:"),e.createElementVNode("br"),e.createTextVNode(" • 事先获得您的明确同意"),e.createElementVNode("br"),e.createTextVNode(" • 在涉及合并、收购或破产清算时,如涉及到个人信息转让,我们会要求新的持有您个人信息的公司、组织继续受本政策的约束 ")]),e.createElementVNode("view",{class:"block-subtitle"},"3.3 公开披露"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" 我们仅会在以下情况下,公开披露您的个人信息:"),e.createElementVNode("br"),e.createTextVNode(" • 获得您的明确同意"),e.createElementVNode("br"),e.createTextVNode(" • 基于法律的披露:在法律、法律程序、诉讼或政府主管部门强制性要求的情况下 ")])]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"四、我们如何保护和保存您的个人信息"),e.createElementVNode("view",{class:"block-subtitle"},"4.1 安全措施"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" 我们采用业界领先的技术和管理措施保护您的个人信息:"),e.createElementVNode("br"),e.createTextVNode(" • 使用加密技术确保数据传输安全"),e.createElementVNode("br"),e.createTextVNode(" • 采用访问控制机制,确保只有授权人员才可访问个人信息"),e.createElementVNode("br"),e.createTextVNode(" • 定期进行安全审计和风险评估 ")]),e.createElementVNode("view",{class:"block-subtitle"},"4.2 存储期限"),e.createElementVNode("view",{class:"block-content"}," 我们仅在为实现目的所必需的期间内保留您的个人信息。当您注销账号或服务终止后,我们将删除或匿名化处理您的个人信息。 ")]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"五、您的权利"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" 按照中国相关的法律法规,您对自己的个人信息享有以下权利:"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"访问权"),e.createTextVNode(":您有权访问您的个人信息"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"更正权"),e.createTextVNode(":您有权更正不准确或不完整的个人信息"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"删除权"),e.createTextVNode(":您有权要求我们删除您的个人信息"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"撤回同意"),e.createTextVNode(":您有权撤回您对个人信息处理的同意"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"注销账号"),e.createTextVNode(":您有权注销您的账号 ")])]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"六、未成年人保护"),e.createElementVNode("view",{class:"block-content"}," 我们非常重视对未成年人个人信息的保护。如果您是未成年人,建议您请您的父母或监护人仔细阅读本隐私政策,并在征得您的父母或监护人同意的前提下使用我们的服务或向我们提供信息。 ")]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"七、本政策如何更新"),e.createElementVNode("view",{class:"block-content"}," 我们可能适时修订本政策内容。如该等变更会导致您在本政策项下权利的实质减损,我们将在变更生效前,通过在页面显著位置提示、向您发送电子邮件等方式通知您。 ")]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"八、如何联系我们"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" 如果您对本隐私政策有任何疑问、意见或建议,请通过以下方式与我们联系:"),e.createElementVNode("br"),e.createElementVNode("br"),s.serviceEmail?(e.openBlock(),e.createElementBlock("text",{key:0,class:"contact-info"},"邮箱:"+e.toDisplayString(s.serviceEmail),1)):e.createCommentVNode("",!0),s.serviceEmail?(e.openBlock(),e.createElementBlock("br",{key:1})):e.createCommentVNode("",!0),s.servicePhone?(e.openBlock(),e.createElementBlock("text",{key:2,class:"contact-info"},"电话:"+e.toDisplayString(s.servicePhone),1)):e.createCommentVNode("",!0),s.servicePhone?(e.openBlock(),e.createElementBlock("br",{key:3})):e.createCommentVNode("",!0)])])])]),e.createElementVNode("view",{class:"button-section"},[e.createElementVNode("button",{class:"agree-btn",onClick:a[0]||(a[0]=(...e)=>l.handleAgree&&l.handleAgree(...e))},"我已阅读并同意")])])])}],["__scopeId","data-v-a3f9e765"]]);const K=d({data:()=>({serviceEmail:"",servicePhone:"",updateDate:""}),onLoad(){this.loadConfig()},methods:{async loadConfig(){try{const e=uni.getStorageSync("appConfig");e&&(e.common&&(this.serviceEmail=e.common.serviceEmail||"",this.servicePhone=e.common.servicePhone||""),e.agreement&&(this.updateDate=e.agreement.updateDate||""));const t=await uni.request({url:`${i}${l.getAppConfig}`,method:"GET",header:{"Content-Type":"application/json"}}),a=Array.isArray(t)?t[1]:t;if(a&&a.data&&a.data.success&&a.data.data){const e=a.data.data;uni.setStorageSync("appConfig",e),e.common&&(this.serviceEmail=e.common.serviceEmail||"",this.servicePhone=e.common.servicePhone||""),e.agreement&&(this.updateDate=e.agreement.updateDate||"")}}catch(e){t("error","at pages/settings/user-agreement.vue:233","加载配置失败:",e)}},handleAgree(){uni.showToast({title:"感谢您的支持",icon:"success"}),setTimeout((()=>{uni.navigateBack()}),1500)}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"agreement-container"},[e.createElementVNode("view",{class:"agreement-content"},[e.createElementVNode("view",{class:"page-header"},[e.createElementVNode("text",{class:"header-title"},"用户服务协议"),s.updateDate?(e.openBlock(),e.createElementBlock("text",{key:0,class:"header-subtitle"},"更新日期:"+e.toDisplayString(s.updateDate),1)):e.createCommentVNode("",!0)]),e.createElementVNode("view",{class:"content-section"},[e.createElementVNode("scroll-view",{"scroll-y":"",class:"scroll-content"},[e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"重要提示"),e.createElementVNode("view",{class:"block-content important"},' 欢迎您使用时光意境·AI声音克隆服务!在使用本服务前,请您务必仔细阅读并充分理解本协议。您点击"同意"按钮或实际使用本服务,即表示您已阅读并同意接受本协议的全部内容。 ')]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"一、服务说明"),e.createElementVNode("view",{class:"block-subtitle"},"1.1 服务内容"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" 时光意境提供以下AI服务:"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"声音克隆"),e.createTextVNode(":基于您提供的音频样本创建专属音色"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"语音合成"),e.createTextVNode(":使用已创建的音色合成语音内容"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"照片复活"),e.createTextVNode(":让照片中的人物开口说话"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"视频通话"),e.createTextVNode(":与AI数字人进行实时对话"),e.createElementVNode("br"),e.createTextVNode(" • "),e.createElementVNode("text",{class:"highlight"},"实时对话"),e.createTextVNode(":基于语音识别和AI的智能对话 ")]),e.createElementVNode("view",{class:"block-subtitle"},"1.2 服务特点"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" • 采用先进的AI技术,提供高质量的声音克隆和合成服务"),e.createElementVNode("br"),e.createTextVNode(" • 支持多种音频格式和场景应用"),e.createElementVNode("br"),e.createTextVNode(" • 提供便捷的用户界面和操作流程"),e.createElementVNode("br"),e.createTextVNode(" • 保护用户隐私和数据安全 ")])]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"二、账号注册与使用"),e.createElementVNode("view",{class:"block-subtitle"},"2.1 注册要求"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" • 您需要提供真实、准确、完整的个人信息"),e.createElementVNode("br"),e.createTextVNode(" • 您需要使用有效的手机号码进行注册"),e.createElementVNode("br"),e.createTextVNode(" • 您需要设置安全的密码并妥善保管"),e.createElementVNode("br"),e.createTextVNode(" • 您应当及时更新您的个人信息 ")]),e.createElementVNode("view",{class:"block-subtitle"},"2.2 账号安全"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" • 您对账号和密码的安全负有全部责任"),e.createElementVNode("br"),e.createTextVNode(" • 如发现账号被盗用,应立即通知我们"),e.createElementVNode("br"),e.createTextVNode(" • 不得将账号转让、出售或出借给他人使用"),e.createElementVNode("br"),e.createTextVNode(" • 不得使用他人账号或冒充他人身份 ")])]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"三、使用规范"),e.createElementVNode("view",{class:"block-subtitle"},"3.1 禁止行为"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" 在使用本服务时,您不得:"),e.createElementVNode("br"),e.createTextVNode(" • 上传违法、违规、侵权或不良内容"),e.createElementVNode("br"),e.createTextVNode(" • 克隆他人声音用于欺诈、诈骗等违法行为"),e.createElementVNode("br"),e.createTextVNode(" • 传播虚假信息、谣言或恶意内容"),e.createElementVNode("br"),e.createTextVNode(" • 侵犯他人知识产权、隐私权或其他合法权益"),e.createElementVNode("br"),e.createTextVNode(" • 干扰或破坏服务的正常运行"),e.createElementVNode("br"),e.createTextVNode(" • 进行任何形式的商业推广或广告活动 ")]),e.createElementVNode("view",{class:"block-subtitle"},"3.2 内容规范"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" • 上传的音频、照片等内容应合法合规"),e.createElementVNode("br"),e.createTextVNode(" • 不得包含暴力、色情、恐怖等不良信息"),e.createElementVNode("br"),e.createTextVNode(" • 不得侵犯他人肖像权、名誉权等权利"),e.createElementVNode("br"),e.createTextVNode(" • 应尊重社会公德和公序良俗 ")])]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"四、知识产权"),e.createElementVNode("view",{class:"block-subtitle"},"4.1 平台权利"),e.createElementVNode("view",{class:"block-content"}," 本服务的所有内容(包括但不限于软件、技术、程序、网页、文字、图片、音频、视频等)的知识产权归我们所有。未经我们书面许可,任何人不得擅自使用。 "),e.createElementVNode("view",{class:"block-subtitle"},"4.2 用户内容"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" • 您上传的内容,您保留其知识产权"),e.createElementVNode("br"),e.createTextVNode(" • 您授予我们使用、存储、处理该内容的权利"),e.createElementVNode("br"),e.createTextVNode(" • 您保证上传的内容不侵犯第三方权利"),e.createElementVNode("br"),e.createTextVNode(" • 生成的音色和视频,您享有使用权 ")])]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"五、费用说明"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" • 部分服务可能需要付费使用"),e.createElementVNode("br"),e.createTextVNode(" • 具体收费标准以页面显示为准"),e.createElementVNode("br"),e.createTextVNode(" • 支付成功后,费用不予退还(法律另有规定除外)"),e.createElementVNode("br"),e.createTextVNode(" • 我们保留调整价格的权利,调整前会提前通知 ")])]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"六、免责声明"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" • 因不可抗力导致的服务中断或故障,我们不承担责任"),e.createElementVNode("br"),e.createTextVNode(" • 因用户自身原因(如操作不当、设备问题等)导致的损失,我们不承担责任"),e.createElementVNode("br"),e.createTextVNode(" • 因第三方原因(如网络故障、黑客攻击等)导致的损失,我们不承担责任"),e.createElementVNode("br"),e.createTextVNode(" • 用户使用本服务产生的法律责任,由用户自行承担 ")])]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"七、服务变更与终止"),e.createElementVNode("view",{class:"block-subtitle"},"7.1 服务变更"),e.createElementVNode("view",{class:"block-content"}," 我们有权根据业务需要,变更、暂停或终止部分或全部服务。如有重大变更,我们会提前通知您。 "),e.createElementVNode("view",{class:"block-subtitle"},"7.2 账号终止"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" 以下情况下,我们有权终止您的账号:"),e.createElementVNode("br"),e.createTextVNode(" • 您违反本协议的约定"),e.createElementVNode("br"),e.createTextVNode(" • 您从事违法违规活动"),e.createElementVNode("br"),e.createTextVNode(" • 您长期未使用账号(超过12个月)"),e.createElementVNode("br"),e.createTextVNode(" • 您主动申请注销账号 ")])]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"八、协议修改"),e.createElementVNode("view",{class:"block-content"}," 我们有权根据法律法规变化或业务需要修改本协议。修改后的协议将在应用内公布,如您继续使用服务,即视为同意修改后的协议。 ")]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"九、法律适用与争议解决"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" • 本协议的订立、执行和解释及争议的解决均应适用中华人民共和国法律"),e.createElementVNode("br"),e.createTextVNode(" • 如双方就本协议内容或其执行发生争议,双方应友好协商解决"),e.createElementVNode("br"),e.createTextVNode(" • 协商不成时,任何一方均可向我们所在地人民法院提起诉讼 ")])]),e.createElementVNode("view",{class:"section-block"},[e.createElementVNode("view",{class:"block-title"},"十、联系我们"),e.createElementVNode("view",{class:"block-content"},[e.createTextVNode(" 如您对本协议有任何疑问,请通过以下方式联系我们:"),e.createElementVNode("br"),e.createElementVNode("br"),s.serviceEmail?(e.openBlock(),e.createElementBlock("text",{key:0,class:"contact-info"},"邮箱:"+e.toDisplayString(s.serviceEmail),1)):e.createCommentVNode("",!0),s.serviceEmail?(e.openBlock(),e.createElementBlock("br",{key:1})):e.createCommentVNode("",!0),s.servicePhone?(e.openBlock(),e.createElementBlock("text",{key:2,class:"contact-info"},"电话:"+e.toDisplayString(s.servicePhone),1)):e.createCommentVNode("",!0),s.servicePhone?(e.openBlock(),e.createElementBlock("br",{key:3})):e.createCommentVNode("",!0)])])])]),e.createElementVNode("view",{class:"button-section"},[e.createElementVNode("button",{class:"agree-btn",onClick:a[0]||(a[0]=(...e)=>l.handleAgree&&l.handleAgree(...e))},"我已阅读并同意")])])])}],["__scopeId","data-v-e6611241"]]);const X=d({data:()=>({appName:"时光意境",version:"v1.0.0",releaseDate:"",serviceEmail:"",servicePhone:"",companyName:"",companyAddress:"",icp:"",copyright:""}),onLoad(){this.loadAppConfig()},methods:{async loadAppConfig(){try{const e=uni.getStorageSync("appConfig");e&&this.updateConfigData(e);const a=await uni.request({url:`${i}${l.getAppConfig}`,method:"GET",header:{"Content-Type":"application/json"}}),o=Array.isArray(a)?a[1]:a;if(o&&200===o.statusCode)if(o.data&&o.data.success&&o.data.data){const e=o.data.data;uni.setStorageSync("appConfig",e),this.updateConfigData(e)}else t("warn","at pages/settings/about.vue:165","[About] API返回数据格式异常:",o.data),e||uni.showToast({title:"加载配置失败",icon:"none",duration:2e3});else t("error","at pages/settings/about.vue:176","[About] API请求失败:",o),e||uni.showToast({title:"网络请求失败",icon:"none",duration:2e3})}catch(e){t("error","at pages/settings/about.vue:187","[About] 加载配置异常:",e);uni.getStorageSync("appConfig")||uni.showToast({title:"加载配置失败",icon:"none",duration:2e3})}},updateConfigData(e){e?(e.app&&(this.appName=e.app.appName||this.appName,this.version=e.app.version?`v${e.app.version}`:this.version,this.releaseDate=e.app.releaseDate||this.releaseDate),e.common&&(this.serviceEmail=e.common.serviceEmail||this.serviceEmail,this.servicePhone=e.common.servicePhone||this.servicePhone,this.companyName=e.common.companyName||"",this.companyAddress=e.common.companyAddress||"",this.icp=e.common.icp||this.icp),e.about&&(this.copyright=e.about.copyright||""),t("log","at pages/settings/about.vue:222","[About] 配置数据已更新:",{appName:this.appName,version:this.version,serviceEmail:this.serviceEmail,servicePhone:this.servicePhone,companyName:this.companyName,icp:this.icp})):t("warn","at pages/settings/about.vue:202","[About] 配置数据为空")},copyText(e){uni.setClipboardData({data:e,success:()=>{uni.showToast({title:"已复制到剪贴板",icon:"success"})}})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"about-container"},[e.createElementVNode("view",{class:"about-content"},[e.createElementVNode("view",{class:"logo-section"},[e.createElementVNode("view",{class:"logo-wrapper"},[e.createElementVNode("text",{class:"logo-text"},"时光意境")]),e.createElementVNode("text",{class:"app-name"},e.toDisplayString(s.appName),1),e.createElementVNode("text",{class:"app-slogan"},"用科技温暖记忆,让告别不留遗憾")]),e.createElementVNode("view",{class:"version-section"},[e.createElementVNode("view",{class:"version-card"},[e.createElementVNode("view",{class:"version-item"},[e.createElementVNode("text",{class:"version-label"},"当前版本"),e.createElementVNode("text",{class:"version-value"},e.toDisplayString(s.version),1)]),e.createElementVNode("view",{class:"version-divider"}),s.releaseDate?(e.openBlock(),e.createElementBlock("view",{key:0,class:"version-item"},[e.createElementVNode("text",{class:"version-label"},"发布日期"),e.createElementVNode("text",{class:"version-value"},e.toDisplayString(s.releaseDate),1)])):e.createCommentVNode("",!0)])]),e.createElementVNode("view",{class:"features-section"},[e.createElementVNode("view",{class:"section-title"},"核心功能"),e.createElementVNode("view",{class:"feature-grid"},[e.createElementVNode("view",{class:"feature-item"},[e.createElementVNode("text",{class:"feature-icon"},"🎤"),e.createElementVNode("text",{class:"feature-name"},"声音克隆"),e.createElementVNode("text",{class:"feature-desc"},"克隆您的声音")]),e.createElementVNode("view",{class:"feature-item"},[e.createElementVNode("text",{class:"feature-icon"},"🎬"),e.createElementVNode("text",{class:"feature-name"},"照片复活"),e.createElementVNode("text",{class:"feature-desc"},"让照片开口说话")]),e.createElementVNode("view",{class:"feature-item"},[e.createElementVNode("text",{class:"feature-icon"},"📹"),e.createElementVNode("text",{class:"feature-name"},"视频通话"),e.createElementVNode("text",{class:"feature-desc"},"与AI数字人对话")]),e.createElementVNode("view",{class:"feature-item"},[e.createElementVNode("text",{class:"feature-icon"},"💬"),e.createElementVNode("text",{class:"feature-name"},"实时对话"),e.createElementVNode("text",{class:"feature-desc"},"智能语音交互")])])]),e.createElementVNode("view",{class:"info-section"},[e.createElementVNode("view",{class:"section-title"},"关于我们"),e.createElementVNode("view",{class:"info-card"},[e.createElementVNode("view",{class:"info-content"},[e.createTextVNode(' 时光意境是一款基于人工智能技术的声音克隆和数字人应用。我们致力于用科技的力量,帮助人们保存珍贵的记忆,让逝去的亲人以数字形式"重逢"。 '),e.createElementVNode("br"),e.createElementVNode("br"),e.createTextVNode(" 通过先进的AI技术,我们可以克隆声音、复活照片、实现智能对话,让每一份思念都有温度,让每一次告别都不留遗憾。 ")])])]),e.createElementVNode("view",{class:"contact-section"},[e.createElementVNode("view",{class:"section-title"},"联系我们"),e.createElementVNode("view",{class:"contact-card"},[s.serviceEmail?(e.openBlock(),e.createElementBlock("view",{key:0,class:"contact-item",onClick:a[0]||(a[0]=e=>l.copyText(s.serviceEmail))},[e.createElementVNode("text",{class:"contact-icon"},"📧"),e.createElementVNode("view",{class:"contact-info"},[e.createElementVNode("text",{class:"contact-label"},"邮箱"),e.createElementVNode("text",{class:"contact-value"},e.toDisplayString(s.serviceEmail),1)]),e.createElementVNode("text",{class:"contact-action"},"复制")])):e.createCommentVNode("",!0),s.serviceEmail&&s.servicePhone?(e.openBlock(),e.createElementBlock("view",{key:1,class:"contact-divider"})):e.createCommentVNode("",!0),s.servicePhone?(e.openBlock(),e.createElementBlock("view",{key:2,class:"contact-item",onClick:a[1]||(a[1]=e=>l.copyText(s.servicePhone))},[e.createElementVNode("text",{class:"contact-icon"},"📞"),e.createElementVNode("view",{class:"contact-info"},[e.createElementVNode("text",{class:"contact-label"},"客服电话"),e.createElementVNode("text",{class:"contact-value"},e.toDisplayString(s.servicePhone),1)]),e.createElementVNode("text",{class:"contact-action"},"复制")])):e.createCommentVNode("",!0),s.servicePhone&&s.companyName?(e.openBlock(),e.createElementBlock("view",{key:3,class:"contact-divider"})):e.createCommentVNode("",!0),s.companyName?(e.openBlock(),e.createElementBlock("view",{key:4,class:"contact-item"},[e.createElementVNode("text",{class:"contact-icon"},"🏢"),e.createElementVNode("view",{class:"contact-info"},[e.createElementVNode("text",{class:"contact-label"},"公司名称"),e.createElementVNode("text",{class:"contact-value"},e.toDisplayString(s.companyName),1)])])):e.createCommentVNode("",!0),s.companyName&&s.companyAddress?(e.openBlock(),e.createElementBlock("view",{key:5,class:"contact-divider"})):e.createCommentVNode("",!0),s.companyAddress?(e.openBlock(),e.createElementBlock("view",{key:6,class:"contact-item"},[e.createElementVNode("text",{class:"contact-icon"},"📍"),e.createElementVNode("view",{class:"contact-info"},[e.createElementVNode("text",{class:"contact-label"},"公司地址"),e.createElementVNode("text",{class:"contact-value"},e.toDisplayString(s.companyAddress),1)])])):e.createCommentVNode("",!0)])]),s.copyright||s.icp?(e.openBlock(),e.createElementBlock("view",{key:0,class:"footer-section"},[s.copyright?(e.openBlock(),e.createElementBlock("text",{key:0,class:"copyright"},e.toDisplayString(s.copyright),1)):e.createCommentVNode("",!0),s.icp?(e.openBlock(),e.createElementBlock("text",{key:1,class:"icp"},e.toDisplayString(s.icp),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])])}],["__scopeId","data-v-73def735"]]);let J=!1,Y=[];const Q=e=>new Promise(((t,a)=>{const o=uni.getStorageSync("token"),s={"Content-Type":"application/json",...e.header};o&&(s.Authorization=`Bearer ${o}`),uni.request({url:i+e.url,method:e.method||"GET",data:e.data||{},header:s,success:o=>{200===o.statusCode?t(o.data):401===o.statusCode?J?Y.push((()=>{Q(e).then(t).catch(a)})):(J=!0,Z().then((o=>{J=!1,Q(e).then(t).catch(a),Y.forEach((e=>e())),Y=[]})).catch((e=>{J=!1,Y=[],uni.showToast({title:"登录已过期,请重新登录",icon:"none"}),setTimeout((()=>{uni.reLaunch({url:"/pages/login/login"})}),1500),a(e)}))):a(o)},fail:e=>{a(e)}})})),Z=()=>new Promise(((e,t)=>{const a=uni.getStorageSync("refreshToken");a?uni.request({url:i+"/api/users/refresh-token",method:"POST",data:{refreshToken:a},success:a=>{if(200===a.statusCode&&a.data.success){const t=a.data.data.token,o=a.data.data.refreshToken;uni.setStorageSync("token",t),uni.setStorageSync("refreshToken",o),e(t)}else t(new Error("Refresh token failed"))},fail:e=>{t(e)}}):t(new Error("No refresh token"))}));const ee=d({data:()=>({content:"",contact:"",submitting:!1}),methods:{validateForm(){return this.content&&this.content.trim()?this.content.length>1e3?(uni.showToast({title:"内容不能超过1000字",icon:"none"}),!1):this.contact&&this.contact.trim()?!(this.contact.length>100)||(uni.showToast({title:"联系方式不能超过100字",icon:"none"}),!1):(uni.showToast({title:"请输入联系方式",icon:"none"}),!1):(uni.showToast({title:"请输入内容",icon:"none"}),!1)},async handleSubmit(){if(this.validateForm()){this.submitting=!0;try{const e=await((e,t={},a={})=>Q({url:e,method:"POST",data:t,header:a}))(n.create,{content:this.content.trim(),contact:this.contact.trim()});if(e&&e.success)return uni.showToast({title:"提交成功",icon:"success",duration:1500}),void setTimeout((()=>{uni.navigateBack()}),1500);uni.showToast({title:e&&e.message?e.message:"提交失败",icon:"none"})}catch(e){uni.showToast({title:e.message||"提交失败",icon:"none"})}finally{this.submitting=!1}}}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"complaint-container"},[e.createElementVNode("view",{class:"complaint-content"},[e.createElementVNode("view",{class:"page-header"},[e.createElementVNode("text",{class:"header-title"},"投诉建议"),e.createElementVNode("text",{class:"header-subtitle"},"请描述你遇到的问题,我们会尽快处理")]),e.createElementVNode("view",{class:"form-section"},[e.createElementVNode("view",{class:"form-item"},[e.createElementVNode("view",{class:"item-label"},[e.createElementVNode("text",{class:"label-icon"},"📝"),e.createElementVNode("text",{class:"label-text"},"内容")]),e.withDirectives(e.createElementVNode("textarea",{class:"item-textarea","onUpdate:modelValue":a[0]||(a[0]=e=>s.content=e),placeholder:"请输入投诉/建议内容(最多1000字)","placeholder-class":"input-placeholder",maxlength:"1000","auto-height":!0},null,512),[[e.vModelText,s.content]]),e.createElementVNode("view",{class:"count-row"},[e.createElementVNode("text",{class:"count-text"},e.toDisplayString(s.content.length)+"/1000",1)])]),e.createElementVNode("view",{class:"form-item"},[e.createElementVNode("view",{class:"item-label"},[e.createElementVNode("text",{class:"label-icon"},"📞"),e.createElementVNode("text",{class:"label-text"},"联系方式")]),e.withDirectives(e.createElementVNode("input",{class:"item-input","onUpdate:modelValue":a[1]||(a[1]=e=>s.contact=e),placeholder:"手机号/微信号/邮箱","placeholder-class":"input-placeholder",maxlength:"100"},null,512),[[e.vModelText,s.contact]])])]),e.createElementVNode("view",{class:"button-section"},[e.createElementVNode("button",{class:"submit-btn",onClick:a[2]||(a[2]=(...e)=>l.handleSubmit&&l.handleSubmit(...e)),disabled:s.submitting},e.toDisplayString(s.submitting?"提交中...":"提交"),9,["disabled"])])])])}],["__scopeId","data-v-92d7a032"]]);const te=d({data:()=>({webviewUrl:"",loading:!0}),onLoad(){uni.getStorageSync("userId")||Date.now(),this.webviewUrl="https://fhapp.ddn-ai.cloud/",uni.showLoading({title:"加载中...",mask:!0}),setTimeout((()=>{this.loading=!1,uni.hideLoading()}),2e3)},methods:{handleLoad(){this.loading=!1,uni.hideLoading()},handleError(e){this.loading=!1,uni.hideLoading(),t("error","at pages/customer-service/customer-service.vue:51","[CustomerService] 加载失败:",e),uni.showToast({title:"页面加载失败",icon:"none"})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"customer-service-container"},[s.loading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"loading-overlay"},[e.createElementVNode("view",{class:"loading-content"},[e.createElementVNode("view",{class:"loading-spinner"}),e.createElementVNode("text",{class:"loading-text"},"正在加载客服页面...")])])):e.createCommentVNode("",!0),e.createElementVNode("web-view",{src:s.webviewUrl,onLoad:a[0]||(a[0]=(...e)=>l.handleLoad&&l.handleLoad(...e)),onError:a[1]||(a[1]=(...e)=>l.handleError&&l.handleError(...e))},null,40,["src"])])}],["__scopeId","data-v-379af02a"]]);const ae=d({data:()=>({imageUrl:"",imageFile:null,prompt:"",promptPlaceholder:"描述你想要的视频效果,支持中文,例如:一个人在微笑着说话,背景是温馨的客厅",duration:10,durations:[2,3,4,5,6,8,10,12],videoName:"",generating:!1,progress:0,progressText:"准备中...",generatedVideo:"",message:{text:"",type:"info"}}),methods:{chooseImage(){uni.chooseImage({count:1,sizeType:["compressed"],sourceType:["album","camera"],success:e=>{const a=e.tempFilePaths[0],o=e.tempFiles&&e.tempFiles[0]?e.tempFiles[0]:null,i=e=>{this.imageUrl=e,this.imageFile=o,this.showMessage("照片已选择","success")};uni.getFileInfo({filePath:a,success:e=>{const o=2097152;if(e.size&&e.size>o){this.showMessage("图片超过2MB,正在自动压缩...","info");const e=[60,40,20],s=(a,l)=>{a>=e.length?this.showMessage("图片压缩后仍超过2MB,请换一张更小的图片(建议拍照/截图后再上传)","error"):uni.compressImage({src:l,quality:e[a],success:e=>{uni.getFileInfo({filePath:e.tempFilePath,success:t=>{t.size&&t.size<=o?i(e.tempFilePath):s(a+1,e.tempFilePath)},fail:o=>{t("error","at pages/video-gen/video-gen.vue:176","获取压缩后文件信息失败:",o),s(a+1,e.tempFilePath)}})},fail:e=>{t("error","at pages/video-gen/video-gen.vue:182","压缩图片失败:",e),this.showMessage("图片过大且压缩失败,请换一张更小的图片","error")}})};s(0,a)}else i(a)},fail:e=>{t("error","at pages/video-gen/video-gen.vue:194","获取文件信息失败:",e),i(a)}})},fail:e=>{t("error","at pages/video-gen/video-gen.vue:200","选择图片失败:",e),this.showMessage("选择图片失败","error")}})},async generateVideo(){if(this.imageUrl){this.generating=!0,this.progress=0,this.progressText="正在上传照片...";try{this.progress=10,this.progressText="照片上传中...";const e=await function(e){const{url:t,filePath:a,name:o="file",formData:i={},timeout:l=s}=e,n=uni.getStorageSync("userId")||"",r=uni.getStorageSync("token")||"";return new Promise(((e,s)=>{uni.uploadFile({url:c(t),filePath:a,name:o,formData:{...i,userId:n||""},header:{"X-User-Id":n||"",...r?{Authorization:`Bearer ${r}`}:{}},timeout:l,success:t=>{if(200===t.statusCode)try{const a=JSON.parse(t.data);e(a)}catch(a){e(t.data)}else 401===t.statusCode?(uni.removeStorageSync("token"),uni.removeStorageSync("userId"),uni.removeStorageSync("userInfo"),uni.removeStorageSync("userPhone"),uni.removeStorageSync("userNickname"),uni.removeStorageSync("username"),uni.showToast({title:"登录已过期,请重新登录",icon:"none"}),setTimeout((()=>{uni.reLaunch({url:"/pages/login/login"})}),1500),s(new Error("Token expired"))):s(new Error(`上传失败: ${t.statusCode}`))},fail:e=>{s(e)}})}))}({url:"/api/photo-revival/volcengine-video",filePath:this.imageUrl,name:"photo",formData:{text:"",prompt:this.prompt||"",duration:this.duration,name:this.videoName||"火山引擎视频"}});this.progress=30,this.progressText="视频生成中,请稍候...";const t=setInterval((()=>{this.progress<90&&(this.progress+=2)}),2e3);setTimeout((()=>{if(clearInterval(t),this.progress=100,this.progressText="视频生成完成!","success"!==e.status)throw new Error(e.message||"视频生成失败");this.generatedVideo=i+e.videoUrl,this.showMessage("视频生成成功!","success"),this.generating=!1}),3e3)}catch(e){t("error","at pages/video-gen/video-gen.vue:261","生成视频失败:",e),this.showMessage("生成失败: "+(e.message||"未知错误"),"error"),this.generating=!1,this.progress=0}}else this.showMessage("请先上传照片","error")},saveToAlbum(){this.generatedVideo?uni.downloadFile({url:this.generatedVideo,success:e=>{200===e.statusCode&&uni.saveVideoToPhotosAlbum({filePath:e.tempFilePath,success:()=>{this.showMessage("已保存到相册","success")},fail:e=>{t("error","at pages/video-gen/video-gen.vue:285","保存失败:",e),this.showMessage("保存失败,请检查相册权限","error")}})},fail:e=>{t("error","at pages/video-gen/video-gen.vue:292","下载失败:",e),this.showMessage("下载失败","error")}}):this.showMessage("没有可保存的视频","error")},reset(){this.imageUrl="",this.imageFile=null,this.prompt="",this.duration=10,this.videoName="",this.generatedVideo="",this.progress=0,this.progressText="准备中...",this.message.text=""},showMessage(e,t="info"){this.message={text:e,type:t},setTimeout((()=>{this.message.text=""}),3e3)}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"video-gen-page"},[e.createElementVNode("view",{class:"header"},[e.createElementVNode("text",{class:"title"},"🎬 AI图生视频"),e.createElementVNode("text",{class:"subtitle"},"火山引擎 · doubao-seedance-1.0-pro")]),s.message.text?(e.openBlock(),e.createElementBlock("view",{key:0,class:e.normalizeClass(["message",s.message.type])},e.toDisplayString(s.message.text),3)):e.createCommentVNode("",!0),e.createElementVNode("scroll-view",{"scroll-y":"",class:"content"},[e.createElementVNode("view",{class:"section"},[e.createElementVNode("view",{class:"section-title"},"📸 上传照片"),e.createElementVNode("view",{class:"upload-area",onClick:a[0]||(a[0]=(...e)=>l.chooseImage&&l.chooseImage(...e))},[s.imageUrl?(e.openBlock(),e.createElementBlock("image",{key:0,src:s.imageUrl,class:"preview-image",mode:"aspectFit"},null,8,["src"])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"upload-placeholder"},[e.createElementVNode("text",{class:"upload-icon"},"📷"),e.createElementVNode("text",{class:"upload-text"},"点击上传照片"),e.createElementVNode("text",{class:"upload-hint"},"支持 JPG、PNG 格式")]))])]),e.createElementVNode("view",{class:"section"},[e.createElementVNode("view",{class:"section-title"},"✍️ 提示词(可选)"),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":a[1]||(a[1]=e=>s.prompt=e),class:"prompt-input",placeholder:s.promptPlaceholder,maxlength:500},null,8,["placeholder"]),[[e.vModelText,s.prompt]]),e.createElementVNode("view",{class:"char-count"},e.toDisplayString(s.prompt.length)+"/500",1)]),e.createElementVNode("view",{class:"section"},[e.createElementVNode("view",{class:"section-title"},"⏱️ 视频时长"),e.createElementVNode("view",{class:"duration-selector"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.durations,(t=>(e.openBlock(),e.createElementBlock("view",{key:t,class:e.normalizeClass(["duration-item",s.duration===t?"active":""]),onClick:e=>s.duration=t},e.toDisplayString(t)+"秒 ",11,["onClick"])))),128))])]),e.createElementVNode("view",{class:"section"},[e.createElementVNode("view",{class:"section-title"},"📝 视频名称(可选)"),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[2]||(a[2]=e=>s.videoName=e),class:"name-input",placeholder:"给视频起个名字",maxlength:50},null,512),[[e.vModelText,s.videoName]])]),e.createElementVNode("view",{class:"action-section"},[e.createElementVNode("button",{class:"generate-btn",disabled:!s.imageUrl||s.generating,onClick:a[3]||(a[3]=(...e)=>l.generateVideo&&l.generateVideo(...e))},[s.generating?(e.openBlock(),e.createElementBlock("text",{key:0},"⏳ 生成中...")):(e.openBlock(),e.createElementBlock("text",{key:1},"🎬 生成视频"))],8,["disabled"])]),s.generating?(e.openBlock(),e.createElementBlock("view",{key:0,class:"progress-section"},[e.createElementVNode("view",{class:"progress-text"},e.toDisplayString(s.progressText),1),e.createElementVNode("view",{class:"progress-bar"},[e.createElementVNode("view",{class:"progress-fill",style:e.normalizeStyle({width:s.progress+"%"})},null,4)])])):e.createCommentVNode("",!0),s.generatedVideo?(e.openBlock(),e.createElementBlock("view",{key:1,class:"result-section"},[e.createElementVNode("view",{class:"section-title"},"✅ 生成成功"),e.createElementVNode("video",{src:s.generatedVideo,class:"result-video",controls:"",autoplay:""},null,8,["src"]),e.createElementVNode("view",{class:"result-actions"},[e.createElementVNode("button",{class:"action-btn",onClick:a[4]||(a[4]=(...e)=>l.saveToAlbum&&l.saveToAlbum(...e))},"💾 保存到相册"),e.createElementVNode("button",{class:"action-btn secondary",onClick:a[5]||(a[5]=(...e)=>l.reset&&l.reset(...e))},"🔄 重新生成")])])):e.createCommentVNode("",!0),e.createElementVNode("view",{class:"tips-section"},[e.createElementVNode("view",{class:"tips-title"},"💡 使用提示"),e.createElementVNode("view",{class:"tip-item"},"• 支持 JPG、PNG 格式的照片"),e.createElementVNode("view",{class:"tip-item"},"• 提示词支持中文,可描述动作、表情、场景等"),e.createElementVNode("view",{class:"tip-item"},"• 视频时长支持 2-12 秒"),e.createElementVNode("view",{class:"tip-item"},"• 生成时间约 1-3 分钟,请耐心等待"),e.createElementVNode("view",{class:"tip-item"},"• 使用火山引擎 doubao-seedance-1.0-pro 模型")])])])}],["__scopeId","data-v-eca30c02"]]);const oe=d({data:()=>({API_BASE:i,veoDisabled:!1,veoMessage:"",volcengineDisabled:!1,volcengineMessage:"",saving:!1}),onLoad(){this.loadConfig()},methods:{goBack(){uni.navigateBack()},loadConfig(){t("log","at pages/admin/model-status.vue:97","[Admin] 加载模型状态配置..."),uni.showLoading({title:"加载中..."}),uni.request({url:`${this.API_BASE}/api/admin/system/model-status-config`,method:"GET",success:e=>{if(t("log","at pages/admin/model-status.vue:104","[Admin] 配置响应:",e),200===e.statusCode&&e.data&&e.data.success){const a=e.data.data;this.veoDisabled="true"===a.veo_disabled,this.veoMessage=a.veo_message||"",this.volcengineDisabled="true"===a.volcengine_disabled,this.volcengineMessage=a.volcengine_message||"",t("log","at pages/admin/model-status.vue:116","[Admin] 配置加载成功")}else uni.showToast({title:"加载配置失败",icon:"none"})},fail:e=>{t("error","at pages/admin/model-status.vue:125","[Admin] 加载配置失败:",e),uni.showToast({title:"网络错误",icon:"none"})},complete:()=>{uni.hideLoading()}})},onVeoStatusChange(e){this.veoDisabled=!e.detail.value,t("log","at pages/admin/model-status.vue:140","[Admin] Veo状态:",this.veoDisabled?"禁用":"启用")},onVolcengineStatusChange(e){this.volcengineDisabled=!e.detail.value,t("log","at pages/admin/model-status.vue:146","[Admin] 火山引擎状态:",this.volcengineDisabled?"禁用":"启用")},saveConfig(){if(t("log","at pages/admin/model-status.vue:151","[Admin] 保存配置..."),this.veoDisabled&&!this.veoMessage.trim())return void uni.showToast({title:"Veo模型已禁用,请填写维护提示信息",icon:"none",duration:2e3});if(this.volcengineDisabled&&!this.volcengineMessage.trim())return void uni.showToast({title:"火山引擎模型已禁用,请填写维护提示信息",icon:"none",duration:2e3});this.saving=!0,uni.showLoading({title:"保存中..."});const e={veo_disabled:this.veoDisabled?"true":"false",veo_message:this.veoMessage,volcengine_disabled:this.volcengineDisabled?"true":"false",volcengine_message:this.volcengineMessage};uni.request({url:`${this.API_BASE}/api/admin/system/model-status-config`,method:"POST",header:{"Content-Type":"application/json"},data:e,success:e=>{var a;t("log","at pages/admin/model-status.vue:190","[Admin] 保存响应:",e),200===e.statusCode&&e.data&&e.data.success?(uni.showToast({title:"保存成功",icon:"success"}),setTimeout((()=>{uni.navigateBack()}),1500)):uni.showToast({title:(null==(a=e.data)?void 0:a.message)||"保存失败",icon:"none"})},fail:e=>{t("error","at pages/admin/model-status.vue:209","[Admin] 保存失败:",e),uni.showToast({title:"网络错误",icon:"none"})},complete:()=>{this.saving=!1,uni.hideLoading()}})}}},[["render",function(t,a,o,i,s,l){return e.openBlock(),e.createElementBlock("view",{class:"admin-container"},[e.createElementVNode("view",{class:"header"},[e.createElementVNode("view",{class:"back-btn",onClick:a[0]||(a[0]=(...e)=>l.goBack&&l.goBack(...e))},"← 返回"),e.createElementVNode("text",{class:"title"},"模型状态管理"),e.createElementVNode("view",{class:"placeholder"})]),e.createElementVNode("scroll-view",{"scroll-y":"",class:"content"},[e.createElementVNode("view",{class:"intro-card"},[e.createElementVNode("text",{class:"intro-text"},"💡 在此管理各个模型的可用状态。当第三方接口更新时,可以临时禁用模型并显示维护信息。")]),e.createElementVNode("view",{class:"model-card"},[e.createElementVNode("view",{class:"model-header"},[e.createElementVNode("text",{class:"model-name"},"Veo 模型"),e.createElementVNode("switch",{checked:!s.veoDisabled,onChange:a[1]||(a[1]=(...e)=>l.onVeoStatusChange&&l.onVeoStatusChange(...e)),color:"#8B7355"},null,40,["checked"])]),e.createElementVNode("view",{class:"model-status"},[e.createElementVNode("text",{class:"status-label"},"状态:"),e.createElementVNode("text",{class:e.normalizeClass(["status-value",s.veoDisabled?"disabled":"enabled"])},e.toDisplayString(s.veoDisabled?"已禁用":"正常"),3)]),e.createElementVNode("view",{class:"form-group"},[e.createElementVNode("text",{class:"form-label"},"维护提示信息"),e.withDirectives(e.createElementVNode("textarea",{class:"form-textarea","onUpdate:modelValue":a[2]||(a[2]=e=>s.veoMessage=e),placeholder:"请输入维护提示信息,例如:官方接口参数更新,正在处理中,暂不可用",maxlength:"200"},null,512),[[e.vModelText,s.veoMessage]]),e.createElementVNode("view",{class:"char-count"},e.toDisplayString(s.veoMessage.length)+" / 200",1)])]),e.createElementVNode("view",{class:"model-card"},[e.createElementVNode("view",{class:"model-header"},[e.createElementVNode("text",{class:"model-name"},"火山引擎模型"),e.createElementVNode("switch",{checked:!s.volcengineDisabled,onChange:a[3]||(a[3]=(...e)=>l.onVolcengineStatusChange&&l.onVolcengineStatusChange(...e)),color:"#8B7355"},null,40,["checked"])]),e.createElementVNode("view",{class:"model-status"},[e.createElementVNode("text",{class:"status-label"},"状态:"),e.createElementVNode("text",{class:e.normalizeClass(["status-value",s.volcengineDisabled?"disabled":"enabled"])},e.toDisplayString(s.volcengineDisabled?"已禁用":"正常"),3)]),e.createElementVNode("view",{class:"form-group"},[e.createElementVNode("text",{class:"form-label"},"维护提示信息"),e.withDirectives(e.createElementVNode("textarea",{class:"form-textarea","onUpdate:modelValue":a[4]||(a[4]=e=>s.volcengineMessage=e),placeholder:"请输入维护提示信息,例如:官方接口参数更新,正在处理中,暂不可用",maxlength:"200"},null,512),[[e.vModelText,s.volcengineMessage]]),e.createElementVNode("view",{class:"char-count"},e.toDisplayString(s.volcengineMessage.length)+" / 200",1)])]),e.createElementVNode("button",{class:"save-btn",onClick:a[5]||(a[5]=(...e)=>l.saveConfig&&l.saveConfig(...e)),disabled:s.saving},[s.saving?(e.openBlock(),e.createElementBlock("text",{key:0},"保存中...")):(e.openBlock(),e.createElementBlock("text",{key:1},"💾 保存配置"))],8,["disabled"])])])}],["__scopeId","data-v-dda586f4"]]);__definePage("pages/index/index",u),__definePage("pages/plaza/plaza",h),__definePage("pages/revival/revival",b),__definePage("pages/revival/revival-original",P),__definePage("pages/revival/revival-history",I),__definePage("pages/video-player/video-player",A),__definePage("pages/video-call/video-call",B),__definePage("pages/video-call-new/video-call-new",D),__definePage("pages/history/history",L),__definePage("pages/phone-call/phone-call",M),__definePage("pages/login/login",_),__definePage("pages/register/register",U),__definePage("pages/forgot-password/forgot-password",R),__definePage("pages/my-works/my-works",F),__definePage("pages/settings/settings",$),__definePage("pages/profile/edit-profile",O),__definePage("pages/history-record/history-record",H),__definePage("pages/short-drama/short-drama",z),__definePage("pages/upload-audio/upload-audio",W),__definePage("pages/settings/change-password",j),__definePage("pages/settings/bind-phone",q),__definePage("pages/settings/privacy-policy",G),__definePage("pages/settings/user-agreement",K),__definePage("pages/settings/about",X),__definePage("pages/settings/complaint",ee),__definePage("pages/customer-service/customer-service",te),__definePage("pages/video-gen/video-gen",ae),__definePage("pages/admin/model-status",oe);const ie={onLaunch(e){t("log","at App.vue:9","App Launch"),this.cleanVideoCache(),this.loadAppConfig(),this.loadServicePrices(),this.setupPaymentInterceptor(),this.getUserIdentity(),this.requestPermissions()},onShow(){t("log","at App.vue:53","App Show")},onHide(){t("log","at App.vue:80","App Hide")},methods:{cleanVideoCache(){try{const e=function(){try{const e=uni.getStorageSync("video_cache_info")||{},a=Date.now();let o=0;return Object.keys(e).forEach((i=>{const s=e[i];a-s.time>2592e6&&(t("log","at utils/videoCacheManager.js:22","[CacheManager] 清理过期缓存:",s.url),uni.removeSavedFile({filePath:s.path,success:()=>{t("log","at utils/videoCacheManager.js:27","[CacheManager] 文件已删除:",s.path)}}),uni.removeStorageSync(i),delete e[i],o++)})),o>0&&(uni.setStorageSync("video_cache_info",e),t("log","at utils/videoCacheManager.js:40",`[CacheManager] 已清理 ${o} 个过期缓存`)),o}catch(e){return t("error","at utils/videoCacheManager.js:45","[CacheManager] 清理缓存失败:",e),0}}(),a=function(){try{const e=uni.getStorageSync("video_cache_info")||{},a=Object.keys(e).map((t=>({key:t,...e[t]})));if(a.length<=50)return 0;a.sort(((e,t)=>e.time-t.time));const o=a.length-50;let i=0;for(let s=0;s{t("log","at utils/videoCacheManager.js:78","[CacheManager] 文件已删除:",o.path)}}),uni.removeStorageSync(o.key),delete e[o.key],i++}return i>0&&(uni.setStorageSync("video_cache_info",e),t("log","at utils/videoCacheManager.js:90",`[CacheManager] 已清理 ${i} 个旧缓存`)),i}catch(e){return t("error","at utils/videoCacheManager.js:95","[CacheManager] 清理缓存失败:",e),0}}();(e>0||a>0)&&t("log","at App.vue:146",`[App] 视频缓存清理完成:过期${e}个,旧缓存${a}个`)}catch(e){t("error","at App.vue:149","[App] 清理视频缓存失败:",e)}},async loadAppConfig(){try{uni.removeStorageSync("appConfig"),t("log","at App.vue:158","[App] 缓存已清除,重新加载配置");const e=await uni.request({url:`${i}${l.getAppConfig}`,method:"GET",header:{"Content-Type":"application/json"}}),a=Array.isArray(e)?e[1]:e;if(a&&a.data&&a.data.success&&a.data.data){const e=a.data.data;uni.setStorageSync("appConfig",e),t("log","at App.vue:175","[App] 应用配置已加载:",e)}}catch(e){t("error","at App.vue:178","[App] 加载应用配置失败:",e)}},async loadServicePrices(){try{await y(),t("log","at App.vue:185","[App] 服务价格已加载")}catch(e){t("error","at App.vue:187","[App] 加载服务价格失败:",e)}},async getUserIdentity(){},setupPaymentInterceptor(){const e=e=>{try{if(!(()=>{const e=uni.getStorageSync("token")||"",t=uni.getStorageSync("userId")||"";return!(!e||!t)})())return void uni.showModal({title:"提示",content:"请先登录后再继续",confirmText:"去登录",cancelText:"取消",success:e=>{e.confirm&&uni.reLaunch({url:"/pages/login/login"})}});const t=e||p.PHOTO_REVIVAL.type;let o=this;try{const e="function"==typeof getCurrentPages?getCurrentPages():[],t=e&&e.length?e[e.length-1]:null;t&&t.$vm&&(o=t.$vm)}catch(a){}T(o,t)}catch(a){t("error","at App.vue:317","[Payment] 402拦截弹窗失败:",a)}},a=(a,o)=>{try{const t=a&&a.url?a.url:"";let s=null;try{s=o&&"string"==typeof o.data?JSON.parse(o.data):o?o.data:null}catch(i){s=null}const l=s&&(s.serviceType||s.service_type),n=("CREATE_VOICE"===l?p.VOICE_CLONE.type:"PHOTO_REVIVAL"===l?p.PHOTO_REVIVAL.type:"VOLCENGINE_VIDEO"===l?p.VOLCENGINE_VIDEO?p.VOLCENGINE_VIDEO.type:"":"SYNTHESIZE"===l?p.TTS_SYNTHESIS.type:"VIDEO_CALL"===l?p.VIDEO_CALL.type:"AI_CALL"===l?p.CONVERSATION.type:"")||(e=>{const t=String(e||"");return t.includes("/api/photo-revival/")?p.PHOTO_REVIVAL.type:t.includes("/api/voice/")?p.VOICE_CLONE.type:t.includes("/api/tts/")?p.TTS_SYNTHESIS.type:t.includes("/api/video-call")?p.VIDEO_CALL.type:t.includes("/api/conversation/")?p.CONVERSATION.type:""})(t);e(n)}catch(i){t("error","at App.vue:341","[Payment] 402拦截处理失败:",i)}},o=e=>{let t=null;uni.addInterceptor(e,{invoke:e=>(t=e,e),returnValue(e){try{if(e&&"function"==typeof e.then)return e.then((e=>{try{const o=Array.isArray(e)?e[1]:e;o&&402===o.statusCode&&a(t,o)}catch(o){}return e}));const o=Array.isArray(e)?e[1]:e;if(o&&402===o.statusCode){const i=Array.isArray(e)?e[0]:t;a(i,o)}}catch(o){}return e}})};o("request"),o("uploadFile")},async requestPermissions(){try{t("log","at App.vue:391","[App] 开始请求App权限"),await f.requestPermissionsOnLaunch()}catch(e){t("error","at App.vue:394","[App] 请求权限失败:",e)}}}};const{app:se,Vuex:le,Pinia:ne}=function(){const t=e.createVueApp(ie);return t.config.globalProperties.$apiBase=i,{app:t}}();uni.Vuex=le,uni.Pinia=ne,se.provide("__globalStyles",__uniConfig.styles),se._component.mpType="app",se._component.render=()=>{},se.mount("#app")}(Vue);